Overlord SVN: r564 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src: java/org/jboss/tools/overlord/cdl/bpel/model/component and 1 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-03-31 17:09:02 -0400 (Tue, 31 Mar 2009)
New Revision: 564
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteraction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestAbstractInteraction.java
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java
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/component/Invoke.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java
Log:
Refactored abstract class names to remove 'Activity', and implemented tests for AbstractInteraction.
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-31 20:53:18 UTC (rev 563)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationInteractionModelChangeRule.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -89,7 +89,7 @@
BPELLanguageModel bpelModel=(BPELLanguageModel)model;
ConversationInteraction interaction=(ConversationInteraction)mobj;
boolean ret=false;
- AbstractInteractionActivity act=null;
+ AbstractInteraction act=null;
// Check if send or receive
if (InteractionUtil.isSend(interaction)) {
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java 2009-03-31 20:53:18 UTC (rev 563)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -1,83 +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.component;
-
-import org.apache.log4j.Logger;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This is the generic BPEL activity class.
- *
- * @author gary
- */
-public abstract class AbstractGroupingActivity extends BPELElement {
-
- private static final long serialVersionUID = -5550042312010190598L;
-
- /**
- * The constructor for initializing the activity based on
- * an existing DOM element.
- */
- protected AbstractGroupingActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The contructor for initializing a new activity.
- */
- protected AbstractGroupingActivity(BPELLanguageModel model,
- String activityName) {
- super(model, activityName);
- }
-
- /**
- * This method identifies whether the BPEL element
- * is an activity.
- *
- * @return Whether the element is an activity
- */
- @Override
- public boolean isActivity() {
- return(true);
- }
-
- /**
- * This method sets the contained activity.
- *
- * @param act The contained activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
-
- getDOMElement().appendChild(act.getDOMElement());
- }
-
- /**
- * This method returns the contained activity.
- *
- * @return The contained activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- private static Logger logger = Logger.getLogger(AbstractGroupingActivity.class);
-
- private BPELElement m_activity=null;
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java (from rev 561, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingConstruct.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -0,0 +1,83 @@
+/*
+ * 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.component;
+
+import org.apache.log4j.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This is the generic BPEL activity class.
+ *
+ * @author gary
+ */
+public abstract class AbstractGroupingConstruct extends BPELElement {
+
+ private static final long serialVersionUID = -5550042312010190598L;
+
+ /**
+ * The constructor for initializing the activity based on
+ * an existing DOM element.
+ */
+ protected AbstractGroupingConstruct(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The contructor for initializing a new activity.
+ */
+ protected AbstractGroupingConstruct(BPELLanguageModel model,
+ String activityName) {
+ super(model, activityName);
+ }
+
+ /**
+ * This method identifies whether the BPEL element
+ * is an activity.
+ *
+ * @return Whether the element is an activity
+ */
+ @Override
+ public boolean isActivity() {
+ return(true);
+ }
+
+ /**
+ * This method sets the contained activity.
+ *
+ * @param act The contained activity
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ getDOMElement().appendChild(act.getDOMElement());
+ }
+
+ /**
+ * This method returns the contained activity.
+ *
+ * @return The contained activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private static Logger logger = Logger.getLogger(AbstractGroupingConstruct.class);
+
+ private BPELElement m_activity=null;
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteraction.java (from rev 563, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteraction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteraction.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -0,0 +1,94 @@
+/*
+ * 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.component;
+
+import org.scribble.conversation.model.ConversationInteraction;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This class represents an abstract interaction activity.
+ *
+ * @author gary
+ */
+public abstract class AbstractInteraction extends BPELElement {
+
+ private static final String OPERATION = "operation";
+ private static final long serialVersionUID = -5048477859609625462L;
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public AbstractInteraction(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ */
+ public AbstractInteraction(BPELLanguageModel model,
+ String name) {
+ super(model, name);
+ }
+
+ /**
+ * This method identifies whether the BPEL element
+ * is an activity.
+ *
+ * @return Whether the element is an activity
+ */
+ @Override
+ public boolean isActivity() {
+ return(true);
+ }
+
+ /**
+ * This method sets the operation.
+ *
+ * @param op The operation
+ */
+ public void setOperation(String op) {
+ getDOMElement().setAttribute(OPERATION, op);
+ }
+
+ /**
+ * This method returns the operation.
+ *
+ * @return The operation
+ */
+ public String getOperation() {
+ return(getDOMElement().getAttribute(OPERATION));
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ }
+
+}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java 2009-03-31 20:53:18 UTC (rev 563)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -1,97 +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.component;
-
-import org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This class represents an abstract interaction activity.
- *
- * @author gary
- */
-public abstract class AbstractInteractionActivity extends BPELElement {
-
- private static final String OPERATION = "operation";
- private static final long serialVersionUID = -5048477859609625462L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public AbstractInteractionActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public AbstractInteractionActivity(BPELLanguageModel model,
- String name) {
- super(model, name);
- }
-
- /**
- * This method sets the operation.
- *
- * @param op The operation
- */
- public void setOperation(String op) {
- getDOMElement().setAttribute(OPERATION, op);
- }
-
- /**
- * This method returns the operation.
- *
- * @return The operation
- */
- public String getOperation() {
- return(getDOMElement().getAttribute(OPERATION));
- // TODO: Record variables against relevant interaction
- // based activity - probably only mechanism for
- // establishing message type
- }
-
- /**
- * This method identifies whether the BPEL element
- * is an activity.
- *
- * @return Whether the element is an activity
- */
- @Override
- public boolean isActivity() {
- return(true);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
-}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-03-31 20:53:18 UTC (rev 563)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -27,7 +27,7 @@
*
* @author gary
*/
-public class Invoke extends AbstractInteractionActivity {
+public class Invoke extends AbstractInteraction {
private static final String INVOKE = "invoke";
private static final long serialVersionUID = 928076947383263387L;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-03-31 20:53:18 UTC (rev 563)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -27,7 +27,7 @@
*
* @author gary
*/
-public class Receive extends AbstractInteractionActivity {
+public class Receive extends AbstractInteraction {
public static final String RECEIVE = "receive";
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-03-31 20:53:18 UTC (rev 563)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -27,7 +27,7 @@
*
* @author gary
*/
-public class Reply extends AbstractInteractionActivity {
+public class Reply extends AbstractInteraction {
public static final String REPLY = "reply";
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java 2009-03-31 20:53:18 UTC (rev 563)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public class While extends AbstractGroupingActivity {
+public class While extends AbstractGroupingConstruct {
private static final long serialVersionUID = -4173984531470466407L;
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionTest.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -0,0 +1,87 @@
+/*
+ * 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.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class AbstractInteractionTest extends TestCase {
+
+ public void testIsActivity() {
+ TestAbstractInteraction act=
+ new TestAbstractInteraction(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testGetOperationFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String op="testOp";
+
+ String xml="<interaction xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\" "+
+ "operation=\""+op+"\" />";
+
+ 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");
+ }
+
+ TestAbstractInteraction component=new TestAbstractInteraction(model, elem);
+
+ if (component.getOperation().equals(op) == false) {
+ fail("Operation not correct, expecting '"+op+"': "+
+ component.getOperation());
+ }
+ }
+
+ public void testGetOperation() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String op="testOp";
+
+ TestAbstractInteraction component=new TestAbstractInteraction(model);
+
+ component.setOperation(op);
+
+ if (component.getOperation().equals(op) == false) {
+ fail("Operation not correct, expecting '"+op+"': "+
+ component.getOperation());
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestAbstractInteraction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestAbstractInteraction.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestAbstractInteraction.java 2009-03-31 21:09:02 UTC (rev 564)
@@ -0,0 +1,44 @@
+/*
+ * 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.component;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+import org.w3c.dom.Element;
+
+public class TestAbstractInteraction extends AbstractInteraction {
+
+ private static final long serialVersionUID = 8254837781661826397L;
+
+ public TestAbstractInteraction(BPELLanguageModel model, Element elem) {
+ super(model, elem);
+ }
+
+ public TestAbstractInteraction(BPELLanguageModel model) {
+ super(model, "test");
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+}
15 years
Overlord SVN: r563 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src: java/org/jboss/tools/overlord/cdl/bpel/model/component and 1 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-03-31 16:53:18 -0400 (Tue, 31 Mar 2009)
New Revision: 563
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/WhileTest.java
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/WhileModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElement.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Condition.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Elseif.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ConditionTest.java
Log:
Added tests for 'while' and expression language on condition. Moved references to ConversationInteraction out of bpel model components, so only used in the model change rules.
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-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationInteractionModelChangeRule.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -89,13 +89,17 @@
BPELLanguageModel bpelModel=(BPELLanguageModel)model;
ConversationInteraction interaction=(ConversationInteraction)mobj;
boolean ret=false;
+ AbstractInteractionActivity act=null;
// Check if send or receive
if (InteractionUtil.isSend(interaction)) {
+ // TODO: Record variables against relevant interaction
+ // based activity - probably only mechanism for
+ // establishing message type
+
if (InteractionUtil.isRequest(interaction)) {
- Invoke act=new Invoke(bpelModel,
- interaction);
+ act = new Invoke(bpelModel);
if (context.getParent() instanceof Sequence) {
((Sequence)context.getParent()).addActivity(act, -1);
@@ -110,8 +114,7 @@
// possibly wrapped around, or contained within the
// invoke.
} else {
- Reply act=new Reply(bpelModel,
- interaction);
+ act = new Reply(bpelModel);
if (context.getParent() instanceof Sequence) {
((Sequence)context.getParent()).addActivity(act, -1);
@@ -121,8 +124,7 @@
}
} else {
if (InteractionUtil.isRequest(interaction)) {
- Receive act=new Receive(bpelModel,
- interaction);
+ act = new Receive(bpelModel);
if (context.getParent() instanceof Sequence) {
((Sequence)context.getParent()).addActivity(act, -1);
@@ -131,6 +133,10 @@
}
}
}
+
+ if (act != null && interaction.getMessageSignature() != null) {
+ act.setOperation(interaction.getMessageSignature().getOperation());
+ }
return(ret);
}
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-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhileModelChangeRule.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -90,7 +90,6 @@
While act=new While(bpelModel);
Sequence seq=new Sequence(bpelModel);
- act.setActivity(seq);
if (context.getParent() instanceof Sequence) {
((Sequence)context.getParent()).addActivity(act, -1);
@@ -107,6 +106,8 @@
context.insert(model, acts.get(i), null);
}
+ act.setActivity(seq);
+
// Reset old parent
context.setParent(parent);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -28,6 +28,7 @@
*/
public abstract class AbstractInteractionActivity extends BPELElement {
+ private static final String OPERATION = "operation";
private static final long serialVersionUID = -5048477859609625462L;
/**
@@ -45,25 +46,28 @@
* The constructor for the activity.
*
* @param model The BPEL model
- * @param interaction The conversation
*/
public AbstractInteractionActivity(BPELLanguageModel model,
- String name, ConversationInteraction interaction) {
+ String name) {
super(model, name);
-
- initialize(interaction);
}
/**
- * This method initializes the invoke interaction.
+ * This method sets the operation.
*
- * @param interaction The invoke interaction
+ * @param op The operation
*/
- protected void initialize(ConversationInteraction interaction) {
-
- getDOMElement().setAttribute("operation",
- interaction.getMessageSignature().getOperation());
-
+ public void setOperation(String op) {
+ getDOMElement().setAttribute(OPERATION, op);
+ }
+
+ /**
+ * This method returns the operation.
+ *
+ * @return The operation
+ */
+ public String getOperation() {
+ return(getDOMElement().getAttribute(OPERATION));
// TODO: Record variables against relevant interaction
// based activity - probably only mechanism for
// establishing message type
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElement.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElement.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElement.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -98,7 +98,7 @@
* @param name The name
* @return The element, or null if not found
*/
- protected org.w3c.dom.Element findElement(String name) {
+ protected org.w3c.dom.Element findChildElement(String name) {
org.w3c.dom.Element ret=null;
org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Condition.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Condition.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Condition.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -28,6 +28,8 @@
*/
public class Condition extends BPELElement {
+ private static final String EXPRESSION_LANGUAGE = "expressionLanguage";
+
private static final long serialVersionUID = 8666349106632652777L;
public static final String CONDITION="condition";
@@ -96,6 +98,25 @@
}
}
+ /**
+ * This method returns the expression language associated
+ * with the condition.
+ *
+ * @return The expression language
+ */
+ public String getExpressionLanguage() {
+ return(getDOMElement().getAttribute(EXPRESSION_LANGUAGE));
+ }
+
+ /**
+ * This method sets the expression language.
+ *
+ * @param lang The expression language
+ */
+ public void setExpressionLanguage(String lang) {
+ getDOMElement().setAttribute(EXPRESSION_LANGUAGE, lang);
+ }
+
@Override
public void convert(List<Activity> activities, ConversionContext context) {
// TODO Auto-generated method stub
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Elseif.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Elseif.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Elseif.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -44,7 +44,7 @@
super(model, activity);
org.w3c.dom.Element cond=
- findElement(Condition.CONDITION);
+ findChildElement(Condition.CONDITION);
if (cond == null) {
m_condition = new Condition(model);
@@ -78,7 +78,7 @@
public void setCondition(Condition cond) {
m_condition = cond;
- setChildElement(findElement(Condition.CONDITION),
+ setChildElement(findChildElement(Condition.CONDITION),
cond.getDOMElement(), getDOMElement().getFirstChild());
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -44,7 +44,7 @@
super(model, activity);
org.w3c.dom.Element cond=
- findElement(Condition.CONDITION);
+ findChildElement(Condition.CONDITION);
if (cond == null) {
m_condition = new Condition(model);
@@ -122,7 +122,7 @@
public void setCondition(Condition cond) {
m_condition = cond;
- setChildElement(findElement(Condition.CONDITION),
+ setChildElement(findChildElement(Condition.CONDITION),
cond.getDOMElement(), getDOMElement().getFirstChild());
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -17,7 +17,6 @@
*/
package org.jboss.tools.overlord.cdl.bpel.model.component;
-import org.scribble.conversation.model.ConversationInteraction;
import org.scribble.model.*;
import org.scribble.model.admin.ModelListener;
import org.jboss.tools.overlord.cdl.bpel.model.*;
@@ -48,11 +47,9 @@
* The constructor for the activity.
*
* @param model The BPEL model
- * @param interaction The conversation
*/
- public Invoke(BPELLanguageModel model,
- ConversationInteraction interaction) {
- super(model, INVOKE, interaction);
+ public Invoke(BPELLanguageModel model) {
+ super(model, INVOKE);
}
/**
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -29,7 +29,8 @@
*/
public class Receive extends AbstractInteractionActivity {
- private static final String RECEIVE = "receive";
+ public static final String RECEIVE = "receive";
+
private static final long serialVersionUID = -3041725198724191842L;
/**
@@ -47,11 +48,9 @@
* The constructor for the activity.
*
* @param model The BPEL model
- * @param interaction The conversation
*/
- public Receive(BPELLanguageModel model,
- ConversationInteraction interaction) {
- super(model, RECEIVE, interaction);
+ public Receive(BPELLanguageModel model) {
+ super(model, RECEIVE);
}
/**
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -29,7 +29,8 @@
*/
public class Reply extends AbstractInteractionActivity {
- private static final String REPLY = "reply";
+ public static final String REPLY = "reply";
+
private static final long serialVersionUID = 8582738107125170604L;
/**
@@ -47,11 +48,9 @@
* The constructor for the activity.
*
* @param model The BPEL model
- * @param interaction The conversation
*/
- public Reply(BPELLanguageModel model,
- ConversationInteraction interaction) {
- super(model, REPLY, interaction);
+ public Reply(BPELLanguageModel model) {
+ super(model, REPLY);
}
/**
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -29,7 +29,8 @@
public class While extends AbstractGroupingActivity {
private static final long serialVersionUID = -4173984531470466407L;
- private static final String WHILE = "while";
+
+ public static final String WHILE = "while";
/**
* The constructor for the activity.
@@ -40,6 +41,17 @@
public While(BPELLanguageModel model,
org.w3c.dom.Element activity) {
super(model, activity);
+
+ org.w3c.dom.Element cond=
+ findChildElement(Condition.CONDITION);
+
+ if (cond == null) {
+ m_condition = new Condition(model);
+ } else {
+ m_condition = new Condition(model, cond);
+ }
+
+ m_activity = findChildActivity();
}
/**
@@ -73,4 +85,58 @@
ConversionContext context) {
}
+ /**
+ * This method sets the condition.
+ *
+ * @param cond The condition
+ */
+ public void setCondition(Condition cond) {
+ m_condition = cond;
+
+ setChildElement(findChildElement(Condition.CONDITION),
+ cond.getDOMElement(), getDOMElement().getFirstChild());
+ }
+
+ /**
+ * This method returns the condition.
+ *
+ * @return The condition
+ */
+ public Condition getCondition() {
+ return(m_condition);
+ }
+
+ /**
+ * This method sets the main 'if' activity.
+ *
+ * @param act The activity associated with the 'if'
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ BPELElement existing=findChildActivity();
+ org.w3c.dom.Element existingElem=null;
+
+ if (existing != null) {
+ existingElem = existing.getDOMElement();
+ }
+
+ org.w3c.dom.Element insertBefore=null;
+
+ setChildElement(existingElem, act.getDOMElement(),
+ insertBefore);
+ }
+
+ /**
+ * This method returns the activity associated with
+ * the 'if' path.
+ *
+ * @return The 'if' activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private Condition m_condition=null;
+ private BPELElement m_activity=null;
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ConditionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ConditionTest.java 2009-03-30 22:30:29 UTC (rev 562)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ConditionTest.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -93,4 +93,67 @@
expr+"' but got '"+result+"'");
}
}
+
+ public void testGetExpressionLanguage() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+ Condition condition=new Condition(model);
+
+ String lang="Test Language";
+
+ condition.setExpressionLanguage(lang);
+
+ String result=condition.getExpressionLanguage();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(lang) == false) {
+ fail("Expression language is not valid: expecting '"+
+ lang+"' but got '"+result+"'");
+ }
+ }
+
+ public void testGetExpressionLanguageFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String lang="TestLanguage";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\"" +
+ " expressionLanguage=\""+lang+"\"></condition>";
+
+ 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");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ String result=condition.getExpressionLanguage();
+
+ if (result == null) {
+ fail("Expression language is null");
+ }
+
+ if (result.equals(lang) == false) {
+ fail("Expression language is not valid: expecting '"+
+ lang+"' but got '"+result+"'");
+ }
+ }
}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/WhileTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/WhileTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/WhileTest.java 2009-03-31 20:53:18 UTC (rev 563)
@@ -0,0 +1,336 @@
+/*
+ * 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.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class WhileTest extends TestCase {
+
+ public void testIsActivity() {
+ While act=new While(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testIfFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<while xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition>"+expr1+"</condition>"+
+ "<sequence/>"+
+ "</while>";
+
+ 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");
+ }
+
+ While component=new While(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+ }
+
+ public void testSetConditionNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ 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");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ While component=new While(model);
+
+ component.setCondition(condition);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetConditionReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ String xml2="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</condition>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=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(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ While component=new While(model);
+
+ component.setCondition(condition1);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setCondition(condition2);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetActivityNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<while xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "</while>";
+
+ org.w3c.dom.Element ifelem=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);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ While component=new While(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("One child element expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+
+ component.setActivity(seq);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("Second element was not a sequence: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testSetActivityReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<while xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "</while>";
+
+ org.w3c.dom.Element ifelem=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);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ While component=new While(model, ifelem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ If sub=new If(model);
+
+ component.setActivity(sub);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(If.IF) == false) {
+ fail("Second element was not an 'if': "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+}
15 years
Overlord SVN: r562 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src: java/org/jboss/tools/overlord/cdl/bpel/model/change and 2 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-03-30 18:30:29 -0400 (Mon, 30 Mar 2009)
New Revision: 562
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/change/IfModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/ESBBrokerProcess(a)Broker.bpel
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/PurchaseGoodsProcess(a)Broker.bpel
Log:
Fixed plugin test failures.
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-30 20:19:51 UTC (rev 561)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/DefaultBPELLanguageModel.java 2009-03-30 22:30:29 UTC (rev 562)
@@ -18,6 +18,7 @@
package org.jboss.tools.overlord.cdl.bpel.model;
import org.apache.log4j.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.component.BPELElement;
import org.jboss.tools.overlord.cdl.bpel.model.component.Sequence;
import org.scribble.model.*;
import org.scribble.model.admin.ModelIssue;
@@ -34,6 +35,7 @@
private static final long serialVersionUID = 7625564863751533521L;
+ private static final String PROCESS_ELEMENT = "process";
public static final String BPEL_NOTATION = "bpel";
/**
@@ -76,7 +78,8 @@
doc = javax.xml.parsers.DocumentBuilderFactory.
newInstance().newDocumentBuilder().newDocument();
- m_bpelProcess = doc.createElement("process");
+ m_bpelProcess = doc.createElementNS(BPELElement.BPEL_NS,
+ PROCESS_ELEMENT);
} catch(Exception e) {
logger.error("Failed to create initial BPEL document: "+e, e);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java 2009-03-30 20:19:51 UTC (rev 561)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java 2009-03-30 22:30:29 UTC (rev 562)
@@ -98,6 +98,19 @@
Sequence seq=new Sequence(bpelModel);
+ // Process the activities within the conversation
+ java.util.List<Activity> acts=path.getContents();
+
+ Object parent=context.getParent();
+
+ context.setParent(seq);
+
+ for (int j=0; j < acts.size(); j++) {
+ context.insert(model, acts.get(j), null);
+ }
+
+ context.setParent(parent);
+
if (i == 0) {
act.setActivity(seq);
} else if (i == elem.getPaths().size()-1) {
@@ -112,19 +125,6 @@
act.addElseIfPath(construct);
}
-
- // Process the activities within the conversation
- java.util.List<Activity> acts=path.getContents();
-
- Object parent=context.getParent();
-
- context.setParent(seq);
-
- for (int j=0; j < acts.size(); j++) {
- context.insert(model, acts.get(j), null);
- }
-
- context.setParent(parent);
}
return(true);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-03-30 20:19:51 UTC (rev 561)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-03-30 22:30:29 UTC (rev 562)
@@ -53,8 +53,6 @@
public Invoke(BPELLanguageModel model,
ConversationInteraction interaction) {
super(model, INVOKE, interaction);
-
- initialize(interaction);
}
/**
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-03-30 20:19:51 UTC (rev 561)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-03-30 22:30:29 UTC (rev 562)
@@ -52,8 +52,6 @@
public Receive(BPELLanguageModel model,
ConversationInteraction interaction) {
super(model, RECEIVE, interaction);
-
- initialize(interaction);
}
/**
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-03-30 20:19:51 UTC (rev 561)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-03-30 22:30:29 UTC (rev 562)
@@ -52,8 +52,6 @@
public Reply(BPELLanguageModel model,
ConversationInteraction interaction) {
super(model, REPLY, interaction);
-
- initialize(interaction);
}
/**
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/ESBBrokerProcess(a)Broker.bpel
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/ESBBrokerProcess(a)Broker.bpel 2009-03-30 20:19:51 UTC (rev 561)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/ESBBrokerProcess(a)Broker.bpel 2009-03-30 22:30:29 UTC (rev 562)
@@ -1,4 +1,4 @@
-<process>
+<process xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
<sequence>
<receive operation="makeEnquiry"/>
<while>
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/PurchaseGoodsProcess(a)Broker.bpel
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/PurchaseGoodsProcess(a)Broker.bpel 2009-03-30 20:19:51 UTC (rev 561)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/PurchaseGoodsProcess(a)Broker.bpel 2009-03-30 22:30:29 UTC (rev 562)
@@ -1,4 +1,4 @@
-<process>
+<process xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
<sequence>
<invoke operation="buy"/>
<invoke operation="checkCredit"/>
15 years
Overlord SVN: r561 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel: src/java/org/jboss/tools/overlord/cdl/bpel/actions and 8 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-03-30 16:19:51 -0400 (Mon, 30 Mar 2009)
New Revision: 561
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElement.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElementFactory.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Condition.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Else.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Elseif.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Sequence.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElementTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ConditionTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ElseIfTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ElseTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/IfTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/SequenceTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestBPELElement.java
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/actions/GenerateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/dialogs/GenerateDialog.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/eclipse/Activator.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java
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/parser/BPELParser.java
Log:
Refactoring to remove 'activity' distinction, and additional tests around the model for if/elseif/else constructs, built from DOM and also programmatically.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF 2009-03-30 19:51:42 UTC (rev 560)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF 2009-03-30 20:19:51 UTC (rev 561)
@@ -13,7 +13,8 @@
org.scribble.osgi,
org.eclipse.jdt.core,
org.junit,
- org.scribble.conversation.parser
+ org.scribble.conversation.parser,
+ org.apache.log4j;bundle-version="1.2.13"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: www.jboss.org
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/actions/GenerateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/actions/GenerateAction.java 2009-03-30 19:51:42 UTC (rev 560)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/actions/GenerateAction.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -17,8 +17,7 @@
*/
package org.jboss.tools.overlord.cdl.bpel.actions;
-import java.util.logging.Logger;
-
+import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
@@ -65,8 +64,7 @@
try {
dialog.open();
} catch(Throwable e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to open generate dialog", e);
+ logger.error("Failed to open generate dialog", e);
}
} else {
warn(CANNOT_GENERATE);
@@ -110,7 +108,7 @@
mbox.open();
}
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.actions");
+ private static Logger logger = Logger.getLogger(GenerateAction.class);
private ISelection m_selection=null;
private IWorkbenchPart m_targetPart=null;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/dialogs/GenerateDialog.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/dialogs/GenerateDialog.java 2009-03-30 19:51:42 UTC (rev 560)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/dialogs/GenerateDialog.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -17,8 +17,7 @@
*/
package org.jboss.tools.overlord.cdl.bpel.dialogs;
-import java.util.logging.Logger;
-
+import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
@@ -366,10 +365,10 @@
mbox.setMessage(mesg);
mbox.open();
- logger.log(java.util.logging.Level.SEVERE, mesg, ex);
+ logger.error(mesg, ex);
}
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.dialogs");
+ private static Logger logger = Logger.getLogger(GenerateDialog.class);
private IFile m_file=null;
private ConversationModel m_conversationModel=null;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/eclipse/Activator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/eclipse/Activator.java 2009-03-30 19:51:42 UTC (rev 560)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/eclipse/Activator.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -1,7 +1,6 @@
package org.jboss.tools.overlord.cdl.bpel.eclipse;
-import java.util.logging.Logger;
-
+import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -66,9 +65,9 @@
getDefault().getLog().log(status);
}
- logger.severe("LOG ERROR: "+mesg+
- (t == null ? "" : ": "+t));
+ logger.error("LOG ERROR: "+mesg+
+ (t == null ? "" : ": "+t), t);
}
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.eclipse");
+ private static Logger logger = Logger.getLogger(Activator.class);
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java 2009-03-30 19:51:42 UTC (rev 560)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -17,14 +17,7 @@
*/
package org.jboss.tools.overlord.cdl.bpel.generator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
+import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
import org.jboss.tools.overlord.cdl.bpel.generator.BuildSystem;
import org.jboss.tools.overlord.cdl.bpel.model.*;
@@ -92,7 +85,7 @@
}
if (m_conversationModel == null) {
- logger.severe("Unable to load model used to generate " +
+ logger.error("Unable to load model used to generate " +
"the ESB artefacts");
}
}
@@ -117,8 +110,8 @@
public void generateRole(Role role, String projectName)
throws Exception {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Generate role '"+role+"' for: "+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Generate role '"+role+"' for: "+
m_conversationModel);
}
@@ -157,7 +150,7 @@
target.getBPELProcess(),
lcm, target);
} else {
- logger.severe("Unable to find model generator");
+ logger.error("Unable to find model generator");
}
}
}
@@ -208,7 +201,7 @@
return(m_buildSystem);
}
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.generator");
+ private static Logger logger = Logger.getLogger(Generator.class);
private IFile m_file=null;
private java.util.List<Role> m_roles=null;
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-30 19:51:42 UTC (rev 560)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELLanguageModel.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -17,7 +17,7 @@
*/
package org.jboss.tools.overlord.cdl.bpel.model;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.SequenceActivity;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Sequence;
import org.scribble.model.*;
import org.scribble.model.admin.ModelListener;
@@ -56,7 +56,7 @@
*
* @return The top level grouping activity
*/
- public SequenceActivity getActivity();
+ public Sequence getActivity();
/**
* This method returns the reference to the DOM
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-30 19:51:42 UTC (rev 560)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/DefaultBPELLanguageModel.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -17,13 +17,9 @@
*/
package org.jboss.tools.overlord.cdl.bpel.model;
-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.apache.log4j.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Sequence;
import org.scribble.model.*;
-import org.scribble.model.admin.DependencyType;
import org.scribble.model.admin.ModelIssue;
import org.scribble.model.admin.ModelListener;
import org.scribble.model.resolutions.*;
@@ -36,6 +32,7 @@
public class DefaultBPELLanguageModel extends org.scribble.lang.model.LanguageModel
implements BPELLanguageModel {
+ private static final long serialVersionUID = 7625564863751533521L;
public static final String BPEL_NOTATION = "bpel";
@@ -82,7 +79,7 @@
m_bpelProcess = doc.createElement("process");
} catch(Exception e) {
- logger.severe("Failed to create initial BPEL document: "+e);
+ logger.error("Failed to create initial BPEL document: "+e, e);
}
}
@@ -141,7 +138,7 @@
*
* @return The top level grouping activity
*/
- public SequenceActivity getActivity() {
+ public Sequence getActivity() {
return(m_activity);
}
@@ -150,7 +147,7 @@
*
* @param act The top level activity
*/
- public void setActivity(SequenceActivity act) {
+ public void setActivity(Sequence act) {
m_activity = act;
m_bpelProcess.appendChild(act.getDOMElement());
@@ -166,12 +163,12 @@
return(m_bpelProcess);
}
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
+ private static Logger logger = Logger.getLogger(DefaultBPELLanguageModel.class);
private ModelReference m_source=null;
private org.w3c.dom.Element m_bpelProcess=null;
private String m_contents=null;
- private SequenceActivity m_activity=null;
+ private Sequence m_activity=null;
public class InnerModelListener implements ModelListener {
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractGroupingActivity.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,83 @@
+/*
+ * 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.component;
+
+import org.apache.log4j.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This is the generic BPEL activity class.
+ *
+ * @author gary
+ */
+public abstract class AbstractGroupingActivity extends BPELElement {
+
+ private static final long serialVersionUID = -5550042312010190598L;
+
+ /**
+ * The constructor for initializing the activity based on
+ * an existing DOM element.
+ */
+ protected AbstractGroupingActivity(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The contructor for initializing a new activity.
+ */
+ protected AbstractGroupingActivity(BPELLanguageModel model,
+ String activityName) {
+ super(model, activityName);
+ }
+
+ /**
+ * This method identifies whether the BPEL element
+ * is an activity.
+ *
+ * @return Whether the element is an activity
+ */
+ @Override
+ public boolean isActivity() {
+ return(true);
+ }
+
+ /**
+ * This method sets the contained activity.
+ *
+ * @param act The contained activity
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ getDOMElement().appendChild(act.getDOMElement());
+ }
+
+ /**
+ * This method returns the contained activity.
+ *
+ * @return The contained activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private static Logger logger = Logger.getLogger(AbstractGroupingActivity.class);
+
+ private BPELElement m_activity=null;
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/AbstractInteractionActivity.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,93 @@
+/*
+ * 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.component;
+
+import org.scribble.conversation.model.ConversationInteraction;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This class represents an abstract interaction activity.
+ *
+ * @author gary
+ */
+public abstract class AbstractInteractionActivity extends BPELElement {
+
+ private static final long serialVersionUID = -5048477859609625462L;
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public AbstractInteractionActivity(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param interaction The conversation
+ */
+ public AbstractInteractionActivity(BPELLanguageModel model,
+ String name, ConversationInteraction interaction) {
+ super(model, name);
+
+ initialize(interaction);
+ }
+
+ /**
+ * This method initializes the invoke interaction.
+ *
+ * @param interaction The invoke interaction
+ */
+ protected void initialize(ConversationInteraction interaction) {
+
+ getDOMElement().setAttribute("operation",
+ interaction.getMessageSignature().getOperation());
+
+ // TODO: Record variables against relevant interaction
+ // based activity - probably only mechanism for
+ // establishing message type
+ }
+
+ /**
+ * This method identifies whether the BPEL element
+ * is an activity.
+ *
+ * @return Whether the element is an activity
+ */
+ @Override
+ public boolean isActivity() {
+ return(true);
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ }
+
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElement.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElement.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElement.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,220 @@
+/*
+ * 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.component;
+
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelListener;
+import org.apache.log4j.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This is the generic BPEL element class.
+ *
+ * @author gary
+ */
+public abstract class BPELElement extends ModelObject {
+
+ public static final String BPEL_NS = "http://docs.oasis-open.org/wsbpel/2.0/process/executable";
+
+ 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 elem) {
+ m_model = model;
+
+ m_element = elem;
+
+ // TODO: Set the start/end position information
+ // in the source details
+
+ getSource().setObject(this);
+ }
+
+ /**
+ * The contructor for initializing a new element.
+ */
+ protected BPELElement(BPELLanguageModel model,
+ String elemName) {
+ m_model = model;
+
+ m_element = model.getBPELProcess().
+ getOwnerDocument().createElementNS(BPEL_NS, elemName);
+
+ 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 BPEL node
+ */
+ public org.w3c.dom.Element getDOMElement() {
+ return(m_element);
+ }
+
+ /**
+ * This method identifies whether the BPEL element
+ * is an activity.
+ *
+ * @return Whether the element is an activity
+ */
+ public boolean isActivity() {
+ return(false);
+ }
+
+ /**
+ * 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() != null &&
+ 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.createBPELElement(m_model,
+ (org.w3c.dom.Element)nl.item(i));
+
+ if (ret != null && ret.isActivity() == false) {
+ ret = null;
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the child elements that conform to
+ * the supplied class.
+ *
+ * @param cls The class
+ * @return The list of child elements of the type specified
+ * by the supplied class
+ */
+ protected java.util.List<BPELElement> findChildElements(Class<? extends BPELElement> cls) {
+ java.util.List<BPELElement> ret=new java.util.Vector<BPELElement>();
+
+ org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
+
+ for (int i=0; i < nl.getLength(); i++) {
+
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ BPELElement elem=BPELElementFactory.createBPELElement(m_model,
+ (org.w3c.dom.Element)nl.item(i));
+
+ if (elem != null &&
+ cls.isAssignableFrom(elem.getClass())) {
+ ret.add(elem);
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method sets a new element. If an existing element
+ * is specified, then it is replaced with the new element.
+ * Otherwise if an insertBefore node is specified, then
+ * the new element is inserted before it. If no existing
+ * or insertBefore parameters are specified, then the
+ * new element will be appended.
+ *
+ * @param existing The optional existing element to be
+ * replaced
+ * @param newelem The new element
+ * @param insertBefore Optional location to insert new element
+ */
+ protected void setChildElement(org.w3c.dom.Element existing,
+ org.w3c.dom.Element newelem, org.w3c.dom.Node insertBefore) {
+
+ if (newelem != null) {
+ org.w3c.dom.Node newNode=newelem.cloneNode(true);
+
+ getDOMElement().getOwnerDocument().adoptNode(newNode);
+
+ if (existing != null) {
+ getDOMElement().replaceChild(newNode, existing);
+ } else if (insertBefore != null) {
+ getDOMElement().insertBefore(newNode, insertBefore);
+ } else {
+ getDOMElement().appendChild(newNode);
+ }
+ }
+ }
+
+ /**
+ * 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(BPELElement.class);
+
+ private BPELLanguageModel m_model=null;
+ private org.w3c.dom.Element m_element=null;
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElementFactory.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElementFactory.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElementFactory.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,68 @@
+/*
+ * 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.component;
+
+import org.apache.log4j.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+
+public class BPELElementFactory {
+
+ public static final String MODEL_COMPONENTS_PACKAGE =
+ "org.jboss.tools.overlord.cdl.bpel.model.component";
+
+ /**
+ * This method creates a BPELElement instance relevant to the
+ * supplied JBossESB action, associated with the supplied
+ * service.
+ *
+ * @param model The BPEL model
+ * @param elem The XML configuration of the BPEL activity
+ * @return The BPEL element instance
+ */
+ public static BPELElement createBPELElement(BPELLanguageModel model,
+ org.w3c.dom.Element elem) {
+ BPELElement ret=null;
+ String activityType=elem.getNodeName();
+
+ // Make first character capitalised
+ char ch=Character.toUpperCase(activityType.charAt(0));
+
+ activityType = ch+activityType.substring(1);
+
+ String clsName=MODEL_COMPONENTS_PACKAGE+"."+activityType;
+
+ 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, elem});
+
+ } catch(Exception e) {
+ logger.error("Unable to find BPEL element class '"+
+ clsName+"'", e);
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger = Logger.getLogger(BPELElementFactory.class);
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Condition.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Condition.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Condition.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,106 @@
+/*
+ * 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.component;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+
+/**
+ * This class represents the BPEL condition element.
+ */
+public class Condition extends BPELElement {
+
+ private static final long serialVersionUID = 8666349106632652777L;
+
+ public static final String CONDITION="condition";
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ * @param elem The XML configuration details for the element
+ */
+ public Condition(BPELLanguageModel model,
+ org.w3c.dom.Element elem) {
+ super(model, elem);
+ }
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ */
+ public Condition(BPELLanguageModel model) {
+ super(model, CONDITION);
+ }
+
+ /**
+ * This method returns the expression associated
+ * with the condition.
+ *
+ * @return The expression
+ */
+ public String getExpression() {
+ String ret=null;
+
+ getDOMElement().normalize();
+
+ if (getDOMElement().getFirstChild() instanceof org.w3c.dom.Text) {
+ org.w3c.dom.Text text=(org.w3c.dom.Text)
+ getDOMElement().getFirstChild();
+
+ ret = text.getNodeValue();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method sets the expression.
+ *
+ * @param expr The expression
+ */
+ public void setExpression(String expr) {
+
+ getDOMElement().normalize();
+
+ if (getDOMElement().getFirstChild() == null) {
+ org.w3c.dom.Text text=
+ getDOMElement().getOwnerDocument().createTextNode(expr);
+
+ getDOMElement().appendChild(text);
+
+ } else if (getDOMElement().getFirstChild() instanceof org.w3c.dom.Text) {
+ org.w3c.dom.Text text=(org.w3c.dom.Text)
+ getDOMElement().getFirstChild();
+
+ text.setNodeValue(expr);
+ }
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Else.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Else.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Else.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,97 @@
+/*
+ * 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.component;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+
+/**
+ * This class represents the 'else' construct contained
+ * within the 'if' activity.
+ */
+public class Else extends BPELElement {
+
+ private static final long serialVersionUID = 1243775332210724718L;
+
+ public static final String ELSE="else";
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the element
+ */
+ public Else(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+
+ m_activity = findChildActivity();
+ }
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ */
+ public Else(BPELLanguageModel model) {
+ super(model, ELSE);
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * This method sets the activity associated with
+ * the 'else' construct.
+ *
+ * @param act The activity
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ BPELElement existing=findChildActivity();
+ org.w3c.dom.Element existingElem=null;
+
+ if (existing != null) {
+ existingElem = existing.getDOMElement();
+ }
+
+ org.w3c.dom.Element insertBefore=null;
+
+ setChildElement(existingElem, act.getDOMElement(),
+ insertBefore);
+ }
+
+ /**
+ * This method returns the activity associated with
+ * the 'else' construct.
+ *
+ * @return The activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private BPELElement m_activity;
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Elseif.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Elseif.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Elseif.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,128 @@
+/*
+ * 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.component;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+
+/**
+ * This class represents the 'elseif' construct contained
+ * within the 'if' activity.
+ */
+public class Elseif extends BPELElement {
+
+ private static final long serialVersionUID = 6371029130621912170L;
+
+ public static final String ELSEIF="elseif";
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the element
+ */
+ public Elseif(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(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();
+ }
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ */
+ public Elseif(BPELLanguageModel model) {
+ super(model, ELSEIF);
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * This method sets the condition.
+ *
+ * @param cond The condition
+ */
+ public void setCondition(Condition cond) {
+ m_condition = cond;
+
+ setChildElement(findElement(Condition.CONDITION),
+ cond.getDOMElement(), getDOMElement().getFirstChild());
+ }
+
+ /**
+ * This method returns the condition.
+ *
+ * @return The condition
+ */
+ public Condition getCondition() {
+ return(m_condition);
+ }
+
+ /**
+ * This method sets the activity associated with
+ * the 'else' construct.
+ *
+ * @param act The activity
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ BPELElement existing=findChildActivity();
+ org.w3c.dom.Element existingElem=null;
+
+ if (existing != null) {
+ existingElem = existing.getDOMElement();
+ }
+
+ org.w3c.dom.Element insertBefore=null;
+
+ setChildElement(existingElem, act.getDOMElement(),
+ insertBefore);
+ }
+
+ /**
+ * This method returns the activity associated with
+ * the 'else' construct.
+ *
+ * @return The activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private Condition m_condition;
+ private BPELElement m_activity;
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,231 @@
+/*
+ * 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.component;
+
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelListener;
+import org.apache.log4j.Logger;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This class represents an 'if' grouping construct.
+ *
+ * @author gary
+ */
+public class If extends BPELElement {
+
+ private static final long serialVersionUID = -763221632866464831L;
+
+ public static final String IF = "if";
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public If(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(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();
+
+ java.util.List<BPELElement> paths=
+ findChildElements(Elseif.class);
+
+ for (int i=0; i < paths.size(); i++) {
+ m_elseIfPaths.add((Elseif)paths.get(i));
+ }
+
+ paths = findChildElements(Else.class);
+
+ if (paths.size() > 0) {
+ m_elsePath = (Else)paths.get(0);
+
+ if (paths.size() > 1) {
+ logger.error("BPEL 'if' has multiple 'else' constructs");
+ }
+ }
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ */
+ public If(BPELLanguageModel model) {
+ super(model, IF);
+ }
+
+ /**
+ * This method identifies whether the BPEL element
+ * is an activity.
+ *
+ * @return Whether the element is an activity
+ */
+ @Override
+ public boolean isActivity() {
+ return(true);
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ }
+
+ /**
+ * 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 void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+ /**
+ * This method sets the condition.
+ *
+ * @param cond The condition
+ */
+ public void setCondition(Condition cond) {
+ m_condition = cond;
+
+ setChildElement(findElement(Condition.CONDITION),
+ cond.getDOMElement(), getDOMElement().getFirstChild());
+ }
+
+ /**
+ * This method returns the condition.
+ *
+ * @return The condition
+ */
+ public Condition getCondition() {
+ return(m_condition);
+ }
+
+ /**
+ * This method sets the main 'if' activity.
+ *
+ * @param act The activity associated with the 'if'
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ BPELElement existing=findChildActivity();
+ org.w3c.dom.Element existingElem=null;
+
+ if (existing != null) {
+ existingElem = existing.getDOMElement();
+ }
+
+ org.w3c.dom.Element insertBefore=null;
+
+ if (m_elseIfPaths.size() > 0) {
+ insertBefore = m_elseIfPaths.get(0).getDOMElement();
+ } else if (m_elsePath != null) {
+ insertBefore = m_elsePath.getDOMElement();
+ }
+
+ setChildElement(existingElem, act.getDOMElement(),
+ insertBefore);
+ }
+
+ /**
+ * This method returns the activity associated with
+ * the 'if' path.
+ *
+ * @return The 'if' activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ /**
+ * This method adds an 'else if' path.
+ *
+ * @param act The 'else if' path
+ */
+ public void addElseIfPath(Elseif act) {
+ m_elseIfPaths.add(act);
+
+ org.w3c.dom.Element insertBefore=null;
+
+ if (m_elsePath != null) {
+ insertBefore = m_elsePath.getDOMElement();
+ }
+
+ setChildElement(null, act.getDOMElement(),
+ insertBefore);
+ }
+
+ /**
+ * This method returns the list of 'else if' paths.
+ *
+ * @return The list of 'else if' paths
+ */
+ public java.util.List<Elseif> getElseIfPaths() {
+ return(m_elseIfPaths);
+ }
+
+ /**
+ * This method sets the 'else' path.
+ *
+ * @param act The 'else' path
+ */
+ public void setElsePath(Else act) {
+ org.w3c.dom.Element existingElem=null;
+
+ if (m_elsePath != null) {
+ existingElem = m_elsePath.getDOMElement();
+ }
+
+ m_elsePath = act;
+
+ setChildElement(existingElem, act.getDOMElement(),
+ null);
+ }
+
+ public Else getElsePath() {
+ return(m_elsePath);
+ }
+
+ private static Logger logger=Logger.getLogger(If.class);
+
+ private Condition m_condition=null;
+ private BPELElement m_activity=null;
+ private Else m_elsePath=null;
+ private java.util.List<Elseif> m_elseIfPaths=
+ new java.util.Vector<Elseif>();
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Invoke.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,82 @@
+/*
+ * 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.component;
+
+import org.scribble.conversation.model.ConversationInteraction;
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This class represents an unsupported (or custom) action within
+ * the conversation based ESB service descriptor.
+ *
+ * @author gary
+ */
+public class Invoke extends AbstractInteractionActivity {
+
+ private static final String INVOKE = "invoke";
+ private static final long serialVersionUID = 928076947383263387L;
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public Invoke(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param interaction The conversation
+ */
+ public Invoke(BPELLanguageModel model,
+ ConversationInteraction interaction) {
+ super(model, INVOKE, interaction);
+
+ initialize(interaction);
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ }
+
+ /**
+ * 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 void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Receive.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,82 @@
+/*
+ * 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.component;
+
+import org.scribble.conversation.model.ConversationInteraction;
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+/**
+ * This class represents an unsupported (or custom) action within
+ * the conversation based ESB service descriptor.
+ *
+ * @author gary
+ */
+public class Receive extends AbstractInteractionActivity {
+
+ private static final String RECEIVE = "receive";
+ private static final long serialVersionUID = -3041725198724191842L;
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public Receive(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param interaction The conversation
+ */
+ public Receive(BPELLanguageModel model,
+ ConversationInteraction interaction) {
+ super(model, RECEIVE, interaction);
+
+ initialize(interaction);
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ // Don't validate unsupported actions
+ }
+
+ /**
+ * 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 void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Reply.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,82 @@
+/*
+ * 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.component;
+
+import org.scribble.conversation.model.ConversationInteraction;
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This class represents a BPEL reply activity.
+ *
+ * @author gary
+ */
+public class Reply extends AbstractInteractionActivity {
+
+ private static final String REPLY = "reply";
+ private static final long serialVersionUID = 8582738107125170604L;
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public Reply(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param interaction The conversation
+ */
+ public Reply(BPELLanguageModel model,
+ ConversationInteraction interaction) {
+ super(model, REPLY, interaction);
+
+ initialize(interaction);
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ // Don't validate unsupported actions
+ }
+
+ /**
+ * 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 void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Sequence.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Sequence.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Sequence.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,161 @@
+/*
+ * 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.component;
+
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This class represents a sequence grouping activity.
+ *
+ * @author gary
+ */
+public class Sequence extends BPELElement {
+
+ public static final String SEQUENCE = "sequence";
+
+ private static final long serialVersionUID = 6656299352423612770L;
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public Sequence(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+
+ java.util.List<BPELElement> acts=
+ findChildElements(BPELElement.class);
+
+ for (int i=0; i < acts.size(); i++) {
+ if (acts.get(i).isActivity()) {
+ m_activities.add(acts.get(i));
+ }
+ }
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ */
+ public Sequence(BPELLanguageModel model) {
+ super(model, SEQUENCE);
+ }
+
+ /**
+ * This method identifies whether the BPEL element
+ * is an activity.
+ *
+ * @return Whether the element is an activity
+ */
+ @Override
+ public boolean isActivity() {
+ return(true);
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ }
+
+ /**
+ * 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 void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+ /**
+ * 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) {
+ if (pos == -1) {
+ m_activities.add(act);
+ getDOMElement().appendChild(act.getDOMElement());
+ } else {
+ m_activities.add(pos, act);
+
+ org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
+ org.w3c.dom.Element elem=null;
+ int cur=-1;
+
+ for (int i=0; i < nl.getLength(); i++) {
+ if (nl.item(i) instanceof org.w3c.dom.Element) {
+ cur++;
+
+ if (cur == pos) {
+ elem = (org.w3c.dom.Element)nl.item(i);
+ }
+ }
+ }
+
+ if (elem != null) {
+ getDOMElement().insertBefore(act.getDOMElement(), elem);
+ } else {
+ getDOMElement().appendChild(act.getDOMElement());
+ }
+ }
+ }
+
+ /**
+ * 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) {
+ boolean ret=m_activities.remove(act);
+
+ if (ret) {
+ getDOMElement().removeChild(act.getDOMElement());
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the list of activities associated
+ * with the grouping construct.
+ *
+ * @return The list of activities
+ */
+ public java.util.List<BPELElement> getActivities() {
+ return(m_activities);
+ }
+
+ private java.util.List<BPELElement> m_activities=
+ new java.util.Vector<BPELElement>();
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/While.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,76 @@
+/*
+ * 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.component;
+
+import org.scribble.model.*;
+import org.scribble.model.admin.ModelListener;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+
+/**
+ * This class represents a while grouping activity.
+ *
+ * @author gary
+ */
+public class While extends AbstractGroupingActivity {
+
+ private static final long serialVersionUID = -4173984531470466407L;
+ private static final String WHILE = "while";
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the activity
+ */
+ public While(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the activity.
+ *
+ * @param model The BPEL model
+ */
+ public While(BPELLanguageModel model) {
+ super(model, WHILE);
+ }
+
+ /**
+ * This method validates the BPEL activity and reports warnings or
+ * errors to the supplied model listener.
+ *
+ * @param l The model listener
+ */
+ @Override
+ public void validate(ModelListener l) {
+ }
+
+ /**
+ * 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 void convert(java.util.List<Activity> activities,
+ ConversionContext context) {
+ }
+
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELParser.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELParser.java 2009-03-30 19:51:42 UTC (rev 560)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/parser/BPELParser.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -18,14 +18,13 @@
package org.jboss.tools.overlord.cdl.bpel.parser;
import java.io.InputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.scribble.model.*;
import org.scribble.model.admin.ModelListener;
+import org.apache.log4j.Logger;
import org.jboss.tools.overlord.cdl.bpel.model.*;
import org.scribble.extensions.*;
import org.scribble.parser.Parser;
@@ -79,12 +78,11 @@
new String(b));
} catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to load model", e);
+ logger.error("Failed to load model", e);
}
return(ret);
}
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.parser");
+ private static Logger logger = Logger.getLogger(BPELParser.class);
}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElementTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElementTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/BPELElementTest.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,389 @@
+/*
+ * 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.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Condition;
+
+import junit.framework.TestCase;
+
+public class BPELElementTest extends TestCase {
+
+ public void testFindChildElements() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<elem xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<first/>"+
+ "<else/>"+
+ "<sequence/>"+
+ "<second/>"+
+ "<if/>"+
+ "</elem>";
+ 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");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ java.util.List<BPELElement> elems=
+ top.findChildElements(BPELElement.class);
+
+ if (elems == null) {
+ fail("Null list");
+ }
+
+ if (elems.size() != 3) {
+ fail("Expecting three child elements: "+elems.size());
+ }
+
+ if ((elems.get(0) instanceof Else) == false) {
+ fail("Element 0 not else: "+elems.get(0));
+ }
+
+ if ((elems.get(1) instanceof Sequence) == false) {
+ fail("Element 1 not sequence: "+elems.get(1));
+ }
+
+ if ((elems.get(2) instanceof If) == false) {
+ fail("Element 2 not 'if': "+elems.get(2));
+ }
+
+ elems = top.findChildElements(Sequence.class);
+
+ if (elems == null) {
+ fail("Null sequence list");
+ }
+
+ if (elems.size() != 1) {
+ fail("Expecting one child element: "+elems.size());
+ }
+
+ if ((elems.get(0) instanceof Sequence) == false) {
+ fail("Element 0 not sequence: "+elems.get(0));
+ }
+ }
+
+ public void testFindChildActivity() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<elem xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<first/>"+
+ "<else/>"+
+ "<sequence/>"+
+ "<second/>"+
+ "<if/>"+
+ "</elem>";
+ 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");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ BPELElement act=top.findChildActivity();
+
+ if (act == null) {
+ fail("Null activity");
+ }
+
+ if ((act instanceof Sequence) == false) {
+ fail("Activity not sequence");
+ }
+ }
+
+ public void testSetChildElement() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ TestBPELElement top=new TestBPELElement(model);
+
+ org.w3c.dom.Element newElem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ newElem = builder.newDocument().createElement("newelem");
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ if (top.getDOMElement().getFirstChild() != null) {
+ fail("Child element not expected");
+ }
+
+ top.setChildElement(null, newElem, null);
+
+ if (top.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("Should only be 1 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (top.getDOMElement().getChildNodes().item(0).getNodeName().
+ equals(newElem.getNodeName()) == false) {
+ fail("Node name of new child element not correct");
+ }
+ }
+
+ public void testSetChildElementAtBeginning() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<elem>"+
+ "<first/>"+
+ "<second/>"+
+ "<third/>"+
+ "</elem>";
+
+ 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");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ org.w3c.dom.Element newElem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ newElem = builder.newDocument().createElement("newelem");
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ if (top.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Should only be 3 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ top.setChildElement(null, newElem, top.getDOMElement().getFirstChild());
+
+ if (top.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Should only be 4 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (top.getDOMElement().getChildNodes().item(0).getNodeName().
+ equals(newElem.getNodeName()) == false) {
+ fail("Node name of new child element not correct");
+ }
+ }
+
+ public void testSetChildElementAtEnd() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<elem>"+
+ "<first/>"+
+ "<second/>"+
+ "<third/>"+
+ "</elem>";
+
+ 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");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ org.w3c.dom.Element newElem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ newElem = builder.newDocument().createElement("newelem");
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ if (top.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Should only be 3 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ top.setChildElement(null, newElem, null);
+
+ if (top.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Should only be 4 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (top.getDOMElement().getChildNodes().item(3).getNodeName().
+ equals(newElem.getNodeName()) == false) {
+ fail("Node name of new child element not correct");
+ }
+ }
+
+ public void testSetChildElementReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String first="first";
+ String second="second";
+
+ String xml="<elem>"+
+ "<newelem name=\""+first+"\" />"+
+ "</elem>";
+
+ 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");
+ }
+
+ TestBPELElement top=new TestBPELElement(model, elem);
+
+ org.w3c.dom.Element newElem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ newElem = builder.newDocument().createElement("newelem");
+ newElem.setAttribute("name", second);
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ if (top.getDOMElement().getFirstChild() == null) {
+ fail("First child element expected");
+ }
+
+ if ((top.getDOMElement().getFirstChild() instanceof
+ org.w3c.dom.Element) == false) {
+ fail("First child is not an element");
+ }
+
+ top.setChildElement((org.w3c.dom.Element)
+ top.getDOMElement().getFirstChild(),
+ newElem, null);
+
+ if (top.getDOMElement().getChildNodes().getLength() != 1) {
+ fail("Should only be 1 child node: "+top.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (top.getDOMElement().getChildNodes().item(0).getNodeName().
+ equals(newElem.getNodeName()) == false) {
+ fail("Node name of new child element not correct");
+ }
+
+ if (((org.w3c.dom.Element)top.getDOMElement().getChildNodes().
+ item(0)).getAttribute("name").equals(second) == false) {
+ fail("Attribute is not as expected");
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ConditionTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ConditionTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ConditionTest.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,96 @@
+/*
+ * 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.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Condition;
+
+import junit.framework.TestCase;
+
+public class ConditionTest extends TestCase {
+
+ public void testIsActivity() {
+ Condition act=new Condition(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testGetExpression() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+ Condition condition=new Condition(model);
+
+ String expr="Test Expression";
+
+ condition.setExpression(expr);
+
+ String result=condition.getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+ }
+
+ public void testGetExpressionFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr="Test Expression";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+expr+"</condition>";
+ 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");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ String result=condition.getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ElseIfTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ElseIfTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ElseIfTest.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,91 @@
+/*
+ * 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.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Elseif;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class ElseIfTest extends TestCase {
+
+ public void testIsActivity() {
+ Elseif act=new Elseif(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildElseIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr="Test Expression";
+
+ String xml="<elseif xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<condition>"+expr+"</condition><sequence/></elseif>";
+ 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");
+ }
+
+ Elseif elseif=new Elseif(model, elem);
+
+ if (elseif.getCondition() == null) {
+ fail("No condition");
+ }
+
+ if (elseif.getActivity() == null) {
+ fail("No activity");
+ }
+
+ String result=elseif.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+
+ if ((elseif.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ElseTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ElseTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/ElseTest.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,74 @@
+/*
+ * 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.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Else;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class ElseTest extends TestCase {
+
+ public void testIsActivity() {
+ Else act=new Else(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<else xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<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");
+ }
+
+ Else construct=new Else(model, elem);
+
+ if (construct.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((construct.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/IfTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/IfTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/IfTest.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,808 @@
+/*
+ * 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.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class IfTest extends TestCase {
+
+ public void testIsActivity() {
+ If act=new If(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testIfFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition>"+expr1+"</condition>"+
+ "<sequence/>"+
+ "</if>";
+
+ 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");
+ }
+
+ If component=new If(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+
+ if (component.getElsePath() != null) {
+ fail("Else path should be null");
+ }
+
+ if (component.getElseIfPaths().size() > 0) {
+ fail("No elseif paths should be set");
+ }
+ }
+
+ public void testIfElseFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition>"+expr1+"</condition>"+
+ "<sequence/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ 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");
+ }
+
+ If component=new If(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+
+ if (component.getElsePath() == null) {
+ fail("Else path is not set");
+ }
+
+ if ((component.getElsePath().getActivity() instanceof Sequence) == false) {
+ fail("Else path Activity not a sequence");
+ }
+
+ }
+
+ public void testIfElseIfsElseFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+ String expr3="Test Expression 3";
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition>"+expr1+"</condition>"+
+ "<sequence/>"+
+ "<elseif>"+
+ "<condition>"+expr2+"</condition>"+
+ "<sequence/>"+
+ "</elseif>"+
+ "<elseif>"+
+ "<condition>"+expr3+"</condition>"+
+ "<sequence/>"+
+ "</elseif>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ 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");
+ }
+
+ If component=new If(model, elem);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ if (component.getActivity() == null) {
+ fail("Activity not set");
+ }
+
+ if ((component.getActivity() instanceof Sequence) == false) {
+ fail("Activity not a sequence");
+ }
+
+ if (component.getElsePath() == null) {
+ fail("Else path is not set");
+ }
+
+ if ((component.getElsePath().getActivity() instanceof Sequence) == false) {
+ fail("Else path Activity not a sequence");
+ }
+
+ if (component.getElseIfPaths().size() != 2) {
+ fail("Two elseif paths expected: "+component.getElseIfPaths().size());
+ }
+
+ if (component.getElseIfPaths().get(0).getCondition() == null) {
+ fail("Elseif 0 no condition");
+ }
+
+ result=component.getElseIfPaths().get(0).getCondition().getExpression();
+
+ if (result == null) {
+ fail("Elseif 0 Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Elseif 0 Expression is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+
+ if (component.getElseIfPaths().get(0).getActivity() == null) {
+ fail("Elseif 0 no activity");
+ }
+
+ if ((component.getElseIfPaths().get(0).getActivity() instanceof Sequence) == false) {
+ fail("Elseif 0 Activity not a sequence");
+ }
+
+ if (component.getElseIfPaths().get(1).getCondition() == null) {
+ fail("Elseif 1 no condition");
+ }
+
+ result=component.getElseIfPaths().get(1).getCondition().getExpression();
+
+ if (result == null) {
+ fail("Elseif 1 Expression is null");
+ }
+
+ if (result.equals(expr3) == false) {
+ fail("Elseif 1 Expression is not valid: expecting '"+
+ expr3+"' but got '"+result+"'");
+ }
+
+ if (component.getElseIfPaths().get(1).getActivity() == null) {
+ fail("Elseif 1 no activity");
+ }
+
+ if ((component.getElseIfPaths().get(1).getActivity() instanceof Sequence) == false) {
+ fail("Elseif 1 Activity not a sequence");
+ }
+ }
+
+ public void testSetConditionNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+
+ String xml="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ 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");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ If component=new If(model);
+
+ component.setCondition(condition);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetConditionReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr1="Test Expression 1";
+ String expr2="Test Expression 2";
+
+ String xml1="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr1+
+ "</condition>";
+
+ String xml2="<condition xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ expr2+
+ "</condition>";
+
+ org.w3c.dom.Element elem1=null;
+ org.w3c.dom.Element elem2=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(xml1.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem1 = doc.getDocumentElement();
+
+ is.close();
+
+ is=new java.io.ByteArrayInputStream(xml2.getBytes());
+
+ doc=builder.parse(is);
+ elem2 = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ Condition condition1=new Condition(model, elem1);
+
+ If component=new If(model);
+
+ component.setCondition(condition1);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ String result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr1) == false) {
+ fail("Expression1 is not valid: expecting '"+
+ expr1+"' but got '"+result+"'");
+ }
+
+ Condition condition2=new Condition(model, elem2);
+
+ component.setCondition(condition2);
+
+ if (component.getCondition() == null) {
+ fail("Condition not set");
+ }
+
+ result=component.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr2) == false) {
+ fail("Expression2 is not valid: expecting '"+
+ expr2+"' but got '"+result+"'");
+ }
+ }
+
+ public void testSetActivityInsertBeforeElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=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);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+
+ component.setActivity(seq);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("Second element was not a sequence: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testSetActivityInsertBeforeElseIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<elseif>"+
+ "<condition/>"+
+ "<sequence/>"+
+ "</elseif>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=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);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getActivity() != null) {
+ fail("Activity should be null");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+
+ component.setActivity(seq);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(1).
+ getLocalName().equals(Sequence.SEQUENCE) == false) {
+ fail("Second element was not a sequence: "+
+ component.getDOMElement().getChildNodes().item(1).
+ getLocalName());
+ }
+ }
+
+ public void testAddElseIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=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);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getElseIfPaths().size() != 0) {
+ fail("Should be no elseif paths");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+ Elseif elseif=new Elseif(model);
+ elseif.setActivity(seq);
+
+ component.addElseIfPath(elseif);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(Elseif.ELSEIF) == false) {
+ fail("Third element was not an elseif: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+ }
+
+ public void testAddElseIfInsertBeforeElse() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=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);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getElseIfPaths().size() != 0) {
+ fail("Should be no elseif paths");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+ Elseif elseif=new Elseif(model);
+ elseif.setActivity(seq);
+
+ component.addElseIfPath(elseif);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 4) {
+ fail("Four child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(Elseif.ELSEIF) == false) {
+ fail("Third element was not an elseif: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+ }
+
+ public void testSetElseNew() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=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);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getElsePath() != null) {
+ fail("Should be no else path");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 2) {
+ fail("Two child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ Sequence seq=new Sequence(model);
+ Else elseElem=new Else(model);
+ elseElem.setActivity(seq);
+
+ component.setElsePath(elseElem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(Else.ELSE) == false) {
+ fail("Third element was not an else: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+ }
+
+
+ public void testSetElseReplace() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<if xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<condition/>"+
+ "<sequence/>"+
+ "<else>"+
+ "<sequence/>"+
+ "</else>"+
+ "</if>";
+
+ org.w3c.dom.Element ifelem=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);
+ ifelem = doc.getDocumentElement();
+
+ is.close();
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ If component=new If(model, ifelem);
+
+ if (component.getElsePath() == null) {
+ fail("Should have else path");
+ }
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ If sub=new If(model);
+ Else elseElem=new Else(model);
+ elseElem.setActivity(sub);
+
+ component.setElsePath(elseElem);
+
+ if (component.getDOMElement().getChildNodes().getLength() != 3) {
+ fail("Three child elements expected: "+
+ component.getDOMElement().getChildNodes().getLength());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).
+ getLocalName().equals(Else.ELSE) == false) {
+ fail("Third element was not an else: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getLocalName());
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).getFirstChild() == null) {
+ fail("Third element has no child");
+ }
+
+ if (component.getDOMElement().getChildNodes().item(2).getFirstChild().
+ getLocalName().equals(If.IF) == false) {
+ fail("Third element child was not an if: "+
+ component.getDOMElement().getChildNodes().item(2).
+ getFirstChild().getLocalName());
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/SequenceTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/SequenceTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/SequenceTest.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -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.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+
+import junit.framework.TestCase;
+
+public class SequenceTest extends TestCase {
+
+ public void testIsActivity() {
+ Sequence act=new Sequence(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == false) {
+ fail("Should be an activity");
+ }
+ }
+
+ public void testSequenceFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<sequence xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">"+
+ "<if/>"+
+ "<if/>"+
+ "</sequence>";
+
+ 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");
+ }
+
+ Sequence component=new Sequence(model, elem);
+
+ if (component.getActivities().size() != 2) {
+ fail("Expecting 2 child activities: "+
+ component.getActivities().size());
+ }
+ }
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestBPELElement.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestBPELElement.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/TestBPELElement.java 2009-03-30 20:19:51 UTC (rev 561)
@@ -0,0 +1,45 @@
+/*
+ * 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.component;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+import org.w3c.dom.Element;
+
+public class TestBPELElement extends BPELElement {
+
+ private static final long serialVersionUID = 6428569513605691840L;
+
+ public TestBPELElement(BPELLanguageModel model, Element elem) {
+ super(model, elem);
+ }
+
+ public TestBPELElement(BPELLanguageModel model) {
+ super(model, "test");
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
15 years
Overlord SVN: r560 - cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-03-30 15:51:42 -0400 (Mon, 30 Mar 2009)
New Revision: 560
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/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/IfModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/RunModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/SpawnModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhenModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhileModelChangeRule.java
Log:
Refactoring to remove 'activity' distinction, and additional tests around the model for if/elseif/else constructs, built from DOM and also programmatically.
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-30 17:06:51 UTC (rev 559)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/AbstractBPELModelChangeRule.java 2009-03-30 19:51:42 UTC (rev 560)
@@ -20,7 +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;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Sequence;
/**
* This is the abstract ESB model change rule.
@@ -43,7 +43,7 @@
Model model, ModelObject mobj, ModelObject ref) {
boolean ret=false;
- if (context.getParent() instanceof SequenceActivity &&
+ if (context.getParent() instanceof Sequence &&
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-30 17:06:51 UTC (rev 559)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationInteractionModelChangeRule.java 2009-03-30 19:51:42 UTC (rev 560)
@@ -19,7 +19,7 @@
import org.jboss.tools.overlord.cdl.bpel.model.*;
import org.jboss.tools.overlord.cdl.bpel.model.util.*;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.jboss.tools.overlord.cdl.bpel.model.component.*;
import org.scribble.model.*;
import org.scribble.model.change.*;
import org.scribble.conversation.model.*;
@@ -94,11 +94,11 @@
if (InteractionUtil.isSend(interaction)) {
if (InteractionUtil.isRequest(interaction)) {
- InvokeActivity act=new InvokeActivity(bpelModel,
+ Invoke act=new Invoke(bpelModel,
interaction);
- if (context.getParent() instanceof SequenceActivity) {
- ((SequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof Sequence) {
+ ((Sequence)context.getParent()).addActivity(act, -1);
ret = true;
}
@@ -110,22 +110,22 @@
// possibly wrapped around, or contained within the
// invoke.
} else {
- ReplyActivity act=new ReplyActivity(bpelModel,
+ Reply act=new Reply(bpelModel,
interaction);
- if (context.getParent() instanceof SequenceActivity) {
- ((SequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof Sequence) {
+ ((Sequence)context.getParent()).addActivity(act, -1);
ret = true;
}
}
} else {
if (InteractionUtil.isRequest(interaction)) {
- ReceiveActivity act=new ReceiveActivity(bpelModel,
+ Receive act=new Receive(bpelModel,
interaction);
- if (context.getParent() instanceof SequenceActivity) {
- ((SequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof Sequence) {
+ ((Sequence)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-30 17:06:51 UTC (rev 559)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationModelChangeRule.java 2009-03-30 19:51:42 UTC (rev 560)
@@ -18,7 +18,7 @@
package org.jboss.tools.overlord.cdl.bpel.model.change;
import org.jboss.tools.overlord.cdl.bpel.model.*;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.jboss.tools.overlord.cdl.bpel.model.component.*;
import org.scribble.model.*;
import org.scribble.model.change.*;
import org.scribble.conversation.model.*;
@@ -89,7 +89,7 @@
DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
Conversation conv=(Conversation)mobj;
- SequenceActivity seq=new SequenceActivity(bpelModel);
+ Sequence seq=new Sequence(bpelModel);
// Check if root conversation
if (conv.getParent() instanceof Model) {
@@ -97,9 +97,9 @@
// Add sequence to model
bpelModel.setActivity(seq);
- } else if (context.getParent() instanceof SequenceActivity) {
+ } else if (context.getParent() instanceof Sequence) {
- ((SequenceActivity)context.getParent()).addActivity(seq, -1);
+ ((Sequence)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/IfModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java 2009-03-30 17:06:51 UTC (rev 559)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java 2009-03-30 19:51:42 UTC (rev 560)
@@ -18,10 +18,9 @@
package org.jboss.tools.overlord.cdl.bpel.model.change;
import org.jboss.tools.overlord.cdl.bpel.model.*;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.jboss.tools.overlord.cdl.bpel.model.component.*;
import org.scribble.model.*;
import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
import org.scribble.extensions.RegistryInfo;
/**
@@ -46,7 +45,7 @@
Model model, ModelObject mobj, ModelObject ref) {
boolean ret=false;
- if (mobj instanceof If &&
+ if (mobj instanceof org.scribble.conversation.model.If &&
model instanceof DefaultBPELLanguageModel) {
ret = true;
}
@@ -85,25 +84,29 @@
public boolean insert(ModelChangeContext context,
Model model, ModelObject mobj, ModelObject ref) {
DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
- If elem=(If)mobj;
+ org.scribble.conversation.model.If elem=
+ (org.scribble.conversation.model.If)mobj;
- IfActivity act=new IfActivity(bpelModel);
+ If act=new If(bpelModel);
- if (context.getParent() instanceof SequenceActivity) {
- ((SequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof Sequence) {
+ ((Sequence)context.getParent()).addActivity(act, -1);
}
for (int i=0; i < elem.getPaths().size(); i++) {
Block path=elem.getPaths().get(i);
- SequenceActivity seq=new SequenceActivity(bpelModel);
+ Sequence seq=new Sequence(bpelModel);
if (i == 0) {
- act.setConditionPath(seq);
+ act.setActivity(seq);
} else if (i == elem.getPaths().size()-1) {
- act.setElsePath(seq);
+ Else construct=new Else(bpelModel);
+ construct.setActivity(seq);
+
+ act.setElsePath(construct);
} else {
- ElseIfConstruct construct=new ElseIfConstruct(bpelModel);
+ Elseif construct=new Elseif(bpelModel);
construct.setActivity(seq);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/RunModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/RunModelChangeRule.java 2009-03-30 17:06:51 UTC (rev 559)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/RunModelChangeRule.java 2009-03-30 19:51:42 UTC (rev 560)
@@ -18,7 +18,7 @@
package org.jboss.tools.overlord.cdl.bpel.model.change;
import org.jboss.tools.overlord.cdl.bpel.model.*;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.jboss.tools.overlord.cdl.bpel.model.component.*;
import org.scribble.model.*;
import org.scribble.model.change.*;
import org.scribble.conversation.model.*;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/SpawnModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/SpawnModelChangeRule.java 2009-03-30 17:06:51 UTC (rev 559)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/SpawnModelChangeRule.java 2009-03-30 19:51:42 UTC (rev 560)
@@ -18,7 +18,7 @@
package org.jboss.tools.overlord.cdl.bpel.model.change;
import org.jboss.tools.overlord.cdl.bpel.model.*;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.jboss.tools.overlord.cdl.bpel.model.component.*;
import org.scribble.model.*;
import org.scribble.model.change.*;
import org.scribble.conversation.model.*;
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhenModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhenModelChangeRule.java 2009-03-30 17:06:51 UTC (rev 559)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhenModelChangeRule.java 2009-03-30 19:51:42 UTC (rev 560)
@@ -18,7 +18,7 @@
package org.jboss.tools.overlord.cdl.bpel.model.change;
import org.jboss.tools.overlord.cdl.bpel.model.*;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.jboss.tools.overlord.cdl.bpel.model.component.*;
import org.scribble.model.*;
import org.scribble.model.change.*;
import org.scribble.conversation.model.*;
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-30 17:06:51 UTC (rev 559)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhileModelChangeRule.java 2009-03-30 19:51:42 UTC (rev 560)
@@ -18,10 +18,9 @@
package org.jboss.tools.overlord.cdl.bpel.model.change;
import org.jboss.tools.overlord.cdl.bpel.model.*;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.jboss.tools.overlord.cdl.bpel.model.component.*;
import org.scribble.model.*;
import org.scribble.model.change.*;
-import org.scribble.conversation.model.*;
import org.scribble.extensions.RegistryInfo;
/**
@@ -46,7 +45,7 @@
Model model, ModelObject mobj, ModelObject ref) {
boolean ret=false;
- if (mobj instanceof While &&
+ if (mobj instanceof org.scribble.conversation.model.While &&
model instanceof DefaultBPELLanguageModel) {
ret = true;
}
@@ -85,15 +84,16 @@
public boolean insert(ModelChangeContext context,
Model model, ModelObject mobj, ModelObject ref) {
DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
- While elem=(While)mobj;
+ org.scribble.conversation.model.While elem=
+ (org.scribble.conversation.model.While)mobj;
- WhileActivity act=new WhileActivity(bpelModel);
+ While act=new While(bpelModel);
- SequenceActivity seq=new SequenceActivity(bpelModel);
- act.setContainedActivity(seq);
+ Sequence seq=new Sequence(bpelModel);
+ act.setActivity(seq);
- if (context.getParent() instanceof SequenceActivity) {
- ((SequenceActivity)context.getParent()).addActivity(act, -1);
+ if (context.getParent() instanceof Sequence) {
+ ((Sequence)context.getParent()).addActivity(act, -1);
}
// Process the activities within the conversation
15 years
Overlord SVN: r559 - cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-03-30 13:06:51 -0400 (Mon, 30 Mar 2009)
New Revision: 559
Removed:
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/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/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/InvokeActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReceiveActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReplyActivity.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/activities/WhileActivity.java
Log:
Deleted: 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-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractGroupingActivity.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,71 +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.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This is the generic BPEL activity class.
- *
- * @author gary
- */
-public abstract class AbstractGroupingActivity extends BPELElement {
-
- /**
- * The constructor for initializing the activity based on
- * an existing DOM element.
- */
- protected AbstractGroupingActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The contructor for initializing a new activity.
- */
- protected AbstractGroupingActivity(BPELLanguageModel model,
- String activityName) {
- super(model, activityName);
- }
-
- /**
- * This method sets the contained activity.
- *
- * @param act The contained activity
- */
- public void setContainedActivity(BPELElement act) {
- m_containedActivity = act;
-
- getDOMElement().appendChild(act.getDOMElement());
- }
-
- /**
- * This method returns the contained activity.
- *
- * @return The contained activity
- */
- public BPELElement getContainedActivity() {
- return(m_containedActivity);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
-
- private BPELElement m_containedActivity=null;
-}
Deleted: 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-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractInteractionActivity.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,82 +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 org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This class represents an abstract interaction activity.
- *
- * @author gary
- */
-public abstract class AbstractInteractionActivity extends BPELElement {
-
- private static final long serialVersionUID = -5048477859609625462L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public AbstractInteractionActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param interaction The conversation
- */
- public AbstractInteractionActivity(BPELLanguageModel model,
- String name, ConversationInteraction interaction) {
- super(model, name);
-
- initialize(interaction);
- }
-
- /**
- * This method initializes the invoke interaction.
- *
- * @param interaction The invoke interaction
- */
- protected void initialize(ConversationInteraction interaction) {
-
- getDOMElement().setAttribute("operation",
- interaction.getMessageSignature().getOperation());
-
- // TODO: Record variables against relevant interaction
- // based activity - probably only mechanism for
- // establishing message type
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
-}
Deleted: 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/BPELElement.java 2009-03-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElement.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,168 +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 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;
-}
Deleted: 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/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElementFactory.java 2009-03-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/BPELElementFactory.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,71 +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.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");
-}
Deleted: 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-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/Condition.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,106 +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.List;
-
-import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
-import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
-import org.scribble.model.Activity;
-
-/**
- * This class represents the BPEL condition element.
- */
-public class Condition extends BPELElement {
-
- private static final long serialVersionUID = 8666349106632652777L;
-
- public static final String CONDITION="condition";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param elem The XML configuration details for the element
- */
- public Condition(BPELLanguageModel model,
- org.w3c.dom.Element elem) {
- super(model, elem);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public Condition(BPELLanguageModel model) {
- super(model, CONDITION);
- }
-
- /**
- * This method returns the expression associated
- * with the condition.
- *
- * @return The expression
- */
- public String getExpression() {
- String ret=null;
-
- getDOMElement().normalize();
-
- if (getDOMElement().getFirstChild() instanceof org.w3c.dom.Text) {
- org.w3c.dom.Text text=(org.w3c.dom.Text)
- getDOMElement().getFirstChild();
-
- ret = text.getNodeValue();
- }
-
- return(ret);
- }
-
- /**
- * This method sets the expression.
- *
- * @param expr The expression
- */
- public void setExpression(String expr) {
-
- getDOMElement().normalize();
-
- if (getDOMElement().getFirstChild() == null) {
- org.w3c.dom.Text text=
- getDOMElement().getOwnerDocument().createTextNode(expr);
-
- getDOMElement().appendChild(text);
-
- } else if (getDOMElement().getFirstChild() instanceof org.w3c.dom.Text) {
- org.w3c.dom.Text text=(org.w3c.dom.Text)
- getDOMElement().getFirstChild();
-
- text.setNodeValue(expr);
- }
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
-
-}
Deleted: 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-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseConstruct.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,98 +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.List;
-
-import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
-import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
-import org.scribble.model.Activity;
-
-/**
- * This class represents the 'else' construct contained
- * within the 'if' activity.
- */
-public class ElseConstruct extends BPELElement {
-
- private static final long serialVersionUID = 1243775332210724718L;
-
- private static final String ELSE="else";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public ElseConstruct(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public ElseConstruct(BPELLanguageModel model) {
- super(model, ELSE);
- }
-
-
- /**
- * 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
-
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- private BPELElement m_activity;
-}
Deleted: 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-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ElseIfConstruct.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,125 +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.List;
-
-import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
-import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
-import org.scribble.model.Activity;
-
-/**
- * This class represents the 'elseif' construct contained
- * within the 'if' activity.
- */
-public class ElseIfConstruct extends BPELElement {
-
- private static final long serialVersionUID = 6371029130621912170L;
-
- private static final String ELSEIF="elseif";
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the element
- */
- public ElseIfConstruct(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the element.
- *
- * @param model The BPEL model
- */
- public ElseIfConstruct(BPELLanguageModel model) {
- super(model, ELSEIF);
- }
-
- /**
- * 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();
- }
-
- @Override
- public void convert(List<Activity> activities, ConversionContext context) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method sets the condition.
- *
- * @param cond The condition
- */
- public void setCondition(Condition cond) {
- m_condition = cond;
- }
-
- /**
- * This method returns the condition.
- *
- * @return The condition
- */
- public Condition getCondition() {
- return(m_condition);
- }
-
- /**
- * This method sets the activity associated with
- * the 'else' construct.
- *
- * @param act The activity
- */
- public void setActivity(BPELElement act) {
- m_activity = act;
- }
-
- /**
- * This method returns the activity associated with
- * the 'else' construct.
- *
- * @return The activity
- */
- public BPELElement getActivity() {
- return(m_activity);
- }
-
- private Condition m_condition;
- private BPELElement m_activity;
-}
Deleted: 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-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/IfActivity.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,149 +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 org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This class represents an 'if' grouping construct.
- *
- * @author gary
- */
-public class IfActivity extends BPELElement {
-
- private static final long serialVersionUID = -763221632866464831L;
- private static final String IF = "if";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public IfActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public IfActivity(BPELLanguageModel model) {
- super(model, IF);
- }
-
- /**
- * 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.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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 void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- public void setCondition(Condition cond) {
- m_condition = cond;
- }
-
- public Condition getCondition() {
- return(m_condition);
- }
-
- public void setConditionPath(BPELElement act) {
- m_activity = act;
- getDOMElement().appendChild(act.getDOMElement());
- }
-
- public BPELElement getConditionPath() {
- return(m_activity);
- }
-
- public void addElseIfPath(ElseIfConstruct act) {
- m_elseIfPaths.add(act);
-
- org.w3c.dom.Element elem=getDOMElement().getOwnerDocument().createElement("elseif");
-
- getDOMElement().appendChild(elem);
- elem.appendChild(act.getDOMElement());
- }
-
- public java.util.List<ElseIfConstruct> getElseIfPaths() {
- return(m_elseIfPaths);
- }
-
- public void setElsePath(BPELElement act) {
- m_elsePath = act;
-
- org.w3c.dom.Element elem=getDOMElement().getOwnerDocument().createElement("else");
-
- getDOMElement().appendChild(elem);
- elem.appendChild(act.getDOMElement());
- }
-
- public BPELElement getElsePath() {
- return(m_elsePath);
- }
-
- private Condition m_condition=null;
- private BPELElement m_activity=null;
- private BPELElement m_elsePath=null;
- private java.util.List<ElseIfConstruct> m_elseIfPaths=
- new java.util.Vector<ElseIfConstruct>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/InvokeActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/InvokeActivity.java 2009-03-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/InvokeActivity.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,82 +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 org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This class represents an unsupported (or custom) action within
- * the conversation based ESB service descriptor.
- *
- * @author gary
- */
-public class InvokeActivity extends AbstractInteractionActivity {
-
- private static final String INVOKE = "invoke";
- private static final long serialVersionUID = 928076947383263387L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public InvokeActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param interaction The conversation
- */
- public InvokeActivity(BPELLanguageModel model,
- ConversationInteraction interaction) {
- super(model, INVOKE, interaction);
-
- initialize(interaction);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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 void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReceiveActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReceiveActivity.java 2009-03-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReceiveActivity.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,82 +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 org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-/**
- * This class represents an unsupported (or custom) action within
- * the conversation based ESB service descriptor.
- *
- * @author gary
- */
-public class ReceiveActivity extends AbstractInteractionActivity {
-
- private static final String RECEIVE = "receive";
- private static final long serialVersionUID = -3041725198724191842L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public ReceiveActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param interaction The conversation
- */
- public ReceiveActivity(BPELLanguageModel model,
- ConversationInteraction interaction) {
- super(model, RECEIVE, interaction);
-
- initialize(interaction);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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 void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReplyActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReplyActivity.java 2009-03-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReplyActivity.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,82 +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 org.scribble.conversation.model.ConversationInteraction;
-import org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This class represents a BPEL reply activity.
- *
- * @author gary
- */
-public class ReplyActivity extends AbstractInteractionActivity {
-
- private static final String REPLY = "reply";
- private static final long serialVersionUID = 8582738107125170604L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public ReplyActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param interaction The conversation
- */
- public ReplyActivity(BPELLanguageModel model,
- ConversationInteraction interaction) {
- super(model, REPLY, interaction);
-
- initialize(interaction);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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 void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
-}
Deleted: 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-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/SequenceActivity.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,140 +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 org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This class represents a sequence grouping activity.
- *
- * @author gary
- */
-public class SequenceActivity extends BPELElement {
-
- private static final String SEQUENCE = "sequence";
- private static final long serialVersionUID = 6656299352423612770L;
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public SequenceActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public SequenceActivity(BPELLanguageModel model) {
- super(model, SEQUENCE);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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 void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
- /**
- * 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) {
- if (pos == -1) {
- m_activities.add(act);
- getDOMElement().appendChild(act.getDOMElement());
- } else {
- m_activities.add(pos, act);
-
- org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
- org.w3c.dom.Element elem=null;
- int cur=-1;
-
- for (int i=0; i < nl.getLength(); i++) {
- if (nl.item(i) instanceof org.w3c.dom.Element) {
- cur++;
-
- if (cur == pos) {
- elem = (org.w3c.dom.Element)nl.item(i);
- }
- }
- }
-
- if (elem != null) {
- getDOMElement().insertBefore(act.getDOMElement(), elem);
- } else {
- getDOMElement().appendChild(act.getDOMElement());
- }
- }
- }
-
- /**
- * 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) {
- boolean ret=m_activities.remove(act);
-
- if (ret) {
- getDOMElement().removeChild(act.getDOMElement());
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of activities associated
- * with the grouping construct.
- *
- * @return The list of activities
- */
- public java.util.List<BPELElement> getActivities() {
- return(m_activities);
- }
-
- private java.util.List<BPELElement> m_activities=
- new java.util.Vector<BPELElement>();
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/WhileActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/WhileActivity.java 2009-03-28 12:41:24 UTC (rev 558)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/WhileActivity.java 2009-03-30 17:06:51 UTC (rev 559)
@@ -1,76 +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 org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This class represents a while grouping activity.
- *
- * @author gary
- */
-public class WhileActivity extends AbstractGroupingActivity {
-
- private static final long serialVersionUID = -4173984531470466407L;
- private static final String WHILE = "while";
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public WhileActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- */
- public WhileActivity(BPELLanguageModel model) {
- super(model, WHILE);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- }
-
- /**
- * 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 void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
-}
15 years
Overlord SVN: r558 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src: java/org/jboss/tools/overlord/cdl/bpel/model/activities and 2 other directories.
by overlord-commits@lists.jboss.org
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\">"+expr+"</condition>";
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\">" +
+ "<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\">" +
+ "<condition>"+expr+"</condition><sequence/></elseif>";
org.w3c.dom.Element elem=null;
try {
15 years, 1 month
Overlord SVN: r557 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel: src and 11 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-03-27 19:41:54 -0400 (Fri, 27 Mar 2009)
New Revision: 557
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/activities/
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
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/UnsupportedActivity.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/.classpath
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/AbstractBPELElement.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
Log:
Initialise the condition and elseIf constructs, and define some tests.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/.classpath
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/.classpath 2009-03-27 21:04:21 UTC (rev 556)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/.classpath 2009-03-27 23:41:54 UTC (rev 557)
@@ -4,5 +4,6 @@
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="src/plugintest"/>
+ <classpathentry kind="src" path="src/test"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: 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 21:04:21 UTC (rev 556)
+++ 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)
@@ -19,13 +19,12 @@
import java.util.logging.Logger;
-import org.jboss.tools.overlord.cdl.bpel.model.activities.UnsupportedActivity;
-
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
@@ -40,7 +39,13 @@
BPELElement ret=null;
String activityType=activity.getNodeName();
- String clsName=MODEL_ACTIVITIES_PACKAGE+"."+activityType;
+ // 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<?>)
@@ -53,14 +58,9 @@
ret = (BPELElement)con.newInstance(new Object[]{model, activity});
} catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
+ logger.log(java.util.logging.Level.FINEST,
"Unable to find action class '"+clsName+"'", e);
}
-
- if (ret == null) {
- // Unrecognised or unsupported activity
- ret = new UnsupportedActivity(model, activity);
- }
return(ret);
}
Modified: 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 21:04:21 UTC (rev 556)
+++ 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)
@@ -32,6 +32,8 @@
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.
@@ -104,6 +106,52 @@
}
/**
+ * 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.
*
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 21:04:21 UTC (rev 556)
+++ 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)
@@ -30,7 +30,7 @@
private static final long serialVersionUID = 8666349106632652777L;
- private static final String CONDITION="condition";
+ public static final String CONDITION="condition";
/**
* The constructor for the element.
@@ -52,6 +52,12 @@
super(model, CONDITION);
}
+ /**
+ * This method returns the expression associated
+ * with the condition.
+ *
+ * @return The expression
+ */
public String getExpression() {
String ret=null;
@@ -67,6 +73,11 @@
return(ret);
}
+ /**
+ * This method sets the expression.
+ *
+ * @param expr The expression
+ */
public void setExpression(String expr) {
getDOMElement().normalize();
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 21:04:21 UTC (rev 556)
+++ 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)
@@ -30,6 +30,8 @@
*/
public class ElseConstruct extends AbstractBPELElement {
+ private static final long serialVersionUID = 1243775332210724718L;
+
private static final String ELSE="else";
/**
@@ -59,10 +61,22 @@
}
+ /**
+ * This method sets the activity associated with
+ * the 'else' construct.
+ *
+ * @param act The activity
+ */
public void setActivity(BPELElement act) {
m_activity = act;
}
+ /**
+ * This method returns the activity associated with
+ * the 'else' construct.
+ *
+ * @return The activity
+ */
public BPELElement getActivity() {
return(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 21:04:21 UTC (rev 556)
+++ 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)
@@ -54,6 +54,28 @@
super(model, ELSEIF);
}
+ /**
+ * 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();
+ }
@Override
public void convert(List<Activity> activities, ConversionContext context) {
@@ -61,22 +83,44 @@
}
+ /**
+ * This method sets the condition.
+ *
+ * @param cond The condition
+ */
public void setCondition(Condition cond) {
m_condition = cond;
}
+ /**
+ * This method returns the condition.
+ *
+ * @return The condition
+ */
public Condition getCondition() {
return(m_condition);
}
+ /**
+ * This method sets the activity associated with
+ * the 'else' construct.
+ *
+ * @param act The activity
+ */
public void setActivity(BPELElement act) {
m_activity = act;
}
+ /**
+ * This method returns the activity associated with
+ * the 'else' construct.
+ *
+ * @return The activity
+ */
public BPELElement getActivity() {
return(m_activity);
}
- private Condition m_condition=null;
- private BPELElement m_activity=null;
+ private Condition m_condition;
+ private BPELElement m_activity;
}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/UnsupportedActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/UnsupportedActivity.java 2009-03-27 21:04:21 UTC (rev 556)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/UnsupportedActivity.java 2009-03-27 23:41:54 UTC (rev 557)
@@ -1,65 +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 org.scribble.model.*;
-import org.scribble.model.admin.ModelListener;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-/**
- * This class represents an unsupported (or custom) action within
- * the conversation based ESB service descriptor.
- *
- * @author gary
- */
-public class UnsupportedActivity extends AbstractBPELElement {
-
- /**
- * The constructor for the activity.
- *
- * @param model The BPEL model
- * @param activity The XML configuration details for the activity
- */
- public UnsupportedActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- super(model, activity);
- }
-
- /**
- * This method validates the BPEL activity and reports warnings or
- * errors to the supplied model listener.
- *
- * @param l The model listener
- */
- @Override
- public void validate(ModelListener l) {
- // Don't validate unsupported actions
- }
-
- /**
- * 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 void convert(java.util.List<Activity> activities,
- ConversionContext context) {
- }
-
-}
Added: 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 (rev 0)
+++ 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)
@@ -0,0 +1,83 @@
+/*
+ * 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 ConditionTest extends TestCase {
+
+ public void testGetExpression() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+ Condition condition=new Condition(model);
+
+ String expr="Test Expression";
+
+ condition.setExpression(expr);
+
+ String result=condition.getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+ }
+
+ public void testGetExpressionFromDOM() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr="Test Expression";
+
+ String xml="<condition>"+expr+"</condition>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilder builder=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance().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");
+ }
+
+ Condition condition=new Condition(model, elem);
+
+ String result=condition.getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+ }
+}
Added: 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 (rev 0)
+++ 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)
@@ -0,0 +1,80 @@
+/*
+ * 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 ElseIfConstructTest extends TestCase {
+
+ public void testBuildElseIf() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String expr="Test Expression";
+
+ String xml="<elseif><condition>"+expr+"</condition><sequence/></elseif>";
+ 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");
+ }
+
+ ElseIfConstruct elseif=new ElseIfConstruct(model, elem);
+
+ if (elseif.getCondition() == null) {
+ fail("No condition");
+ }
+
+ if (elseif.getActivity() == null) {
+ fail("No activity");
+ }
+
+ String result=elseif.getCondition().getExpression();
+
+ if (result == null) {
+ fail("Expression is null");
+ }
+
+ if (result.equals(expr) == false) {
+ fail("Expression is not valid: expecting '"+
+ expr+"' but got '"+result+"'");
+ }
+
+ if ((elseif.getActivity() instanceof SequenceActivity) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
15 years, 1 month
Overlord SVN: r556 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel: src and 5 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-03-27 17:04:21 -0400 (Fri, 27 Mar 2009)
New Revision: 556
Added:
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/activities/AbstractBPELElement.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/plugintest/
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivityFactory.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/.classpath
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/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/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/activities/UnsupportedActivity.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/GeneratorTest.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/PurchaseGoodsProcess(a)Broker.bpel
Log:
Moving plugin tests into specific folder, to separate from normal junit tests. Adding more detail to BPEL model.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/.classpath
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/.classpath 2009-03-27 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/.classpath 2009-03-27 21:04:21 UTC (rev 556)
@@ -3,6 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/java"/>
- <classpathentry kind="src" path="src/test"/>
+ <classpathentry kind="src" path="src/plugintest"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivity.java 2009-03-27 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivity.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -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 BPELActivity {
-
- /**
- * This method returns the XML configuration representation
- * of the activity.
- *
- * @return The XML configuration for the activity
- */
- public org.w3c.dom.Element getActivity();
-
-}
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivityFactory.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivityFactory.java 2009-03-27 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivityFactory.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -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;
-
-import org.jboss.tools.overlord.cdl.bpel.model.activities.UnsupportedActivity;
-
-public class BPELActivityFactory {
-
- public static final String MODEL_ACTIVITIES_PACKAGE =
- "org.jboss.tools.overlord.cdl.bpel.model.activities";
-
- /**
- * 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 BPELActivity createActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- BPELActivity ret=null;
- String activityType=activity.getNodeName();
-
- String clsName=MODEL_ACTIVITIES_PACKAGE+"."+activityType;
-
- try {
- Class<?> cls=(Class<?>)
- Class.forName(clsName);
-
- java.lang.reflect.Constructor<?> con=
- cls.getConstructor(new Class<?>[]{BPELLanguageModel.class,
- org.w3c.dom.Element.class});
-
- ret = (BPELActivity)con.newInstance(new Object[]{model, activity});
-
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Unable to find action class '"+clsName+"'", e);
- }
-
- if (ret == null) {
- // Unrecognised or unsupported activity
- ret = new UnsupportedActivity(model, activity);
- }
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
-}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElement.java (from rev 555, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivity.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElement.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElement.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -0,0 +1,30 @@
+/*
+ * 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();
+
+}
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElementFactory.java (from rev 555, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivityFactory.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElementFactory.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELElementFactory.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -0,0 +1,69 @@
+/*
+ * 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;
+
+import org.jboss.tools.overlord.cdl.bpel.model.activities.UnsupportedActivity;
+
+public class BPELElementFactory {
+
+ public static final String MODEL_ACTIVITIES_PACKAGE =
+ "org.jboss.tools.overlord.cdl.bpel.model.activities";
+
+ /**
+ * 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();
+
+ String clsName=MODEL_ACTIVITIES_PACKAGE+"."+activityType;
+
+ 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.SEVERE,
+ "Unable to find action class '"+clsName+"'", e);
+ }
+
+ if (ret == null) {
+ // Unrecognised or unsupported activity
+ ret = new UnsupportedActivity(model, activity);
+ }
+
+ 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/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 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELSequenceActivity.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -17,7 +17,7 @@
*/
package org.jboss.tools.overlord.cdl.bpel.model;
-public interface BPELSequenceActivity extends BPELActivity {
+public interface BPELSequenceActivity extends BPELElement {
/**
* This method adds an activity to the grouping construct.
@@ -25,7 +25,7 @@
* @param act The activity to be added
* @param pos The position to add, or -1 if at the end
*/
- public void addActivity(BPELActivity act, int pos);
+ public void addActivity(BPELElement act, int pos);
/**
* This method removes an activity from the grouping
@@ -34,7 +34,7 @@
* @param act The activity to be removed
* @return Whether the activity was removed
*/
- public boolean removeActivity(BPELActivity act);
+ public boolean removeActivity(BPELElement act);
/**
* This method returns the list of activities associated
@@ -42,6 +42,6 @@
*
* @return The list of activities
*/
- public java.util.List<BPELActivity> getActivities();
+ 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 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/DefaultBPELLanguageModel.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -152,7 +152,7 @@
public void setActivity(BPELSequenceActivity act) {
m_activity = act;
- m_bpelProcess.appendChild(act.getActivity());
+ m_bpelProcess.appendChild(act.getDOMElement());
}
/**
Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELActivity.java 2009-03-27 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELActivity.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -1,121 +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 activity class.
- *
- * @author gary
- */
-public abstract class AbstractBPELActivity extends ModelObject
- implements BPELActivity {
-
- /**
- * The constructor for initializing the activity based on
- * an existing DOM element.
- */
- protected AbstractBPELActivity(BPELLanguageModel model,
- org.w3c.dom.Element activity) {
- m_model = model;
-
- initExistingActivity(model, activity);
- }
-
- /**
- * The contructor for initializing a new activity.
- */
- protected AbstractBPELActivity(BPELLanguageModel model,
- String activityName) {
- m_model = model;
-
- initNewAction(model, activityName);
- }
-
- /**
- * This method initializes the activity.
- *
- * @param model The BPEL model
- * @param activity The activity name
- */
- protected void initNewAction(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 initExistingActivity(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 getActivity() {
- return(m_activity);
- }
-
- /**
- * 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/AbstractBPELElement.java (from rev 555, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELActivity.java)
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractBPELElement.java (rev 0)
+++ 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 21:04:21 UTC (rev 556)
@@ -0,0 +1,121 @@
+/*
+ * 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 {
+
+ /**
+ * 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 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 14:46:16 UTC (rev 555)
+++ 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 21:04:21 UTC (rev 556)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public abstract class AbstractGroupingActivity extends AbstractBPELActivity {
+public abstract class AbstractGroupingActivity extends AbstractBPELElement {
/**
* The constructor for initializing the activity based on
@@ -50,10 +50,10 @@
*
* @param act The contained activity
*/
- public void setContainedActivity(BPELActivity act) {
+ public void setContainedActivity(BPELElement act) {
m_containedActivity = act;
- getActivity().appendChild(act.getActivity());
+ getDOMElement().appendChild(act.getDOMElement());
}
/**
@@ -61,11 +61,11 @@
*
* @return The contained activity
*/
- public BPELActivity getContainedActivity() {
+ public BPELElement getContainedActivity() {
return(m_containedActivity);
}
private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
- private BPELActivity m_containedActivity=null;
+ private BPELElement m_containedActivity=null;
}
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 14:46:16 UTC (rev 555)
+++ 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 21:04:21 UTC (rev 556)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public abstract class AbstractInteractionActivity extends AbstractBPELActivity {
+public abstract class AbstractInteractionActivity extends AbstractBPELElement {
private static final long serialVersionUID = -5048477859609625462L;
@@ -61,7 +61,7 @@
*/
protected void initialize(ConversationInteraction interaction) {
- getActivity().setAttribute("operation",
+ getDOMElement().setAttribute("operation",
interaction.getMessageSignature().getOperation());
// TODO: Record variables against relevant interaction
Added: 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 (rev 0)
+++ 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 21:04:21 UTC (rev 556)
@@ -0,0 +1,95 @@
+/*
+ * 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.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+
+/**
+ * This class represents the BPEL condition element.
+ */
+public class Condition extends AbstractBPELElement {
+
+ private static final long serialVersionUID = 8666349106632652777L;
+
+ private static final String CONDITION="condition";
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ * @param elem The XML configuration details for the element
+ */
+ public Condition(BPELLanguageModel model,
+ org.w3c.dom.Element elem) {
+ super(model, elem);
+ }
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ */
+ public Condition(BPELLanguageModel model) {
+ super(model, CONDITION);
+ }
+
+ public String getExpression() {
+ String ret=null;
+
+ getDOMElement().normalize();
+
+ if (getDOMElement().getFirstChild() instanceof org.w3c.dom.Text) {
+ org.w3c.dom.Text text=(org.w3c.dom.Text)
+ getDOMElement().getFirstChild();
+
+ ret = text.getNodeValue();
+ }
+
+ return(ret);
+ }
+
+ public void setExpression(String expr) {
+
+ getDOMElement().normalize();
+
+ if (getDOMElement().getFirstChild() == null) {
+ org.w3c.dom.Text text=
+ getDOMElement().getOwnerDocument().createTextNode(expr);
+
+ getDOMElement().appendChild(text);
+
+ } else if (getDOMElement().getFirstChild() instanceof org.w3c.dom.Text) {
+ org.w3c.dom.Text text=(org.w3c.dom.Text)
+ getDOMElement().getFirstChild();
+
+ text.setNodeValue(expr);
+ }
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
Added: 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 (rev 0)
+++ 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 21:04:21 UTC (rev 556)
@@ -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.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;
+
+/**
+ * This class represents the 'else' construct contained
+ * within the 'if' activity.
+ */
+public class ElseConstruct extends AbstractBPELElement {
+
+ private static final String ELSE="else";
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the element
+ */
+ public ElseConstruct(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ */
+ public ElseConstruct(BPELLanguageModel model) {
+ super(model, ELSE);
+ }
+
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+ }
+
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private BPELElement m_activity=null;
+}
Added: 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 (rev 0)
+++ 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 21:04:21 UTC (rev 556)
@@ -0,0 +1,82 @@
+/*
+ * 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.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;
+
+/**
+ * This class represents the 'elseif' construct contained
+ * within the 'if' activity.
+ */
+public class ElseIfConstruct extends AbstractBPELElement {
+
+ private static final long serialVersionUID = 6371029130621912170L;
+
+ private static final String ELSEIF="elseif";
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the element
+ */
+ public ElseIfConstruct(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ */
+ public ElseIfConstruct(BPELLanguageModel model) {
+ super(model, ELSEIF);
+ }
+
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCondition(Condition cond) {
+ m_condition = cond;
+ }
+
+ public Condition getCondition() {
+ return(m_condition);
+ }
+
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+ }
+
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private Condition m_condition=null;
+ private BPELElement m_activity=null;
+}
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 14:46:16 UTC (rev 555)
+++ 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 21:04:21 UTC (rev 556)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public class IfActivity extends AbstractBPELActivity {
+public class IfActivity extends AbstractBPELElement {
private static final long serialVersionUID = -763221632866464831L;
private static final String IF = "if";
@@ -73,43 +73,52 @@
ConversionContext context) {
}
- public void setConditionPath(SequenceActivity act) {
- m_conditionPath = act;
- getActivity().appendChild(act.getActivity());
+ public void setCondition(Condition cond) {
+ m_condition = cond;
}
- public SequenceActivity getConditionPath() {
- return(m_conditionPath);
+ public Condition getCondition() {
+ return(m_condition);
}
+
+ public void setConditionPath(BPELElement act) {
+ m_activity = act;
+ getDOMElement().appendChild(act.getDOMElement());
+ }
- public void addElseIfPath(SequenceActivity act) {
+ public BPELElement getConditionPath() {
+ return(m_activity);
+ }
+
+ public void addElseIfPath(ElseIfConstruct act) {
m_elseIfPaths.add(act);
- org.w3c.dom.Element elem=getActivity().getOwnerDocument().createElement("elseif");
+ org.w3c.dom.Element elem=getDOMElement().getOwnerDocument().createElement("elseif");
- getActivity().appendChild(elem);
- elem.appendChild(act.getActivity());
+ getDOMElement().appendChild(elem);
+ elem.appendChild(act.getDOMElement());
}
- public java.util.List<SequenceActivity> getElseIfPaths() {
+ public java.util.List<ElseIfConstruct> getElseIfPaths() {
return(m_elseIfPaths);
}
- public void setElsePath(SequenceActivity act) {
+ public void setElsePath(BPELElement act) {
m_elsePath = act;
- org.w3c.dom.Element elem=getActivity().getOwnerDocument().createElement("else");
+ org.w3c.dom.Element elem=getDOMElement().getOwnerDocument().createElement("else");
- getActivity().appendChild(elem);
- elem.appendChild(act.getActivity());
+ getDOMElement().appendChild(elem);
+ elem.appendChild(act.getDOMElement());
}
- public SequenceActivity getElsePath() {
+ public BPELElement getElsePath() {
return(m_elsePath);
}
- private SequenceActivity m_conditionPath=null;
- private SequenceActivity m_elsePath=null;
- private java.util.List<SequenceActivity> m_elseIfPaths=
- new java.util.Vector<SequenceActivity>();
+ private Condition m_condition=null;
+ private BPELElement m_activity=null;
+ private BPELElement m_elsePath=null;
+ private java.util.List<ElseIfConstruct> m_elseIfPaths=
+ new java.util.Vector<ElseIfConstruct>();
}
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 14:46:16 UTC (rev 555)
+++ 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 21:04:21 UTC (rev 556)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public class SequenceActivity extends AbstractBPELActivity
+public class SequenceActivity extends AbstractBPELElement
implements BPELSequenceActivity {
private static final String SEQUENCE = "sequence";
@@ -80,14 +80,14 @@
* @param act The activity to be added
* @param pos The position to add, or -1 if at the end
*/
- public void addActivity(BPELActivity act, int pos) {
+ public void addActivity(BPELElement act, int pos) {
if (pos == -1) {
m_activities.add(act);
- getActivity().appendChild(act.getActivity());
+ getDOMElement().appendChild(act.getDOMElement());
} else {
m_activities.add(pos, act);
- org.w3c.dom.NodeList nl=getActivity().getChildNodes();
+ org.w3c.dom.NodeList nl=getDOMElement().getChildNodes();
org.w3c.dom.Element elem=null;
int cur=-1;
@@ -102,9 +102,9 @@
}
if (elem != null) {
- getActivity().insertBefore(act.getActivity(), elem);
+ getDOMElement().insertBefore(act.getDOMElement(), elem);
} else {
- getActivity().appendChild(act.getActivity());
+ getDOMElement().appendChild(act.getDOMElement());
}
}
}
@@ -116,11 +116,11 @@
* @param act The activity to be removed
* @return Whether the activity was removed
*/
- public boolean removeActivity(BPELActivity act) {
+ public boolean removeActivity(BPELElement act) {
boolean ret=m_activities.remove(act);
if (ret) {
- getActivity().removeChild(act.getActivity());
+ getDOMElement().removeChild(act.getDOMElement());
}
return(ret);
@@ -132,10 +132,10 @@
*
* @return The list of activities
*/
- public java.util.List<BPELActivity> getActivities() {
+ public java.util.List<BPELElement> getActivities() {
return(m_activities);
}
- private java.util.List<BPELActivity> m_activities=
- new java.util.Vector<BPELActivity>();
+ private java.util.List<BPELElement> m_activities=
+ new java.util.Vector<BPELElement>();
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/UnsupportedActivity.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/UnsupportedActivity.java 2009-03-27 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/UnsupportedActivity.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -26,7 +26,7 @@
*
* @author gary
*/
-public class UnsupportedActivity extends AbstractBPELActivity {
+public class UnsupportedActivity extends AbstractBPELElement {
/**
* The constructor for the activity.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java 2009-03-27 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -103,7 +103,11 @@
} else if (i == elem.getPaths().size()-1) {
act.setElsePath(seq);
} else {
- act.addElseIfPath(seq);
+ ElseIfConstruct construct=new ElseIfConstruct(bpelModel);
+
+ construct.setActivity(seq);
+
+ act.addElseIfPath(construct);
}
// Process the activities within the conversation
Copied: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest (from rev 555, cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test)
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/GeneratorTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/generator/GeneratorTest.java 2009-03-27 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/GeneratorTest.java 2009-03-27 21:04:21 UTC (rev 556)
@@ -149,9 +149,9 @@
new Throwable("Generated BPEL does not match stored version"));
System.out.println("COMPARED GENERATED:");
- System.out.println(bpel);
+ System.out.println("["+bpel+"]");
System.out.println("WITH ORIGINAL:");
- System.out.println(orig);
+ System.out.println("["+orig+"]");
}
} catch(Exception e) {
result.addError(this, e);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/PurchaseGoodsProcess(a)Broker.bpel
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/generator/results/PurchaseGoodsProcess(a)Broker.bpel 2009-03-27 14:46:16 UTC (rev 555)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/plugintest/org/jboss/tools/overlord/cdl/bpel/generator/results/PurchaseGoodsProcess(a)Broker.bpel 2009-03-27 21:04:21 UTC (rev 556)
@@ -15,4 +15,4 @@
</else>
</if>
</sequence>
-</process>
\ No newline at end of file
+</process>
15 years, 1 month
Overlord SVN: r555 - cdl/trunk/distribution/src/main/release/samples/jbossesb.
by overlord-commits@lists.jboss.org
Author: jeff.yuchang
Date: 2009-03-27 10:46:16 -0400 (Fri, 27 Mar 2009)
New Revision: 555
Modified:
cdl/trunk/distribution/src/main/release/samples/jbossesb/common_build.xml
Log:
[SOAG-101] Update.
Modified: cdl/trunk/distribution/src/main/release/samples/jbossesb/common_build.xml
===================================================================
--- cdl/trunk/distribution/src/main/release/samples/jbossesb/common_build.xml 2009-03-27 06:41:35 UTC (rev 554)
+++ cdl/trunk/distribution/src/main/release/samples/jbossesb/common_build.xml 2009-03-27 14:46:16 UTC (rev 555)
@@ -27,10 +27,10 @@
<target name="messaging-config">
<condition property="messaging.present">
- <available file="${server.dir}/jboss-messaging"/>
+ <available file="${server.dir}/deploy/jboss-messaging"/>
</condition>
<condition property="messaging.present">
- <available file="${server.dir}/jboss-messaging.sar"/>
+ <available file="${server.dir}/deploy/jboss-messaging.sar"/>
</condition>
<condition property="jbossmq.present">
15 years, 1 month