[overlord-commits] Overlord SVN: r481 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel: META-INF and 4 other directories.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Fri Feb 6 19:16:30 EST 2009


Author: objectiser
Date: 2009-02-06 19:16:30 -0500 (Fri, 06 Feb 2009)
New Revision: 481

Added:
   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/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/WhileActivity.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
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/plugin.xml
   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/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/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/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/util/InteractionUtil.java
Log:
Established basic structure for generation.

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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/META-INF/MANIFEST.MF	2009-02-07 00:16:30 UTC (rev 481)
@@ -18,4 +18,10 @@
 Scribble-Extensions: org.jboss.tools.overlord.cdl.bpel.parser.BPELParser,
   org.jboss.tools.overlord.cdl.bpel.parser.BPELNotation,
   org.jboss.tools.overlord.cdl.bpel.model.change.LanguageToConversationModelChangeRule,
+  org.jboss.tools.overlord.cdl.bpel.model.change.ConversationModelChangeRule,
+  org.jboss.tools.overlord.cdl.bpel.model.change.WhileModelChangeRule,
+  org.jboss.tools.overlord.cdl.bpel.model.change.WhenModelChangeRule,
+  org.jboss.tools.overlord.cdl.bpel.model.change.IfModelChangeRule,
+  org.jboss.tools.overlord.cdl.bpel.model.change.RunModelChangeRule,
+  org.jboss.tools.overlord.cdl.bpel.model.change.SpawnModelChangeRule,
   org.jboss.tools.overlord.cdl.bpel.model.change.ConversationInteractionModelChangeRule

Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/plugin.xml
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/plugin.xml	2009-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/plugin.xml	2009-02-07 00:16:30 UTC (rev 481)
@@ -1,6 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.2"?>
 <plugin>
+   <extension
+         id="org.jboss.tools.overlord.cdl.bpel.extension"
+         name="Overlord CDL BPEL model extension"
+         point="org.scribble.extension">
+   </extension>
+
   <extension point="org.eclipse.ui.popupMenus"> 
 	<objectContribution 
       id="org.jboss.tools.overlord.cdl.bpel.object.contribution"

Modified: 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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -19,4 +19,12 @@
 
 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();
+	
 }

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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELLanguageModel.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -51,6 +51,13 @@
 	 */
 	public String getOriginalContents();
 	
+	/**
+	 * This method returns the top level grouping
+	 * activity.
+	 * 
+	 * @return The top level grouping activity
+	 */
+	public BPELSequenceActivity getActivity();
 	
 	/**
 	 * This method returns the reference to the DOM

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/BPELSequenceActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -0,0 +1,47 @@
+/*
+ * 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 BPELActivity {
+
+	/**
+	 * 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(BPELActivity 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(BPELActivity act);
+	
+	/**
+	 * This method returns the list of activities associated
+	 * with the grouping construct.
+	 * 
+	 * @return The list of activities
+	 */
+	public java.util.List<BPELActivity> 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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/DefaultBPELLanguageModel.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -140,6 +140,27 @@
 	}
 	
 	/**
+	 * This method returns the top level grouping
+	 * activity.
+	 * 
+	 * @return The top level grouping activity
+	 */
+	public BPELSequenceActivity getActivity() {
+		return(m_activity);
+	}
+	
+	/**
+	 * This method sets the top level activity.
+	 * 
+	 * @param act The top level activity
+	 */
+	public void setActivity(BPELSequenceActivity act) {
+		m_activity = act;
+		
+		m_bpelProcess.appendChild(act.getActivity());
+	}
+	
+	/**
 	 * This method returns the reference to the DOM
 	 * representation of the BPEL process.
 	 * 
@@ -154,6 +175,7 @@
 	private ModelReference m_source=null;
 	private org.w3c.dom.Element m_bpelProcess=null;
 	private String m_contents=null;
+	private BPELSequenceActivity 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/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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractGroupingActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -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.*;
+
+/**
+ * This is the generic BPEL activity class.
+ *  
+ * @author gary
+ */
+public abstract class AbstractGroupingActivity extends AbstractBPELActivity {
+
+	/**
+	 * 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(BPELActivity act) {
+		m_containedActivity = act;
+		
+		getActivity().appendChild(act.getActivity());
+	}
+	
+	/**
+	 * This method returns the contained activity.
+	 * 
+	 * @return The contained activity
+	 */
+	public BPELActivity getContainedActivity() {
+		return(m_containedActivity);
+	}
+	
+	private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.bpel.model");
+
+	private BPELActivity m_containedActivity=null;
+}

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/AbstractInteractionActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -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 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 AbstractBPELActivity {
+
+	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) {
+		
+		getActivity().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) {
+	}
+
+}

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/IfActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -0,0 +1,115 @@
+/*
+ * 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 AbstractBPELActivity {
+
+	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 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 setConditionPath(SequenceActivity act) {
+		m_conditionPath = act;
+		getActivity().appendChild(act.getActivity());
+	}
+	
+	public SequenceActivity getConditionPath() {
+		return(m_conditionPath);
+	}
+	
+	public void addElseIfPath(SequenceActivity act) {
+		m_elseIfPaths.add(act);
+		
+		org.w3c.dom.Element elem=getActivity().getOwnerDocument().createElement("elseif");
+		
+		getActivity().appendChild(elem);
+		elem.appendChild(act.getActivity());
+	}
+	
+	public java.util.List<SequenceActivity> getElseIfPaths() {
+		return(m_elseIfPaths);
+	}
+	
+	public void setElsePath(SequenceActivity act) {
+		m_elsePath = act;
+		
+		org.w3c.dom.Element elem=getActivity().getOwnerDocument().createElement("else");
+		
+		getActivity().appendChild(elem);
+		elem.appendChild(act.getActivity());
+	}
+	
+	public SequenceActivity 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>();
+}

Modified: 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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/InvokeActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -17,29 +17,47 @@
  */
 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 AbstractBPELActivity {
+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,
+	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.
 	 * 
@@ -47,7 +65,6 @@
 	 */
 	@Override
 	public void validate(ModelListener l) {
-		// Don't validate unsupported actions
 	}
 	
 	/**

Modified: 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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReceiveActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -17,6 +17,7 @@
  */
 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.*;
@@ -26,8 +27,11 @@
  *  
  * @author gary
  */
-public class ReceiveActivity extends AbstractBPELActivity {
+public class ReceiveActivity extends AbstractInteractionActivity {
 
+	private static final String RECEIVE = "receive";
+	private static final long serialVersionUID = -3041725198724191842L;
+
 	/**
 	 * The constructor for the activity.
 	 * 
@@ -40,6 +44,19 @@
 	}
 
 	/**
+	 * 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.
 	 * 

Modified: 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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/ReplyActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -17,17 +17,21 @@
  */
 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.
+ * This class represents a BPEL reply activity.
  *  
  * @author gary
  */
-public class ReplyActivity extends AbstractBPELActivity {
+public class ReplyActivity extends AbstractInteractionActivity {
 
+	private static final String REPLY = "reply";
+	private static final long serialVersionUID = 8582738107125170604L;
+
 	/**
 	 * The constructor for the activity.
 	 * 
@@ -40,6 +44,19 @@
 	}
 
 	/**
+	 * 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.
 	 * 

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/SequenceActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -0,0 +1,141 @@
+/*
+ * 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 AbstractBPELActivity
+				implements BPELSequenceActivity {
+
+	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(BPELActivity act, int pos) {
+		if (pos == -1) {
+			m_activities.add(act);
+			getActivity().appendChild(act.getActivity());
+		} else {
+			m_activities.add(pos, act);
+			
+			org.w3c.dom.NodeList nl=getActivity().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) {
+				getActivity().insertBefore(act.getActivity(), elem);
+			} else {
+				getActivity().appendChild(act.getActivity());
+			}
+		}
+	}
+	
+	/**
+	 * 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(BPELActivity act) {
+		boolean ret=m_activities.remove(act);
+		
+		if (ret) {
+			getActivity().removeChild(act.getActivity());
+		}
+		
+		return(ret);
+	}
+	
+	/**
+	 * This method returns the list of activities associated
+	 * with the grouping construct.
+	 * 
+	 * @return The list of activities
+	 */
+	public java.util.List<BPELActivity> getActivities() {
+		return(m_activities);
+	}
+
+	private java.util.List<BPELActivity> m_activities=
+					new java.util.Vector<BPELActivity>();
+}

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/activities/WhileActivity.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -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.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) {
+	}
+
+}

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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/AbstractBPELModelChangeRule.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -19,6 +19,7 @@
 
 import org.scribble.model.*;
 import org.scribble.model.change.*;
+import org.jboss.tools.overlord.cdl.bpel.model.*;
 
 /**
  * This is the abstract ESB model change rule.
@@ -41,6 +42,11 @@
 				Model model, ModelObject mobj, ModelObject ref) {
 		boolean ret=false;
 		
+		if (context.getParent() instanceof BPELSequenceActivity &&
+					model instanceof BPELLanguageModel) {
+			ret = true;
+		}
+		
 		return(ret);
 	}
 	

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-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationInteractionModelChangeRule.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -88,31 +88,53 @@
 				Model model, ModelObject mobj, ModelObject ref) {
 		BPELLanguageModel bpelModel=(BPELLanguageModel)model;
 		ConversationInteraction interaction=(ConversationInteraction)mobj;
+		boolean ret=false;
 		
 		// Check if send or receive
 		if (InteractionUtil.isSend(interaction)) {
 			
-			// Send
-			insertSend(context, bpelModel, interaction, ref);		
-			
+			if (InteractionUtil.isRequest(interaction)) {
+				InvokeActivity act=new InvokeActivity(bpelModel,
+								interaction);
+				
+				if (context.getParent() instanceof BPELSequenceActivity) {
+					((BPELSequenceActivity)context.getParent()).addActivity(act, -1);
+					
+					ret = true;
+				}
+				
+				// TODO: Need to deal with subsequent responses
+				// which could be in a following choice - with each
+				// choice path being a normal or fault response.
+				// The faults need to be encoded in a fault handler
+				// possibly wrapped around, or contained within the
+				// invoke.
+			} else {
+				ReplyActivity act=new ReplyActivity(bpelModel,
+							interaction);
+		
+				if (context.getParent() instanceof BPELSequenceActivity) {
+					((BPELSequenceActivity)context.getParent()).addActivity(act, -1);
+					
+					ret = true;
+				}
+			}
 		} else {
-			// Receive
-			insertReceive(context, bpelModel, interaction, ref);		
+			if (InteractionUtil.isRequest(interaction)) {
+				ReceiveActivity act=new ReceiveActivity(bpelModel,
+									interaction);
+	
+				if (context.getParent() instanceof BPELSequenceActivity) {
+					((BPELSequenceActivity)context.getParent()).addActivity(act, -1);
+					
+					ret = true;
+				}	
+			}
 		}
 		
-		return(true);
+		return(ret);
 	}
 
-	protected void insertSend(ModelChangeContext context,
-			BPELLanguageModel bpelModel, ConversationInteraction interaction,
-						ModelObject ref) {
-	}
-
-	protected void insertReceive(ModelChangeContext context,
-			BPELLanguageModel bpelModel, ConversationInteraction interaction,
-						ModelObject ref) {
-	}
-	
 	/**
 	 * This method determines whether the rule is appropriate
 	 * for the supplied type of model, parent (in the context)

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/ConversationModelChangeRule.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -0,0 +1,124 @@
+/*
+ * 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.change;
+
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the Conversation.
+ */
+ at RegistryInfo(extension=ModelChangeRule.class,notation=BPELLanguageModel.BPEL_NOTATION)
+public class ConversationModelChangeRule extends AbstractModelChangeRule {
+
+	private static final String NAME_SUFFIX = "_main";
+
+	/**
+	 * This method determines whether the rule is appropriate
+	 * for the supplied type of model, parent (in the context) and
+	 * model object.
+	 *
+	 * @param context The context
+	 * @param model The model
+	 * @param mobj The model object causing the change
+	 * @param ref The optional reference model object
+	 * @return Whether the rule supports the supplied information
+	 */
+	@Override
+	public boolean isInsertSupported(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		boolean ret=false;
+		
+		if (mobj instanceof Conversation &&
+				model instanceof DefaultBPELLanguageModel) {
+			ret = true;
+		}
+		
+		return(ret);
+	}
+
+	/**
+	 * This method adds a new model object, within a
+	 * parent model object, with the details supplied in
+	 * another model object. The supplied model object
+	 * will usually be from a different model representation
+	 * (e.g. due to a merge), so the details will be
+	 * copied and placed in the representation associated
+	 * with the supplied model and parent model object.<p>
+	 * <p>
+	 * If a reference model object is supplied, then the
+	 * insertion will occur relative to it. If the reference
+	 * object is a block, then it means that the insertion
+	 * should occur at the end of the block. Otherwise the
+	 * new model object should be inserted before the
+	 * reference object, within the containing block.<p>
+	 * <p>
+	 * If the reference object is not supplied, then the
+	 * new model object should be inserted at the end of
+	 * the behaviour associated with the parent in the model
+	 * change context.
+	 * 
+	 * @param context The context
+	 * @param model The model being changed
+	 * @param mobj The model object details to be inserted
+	 * @param ref The optional reference model object
+	 * @return Whether the change has been applied
+	 */
+	@Override
+	public boolean insert(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
+		Conversation conv=(Conversation)mobj;
+		
+		SequenceActivity seq=new SequenceActivity(bpelModel);
+		
+		// Check if root conversation
+		if (conv.getParent() instanceof Model) {
+			
+			// Add sequence to model
+			bpelModel.setActivity(seq);
+			
+		} else if (context.getParent() instanceof BPELSequenceActivity) {
+			
+			((BPELSequenceActivity)context.getParent()).addActivity(seq, -1);
+		}
+
+		// Process the activities within the conversation
+		java.util.List<Activity> acts=conv.getBlock().getContents();
+		
+		Object parent=context.getParent();
+		
+		context.setParent(seq);
+		
+		for (int i=0; i < acts.size(); i++) {
+			if ((acts.get(i) instanceof Definition) == false) {
+				context.insert(model, acts.get(i), null);
+			}
+		}
+		
+		// Reset old parent
+		context.setParent(parent);
+		
+		return(true);
+	}
+	
+}

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/IfModelChangeRule.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -0,0 +1,126 @@
+/*
+ * 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.change;
+
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the If.
+ */
+ at RegistryInfo(extension=ModelChangeRule.class,notation=BPELLanguageModel.BPEL_NOTATION)
+public class IfModelChangeRule extends AbstractModelChangeRule {
+
+	/**
+	 * This method determines whether the rule is appropriate
+	 * for the supplied type of model, parent (in the context) and
+	 * model object.
+	 *
+	 * @param context The context
+	 * @param model The model
+	 * @param mobj The model object causing the change
+	 * @param ref The optional reference model object
+	 * @return Whether the rule supports the supplied information
+	 */
+	@Override
+	public boolean isInsertSupported(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		boolean ret=false;
+		
+		if (mobj instanceof If &&
+				model instanceof DefaultBPELLanguageModel) {
+			ret = true;
+		}
+		
+		return(ret);
+	}
+
+	/**
+	 * This method adds a new model object, within a
+	 * parent model object, with the details supplied in
+	 * another model object. The supplied model object
+	 * will usually be from a different model representation
+	 * (e.g. due to a merge), so the details will be
+	 * copied and placed in the representation associated
+	 * with the supplied model and parent model object.<p>
+	 * <p>
+	 * If a reference model object is supplied, then the
+	 * insertion will occur relative to it. If the reference
+	 * object is a block, then it means that the insertion
+	 * should occur at the end of the block. Otherwise the
+	 * new model object should be inserted before the
+	 * reference object, within the containing block.<p>
+	 * <p>
+	 * If the reference object is not supplied, then the
+	 * new model object should be inserted at the end of
+	 * the behaviour associated with the parent in the model
+	 * change context.
+	 * 
+	 * @param context The context
+	 * @param model The model being changed
+	 * @param mobj The model object details to be inserted
+	 * @param ref The optional reference model object
+	 * @return Whether the change has been applied
+	 */
+	@Override
+	public boolean insert(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
+		If elem=(If)mobj;
+		
+		IfActivity act=new IfActivity(bpelModel);
+		
+		if (context.getParent() instanceof SequenceActivity) {
+			((SequenceActivity)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);
+			
+			if (i == 0) {
+				act.setConditionPath(seq);
+			} else if (i == elem.getPaths().size()-1) {
+				act.setElsePath(seq);
+			} else {
+				act.addElseIfPath(seq);
+			}
+			
+			// 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);
+	}
+	
+}

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/RunModelChangeRule.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -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.change;
+
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the Run.
+ */
+ at RegistryInfo(extension=ModelChangeRule.class,notation=BPELLanguageModel.BPEL_NOTATION)
+public class RunModelChangeRule extends AbstractModelChangeRule {
+
+	/**
+	 * This method determines whether the rule is appropriate
+	 * for the supplied type of model, parent (in the context) and
+	 * model object.
+	 *
+	 * @param context The context
+	 * @param model The model
+	 * @param mobj The model object causing the change
+	 * @param ref The optional reference model object
+	 * @return Whether the rule supports the supplied information
+	 */
+	@Override
+	public boolean isInsertSupported(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		boolean ret=false;
+		
+		if (mobj instanceof Run &&
+				model instanceof DefaultBPELLanguageModel) {
+			ret = true;
+		}
+		
+		return(ret);
+	}
+
+	/**
+	 * This method adds a new model object, within a
+	 * parent model object, with the details supplied in
+	 * another model object. The supplied model object
+	 * will usually be from a different model representation
+	 * (e.g. due to a merge), so the details will be
+	 * copied and placed in the representation associated
+	 * with the supplied model and parent model object.<p>
+	 * <p>
+	 * If a reference model object is supplied, then the
+	 * insertion will occur relative to it. If the reference
+	 * object is a block, then it means that the insertion
+	 * should occur at the end of the block. Otherwise the
+	 * new model object should be inserted before the
+	 * reference object, within the containing block.<p>
+	 * <p>
+	 * If the reference object is not supplied, then the
+	 * new model object should be inserted at the end of
+	 * the behaviour associated with the parent in the model
+	 * change context.
+	 * 
+	 * @param context The context
+	 * @param model The model being changed
+	 * @param mobj The model object details to be inserted
+	 * @param ref The optional reference model object
+	 * @return Whether the change has been applied
+	 */
+	@Override
+	public boolean insert(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
+		Run elem=(Run)mobj;
+
+		if (elem.getDefinition() != null) {
+			context.insert(bpelModel, elem.getDefinition(), ref);
+		}
+		
+		return(true);
+	}
+	
+}

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/SpawnModelChangeRule.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -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.change;
+
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the Run.
+ */
+ at RegistryInfo(extension=ModelChangeRule.class,notation=BPELLanguageModel.BPEL_NOTATION)
+public class SpawnModelChangeRule extends AbstractModelChangeRule {
+
+	/**
+	 * This method determines whether the rule is appropriate
+	 * for the supplied type of model, parent (in the context) and
+	 * model object.
+	 *
+	 * @param context The context
+	 * @param model The model
+	 * @param mobj The model object causing the change
+	 * @param ref The optional reference model object
+	 * @return Whether the rule supports the supplied information
+	 */
+	@Override
+	public boolean isInsertSupported(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		boolean ret=false;
+		
+		if (mobj instanceof Spawn &&
+				model instanceof DefaultBPELLanguageModel) {
+			ret = true;
+		}
+		
+		return(ret);
+	}
+
+	/**
+	 * This method adds a new model object, within a
+	 * parent model object, with the details supplied in
+	 * another model object. The supplied model object
+	 * will usually be from a different model representation
+	 * (e.g. due to a merge), so the details will be
+	 * copied and placed in the representation associated
+	 * with the supplied model and parent model object.<p>
+	 * <p>
+	 * If a reference model object is supplied, then the
+	 * insertion will occur relative to it. If the reference
+	 * object is a block, then it means that the insertion
+	 * should occur at the end of the block. Otherwise the
+	 * new model object should be inserted before the
+	 * reference object, within the containing block.<p>
+	 * <p>
+	 * If the reference object is not supplied, then the
+	 * new model object should be inserted at the end of
+	 * the behaviour associated with the parent in the model
+	 * change context.
+	 * 
+	 * @param context The context
+	 * @param model The model being changed
+	 * @param mobj The model object details to be inserted
+	 * @param ref The optional reference model object
+	 * @return Whether the change has been applied
+	 */
+	@Override
+	public boolean insert(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
+		Spawn elem=(Spawn)mobj;
+
+		if (elem.getDefinition() != null) {
+			context.insert(bpelModel, elem.getDefinition(), ref);
+		}
+		
+		return(true);
+	}
+	
+}

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhenModelChangeRule.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -0,0 +1,108 @@
+/*
+ * 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.change;
+
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the When.
+ */
+ at RegistryInfo(extension=ModelChangeRule.class,notation=BPELLanguageModel.BPEL_NOTATION)
+public class WhenModelChangeRule extends AbstractModelChangeRule {
+
+	/**
+	 * This method determines whether the rule is appropriate
+	 * for the supplied type of model, parent (in the context) and
+	 * model object.
+	 *
+	 * @param context The context
+	 * @param model The model
+	 * @param mobj The model object causing the change
+	 * @param ref The optional reference model object
+	 * @return Whether the rule supports the supplied information
+	 */
+	@Override
+	public boolean isInsertSupported(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		boolean ret=false;
+		
+		if (mobj instanceof When &&
+				model instanceof DefaultBPELLanguageModel) {
+			ret = true;
+		}
+		
+		return(ret);
+	}
+
+	/**
+	 * This method adds a new model object, within a
+	 * parent model object, with the details supplied in
+	 * another model object. The supplied model object
+	 * will usually be from a different model representation
+	 * (e.g. due to a merge), so the details will be
+	 * copied and placed in the representation associated
+	 * with the supplied model and parent model object.<p>
+	 * <p>
+	 * If a reference model object is supplied, then the
+	 * insertion will occur relative to it. If the reference
+	 * object is a block, then it means that the insertion
+	 * should occur at the end of the block. Otherwise the
+	 * new model object should be inserted before the
+	 * reference object, within the containing block.<p>
+	 * <p>
+	 * If the reference object is not supplied, then the
+	 * new model object should be inserted at the end of
+	 * the behaviour associated with the parent in the model
+	 * change context.
+	 * 
+	 * @param context The context
+	 * @param model The model being changed
+	 * @param mobj The model object details to be inserted
+	 * @param ref The optional reference model object
+	 * @return Whether the change has been applied
+	 */
+	@Override
+	public boolean insert(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
+		When elem=(When)mobj;
+		
+		// TODO: Need to decide best way to deal with single
+		// and multi-path when constructs.
+		
+		if (elem.getPaths().size() == 1) {
+			// Single path - so ignore it for now
+			Block path=elem.getPaths().get(0);
+			
+			// Process the activities within the conversation
+			java.util.List<Activity> acts=path.getContents();
+						
+			for (int i=0; i < acts.size(); i++) {
+				context.insert(model, acts.get(i), null);
+			}
+		}
+				
+		return(true);
+	}
+	
+}

Added: 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	                        (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/change/WhileModelChangeRule.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -0,0 +1,116 @@
+/*
+ * 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.change;
+
+import org.jboss.tools.overlord.cdl.bpel.model.*;
+import org.jboss.tools.overlord.cdl.bpel.model.activities.*;
+import org.scribble.model.*;
+import org.scribble.model.change.*;
+import org.scribble.conversation.model.*;
+import org.scribble.extensions.RegistryInfo;
+
+/**
+ * This is the model change rule for the While.
+ */
+ at RegistryInfo(extension=ModelChangeRule.class,notation=BPELLanguageModel.BPEL_NOTATION)
+public class WhileModelChangeRule extends AbstractModelChangeRule {
+
+	/**
+	 * This method determines whether the rule is appropriate
+	 * for the supplied type of model, parent (in the context) and
+	 * model object.
+	 *
+	 * @param context The context
+	 * @param model The model
+	 * @param mobj The model object causing the change
+	 * @param ref The optional reference model object
+	 * @return Whether the rule supports the supplied information
+	 */
+	@Override
+	public boolean isInsertSupported(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		boolean ret=false;
+		
+		if (mobj instanceof While &&
+				model instanceof DefaultBPELLanguageModel) {
+			ret = true;
+		}
+		
+		return(ret);
+	}
+
+	/**
+	 * This method adds a new model object, within a
+	 * parent model object, with the details supplied in
+	 * another model object. The supplied model object
+	 * will usually be from a different model representation
+	 * (e.g. due to a merge), so the details will be
+	 * copied and placed in the representation associated
+	 * with the supplied model and parent model object.<p>
+	 * <p>
+	 * If a reference model object is supplied, then the
+	 * insertion will occur relative to it. If the reference
+	 * object is a block, then it means that the insertion
+	 * should occur at the end of the block. Otherwise the
+	 * new model object should be inserted before the
+	 * reference object, within the containing block.<p>
+	 * <p>
+	 * If the reference object is not supplied, then the
+	 * new model object should be inserted at the end of
+	 * the behaviour associated with the parent in the model
+	 * change context.
+	 * 
+	 * @param context The context
+	 * @param model The model being changed
+	 * @param mobj The model object details to be inserted
+	 * @param ref The optional reference model object
+	 * @return Whether the change has been applied
+	 */
+	@Override
+	public boolean insert(ModelChangeContext context,
+				Model model, ModelObject mobj, ModelObject ref) {
+		DefaultBPELLanguageModel bpelModel=(DefaultBPELLanguageModel)model;
+		While elem=(While)mobj;
+		
+		WhileActivity act=new WhileActivity(bpelModel);
+		
+		SequenceActivity seq=new SequenceActivity(bpelModel);
+		act.setContainedActivity(seq);
+		
+		if (context.getParent() instanceof BPELSequenceActivity) {		
+			((BPELSequenceActivity)context.getParent()).addActivity(act, -1);
+		}
+
+		// Process the activities within the conversation
+		java.util.List<Activity> acts=elem.getBlock().getContents();
+		
+		Object parent=context.getParent();
+		
+		context.setParent(seq);
+		
+		for (int i=0; i < acts.size(); i++) {
+			context.insert(model, acts.get(i), null);
+		}
+		
+		// Reset old parent
+		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/util/InteractionUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/util/InteractionUtil.java	2009-02-06 19:12:16 UTC (rev 480)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/util/InteractionUtil.java	2009-02-07 00:16:30 UTC (rev 481)
@@ -52,4 +52,22 @@
 		return(ret);
 	}
 	
+	/**
+	 * This method determines whether the supplied interaction
+	 * is a request.
+	 * 
+	 * @param interaction The interaction
+	 * @return Whether the interaction is a request
+	 */
+	public static boolean isRequest(Interaction interaction) {
+		boolean ret=false;
+
+		if (interaction.getRequestLabel() != null ||
+				interaction.getReplyToLabel() == null) {
+			ret = true;
+		}
+		
+		return(ret);
+	}
+	
 }




More information about the overlord-commits mailing list