[jbpm-commits] JBoss JBPM SVN: r6683 - in jbpm3/branches/jbpm-3.2-soa: ci and 29 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Sep 25 20:44:54 EDT 2010


Author: alex.guizar at jboss.com
Date: 2010-09-25 20:44:51 -0400 (Sat, 25 Sep 2010)
New Revision: 6683

Added:
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/.classpath
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/.project
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/scripts/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/scripts/assembly-config.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/hibernate.extra.hbm.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.cfg.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.jndi.properties
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/LocalCommandService.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorServiceFactory.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/ejb-jar.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/jboss.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/DeploymentException.java
Removed:
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/resources/jndi.properties
Modified:
   jbpm3/branches/jbpm-3.2-soa/ci/container.sh
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/command/Command.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/context/exe/matcher/HibernateLongIdMatcher.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/context/exe/matcher/HibernateStringIdMatcher.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java
   jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/Job.java
   jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
   jbpm3/branches/jbpm-3.2-soa/distribution/scripts/assembly-modules.xml
   jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise/pom.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/etc/jbpm.cfg.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/resources/META-INF/ejb-jar.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/resources/META-INF/jboss.xml
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/AbstractEnterpriseTestCase.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/ArchiveDeployer.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/IntegrationTestHelper.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/IntegrationTestSetup.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/JBossArchiveDeployer.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/webapp/WEB-INF/jboss-web.xml
   jbpm3/branches/jbpm-3.2-soa/pom.xml
   jbpm3/branches/jbpm-3.2-soa/soa-distribution/pom.xml
Log:
JBPM-2945 derive job processor based on jee5 from existing enterprise module

Modified: jbpm3/branches/jbpm-3.2-soa/ci/container.sh
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/ci/container.sh	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/ci/container.sh	2010-09-26 00:44:51 UTC (rev 6683)
@@ -53,8 +53,8 @@
 cp -u ci/profiles.redhat.qa.xml profiles.xml
 
 # Determine jBPM version
-mvn -s /dev/null -Dexpression=project.version help:evaluate > $WORKSPACE/project-version.txt
-JBPM_VERSION=`grep '^3\.' $WORKSPACE/project-version.txt`
+mvn -s /dev/null -Dexpression=project.version help:evaluate > $WORKSPACE/version.txt
+JBPM_VERSION=`grep '^3\.' $WORKSPACE/version.txt`
 
 # Build jBPM
 mvn -s /dev/null -Pdistro -Djbpm.home=$WORKSPACE/jbpm-$JBPM_VERSION -Dcontainer=$CONTAINER \
@@ -147,7 +147,6 @@
 # Run enterprise test suite
 mvn -f enterprise/pom.xml -s /dev/null --fail-at-end -Djboss.bind.address=$MYTESTIP_1 \
   -Dsurefire.jvm.args="-Xms64m -Xmx256m" integration-test | tee $WORKSPACE/tests.log
-grep -E 'FIXME\|FAILED' $WORKSPACE/tests.log | sort -u > $WORKSPACE/fixme.txt
 
 # Stop JBoss AS
 $JBOSS_HOME/bin/shutdown.sh -s jnp://$MYTESTIP_1:1099 -S

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/command/Command.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/command/Command.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/command/Command.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -25,8 +25,7 @@
 
 import org.jbpm.JbpmContext;
 
-public interface Command extends Serializable
-{
+public interface Command extends Serializable {
 
   Object execute(JbpmContext jbpmContext) throws Exception;
 }

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/context/exe/matcher/HibernateLongIdMatcher.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/context/exe/matcher/HibernateLongIdMatcher.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/context/exe/matcher/HibernateLongIdMatcher.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -21,10 +21,10 @@
  */
 package org.jbpm.context.exe.matcher;
 
+import org.hibernate.Hibernate;
 import org.hibernate.SessionFactory;
 import org.hibernate.metadata.ClassMetadata;
 import org.hibernate.proxy.HibernateProxy;
-import org.hibernate.type.LongType;
 
 import org.jbpm.JbpmContext;
 import org.jbpm.context.exe.JbpmTypeMatcher;
@@ -44,7 +44,7 @@
       if (sessionFactory != null) {
         ClassMetadata classMetadata = sessionFactory.getClassMetadata(valueClass);
         return classMetadata != null
-          && classMetadata.getIdentifierType().getClass() == LongType.class;
+          && classMetadata.getIdentifierType() == Hibernate.LONG;
       }
     }
     return false;

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/context/exe/matcher/HibernateStringIdMatcher.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/context/exe/matcher/HibernateStringIdMatcher.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/context/exe/matcher/HibernateStringIdMatcher.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -21,10 +21,10 @@
  */
 package org.jbpm.context.exe.matcher;
 
+import org.hibernate.Hibernate;
 import org.hibernate.SessionFactory;
 import org.hibernate.metadata.ClassMetadata;
 import org.hibernate.proxy.HibernateProxy;
-import org.hibernate.type.StringType;
 
 import org.jbpm.JbpmContext;
 import org.jbpm.context.exe.JbpmTypeMatcher;
@@ -44,7 +44,7 @@
       if (sessionFactory != null) {
         ClassMetadata classMetadata = sessionFactory.getClassMetadata(valueClass);
         return classMetadata != null
-          && classMetadata.getIdentifierType().getClass() == StringType.class;
+          && classMetadata.getIdentifierType() == Hibernate.STRING;
       }
     }
     return false;

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/db/JobSession.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -69,10 +69,8 @@
         .list();
     }
     catch (HibernateException e) {
-      throw new JbpmPersistenceException("could not find exclusive jobs owned by '"
-        + lockOwner
-        + "' for "
-        + processInstance, e);
+      throw new JbpmPersistenceException("could not find exclusive jobs owned by '" + lockOwner
+        + "' for " + processInstance, e);
     }
   }
 
@@ -100,10 +98,8 @@
       return (Job) query.setString("lockOwner", lockOwner).setMaxResults(1).uniqueResult();
     }
     catch (HibernateException e) {
-      throw new JbpmPersistenceException("could not get first due job owned by '"
-        + lockOwner
-        + "' ignoring jobs "
-        + monitoredJobs, e);
+      throw new JbpmPersistenceException("could not get first due job owned by '" + lockOwner
+        + "' ignoring jobs " + monitoredJobs, e);
     }
   }
 
@@ -213,9 +209,7 @@
       preventFurtherRepetitions(timers);
     }
     catch (HibernateException e) {
-      throw new JbpmPersistenceException("could not delete timers by name '"
-        + name
-        + "' for "
+      throw new JbpmPersistenceException("could not delete timers by name '" + name + "' for "
         + token, e);
     }
   }
@@ -261,8 +255,8 @@
         .list();
     }
     catch (HibernateException e) {
-      throw new JbpmPersistenceException(
-        "could not find jobs with lock time over " + threshold, e);
+      throw new JbpmPersistenceException("could not find jobs with lock time over " +
+        threshold, e);
     }
   }
 

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/Job.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/Job.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/job/Job.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -83,8 +83,8 @@
     return lockTime;
   }
 
-  public void setLockTime(Date aqcuireDate) {
-    this.lockTime = aqcuireDate;
+  public void setLockTime(Date lockTime) {
+    this.lockTime = lockTime;
   }
 
   /** @deprecated call {@link #getLockTime()} instead */
@@ -127,8 +127,8 @@
     return lockOwner;
   }
 
-  public void setLockOwner(String jobExecutorName) {
-    this.lockOwner = jobExecutorName;
+  public void setLockOwner(String lockOwner) {
+    this.lockOwner = lockOwner;
   }
 
   /** @deprecated call {@link #getLockOwner()} instead */

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/pom.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -40,6 +40,18 @@
     </dependency>
     <dependency>
       <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jbpm-enterprise-jee5</artifactId>
+      <version>${project.version}</version>
+      <type>ejb</type>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jbpm-enterprise-jee5</artifactId>
+      <classifier>config</classifier>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
       <artifactId>jbpm-enterprise</artifactId>
       <version>${project.version}</version>
       <type>ejb</type>
@@ -96,6 +108,11 @@
     </dependency>
     <dependency>
       <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jsf-console-jee5</artifactId>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
       <artifactId>gpd-deployer</artifactId>
       <type>war</type>
     </dependency>
@@ -103,6 +120,12 @@
     <!-- Sources -->
     <dependency>
       <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jbpm-enterprise-jee5</artifactId>
+      <classifier>sources</classifier>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
       <artifactId>jbpm-enterprise</artifactId>
       <classifier>sources</classifier>
       <version>${project.version}</version>
@@ -123,6 +146,12 @@
     <!-- Javadoc -->
     <dependency>
       <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jbpm-enterprise-jee5</artifactId>
+      <classifier>javadoc</classifier>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
       <artifactId>jbpm-enterprise</artifactId>
       <classifier>javadoc</classifier>
       <version>${project.version}</version>
@@ -233,5 +262,4 @@
       </plugin>
     </plugins>
   </build>
-
 </project>

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/scripts/assembly-modules.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/scripts/assembly-modules.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/scripts/assembly-modules.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -23,7 +23,6 @@
       <outputDirectory>lib</outputDirectory>
       <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
       <useProjectArtifact>false</useProjectArtifact>
-      <scope>test</scope>
     </dependencySet>
 
     <!-- config -->

Modified: jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/distribution/src/main/resources/installer/install-definition.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -213,7 +213,16 @@
       <!-- jbpm/jbpm-service.sar -->
       <file src="@{assemblyDirectory}/lib/jbpm-enterprise-config.jar"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
-        unpack="true" />
+        unpack="true" condition="isJBoss405" />
+      <file src="@{assemblyDirectory}/lib/jbpm-enterprise-config.jar"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
+        unpack="true" condition="isJBoss423" />
+      <file src="@{assemblyDirectory}/lib/jbpm-enterprise-jee5-config.jar"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
+        unpack="true" condition="isJBoss501" />
+      <file src="@{assemblyDirectory}/lib/jbpm-enterprise-jee5-config.jar"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
+        unpack="true" condition="isJBoss510" />
       <fileset dir="@{assemblyDirectory}/lib"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar">
         <include name="jbpm-jpdl.jar" />
@@ -231,7 +240,16 @@
       <!-- jbpm/jbpm-enterprise.jar -->
       <file src="@{assemblyDirectory}/lib/jbpm-enterprise.jar"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-enterprise.jar"
-        unpack="true" />
+        unpack="true" condition="isJBoss405" />
+      <file src="@{assemblyDirectory}/lib/jbpm-enterprise.jar"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-enterprise.jar"
+        unpack="true" condition="isJBoss423" />
+      <file src="@{assemblyDirectory}/lib/jbpm-enterprise-jee5.jar"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-enterprise.jar"
+        unpack="true" condition="isJBoss501" />
+      <file src="@{assemblyDirectory}/lib/jbpm-enterprise-jee5.jar"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-enterprise.jar"
+        unpack="true" condition="isJBoss510" />
 
       <!-- jbpm-mq-service.xml -->
       <file src="@{resourcesDirectory}/destination/jbpm-mq-service.xml"
@@ -352,7 +370,18 @@
       <!-- jbpm/jsf-console.war -->
       <file src="@{assemblyDirectory}/lib/jsf-console.war"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jsf-console.war"
-        unpack="true" />
+        unpack="true" condition="isJBoss405" />
+      <file src="@{assemblyDirectory}/lib/jsf-console.war"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jsf-console.war"
+        unpack="true" condition="isJBoss423" />
+      <file src="@{assemblyDirectory}/lib/jsf-console-jee5.war"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jsf-console.war"
+        unpack="true" condition="isJBoss501" />
+      <file src="@{assemblyDirectory}/lib/jsf-console-jee5.war"
+        targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/jsf-console.war"
+        unpack="true" condition="isJBoss510" />
+
+      <!-- jbpm/gpd-deployer.war -->
       <file src="@{assemblyDirectory}/lib/gpd-deployer.war"
         targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/jbpm/gpd-deployer.war"
         unpack="true" />

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/pom.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/pom.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -54,13 +54,6 @@
 
   <!-- Plugins -->
   <build>
-    <testResources>
-      <testResource>
-        <directory>src/test/resources</directory>
-        <filtering>true</filtering>
-      </testResource>
-    </testResources>
-
     <plugins>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
@@ -100,26 +93,15 @@
         <configuration>
           <skip>true</skip>
         </configuration>
+      </plugin>
+
+      <plugin>
+      	<artifactId>maven-jar-plugin</artifactId>
         <executions>
           <execution>
-            <id>surefire-integration</id>
-            <phase>integration-test</phase>
             <goals>
-              <goal>test</goal>
+              <goal>test-jar</goal>
             </goals>
-            <configuration>
-              <skip>false</skip>
-              <systemProperties>
-                <property>
-                  <name>cactus.contextURL</name>
-                  <value>http://${jboss.bind.address}:8080/enterprise-test</value>
-                </property>
-                <property>
-                  <name>log4j.output.dir</name>
-                  <value>${project.build.directory}</value>
-                </property>
-              </systemProperties>
-            </configuration>
           </execution>
         </executions>
       </plugin>
@@ -129,14 +111,14 @@
   <!-- Profiles -->
   <profiles>
     <!--
-      Name: no-jboss-bind-address
-      Desc: Skip tests if no bind address is given
+      Name: jboss-bind-address
+      Desc: Run integration tests if bind address is given
     -->
     <profile>
-      <id>no-jboss-bind-address</id>
+      <id>jboss-bind-address</id>
       <activation>
         <property>
-          <name>!jboss.bind.address</name>
+          <name>jboss.bind.address</name>
         </property>
       </activation>
       <build>
@@ -146,8 +128,34 @@
             <executions>
               <execution>
                 <id>surefire-integration</id>
+                <phase>integration-test</phase>
+                <goals>
+                  <goal>test</goal>
+                </goals>
                 <configuration>
-                  <skipTests>true</skipTests>
+                  <skip>false</skip>
+                  <systemProperties>
+                    <property>
+                      <name>log4j.output.dir</name>
+                      <value>${project.build.directory}</value>
+                    </property>
+                    <property>
+                      <name>cactus.contextURL</name>
+                      <value>http://${jboss.bind.address}:8080/enterprise-test</value>
+                    </property>
+                    <property>
+                      <name>java.naming.factory.initial</name>
+                      <value>org.jnp.interfaces.NamingContextFactory</value>
+                    </property>
+                    <property>
+                      <name>java.naming.factory.url.pkgs</name>
+                      <value>org.jboss.naming:org.jnp.interfaces</value>
+                    </property>
+                    <property>
+                      <name>java.naming.provider.url</name>
+                      <value>jnp://${jboss.bind.address}:1099</value>
+                    </property>
+                  </systemProperties>
                 </configuration>
               </execution>
             </executions>

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/etc/jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/etc/jbpm.cfg.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/etc/jbpm.cfg.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -17,9 +17,8 @@
   ==== High-availability JNDI properties (end) -->
 
   <!--
-    The default job executor needs to be overwritten with a null value. 
-    There should be no job executor in the enterprise configuration. 
-    Async messaging is bound to JMS and scheduling, to EJB timers.  
+    There should be no job executor in the enterprise configuration.
+    The message service is bound to JMS and the scheduler service, to EJB timers.  
   -->  
   <null name="jbpm.job.executor" />
 

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -24,7 +24,6 @@
 import java.io.Serializable;
 
 import javax.ejb.CreateException;
-import javax.ejb.EJBException;
 import javax.ejb.MessageDrivenBean;
 import javax.ejb.MessageDrivenContext;
 import javax.jms.Connection;
@@ -42,6 +41,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import org.jbpm.JbpmException;
 import org.jbpm.command.Command;
 import org.jbpm.ejb.LocalCommandService;
 import org.jbpm.ejb.LocalCommandServiceHome;
@@ -81,12 +81,6 @@
  * <td>Logical name of the factory that provides JMS connections for producing result messages.
  * Required for command messages that indicate a reply destination.</td>
  * </tr>
- * <tr>
- * <td><code>jms/DeadLetterQueue</code></td>
- * <td>Message Destination Reference</td>
- * <td>Messages which do not contain a command are sent to the queue referenced here. Optional;
- * if absent, such messages are rejected, which may cause the container to redeliver.</td>
- * </tr>
  * </table>
  * 
  * @author Jim Rigsbee
@@ -100,7 +94,6 @@
   private MessageDrivenContext messageDrivenContext;
   private LocalCommandService commandService;
 
-  private Destination deadLetterQueue;
   private ConnectionFactory jmsConnectionFactory;
   private Connection jmsConnection;
 
@@ -110,10 +103,7 @@
     try {
       // extract command from message
       Command command = extractCommand(message);
-      if (command == null) {
-        discard(message);
-        return;
-      }
+      if (command == null) return;
       try {
         // execute command via local command executor bean
         Object result = commandService.execute(command);
@@ -159,25 +149,6 @@
     return null;
   }
 
-  private void discard(Message message) throws JMSException {
-    if (deadLetterQueue == null) {
-      if (log.isDebugEnabled()) {
-        log.debug("dead letter queue not available, rejecting: " + message);
-      }
-      messageDrivenContext.setRollbackOnly();
-    }
-    else {
-      // send message to dead letter queue
-      Session jmsSession = createSession();
-      try {
-        jmsSession.createProducer(deadLetterQueue).send(message);
-      }
-      finally {
-        jmsSession.close();
-      }
-    }
-  }
-
   private void sendResult(Serializable result, Destination destination, String correlationId)
     throws JMSException {
     if (log.isDebugEnabled()) log.debug("sending " + result + " to " + destination);
@@ -220,7 +191,6 @@
       jmsConnection = null;
     }
     jmsConnectionFactory = null;
-    deadLetterQueue = null;
     commandService = null;
     messageDrivenContext = null;
   }
@@ -233,19 +203,13 @@
       LocalCommandServiceHome commandServiceHome = (LocalCommandServiceHome) jndiContext.lookup("java:comp/env/ejb/LocalCommandServiceBean");
       commandService = commandServiceHome.create();
 
-      try {
-        deadLetterQueue = (Destination) jndiContext.lookup("java:comp/env/jms/DeadLetterQueue");
-      }
-      catch (NamingException e) {
-        // dead letter queue will not be available
-      }
       jndiContext.close();
     }
     catch (NamingException e) {
-      throw new EJBException("error retrieving command service home", e);
+      throw new JbpmException("error retrieving command service home", e);
     }
     catch (CreateException e) {
-      throw new EJBException("error creating command service", e);
+      throw new JbpmException("error creating command service", e);
     }
   }
 }

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -105,11 +105,10 @@
   private SessionContext sessionContext;
 
   /**
-   * creates a command service that will be used to execute the commands that are passed in the
-   * execute method. The command service will be build by creating a jbpm configuration. In case
-   * the environment key JbpmCfgResource is specified for this bean, that value will be used to
-   * resolve the jbpm configuration file as a resource. If that key is not configured, the
-   * default jbpm configuration file will be used (jbpm.cfg.xml).
+   * Creates the {@link JbpmConfiguration} to be used by this command service. In case the
+   * environment key <code>JbpmCfgResource</code> is specified, that value is interpreted as the
+   * name of the configuration resource to load from the classpath. If that key is absent, the
+   * default configuration file will be used (jbpm.cfg.xml).
    */
   public void ejbCreate() throws CreateException {
     String jbpmCfgResource;

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/resources/META-INF/ejb-jar.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/resources/META-INF/ejb-jar.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -4,15 +4,13 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
     http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
-
   <description>Component set for Java EE integration.</description>
   <display-name>JBoss jBPM Enterprise Beans</display-name>
 
   <enterprise-beans>
-
     <session>
       <description>Executes commands in a separate context.</description>
-      <display-name>jBPM Command Service Session Bean</display-name>
+      <display-name>jBPM Command Service</display-name>
       <ejb-name>CommandServiceBean</ejb-name>
       <home>org.jbpm.ejb.RemoteCommandServiceHome</home>
       <remote>org.jbpm.ejb.RemoteCommandService</remote>
@@ -36,8 +34,8 @@
 
       <ejb-local-ref>
         <description>
-          Link to the local entity bean that implements the scheduler service. Required for
-          processes that contain timers.
+          Link to the local entity bean that implements the scheduler service.
+          Required for processes that contain timers.
         </description>
         <ejb-ref-name>ejb/TimerEntityBean</ejb-ref-name>
         <ejb-ref-type>Entity</ejb-ref-type>
@@ -62,8 +60,8 @@
 
       <resource-ref>
         <description>
-          Logical name of the data source that provides connections to the persistence service. Must
-          match the hibernate.connection.datasource property in the Hibernate configuration file.
+          Data source that provides the persistence service with connections.
+          Must match property hibernate.connection.datasource in the Hibernate configuration.
         </description>
         <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
@@ -72,8 +70,8 @@
 
       <resource-ref>
         <description>
-          Logical name of the factory that provides JMS connections to the message service. Required
-          for processes that contain asynchronous continuations.
+          Connection factory that provides JMS connections to the message service.
+          Required for processes that contain asynchronous continuations.
         </description>
         <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
         <res-type>javax.jms.ConnnectionFactory</res-type>
@@ -103,7 +101,6 @@
       	<message-destination-usage>Produces</message-destination-usage>
       	<message-destination-link>CommandQueue</message-destination-link>
       </message-destination-ref>
-
     </session>
 
     <!-- Timer service bean ==>
@@ -137,7 +134,7 @@
       <description>
         Listens for serialized commands and routes them to the command service session bean.
       </description>
-      <display-name>jBPM Command Listener Message Driven Bean</display-name>
+      <display-name>jBPM Command Listener</display-name>
       <ejb-name>CommandListenerBean</ejb-name>
       <ejb-class>org.jbpm.ejb.impl.CommandListenerBean</ejb-class>
       <transaction-type>Container</transaction-type>
@@ -164,16 +161,6 @@
         <res-type>javax.jms.ConnectionFactory</res-type>
         <res-auth>Container</res-auth>
       </resource-ref>
-
-      <message-destination-ref>
-        <description>
-          Messages that do not contain a command are sent to the queue referenced here. Optional;
-          if absent, such messages are rejected, which may cause the container to redeliver.
-        </description>
-        <message-destination-ref-name>jms/DeadLetterQueue</message-destination-ref-name>
-        <message-destination-type>javax.jms.Queue</message-destination-type>
-        <message-destination-usage>Produces</message-destination-usage>
-      </message-destination-ref>
     </message-driven>
 
     <message-driven>
@@ -181,7 +168,7 @@
         Listens for job references and delegates execution of the referenced Job to the command
         service session bean.
       </description>
-      <display-name>jBPM Job Listener Message Driven Bean</display-name>
+      <display-name>jBPM Job Listener</display-name>
       <ejb-name>JobListenerBean</ejb-name>
       <ejb-class>org.jbpm.ejb.impl.JobListenerBean</ejb-class>
       <transaction-type>Container</transaction-type>
@@ -208,21 +195,11 @@
         <res-type>javax.jms.ConnectionFactory</res-type>
         <res-auth>Container</res-auth>
       </resource-ref>
-
-      <message-destination-ref>
-        <description>
-          Messages that do not contain a job ID are sent to the queue referenced here. Optional; if
-          absent, such messages are rejected, which may cause the container to redeliver.
-        </description>
-        <message-destination-ref-name>jms/DeadLetterQueue</message-destination-ref-name>
-        <message-destination-type>javax.jms.Queue</message-destination-type>
-        <message-destination-usage>Produces</message-destination-usage>
-      </message-destination-ref>
     </message-driven>
 
     <entity>
       <description>Interacts with the EJB timer service to schedule jBPM timers.</description>
-      <display-name>jBPM Timer Entity Bean</display-name>
+      <display-name>jBPM Timer</display-name>
       <ejb-name>TimerEntityBean</ejb-name>
       <home>org.jbpm.ejb.TimerEntityHome</home>
       <remote>org.jbpm.ejb.TimerEntity</remote>
@@ -263,7 +240,7 @@
       </ejb-local-ref>
 
       <query>
-        <description>Retrieve all timers by name and token identifier</description>
+        <description>Retrieve all timers by name and token identifier.</description>
         <query-method>
           <method-name>findByNameAndTokenId</method-name>
           <method-params>
@@ -279,7 +256,7 @@
       </query>
 
       <query>
-        <description>Retrieve all timers by process instance identifier</description>
+        <description>Retrieve all timers by process instance identifier.</description>
         <query-method>
           <method-name>findByProcessInstanceId</method-name>
           <method-params>
@@ -293,11 +270,9 @@
         ]]></ejb-ql>
       </query>
     </entity>
-
   </enterprise-beans>
 
   <assembly-descriptor>
-
     <container-transaction>
       <method>
         <ejb-name>CommandServiceBean</ejb-name>
@@ -341,13 +316,13 @@
     </container-transaction>
 
     <message-destination>
+      <description>Receiver of job references.</description>
       <message-destination-name>JobQueue</message-destination-name>
     </message-destination>
 
     <message-destination>
+      <description>Receiver of serialized commands.</description>
       <message-destination-name>CommandQueue</message-destination-name>
     </message-destination>
-
   </assembly-descriptor>
-
 </ejb-jar>

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/resources/META-INF/jboss.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/resources/META-INF/jboss.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/main/resources/META-INF/jboss.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -24,10 +24,6 @@
         <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
         <jndi-name>java:JmsXA</jndi-name>
       </resource-ref>
-      <message-destination-ref>
-        <message-destination-ref-name>jms/DeadLetterQueue</message-destination-ref-name>
-        <jndi-name>jnp://${jboss.bind.address}:1100/queue/DLQ</jndi-name>
-      </message-destination-ref>
     </message-driven>
 
     <message-driven>
@@ -36,10 +32,6 @@
         <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
         <jndi-name>java:JmsXA</jndi-name>
       </resource-ref>
-      <message-destination-ref>
-        <message-destination-ref-name>jms/DeadLetterQueue</message-destination-ref-name>
-        <jndi-name>jnp://${jboss.bind.address}:1100/queue/DLQ</jndi-name>
-      </message-destination-ref>
     </message-driven>
 
     <entity>
@@ -52,12 +44,12 @@
   <assembly-descriptor>
     <message-destination>
       <message-destination-name>JobQueue</message-destination-name>
-      <jndi-name>jnp://${jboss.bind.address}:1100/queue/JbpmJobQueue</jndi-name>
+      <jndi-name>queue/JbpmJobQueue</jndi-name>
     </message-destination>
 
     <message-destination>
       <message-destination-name>CommandQueue</message-destination-name>
-      <jndi-name>jnp://${jboss.bind.address}:1100/queue/JbpmCommandQueue</jndi-name>
+      <jndi-name>queue/JbpmCommandQueue</jndi-name>
     </message-destination>
   </assembly-descriptor>
 </jboss>

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/AbstractEnterpriseTestCase.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/AbstractEnterpriseTestCase.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/AbstractEnterpriseTestCase.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -59,7 +59,6 @@
   private List processDefinitions = new ArrayList();
 
   private static Context environment;
-  private static LocalCommandServiceHome commandServiceHome;
 
   private static final Log log = LogFactory.getLog(AbstractEnterpriseTestCase.class);
 
@@ -82,10 +81,19 @@
   }
 
   protected CommandService createCommandService() throws Exception {
-    if (commandServiceHome == null) {
-      commandServiceHome = (LocalCommandServiceHome) getEnvironment().lookup("ejb/CommandServiceBean");
+    Object object = getEnvironment().lookup("ejb/CommandServiceBean");
+    CommandService commandService;
+
+    if (object instanceof CommandService) {
+      // compatibility with EJB3 homeless beans
+      commandService = (CommandService) object;
     }
-    return new RetryCommandService(commandServiceHome.create());
+    else {
+      LocalCommandServiceHome home = (LocalCommandServiceHome) object;
+      commandService = home.create();
+    }
+
+    return new RetryCommandService(commandService);
   }
 
   protected ProcessDefinition deployProcessDefinition(String xml) {

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/ArchiveDeployer.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/ArchiveDeployer.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/ArchiveDeployer.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -34,10 +34,10 @@
   /**
    * Deploy the given archive
    */
-  void deploy(URL archive) throws Exception;
+  void deploy(URL archive) throws DeploymentException;
 
   /**
    * Undeploy the given archive
    */
-  void undeploy(URL archive) throws Exception;
+  void undeploy(URL archive) throws DeploymentException;
 }

Added: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/DeploymentException.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/DeploymentException.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/DeploymentException.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.enterprise;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class DeploymentException extends Exception {
+
+  private static final long serialVersionUID = 1L;
+
+  public DeploymentException() {
+  }
+
+  public DeploymentException(String message) {
+    super(message);
+  }
+
+  public DeploymentException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/DeploymentException.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/IntegrationTestHelper.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/IntegrationTestHelper.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/IntegrationTestHelper.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -22,17 +22,17 @@
 package org.jbpm.enterprise;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URL;
-import java.util.Hashtable;
 
 import javax.management.JMException;
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
-import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
 import org.jbpm.JbpmException;
+import org.jbpm.util.JndiUtil;
 
 /**
  * An integration test helper that deals with test deployment/undeployment, etc.
@@ -53,24 +53,21 @@
 
   public String getTestResourcesDir() {
     if (testResourcesDir == null) {
-      testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY, "target/test-classes");
+      testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY,
+        "target/test-classes");
     }
     return testResourcesDir;
   }
 
   /** Try to discover the File for the test resource */
-  public File getResourceFile(String resource) {
+  public File getResourceFile(String resource) throws FileNotFoundException {
     File file = new File(resource);
     if (file.exists()) return file;
 
     file = new File(getTestResourcesDir() + "/" + resource);
     if (file.exists()) return file;
 
-    throw new IllegalArgumentException("Cannot obtain '"
-        + getTestResourcesDir()
-        + "/"
-        + resource
-        + "'");
+    throw new FileNotFoundException("resource not found: " + resource);
   }
 
   public String getTestArchiveDir() {
@@ -81,39 +78,32 @@
   }
 
   /** Try to discover the File for the deployment archive */
-  public File getTestArchiveFile(String archive) {
+  public File getTestArchiveFile(String archive) throws FileNotFoundException {
     File file = new File(archive);
     if (file.exists()) return file;
 
     file = new File(getTestArchiveDir() + "/" + archive);
     if (file.exists()) return file;
 
-    String notSet = getTestArchiveDir() == null ? " System property '"
-        + SYSPROP_TEST_ARCHIVE_DIRECTORY
-        + "' not set." : "";
-    throw new IllegalArgumentException("Cannot obtain '"
-        + getTestArchiveDir()
-        + "/"
-        + archive
-        + "'."
-        + notSet);
+    throw new FileNotFoundException("test archive not found: " + getTestArchiveDir() + "/"
+      + archive);
   }
 
-  public void deploy(String archive) throws Exception {
+  public void deploy(String archive) throws IOException, DeploymentException {
     URL url = getTestArchiveFile(archive).toURI().toURL();
     deploy(url);
   }
 
-  public void deploy(URL archive) throws Exception {
+  public void deploy(URL archive) throws DeploymentException {
     getDeployer().deploy(archive);
   }
 
-  public void undeploy(String archive) throws Exception {
+  public void undeploy(String archive) throws IOException, DeploymentException {
     URL url = getTestArchiveFile(archive).toURI().toURL();
     undeploy(url);
   }
 
-  public void undeploy(URL archive) throws Exception {
+  public void undeploy(URL archive) throws DeploymentException {
     getDeployer().undeploy(archive);
   }
 
@@ -125,10 +115,10 @@
         jbossVersion = (String) getServer().getAttribute(oname, "Version");
       }
       catch (JMException e) {
-        throw new JbpmException("cannot obtain jboss version", e);
+        throw new JbpmException("failed to determine jboss version", e);
       }
       catch (IOException e) {
-        throw new JbpmException("cannot obtain jboss version", e);
+        throw new JbpmException("failed to determine jboss version", e);
       }
 
       if (jbossVersion.startsWith("5.1.0"))
@@ -147,15 +137,11 @@
 
   public MBeanServerConnection getServer() {
     if (server == null) {
-      Hashtable jndiEnv = null;
       try {
-        InitialContext iniCtx = new InitialContext();
-        jndiEnv = iniCtx.getEnvironment();
-        server = (MBeanServerConnection) iniCtx.lookup("jmx/invoker/RMIAdaptor");
+        server = (MBeanServerConnection) JndiUtil.lookup("jmx/invoker/RMIAdaptor");
       }
       catch (NamingException ex) {
-        throw new RuntimeException("Cannot obtain MBeanServerConnection using jndi props: "
-            + jndiEnv, ex);
+        throw new JbpmException("failed to retrieve mbean server connection", ex);
       }
     }
     return server;

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/IntegrationTestSetup.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/IntegrationTestSetup.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/IntegrationTestSetup.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -21,15 +21,6 @@
  */
 package org.jbpm.enterprise;
 
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.management.MBeanServerConnection;
-
 import junit.extensions.TestSetup;
 import junit.framework.TestSuite;
 
@@ -41,73 +32,38 @@
  */
 public class IntegrationTestSetup extends TestSetup {
 
-  private IntegrationTestHelper delegate = new IntegrationTestHelper();
-  private String[] archives;
-  private ClassLoader originalClassLoader;
+  private final IntegrationTestHelper helper = new IntegrationTestHelper();
+  private final String[] archives;
 
   public IntegrationTestSetup(Class testClass, String archiveList) {
     super(new TestSuite(testClass));
-    archives = getArchiveArray(archiveList);
+    archives = archiveList == null ? new String[0] : archiveList.split("[\\s,]+");
   }
 
-  public File getArchiveFile(String archive) {
-    return delegate.getTestArchiveFile(archive);
+  public IntegrationTestHelper getHelper() {
+    return helper;
   }
 
-  public URL getArchiveURL(String archive) throws MalformedURLException {
-    return delegate.getTestArchiveFile(archive).toURI().toURL();
-  }
-
-  public MBeanServerConnection getServer() {
-    return delegate.getServer();
-  }
-
-  private String[] getArchiveArray(String archiveList) {
-    return archiveList == null ? new String[0] : archiveList.split("[\\s,]+");
-  }
-
   protected void setUp() throws Exception {
     super.setUp();
 
-    List clientJars = new ArrayList();
     for (int i = 0; i < archives.length; i++) {
       String archive = archives[i];
       try {
-        delegate.deploy(archive);
+        helper.deploy(archive);
       }
-      catch (Exception ex) {
-        ex.printStackTrace();
-        delegate.undeploy(archive);
+      catch (DeploymentException ex) {
+        helper.undeploy(archive);
+        throw ex;
       }
-
-      if (archive.endsWith("-client.jar")) {
-        URL archiveURL = getArchiveURL(archive);
-        clientJars.add(archiveURL);
-      }
     }
-
-    ClassLoader parent = Thread.currentThread().getContextClassLoader();
-    originalClassLoader = parent;
-
-    // add client jars to the class loader
-    if (!clientJars.isEmpty()) {
-      URL[] urls = new URL[clientJars.size()];
-      clientJars.toArray(urls);
-      URLClassLoader cl = new URLClassLoader(urls, parent);
-      Thread.currentThread().setContextClassLoader(cl);
-    }
   }
 
   protected void tearDown() throws Exception {
-    try {
-      for (int i = 0; i < archives.length; i++) {
-        String archive = archives[archives.length - i - 1];
-        delegate.undeploy(archive);
-      }
+    for (int i = 0; i < archives.length; i++) {
+      String archive = archives[archives.length - i - 1];
+      helper.undeploy(archive);
     }
-    finally {
-      Thread.currentThread().setContextClassLoader(originalClassLoader);
-    }
     super.tearDown();
   }
 }

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/JBossArchiveDeployer.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/JBossArchiveDeployer.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/JBossArchiveDeployer.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -21,8 +21,10 @@
  */
 package org.jbpm.enterprise;
 
+import java.io.IOException;
 import java.net.URL;
 
+import javax.management.JMException;
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
 
@@ -42,16 +44,24 @@
     this.server = server;
   }
 
-  public void deploy(URL url) throws Exception {
+  public void deploy(URL url) throws DeploymentException {
     invokeMainDeployer("deploy", url);
   }
 
-  public void undeploy(URL url) throws Exception {
+  public void undeploy(URL url) throws DeploymentException {
     invokeMainDeployer("undeploy", url);
   }
 
-  private void invokeMainDeployer(String methodName, URL url) throws Exception {
-    server.invoke(new ObjectName(MAIN_DEPLOYER), methodName, new Object[] { url },
+  private void invokeMainDeployer(String methodName, URL url) throws DeploymentException {
+    try {
+      server.invoke(new ObjectName(MAIN_DEPLOYER), methodName, new Object[] { url },
         new String[] { "java.net.URL" });
+    }
+    catch (JMException e) {
+      throw new DeploymentException(methodName + " failed", e);
+    }
+    catch (IOException e) {
+      throw new DeploymentException(methodName + " failed", e);
+    }
   }
 }

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/config/AppServerConfigurationsTest.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -24,11 +24,11 @@
 import junit.framework.Test;
 
 import org.apache.cactus.ServletTestCase;
+
 import org.jbpm.JbpmConfiguration;
 import org.jbpm.enterprise.IntegrationTestSetup;
-import org.jbpm.msg.jms.JmsMessageServiceFactory;
 import org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory;
-import org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory;
+import org.jbpm.svc.ServiceFactory;
 import org.jbpm.svc.Services;
 
 public class AppServerConfigurationsTest extends ServletTestCase {
@@ -48,30 +48,46 @@
   }
 
   public void testJtaDbPersistenceFactoryConfiguration() {
-    String expService = JtaDbPersistenceServiceFactory.class.getName();
-    String wasService = jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE)
-        .getClass()
-        .getName();
-    assertEquals(expService, wasService);
+    ServiceFactory serviceFactory = jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+    assertSame(JtaDbPersistenceServiceFactory.class, serviceFactory.getClass());
 
-    JtaDbPersistenceServiceFactory persistenceServiceFactory = (JtaDbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+    JtaDbPersistenceServiceFactory persistenceServiceFactory = (JtaDbPersistenceServiceFactory) serviceFactory;
     assertFalse(persistenceServiceFactory.isTransactionEnabled());
     assertTrue(persistenceServiceFactory.isCurrentSessionEnabled());
   }
 
   public void testJmsMessageServiceFactoryConfiguration() {
-    String expService = JmsMessageServiceFactory.class.getName();
-    String wasService = jbpmConfiguration.getServiceFactory(Services.SERVICENAME_MESSAGE)
-        .getClass()
-        .getName();
-    assertEquals(expService, wasService);
+    Class serviceClass;
+    try {
+      serviceClass = Class.forName("org.jbpm.msg.jms.JmsMessageServiceFactory");
+    }
+    catch (ClassNotFoundException e) {
+      try {
+        serviceClass = Class.forName("org.jbpm.jms.JmsConnectorServiceFactory");
+      }
+      catch (ClassNotFoundException e2) {
+        throw new AssertionError(e2);
+      }
+    }
+
+    assertSame(serviceClass, jbpmConfiguration.getServiceFactory(Services.SERVICENAME_MESSAGE)
+      .getClass());
   }
 
   public void testEjbSchedulerServiceFactoryConfiguration() {
-    String expService = EntitySchedulerServiceFactory.class.getName();
-    String wasService = jbpmConfiguration.getServiceFactory(Services.SERVICENAME_SCHEDULER)
-        .getClass()
-        .getName();
-    assertEquals(expService, wasService);
+    Class serviceClass;
+    try {
+      serviceClass = Class.forName("org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory");
+    }
+    catch (ClassNotFoundException e) {
+      try {
+        serviceClass = Class.forName("org.jbpm.jms.JmsConnectorServiceFactory");
+      }
+      catch (ClassNotFoundException e2) {
+        throw new AssertionError(e2);
+      }
+    }
+    assertSame(serviceClass,
+      jbpmConfiguration.getServiceFactory(Services.SERVICENAME_SCHEDULER).getClass());
   }
 }

Deleted: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/resources/jndi.properties
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/resources/jndi.properties	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/resources/jndi.properties	2010-09-26 00:44:51 UTC (rev 6683)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://@jboss.bind.address@:1099

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/webapp/WEB-INF/jboss-web.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/webapp/WEB-INF/jboss-web.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/webapp/WEB-INF/jboss-web.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -20,6 +20,6 @@
 
   <message-destination-ref>
     <message-destination-ref-name>jms/JobQueue</message-destination-ref-name>
-    <jndi-name>jnp://${jboss.bind.address}:1100/queue/JbpmJobQueue</jndi-name>
+    <jndi-name>queue/JbpmJobQueue</jndi-name>
   </message-destination-ref>
 </jboss-web>


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5
___________________________________________________________________
Name: svn:ignore
   + target
.settings


Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/.classpath
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/.classpath	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/.classpath	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/.project
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/.project	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/.project	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jbpm-ejb3</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,78 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <name>jBPM3 - EJB3</name>
+  <groupId>org.jbpm.jbpm3</groupId>
+  <artifactId>jbpm-enterprise-jee5</artifactId>
+  <packaging>ejb</packaging>
+
+  <parent>
+    <groupId>org.jbpm.jbpm3</groupId>
+    <artifactId>jbpm</artifactId>
+    <version>3.2.10-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+      	<artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>assembly-config</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <descriptors>
+                <descriptor>scripts/assembly-config.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.jbpm.jbpm3</groupId>
+      <artifactId>jbpm-jpdl</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.jms</groupId>
+      <artifactId>jms</artifactId>
+      <version>1.1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.ejb</groupId>
+      <artifactId>ejb-api</artifactId>
+      <version>3.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.annotation</groupId>
+      <artifactId>jsr250-api</artifactId>
+      <version>1.0</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/pom.xml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/scripts/assembly-config.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/scripts/assembly-config.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/scripts/assembly-config.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!-- ====================================================================== -->
+<!--  jBPM: Workflow in Java                                                -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!-- ====================================================================== -->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+  <id>config</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <fileSets>
+    <fileSet>
+      <directory>${basedir}/src/main/etc</directory>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/scripts/assembly-config.xml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/hibernate.extra.hbm.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/hibernate.extra.hbm.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/hibernate.extra.hbm.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping PUBLIC
+      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+   <!-- ################################################## -->
+   <!-- # Additional mappings defined per module go here # -->
+   <!-- ################################################## -->
+  
+</hibernate-mapping>


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/hibernate.extra.hbm.xml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.cfg.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.cfg.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.cfg.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,40 @@
+<jbpm-configuration>
+
+  <bean name="jbpm.jms.connector.service" class="org.jbpm.jms.JmsConnectorServiceFactory"
+    singleton="true">
+    <field name="jbpmConfiguration">
+      <ref bean="jbpm.configuration" />
+    </field>
+  </bean>
+
+  <jbpm-context>
+    <service name="persistence" factory="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory" />
+    <service name="message">
+      <factory>
+        <ref bean="jbpm.jms.connector.service" />
+      </factory>
+    </service>
+    <service name="scheduler">
+      <factory>
+        <ref bean="jbpm.jms.connector.service" />
+      </factory>
+    </service>
+    <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
+    <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
+    <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
+  </jbpm-context>
+
+  <!-- employ the context class loader -->
+  <string name="jbpm.class.loader" value="context" />
+
+  <!-- High-availability JNDI properties (begin) ===
+  <string name="resource.jndi.properties" value="jbpm.jndi.properties" />
+  ==== High-availability JNDI properties (end) -->
+
+  <!--
+    There should be no job executor in the enterprise configuration.
+    The message and scheduler services are both bound to JMS. 
+  -->  
+  <null name="jbpm.job.executor" />
+
+</jbpm-configuration>


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.cfg.xml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.jndi.properties
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.jndi.properties	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.jndi.properties	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,2 @@
+java.naming.provider.url=jnp://${jboss.bind.address}:1100,jnp://${jboss.bind.address}
+jnp.partitionName=${jboss.partition.name}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/etc/jbpm.jndi.properties
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/LocalCommandService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/LocalCommandService.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/LocalCommandService.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.ejb;
+
+import javax.ejb.Local;
+
+import org.jbpm.command.CommandService;
+
+ at Local
+public interface LocalCommandService extends CommandService {
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/LocalCommandService.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,215 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.ejb.impl;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.EJB;
+import javax.ejb.MessageDriven;
+import javax.ejb.MessageDrivenContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jbpm.JbpmException;
+import org.jbpm.command.Command;
+import org.jbpm.ejb.LocalCommandService;
+import org.jbpm.persistence.db.DbPersistenceService;
+import org.jbpm.persistence.db.StaleObjectLogConfigurer;
+
+/**
+ * This message-driven bean listens for {@link ObjectMessage object messages} containing a
+ * command instance. The received commands are executed by the {@link CommandServiceBean command
+ * service} bean, using the local interface.
+ * 
+ * The body of the message must be a Java object that implements the {@link Command} interface.
+ * The message properties, if any, are ignored.
+ * 
+ * <h3>Environment</h3>
+ * 
+ * <p>
+ * The environment entries and resources available for customization are summarized in the table
+ * below.
+ * </p>
+ * 
+ * <table border="1">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><code>ejb/LocalCommandService</code></td>
+ * <td>EJB Reference</td>
+ * <td>Link to the local {@linkplain CommandServiceBean session bean} that executes commands on
+ * a separate jBPM context.</td>
+ * </tr>
+ * <tr>
+ * <td><code>jms/JbpmConnectionFactory</code></td>
+ * <td>Resource Manager Reference</td>
+ * <td>Logical name of the factory that provides JMS connections for producing result messages.
+ * Required for command messages that indicate a reply destination.</td>
+ * </tr>
+ * </table>
+ * 
+ * @author Alejandro Guizar
+ */
+ at MessageDriven(activationConfig = {
+  @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
+})
+public class CommandListenerBean implements MessageListener {
+
+  private static final long serialVersionUID = 1L;
+
+  @Resource
+  private MessageDrivenContext messageDrivenContext;
+  @EJB(name = "ejb/LocalCommandService")
+  private LocalCommandService commandService;
+  @Resource(name = "jms/JbpmConnectionFactory")
+  private ConnectionFactory jmsConnectionFactory;
+
+  private Connection jmsConnection;
+
+  private static final Log log = LogFactory.getLog(CommandListenerBean.class);
+
+  @PostConstruct
+  void createConnection() {
+    Object cs = messageDrivenContext.lookup("ejb/LocalCommandService");
+    if (!(cs instanceof LocalCommandService)) {
+      throw new AssertionError(cs);
+    }
+    try {
+      jmsConnection = jmsConnectionFactory.createConnection();
+    }
+    catch (JMSException e) {
+      throw new JbpmException("failed to create jms connection", e);
+    }
+  }
+
+  @PreDestroy
+  void closeConnection() {
+    if (jmsConnection != null) {
+      try {
+        jmsConnection.close();
+      }
+      catch (JMSException e) {
+        log.debug("failed to close jms connection", e);
+      }
+    }
+  }
+
+  public void onMessage(Message message) {
+    try {
+      // extract command from message
+      Command command = extractCommand(message);
+      if (command == null) return;
+      try {
+        // execute command via local command executor bean
+        Object result = commandService.execute(command);
+        // send a response back if a "reply to" destination is set
+        Destination replyTo = message.getJMSReplyTo();
+        if (replyTo != null && (result instanceof Serializable || result == null)) {
+          sendResult((Serializable) result, replyTo, message.getJMSMessageID());
+        }
+      }
+      catch (RuntimeException e) {
+        // MDBs are not supposed to throw exceptions
+        messageDrivenContext.setRollbackOnly();
+        // if this is a locking exception, keep it quiet
+        if (DbPersistenceService.isLockingException(e)) {
+          StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error("failed to execute "
+            + command,
+            e);
+        }
+        else {
+          log.error("failed to execute " + command, e);
+        }
+      }
+    }
+    catch (JMSException e) {
+      messageDrivenContext.setRollbackOnly();
+      log.error("failed to process message " + message, e);
+    }
+  }
+
+  /**
+   * Retrieves a {@link Command} instance from the given message, which is assumed to be an
+   * {@link ObjectMessage}.
+   * <p>
+   * Subclasses may override this method to materialize the command in some other way.
+   * </p>
+   */
+  protected Command extractCommand(Message message) throws JMSException {
+    if (message instanceof ObjectMessage) {
+      ObjectMessage objectMessage = (ObjectMessage) message;
+      Serializable object = objectMessage.getObject();
+      if (object instanceof Command) {
+        return (Command) object;
+      }
+      else {
+        log.warn("not a command: " + object);
+      }
+    }
+    else {
+      log.warn("not an object message: " + message);
+    }
+    return null;
+  }
+
+  private void sendResult(Serializable result, Destination destination, String correlationId)
+    throws JMSException {
+    if (log.isDebugEnabled()) log.debug("sending " + result + " to " + destination);
+    Session jmsSession = createSession();
+    try {
+      Message resultMessage = jmsSession.createObjectMessage(result);
+      resultMessage.setJMSCorrelationID(correlationId);
+      jmsSession.createProducer(destination).send(resultMessage);
+    }
+    finally {
+      jmsSession.close();
+    }
+  }
+
+  private Session createSession() throws JMSException {
+    if (jmsConnection == null) {
+      jmsConnection = jmsConnectionFactory.createConnection();
+    }
+    /*
+     * if the connection supports xa, the session will be transacted, else the session will auto
+     * acknowledge; in either case no explicit transaction control must be performed - see ejb
+     * 2.1 - 17.3.5
+     */
+    return jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+  }
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandListenerBean.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.ejb.impl;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+import javax.jms.ConnectionFactory;
+import javax.jms.Queue;
+import javax.sql.DataSource;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.JbpmException;
+import org.jbpm.command.Command;
+import org.jbpm.ejb.LocalCommandService;
+import org.jbpm.jms.JmsConnectorServiceFactory;
+import org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory;
+
+/**
+ * Stateless session bean that executes {@linkplain Command commands} by calling their
+ * {@link Command#execute(JbpmContext) execute} method on a separate {@link JbpmContext jBPM
+ * context}.
+ * 
+ * <h3>Environment</h3>
+ * 
+ * <p>
+ * The environment entries and resources available for customization are summarized in the table
+ * below.
+ * </p>
+ * 
+ * <table border="1">
+ * <tr>
+ * <th>Name</th>
+ * <th>Type</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td><code>JbpmCfgResource</code></td>
+ * <td>Environment Entry</td>
+ * <td>The classpath resource from which to read the {@linkplain JbpmConfiguration jBPM
+ * configuration}. Optional, defaults to <code>
+ * jbpm.cfg.xml</code>.</td>
+ * </tr>
+ * <tr>
+ * <td><code>jdbc/JbpmDataSource</code></td>
+ * <td>Resource Manager Reference</td>
+ * <td>Logical name of the data source that provides JDBC connections to the
+ * {@linkplain JtaDbPersistenceServiceFactory persistence service}. Must match the
+ * <code>hibernate.connection.datasource</code> property in the Hibernate configuration file.</td>
+ * </tr>
+ * <tr>
+ * <td><code>jms/JbpmConnectionFactory</code></td>
+ * <td>Resource Manager Reference</td>
+ * <td>Logical name of the factory that provides JMS connections to the
+ * {@linkplain JmsConnectorServiceFactory JMS connector service}. Required for processes that
+ * contain asynchronous continuations.</td>
+ * </tr>
+ * <tr>
+ * <td><code>jms/JobQueue</code></td>
+ * <td>Message Destination Reference</td>
+ * <td>The message service sends job messages to the queue referenced here. To ensure this is
+ * the same queue from which the {@linkplain JobListenerBean job listener bean} receives
+ * messages, the <code>message-destination-link</code> points to a common logical destination,
+ * <code>JobQueue</code>.</td>
+ * </tr>
+ * </table>
+ * 
+ * @author Alejandro Guizar
+ */
+ at Stateless
+ at Resources(value = {
+  @Resource(name = "jdbc/JbpmDataSource", type = DataSource.class),
+  @Resource(name = "jms/JbpmConnectionFactory", type = ConnectionFactory.class),
+  @Resource(name = "jms/JobQueue", type = Queue.class)
+})
+public class CommandServiceBean implements LocalCommandService {
+
+  private static final long serialVersionUID = 1L;
+
+  @Resource
+  private SessionContext sessionContext;
+  @Resource(name = "JbpmCfgResource")
+  private String jbpmCfgResource;
+
+  private JbpmConfiguration jbpmConfiguration;
+
+  /**
+   * Creates the {@link JbpmConfiguration} to be used by this command service. In case the
+   * environment key <code>JbpmCfgResource</code> is specified, that value is interpreted as the
+   * name of the configuration resource to load from the classpath. If that key is absent, the
+   * default configuration file will be used (jbpm.cfg.xml).
+   */
+  @PostConstruct
+  void createConfiguration() {
+    jbpmConfiguration = JbpmConfiguration.getInstance(jbpmCfgResource);
+  }
+
+  public Object execute(Command command) {
+    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+    try {
+      Object result = command.execute(jbpmContext);
+      // check whether command requested a rollback
+      if (jbpmContext.getServices().getTxService().isRollbackOnly()) {
+        sessionContext.setRollbackOnly();
+      }
+      return result;
+    }
+    catch (RuntimeException e) {
+      throw e;
+    }
+    catch (Exception e) {
+      throw new JbpmException("failed to execute " + command, e);
+    }
+    finally {
+      jbpmContext.close();
+    }
+  }
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/CommandServiceBean.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.ejb.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jbpm.JbpmContext;
+import org.jbpm.command.Command;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.job.Job;
+import org.jbpm.job.Timer;
+import org.jbpm.scheduler.SchedulerService;
+
+/**
+ * Individual job processing command.
+ * 
+ * @author Alejandro Guizar
+ */
+public class ExecuteJobCommand implements Command {
+
+  private final long jobId;
+
+  private static final long serialVersionUID = 1L;
+  private static final Log log = LogFactory.getLog(ExecuteJobCommand.class.getName());
+
+  public ExecuteJobCommand(long jobId) {
+    this.jobId = jobId;
+  }
+
+  public Object execute(JbpmContext jbpmContext) throws Exception {
+    Job job = acquireJob(jobId, jbpmContext);
+    if (job != null) executeJob(job, jbpmContext);
+    return job;
+  }
+
+  private static Job acquireJob(long jobId, JbpmContext jbpmContext) {
+    boolean debug = log.isDebugEnabled();
+    if (debug) log.debug("acquiring job: " + jobId);
+    Job job = jbpmContext.getJobSession().getJob(jobId);
+
+    // job could have been deleted manually
+    // or by ending the process instance
+    if (job != null) {
+      // register process instance for automatic save
+      // see https://jira.jboss.org/jira/browse/JBPM-1015
+      ProcessInstance processInstance = job.getProcessInstance();
+      jbpmContext.addAutoSaveProcessInstance(processInstance);
+
+      // if job is exclusive, lock process instance
+      if (job.isExclusive()) {
+        jbpmContext.getGraphSession().lockProcessInstance(processInstance);
+      }
+
+      // mark job as locked to prevent it from being deleted
+      job.setLockOwner(Thread.currentThread().getName());
+      if (debug) log.debug("acquired " + job);
+    }
+    else {
+      log.warn("job not found: " + jobId);
+    }
+
+    return job;
+  }
+
+  private static void executeJob(Job job, JbpmContext jbpmContext) throws Exception {
+    if (log.isDebugEnabled()) log.debug("executing " + job);
+    if (job.execute(jbpmContext)) {
+      if (job instanceof Timer) {
+        Timer timer = (Timer) job;
+        SchedulerService schedulerService = jbpmContext.getServices().getSchedulerService();
+        // if the timer has repeat
+        if (timer.getRepeat() != null) {
+          // create a new timer
+          if (log.isDebugEnabled()) {
+            log.debug("scheduling timer for repeat on " + timer.getDueDate());
+          }
+          schedulerService.createTimer(timer);
+        }
+        else {
+          // clear timer
+          schedulerService.deleteTimer((Timer) job);
+        }
+      }
+      else {
+        // clear job
+        jbpmContext.getJobSession().deleteJob(job);
+      }
+    }
+  }
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,48 @@
+package org.jbpm.ejb.impl;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jbpm.command.Command;
+
+/**
+ * Message-driven bean that listens for {@link Message messages} containing a reference to a
+ * pending {@linkplain org.jbpm.job.Job job} for asynchronous continuations.
+ * <p>
+ * The message must have a <code>long</code> property called <code>jobId</code> which identifies
+ * a job in the database. The message body, if any, is ignored.
+ * </p>
+ * <h3>Environment</h3>
+ * <p>
+ * This bean inherits its environment entries and resources available for customization from
+ * {@link CommandListenerBean}.
+ * </p>
+ * 
+ * @author Alejandro Guizar
+ */
+ at MessageDriven(messageListenerInterface = MessageListener.class, activationConfig = {
+  @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
+})
+public class JobListenerBean extends CommandListenerBean {
+
+  private static final long serialVersionUID = 1L;
+  private static final Log log = LogFactory.getLog(JobListenerBean.class);
+
+  protected Command extractCommand(Message message) throws JMSException {
+    // checking for jobId property
+    if (message.propertyExists("jobId")) {
+      long jobId = message.getLongProperty("jobId");
+      return new ExecuteJobCommand(jobId);
+    }
+    else {
+      log.warn("property jobId not found");
+    }
+    return null;
+  }
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.jms;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jbpm.JbpmContext;
+import org.jbpm.JbpmException;
+import org.jbpm.db.JobSession;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.exe.Token;
+import org.jbpm.job.Job;
+import org.jbpm.job.Timer;
+import org.jbpm.msg.MessageService;
+import org.jbpm.scheduler.SchedulerService;
+
+public class JmsConnectorService implements MessageService, SchedulerService {
+
+  private static final long serialVersionUID = 1L;
+
+  private static final Log log = LogFactory.getLog(JmsConnectorService.class);
+
+  private final JobSession jobSession;
+
+  private final Connection connection;
+  private final Session session;
+  private final MessageProducer messageProducer;
+
+  public JmsConnectorService(JmsConnectorServiceFactory factory) throws JMSException {
+    JbpmContext jbpmContext = factory.getJbpmConfiguration().getCurrentJbpmContext();
+    if (jbpmContext == null) throw new JbpmException("no active jbpm context");
+    jobSession = jbpmContext.getJobSession();
+
+    this.connection = factory.getConnectionFactory().createConnection();
+    /*
+     * if the connection supports xa, the session will be transacted, else the session will auto
+     * acknowledge; in either case no explicit transaction control must be performed - see ejb
+     * 2.1 - 17.3.5
+     */
+    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+    messageProducer = session.createProducer(factory.getDestination());
+  }
+
+  public Session getSession() {
+    return session;
+  }
+
+  public void send(Job job) {
+    jobSession.saveJob(job);
+
+    try {
+      Message message = session.createMessage();
+      populateMessage(message, job);
+      messageProducer.send(message);
+    }
+    catch (JMSException e) {
+      throw new JbpmException("could not send jms message", e);
+    }
+  }
+
+  protected void populateMessage(Message message, Job job) throws JMSException {
+    message.setLongProperty("jobId", job.getId());
+
+    if (job instanceof Timer) {
+      Timer timer = (Timer) job;
+      message.setLongProperty("JMS_JBOSS_SCHEDULED_DELIVERY", timer.getDueDate().getTime());
+    }
+  }
+
+  public void createTimer(Timer timer) {
+    send(timer);
+  }
+
+  public void deleteTimer(Timer timer) {
+    jobSession.deleteJob(timer);
+  }
+
+  public void deleteTimersByName(String timerName, Token token) {
+    jobSession.deleteTimersByName(timerName, token);
+  }
+
+  public void deleteTimersByProcessInstance(ProcessInstance processInstance) {
+    jobSession.deleteJobsForProcessInstance(processInstance);
+  }
+
+  public void close() {
+    try {
+      messageProducer.close();
+    }
+    catch (JMSException e) {
+      log.warn("could not close message producer", e);
+    }
+
+    try {
+      session.close();
+    }
+    catch (JMSException e) {
+      log.warn("could not close jms session", e);
+    }
+
+    try {
+      connection.close();
+    }
+    catch (JMSException e) {
+      log.warn("could not close jms connection", e);
+    }
+  }
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorServiceFactory.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorServiceFactory.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorServiceFactory.java	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.jms;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.JbpmException;
+import org.jbpm.svc.Service;
+import org.jbpm.svc.ServiceFactory;
+import org.jbpm.util.JndiUtil;
+
+/**
+ * The JMS connector service leverages the reliable communication infrastructure available through
+ * JMS interfaces to deliver asynchronous continuation messages to the {@link JobListenerBean}.
+ * 
+ * <h3>Configuration</h3>
+ * 
+ * The JMS connector service factory exposes the following configurable fields.
+ * 
+ * <ul>
+ * <li><code>connectionFactoryJndiName</code></li>
+ * <li><code>destinationJndiName</code></li>
+ * <li><code>isCommitEnabled</code></li>
+ * </ul>
+ * 
+ * Refer to the jBPM manual for details.
+ * 
+ * @author Tom Baeyens
+ * @author Alejandro Guizar
+ */
+public class JmsConnectorServiceFactory implements ServiceFactory {
+
+  private static final long serialVersionUID = 1L;
+
+  private String connectionFactoryJndiName = "java:comp/env/jms/JbpmConnectionFactory";
+  private String destinationJndiName = "java:comp/env/jms/JobQueue";
+
+  private JbpmConfiguration jbpmConfiguration;
+
+  private ConnectionFactory connectionFactory;
+  private Destination destination;
+
+  public synchronized ConnectionFactory getConnectionFactory() {
+    if (connectionFactory == null) {
+      connectionFactory = (ConnectionFactory) JndiUtil.lookup(connectionFactoryJndiName, ConnectionFactory.class);
+    }
+    return connectionFactory;
+  }
+
+  public synchronized Destination getDestination() {
+    if (destination == null) {
+      destination = (Destination) JndiUtil.lookup(destinationJndiName, Destination.class);
+    }
+    return destination;
+  }
+
+  public JbpmConfiguration getJbpmConfiguration() {
+    // in case this field is not initialized in jbpm configuration
+    if (jbpmConfiguration == null) {
+      JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
+      if (jbpmContext == null) throw new JbpmException("no active jbpm context");
+      jbpmConfiguration = jbpmContext.getJbpmConfiguration();
+    }
+    return jbpmConfiguration;
+  }
+
+  public Service openService() {
+    try {
+      return new JmsConnectorService(this);
+    }
+    catch (JMSException e) {
+      throw new JbpmException("could not open message service", e);
+    }
+  }
+
+  public void close() {
+    connectionFactory = null;
+    destination = null;
+  }
+
+}


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorServiceFactory.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/ejb-jar.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/ejb-jar.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/ejb-jar.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+    http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+  <enterprise-beans>
+    <session>
+      <description>Executes commands in a separate context.</description>
+      <display-name>jBPM Command Service</display-name>
+      <ejb-name>CommandServiceBean</ejb-name>
+
+      <resource-ref>
+        <description>
+          Data source that provides the persistence service with connections.
+          Must match property hibernate.connection.datasource in the Hibernate configuration.
+        </description>
+        <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
+        <mapped-name>java:JbpmDS</mapped-name>
+      </resource-ref>
+
+      <resource-ref>
+        <description>
+          Connection factory that provides JMS connections to the message service.
+          Required for processes that contain asynchronous continuations.
+        </description>
+        <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
+        <mapped-name>java:JmsXA</mapped-name>
+      </resource-ref>
+
+      <message-destination-ref>
+        <description>
+          The message service sends job messages to the queue referenced here. To ensure this is the
+          same queue from which the JobListenerBean receives messages, the message-destination-link
+          element points to a common logical destination, JobQueue.
+        </description>
+        <message-destination-ref-name>jms/JobQueue</message-destination-ref-name>
+        <message-destination-usage>Produces</message-destination-usage>
+        <mapped-name>queue/JbpmJobQueue</mapped-name>
+      </message-destination-ref>
+    </session>
+
+    <message-driven>
+      <description>
+        Listens for serialized commands and routes them to the command service session bean.
+      </description>
+      <display-name>jBPM Command Listener</display-name>
+      <ejb-name>CommandListenerBean</ejb-name>
+      <mapped-name>queue/JbpmCommandQueue</mapped-name>
+
+      <resource-ref>
+        <description>
+          Logical name of the factory that provides JMS connections for producing result messages.
+          Required for command messages that indicate a reply destination.
+        </description>
+        <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
+        <mapped-name>java:JmsXA</mapped-name>
+      </resource-ref>
+    </message-driven>
+
+    <message-driven>
+      <description>
+        Listens for job references and delegates execution of the referenced Job to the command
+        service session bean.
+      </description>
+      <display-name>jBPM Job Listener</display-name>
+      <ejb-name>JobListenerBean</ejb-name>
+      <mapped-name>queue/JbpmJobQueue</mapped-name>
+
+      <resource-ref>
+        <description>
+          Logical name of the factory that provides JMS connections for producing result messages.
+          Required for command messages that indicate a reply destination.
+        </description>
+        <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
+        <mapped-name>java:JmsXA</mapped-name>
+      </resource-ref>
+    </message-driven>
+  </enterprise-beans>
+</ejb-jar>


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/ejb-jar.xml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/jboss.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/jboss.xml	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/jboss.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 5.0//EN"
+  "http://www.jboss.org/j2ee/dtd/jboss_5_0.dtd">
+<jboss>
+  <enterprise-beans>
+    <session>
+      <ejb-name>CommandServiceBean</ejb-name>
+      <local-jndi-name>java:jbpm/CommandServiceBean</local-jndi-name>
+    </session>
+  </enterprise-beans>
+</jboss>


Property changes on: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/resources/META-INF/jboss.xml
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: jbpm3/branches/jbpm-3.2-soa/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/pom.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/pom.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -35,6 +35,7 @@
     <module>core</module>
     <module>identity</module>
     <module>enterprise</module>
+    <module>enterprise-jee5</module>
     <module>examples</module>
     <module>simulation</module>
   </modules>
@@ -66,9 +67,8 @@
       </dependency>
       <dependency>
         <groupId>org.jbpm.jbpm3</groupId>
-        <artifactId>jsf-console</artifactId>
+        <artifactId>jsf-console-jee5</artifactId>
         <version>${project.version}</version>
-        <classifier>soa</classifier>
         <type>war</type>
       </dependency>
       <dependency>

Modified: jbpm3/branches/jbpm-3.2-soa/soa-distribution/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/soa-distribution/pom.xml	2010-09-26 00:38:17 UTC (rev 6682)
+++ jbpm3/branches/jbpm-3.2-soa/soa-distribution/pom.xml	2010-09-26 00:44:51 UTC (rev 6683)
@@ -10,7 +10,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <name>jBPM3-  Build distribution for SOA-P </name>
+  <name>jBPM3 - SOA Distribution</name>
   <groupId>org.jbpm.jbpm3</groupId>
   <artifactId>jbpm-soa-distribution</artifactId>
   <packaging>pom</packaging>



More information about the jbpm-commits mailing list