[jboss-svn-commits] JBL Code SVN: r25099 - in labs/jbossesb/trunk/product: docs and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Feb 4 09:19:18 EST 2009


Author: tfennelly
Date: 2009-02-04 09:19:18 -0500 (Wed, 04 Feb 2009)
New Revision: 25099

Added:
   labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java
   labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java
   labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtilTest.java
   labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/mappingconfig-01.xml
Modified:
   labs/jbossesb/trunk/product/docs/ServicesGuide.odt
   labs/jbossesb/trunk/product/ivy-build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/build.xml
   labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/docs/Readme.odt
   labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jbm-queue-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jbmq-queue-service.xml
   labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jboss-esb.xml
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Constants.java
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/CommandExecutor.java
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtil.java
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/MessageFacade.java
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/NewProcessInstanceFacade.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2316

Modified: labs/jbossesb/trunk/product/docs/ServicesGuide.odt
===================================================================
(Binary files differ)

Modified: labs/jbossesb/trunk/product/ivy-build.xml
===================================================================
--- labs/jbossesb/trunk/product/ivy-build.xml	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/ivy-build.xml	2009-02-04 14:19:18 UTC (rev 25099)
@@ -1,4 +1,4 @@
-<project name="Dependencies" default="retrieve" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
+<project name="Dependencies" default="retrieve" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:artifact="urn:maven-artifact-ant">
 
     <property name="ivy.lib.dir" value="${basedir}/build/lib" />
     <path id="classpath.ivy">
@@ -14,9 +14,7 @@
         <ivy:retrieve />
 
         <!-- We have to get the Smooks dependencies manually due to an issue with Ivy.  See ivy.xml. -->
-        <get src="http://repo1.maven.org/maven2/org/milyn/milyn-commons/1.1/milyn-commons-1.1.jar" dest="${ivy.lib.dir}/milyn-commons-1.1.jar" />
-        <get src="http://repo1.maven.org/maven2/org/milyn/milyn-smooks-core/1.1/milyn-smooks-core-1.1.jar" dest="${ivy.lib.dir}/milyn-smooks-core-1.1.jar" />
-        <get src="http://repo1.maven.org/maven2/org/milyn/milyn-smooks-javabean/1.1/milyn-smooks-javabean-1.1.jar" dest="${ivy.lib.dir}/milyn-smooks-javabean-1.1.jar" />
+        <antcall target="smooks.dependencies.get" />
 
     </target>
 
@@ -32,4 +30,48 @@
         <ivy:report todir="${ivy.lib.dir}"/>
     </target>
 
+    <property environment="env"/>
+    <property name="smooks.version" value="1.1"/>
+    <property name="maven.ant.version" value="2.0.9"/>
+    <property name="maven.dir" value="org/apache/maven/maven-ant-tasks/${maven.ant.version}"/>
+    <property name="maven.jar" value="maven-ant-tasks-${maven.ant.version}.jar"/>
+    <pathconvert targetos="unix" property="maven.repo.dir">
+        <path>
+            <pathelement location="${user.home}/.m2/repository"/>
+        </path>
+    </pathconvert>
+    <pathconvert targetos="unix" property="maven.ant.repo.dir">
+        <path>
+            <pathelement location="${maven.repo.dir}/${maven.dir}"/>
+        </path>
+    </pathconvert>
+    <condition property="maven.exists.locally">
+        <available file="${maven.ant.repo.dir}/${maven.jar}"/>
+    </condition>
+
+    <target name="smooks.dependencies.get">
+        <mkdir dir="${maven.ant.repo.dir}"/>
+        <antcall target="maven.get"/>
+
+        <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpath="${maven.ant.repo.dir}/${maven.jar}"/>
+        <artifact:remoteRepository id="m2.repo" url="http://repo1.maven.org/maven2" />
+        <artifact:localRepository id="local.repository" path="${maven.repo.dir}"/>
+        <artifact:dependencies filesetId="dependencies">
+            <dependency groupId="org.milyn" version="${smooks.version}" artifactId="milyn-commons" />
+            <dependency groupId="org.milyn" version="${smooks.version}" artifactId="milyn-smooks-core" />
+            <dependency groupId="org.milyn" version="${smooks.version}" artifactId="milyn-smooks-javabean"/>
+            <localRepository refid="local.repository" />
+            <remoteRepository refid="m2.repo" />            
+        </artifact:dependencies>
+
+        <copy todir="${ivy.lib.dir}">
+            <fileset refid="dependencies"/>
+            <mapper type="flatten"/>
+        </copy>
+    </target>
+
+    <target name="maven.get" unless="maven.exists.locally">
+        <get src="http://repo1.maven.org/maven2/${maven.dir}/${maven.jar}" dest="${maven.ant.repo.dir}/${maven.jar}" usetimestamp="true"/>
+    </target>
+
 </project>

Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/build.xml	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/build.xml	2009-02-04 14:19:18 UTC (rev 25099)
@@ -39,7 +39,6 @@
 	</deployToServer>
   </target>
 	
-  
   <target name="startProcess" depends="compile" description="Sends a message to start the process instance">
   	<echo>Sends a message to start the process instance</echo>
     <java fork="yes" classname="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.test.SendJMSMessageStart" failonerror="true">      
@@ -48,6 +47,22 @@
     </java>  
   </target>	 
 
+    <target name="startProcessSync" depends="compile" description="Sends a message to start the process instance.">
+        <echo>Sends a message to start the process instance</echo>
+      <java fork="yes" classname="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.test.SendEsbStartMessage" failonerror="true">
+          <arg value="SampleOrder.xml"/>
+          <classpath refid="exec-classpath"/>
+      </java>
+    </target>
+
+    <target name="queryProcessSync" depends="compile" description="Sends a message to query a process instance.">
+      <input addproperty="processId" message="Please enter the Process Instance ID of the process to be queried > " />
+      <java fork="yes" classname="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.test.SendEsbQueryMessage" failonerror="true">
+          <arg value="${processId}"/>
+          <classpath refid="exec-classpath"/>
+      </java>
+    </target>
+
   <target name="startProcessPets" depends="compile" description="Sends a message to start the process instance">
   	<echo>Sends a message to start the process instance</echo>
     <java fork="yes" classname="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.test.SendJMSMessageStart" failonerror="true">

Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/docs/Readme.odt
===================================================================
(Binary files differ)

Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jbm-queue-service.xml	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jbm-queue-service.xml	2009-02-04 14:19:18 UTC (rev 25099)
@@ -10,7 +10,28 @@
     xmbean-dd="xmdesc/Queue-xmbean.xml">
     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
   </mbean>
-  
+
+    <mbean code="org.jboss.jms.server.destination.QueueService"
+       name="jboss.messaging.destination:service=Queue,name=quickstart_bpm_orchestration4_start_sync_esb"
+       xmbean-dd="xmdesc/Queue-xmbean.xml">
+       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+     </mbean>
+    <mbean code="org.jboss.jms.server.destination.QueueService"
+       name="jboss.messaging.destination:service=Queue,name=quickstart_bpm_orchestration4_start_sync_esb_reply"
+       xmbean-dd="xmdesc/Queue-xmbean.xml">
+       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+     </mbean>
+    <mbean code="org.jboss.jms.server.destination.QueueService"
+       name="jboss.messaging.destination:service=Queue,name=quickstart_bpm_orchestration4_query_sync_esb"
+       xmbean-dd="xmdesc/Queue-xmbean.xml">
+       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+     </mbean>
+    <mbean code="org.jboss.jms.server.destination.QueueService"
+       name="jboss.messaging.destination:service=Queue,name=quickstart_bpm_orchestration4_query_sync_esb_reply"
+       xmbean-dd="xmdesc/Queue-xmbean.xml">
+       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+     </mbean>
+
   <mbean code="org.jboss.jms.server.destination.QueueService"
     name="jboss.messaging.destination:service=Queue,name=quickstart_bpm_orchestration4_intake_service_esb"
     xmbean-dd="xmdesc/Queue-xmbean.xml">

Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jbmq-queue-service.xml	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jbmq-queue-service.xml	2009-02-04 14:19:18 UTC (rev 25099)
@@ -13,6 +13,33 @@
 		jboss.mq:service=DestinationManager
 	  </depends>
 	</mbean>	
+
+    <mbean code="org.jboss.mq.server.jmx.Queue"
+         name="jboss.mq.destination:service=Queue,name=quickstart_bpm_orchestration4_start_sync_esb">
+      <depends optional-attribute-name="DestinationManager">
+        jboss.mq:service=DestinationManager
+      </depends>
+    </mbean>
+    <mbean code="org.jboss.mq.server.jmx.Queue"
+         name="jboss.mq.destination:service=Queue,name=quickstart_bpm_orchestration4_start_sync_esb_reply">
+      <depends optional-attribute-name="DestinationManager">
+        jboss.mq:service=DestinationManager
+      </depends>
+    </mbean>
+
+    <mbean code="org.jboss.mq.server.jmx.Queue"
+         name="jboss.mq.destination:service=Queue,name=quickstart_bpm_orchestration4_query_sync_esb">
+      <depends optional-attribute-name="DestinationManager">
+        jboss.mq:service=DestinationManager
+      </depends>
+    </mbean>
+    <mbean code="org.jboss.mq.server.jmx.Queue"
+         name="jboss.mq.destination:service=Queue,name=quickstart_bpm_orchestration4_query_sync_esb_reply">
+      <depends optional-attribute-name="DestinationManager">
+        jboss.mq:service=DestinationManager
+      </depends>
+    </mbean>
+
 	<mbean code="org.jboss.mq.server.jmx.Queue"
 		 name="jboss.mq.destination:service=Queue,name=quickstart_bpm_orchestration4_intake_service_esb">
 	  <depends optional-attribute-name="DestinationManager">

Modified: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jboss-esb.xml	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/jboss-esb.xml	2009-02-04 14:19:18 UTC (rev 25099)
@@ -17,6 +17,14 @@
 				<jms-message-filter dest-type="QUEUE"
 					dest-name="queue/quickstart_bpm_orchestration4_start_esb" />
 			</jms-bus>
+            <jms-bus busid="startEsbChannel_sync">
+                <jms-message-filter dest-type="QUEUE"
+                    dest-name="queue/quickstart_bpm_orchestration4_start_sync_esb" />
+            </jms-bus>
+            <jms-bus busid="queryEsbChannel_sync">
+                <jms-message-filter dest-type="QUEUE"
+                    dest-name="queue/quickstart_bpm_orchestration4_query_sync_esb" />
+            </jms-bus>
 			<jms-bus busid="intakeServiceEsbChannel">
 				<jms-message-filter dest-type="QUEUE"
 					dest-name="queue/quickstart_bpm_orchestration4_intake_service_esb" />
@@ -81,6 +89,56 @@
 				</action>
 			</actions>
 		</service>
+
+        <service category="BPM_orchestration4_Starter_Service" name="Starter_Service_Sync"
+                 description="BPM Orchestration Sample 4: Use this service to start a process instance" >
+            <listeners>
+                <jms-listener name="ESB-Listener" busidref="startEsbChannel_sync"/>
+            </listeners>
+            <actions mep="RequestResponse">
+                <action name="setup_key" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
+                        <property name="script"
+                            value="/scripts/setup_key.groovy" />
+                </action>
+                <action name="start_a_new_order_process"
+                    class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
+                    <property name="command"
+                        value="StartProcessInstanceCommand" />
+                    <property name="process-definition-name"
+                        value="bpm4_ESBOrderProcess" />
+                    <property name="key" value="body.businessKey" />
+                    <property name="esbToBpmVars">
+                        <mapping esb="BODY_CONTENT"	bpm="entireOrderAsXML" />
+                    </property>
+
+                </action>
+                <action name="dump2" class="org.jboss.soa.esb.actions.SystemPrintln">
+                    <property name="message" value="After" />
+                    <property name="printfull" value="true"/>
+                </action>
+            </actions>
+        </service>
+
+        <service category="BPM_orchestration4_Starter_Service" name="Get_Service_Vars_Sync"
+                 description="BPM Orchestration Sample 4: Use this service to query the Service Variables" >
+            <listeners>
+                <jms-listener name="ESB-Listener" busidref="queryEsbChannel_sync"/>
+            </listeners>
+            <actions mep="RequestResponse">
+                <action name="GetVariables" class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
+                    <property name="command" value="GetProcessInstanceVariablesCommand"/>
+                    <property name="bpmToEsbVars">
+                        <mapping bpm="entireCustomerAsObject" esb="body.customer" />
+                        <mapping bpm="customer_firstName" esb="body.customer.firstName" />
+                        <mapping bpm="customer_lastName" esb="body.customer.lastName" />
+                        <mapping bpm="customer_status" esb="body.customer.status" />
+                        <mapping bpm="entireOrderAsObject" esb="orderHeader" />
+                        <mapping bpm="entireOrderAsXML" esb="BODY_CONTENT" />
+                    </property>
+                </action>
+            </actions>
+        </service>
+
 		<service category="BPM_Orchestration4" name="IntakeService"
 			description="IntakeService: transforms, massages, calculates priority">
 			<listeners>

Added: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.test;
+
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.cmd.MessageHelper;
+import org.jboss.soa.esb.store.Customer;
+
+public class SendEsbQueryMessage {
+
+    public static void main(String args[]) throws Exception {
+        if (args[0].trim().equals("")) {
+            return;
+        }
+
+        System.setProperty("javax.xml.registry.ConnectionFactoryClass", "org.apache.ws.scout.registry.ConnectionFactoryImpl");
+        Message esbMessage = MessageFactory.getInstance().getMessage();
+
+        long processInstanceId = Long.parseLong(args[0]);
+        MessageHelper.setLongValue(esbMessage, Constants.PROCESS_INSTANCE_ID, processInstanceId);
+
+        Message response = (new ServiceInvoker("BPM_orchestration4_Starter_Service", "Get_Service_Vars_Sync")).deliverSync(esbMessage, 10000);
+
+        Customer customer = (Customer) response.getBody().get("customer");
+        System.out.println("'customer' variable as queried from jBPM process: " + customer);
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbQueryMessage.java
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java (from rev 25057, labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.test;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.util.FileUtil;
+import org.jboss.soa.esb.services.jbpm.cmd.MessageHelper;
+import org.jboss.soa.esb.services.jbpm.Constants;
+
+import java.io.File;
+
+public class SendEsbStartMessage 
+{
+    public static void main(String args[]) throws Exception
+    {
+        System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
+
+    	Message esbMessage = MessageFactory.getInstance().getMessage();
+        String orderPayload = FileUtil.readTextFile(new File(args[0]));
+
+    	esbMessage.getBody().add(orderPayload);
+
+        Message response = (new ServiceInvoker("BPM_orchestration4_Starter_Service", "Starter_Service_Sync")).deliverSync(esbMessage, 10000);
+
+        System.out.println("\n\n****** New Process Instance ID: " + MessageHelper.getLongValue(response, Constants.PROCESS_INSTANCE_ID));
+    }
+    
+}


Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/bpm_orchestration4/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration4/test/SendEsbStartMessage.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Constants.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Constants.java	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/Constants.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -112,6 +112,7 @@
         CallbackCommand
 		,CancelProcessInstanceCommand
 		,NewProcessInstanceCommand
-		,StartProcessInstanceCommand;
+		,StartProcessInstanceCommand
+        , GetProcessInstanceVariablesCommand;
 	}
 }

Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/CommandExecutor.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/CommandExecutor.java	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/CommandExecutor.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -24,6 +24,7 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.List;
 
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.ConfigurationException;
@@ -32,16 +33,11 @@
 import org.jboss.soa.esb.message.mapping.ObjectMapper;
 import org.jboss.soa.esb.message.mapping.ObjectMappingException;
 import org.jboss.soa.esb.services.jbpm.Constants;
-import org.jboss.soa.esb.services.jbpm.JBpmObjectMapper;
 import org.jboss.soa.esb.services.jbpm.Mapping;
 import org.jbpm.JbpmConfiguration;
 import org.jbpm.JbpmContext;
 import org.jbpm.JbpmException;
-import org.jbpm.command.CancelProcessInstanceCommand;
-import org.jbpm.command.CommandService;
-import org.jbpm.command.GetProcessInstanceCommand;
-import org.jbpm.command.NewProcessInstanceCommand;
-import org.jbpm.command.SignalCommand;
+import org.jbpm.command.*;
 import org.jbpm.command.impl.CommandServiceImpl;
 import org.jbpm.graph.exe.ProcessInstance;
 
@@ -150,6 +146,7 @@
 				,new CommandExecutor.NewProcessInstancePerformer(false));
 		_values.put(Constants.OpCode.StartProcessInstanceCommand
 				,new CommandExecutor.NewProcessInstancePerformer(true));
+        _values.put(Constants.OpCode.GetProcessInstanceVariablesCommand, new GetProcessVariablesPerformer());
 	}
 	
 	// this class is used both for NewProcessInstance and for StartProcessInstance
@@ -228,7 +225,51 @@
             }
         }
 	}
-    
+
+    private static class GetProcessVariablesPerformer implements Command {
+        
+        public void execute(Message message) throws JbpmException {
+            Long processInstanceId = MessageHelper.getLongValue(message,Constants.PROCESS_INSTANCE_ID);
+
+            if (processInstanceId == null) {
+                throw new JbpmException("'" + Constants.PROCESS_INSTANCE_ID + "' must be specified in Message body.  Cannot retrieve process variables.");
+            }
+
+            ProcessInstance processInstance = (ProcessInstance)getJbpmCommandService().execute(new GetProcessInstanceCommand(processInstanceId));
+            if(processInstance == null) {
+                throw new JbpmException("Unknown jBPM process instance ID '" + processInstanceId + "'.");
+            }
+
+            VariablesCommand command = new HungryVariablesCommand();
+
+            command.setTokenId(processInstance.getRootToken().getId());
+            Object result = getJbpmCommandService().execute(command);
+            if(result instanceof Map) {
+                Map processVariables = (Map) result;
+                List<Mapping> variableMappings = GetProcessVariablesFacade.getMappings(message);
+
+                for (Mapping mapping : variableMappings) {
+                    Object value = processVariables.get(mapping.getBpm());
+                    ObjectMapper mapper = new ObjectMapper();
+
+                    try {
+                        if(value != null) {
+                            mapper.setObjectOnMessage(message, mapping.getEsb(), value);
+                        } else {
+                            mapper.setObjectOnMessage(message, mapping.getEsb(), mapping.getDefaultValue());
+                        }
+                    } catch (ObjectMappingException e) {
+                        throw new JbpmException("Failed to apply jBPM->ESB mapping for process instance ID '" + processInstanceId + "' (root token ID '" + processInstance.getRootToken().getId() + "'). Mapping: " + mapping);
+                    }
+                }
+            } else if(result == null) {
+                throw new JbpmException("Invalid 'null' jBPM VariablesCommand result for process instance ID '" + processInstanceId + "' (root token ID '" + processInstance.getRootToken().getId() + "').");
+            } else {
+                throw new JbpmException("Invalid jBPM VariablesCommand result type '" + result.getClass().getName() + "' for process instance ID '" + processInstanceId + "' (root token ID '" + processInstance.getRootToken().getId() + "')..  Expected instanceof '" + Map.class.getName() + "'.");
+            }
+        }
+    }
+
     private static Object executeJbpmCommand(org.jbpm.command.Command command)
     {
         if (logger.isDebugEnabled()) {

Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtil.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtil.java	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtil.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -36,9 +36,9 @@
 		throws ConfigurationException
 	{   
         List<Mapping> mappingList = new ArrayList<Mapping>();
-        ConfigTree[] esbToBpm = tree.getChildren(Constants.MAPPING_TAG);
-        if (esbToBpm != null) {
-            for (ConfigTree mappingElement : esbToBpm) {
+        ConfigTree[] mappingElements = tree.getChildren(Constants.MAPPING_TAG);
+        if (mappingElements != null) {
+            for (ConfigTree mappingElement : mappingElements) {
                 Mapping mapping = Mapping.parseMappingElement(mappingElement);
                 mappingList.add(mapping);
             }

Added: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.soa.esb.services.jbpm.cmd;
+
+import org.jboss.soa.esb.services.jbpm.Constants;
+import org.jboss.soa.esb.services.jbpm.Mapping;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.ConfigurationException;
+
+import java.util.List;
+
+/**
+ * Get process variable facade.
+ * 
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class GetProcessVariablesFacade  extends MessageFacade {
+
+    private List<Mapping> mappings;
+
+    public GetProcessVariablesFacade(ConfigTree configTree) throws ConfigurationException {
+        mappings = ConfigUtil.getMappingConfig(configTree);
+    }
+
+    public Constants.OpCode getOpCode() {
+        return Constants.OpCode.GetProcessInstanceVariablesCommand;
+    }
+
+    public void setJBPMContextParameters(Message message) {
+        message.getBody().add(Constants.BPM_TO_ESB_VARS_TAG, mappings);
+    }
+
+    public static List<Mapping> getMappings(Message message) {
+        return (List<Mapping>) message.getBody().get(Constants.BPM_TO_ESB_VARS_TAG);
+    }
+}


Property changes on: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/GetProcessVariablesFacade.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.soa.esb.services.jbpm.cmd;
+
+import org.jbpm.command.VariablesCommand;
+import org.jbpm.JbpmContext;
+import org.jbpm.context.exe.VariableContainer;
+
+/**
+ * Get the process variables {@link java.util.Map}.
+ * <p/>
+ * This version of {@link VariablesCommand} "hungrily" gets the process
+ * variable, while still inside the jBPM execution context.
+ * <p/>
+ * {@link VariablesCommand} just returns a lazy proxy that gets the variables lazily.
+ * Gets from this proxy fail outside the context of a jBPM execution context. 
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class HungryVariablesCommand extends VariablesCommand {
+
+    public Object execute(JbpmContext jbpmContext) throws Exception {
+        VariableContainer variableContainer = getVariableContainer(jbpmContext);
+        return variableContainer.getVariables();
+    }
+}


Property changes on: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/HungryVariablesCommand.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/MessageFacade.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/MessageFacade.java	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/MessageFacade.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -26,7 +26,7 @@
      * <br/>Some of the Message content will thus come from configuration XML, and some will
      * be the users' responsibility (e.g. processId, tokenId, etc)
      * <br/>Variable name mapping between esb and jBPM is also handled by this interface
-     * @param message Message - Into which the static values will be added
+     * @param request Message - Into which the static values will be added
      */
     public abstract void setJBPMContextParameters(Message request);
     
@@ -49,7 +49,9 @@
             return new NewProcessInstanceFacade(config, false);
         if (Constants.OpCode.StartProcessInstanceCommand.equals(opCode))
             return new NewProcessInstanceFacade(config, true);
-                  
+        if (Constants.OpCode.GetProcessInstanceVariablesCommand.equals(opCode))
+            return new GetProcessVariablesFacade(config);
+
         throw new UnsupportedOperationException(opCode.toString()+" not implemented");
     }
 }

Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/NewProcessInstanceFacade.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/NewProcessInstanceFacade.java	2009-02-04 14:00:47 UTC (rev 25098)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/cmd/NewProcessInstanceFacade.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -78,19 +78,27 @@
 	public void setJBPMContextParameters(Message message) 
 	{
 		Body body = message.getBody();
+
         if (null!=_keyPath)
             body.add(Constants.KEYPATH, _keyPath);
-		if (null!=_actor)
+
+        if (null!=_actor)
 			body.add(Constants.ACTOR_ID	,_actor);
-		if (null!=_processName)
+
+        if (null!=_processName)
 			body.add(Constants.PROCESS_DEFINITION_NAME	,_processName);
-		if (null!=_processId)
+
+        if (null!=_processId)
 			body.add(Constants.PROCESS_DEFINITION_ID	,_processId);
-		if (null!=_transitionName)
+
+        if (null!=_transitionName)
 			body.add(Constants.TRANSITION_NAME, _transitionName);
-		Map<String,Object> variableMap = _mapper.mapFromEsbMessageToJBpmMap(message,_esbToBpm);
+
+        Map<String,Object> variableMap = _mapper.mapFromEsbMessageToJBpmMap(message,_esbToBpm);
+
         if (null!=variableMap)
             body.add(Constants.VARIABLE_VALUES, variableMap);
+
         if (_replyToOriginator) {
             final Call call = message.getHeader().getCall() ;
             setEPR(body, Constants.REPLY_TO, getEPR(call.getReplyTo())) ;

Added: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtilTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtilTest.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtilTest.java	2009-02-04 14:19:18 UTC (rev 25099)
@@ -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.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.soa.esb.services.jbpm.cmd;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.testutils.ESBConfigUtil;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.services.jbpm.Mapping;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.xml.sax.SAXException;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ConfigUtilTest extends TestCase {
+
+    public void test_esbToJBPM_Mapping() throws IOException, SAXException, ConfigurationException {
+        ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("mappingconfig-01.xml"));
+        ConfigTree actionConfig = configUtil.getActionConfig("InVM-0", "action1");
+
+        List<Mapping> mappingConfig = ConfigUtil.getMappingConfig(actionConfig);
+        assertEquals("[Mapping[ esb=eVar1, bpm=counter, isProcessScope=null, defaultValue=null ], Mapping[ esb=BODY_CONTENT, bpm=theBody, isProcessScope=null, defaultValue=null ]]", mappingConfig.toString());
+    }
+}


Property changes on: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/ConfigUtilTest.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/mappingconfig-01.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/mappingconfig-01.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/mappingconfig-01.xml	2009-02-04 14:19:18 UTC (rev 25099)
@@ -0,0 +1,21 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
+    parameterReloadSecs="5">
+
+      <services>
+        <service category="Cat" name="S1" description="Blah" invmScope="GLOBAL">
+            <actions mep="OneWay">
+                <action name="action1" class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
+                    <property name="command" value="GetProcessVariables" />
+                    <property name="process-definition-name" value="processDefinition2"/>
+                    <property name="actor" value="FrankSinatra"/>
+                    <property name="esbToBpmVars">
+                        <mapping esb="eVar1" bpm="counter" value="45" />
+                        <mapping esb="BODY_CONTENT" bpm="theBody" />
+                    </property>
+                 </action>
+              </actions>
+        </service>
+      </services>
+
+</jbossesb>


Property changes on: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/cmd/mappingconfig-01.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list