[jboss-svn-commits] JBL Code SVN: r24950 - in labs/jbossesb/workspace/dbevenius/ruleflow/product: samples/quickstarts/bpm_orchestration_flow_1 and 24 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jan 27 11:12:40 EST 2009


Author: beve
Date: 2009-01-27 11:12:40 -0500 (Tue, 27 Jan 2009)
New Revision: 24950

Added:
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build.xml
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/deployment.xml
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jbm-queue-service.xml
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jboss-esb-unfiltered.xml
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jboss-esb.xml
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jbossesb-properties.xml
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jndi.properties
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/juddi.properties
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/lib/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/log4j.xml
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/processDefinition/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/processDefinition/bpm_orchestration_flow_1.rf
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/readme.txt
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/ESBWorkDefinitions.conf
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/drools.rulebase.conf
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/log4j.xml
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service1.groovy
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service2.groovy
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service3.groovy
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/esb_actions/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/esb_actions/MessageSpy.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/DeployProcessMessage.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/SendTestMessage.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/DroolsConstants.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/ESBServiceWorkItemHandler.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/BpmProcessor.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/AbstractCommand.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/Command.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CommandFactory.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CompleteWorkItem.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcess.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcessException.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/StartProcess.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/commands/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/ESBServiceWorkItemHandlerUnitTest.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/action/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/action/BpmProcessorUnitTest.java
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/bpm-ruleflow-invalid.rf
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/bpm-ruleflow.rf
Modified:
   labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/build.xml
Log:
Drools Rule flow integration initial checkin.


Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,70 @@
+<project name="Quickstart_bpm_orchestration1" basedir=".">
+
+	<description>
+		${ant.project.name}
+		${line.separator}
+	</description>
+
+  <property name="deploy.exploded" value="false"/>
+
+  <!-- Import the base Ant build script... -->
+  <import file="../conf/base-build.xml"/>
+
+  <property name="jbossesb.inputdir" location="${build.dir}/inputdir"/>
+
+  <property name="project.process.dir" value="processDefinition"/>
+
+  <target name="config">
+    <delete dir="${jbossesb.inputdir}" quiet="true"/>
+    <mkdir dir="${jbossesb.inputdir}"/>
+    <copy file="${basedir}/jboss-esb-unfiltered.xml" tofile="${basedir}/jboss-esb.xml" overwrite="true" filtering="true">
+      <filterset>
+        <filter token="INPUT_DIR" value="${jbossesb.inputdir}"/>
+      </filterset>
+    </copy>
+  </target>
+
+  <target name="quickstart-specific-assemblies">
+    <copy overwrite="true" file="${project.process.dir}/bpm_orchestration_flow_1.rf" todir="${classes}" />
+    <copy todir="${classes}">
+      <fileset dir="${basedir}" includes="scripts/**/*"/>
+    </copy>
+  </target>
+	
+  <target name="run">
+		<echo message="This target is not implemented for this quickstart. Please run 'ant deploy', 'ant deployProcess' and 'ant startProcess'"/>
+	</target>
+	
+  <target name="runtest">
+    <echo message="This target is not implemented for this quickstart. Please run 'ant deployProcess' and 'ant startProcess'"/>
+  </target>
+	
+  <target name="deployProcess" description="deploys the process definition" depends="dependencies">
+    <echo>Deploy the process definition</echo>
+	<java fork="yes" classname="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.test.DeployProcessMessage" failonerror="true">
+	  <arg value="${jbossesb.inputdir}"/>
+	  <arg value=".deployProcessGW"/> <!-- file ext -->
+	  <arg value="${basedir}/processDefinition/bpm_orchestration_flow_1.rf"/>
+	  <classpath refid="exec-classpath"/>
+	</java>
+  </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_orchestration1.test.SendTestMessage" failonerror="true">
+	  <arg value="${jbossesb.inputdir}"/>
+	  <arg value=".startProcessGW"/> <!-- file ext -->
+	  <arg value="Start It Up"/> <!-- the file contents -->
+	  <classpath refid="exec-classpath"/>
+	</java>
+  </target>	
+
+  <target name="display-instructions">
+    <echo message='${line.separator}******************' />
+    <echo>Quickstart deployed to target JBoss ESB/App Server at '${org.jboss.esb.server.deploy.dir}'.</echo>
+    <echo>1.  Check your ESB Server console to make sure the deployment was executed without errors.</echo>
+    <echo>2.  Run 'ant deployProcess' and 'ant startProcess' to run the Quickstart.</echo>
+    <echo>3.  Check your ESB Server console again.  The Quickstart should have produced some output.</echo>
+    <echo message='******************' />
+  </target>
+</project>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/deployment.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/deployment.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+  <depends>jboss.esb:deployment=jbossesb.esb</depends>
+  <depends>jboss.esb:deployment=jbrules.esb</depends>
+</jbossesb-deployment>
\ No newline at end of file

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jbm-queue-service.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jbm-queue-service.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+    <mbean code="org.jboss.jms.server.destination.QueueService"
+           name="jboss.esb.destination:service=Queue,name=DroolsCallbackQueue"
+           xmbean-dd="xmdesc/Queue-xmbean.xml">
+        <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+    </mbean>
+</server>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jboss-esb-unfiltered.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jboss-esb-unfiltered.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jboss-esb-unfiltered.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,185 @@
+<?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">
+
+    <providers>        
+         <fs-provider name="FSprovider1">
+         
+          	<fs-bus busid="deployGwChannel" >
+          		<fs-message-filter
+          			directory="@INPUT_DIR@"
+          			input-suffix=".deployProcessGW"          			
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>    
+          	<fs-bus busid="deployEsbChannel" >
+          		<fs-message-filter
+          			directory="@INPUT_DIR@"
+          			input-suffix=".deployProcessESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus> 
+          	
+          	<fs-bus busid="startGwChannel" >
+          		<fs-message-filter
+          			directory="@INPUT_DIR@"
+          			input-suffix=".startProcessGW"
+          			work-suffix=".startProcessGWWorking"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>   
+          	<fs-bus busid="startEsbChannel" >
+          		<fs-message-filter
+          			directory="@INPUT_DIR@"
+          			input-suffix=".startProcessESB"          			
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>    
+          	<fs-bus busid="service1EsbChannel" >
+          		<fs-message-filter
+          			directory="@INPUT_DIR@"
+          			input-suffix=".service1ESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>   
+          	<fs-bus busid="service2EsbChannel" >
+          		<fs-message-filter
+          			directory="@INPUT_DIR@"
+          			input-suffix=".service2ESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus> 
+          	<fs-bus busid="service3EsbChannel" >
+          		<fs-message-filter
+          			directory="@INPUT_DIR@"
+          			input-suffix=".service3ESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>    
+          	<fs-bus busid="resultsService" >
+          		<fs-message-filter
+          			directory="@INPUT_DIR@"
+          			input-suffix=".resultsServiceESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>   	          	        	   	
+         </fs-provider>
+         <jms-jca-provider name="CallbackQueue-JMS-Provider" connection-factory="ConnectionFactory">
+	        <jms-bus busid="DroolsCallbackBus">
+               <jms-message-filter dest-type="QUEUE" dest-name="queue/DroolsCallbackQueue"/>
+            </jms-bus>
+         </jms-jca-provider>
+      </providers>
+
+      <services>
+        
+        <service category="BPM_Orchestration_Deploy_Service" name="Deploy_Service"
+                 description="BPM Orchestration Sample 1: Use this service to deploy a process">
+            <listeners>
+                <fs-listener name="Gateway" busidref="deployGwChannel"
+                    maxThreads="4"
+                    is-gateway="true" />
+                <fs-listener name="ESB-Listener" busidref="deployEsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="deploy_new_process" 
+                    class="org.jboss.soa.esb.ruleflow.action.BpmProcessor">
+                    <property name="command" value="deployProcess" />
+                 </action>
+              </actions>
+        </service>
+        
+        <service category="BPM_Orchestration_Starter_Service" name="Starter_Service"
+                 description="BPM Orchestration Sample 1: Use this service to start a process instance">
+            <listeners>
+                <fs-listener name="Gateway" busidref="startGwChannel"
+                    maxThreads="4"
+                    is-gateway="true" />
+                <fs-listener name="ESB-Listener" busidref="startEsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="create_new_process_instance" 
+                    class="org.jboss.soa.esb.ruleflow.action.BpmProcessor">
+                    <property name="command" value="startProcess" />
+                    <property name="processId" value="org.drools.sample.bpm_orchestration_flow_1"/>
+                 </action>
+              </actions>
+        </service>
+        
+        <service category="BPM_Orchestration_Service1" name="Service1"
+                 description="BPM Orchestration Sample 1: this is a service invoked within the process">
+            <listeners>
+                <fs-listener name="ESB-Listener" busidref="service1EsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="groovy" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
+                  <property name="script" value="/scripts/service1.groovy" />
+                </action>                                
+            </actions>
+        </service>
+
+        <service category="BPM_Orchestration_Service2" name="Service2"
+                 description="BPM Orchestration Sample 1: this is a service invoked within the process">
+            <listeners>
+                <fs-listener name="ESB-Listener" busidref="service2EsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="groovy" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
+                  <property name="script" value="/scripts/service2.groovy" />
+                </action>  
+		<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>              
+            </actions>
+        </service>
+
+        <service category="BPM_Orchestration_Service3" name="Service3"
+                 description="BPM Orchestration Sample 1: this is a service invoked within the process">
+            <listeners>
+                <fs-listener name="ESB-Listener" busidref="service3EsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="groovy" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
+                  <property name="script" value="/scripts/service3.groovy" />
+                </action>
+		<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
+            </actions>
+        </service>
+
+        <service category="BPM_Orchestration_ResultsService" name="ResultsService"
+                 description="BPM Orchestration Sample 1: Sends outbound results of the process flow">
+            <listeners>
+                <fs-listener name="ESB-Listener" busidref="resultsService"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="spy" 
+                    class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.esb_actions.MessageSpy"/>
+		<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
+            </actions>
+        </service>
+
+        <service category="JBossESB-Internal" name="DroolsWorkItemManagerService" description="BPM Service">
+            <listeners>
+                <jms-listener name="JMS-DCQListener" busidref="DroolsCallbackBus" maxThreads="1"/>
+            </listeners>
+            <actions mep="OneWay">
+                <action name="action" class="org.jboss.soa.esb.ruleflow.action.BpmProcessor">
+                    <property name="command" value="completeWorkItem" />
+                </action>
+            </actions>
+		</service>
+        
+      </services>
+</jbossesb>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jboss-esb.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,185 @@
+<?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">
+
+    <providers>        
+         <fs-provider name="FSprovider1">
+         
+          	<fs-bus busid="deployGwChannel" >
+          		<fs-message-filter
+          			directory="/opt/jboss/esb/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build/inputdir"
+          			input-suffix=".deployProcessGW"          			
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>    
+          	<fs-bus busid="deployEsbChannel" >
+          		<fs-message-filter
+          			directory="/opt/jboss/esb/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build/inputdir"
+          			input-suffix=".deployProcessESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus> 
+          	
+          	<fs-bus busid="startGwChannel" >
+          		<fs-message-filter
+          			directory="/opt/jboss/esb/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build/inputdir"
+          			input-suffix=".startProcessGW"
+          			work-suffix=".startProcessGWWorking"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>   
+          	<fs-bus busid="startEsbChannel" >
+          		<fs-message-filter
+          			directory="/opt/jboss/esb/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build/inputdir"
+          			input-suffix=".startProcessESB"          			
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>    
+          	<fs-bus busid="service1EsbChannel" >
+          		<fs-message-filter
+          			directory="/opt/jboss/esb/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build/inputdir"
+          			input-suffix=".service1ESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>   
+          	<fs-bus busid="service2EsbChannel" >
+          		<fs-message-filter
+          			directory="/opt/jboss/esb/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build/inputdir"
+          			input-suffix=".service2ESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus> 
+          	<fs-bus busid="service3EsbChannel" >
+          		<fs-message-filter
+          			directory="/opt/jboss/esb/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build/inputdir"
+          			input-suffix=".service3ESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>    
+          	<fs-bus busid="resultsService" >
+          		<fs-message-filter
+          			directory="/opt/jboss/esb/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/build/inputdir"
+          			input-suffix=".resultsServiceESB"
+          			post-delete="true"
+          			error-delete="true"
+          		/>
+          	</fs-bus>   	          	        	   	
+         </fs-provider>
+         <jms-jca-provider name="CallbackQueue-JMS-Provider" connection-factory="ConnectionFactory">
+	        <jms-bus busid="DroolsCallbackBus">
+               <jms-message-filter dest-type="QUEUE" dest-name="queue/DroolsCallbackQueue"/>
+            </jms-bus>
+         </jms-jca-provider>
+      </providers>
+
+      <services>
+        
+        <service category="BPM_Orchestration_Deploy_Service" name="Deploy_Service"
+                 description="BPM Orchestration Sample 1: Use this service to deploy a process">
+            <listeners>
+                <fs-listener name="Gateway" busidref="deployGwChannel"
+                    maxThreads="4"
+                    is-gateway="true" />
+                <fs-listener name="ESB-Listener" busidref="deployEsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="deploy_new_process" 
+                    class="org.jboss.soa.esb.ruleflow.action.BpmProcessor">
+                    <property name="command" value="deployProcess" />
+                 </action>
+              </actions>
+        </service>
+        
+        <service category="BPM_Orchestration_Starter_Service" name="Starter_Service"
+                 description="BPM Orchestration Sample 1: Use this service to start a process instance">
+            <listeners>
+                <fs-listener name="Gateway" busidref="startGwChannel"
+                    maxThreads="4"
+                    is-gateway="true" />
+                <fs-listener name="ESB-Listener" busidref="startEsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="create_new_process_instance" 
+                    class="org.jboss.soa.esb.ruleflow.action.BpmProcessor">
+                    <property name="command" value="startProcess" />
+                    <property name="processId" value="org.drools.sample.bpm_orchestration_flow_1"/>
+                 </action>
+              </actions>
+        </service>
+        
+        <service category="BPM_Orchestration_Service1" name="Service1"
+                 description="BPM Orchestration Sample 1: this is a service invoked within the process">
+            <listeners>
+                <fs-listener name="ESB-Listener" busidref="service1EsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="groovy" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
+                  <property name="script" value="/scripts/service1.groovy" />
+                </action>                                
+            </actions>
+        </service>
+
+        <service category="BPM_Orchestration_Service2" name="Service2"
+                 description="BPM Orchestration Sample 1: this is a service invoked within the process">
+            <listeners>
+                <fs-listener name="ESB-Listener" busidref="service2EsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="groovy" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
+                  <property name="script" value="/scripts/service2.groovy" />
+                </action>  
+		<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>              
+            </actions>
+        </service>
+
+        <service category="BPM_Orchestration_Service3" name="Service3"
+                 description="BPM Orchestration Sample 1: this is a service invoked within the process">
+            <listeners>
+                <fs-listener name="ESB-Listener" busidref="service3EsbChannel"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="groovy" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
+                  <property name="script" value="/scripts/service3.groovy" />
+                </action>
+		<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
+            </actions>
+        </service>
+
+        <service category="BPM_Orchestration_ResultsService" name="ResultsService"
+                 description="BPM Orchestration Sample 1: Sends outbound results of the process flow">
+            <listeners>
+                <fs-listener name="ESB-Listener" busidref="resultsService"
+                maxThreads="1"/>
+            </listeners>
+            <actions>
+                <action name="spy" 
+                    class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.esb_actions.MessageSpy"/>
+		<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
+            </actions>
+        </service>
+
+        <service category="JBossESB-Internal" name="DroolsWorkItemManagerService" description="BPM Service">
+            <listeners>
+                <jms-listener name="JMS-DCQListener" busidref="DroolsCallbackBus" maxThreads="1"/>
+            </listeners>
+            <actions mep="OneWay">
+                <action name="action" class="org.jboss.soa.esb.ruleflow.action.BpmProcessor">
+                    <property name="command" value="completeWorkItem" />
+                </action>
+            </actions>
+		</service>
+        
+      </services>
+</jbossesb>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jbossesb-properties.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jbossesb-properties.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  JBoss, Home of Professional Open Source
+  Copyright 2006, JBoss Inc., 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-2006,
+  @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+  These options are described in the JBossESB manual.
+  Defaults are provided here for convenience only.
+ 
+  Please read through this file prior to using the system, and consider
+  updating the specified entries.
+-->
+<esb
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+    <properties name="core">
+		<property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+		<property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+		<property name="org.jboss.soa.esb.persistence.connection.factory" 	value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+        <property name="jboss.esb.invm.scope.default" value="NONE"/>
+    </properties>
+    <properties name="registry">      
+    	<property name="org.jboss.soa.esb.registry.queryManagerURI"     		
+    		value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>    		
+    	<property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"     		
+    		value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+    	<property name="org.jboss.soa.esb.registry.implementationClass" 
+    		value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.factoryClass" 
+    		value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+    	<property name="org.jboss.soa.esb.registry.user" 
+    		value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.registry.password" 
+    	  value="password"/>
+    	<!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+    	<property name="org.jboss.soa.esb.scout.proxy.transportClass" 
+    		value="org.apache.ws.scout.transport.RMITransport"/>
+    </properties>
+    <properties name="transports" depends="core">
+    	<property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+    	<property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+    	<property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+    </properties>
+    <properties name="connection">
+    	<property name="min-pool-size" value="5"/>
+    	<property name="max-pool=size" value="10"/>
+    	<property name="blocking-timeout-millis" value="5000"/>
+    	<property name="abandoned-connection-timeout" value="10000"/>
+    	<property name="abandoned-connection-time-interval" value="30000"/>
+    </properties>
+    <properties name="dbstore">
+		<property name="org.jboss.soa.esb.persistence.db.connection.url" 	value="jdbc:hsqldb:hsql://localhost:9001/"/>
+		<property name="org.jboss.soa.esb.persistence.db.jdbc.driver" 		value="org.hsqldb.jdbcDriver"/>
+		<property name="org.jboss.soa.esb.persistence.db.user" 			value="sa"/>
+		<property name="org.jboss.soa.esb.persistence.db.pwd" 			value=""/>		
+		<property name="org.jboss.soa.esb.persistence.db.pool.initial.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.min.size"	value="2"/>
+		<property name="org.jboss.soa.esb.persistence.db.pool.max.size"	value="5"/>
+		<!--table managed by pool to test for valid connections - created by pool automatically -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.test.table"	value="pooltest"/>
+		<!-- # of milliseconds to timeout waiting for a connection from pool -->
+		<property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis"	value="5000"/> 
+                <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+    </properties>
+    <properties name="messagerouting">
+    	<property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+    </properties>
+</esb>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jndi.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jndi.properties	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/jndi.properties	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/juddi.properties
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/juddi.properties	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/juddi.properties	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any 
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct 
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+ 
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+  

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/log4j.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/log4j.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/log4j.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A size based file rolling appender -->
+   <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="File" value="./listener.log"/>
+     <param name="Append" value="false"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+     </layout>	    
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="org.jboss">
+      <priority value="WARN"/>
+   </category>
+   <category name="org.jboss.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss.internal.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.apache">
+      <priority value="ERROR"/>
+   </category>
+   <category name="quickstart">
+      <priority value="DEBUG"/>
+   </category>
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/processDefinition/bpm_orchestration_flow_1.rf
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/processDefinition/bpm_orchestration_flow_1.rf	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/processDefinition/bpm_orchestration_flow_1.rf	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<process xmlns="http://drools.org/drools-5.0/process"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
+         type="RuleFlow" name="flow" id="org.drools.sample.bpm_orchestration_flow_1" package-name="org.drools.sample" version="1.0" >
+
+  <header>
+    <variables>
+      <variable name="org.jboss.soa.esb.message.defaultEntry" >
+        <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+      </variable>
+    </variables>
+  </header>
+
+  <nodes>
+    <workItem id="2" name="Service1" x="128" y="16" width="97" height="40" >
+      <work name="ESB Service" >
+        <parameter name="Body" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+        <parameter name="ServiceName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>Service1</value>
+        </parameter>
+        <parameter name="CategoryName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>BPM_Orchestration_Service1</value>
+        </parameter>
+      </work>
+      <mapping type="in" from="org.jboss.soa.esb.message.defaultEntry" to="Body" />
+      <mapping type="out" from="Result" to="org.jboss.soa.esb.message.defaultEntry" />
+      <onEntry>
+        <action type="expression" dialect="java" >System.out.println("Executed by the process, not by the ESB");</action>
+      </onEntry>
+    </workItem>
+
+    <workItem id="4" name="Service3" x="387" y="16" width="98" height="40" >
+      <work name="ESB Service" >
+        <parameter name="Body" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+        <parameter name="ServiceName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>Service3</value>
+        </parameter>
+        <parameter name="CategoryName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>BPM_Orchestration_Service3</value>
+        </parameter>
+      </work>
+      <mapping type="in" from="org.jboss.soa.esb.message.defaultEntry" to="Body" />
+      <mapping type="out" from="Result" to="org.jboss.soa.esb.message.defaultEntry" />
+    </workItem>
+    <end id="6" name="End" x="646" y="16" width="80" height="40" />
+    <start id="1" name="Start" x="16" y="16" width="80" height="40" />
+    <workItem id="3" name="Service2" x="257" y="16" width="98" height="40" >
+      <work name="ESB Service" >
+        <parameter name="Body" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+        <parameter name="ServiceName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>Service2</value>
+        </parameter>
+        <parameter name="CategoryName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>BPM_Orchestration_Service2</value>
+        </parameter>
+      </work>
+      <mapping type="in" from="org.jboss.soa.esb.message.defaultEntry" to="Body" />
+      <mapping type="out" from="Result" to="org.jboss.soa.esb.message.defaultEntry" />
+    </workItem>
+    <workItem id="5" name="Results" x="517" y="16" width="97" height="40" >
+      <work name="ESB Service" >
+        <parameter name="CategoryName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>BPM_Orchestration_ResultsService</value>
+        </parameter>
+        <parameter name="ServiceName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>ResultsService</value>
+        </parameter>
+        <parameter name="Body" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+      </work>
+      <mapping type="in" from="org.jboss.soa.esb.message.defaultEntry" to="Body" />
+      <onExit>
+        <action type="expression" dialect="java" >System.out.println("Executed by the process, not by the ESB");</action>
+      </onExit>
+    </workItem>
+  </nodes>
+
+  <connections>
+    <connection from="1" to="2" />
+    <connection from="3" to="4" />
+    <connection from="5" to="6" />
+    <connection from="2" to="3" />
+    <connection from="4" to="5" />
+  </connections>
+
+</process>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/readme.txt	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/readme.txt	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,39 @@
+Overview:
+=========
+  The purpose of the bpm_orchestration1 quickstart sample is to demonstrate the
+  integration Drools Rule Flow with JBossESB.
+
+To Run '.esb' archive mode:
+===========================
+  1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+  2. Open another command terminal window in this folder ("Window2"), type
+     'ant deployProcess'.
+  3. Switch back to Application Server console and wait for the message
+	[DeployProcess] Deployed process 'org.drools.sample'
+  4. Switch back to "Window2", type 'ant startProcess'.
+  5. Switch back to Application Server console to see the output from the ESB.
+  
+   Sample Output from "ant startProcess":
+    ======================================
+	17:05:49,295 INFO  [STDOUT] Executed by the process, not by the ESB
+	17:05:49,954 INFO  [STDOUT] 1********** Begin Service 1 ***********
+	17:05:50,031 INFO  [STDOUT] In: Start It Up
+	17:05:50,031 INFO  [STDOUT] Out: Service 1 Start It Up
+	17:05:50,032 INFO  [STDOUT] ************ End Service 1 ************
+	17:05:50,297 INFO  [STDOUT] 2********** Begin Service 2 ***********
+	17:05:50,297 INFO  [STDOUT] In: Service 1 Start It Up
+	17:05:50,297 INFO  [STDOUT] Out: Service 2 Service 1 Start It Up
+	17:05:50,297 INFO  [STDOUT] ************ End Service 2 ************
+	17:05:50,491 INFO  [STDOUT] 3********** Begin Service 3 ***********
+	17:05:50,491 INFO  [STDOUT] In: Service 2 Service 1 Start It Up
+	17:05:50,492 INFO  [STDOUT] Out: Service 3 Service 2 Service 1 Start It Up
+	17:05:50,492 INFO  [STDOUT] ************ End Service 3 ************
+	17:05:50,671 INFO  [STDOUT] Body: Service 3 Service 2 Service 1 Start It Up
+	17:05:50,838 INFO  [STDOUT] Executed by the process, not by the ESB
+
+  
+  6. To undeploy the esb archive, type 'ant undeploy' ("Window1").
+
+
+
+

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/ESBWorkDefinitions.conf
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/ESBWorkDefinitions.conf	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/ESBWorkDefinitions.conf	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,24 @@
+// We use MVEL to return a List of work definitions
+// The properties of the work definitions are specified as a Map<String, Object>
+// The allowed properties are name, parameters, displayName, icon and customEditor
+// The returned result should thus be of type List<Map<String, Object>>
+import org.drools.process.core.datatype.impl.type.StringDataType;
+
+[
+
+  [
+    "name" : "ESB Service",
+    "parameters" : [
+    	"CategoryName" : new StringDataType(),
+    	"ServiceName" : new StringDataType(),
+    	"Body" : new StringDataType(),
+    ],
+    "results" : [
+    	"Result" : new StringDataType(),
+    ],
+    "displayName" : "ESB Service",
+    "icon" : "icons/action.gif",
+    "customEditor" : "org.drools.eclipse.flow.common.editor.editpart.work.SampleCustomEditor"
+  ]
+  
+]
\ No newline at end of file

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/drools.rulebase.conf
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/drools.rulebase.conf	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/META-INF/drools.rulebase.conf	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1 @@
+drools.workDefinitions = ESBWorkDefinitions.conf
\ No newline at end of file

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/log4j.xml	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/resources/log4j.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+   <!-- ============================== -->
+   <!-- Append messages to the console -->
+   <!-- ============================== -->
+
+   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+      </layout>
+   </appender>
+
+   <!-- ================================= -->
+   <!-- Preserve messages in a local file -->
+   <!-- ================================= -->
+
+   <!-- A size based file rolling appender -->
+   <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+     <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+     <param name="File" value="./listener.log"/>
+     <param name="Append" value="false"/>
+     <param name="MaxFileSize" value="500KB"/>
+     <param name="MaxBackupIndex" value="1"/>
+
+     <layout class="org.apache.log4j.PatternLayout">
+       <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+     </layout>	    
+   </appender>
+
+   <!-- ================ -->
+   <!-- Limit categories -->
+   <!-- ================ -->
+
+   <category name="org.jboss">
+      <priority value="WARN"/>
+   </category>
+   <category name="org.jboss.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.jboss.internal.soa.esb">
+      <priority value="ERROR"/>
+   </category>
+   <category name="org.apache">
+      <priority value="ERROR"/>
+   </category>
+   <category name="quickstart">
+      <priority value="DEBUG"/>
+   </category>
+   <!-- ======================= -->
+   <!-- Setup the Root category -->
+   <!-- ======================= -->
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+      <appender-ref ref="FILE"/>
+   </root>
+
+</log4j:configuration>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service1.groovy
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service1.groovy	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service1.groovy	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,11 @@
+import org.jboss.soa.esb.message.*
+
+println "1********** Begin Service 1 ***********"
+
+println "In: " + new String(message.getBody().get())
+
+message.getBody().add("Service 1 " + new String(message.getBody().get()))
+
+println "Out: " + message.getBody().get()
+
+println "************ End Service 1 ************"
\ No newline at end of file

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service2.groovy
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service2.groovy	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service2.groovy	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,13 @@
+import org.jboss.soa.esb.message.*
+
+println "2********** Begin Service 2 ***********"
+
+println "In: " + new String(message.getBody().get())
+
+message.getBody().add("Service 2 " + new String(message.getBody().get()))
+
+println "Out: " + message.getBody().get()
+
+println "************ End Service 2 ************"
+
+

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service3.groovy
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service3.groovy	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/scripts/service3.groovy	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,10 @@
+import org.jboss.soa.esb.message.*
+
+println "3********** Begin Service 3 ***********"
+
+println "In: " + new String(message.getBody().get())
+
+message.getBody().add("Service 3 " + new String(message.getBody().get()))
+
+println "Out: " + message.getBody().get()
+println "************ End Service 3 ************"
\ No newline at end of file

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/esb_actions/MessageSpy.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/esb_actions/MessageSpy.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/esb_actions/MessageSpy.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,23 @@
+package org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.esb_actions;
+
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+public class MessageSpy extends AbstractActionLifecycle {
+	
+	public Message process(Message message) throws Exception {
+        Object payload = message.getBody().get();
+        if (payload instanceof byte[]) {
+            System.out.println("Body: " + new String((byte[])payload));
+        } else if (payload instanceof String) {
+        	System.out.println("Body: " + payload);
+		} else {
+			System.out.println("Body Contents are NULL");
+		}
+		return message;         	
+	}
+	 	  
+    public MessageSpy(ConfigTree config) {} 
+  
+}	
\ No newline at end of file

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/DeployProcessMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/DeployProcessMessage.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/DeployProcessMessage.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.test;
+
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.util.Calendar;
+
+public class DeployProcessMessage {
+    
+	public DeployProcessMessage() {
+	}
+	
+	public void sendMessage(String inputDirectory, String fileExtension, String fileName) {
+    	String prefix = Long.toString(Calendar.getInstance().getTimeInMillis());
+    	File x = null;
+    	try {
+    		x = File.createTempFile(prefix + "_",fileExtension,new File(inputDirectory));
+    		BufferedWriter out = new BufferedWriter(new FileWriter(x));
+    		FileReader fileReader = new FileReader(fileName);
+    		final StringBuffer text = new StringBuffer();
+            final char[] buf = new char[1024];
+            int len = 0;
+            while ((len = fileReader.read(buf)) >= 0) {
+                text.append(buf, 0, len);
+            }
+    		out.write(text.toString());
+    		out.close();
+    	} catch (Exception e) {
+    		System.out.println("Error while writing the file: " + x.getAbsolutePath());
+    		System.out.println(e.getMessage());
+    	}		
+	}
+	
+    public static void main(String args[]) throws Exception
+    {               
+    	DeployProcessMessage stm = new DeployProcessMessage();
+    	stm.sendMessage(args[0], args[1], args[2]);
+    }
+    
+}

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/SendTestMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/SendTestMessage.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/samples/quickstarts/bpm_orchestration_flow_1/src/org/jboss/soa/esb/samples/quickstarts/bpm_orchestration1/test/SendTestMessage.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstarts.bpm_orchestration1.test;
+
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.Calendar;
+
+public class SendTestMessage {
+    
+	public SendTestMessage() {
+	}
+	
+	public void sendMessage(String inputDirectory, String fileExtension, String fileContents) {    	
+    	String prefix = Long.toString(Calendar.getInstance().getTimeInMillis());
+    	File x = null;
+    	try {
+    		x = File.createTempFile(prefix + "_",fileExtension,new File(inputDirectory));
+    		BufferedWriter out = new BufferedWriter(new FileWriter(x));
+    		out.write(fileContents.toCharArray());
+    		out.close();
+    	} catch (Exception e) {
+    		System.out.println("Error while writing the file: " + x.getAbsolutePath());
+    		System.out.println(e.getMessage());
+    	}		
+	}
+	
+    public static void main(String args[]) throws Exception
+    {               
+    	SendTestMessage stm = new SendTestMessage();
+    	stm.sendMessage(args[0], args[1], args[2]);
+    }
+    
+}

Modified: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/build.xml	2009-01-27 14:29:00 UTC (rev 24949)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/build.xml	2009-01-27 16:12:40 UTC (rev 24950)
@@ -11,6 +11,7 @@
 				<include name="*.drl"/>	
 				<include name="*.properties"/>	
 				<include name="*.pgk"/>	
+				<include name="**/*.rf"/>	
 			</fileset>
 		</copy>
 		<antcall target="base.test"/>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/DroolsConstants.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/DroolsConstants.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/DroolsConstants.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow;
+
+/**
+ * Constants used for ESB Drools Ruleflow integration.
+ * 
+ */
+public final class DroolsConstants 
+{
+	public static final String DROOLS_SERVICE_NAME = "DroolsWorkItemManagerService";
+	public static final String SERVICE_NAME = "ServiceName";
+	public static final String CATEGORY_NAME = "CategoryName";
+	public static final String BODY = "Body";
+	public static final String REPLY_TO = "ReplyTo";
+	public static final String RESULT = "Result";
+	
+	public static final  String WORK_ITEM_ID = "WorkItemId";
+
+}

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/ESBServiceWorkItemHandler.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/ESBServiceWorkItemHandler.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/ESBServiceWorkItemHandler.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,204 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.process.instance.WorkItemHandler;
+import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
+import org.jboss.soa.esb.UnmarshalException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.MalformedEPRException;
+import org.jboss.soa.esb.addressing.PortReference;
+import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.couriers.Courier;
+import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.couriers.CourierFactory;
+import org.jboss.soa.esb.couriers.CourierUtil;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.message.mapping.ObjectMapper;
+import org.jboss.soa.esb.message.mapping.ObjectMappingException;
+
+/**
+ * ESBServiceWorkHandler is a WorkItemHandler that takes care of communication
+ * from a Drools RuleFlow and JBossESB.
+ * <p/>
+ * 
+ * <h3> Setup/Configuration </h3>
+ * To enable/use this work handler two things need to happen. 
+ * <br>
+ * 1. You need to register this work handler in the session:
+ * <pre>{@code
+ *   RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ *   session = ruleBase.newStatefulSession();
+ *   session.getWorkItemManager().registerWorkItemHandler("handlerName", new ESBServiceWorkItemHandler())
+ * }</pre>
+ * 
+ * 2. Specify that this work item handler is to be used. This is specified in the rule flow file:
+ * <pre>{@code
+ * <nodes>
+ *  <workItem id="2" name="Service1" x="128" y="16" width="97" height="40" >
+ *   <work name="ESB Service" >
+ *   ...
+ * </nodes>
+ * }</pre>
+ * 
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ESBServiceWorkItemHandler implements WorkItemHandler
+{
+    /**
+     * Cache of ServiceInvokers.
+     */
+    private static Map<String, ServiceInvoker> serviceInvokerCache = new HashMap<String, ServiceInvoker>();
+    
+    /**
+     * 
+     */
+    public void executeWorkItem(org.drools.runtime.process.WorkItem workItem, org.drools.runtime.process.WorkItemManager manager)
+    {
+
+        String serviceName = (String) workItem.getParameter(DroolsConstants.SERVICE_NAME);
+        String categoryName = (String) workItem.getParameter(DroolsConstants.CATEGORY_NAME);
+        Object body = workItem.getParameter(DroolsConstants.BODY);
+        String oldReplyTo = (String) workItem.getParameter(DroolsConstants.REPLY_TO);
+
+        // Validation
+        EPR oldReplyToEPR = null;
+        if (oldReplyTo != null)
+        {
+            try
+            {
+                oldReplyToEPR = EPRHelper.fromXMLString(oldReplyTo);
+            } catch (UnmarshalException e)
+            {
+                throw new IllegalArgumentException("Could not unmarshal replyTo EPR!", e);
+            }
+            if (oldReplyToEPR == null)
+            {
+                throw new IllegalArgumentException("Could not restore replyTo EPR!");
+            }
+        } else
+        {
+            if (null == categoryName)
+            {
+                throw new IllegalArgumentException("ESB Service category must not be null!");
+            }
+            if (null == serviceName)
+            {
+                throw new IllegalArgumentException("ESB Service name must not be null!");
+            }
+        }
+
+        // Initializing the message
+        Message message;
+        try
+        {
+            message = MessageFactory.getInstance().getMessage();
+            if (body != null)
+            {
+                new ObjectMapper().setObjectOnMessage(message, "BODY_CONTENT", body);
+            }
+        } catch (ObjectMappingException e)
+        {
+            throw new IllegalArgumentException("Could not create ESB message!", e);
+        }
+        EPR replyTo = createReplyTo(workItem.getId());
+        message.getHeader().getCall().setReplyTo(replyTo);
+
+        // Sending the message
+        if (oldReplyToEPR != null)
+        {
+            if (oldReplyToEPR instanceof LogicalEPR)
+            {
+                try
+                {
+                    final ServiceInvoker invoker = ((LogicalEPR) oldReplyToEPR).getServiceInvoker();
+                    invoker.deliverAsync(message);
+                } catch (MessageDeliverException e)
+                {
+                    throw new IllegalArgumentException("Could not deliver ESB message!", e);
+                }
+            } else
+            {
+                try
+                {
+                    final Courier courier = CourierFactory.getCourier(oldReplyToEPR);
+                    try
+                    {
+                        courier.deliver(message);
+                    } finally
+                    {
+                        CourierUtil.cleanCourier(courier);
+                    }
+                } catch (MalformedEPRException e)
+                {
+                    throw new IllegalArgumentException("Could not deliver ESB message!", e);
+                } catch (CourierException e)
+                {
+                    throw new IllegalArgumentException("Could not deliver ESB message!", e);
+                }
+            }
+        } else
+        {
+            try
+            {
+                getServiceInvoker(categoryName, serviceName).deliverAsync(message);
+            } catch (MessageDeliverException e)
+            {
+                throw new IllegalArgumentException("Could not deliver ESB message!", e);
+            }
+        }
+    }
+
+    private ServiceInvoker getServiceInvoker(String categoryName, String serviceName) throws MessageDeliverException
+    {
+        String key = categoryName + "." + serviceName;
+        ServiceInvoker serviceInvoker = serviceInvokerCache.get(key);
+        if (serviceInvoker != null)
+        {
+            return serviceInvoker;
+        }
+        serviceInvoker = new ServiceInvoker(categoryName, serviceName);
+        serviceInvokerCache.put(key, serviceInvoker);
+        return serviceInvoker;
+    }
+
+    private EPR createReplyTo(long workItemInstanceId)
+    {
+        EPR replyTo = new LogicalEPR(ServiceInvoker.INTERNAL_SERVICE_CATEGORY, DroolsConstants.DROOLS_SERVICE_NAME);
+        PortReference portReference = replyTo.getAddr();
+        portReference.addExtension(DroolsConstants.WORK_ITEM_ID, String.valueOf(workItemInstanceId));
+        return replyTo;
+    }
+
+    public void abortWorkItem(org.drools.runtime.process.WorkItem workItem, org.drools.runtime.process.WorkItemManager manager)
+    {
+        //TODO: Do we need to do any cleaning up here.
+    }
+
+}

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/BpmProcessor.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/BpmProcessor.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/BpmProcessor.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionLifecycle;
+import org.jboss.soa.esb.actions.ActionLifecycleException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.ruleflow.ESBServiceWorkItemHandler;
+import org.jboss.soa.esb.ruleflow.action.commands.AbstractCommand;
+import org.jboss.soa.esb.ruleflow.action.commands.Command;
+import org.jboss.soa.esb.ruleflow.action.commands.CommandFactory;
+import org.jboss.soa.esb.ruleflow.action.commands.CompleteWorkItem;
+import org.jboss.soa.esb.ruleflow.action.commands.StartProcess;
+
+/**
+ * BpmProcessor is a Drools RuleFlow action for JBossESB.
+ * <p/>
+ * 
+ * <h2> Deploy a process </h2>
+ * For configuration information see {@link DeployProcess}.
+ * 
+ * <h2> Start a process </h2>
+ * For configuration information see {@link StartProcess}.
+ * 
+ * <h2> Complete a process </h2>
+ * For configuration information see {@link CompleteWorkItem}.
+ * 
+ * <p/>
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 4.5
+ */
+public class BpmProcessor implements ActionLifecycle
+{
+    /**
+     * Work item handler name which is specified in a .rf file.
+     */
+    public static final String HANDLER_NAME = "ESB Service";
+    
+    /**
+     * The Drools stateful session.
+     */
+    private static StatefulSession session = registerEsbWorkItemHandler();
+    
+    /**
+     * The command that this processor handles.
+     */
+    private Command command;
+
+    /**
+     * Sole Constructor.
+     * 
+     * @param config    {@link ConfigTree} that will be passed to the {@link CommandFactory} and made
+     *                  available to {@link AbstractCommand} implementations.
+     *                  
+     * @throws ConfigurationException If an invalid configuration was passed.
+     */
+    public BpmProcessor(final ConfigTree config) throws ConfigurationException
+    {
+        command = CommandFactory.getInstance().create(config);
+    }
+    
+    /**
+     * Currently does nothing.
+     */
+    public void initialise() throws ActionLifecycleException
+    {
+        //NoOp
+    }
+
+    public Message process(final Message message) throws ActionProcessingException 
+    {
+        command.execute(message, session);
+        return null;
+    }
+
+    /**
+     * Currently does nothing.
+     */
+    public void destroy() throws ActionLifecycleException
+    {
+        //TODO: Do we need to call dispose here. Is there a risk that we have inserted things into
+        //      the working memory that may be left there causing a leak.
+    }
+
+    private static StatefulSession registerEsbWorkItemHandler()
+    {
+        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        final StatefulSession session = ruleBase.newStatefulSession();
+        session.getWorkItemManager().registerWorkItemHandler(HANDLER_NAME, new ESBServiceWorkItemHandler());
+        return session;
+    }
+
+}

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/AbstractCommand.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/AbstractCommand.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/AbstractCommand.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action.commands;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+/**
+ * Simple abstract class to force subclasses to have a constructor
+ * that takes a {@link ConfigTree}.
+ * <p/>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * 
+ */
+public abstract class AbstractCommand implements Command
+{
+    /**
+     * Sole constructor.
+     * 
+     * @param config The config for this command.
+     */
+    public AbstractCommand(final ConfigTree config)
+    {
+    }
+}


Property changes on: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/AbstractCommand.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/Command.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/Command.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/Command.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action.commands;
+
+import org.drools.StatefulSession;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * Command interface for executing Drools Ruleflow commands.
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * 
+ */
+public interface Command
+{
+    void execute(final Message message, final StatefulSession session) throws ActionProcessingException;
+}


Property changes on: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/Command.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CommandFactory.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CommandFactory.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CommandFactory.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action.commands;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+/**
+ * Factory for {@link Command}s.
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class CommandFactory
+{
+    /**
+     * Singleton instance.
+     */
+    private static final CommandFactory INSTANCE = new CommandFactory();
+    
+    /**
+     * Private constructor.
+     */
+    private CommandFactory()
+    {
+    }
+    
+    /**
+     * Returns the singleton.
+     * 
+     * @return CommandFactory The singleton factory.
+     */
+    public static CommandFactory getInstance()
+    {
+        return CommandFactory.INSTANCE;
+    }
+    
+    /**
+     * Creates {@link Command} implementations depending on the configured 'command' attribute
+     * in the passed in {@link ConfigTree}.
+     * 
+     * @param config    The configuration.
+     * @return Command  Command instance that matches the passed in command name.
+     * 
+     * @throws ConfigurationException If required configuration settings are missing.
+     */
+    public Command create(final ConfigTree config) throws ConfigurationException
+    {
+        final String command = config.getRequiredAttribute("command");
+        if (command.equals(StartProcess.NAME))
+        {
+            return new StartProcess(config);
+        }
+        else if (command.equals(DeployProcess.NAME))
+        {
+            return new DeployProcess(config);
+        }
+        else if (command.equals(CompleteWorkItem.NAME))
+        {
+            return new CompleteWorkItem();
+        }
+        throw new ConfigurationException("Could not find an AbstractCommand implementation for command '" + command + "'");
+    }
+
+}


Property changes on: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CommandFactory.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CompleteWorkItem.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CompleteWorkItem.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/CompleteWorkItem.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action.commands;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.StatefulSession;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.ruleflow.DroolsConstants;
+
+/**
+ * Completes a work item.
+ * <p/>
+ * 
+ * * <h2> Complete a process </h2>
+ * Example action configuration to complete a process:
+ * <pre>{@code
+ * <actions>
+ *    <action name="create_new_process_instance" class="org.jboss.soa.esb.actions.ruleflow.BpmProcessor">
+ *       <property name="command" value="completeWorkItem" />
+ *     </action>
+ * </actions>
+ * }</pre>
+ * <lu>
+ * <li><i>commmand</i>  
+ *      Will cause this class to be used as the command. Mandatory</li>
+ * </lu>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class CompleteWorkItem implements Command
+{
+    /**
+     * Name of this command.
+     */
+    public static final String NAME = "completeWorkItem";
+    
+    public void execute(final Message message, final StatefulSession session)
+    {
+        final String workItemId = message.getHeader().getCall().getTo().getAddr().getExtensionValue(DroolsConstants.WORK_ITEM_ID);
+        final Map<String, Object> results = new HashMap<String, Object>();
+        results.put("Result", message.getBody().get());
+        session.getWorkItemManager().completeWorkItem(Long.parseLong(workItemId), results);
+    }
+    
+}

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcess.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcess.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcess.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action.commands;
+
+import java.io.StringReader;
+
+import org.apache.log4j.Logger;
+import org.drools.StatefulSession;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderErrors;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * Deploys a Drools RuleFlow process definiation.
+ * <p/> 
+ * 
+ * <h2> Deploy a process </h2>
+ * Example action configuration to deploy a process:
+ * <pre>{@code
+ * <actions>
+ *    <action name="create_new_process_instance" class="org.jboss.soa.esb.actions.ruleflow.BpmProcessor">
+ *       <property name="command" value="deployProcess" />
+ *     </action>
+ * </actions>
+ * }</pre>
+ * 
+ * <lu>
+ * <li><i>commmand</i>  
+ *      Will cause this class to be used as the command. Mandatory</li>
+ * <li><i>processLocation</i>  
+ *      Optional location for the process defination. By default the process definition is expected to be
+ *      in the default body but this can be overridden by specifying this property.</li>
+ * </lu>
+ * 
+ * 
+ * The execute method expects the {@link Message} instances body content
+ * to contain a String that is the process definition.
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * 
+ */
+public class DeployProcess extends AbstractCommand
+{
+    /**
+     * Name of this command.
+     */
+    public static final String NAME = "deployProcess";
+    
+    /**
+     * Logger.
+     */
+    private Logger log = Logger.getLogger(DeployProcess.class);
+    
+    /**
+     * Stores the named location of the process definition.
+     */
+    private String processLocation;
+    
+    /**
+     * Sole constructor.
+     * 
+     * @param config The configuration for this action.
+     */
+    public DeployProcess(ConfigTree config) 
+    {
+        super(config);
+        processLocation = config.getAttribute("processLocation", Body.DEFAULT_LOCATION);
+    }
+
+    public void execute(final Message message, final StatefulSession session) throws ActionProcessingException
+    {
+        final PackageBuilder packageBuilder = new PackageBuilder();
+        final StringReader reader = new StringReader(extractProcessDef(message));
+        packageBuilder.addProcessFromXml(reader);
+        
+        verifyDeployment(packageBuilder);
+        
+        session.getRuleBase().addPackage(packageBuilder.getPackage());
+        
+        log.info("Deployed process '" + packageBuilder.getPackage().getName() + "'");
+    }
+    
+    protected String extractProcessDef(final Message message) throws ActionProcessingException
+    {
+        final Object object = message.getBody().get(processLocation);
+        
+        if (object instanceof String)
+        {
+            return (String) object;
+        }
+        else if (object instanceof byte[])
+        {
+            return new String((byte[]) object);
+        }
+        
+        throw new ActionProcessingException("Could not located a RuleFlow process definition in body location '" + processLocation + "'. Was '" + object + "'");
+    }
+    
+    public void verifyDeployment(final PackageBuilder packageBuilder) throws DeployProcessException
+    {
+        final PackageBuilderErrors errors = packageBuilder.getErrors();
+        if (!errors.isEmpty())
+        {
+            throw new DeployProcessException("Errors detected, could not deploy process.", errors);
+        }
+    }
+    
+    @Override
+    public String toString()
+    {
+        return "DeployProcess [processLocation=" + processLocation + "]";
+    }
+    
+}


Property changes on: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcess.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcessException.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcessException.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcessException.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action.commands;
+
+import org.drools.compiler.PackageBuilderErrors;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+
+/**
+ * Exception that indicates a Drools RuleFlow deployment error.
+ * <p/>
+ * This exception class addes an array or error that occured when
+ * trying to deploy the rule flow.
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public final class DeployProcessException extends ActionProcessingException
+{
+    /**
+     * Serial Version Unique Identifier.
+     */
+    private static final long serialVersionUID = 1L;
+    
+    /**
+     * The errors that occurred during deployment.
+     */
+    private PackageBuilderErrors errors;
+
+    /**
+     * @param message   The exception message.
+     * @param errors    The errors that occurred during deployment.
+     */
+    public DeployProcessException(final String message, final PackageBuilderErrors errors)
+    {
+        super(message);
+        this.errors = errors;
+    }
+
+    /**
+     * @param message   The exception message.
+     * @param cause     The cause of the exception.
+     * @param errors    The errors that occurred during deployment.
+     */
+    public DeployProcessException(String message, Throwable cause, final PackageBuilderErrors errors)
+    {
+        super(message, cause);
+        this.errors = errors;
+    }
+    
+    /**
+     * Get the {@link PackageBuilderErrors} that occurred during deployment.
+     * 
+     * @return PackageBuilderErrors The errors that ocurred during deployment.
+     */
+    public PackageBuilderErrors getErrors()
+    {
+        return errors;
+    }
+}


Property changes on: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/DeployProcessException.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/StartProcess.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/StartProcess.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/StartProcess.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action.commands;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.StatefulSession;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * Command implementation that starts a Drools rule flow.
+ * <p/>
+ * 
+ * <h2> Start a process </h2>
+ * Example action configuration to start a process:
+ * <pre>{@code
+ * <actions>
+ *    <action name="create_new_process_instance" class="org.jboss.soa.esb.actions.ruleflow.BpmProcessor">
+ *       <property name="command" value="startProcess" />
+ *       <property name="processId" value="org.drools.sample.bpm_orchestration_flow_1"/>
+ *       <property name="bodyLocations" value="message"/>
+ *     </action>
+ * </actions>
+ * }</pre> 
+ * <lu>
+ * <li><i>commmand</i>  
+ *      Will cause this class to be used as the command. Mandatory</li>
+ * <li><i>processId</i> 
+ *      The process id to start. This must be the processId of a deploy process. This maps to the 'id' attribute of 
+ *      the process element in rule flow file(.rf). Mandatory</li>
+ * <li><i>bodyLocations</i> 
+ *      The named locations of the ESB Message object that should be passed along and made available to the Rule flow.
+ *      This can be a comma separated string of named elements. Optional and if not specified the default body location
+ *      will be passed. This would be the same as specifying 'org.jboss.soa.esb.message.defaultEntry' as the bodyLocations
+ *      value. 
+ *      </li>
+ * </lu>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class StartProcess extends AbstractCommand
+{
+    /**
+     * Name of this command.
+     */
+    public static final String NAME = "startProcess";
+    
+    /**
+     * The Drools Rule Flow process Id.
+     */
+    private String processId;
+    
+    /**
+     * The location of the process definition in the ESB Message body.
+     */
+    private String bodyLocations;
+
+    public StartProcess(ConfigTree config) throws ConfigurationException
+    {
+        super(config);
+        processId = config.getRequiredAttribute("processId");
+        bodyLocations = config.getAttribute("bodyLocations", Body.DEFAULT_LOCATION);
+    }
+
+    public void execute(final Message message, final StatefulSession session)
+    {
+        session.startProcess(processId, extractParameters(message));
+    }
+    
+    private Map<String, Object> extractParameters(final Message message)
+    {
+        Map<String, Object> parameters = new HashMap<String, Object>();
+        if (bodyLocations != null)
+        {
+            for (String payloadLocation : bodyLocations.split(","))
+            {
+                parameters.put(payloadLocation, message.getBody().get(payloadLocation));
+            }
+        }
+        else
+        {
+            parameters.put(Body.DEFAULT_LOCATION, message.getBody().get());
+        }
+        return parameters;
+    }
+    
+    @Override
+    public String toString()
+    {
+        return "StartProcess [processId=" + processId + ", bodyLocations=" + bodyLocations + "]";
+    }
+
+}


Property changes on: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/main/java/org/jboss/soa/esb/ruleflow/action/commands/StartProcess.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/ESBServiceWorkItemHandlerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/ESBServiceWorkItemHandlerUnitTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/ESBServiceWorkItemHandlerUnitTest.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow;
+
+import static org.jboss.soa.esb.ruleflow.DroolsConstants.BODY;
+import static org.jboss.soa.esb.ruleflow.DroolsConstants.CATEGORY_NAME;
+import static org.jboss.soa.esb.ruleflow.DroolsConstants.SERVICE_NAME;
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.StatefulSession;
+import org.drools.process.instance.WorkItemManager;
+import org.drools.process.instance.impl.DefaultWorkItemManagerFactory;
+import org.drools.process.instance.impl.WorkItemImpl;
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.ruleflow.ESBServiceWorkItemHandler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link ESBServiceWorkItemHandler}.
+ * <p/>
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class ESBServiceWorkItemHandlerUnitTest
+{
+    private String serviceCategory = "TestCategory";
+    private String serviceName = "TestService";
+    private MockCourier mockCourier;
+    private ESBServiceWorkItemHandler handler = new ESBServiceWorkItemHandler();
+    
+    @Test
+    public void test()
+    {
+        final String payload = "Sample payload string";
+        
+        WorkItemImpl workItem = new WorkItemBuilder().serviceCategory(serviceCategory).serviceName(serviceName).body(payload).build();
+        WorkItemManager workItemManager = createWorkItemManager();
+        
+        handler.executeWorkItem(workItem, workItemManager);
+        
+        assertEquals(payload, mockCourier.message.getBody().get());
+    }
+    
+    private WorkItemManager createWorkItemManager()
+    {
+        RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        StatefulSession session = ruleBase.newStatefulSession();
+        return new DefaultWorkItemManagerFactory().createWorkItemManager(session);
+    }
+    
+    @Before
+    public void setUp() throws Exception
+    {
+        MockCourierFactory.install();
+        MockRegistry.install();
+        mockCourier = new MockCourier(true, true);
+        MockRegistry.register(serviceCategory, serviceName, new EPR(new URI("jms://localhost:8080/queue1")), mockCourier);
+    }
+    
+    @After
+    public void tearDown() throws Exception
+    {
+        MockRegistry.uninstall();
+        MockCourierFactory.uninstall();
+    }
+    
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(ESBServiceWorkItemHandlerUnitTest.class);
+    }
+    
+    private static class WorkItemBuilder
+    {
+        private WorkItemImpl workItem;
+
+        public WorkItemBuilder()
+        {
+            workItem = new WorkItemImpl();
+        }
+            
+        public WorkItemBuilder serviceCategory(final String category)
+        {
+            workItem.setParameter(CATEGORY_NAME, category);
+            return this;
+        }
+        
+        public WorkItemBuilder serviceName(final String name)
+        {
+            workItem.setParameter(SERVICE_NAME, name);
+            return this;
+        }
+            
+        public WorkItemBuilder body(final Object payload)
+        {
+            workItem.setParameter(BODY, payload);
+            return this;
+        }
+            
+        public WorkItemImpl build()
+        {
+            return workItem;
+        }
+        
+    }
+
+
+}

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/action/BpmProcessorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/action/BpmProcessorUnitTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/java/org/jboss/soa/esb/ruleflow/action/BpmProcessorUnitTest.java	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware
+ * LLC, and individual contributors 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.ruleflow.action;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.jboss.internal.soa.esb.couriers.MockCourier;
+import org.jboss.internal.soa.esb.couriers.MockCourierFactory;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link BpmProcessor}
+ * <p/> 
+ * Configur files can be found in src/test/resources/ruleflow.
+ * 
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class BpmProcessorUnitTest
+{
+    /**
+     * This is the location of the payload. This is mapped in the ruleflow file.
+     */
+    private final static String MSG_LOCATION = Body.DEFAULT_LOCATION;
+    
+    /**
+     * Simple ruleflow with one call to the mock service.
+     */
+    private String processFileName = "/ruleflow/bpm-ruleflow.rf";
+    
+    /**
+     * Matches the id in processFileName.
+     */
+    private String processId = "test-ruleflow";
+    
+    /**
+     * Mock courier will be invoked by the ruleflow.
+     */
+    private MockCourier mockCourier;
+    
+    
+    @Test (expected = IllegalArgumentException.class)
+    public void shouldThrowIfRuleFlowIsInvalid() throws ConfigurationException, IOException, ActionProcessingException
+    {
+        deployProcess(processId, "/ruleflow/bpm-ruleflow-invalid.rf");
+    }
+    
+    @Test
+    public void deployProcess() throws ConfigurationException, IOException, ActionProcessingException
+    {
+        deployProcess(processId);
+    }
+    
+    @Test
+    public void verifyThatServiceWasInvoked() throws ConfigurationException, IOException, InterruptedException, ActionProcessingException
+    {
+        deployProcess(processId);
+        
+        final String payload = "TestPayload";
+        final Message message = MessageFactory.getInstance().getMessage();
+        message.getBody().add(payload);
+        
+        ConfigTree config = new ConfigBuilder("startProcess", processId).msgBodyLocations(MSG_LOCATION).build();
+        BpmProcessor processor = new BpmProcessor(config);
+        processor.process(message);
+        
+        assertEquals(payload, mockCourier.message.getBody().get());
+    }
+    
+    @Before
+    public void setUp() throws Exception
+    {
+        MockCourierFactory.install();
+        MockRegistry.install();
+        mockCourier = new MockCourier(true, true);
+        MockRegistry.register("TestCategory", "TestService1", new EPR(new URI("jms://localhost:8080/queue1")), mockCourier);
+    }
+    
+    @After
+    public void tearDown() throws Exception
+    {
+        MockRegistry.uninstall();
+        MockCourierFactory.uninstall();
+    }
+    
+    private void deployProcess(final String processId) throws ConfigurationException, IOException, ActionProcessingException
+    {
+        deployProcess(processId, processFileName);
+    }
+
+    private void deployProcess(final String processId, final String processFileName) throws ConfigurationException, IOException, ActionProcessingException
+    {
+        ConfigTree config = new ConfigBuilder("deployProcess", processId).build();
+        BpmProcessor processor = new BpmProcessor(config);
+        String processDef = FileUtil.readStream(getClass().getResourceAsStream(processFileName));
+        
+        Message message = MessageFactory.getInstance().getMessage();
+        message.getBody().add(processDef.getBytes());
+        processor.process(message);
+        
+    }
+
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(BpmProcessorUnitTest.class);
+    }
+    
+    private static class ConfigBuilder
+    {
+        private ConfigTree config;
+        
+        public ConfigBuilder(final String command, final String processId)
+        {
+            config = new ConfigTree("config");
+            config.setAttribute("command", command);
+            config.setAttribute("processId", processId);
+        }
+            
+        public ConfigBuilder msgBodyLocations(final String locations)
+        {
+            config.setAttribute("msgBodyLocations", locations);
+            return this;
+        }
+            
+        public ConfigBuilder message(final String message)
+        {
+            config.setAttribute("message", message);
+            return this;
+        }
+            
+        public ConfigTree build()
+        {
+            return config;
+        }
+        
+    }
+
+}

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/bpm-ruleflow-invalid.rf
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/bpm-ruleflow-invalid.rf	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/bpm-ruleflow-invalid.rf	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<process xmlns="http://drools.org/drools-5.0/process"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
+         type="RuleFlow" name="flow" id="test-ruleflow" package-name="org.jboss.soa.esb" version="1.0" >
+
+  <header>
+    <variables>
+      <variable name="org.jboss.soa.esb.message.defaultEntry" >
+        <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+      </variable>
+    </variables>
+  </header>
+
+  <nodes>
+    <workItem id="2" name="Service1" x="128" y="16" width="97" height="40" >
+      <work name="ESB Service" >
+        <parameter name="Body">
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+        <parameter name="ServiceName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>TestService1</value>
+        </parameter>
+        <parameter name="CategoryName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>TestCategory</value>
+        </parameter>
+      </work>
+      <mapping type="in" from="org.jboss.soa.esb.message.defaultEntry" to="Body" />
+      <mapping type="out" from="Result" to="org.jboss.soa.esb.message.defaultEntry" />
+      <onEntry>
+        <action type="expression" dialect="java" >System.out.println("Entering Service1");</action>
+      </onEntry>
+      <onExit>
+        <action type="expression" dialect="java" >System.out.println("Exiting Service1");</action>
+      </onExit>
+    </workItem>
+
+    <end id="6" name="End" x="646" y="16" width="80" height="40" />
+    <start id="1" name="Start" x="16" y="16" width="80" height="40" />
+  </nodes>
+    
+  <connections>
+    <connection from="2" to="2" />
+    <connection from="2" to="6" />
+  </connections>
+
+</process>

Added: labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/bpm-ruleflow.rf
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/bpm-ruleflow.rf	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleflow/product/services/jbrules/src/test/resources/ruleflow/bpm-ruleflow.rf	2009-01-27 16:12:40 UTC (rev 24950)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<process xmlns="http://drools.org/drools-5.0/process"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
+         type="RuleFlow" name="flow" id="test-ruleflow" package-name="org.jboss.soa.esb" version="1.0" >
+
+  <header>
+    <variables>
+      <variable name="org.jboss.soa.esb.message.defaultEntry" >
+        <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+      </variable>
+    </variables>
+  </header>
+
+  <nodes>
+    <workItem id="2" name="Service1" x="128" y="16" width="97" height="40" >
+      <work name="ESB Service" > <!-- Name of the WorkItemHandler registered in BpmProcessor. -->
+        <parameter name="Body">
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+        </parameter>
+        <parameter name="ServiceName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>TestService1</value>
+        </parameter>
+        <parameter name="CategoryName" >
+          <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+          <value>TestCategory</value>
+        </parameter>
+      </work>
+      <mapping type="in" from="org.jboss.soa.esb.message.defaultEntry" to="Body" />
+      <mapping type="out" from="Result" to="org.jboss.soa.esb.message.defaultEntry" />
+      <onEntry>
+        <action type="expression" dialect="java" >System.out.println("Entering Service1");</action>
+      </onEntry>
+      <onExit>
+        <action type="expression" dialect="java" >System.out.println("Exiting Service1");</action>
+      </onExit>
+    </workItem>
+
+    <end id="6" name="End" x="646" y="16" width="80" height="40" />
+    <start id="1" name="Start" x="16" y="16" width="80" height="40" />
+  </nodes>
+    
+  <connections>
+    <connection from="1" to="2" />
+    <connection from="2" to="6" />
+  </connections>
+
+</process>




More information about the jboss-svn-commits mailing list