Author: objectiser
Date: 2009-03-28 08:41:24 -0400 (Sat, 28 Mar 2009)
New Revision: 558
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElement.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElementFactory.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstructTest.java
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElement.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElementFactory.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELSequenceActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELElement.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/DefaultBPELLanguageModel.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractGroupingActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractInteractionActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/Condition.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstruct.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstruct.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/IfActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/SequenceActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/AbstractBPELModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationInteractionModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhileModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ConditionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstructTest.java
Log:
Some additional refactoring.
Deleted:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElement.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElement.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElement.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.bpel.model;
-
-public interface BPELElement {
-
- /**
- * This method returns the XML configuration representation
- * of the activity.
- *
- * @return The XML configuration for the activity
- */
- public org.w3c.dom.Element getDOMElement();
-
-}
Deleted:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElementFactory.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElementFactory.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElementFactory.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.bpel.model;
-
-import java.util.logging.Logger;
-
-public class BPELElementFactory {
-
- public static final String MODEL_ACTIVITIES_PACKAGE =
- "org.jboss.tools.overlord.cdl.bpel.model.activities";
- private static final String ACTIVITY_SUFFIX="Activity";
-
- /**
- * This method creates a BPELActivity instance relevant to the
- * supplied JBossESB action, associated with the supplied
- * service.
- *
- * @param model The BPEL model
- * @param activity The XML configuration of the BPEL activity
- * @return The BPEL activity instance
- */
- public static BPELElement createActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- BPELElement ret=null;
- String activityType=activity.getNodeName();
-
- // Make first character capitalised
- char ch=Character.toUpperCase(activityType.charAt(0));
-
- activityType = ch+activityType.substring(1);
-
- String clsName=MODEL_ACTIVITIES_PACKAGE+"."+activityType+
- ACTIVITY_SUFFIX;
-
- try {
- Class<?> cls=(Class<?>)
- Class.forName(clsName);
-
- java.lang.reflect.Constructor<?> con=
- cls.getConstructor(new Class<?>[]{BPELLanguageModel.class,
- org.w3c.dom.Element.class});
-
- ret = (BPELElement)con.newInstance(new Object[]{model, activity});
-
- } catch(Exception e) {
- logger.log(java.util.logging.Level.FINEST,
- "Unable to find action class '"+clsName+"'", e);
- }
-
- return(ret);
- }
-
- private static Logger logger =
Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
-}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELLanguageModel.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELLanguageModel.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELLanguageModel.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -17,6 +17,7 @@
*/
package org.jboss.tools.overlord.cdl.bpel.model;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.SequenceActivity;
import org.scribble.model.*;
import org.scribble.model.admin.ModelListener;
@@ -55,7 +56,7 @@
*
* @return The top level grouping activity
*/
- public BPELSequenceActivity getActivity();
+ public SequenceActivity getActivity();
/**
* This method returns the reference to the DOM
Deleted:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELSequenceActivity.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELSequenceActivity.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELSequenceActivity.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.bpel.model;
-
-public interface BPELSequenceActivity extends BPELElement {
-
- /**
- * This method adds an activity to the grouping construct.
- *
- * @param act The activity to be added
- * @param pos The position to add, or -1 if at the end
- */
- public void addActivity(BPELElement act, int pos);
-
- /**
- * This method removes an activity from the grouping
- * construct.
- *
- * @param act The activity to be removed
- * @return Whether the activity was removed
- */
- public boolean removeActivity(BPELElement act);
-
- /**
- * This method returns the list of activities associated
- * with the grouping construct.
- *
- * @return The list of activities
- */
- public java.util.List<BPELElement> getActivities();
-
-}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/DefaultBPELLanguageModel.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/DefaultBPELLanguageModel.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/DefaultBPELLanguageModel.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -19,6 +19,7 @@
import java.util.logging.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.SequenceActivity;
import org.scribble.conversation.model.*;
import org.scribble.extensions.RegistryFactory;
import org.scribble.model.*;
@@ -140,7 +141,7 @@
*
* @return The top level grouping activity
*/
- public BPELSequenceActivity getActivity() {
+ public SequenceActivity getActivity() {
return(m_activity);
}
@@ -149,7 +150,7 @@
*
* @param act The top level activity
*/
- public void setActivity(BPELSequenceActivity act) {
+ public void setActivity(SequenceActivity act) {
m_activity = act;
m_bpelProcess.appendChild(act.getDOMElement());
@@ -170,7 +171,7 @@
private ModelReference m_source=null;
private org.w3c.dom.Element m_bpelProcess=null;
private String m_contents=null;
- private BPELSequenceActivity m_activity=null;
+ private SequenceActivity m_activity=null;
public class InnerModelListener implements ModelListener {
Deleted:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELElement.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELElement.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELElement.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -1,169 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.bpel.model.activities;
-
-import java.util.logging.Logger;
-
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelIssue;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This is the generic BPEL element class.
- *
- * @author gary
- */
-public abstract class AbstractBPELElement extends ModelObject
- implements BPELElement {
-
- private static final long serialVersionUID = -7306844554703224704L;
-
- /**
- * The constructor for initializing the BPEL element based on
- * an existing DOM element.
- */
- protected AbstractBPELElement(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- m_model = model;
-
- initExistingElement(model, activity);
- }
-
- /**
- * The contructor for initializing a new element.
- */
- protected AbstractBPELElement(BPELLanguageModel model,
- String activityName) {
- m_model = model;
-
- initNewElement(model, activityName);
- }
-
- /**
- * This method initializes the activity.
- *
- * @param model The BPEL model
- * @param activity The activity name
- */
- protected void initNewElement(BPELLanguageModel model,
- String activity) {
- m_activity = model.getBPELProcess().
- getOwnerDocument().createElement(activity);
-
- getSource().setObject(this);
- }
-
- /**
- * This method initializes the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- protected void initExistingElement(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- m_activity = activity;
-
- // TODO: Set the start/end position information
- // in the source details
-
- getSource().setObject(this);
- }
-
- /**
- * This method validates the ESB action and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- public void validate(ModelListener l) {
- }
-
-
- /**
- * This method returns the XML configuration representation
- * of the activity.
- *
- * @return The XML configuration for the activity
- */
- public org.w3c.dom.Element getDOMElement() {
- return(m_activity);
- }
-
- /**
- * This method returns the element associated with
- * the supplied name.
- *
- * @param name The name
- * @return The element, or null if not found
- */
- protected org.w3c.dom.Element findElement(String name) {
- org.w3c.dom.Element ret=null;
-
- org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
-
- for (int i=0; ret == null && i < nl.getLength(); i++) {
- org.w3c.dom.Node n=nl.item(i);
-
- if (n instanceof org.w3c.dom.Element &&
- n.getLocalName().equals(name)) {
- ret = (org.w3c.dom.Element)nl.item(i);
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the first child BPEL activity
- * found within the DOM element.
- *
- * @return The child BPEL activity, or null if not found
- */
- protected BPELElement findChildActivity() {
- BPELElement ret=null;
-
- org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
-
- for (int i=0; ret == null &&
- i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- ret = BPELElementFactory.createActivity(m_model,
- (org.w3c.dom.Element)nl.item(i));
- }
- }
-
- return(ret);
- }
-
- /**
- * This method converts the BPEL activity into an equivalent
- * behavioural description for conformance checking.
- *
- * @param activities The list of activities that will contain
- * the converted action(s)
- * @param context The conversion context
- */
- public abstract void convert(java.util.List<Activity> activities,
- ConversionContext context);
-
- private static Logger logger =
Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
-
- private BPELLanguageModel m_model=null;
- private org.w3c.dom.Element m_activity=null;
-}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractGroupingActivity.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractGroupingActivity.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractGroupingActivity.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public abstract class AbstractGroupingActivity extends AbstractBPELElement {
+public abstract class AbstractGroupingActivity extends BPELElement {
/**
* The constructor for initializing the activity based on
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractInteractionActivity.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractInteractionActivity.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractInteractionActivity.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public abstract class AbstractInteractionActivity extends AbstractBPELElement {
+public abstract class AbstractInteractionActivity extends BPELElement {
private static final long serialVersionUID = -5048477859609625462L;
Copied:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElement.java
(from rev 557,
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELElement.java)
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElement.java
(rev 0)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElement.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.bpel.model.activities;
+
+import java.util.logging.Logger;
+
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelIssue;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This is the generic BPEL element class.
+ *
+ * @author gary
+ */
+public abstract class BPELElement extends ModelObject {
+
+ private static final long serialVersionUID = -7306844554703224704L;
+
+ /**
+ * The constructor for initializing the BPEL element based on
+ * an existing DOM element.
+ */
+ protected BPELElement(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ m_model = model;
+
+ initExistingElement(model, activity);
+ }
+
+ /**
+ * The contructor for initializing a new element.
+ */
+ protected BPELElement(BPELLanguageModel model,
+ String activityName) {
+ m_model = model;
+
+ initNewElement(model, activityName);
+ }
+
+ /**
+ * This method initializes the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The activity name
+ */
+ protected void initNewElement(BPELLanguageModel model,
+ String activity) {
+ m_activity = model.getBPELProcess().
+ getOwnerDocument().createElement(activity);
+
+ getSource().setObject(this);
+ }
+
+ /**
+ * This method initializes the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ protected void initExistingElement(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ m_activity = activity;
+
+ // TODO: Set the start/end position information
+ // in the source details
+
+ getSource().setObject(this);
+ }
+
+ /**
+ * This method validates the ESB action and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ public void validate(ModelListener l) {
+ }
+
+
+ /**
+ * This method returns the XML configuration representation
+ * of the activity.
+ *
+ * @return The XML configuration for the activity
+ */
+ public org.w3c.dom.Element getDOMElement() {
+ return(m_activity);
+ }
+
+ /**
+ * This method returns the element associated with
+ * the supplied name.
+ *
+ * @param name The name
+ * @return The element, or null if not found
+ */
+ protected org.w3c.dom.Element findElement(String name) {
+ org.w3c.dom.Element ret=null;
+
+ org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
+
+ for (int i=0; ret == null && i < nl.getLength(); i++) {
+ org.w3c.dom.Node n=nl.item(i);
+
+ if (n instanceof org.w3c.dom.Element &&
+ n.getLocalName().equals(name)) {
+ ret = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the first child BPEL activity
+ * found within the DOM element.
+ *
+ * @return The child BPEL activity, or null if not found
+ */
+ protected BPELElement findChildActivity() {
+ BPELElement ret=null;
+
+ org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
+
+ for (int i=0; ret == null &&
+ i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ ret = BPELElementFactory.createActivity(m_model,
+ (org.w3c.dom.Element)nl.item(i));
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method converts the BPEL activity into an equivalent
+ * behavioural description for conformance checking.
+ *
+ * @param activities The list of activities that will contain
+ * the converted action(s)
+ * @param context The conversion context
+ */
+ public abstract void convert(java.util.List<Activity> activities,
+ ConversionContext context);
+
+ private static Logger logger =
Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
+
+ private BPELLanguageModel m_model=null;
+ private org.w3c.dom.Element m_activity=null;
+}
Copied:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElementFactory.java
(from rev 557,
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElementFactory.java)
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElementFactory.java
(rev 0)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElementFactory.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.bpel.model.activities;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+
+public class BPELElementFactory {
+
+ public static final String MODEL_ACTIVITIES_PACKAGE =
+ "org.jboss.tools.overlord.cdl.bpel.model.activities";
+ private static final String ACTIVITY_SUFFIX="Activity";
+
+ /**
+ * This method creates a BPELActivity instance relevant to the
+ * supplied JBossESB action, associated with the supplied
+ * service.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration of the BPEL activity
+ * @return The BPEL activity instance
+ */
+ public static BPELElement createActivity(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ BPELElement ret=null;
+ String activityType=activity.getNodeName();
+
+ // Make first character capitalised
+ char ch=Character.toUpperCase(activityType.charAt(0));
+
+ activityType = ch+activityType.substring(1);
+
+ String clsName=MODEL_ACTIVITIES_PACKAGE+"."+activityType+
+ ACTIVITY_SUFFIX;
+
+ try {
+ Class<?> cls=(Class<?>)
+ Class.forName(clsName);
+
+ java.lang.reflect.Constructor<?> con=
+ cls.getConstructor(new Class<?>[]{BPELLanguageModel.class,
+ org.w3c.dom.Element.class});
+
+ ret = (BPELElement)con.newInstance(new Object[]{model, activity});
+
+ } catch(Exception e) {
+ logger.log(java.util.logging.Level.FINEST,
+ "Unable to find action class '"+clsName+"'", e);
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger =
Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
+}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/Condition.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/Condition.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/Condition.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -26,7 +26,7 @@
/**
* This class represents the BPEL condition element.
*/
-public class Condition extends AbstractBPELElement {
+public class Condition extends BPELElement {
private static final long serialVersionUID = 8666349106632652777L;
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstruct.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstruct.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstruct.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -19,7 +19,6 @@
import java.util.List;
-import org.jboss.tools.overlord.cdl.bpel.model.BPELElement;
import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
import org.scribble.model.Activity;
@@ -28,7 +27,7 @@
* This class represents the 'else' construct contained
* within the 'if' activity.
*/
-public class ElseConstruct extends AbstractBPELElement {
+public class ElseConstruct extends BPELElement {
private static final long serialVersionUID = 1243775332210724718L;
@@ -55,7 +54,21 @@
}
+ /**
+ * This method initializes the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
@Override
+ protected void initExistingElement(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super.initExistingElement(model, activity);
+
+ m_activity = findChildActivity();
+ }
+
+ @Override
public void convert(List<Activity> activities, ConversionContext context) {
// TODO Auto-generated method stub
@@ -81,5 +94,5 @@
return(m_activity);
}
- private BPELElement m_activity=null;
+ private BPELElement m_activity;
}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstruct.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstruct.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstruct.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -19,7 +19,6 @@
import java.util.List;
-import org.jboss.tools.overlord.cdl.bpel.model.BPELElement;
import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
import org.scribble.model.Activity;
@@ -28,7 +27,7 @@
* This class represents the 'elseif' construct contained
* within the 'if' activity.
*/
-public class ElseIfConstruct extends AbstractBPELElement {
+public class ElseIfConstruct extends BPELElement {
private static final long serialVersionUID = 6371029130621912170L;
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/IfActivity.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/IfActivity.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/IfActivity.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public class IfActivity extends AbstractBPELElement {
+public class IfActivity extends BPELElement {
private static final long serialVersionUID = -763221632866464831L;
private static final String IF = "if";
@@ -52,6 +52,31 @@
}
/**
+ * This method initializes the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ @Override
+ protected void initExistingElement(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super.initExistingElement(model, activity);
+
+ org.w3c.dom.Element cond=
+ findElement(Condition.CONDITION);
+
+ if (cond == null) {
+ m_condition = new Condition(model);
+ } else {
+ m_condition = new Condition(model, cond);
+ }
+
+ m_activity = findChildActivity();
+
+
+ }
+
+ /**
* This method validates the BPEL activity and reports warnings or
* errors to the supplied model listener.
*
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/SequenceActivity.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/SequenceActivity.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/SequenceActivity.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -26,8 +26,7 @@
*
* @author gary
*/
-public class SequenceActivity extends AbstractBPELElement
- implements BPELSequenceActivity {
+public class SequenceActivity extends BPELElement {
private static final String SEQUENCE = "sequence";
private static final long serialVersionUID = 6656299352423612770L;
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/AbstractBPELModelChangeRule.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/AbstractBPELModelChangeRule.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/AbstractBPELModelChangeRule.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -20,6 +20,7 @@
import org.scribble.model.*;
import org.scribble.model.change.*;
import org.jboss.tools.overlord.cdl.bpel.model.*;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.SequenceActivity;
/**
* This is the abstract ESB model change rule.
@@ -42,7 +43,7 @@
Model model, ModelObject mobj, ModelObject ref) {
boolean ret=false;
- if (context.getParent() instanceof BPELSequenceActivity &&
+ if (context.getParent() instanceof SequenceActivity &&
model instanceof BPELLanguageModel) {
ret = true;
}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationInteractionModelChangeRule.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationInteractionModelChangeRule.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationInteractionModelChangeRule.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -97,8 +97,8 @@
InvokeActivity act=new InvokeActivity(bpelModel,
interaction);
- if (context.getParent() instanceof BPELSequenceActivity) {
- ((BPELSequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof SequenceActivity) {
+ ((SequenceActivity)context.getParent()).addActivity(act, -1);
ret = true;
}
@@ -113,8 +113,8 @@
ReplyActivity act=new ReplyActivity(bpelModel,
interaction);
- if (context.getParent() instanceof BPELSequenceActivity) {
- ((BPELSequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof SequenceActivity) {
+ ((SequenceActivity)context.getParent()).addActivity(act, -1);
ret = true;
}
@@ -124,8 +124,8 @@
ReceiveActivity act=new ReceiveActivity(bpelModel,
interaction);
- if (context.getParent() instanceof BPELSequenceActivity) {
- ((BPELSequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof SequenceActivity) {
+ ((SequenceActivity)context.getParent()).addActivity(act, -1);
ret = true;
}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationModelChangeRule.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationModelChangeRule.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationModelChangeRule.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -97,9 +97,9 @@
// Add sequence to model
bpelModel.setActivity(seq);
- } else if (context.getParent() instanceof BPELSequenceActivity) {
+ } else if (context.getParent() instanceof SequenceActivity) {
- ((BPELSequenceActivity)context.getParent()).addActivity(seq, -1);
+ ((SequenceActivity)context.getParent()).addActivity(seq, -1);
}
// Process the activities within the conversation
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhileModelChangeRule.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhileModelChangeRule.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhileModelChangeRule.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -92,8 +92,8 @@
SequenceActivity seq=new SequenceActivity(bpelModel);
act.setContainedActivity(seq);
- if (context.getParent() instanceof BPELSequenceActivity) {
- ((BPELSequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof SequenceActivity) {
+ ((SequenceActivity)context.getParent()).addActivity(act, -1);
}
// Process the activities within the conversation
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ConditionTest.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ConditionTest.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ConditionTest.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -49,7 +49,7 @@
String expr="Test Expression";
- String xml="<condition>"+expr+"</condition>";
+ String xml="<condition
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu...;
org.w3c.dom.Element elem=null;
try {
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstructTest.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstructTest.java
(rev 0)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstructTest.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.bpel.model.activities;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class ElseConstructTest extends TestCase {
+
+ public void testBuildElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<else
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu... +
+ "<sequence/></else>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ ElseConstruct construct=new ElseConstruct(model, elem);
+
+ if (construct.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((construct.getActivity() instanceof SequenceActivity) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstructTest.java
===================================================================
---
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstructTest.java 2009-03-27
23:41:54 UTC (rev 557)
+++
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstructTest.java 2009-03-28
12:41:24 UTC (rev 558)
@@ -29,7 +29,8 @@
String expr="Test Expression";
- String
xml="<elseif><condition>"+expr+"</condition><sequence/></elseif>";
+ String xml="<elseif
xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\&qu... +
+ "<condition>"+expr+"</condition><sequence/></elseif>";
org.w3c.dom.Element elem=null;
try {