Author: scabanovich
Date: 2009-12-23 09:52:18 -0500 (Wed, 23 Dec 2009)
New Revision: 19555
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/JBRListenerConverter.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb12.meta
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBLoaderUtil.java
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBOrderedChildren.java
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificPropertyConverter.java
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddProviderSupport.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5548
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb12.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb12.meta 2009-12-23
14:40:36 UTC (rev 19554)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb12.meta 2009-12-23
14:52:18 UTC (rev 19555)
@@ -365,7 +365,8 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
- <XModelEntity
ImplementingClass="org.jboss.tools.esb.core.model.impl.FTPListenerSpecificPropertiesImpl"
+ <XModelEntity
+
ImplementingClass="org.jboss.tools.esb.core.model.impl.FTPListenerSpecificPropertiesImpl"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;converter=converter"
name="ESBFTPRemote">
<XChildrenEntities/>
<XEntityRenderer>
@@ -589,6 +590,177 @@
<XDependencies/>
</XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
+
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%;hasConvertedProperties=true"
+ XMLSUBPATH="jbr-bus" name="ESBJBRBus120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ <XChildEntity maxCount="1" name="ESBJBRConfig"
required="yes"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.bus" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="channel" loader="ElementType"
name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="id" xmlname="busid"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ name="port" xmlname="port">
+ <Constraint loader="%IntEL%"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment"
visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions">
+ <XActionItemReference entity="ESBAction101" name="AddProperty"
path="CreateActions/AddProperty"/>
+ </XActionItem>
+ <XActionItem ICON="action.empty" displayName="Create"
kind="list" name="EditActions"/>
+ <XActionItemReference entity="ESBProperty"
name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty"
name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty"
name="Properties"/>
+ <XActionItemReference entity="ESBProperty"
name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
+
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;converter=converter"
name="ESBJBRConfig">
+ <XChildrenEntities/>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.property" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="JBR Gateway Config"
loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true"
+ default="Config" name="name" visibility="false"
xmlname="name">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ default="Default(true)" name="synchronous"
xmlname="synchronous">
+ <Constraint loader="ListString">
+ <value name="Default(true)"/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ name="service invoker timeout"
xmlname="serviceInvokerTimeout"/>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ name="async response" xmlname="asyncResponse"/>
+ <XModelAttribute TRIM="no" name="comment"
visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem ICON="action.empty" displayName="Create"
kind="list" name="EditActions"/>
+ <XActionItemReference entity="ESBPreAlias"
name="CopyActions"/>
+ <XActionItemReference entity="ESBPreAlias"
name="DeleteActions"/>
+ <XActionItemReference entity="ESBPreAlias"
name="Properties"/>
+ <XActionItemReference entity="ESBPreAlias"
name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
+
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%;hasConvertedProperties=true"
+ XMLSUBPATH="jbr-listener" name="ESBJBRListener120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ <XChildEntity maxCount="1" name="ESBJBRConfig"
required="yes"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.listener" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="jbr listener" loader="ElementType"
name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttributeReference
+ attributes="name,channel id ref,max threads,is gateway"
+ entity="ESBListener101" name="listener"/>
+ <XModelAttribute TRIM="no" name="comment"
visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions">
+ <XActionItemReference entity="ESBAction101" name="AddProperty"
path="CreateActions/AddProperty"/>
+ </XActionItem>
+ <XActionItem ICON="action.empty" displayName="Create"
kind="list" name="EditActions"/>
+ <XActionItemReference entity="ESBProperty"
name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty"
name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty"
name="Properties"/>
+ <XActionItemReference entity="ESBProperty"
name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
+
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%ESBOrdered%;hasConvertedProperties=true"
+ XMLSUBPATH="jbr-provider" name="ESBJBRProvider120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ <XChildEntity name="ESBBus"/>
+ <XChildEntity name="ESBJBRBus120"/>
+ <XChildEntity maxCount="1" name="ESBJBRConfig"
required="yes"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.provider" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="jbr provider" loader="ElementType"
name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="name" xmlname="name"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ default="http" name="protocol" xmlname="protocol">
+ <Constraint loader="List">
+ <value name="http"/>
+ <value name="https"/>
+ <value name="socket"/>
+ <value name="sslsocket"/>
+ </Constraint>
+ <Editor name="List"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general" name="host"
xmlname="host"/>
+ <XModelAttribute TRIM="no" name="comment"
visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem ICON="action.empty" displayName="New"
group="1"
+ kind="list" name="CreateActions">
+ <XActionItemReference entity="ESBAction101" name="AddProperty"
path="CreateActions/AddProperty"/>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="JBR Bus..." kind="action"
name="AddBus">
+ <EntityData EntityName="ESBJBRBus120">
+ <AttributeData AttributeName="id"/>
+ <AttributeData AttributeName="port"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
+ <XActionItem ICON="action.empty" displayName="Create"
kind="list" name="EditActions"/>
+ <XActionItemReference entity="ESBProperty"
name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty"
name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty"
name="Properties"/>
+ <XActionItemReference entity="ESBProperty"
name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%ESBOrdered%"
XMLSUBPATH="jca-gateway" name="ESBJCAGateway120">
<XChildrenEntities>
@@ -639,8 +811,7 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
- <XModelEntity
- ImplementingClass="%ESB%"
+ <XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"
XMLSUBPATH="listener" name="ESBListener120">
<XChildrenEntities>
@@ -688,7 +859,7 @@
<XChildEntity name="ESBFTPListener120"/>
<XChildEntity name="ESBSQLListener120"/>
<XChildEntity name="ESBHibernateListener101"/>
- <XChildEntity name="ESBJBRListener101"/>
+ <XChildEntity name="ESBJBRListener120"/>
<XChildEntity name="ESBGroovyListener101"/>
<XChildEntity name="ESBHTTPGateway120"/>
<XChildEntity name="ESBUDPListener110"/>
@@ -748,7 +919,7 @@
ICON="action.empty" PROPERTIES="validator.add=true"
WizardClassName="%Default%" displayName="JBR Listener..."
kind="action" name="AddJBRListener">
- <EntityData EntityName="ESBJBRListener101">
+ <EntityData EntityName="ESBJBRListener120">
<AttributeData AttributeName="name"/>
<AttributeData AttributeName="channel id ref"
Mandatory="no"/>
</EntityData>
@@ -856,7 +1027,7 @@
XMLSUBPATH="providers" name="ESBProviders120">
<XChildrenEntities>
<XChildEntity name="ESBBusProvider101"/>
- <XChildEntity name="ESBJBRProvider101"/>
+ <XChildEntity name="ESBJBRProvider120"/>
<XChildEntity name="ESBScheduleProvider101"/>
<XChildEntity name="ESBJMSProvider101"/>
<XChildEntity name="ESBJCAProvider101"/>
@@ -901,7 +1072,19 @@
<AttributeData AttributeName="id"/>
</EntityData>
</XActionItem>
- <XActionItemReference entity="ESBProviders101"
name="AddJBRProvider" path="CreateActions/AddJBRProvider"/>
+ <XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
+
PROPERTIES="validator.add=true;support=org.jboss.tools.esb.core.model.handlers.AddProviderSupport;busEntity=ESBJBRBus120"
+ displayName="JBR Provider..." kind="action"
name="AddJBRProvider">
+ <EntityData EntityName="ESBJBRProvider120">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="protocol"/>
+ <AttributeData AttributeName="host" Mandatory="no"/>
+ </EntityData>
+ <EntityData EntityName="ESBBusCreator">
+ <AttributeData AttributeName="id"/>
+ <AttributeData AttributeName="port"/>
+ </EntityData>
+ </XActionItem>
<XActionItemReference entity="ESBProviders101"
name="AddJCAProvider" path="CreateActions/AddJCAProvider"/>
<XActionItemReference entity="ESBProviders101"
name="AddJMSProvider" path="CreateActions/AddJMSProvider"/>
<XActionItemReference entity="ESBProviders101"
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBLoaderUtil.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBLoaderUtil.java 2009-12-23
14:40:36 UTC (rev 19554)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBLoaderUtil.java 2009-12-23
14:52:18 UTC (rev 19555)
@@ -56,9 +56,9 @@
String entity = o.getModelEntity().getName();
if(SpecificActionLoader.instance.isActionsFolder(entity)) {
SpecificActionLoader.instance.convertChildrenToSpecific(o);
- } else if(SpecificPropertyConverter.instance.isListenersFolder(entity)) {
- SpecificPropertyConverter.instance.convertChildrenToSpecific(o);
- } //TODO add other folders
+ } else
if("true".equals(o.getModelEntity().getProperty("hasConvertedProperties")))
{
+ SpecificPropertyConverter.instance.convertBasicToSpecific(o);
+ }
}
public boolean save(Element parent, XModelObject o) {
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBOrderedChildren.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBOrderedChildren.java 2009-12-23
14:40:36 UTC (rev 19554)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/ESBOrderedChildren.java 2009-12-23
14:52:18 UTC (rev 19555)
@@ -18,11 +18,18 @@
*/
public class ESBOrderedChildren extends GroupOrderedChildren {
+ protected int getGroupCount() {
+ return 3;
+ }
+
protected int getGroup(XModelObject o) {
if(o != null &&
ESBConstants.ENT_ESB_PROPERTY.equals(o.getModelEntity().getName())) {
return 0;
}
- return 1;
+ if("ESBJBRConfig".equals(o.getModelEntity().getName())) {
+ return 1;
+ }
+ return 2;
}
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificPropertyConverter.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificPropertyConverter.java 2009-12-23
14:40:36 UTC (rev 19554)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificPropertyConverter.java 2009-12-23
14:52:18 UTC (rev 19555)
@@ -14,6 +14,7 @@
import org.jboss.tools.common.model.impl.RegularObjectImpl;
import org.jboss.tools.esb.core.model.converters.FTPListenerConverter;
import org.jboss.tools.esb.core.model.converters.IPropertyConverter;
+import org.jboss.tools.esb.core.model.converters.JBRListenerConverter;
/**
* When loading from xml, reads 'raw' list of esb property children of loaded
object
@@ -37,30 +38,16 @@
return entity.startsWith(ENT_ESB_LISTENERS);
}
- public void convertChildrenToSpecific(XModelObject actions) {
- boolean modified = false;
+ static String JBR_ENTITIES =
".ESBJBRProvider120.ESBJBRListener120.ESBJBRBus120.";
- XModelObject[] as = actions.getChildren();
- for (int i = 0; i < as.length; i++) {
- XModelObject action = convertBasicToSpecific(actions, as[i]);
- if(action != null) {
- as[i] = action;
- modified = true;
- }
- }
- if(modified) {
- ((RegularObjectImpl)actions).replaceChildren(as);
- }
-
- }
-
- public XModelObject convertBasicToSpecific(XModelObject parent, XModelObject basic) {
+ public XModelObject convertBasicToSpecific(XModelObject basic) {
String entity = basic.getModelEntity().getName();
if("ESBFTPListener120".equals(entity)) {
FTPListenerConverter.instance.toSpecific(basic, basic);
+ } else if(JBR_ENTITIES.indexOf("." + entity + ".") >= 0) {
+ JBRListenerConverter.instance.toSpecific(basic, basic);
}
- //returns null because no new object is created
- return null;
+ return basic;
}
public XModelObject convertSpecificToBasic(XModelObject specific) {
@@ -69,6 +56,9 @@
if("ESBFTPListener120".equals(entity)) {
basic = basic.copy();
FTPListenerConverter.instance.toBasic(basic, specific);
+ } else if(JBR_ENTITIES.indexOf("." + entity + ".") >= 0) {
+ basic = basic.copy();
+ JBRListenerConverter.instance.toBasic(basic, specific);
}
return basic;
}
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/JBRListenerConverter.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/JBRListenerConverter.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/JBRListenerConverter.java 2009-12-23
14:52:18 UTC (rev 19555)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.core.model.converters;
+
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.esb.core.model.SpecificActionLoader;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class JBRListenerConverter implements IPropertyConverter {
+ public static JBRListenerConverter instance = new JBRListenerConverter();
+
+ public JBRListenerConverter() {}
+
+ public void toBasic(XModelObject basic, XModelObject specific) {
+ XModelObject config = specific.getChildByPath("Config");
+ if(config != null) {
+ SpecificActionLoader.copySpecificAtttributesToBasicProperties(config, basic);
+ }
+ }
+
+ public void toSpecific(XModelObject basic, XModelObject specific) {
+ XModelObject config = specific.getChildByPath("Config");
+ if(config != null) {
+ SpecificActionLoader.copyBasicPropertiesToSpecificAtttributes(basic, config);
+ }
+ }
+
+}
Property changes on:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/JBRListenerConverter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddProviderSupport.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddProviderSupport.java 2009-12-23
14:40:36 UTC (rev 19554)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddProviderSupport.java 2009-12-23
14:52:18 UTC (rev 19555)
@@ -62,7 +62,7 @@
protected void execute() throws XModelException {
Properties p0 = extractStepData(0);
- XModelObject provider = getTarget().getModel().createModelObject(providerEntity, p0);
+ XModelObject provider =
XModelObjectLoaderUtil.createValidObject(getTarget().getModel(), providerEntity, p0);
Properties p1 = extractStepData(1);
XModelObject bus = XModelObjectLoaderUtil.createValidObject(getTarget().getModel(),
busEntity, p1);