[jboss-svn-commits] JBL Code SVN: r37931 - in labs/jbossesb/trunk/product: install and 28 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Mar 25 18:51:13 EDT 2012


Author: tcunning
Date: 2012-03-25 18:51:09 -0400 (Sun, 25 Mar 2012)
New Revision: 37931

Added:
   labs/jbossesb/trunk/product/services/jbpm5/
   labs/jbossesb/trunk/product/services/jbpm5/build.properties
   labs/jbossesb/trunk/product/services/jbpm5/build.xml
   labs/jbossesb/trunk/product/services/jbpm5/console/
   labs/jbossesb/trunk/product/services/jbpm5/console/conf/
   labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/
   labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/CustomWorkItemHandlers.conf
   labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/drools.session.conf
   labs/jbossesb/trunk/product/services/jbpm5/console/conf/jbpm.console.properties
   labs/jbossesb/trunk/product/services/jbpm5/console/hibernate.cfg.xml
   labs/jbossesb/trunk/product/services/jbpm5/console/jBPM-ds.xml
   labs/jbossesb/trunk/product/services/jbpm5/console/jboss-web.xml
   labs/jbossesb/trunk/product/services/jbpm5/console/persistence.xml
   labs/jbossesb/trunk/product/services/jbpm5/console/roles.properties
   labs/jbossesb/trunk/product/services/jbpm5/console/users.properties
   labs/jbossesb/trunk/product/services/jbpm5/ivy.xml
   labs/jbossesb/trunk/product/services/jbpm5/lib/
   labs/jbossesb/trunk/product/services/jbpm5/lib/ext/
   labs/jbossesb/trunk/product/services/jbpm5/lib/ext/build-time/
   labs/jbossesb/trunk/product/services/jbpm5/src/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/ProcessConstants.java
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/ProcessType.java
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/Bpm5Processor.java
   labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/BpmParameterMapper.java
   labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/
   labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/deployment.xml
   labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/jboss-esb.xml
   labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/jboss-scanning.xml
   labs/jbossesb/trunk/product/services/jbpm5/src/test/
   labs/jbossesb/trunk/product/services/jbpm5/src/test/java/
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/antlr-runtime-3.3.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-5.3.1.Final.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-5.3.1.Final.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-5.3.1.Final.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-jsr94-5.3.1.Final.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-templates-5.3.1.Final.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/knowledge-api-5.3.1.Final.jar
Removed:
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/antlr-runtime-3.1.3.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-5.2.1.Final.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-5.2.1.Final.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-5.2.1.Final.jar
   labs/jbossesb/trunk/product/services/jbrules/lib/ext/knowledge-api-5.2.1.Final.jar
Modified:
   labs/jbossesb/trunk/product/build-distr.xml
   labs/jbossesb/trunk/product/install/build.xml
   labs/jbossesb/trunk/product/install/jbpm-patch/build.xml
   labs/jbossesb/trunk/product/ivy.xml
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/ServiceRouteFilter.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/DefaultMessageHandler.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/MessageHandler.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/UdpGatewayListener.java
   labs/jbossesb/trunk/product/services/build.xml
   labs/jbossesb/trunk/product/services/jbrules/src/test/resources/testrules.pkg
Log:
JBESB-3761
Create a JBPM 5 BpmProcessor.


Modified: labs/jbossesb/trunk/product/build-distr.xml
===================================================================
--- labs/jbossesb/trunk/product/build-distr.xml	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/build-distr.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -161,8 +161,8 @@
         <copy todir="${build.lib.dir}">
             <fileset dir="build" includes="jbossesb.sar/**"/>
             <fileset dir="build" includes="jbossesb-registry.sar/**"/>
-        </copy>
-    </target>
-
-
-</project>
+        </copy>
+    </target>
+
+
+</project>

Modified: labs/jbossesb/trunk/product/install/build.xml
===================================================================
--- labs/jbossesb/trunk/product/install/build.xml	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/install/build.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -279,7 +279,12 @@
 	            <property name="org.jboss.esb.server.home" value="${org.jboss.esb.server.home}"/>
 	            <property name="org.jboss.esb.server.config" value="${org.jboss.esb.server.config}"/>
 	        </ant> 
-	
+<!--
+                <ant dir="jbpm-patch" target="install.jbpm5.console">
+                    <property name="org.jboss.esb.server.home" value="${org.jboss.esb.server.home}"/>
+                    <property name="org.jboss.esb.server.config" value="${org.jboss.esb.server.config}"/>
+                </ant>
+-->	
 	        <!-- licence file -->
 	        <copy file="${org.jboss.esb.dist.lib}/Licenses.txt" tofile="${org.jboss.esb.server.home}/EsbLicences.txt"/>
 	    </target>
@@ -476,8 +481,13 @@
 	    <antcall target="deployEsbModule">
 	    	<param name="esbModuleName" value="slsb.esb" />
 	    </antcall>
-	</target>
 
+        <!-- slsb.esb -->
+            <antcall target="deployEsbModule">
+                <param name="esbModuleName" value="jbpm5.esb" />
+            </antcall>
+        </target>
+
 	<target name="deployEsbModule">
 		<echo>Deploying ESB ${esbModuleName} to ${deploy.dir}</echo>
         
@@ -528,6 +538,7 @@
         <delete dir="${deploy.dir}/smooks.esb" quiet="true" />
         <delete dir="${deploy.dir}/spring.esb" quiet="true"/>
         <delete dir="${deploy.dir}/soap.esb" quiet="true"/>
+	<delete dir="${deploy.dir}/jbpm5.esb" quiet="true"/>
         <delete dir="${deploy.dir}/soapui-client.sar" quiet="true"/>
         <delete file="${deploy.dir}/contract.war" quiet="true"/>
         <delete file="${deploy.dir}/esb-console.war" quiet="true" />
@@ -702,4 +713,41 @@
 		<replace file="${profile.xml.file}" token=".*/(application|web|ejb-jar|" value=".*/(application|web|ejb-jar|jboss-esb|" />
 	</target>
 	
+        <target name="install.jbpm5.console">
+            <property name="jbpm5.console.dir" value="${server.dir}/deploy/jbpm-gwt-console-5.2.0.Final.war"/> 
+            <unzip src="${product.dir}/build/lib/jbpm-gwt-console-5.2.0.Final.war"
+		dest="${jbpm5.console.dir}"/>
+            <copy file="${product.dir}/services/jbpm5/console/hibernate.cfg.xml"
+                tofile="${jbpm5.console.dir}/WEB-INF/classes/hibernate.cfg.xml"
+                overwrite="true" />
+            <copy file="${product.dir}/services/jbpm5/console/persistence.xml"
+                tofile="${jbpm5.console.dir}/WEB-INF/classes/META-INF/persistence.xml"
+                overwrite="true" />
+            <!-- Fix for conflicting javassist jar -->
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/xml-apis-1.3.04.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-annotations-3.4.0.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-commons-annotations-3.1.0.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-core-3.3.2.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-entitymanager-3.4.0.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-tools-3.2.3.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/ejb3-persistence-1.0.2.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/javassist-3.14.0-GA.jar"/>
+            <!-- Other configuration like work item handlers -->
+            <copy todir="${jbpm5.console.dir}/WEB-INF/classes" overwrite="true">
+                <fileset dir="${product.dir}/services/jbpm5/console/conf"/>
+            </copy>
+            <!-- db configuration -->
+            <copy file="${product.dir}/services/jbpm5/console/jBPM-ds.xml"
+                tofile="${server.dir}/deploy/jBPM5-ds.xml"
+                overwrite="true" />
+            <!-- authentication configuration -->
+            <copy file="${product.dir}/services/jbpm5/console/users.properties"
+                tofile="${server.dir}/conf/props/jbpm5-users.properties"
+                overwrite="true" />
+            <copy file="${product.dir}/services/jbpm5/console/roles.properties"
+                tofile="${server.dir}/conf/props/jbpm5-roles.properties"
+                overwrite="true" />
+    </target>
+
+
 </project>

Modified: labs/jbossesb/trunk/product/install/jbpm-patch/build.xml
===================================================================
--- labs/jbossesb/trunk/product/install/jbpm-patch/build.xml	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/install/jbpm-patch/build.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -20,5 +20,48 @@
 			match="^&lt;policy&gt;\s*$\n" flags="m"/>
 	</target>
 
+        <target name="install.jbpm5.console">
+            <property name="jbpm5.console.dir" value="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/deploy/jbpm-gwt-console-5.2.0.Final.war"/> 
+            <unzip src="${product.dir}/build/lib/jbpm-gwt-console-5.2.0.Final.war"
+		dest="${jbpm5.console.dir}"/>
+            <copy file="${product.dir}/services/jbpm5/console/hibernate.cfg.xml"
+                tofile="${jbpm5.console.dir}/WEB-INF/classes/hibernate.cfg.xml"
+                overwrite="true" />
+            <copy file="${product.dir}/services/jbpm5/console/persistence.xml"
+                tofile="${jbpm5.console.dir}/WEB-INF/classes/META-INF/persistence.xml"
+                overwrite="true" />
+            <!-- Fix for conflicting javassist jar -->
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/xml-apis-1.3.04.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-annotations-3.4.0.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-commons-annotations-3.1.0.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-core-3.3.2.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-entitymanager-3.4.0.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/hibernate-tools-3.2.3.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/ejb3-persistence-1.0.2.GA.jar"/>
+            <delete file="${jbpm5.console.dir}/WEB-INF/lib/javassist-3.14.0-GA.jar"/>
+            <!-- Other configuration like work item handlers -->
+            <copy todir="${jbpm5.console.dir}/WEB-INF/classes" overwrite="true">
+                <fileset dir="${product.dir}/services/jbpm5/console/conf"/>
+            </copy>
 
+            <!-- db configuration -->
+            <copy file="${product.dir}/services/jbpm5/console/jBPM-ds.xml"
+                tofile="${server.dir}/deploy/jBPM5-ds.xml"
+                overwrite="true" />
+
+	    <!-- finalName config -->
+            <copy file="${product.dir}/services/jbpm5/console/jboss-web.xml"
+                tofile="${jbpm5.console.dir}/WEB-INF/jboss-web.xml"
+                overwrite="true" />
+
+
+            <!-- authentication configuration -->
+            <copy file="${product.dir}/services/jbpm5/console/users.properties"
+                tofile="${server.dir}/conf/props/jbpm5-users.properties"
+                overwrite="true" />
+            <copy file="${product.dir}/services/jbpm5/console/roles.properties"
+                tofile="${server.dir}/conf/props/jbpm5-roles.properties"
+                overwrite="true" />
+    </target>
+
 </project>

Modified: labs/jbossesb/trunk/product/ivy.xml
===================================================================
--- labs/jbossesb/trunk/product/ivy.xml	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/ivy.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -9,7 +9,10 @@
 	<dependency org="commons-net" name="commons-net" rev="2.0"/>	
 	
 		<!-- Mina dependencies -->
-        <dependency org="org.apache.mina" name="mina-core" rev="1.1.7"/>
+        <dependency org="org.apache.mina" name="mina-core" rev="2.0.1">
+             <artifact name="mina-core" type="jar"/>
+        </dependency>
+
         <dependency org="org.apache.mina" name="mina-filter-ssl" rev="1.1.7"/>
         <dependency org="org.slf4j" name="slf4j-api" rev="1.4.3"/>
         <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.4.3"/>
@@ -181,6 +184,13 @@
         <dependency org="com.envoisolutions.sxc" name="sxc-xpath" rev="0.7.3">
             <exclude org="com.sun.xml.bind" module="jaxb-xjc"/>
         </dependency>
-        
+
+<!--
+        <dependency org="org.jbpm" name="jbpm-gwt-console" rev="5.2.0.Final"
+		transitive="false">
+             <artifact name="jbpm-gwt-console" type="war"/>
+        </dependency>
+-->   
+     
     </dependencies>
 </ivy-module>

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/ServiceRouteFilter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/ServiceRouteFilter.java	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/ServiceRouteFilter.java	2012-03-25 22:51:09 UTC (rev 37931)
@@ -26,7 +26,6 @@
 import java.util.Map;
 
 import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.common.ModulePropertyManager;
 import org.jboss.soa.esb.couriers.CourierException;
 import org.jboss.soa.esb.filter.FilterManager;
 import org.jboss.soa.esb.filter.InputOutputFilter;

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/DefaultMessageHandler.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/DefaultMessageHandler.java	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/DefaultMessageHandler.java	2012-03-25 22:51:09 UTC (rev 37931)
@@ -19,12 +19,11 @@
  */
 package org.jboss.soa.esb.listeners.gateway.mina;
 
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.IoHandlerAdapter;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.common.TransportType;
-import org.apache.mina.transport.socket.nio.SocketSessionConfig;
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IdleStatus;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.transport.socket.SocketSessionConfig;
 import org.jboss.soa.esb.client.ServiceInvoker;
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.message.format.MessageFactory;
@@ -63,11 +62,15 @@
      */
     public void sessionCreated(final IoSession session)
     {
-        if (session.getTransportType() == TransportType.SOCKET)
+        if (session.getConfig() instanceof SocketSessionConfig)
         {
             ((SocketSessionConfig) session.getConfig()).setReceiveBufferSize(2048);
         }
-        session.setIdleTime(IdleStatus.BOTH_IDLE, 10);
+        try { 
+        	this.sessionIdle(session, IdleStatus.BOTH_IDLE);
+        } catch (Exception e) {
+        	throw new RuntimeException(e);
+        }
     }
 
     public void exceptionCaught(final IoSession session, final Throwable cause)
@@ -84,13 +87,13 @@
      */
     public void messageReceived(final IoSession session, final Object message) throws Exception
     {
-        if (!(message instanceof ByteBuffer))
+        if (!(message instanceof IoBuffer))
         {
             return;
         }
-
-        final ByteBuffer byteBuffer = (ByteBuffer) message;
-        final byte[] bytes = new byte[byteBuffer.remaining()];
+        
+        final IoBuffer byteBuffer = (IoBuffer) message;
+        final byte[] bytes = new byte[byteBuffer.limit()];
         byteBuffer.get(bytes);
         
         final Message esbMessage = MessageFactory.getInstance().getMessage();

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/MessageHandler.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/MessageHandler.java	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/MessageHandler.java	2012-03-25 22:51:09 UTC (rev 37931)
@@ -19,7 +19,7 @@
  */
 package org.jboss.soa.esb.listeners.gateway.mina;
 
-import org.apache.mina.common.IoHandler;
+import org.apache.mina.core.service.IoHandler;
 import org.jboss.soa.esb.client.ServiceInvoker;
 
 /**

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/UdpGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/UdpGatewayListener.java	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/mina/UdpGatewayListener.java	2012-03-25 22:51:09 UTC (rev 37931)
@@ -22,9 +22,10 @@
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import org.apache.log4j.Logger;
-import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.transport.socket.nio.DatagramAcceptor;
-import org.apache.mina.transport.socket.nio.DatagramSessionConfig;
+import org.apache.mina.core.service.IoAcceptor;
+import org.apache.mina.transport.socket.DatagramAcceptor;
+import org.apache.mina.transport.socket.nio.NioDatagramAcceptor;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.client.ServiceInvoker;
 import org.jboss.soa.esb.helpers.ConfigTree;
@@ -115,12 +116,12 @@
         final ServiceInvoker serviceInvoker = createServiceInvoker(serviceCategory, serviceName);
         messageHandler.setServiceInvoker(serviceInvoker);
         
-        datagramAcceptor = new DatagramAcceptor(); 
-        ((DatagramSessionConfig) datagramAcceptor.getDefaultConfig().getSessionConfig()).setReuseAddress(true);
+        datagramAcceptor = new NioDatagramAcceptor(); 
         
         try
         {
-            datagramAcceptor.bind(socketAddress, messageHandler);
+        	datagramAcceptor.setHandler(messageHandler);
+            datagramAcceptor.bind(socketAddress);
         } 
         catch (final IOException e)
         {

Modified: labs/jbossesb/trunk/product/services/build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/build.xml	2012-03-23 16:03:47 UTC (rev 37930)
+++ labs/jbossesb/trunk/product/services/build.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -4,9 +4,10 @@
     
     <target name="esb">
         <ant dir="jbossesb" target="dist"/>
-		<ant dir="jbpm" target="dist"/>
-		<ant dir="jbrules" target="dist"/>
-		<ant dir="smooks" target="dist"/>
+	<ant dir="jbpm" target="dist"/>
+        <ant dir="jbpm5" target="dist"/>
+	<ant dir="jbrules" target="dist"/>
+	<ant dir="smooks" target="dist"/>
         <ant dir="soapui-client" target="sar"/>
         <ant dir="soap" target="dist"/>
         <ant dir="spring" target="dist"/>
@@ -15,26 +16,28 @@
 
     <target name="clean">
         <ant dir="jbossesb" target="clean"/>
-		<ant dir="jbpm" target="clean"/>
-		<ant dir="jbpm/ant-task" target="clean"/>
-		<ant dir="jbrules" target="clean"/>
-		<ant dir="smooks" target="clean"/>
+	<ant dir="jbpm" target="clean"/>
+	<ant dir="jbpm/ant-task" target="clean"/>
+        <ant dir="jbpm5" target="clean"/>
+	<ant dir="jbrules" target="clean"/>
+	<ant dir="smooks" target="clean"/>
         <ant dir="soapui-client" target="clean"/>
-		<ant dir="soap" target="clean"/>
+	<ant dir="soap" target="clean"/>
         <ant dir="spring" target="clean"/>
     	<ant dir="slsb" target="clean"/>
     </target>
 
     <target name="test">
-		<ant dir="jbossesb" target="test"/>
-		<ant dir="jbpm" target="test"/> 
-		<ant dir="jbrules" target="test"/>
-		<ant dir="smooks" target="test"/>
+	<ant dir="jbossesb" target="test"/>
+	<ant dir="jbpm" target="test"/> 
+        <ant dir="jbpm5" target="test"/>
+	<ant dir="jbrules" target="test"/>
+	<ant dir="smooks" target="test"/>
 		
-                <ant dir="soapui-client" target="test"/>
-		<ant dir="soap" target="test"/>
-		<ant dir="spring" target="test"/>
-    	        <ant dir="slsb" target="test"/>
+        <ant dir="soapui-client" target="test"/>
+	<ant dir="soap" target="test"/>
+	<ant dir="spring" target="test"/>
+    	<ant dir="slsb" target="test"/>
     </target>
 	
 </project>

Added: labs/jbossesb/trunk/product/services/jbpm5/build.properties
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/build.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/build.properties	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,5 @@
+esb.build.dir=../../build
+esb.product.lib.dir=../../build/jbossesb/lib
+esb.main.lib=../../build/lib
+esb.product.lib.ext=../../lib/ext
+services.base.build=../base-project-build.xml

Added: labs/jbossesb/trunk/product/services/jbpm5/build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/build.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/build.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,12 @@
+<project name="jbpm5" default="test" basedir=".">
+	
+	<property file="build.properties"/>
+	<!-- Import the base Ant build script... -->
+	<import file="${services.base.build}"/>
+	
+	<target name="service-prepare">
+	</target>
+	
+	<target name="test" depends="base.test"/>
+
+</project>

Added: labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/CustomWorkItemHandlers.conf
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/CustomWorkItemHandlers.conf	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/CustomWorkItemHandlers.conf	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,3 @@
+[
+  "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
+]

Added: labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/drools.session.conf
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/drools.session.conf	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/conf/META-INF/drools.session.conf	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1 @@
+drools.workItemHandlers = CustomWorkItemHandlers.conf

Added: labs/jbossesb/trunk/product/services/jbpm5/console/conf/jbpm.console.properties
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/conf/jbpm.console.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/conf/jbpm.console.properties	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,13 @@
+jbpm.console.server.host=localhost
+jbpm.console.server.port=8080
+jbpm.console.task.service.host=127.0.0.1
+jbpm.console.task.service.port=9123
+jbpm.console.directory=
+guvnor.protocol=http
+guvnor.host=localhost:8080
+guvnor.subdomain=drools-guvnor
+guvnor.usr=admin
+guvnor.pwd=admin
+guvnor.packages=
+guvnor.connect.timeout=10000
+guvnor.read.timeout=10000

Added: labs/jbossesb/trunk/product/services/jbpm5/console/hibernate.cfg.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/hibernate.cfg.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/hibernate.cfg.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,39 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+
+    <session-factory>
+
+        <!-- Database connection settings -->
+        <property name="connection.driver_class">org.h2.Driver</property>
+        <property name="connection.url">jdbc:h2:tcp://localhost/~/test</property>
+        <!--property name="connection.url">jdbc:h2:file:/NotBackedUp/data/mydb</property-->
+        <property name="connection.username">sa</property>
+        <property name="connection.password"></property>
+
+        <!-- JDBC connection pool (use the built-in) -->
+        <property name="connection.pool_size">1</property>
+
+        <!-- SQL dialect -->
+        <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+
+        <!-- Enable Hibernate's automatic session context management -->
+        <property name="current_session_context_class">thread</property>
+
+        <!-- Disable the second-level cache  -->
+        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
+
+        <!-- Echo all executed SQL to stdout -->
+        <property name="show_sql">false</property>
+
+        <!-- Drop and re-create the database schema on startup? -->
+        <property name="hbm2ddl.auto">create</property>
+
+        <mapping resource="AuditLog.hbm.xml"/>
+
+    </session-factory>
+
+</hibernate-configuration>

Added: labs/jbossesb/trunk/product/services/jbpm5/console/jBPM-ds.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/jBPM-ds.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/jBPM-ds.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources>
+  <local-tx-datasource>
+    <jndi-name>jboss/datasources/jbpmDS</jndi-name>
+    <connection-url>jdbc:h2:tcp://localhost/~/test</connection-url>
+    <!--connection-url>jdbc:h2:mem:mydb</connection-url-->
+    <driver-class>org.h2.jdbcx.JdbcDataSource</driver-class>
+    <user-name>sa</user-name>
+    <password></password>
+  </local-tx-datasource>
+</datasources>

Added: labs/jbossesb/trunk/product/services/jbpm5/console/jboss-web.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/jboss-web.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/jboss-web.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss-web PUBLIC
+  "-//JBoss//DTD Web Application 2.4//EN"
+  "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
+
+<jboss-web>
+
+   <security-domain>java:/jaas/jbpm5-console</security-domain>
+
+   <context-root>jbpm5-console</context-root>
+
+   <!--resource-ref>
+     <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
+     <jndi-name>java:/JbpmDS</jndi-name>
+   </resource-ref>
+   -->
+
+</jboss-web>

Added: labs/jbossesb/trunk/product/services/jbpm5/console/persistence.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/persistence.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/persistence.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<persistence version="1.0"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+                                 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
+                                 http://java.sun.com/xml/ns/persistence/orm 
+                                 http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
+             xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xmlns="http://java.sun.com/xml/ns/persistence">
+
+  <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
+    <provider>org.hibernate.ejb.HibernatePersistence</provider>
+    <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>       
+    <mapping-file>META-INF/JBPMorm.xml</mapping-file>
+    <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
+    <class>org.drools.persistence.info.SessionInfo</class>
+    <class>org.drools.persistence.info.WorkItemInfo</class>
+    <properties>
+      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>	        
+      <property name="hibernate.max_fetch_depth" value="3"/>
+      <property name="hibernate.hbm2ddl.auto" value="create" />
+      <property name="hibernate.show_sql" value="false" />
+      <!-- for AS7 -->	
+      <property name="hibernate.transaction.manager_lookup_class" value="org.jbpm.integration.console.JBPMTransactionManager" />
+      <!-- for AS5 -->
+      <!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> -->	
+      <!--property name="hibernate.transaction.manager_lookup_class" value="org.jbpm.integration.console.JBPMTransactionManager" /-->
+    </properties>        
+  </persistence-unit>
+    
+  <!--persistence-unit name="org.jbpm.task" transaction-type="JTA">
+    <provider>org.hibernate.ejb.HibernatePersistence</provider>      
+    <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>       
+    <mapping-file>META-INF/Taskorm.xml</mapping-file>
+    <class>org.jbpm.task.Attachment</class>
+    <class>org.jbpm.task.Content</class>
+    <class>org.jbpm.task.BooleanExpression</class>
+    <class>org.jbpm.task.Comment</class>
+    <class>org.jbpm.task.Deadline</class>
+    <class>org.jbpm.task.Comment</class>
+    <class>org.jbpm.task.Deadline</class>
+    <class>org.jbpm.task.Delegation</class>
+    <class>org.jbpm.task.Escalation</class>
+    <class>org.jbpm.task.Group</class>
+    <class>org.jbpm.task.I18NText</class>
+    <class>org.jbpm.task.Notification</class>
+    <class>org.jbpm.task.EmailNotification</class>
+    <class>org.jbpm.task.EmailNotificationHeader</class>
+    <class>org.jbpm.task.PeopleAssignments</class>
+    <class>org.jbpm.task.Reassignment</class>
+    <class>org.jbpm.task.Status</class>
+    <class>org.jbpm.task.Task</class>
+    <class>org.jbpm.task.TaskData</class>
+    <class>org.jbpm.task.SubTasksStrategy</class>
+    <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
+    <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
+    <class>org.jbpm.task.User</class>
+    <properties>
+      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+      <property name="hibernate.max_fetch_depth" value="3"/>
+      <property name="hibernate.hbm2ddl.auto" value="create" />
+      <property name="hibernate.show_sql" value="false" />
+      <!-property name="hibernate.transaction.manager_lookup_class" value="org.jbpm.integration.console.JBPMTransactionManager" /->
+      <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+    </properties>
+  </persistence-unit-->
+
+</persistence>

Added: labs/jbossesb/trunk/product/services/jbpm5/console/roles.properties
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/roles.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/roles.properties	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,5 @@
+admin=admin,manager,user
+krisv=admin,manager,user
+john=admin,manager,user,PM
+mary=admin,manager,user,HR
+sales-rep=admin,manager,user,sales
\ No newline at end of file

Added: labs/jbossesb/trunk/product/services/jbpm5/console/users.properties
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/console/users.properties	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/console/users.properties	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,5 @@
+admin=admin
+krisv=krisv
+john=john
+mary=mary
+sales-rep=sales-rep
\ No newline at end of file

Added: labs/jbossesb/trunk/product/services/jbpm5/ivy.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/ivy.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/ivy.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,15 @@
+<ivy-module version="2.0">
+    <info organisation="org.jboss" module="jbossesb"/>    
+    <dependencies>
+
+	<dependency org="org.jbpm" name="jbpm-bpmn2" rev="5.2.0.Final" transitive="false"/>
+	<dependency org="org.jbpm" name="jbpm-human-task" rev="5.2.0.Final" transitive="false"/>
+        <dependency org="org.jbpm" name="jbpm-flow-builder" rev="5.2.0.Final" transitive="false"/>
+        <dependency org="org.jbpm" name="jbpm-flow" rev="5.2.0.Final" transitive
+="false"/>
+
+
+        <dependency org="org.drools" name="drools-core" rev="5.3.1.Final" transitive="false"/>
+	<dependency org="org.drools" name="knowledge-api" rev="5.3.1.Final" transitive="false"/>
+    </dependencies>
+</ivy-module>

Added: labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/ProcessConstants.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/ProcessConstants.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/ProcessConstants.java	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.service.jbpm5.model;
+
+/**
+ * Constants used in the BPM5Processor.
+ *  
+ * @author <a href="mailto:tcunning at redhat.com">tcunning at redhat.com</a>
+ * @since Version 4.11
+ */
+public class ProcessConstants {
+	
+	/* Process Types */
+	public static final String START_PROCESS_TYPE = "startProcess";
+    public static final String SIGNAL_EVENT_TYPE = "signalEvent";
+    public static final String ABORT_PROCESS_INSTANCE_TYPE = "abortProcessInstance";
+
+	/* Events */
+    public static final String PROCESS_EVENT_TYPE = "processEventType";
+    public static final String PROCESS_EVENT = "processEvent";
+    
+    
+    /* Tags */
+    public static final String PROCESS_DEFINITION_NAME = "process-definition-name";
+    public static final String PROCESS_ID = "process-id";
+    public static final String PROCESS_COMMAND = "command";
+    public static final String PROCESS_ACTION = "process-action";
+    public static final String ESB_TO_BPM_PARAMS = "esbToBpmParams";
+    
+    public static final String PROCESS_INSTANCE_ID = "processInstanceId";
+}

Added: labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/ProcessType.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/ProcessType.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/service/jbpm5/model/ProcessType.java	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.service.jbpm5.model;
+
+/**
+ * Process type enum.
+ *  
+ * @author <a href="mailto:tcunning at redhat.com">tcunning at redhat.com</a>
+ * @since Version 4.11
+ */
+public enum ProcessType {
+	/** startProcess . */
+    START_PROCESS(ProcessConstants.START_PROCESS_TYPE),
+    /** signalEvent . */
+    SIGNAL_EVENT(ProcessConstants.SIGNAL_EVENT_TYPE),
+    /** abortProcessInstance . */
+    ABORT_PROCESS_INSTANCE(ProcessConstants.ABORT_PROCESS_INSTANCE_TYPE);
+
+    private final String _action;
+        
+    /**
+     * Constructs a new ProcessActionType with the specified action.
+     * @param action the action
+     */
+    ProcessType(String action) {
+        _action = action;
+    }
+
+    /**
+     * Gets the action.
+     * @return the action
+     */
+    public String action() {
+        return _action;
+    }
+
+    /**
+     * Gets the ProcessActionType matching the specified action.
+     * @param action the action
+     * @return the matching ProcessActionType
+     */
+    public static ProcessType fromAction(String action) {
+        for (ProcessType pat : values()) {
+            if (pat.action().equals(action)) {
+                return pat;
+            }
+        }
+        return null;
+    }
+
+}

Added: labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/Bpm5Processor.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/Bpm5Processor.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/Bpm5Processor.java	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,299 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.jbpm5.actions;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.crypto.SealedObject;
+
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+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.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.security.SecurityContext;
+import org.jboss.soa.esb.services.security.SecurityService;
+import org.jboss.soa.esb.services.security.auth.AuthenticationRequestImpl;
+
+import org.jboss.soa.esb.service.jbpm5.model.ProcessType;
+import org.jboss.soa.esb.service.jbpm5.model.ProcessConstants;
+import org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler;
+
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.agent.KnowledgeAgent;
+import org.drools.base.MapGlobalResolver;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderFactory;
+
+import org.drools.builder.ResourceType;
+import org.drools.impl.EnvironmentFactory;
+import org.drools.io.ResourceFactory;
+import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
+
+import org.drools.runtime.Environment;
+import org.drools.runtime.EnvironmentName;
+import org.drools.runtime.KnowledgeSessionConfiguration;
+import org.drools.runtime.conf.ClockTypeOption;
+import org.drools.runtime.process.ProcessInstance;
+import org.drools.runtime.StatefulKnowledgeSession;
+
+/**
+ * The Bpm5Processor processes an action on a single JBPM process.
+ *  
+ * @author <a href="mailto:tcunning at redhat.com">tcunning at redhat.com</a>
+ * @since Version 4.11
+ */
+public class Bpm5Processor implements ActionLifecycle {
+    protected ConfigTree configTree;
+    private static Logger logger = Logger.getLogger(Bpm5Processor.class);
+    
+    private String processDefName;
+    private String processId;
+    private String processAction;
+    
+    KnowledgeBuilder kbuilder;
+    KnowledgeBase kbase;
+    private KnowledgeAgent kagent;
+    private Environment kenvironment;
+    private KnowledgeSessionConfiguration ksessionConfig;
+
+    private StatefulKnowledgeSession ksession;
+    private KnowledgeRuntimeLogger klogger;
+
+    private CommandBasedWSHumanTaskHandler khandler;
+    
+    public void initialise() throws ActionLifecycleException {
+    }
+
+    public void destroy() throws ActionLifecycleException {
+        if (ksession != null) {
+            try {
+                ksession.halt();
+            } finally {
+                try {
+                    ksession.dispose();
+                } finally {
+                    ksession = null;
+                    if (klogger != null) {
+                        try {
+                            klogger.close();
+                        } finally {
+                            klogger = null;
+                        }
+                    }
+                }
+            }
+        }
+
+        kbase = null;
+        
+        processId = null;
+        if (kagent != null) {
+            try {
+                kagent.dispose();
+            } finally {
+                kagent = null;
+            }
+        }
+    }
+    
+    
+    /**
+     * Verify that the process action matches one of the valid process action values.
+     * @param processAction process action
+     * @throws ConfigurationException 
+     */
+    public void verifyProcessAction(String processAction) throws ConfigurationException 
+    {
+    	if ((ProcessConstants.SIGNAL_EVENT_TYPE.equals(processAction)) ||
+    		(ProcessConstants.ABORT_PROCESS_INSTANCE_TYPE.equals(processAction)) ||
+    		(ProcessConstants.START_PROCESS_TYPE.equals(processAction))) {
+    		return;
+    	} else {
+    		throw new ConfigurationException("Process action " + processAction +
+    			"does not match valid process actions (" + 
+    			ProcessConstants.START_PROCESS_TYPE + ", " +
+    			ProcessConstants.SIGNAL_EVENT_TYPE + ", " +
+    			ProcessConstants.ABORT_PROCESS_INSTANCE_TYPE + ")");
+    	}
+    			
+    }
+    
+	public Bpm5Processor(ConfigTree configTree) throws ConfigurationException
+	{
+		this.configTree = configTree;
+		this.processDefName = configTree.getRequiredAttribute(ProcessConstants.PROCESS_DEFINITION_NAME);
+		this.processId = configTree.getRequiredAttribute(ProcessConstants.PROCESS_ID);
+		
+		// verify the process action
+		this.processAction = configTree.getRequiredAttribute(ProcessConstants.PROCESS_ACTION);
+		verifyProcessAction(processAction);
+		
+		KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+		kbuilder.add(ResourceFactory.newClassPathResource(processDefName), ResourceType.BPMN2);
+		kbase = kbuilder.newKnowledgeBase();
+		ksessionConfig = getSessionConfiguration(new Properties());
+		kenvironment = getEnvironment(new HashMap<String, Object>());
+		ksession = kbase.newStatefulKnowledgeSession(ksessionConfig, kenvironment);
+		klogger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);
+		
+		khandler = new CommandBasedWSHumanTaskHandler(ksession);
+		ksession.getWorkItemManager().registerWorkItemHandler("Human Task", khandler);
+		khandler.connect();
+	}
+
+	public Long getProcessInstanceId(Message msg) {
+		Long id = null;
+		try {
+			id = (Long)msg.getContext().getContext(ProcessConstants.PROCESS_INSTANCE_ID);
+		} catch (Exception e) {
+		}
+		return id;
+	}
+	
+	public Message process(Message message) throws ConfigurationException
+	{
+		// Add security context to message context.
+		addSecurityContext(message);
+		// Add authentication request context to message context.
+		addAuthenticationRequest(message);
+		
+        Long processInstanceId = null;
+        ProcessInstance processInstance = null;
+				
+		ProcessType processType = ProcessType.fromAction((String)processAction);
+		switch (processType) {
+			case START_PROCESS:
+				logger.error(ProcessConstants.START_PROCESS_TYPE);
+				
+				Map<String, Object> params = BpmParameterMapper.mapPropertiesToParams(message, configTree);
+				if (params.size() > 0) {
+                    processInstance = ksession.startProcess(processId, params);
+                } else {
+                    processInstance = ksession.startProcess(processId);
+                }
+                processInstanceId = Long.valueOf(processInstance.getId());				
+				break;
+		    case SIGNAL_EVENT:
+				logger.error(ProcessConstants.SIGNAL_EVENT_TYPE);
+                String processEventType = (String) message.getProperties().getProperty(ProcessConstants.PROCESS_EVENT_TYPE);
+                Object processEvent = message.getProperties().getProperty(ProcessConstants.PROCESS_EVENT);
+                processInstanceId = getProcessInstanceId(message);
+                if (processInstanceId != null) {
+                    ksession.signalEvent(processEventType, processEvent, processInstanceId.longValue());
+                } else {
+                    throw new ConfigurationException(ProcessConstants.SIGNAL_EVENT_TYPE 
+                    		+ ": tried to abort and process id was null");
+                }
+                break;
+	        case ABORT_PROCESS_INSTANCE:
+				logger.error(ProcessConstants.ABORT_PROCESS_INSTANCE_TYPE);
+                processInstanceId = getProcessInstanceId(message);
+                if (processInstanceId != null) {
+                    ksession.abortProcessInstance(processInstanceId.longValue());
+                } else {
+                    throw new ConfigurationException(ProcessConstants.ABORT_PROCESS_INSTANCE_TYPE 
+                    		+ ": tried to abort and process id was null");
+                }
+
+				break;
+			}
+  
+		message.getContext().setContext(ProcessConstants.PROCESS_INSTANCE_ID, 
+				processInstanceId);
+
+		if (processInstance == null) {
+			processInstance = ksession.getProcessInstance(processInstanceId.longValue());
+        }
+        
+		return message;
+	}
+	
+	/**
+	 * Adds the current security context to the passed in message.
+	 * The context is added, if set, to the message context keyed by {@link SecurityService#CONTEXT}.
+	 *
+	 * @param message The ESB message object.
+	 */
+    final void addSecurityContext(Message message)
+    {
+        AssertArgument.isNotNull(message, "message");
+
+        SealedObject securityContext = SecurityContext.getSecurityContext();
+        if (securityContext != null)
+        {
+            message.getContext().setContext(SecurityService.CONTEXT, securityContext);
+        }
+    }
+
+	/**
+	 * Adds the authentication request to the passed in message.
+	 * The context is added, if set, to the message context keyed by {@link SecurityService#AUTH_REQUEST}.
+	 *
+	 * @param message The ESB message object.
+	 */
+    final void addAuthenticationRequest(Message message)
+    {
+        AssertArgument.isNotNull(message, "message");
+
+        byte[] encryptedAuthRequest = AuthenticationRequestImpl.getEncryptedAuthRequest();
+        if (encryptedAuthRequest != null)
+        {
+            message.getContext().setContext(SecurityService.AUTH_REQUEST, encryptedAuthRequest);
+        }
+    }
+    
+    /** 
+     * Return a knowledge session configuration.
+     * @param props
+     * @return
+     */
+    public static KnowledgeSessionConfiguration getSessionConfiguration(Properties props) {
+        KnowledgeSessionConfiguration ksess = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(props);
+        ksess.setOption(ClockTypeOption.get(org.drools.ClockType.REALTIME_CLOCK.getId()));
+        return ksess;
+    }
+    
+    /**
+     * Returns an environment.
+     * @param overrides
+     * @return
+     */
+    public static Environment getEnvironment(Map<String, Object> overrides) {
+        Environment env = EnvironmentFactory.newEnvironment();
+        // set the default global resolver
+        env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
+        // apply any overrides
+        if (overrides != null) {
+            for (Map.Entry<String, Object> entry : overrides.entrySet()) {
+                env.set(entry.getKey(), entry.getValue());
+            }
+        }
+        return env;
+    }
+}

Added: labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/BpmParameterMapper.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/BpmParameterMapper.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/src/main/java/org/jboss/soa/esb/services/jbpm5/actions/BpmParameterMapper.java	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.services.jbpm5.actions;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * Maps BPM parameters from either values in the configuration or ESB
+ * message properties.
+ *  
+ * @author <a href="mailto:tcunning at redhat.com">tcunning at redhat.com</a>
+ * @since Version 4.11
+ */
+public class BpmParameterMapper {
+	private static final String MAPPING_TAG = "mapping";
+	
+	private static final String ESB_TAG = "esb";
+	private static final String BPM_TAG = "bpm";
+	private static final String VALUE_TAG = "value";
+	
+	/**
+	 * Map ESB properties to BPM properties.    If a value attribute exists,
+	 * use the value attribute as the value of the BPM property.    If no
+	 * value attribute exists, map the value of the ESB message property to the
+	 * BPM property.
+	 * @param msg message
+	 * @param tree ConfigTree
+	 * @return 
+	 */
+	public static Map<String,Object> mapPropertiesToParams(Message msg, 
+			ConfigTree tree) {
+		
+		HashMap<String,String> mappingsOfParams = new HashMap<String, String>();
+		Map<String, Object> params = new HashMap<String,Object>();
+		
+		ConfigTree[] mappings = tree.getChildren(MAPPING_TAG);
+		for (int i = 0; i < mappings.length; i++) {
+			ConfigTree mapTree = mappings[i];
+			String value = mapTree.getAttribute(VALUE_TAG);
+
+			// If value isn't set, include the esb->bpm mapping in the mappings we
+			// check message properties for.    If value is set, use it instead.
+			if (value == null) {
+				mappingsOfParams.put(mapTree.getAttribute(ESB_TAG), mapTree.getAttribute(BPM_TAG));
+			} else {
+				params.put(mapTree.getAttribute(BPM_TAG), value);
+			}
+		}
+
+		// Now that we have the mapping, add the bpm key and the message property value
+		for (String esb : mappingsOfParams.keySet()) {
+			params.put(mappingsOfParams.get(esb), msg.getProperties().getProperty(esb));
+		}
+		
+		return params;
+	}
+}

Added: labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/deployment.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/deployment.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+  <depends>jboss.esb:deployment=jbossesb.esb</depends>
+</jbossesb-deployment>

Added: labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/jboss-esb.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/jboss-esb.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,6 @@
+<?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">
+     <!--  
+     		jbossesb internal services 
+     -->
+</jbossesb>

Added: labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/jboss-scanning.xml
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/jboss-scanning.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/jbpm5/src/main/resources/META-INF/jboss-scanning.xml	2012-03-25 22:51:09 UTC (rev 37931)
@@ -0,0 +1,3 @@
+<scanning xmlns="urn:jboss:scanning:1.0">
+	<!-- prevent scanning for annotations -->
+</scanning>

Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/antlr-runtime-3.1.3.jar
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/product/services/jbrules/lib/ext/antlr-runtime-3.3.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/jbrules/lib/ext/antlr-runtime-3.3.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-5.2.1.Final.jar
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-5.3.1.Final.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-compiler-5.3.1.Final.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-5.2.1.Final.jar
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-5.3.1.Final.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-core-5.3.1.Final.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-5.2.1.Final.jar
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-5.3.1.Final.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-decisiontables-5.3.1.Final.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-jsr94-5.3.1.Final.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-jsr94-5.3.1.Final.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-templates-5.3.1.Final.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/jbrules/lib/ext/drools-templates-5.3.1.Final.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: labs/jbossesb/trunk/product/services/jbrules/lib/ext/knowledge-api-5.2.1.Final.jar
===================================================================
(Binary files differ)

Added: labs/jbossesb/trunk/product/services/jbrules/lib/ext/knowledge-api-5.3.1.Final.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbossesb/trunk/product/services/jbrules/lib/ext/knowledge-api-5.3.1.Final.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: labs/jbossesb/trunk/product/services/jbrules/src/test/resources/testrules.pkg
===================================================================
(Binary files differ)



More information about the jboss-svn-commits mailing list