[jbpm-commits] JBoss JBPM SVN: r5722 - in jbpm4/branches/tbaeyens: modules and 30 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Oct 9 09:49:13 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-10-09 09:49:12 -0400 (Fri, 09 Oct 2009)
New Revision: 5722

Added:
   jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/jboss/config/
   jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/jboss/config/deploy/
   jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/jboss/config/deploy/jbpm/
   jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/jboss/config/deploy/jbpm/jbpm-destinations-service.xml
   jbpm4/branches/tbaeyens/modules/jboss/
   jbpm4/branches/tbaeyens/modules/jboss/.classpath
   jbpm4/branches/tbaeyens/modules/jboss/.project
   jbpm4/branches/tbaeyens/modules/jboss/pom.xml
   jbpm4/branches/tbaeyens/modules/jboss/src/
   jbpm4/branches/tbaeyens/modules/jboss/src/main/
   jbpm4/branches/tbaeyens/modules/jboss/src/main/java/
   jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/
   jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/jbpm/
   jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/jbpm/jboss/
   jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/jbpm/jboss/internal/
   jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/jbpm/jboss/internal/JbpmService.java
   jbpm4/branches/tbaeyens/modules/jboss/target/
   jbpm4/branches/tbaeyens/modules/jboss/target/classes/
   jbpm4/branches/tbaeyens/modules/jboss/target/classes/org/
   jbpm4/branches/tbaeyens/modules/jboss/target/classes/org/jbpm/
   jbpm4/branches/tbaeyens/modules/jboss/target/classes/org/jbpm/jboss/
   jbpm4/branches/tbaeyens/modules/jboss/target/classes/org/jbpm/jboss/internal/
   jbpm4/branches/tbaeyens/modules/jboss/target/classes/org/jbpm/jboss/internal/JbpmService.class
Removed:
   jbpm4/branches/tbaeyens/modules/integration/.project
   jbpm4/branches/tbaeyens/modules/integration/jboss4/
   jbpm4/branches/tbaeyens/modules/integration/jboss5/
   jbpm4/branches/tbaeyens/modules/integration/spi/
Modified:
   jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/api/Configuration.java
   jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java
   jbpm4/branches/tbaeyens/modules/distro/pom.xml
   jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/build.xml
   jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/cfg/jbpm/jta.testsuite.jbpm.cfg.xml
   jbpm4/branches/tbaeyens/modules/integration/form-plugin/pom.xml
   jbpm4/branches/tbaeyens/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/AbstractFormDispatcher.java
   jbpm4/branches/tbaeyens/modules/integration/graphView-plugin/pom.xml
   jbpm4/branches/tbaeyens/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java
   jbpm4/branches/tbaeyens/modules/integration/pom.xml
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java
   jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobExecutorBinding.java
   jbpm4/branches/tbaeyens/pom.xml
Log:
simplified jboss integration

Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/api/Configuration.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/api/Configuration.java	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/api/Configuration.java	2009-10-09 13:49:12 UTC (rev 5722)
@@ -38,7 +38,7 @@
   
   static Map<String, String> implementationClassNames = null;
 
-  Configuration impl;
+  transient Configuration impl;
   
   /** 
    * Cached processEngine instance used by the 

Modified: jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/api/src/main/java/org/jbpm/api/ProcessEngine.java	2009-10-09 13:49:12 UTC (rev 5722)
@@ -83,6 +83,11 @@
    * a service method in the same thread.
    * This method returns the process engine for convenient method concatenations. */
   ProcessEngine setJdbcConnection(Connection jdbcConnection);
-  
+
+  /** perform a user command.  that allows users to span a transaction over
+   * their own updates, as well as the jbpm operations. */
   <T> T execute(Command<T> command);
+
+  /** clean shutdown of the engine. */
+  void close();
 }

Modified: jbpm4/branches/tbaeyens/modules/distro/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/pom.xml	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/distro/pom.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -65,14 +65,10 @@
     </dependency>
     <dependency>
       <groupId>org.jbpm.jbpm4</groupId>
-      <artifactId>jbpm-jboss4</artifactId>
+      <artifactId>jbpm-jboss</artifactId>      
     </dependency>
     <dependency>
       <groupId>org.jbpm.jbpm4</groupId>
-      <artifactId>jbpm-jboss5</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.jbpm.jbpm4</groupId>
       <artifactId>jbpm-tomcat6</artifactId>
     </dependency>
     <dependency>
@@ -94,10 +90,6 @@
     </dependency>
     <dependency>
       <groupId>org.jbpm.jbpm4</groupId>
-      <artifactId>jbpm-spi</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.jbpm.jbpm4</groupId>
       <artifactId>jbpm-test-db</artifactId>
       <classifier>tests</classifier>
     </dependency>

Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/build.xml	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/build.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -271,7 +271,7 @@
           description="Installs jBPM into JBoss">
     <!-- copy static configuration files -->
     <copy todir="${jboss.server.config.dir}" overwrite="true">
-       <fileset dir="${jbpm.home}/install/src/jboss/config.common" />
+       <fileset dir="${jbpm.home}/install/src/jboss/config" />
     </copy>
 
     <!-- copy the right hibernate configuration file -->
@@ -295,14 +295,10 @@
       <fileset dir="${jbpm.home}/lib">
         <include name="gwt-console-server-integration.jar" />
         <include name="gwt-console-rpc.jar" />
+        <include name="jbpm-jboss.jar" />
       </fileset>
     </copy>
     
-    <!-- Copy Signavio war into /webapps
-    commented cause it doesn't seem to run on jdk 5
-    <antcall target="install.signavio.into.jboss" />
-    -->
-
     <copy todir="${jboss.server.config.dir}/deploy/jbpm" overwrite="true">
       <fileset dir="${jbpm.home}/lib">
         <include name="gwt-console-jbpm.war" />
@@ -332,29 +328,6 @@
     <unzip src="${jbpm.home}/lib/report-engine.zip" dest="${birt.dir}"/>
     <unzip src="${jbpm.home}/lib/jbpm-console-reports.jar" dest="${birt.dir}"/>
 
-    <!-- copy static configuration files -->
-    <copy todir="${jboss.server.config.dir}" overwrite="true">
-       <fileset dir="${jbpm.home}/install/src/jboss/config.jboss5" />
-    </copy>
-
-    <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar" overwrite="true">
-      <fileset dir="${jbpm.home}/lib">
-        <include name="jbpm-spi.jar"/>
-      </fileset>
-    </copy>
-
-    <copy todir="${jboss.server.config.dir}/deployers/jbpm.deployer" overwrite="true">
-      <fileset dir="${jbpm.home}/lib">
-        <include name="jbpm-jboss5.jar"/>
-      </fileset>
-    </copy>
-
-    <copy todir="${jboss.server.config.dir}/deployers/jbpm.deployer" overwrite="true">
-      <fileset dir="${jbpm.home}/lib">
-        <include name="jbpm-spi.jar"/>
-      </fileset>
-    </copy>
-
     <property name="container.lib.dir" value="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar" />
     <antcall target="internal.copy.database.driver" />
   </target>

Modified: jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/cfg/jbpm/jta.testsuite.jbpm.cfg.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/cfg/jbpm/jta.testsuite.jbpm.cfg.xml	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/cfg/jbpm/jta.testsuite.jbpm.cfg.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<jbpm-configuration>
+<jbpm-configuration jndi-name="java:/ProcessEngine">
 
   <import resource="jbpm.default.cfg.xml" />
   <import resource="jbpm.tx.jta.cfg.xml" />

Added: jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/jboss/config/deploy/jbpm/jbpm-destinations-service.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/jboss/config/deploy/jbpm/jbpm-destinations-service.xml	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/jboss/config/deploy/jbpm/jbpm-destinations-service.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  This file defines the default queue that jBPM ships with. You can add other
+  destinations to this file, or you can create other *-service.xml files to
+  contain your application's destinations.
+-->
+<server>
+
+  <!--
+    The default command queue. This destination is used by the
+    JmsMessageSession.
+  -->
+  <mbean code="org.jboss.jms.server.destination.QueueService"
+    name="jboss.messaging.destination:service=Queue,name=JbpmCommandQueue"
+    xmbean-dd="xmdesc/Queue-xmbean.xml">
+    <depends optional-attribute-name="ServerPeer">
+      jboss.messaging:service=ServerPeer
+    </depends>
+    <depends>jboss.messaging:service=PostOffice</depends>
+  </mbean>
+
+</server>
\ No newline at end of file


Property changes on: jbpm4/branches/tbaeyens/modules/distro/src/main/files/install/src/jboss/config/deploy/jbpm/jbpm-destinations-service.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: jbpm4/branches/tbaeyens/modules/integration/.project
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/.project	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/integration/.project	2009-10-09 13:49:12 UTC (rev 5722)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>jbpm-integration</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.maven.ide.eclipse.maven2Builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.maven.ide.eclipse.maven2Nature</nature>
-	</natures>
-</projectDescription>

Modified: jbpm4/branches/tbaeyens/modules/integration/form-plugin/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/form-plugin/pom.xml	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/integration/form-plugin/pom.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -30,12 +30,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.jbpm.jbpm4</groupId>
-      <artifactId>jbpm-spi</artifactId>
-      <scope>provided</scope>
-      <version>${version}</version>
-    </dependency>
-    <dependency>
       <groupId>org.jboss.bpm</groupId>
       <artifactId>gwt-console-server-integration</artifactId>
       <scope>provided</scope>

Modified: jbpm4/branches/tbaeyens/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/AbstractFormDispatcher.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/AbstractFormDispatcher.java	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/integration/form-plugin/src/main/java/org/jbpm/integration/console/forms/AbstractFormDispatcher.java	2009-10-09 13:49:12 UTC (rev 5722)
@@ -21,20 +21,27 @@
  */
 package org.jbpm.integration.console.forms;
 
-import freemarker.template.DefaultObjectWrapper;
-import freemarker.template.Template;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Map;
 
-import org.jbpm.api.Configuration;
-import org.jbpm.api.ProcessEngine;
-import org.jbpm.integration.spi.mgmt.ServerConfig;
-import org.jbpm.integration.spi.mgmt.ServerConfigFactory;
-
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
 import javax.naming.InitialContext;
-import java.io.*;
-import java.util.Map;
 
+import org.jbpm.api.Configuration;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessEngine;
+
+import freemarker.template.DefaultObjectWrapper;
+import freemarker.template.Template;
+
 /**
  * Base class for freemarker based form dispatcher implementations that should
  * run on JBoss. Uses {@link org.jbpm.integration.spi.mgmt.ServerConfig} to
@@ -50,9 +57,9 @@
   protected final static String WEB_CONTEXT = "/gwt-console-server/rs";
 
   protected ProcessEngine processEngine;
+  protected String webServiceHost = null;
+  protected String webServicePort = null;
 
-  protected ServerConfig serverConfig = null; // lazy
-  
   protected static final String FORM_DIRECTIVE_KEY = "form";
   
   protected static final String OUTCOME_DIRECTIVE_NAME = "outcome";
@@ -65,24 +72,28 @@
     try {
       InitialContext ctx = new InitialContext();
       this.processEngine = (ProcessEngine) ctx.lookup("java:/ProcessEngine");
+      
     } catch (Exception e) {
       // Fall back to default mechanism
       this.processEngine = Configuration.getProcessEngine();
     }
-  }
-
-  protected ServerConfig getServerConfig() {
-    if (null == serverConfig) {
-      serverConfig = ServerConfigFactory.getServerConfig();
+    
+    this.webServiceHost = (String) processEngine.get("jbpm.console.webservice.host");
+    this.webServicePort = (String) processEngine.get("jbpm.console.webservice.port");
+    
+    if ( (webServiceHost==null)
+         || (webServicePort==null)
+       ) {
+      throw new JbpmException("make sure that strings 'jbpm.console.webservice.host' and 'jbpm.console.webservice.port' are properly configured in the process-engine-context of jbpm.cfg.xml");
     }
-    return serverConfig;
   }
 
   protected StringBuilder getBaseUrl() {
     StringBuilder spec = new StringBuilder();
     spec.append("http://");
-    spec.append(getServerConfig().getWebServiceHost());
-    spec.append(":").append(getServerConfig().getWebServicePort());
+    spec.append(webServiceHost);
+    spec.append(":");
+    spec.append(webServicePort);
     spec.append(WEB_CONTEXT);
     return spec;
   }

Modified: jbpm4/branches/tbaeyens/modules/integration/graphView-plugin/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/graphView-plugin/pom.xml	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/integration/graphView-plugin/pom.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -30,12 +30,6 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.jbpm.jbpm4</groupId>
-      <artifactId>jbpm-spi</artifactId>
-      <scope>provided</scope>
-      <version>${version}</version>
-    </dependency>
-    <dependency>
       <groupId>org.jboss.bpm</groupId>
       <artifactId>gwt-console-server-integration</artifactId>
       <scope>provided</scope>

Modified: jbpm4/branches/tbaeyens/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/integration/graphView-plugin/src/main/java/org/jbpm/integration/console/graphView/GraphViewerPluginImpl.java	2009-10-09 13:49:12 UTC (rev 5722)
@@ -37,13 +37,12 @@
 import org.jboss.bpm.console.client.model.DiagramNodeInfo;
 import org.jboss.bpm.console.server.plugin.GraphViewerPlugin;
 import org.jbpm.api.Configuration;
+import org.jbpm.api.JbpmException;
 import org.jbpm.api.ProcessDefinition;
 import org.jbpm.api.ProcessEngine;
 import org.jbpm.api.ProcessInstance;
 import org.jbpm.api.RepositoryService;
 import org.jbpm.api.model.ActivityCoordinates;
-import org.jbpm.integration.spi.mgmt.ServerConfig;
-import org.jbpm.integration.spi.mgmt.ServerConfigFactory;
 
 /**
  * @author Heiko.Braun <heiko.braun at jboss.com>
@@ -53,7 +52,8 @@
   protected final static String WEB_CONTEXT = "/gwt-console-server/rs";
 
   protected ProcessEngine processEngine;
-  protected ServerConfig serverConfig = null; // lazy
+  protected String webServiceHost = null;
+  protected String webServicePort = null;
 
   public GraphViewerPluginImpl() {
     initializeProcessEngine();
@@ -63,24 +63,28 @@
     try {
       InitialContext ctx = new InitialContext();
       this.processEngine = (ProcessEngine) ctx.lookup("java:/ProcessEngine");
+      
     } catch (Exception e) {
       // Fall back to default mechanism
       this.processEngine = Configuration.getProcessEngine();
     }
-  }
-
-  protected ServerConfig getServerConfig() {
-    if (null == serverConfig) {
-      serverConfig = ServerConfigFactory.getServerConfig();
+    
+    this.webServiceHost = (String) processEngine.get("jbpm.console.webservice.host");
+    this.webServicePort = (String) processEngine.get("jbpm.console.webservice.port");
+    
+    if ( (webServiceHost==null)
+         || (webServicePort==null)
+       ) {
+      throw new JbpmException("make sure that strings 'jbpm.console.webservice.host' and 'jbpm.console.webservice.port' are properly configured in the process-engine-context of jbpm.cfg.xml");
     }
-    return serverConfig;
   }
 
   protected StringBuilder getBaseUrl() {
     StringBuilder spec = new StringBuilder();
     spec.append("http://");
-    spec.append(getServerConfig().getWebServiceHost());
-    spec.append(":").append(getServerConfig().getWebServicePort());
+    spec.append(webServiceHost);
+    spec.append(":");
+    spec.append(webServicePort);
     spec.append(WEB_CONTEXT);
     return spec;
   }

Modified: jbpm4/branches/tbaeyens/modules/integration/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/integration/pom.xml	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/integration/pom.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -117,9 +117,6 @@
   </dependencyManagement>
 
   <modules>
-    <module>spi</module>
-    <module>jboss5</module>
-    <module>jboss4</module>
     <module>console</module>
     <module>form-plugin</module>
     <module>graphView-plugin</module>

Added: jbpm4/branches/tbaeyens/modules/jboss/.classpath
===================================================================
--- jbpm4/branches/tbaeyens/modules/jboss/.classpath	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jboss/.classpath	2009-10-09 13:49:12 UTC (rev 5722)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<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>


Property changes on: jbpm4/branches/tbaeyens/modules/jboss/.classpath
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/tbaeyens/modules/jboss/.project
===================================================================
--- jbpm4/branches/tbaeyens/modules/jboss/.project	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jboss/.project	2009-10-09 13:49:12 UTC (rev 5722)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jboss</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>


Property changes on: jbpm4/branches/tbaeyens/modules/jboss/.project
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/tbaeyens/modules/jboss/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/modules/jboss/pom.xml	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jboss/pom.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>jBPM 4 - JBoss Integration</name>
+  <description>JBoss jBPM - JBoss Integration</description>
+
+  <groupId>org.jbpm.jbpm4</groupId>
+  <artifactId>jbpm-jboss</artifactId>
+  <packaging>jar</packaging>
+
+  <parent>
+    <groupId>org.jbpm.jbpm4</groupId>
+    <artifactId>jbpm</artifactId>
+    <version>4.2-SNAPSHOT</version>
+  </parent>
+
+  <!-- Properties -->
+  <properties>
+  </properties>
+
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-jpdl</artifactId>      
+    </dependency>
+  </dependencies>
+
+</project>


Property changes on: jbpm4/branches/tbaeyens/modules/jboss/pom.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/jbpm/jboss/internal/JbpmService.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/jbpm/jboss/internal/JbpmService.java	                        (rev 0)
+++ jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/jbpm/jboss/internal/JbpmService.java	2009-10-09 13:49:12 UTC (rev 5722)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jboss.internal;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.internal.log.Log;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JbpmService {
+
+  private static final Log log = Log.getLog(JbpmService.class.getName());
+
+  private ProcessEngine processEngine;
+
+  public void start() {
+    log.debug("JbpmService starting...");
+    this.processEngine = Configuration.getProcessEngine();
+    log.info("JbpmService started");
+  }
+
+  public void stop() {
+    this.processEngine.close();
+    log.info("JbpmService stopped");
+  }
+
+  public ProcessEngine getProcessEngine() {
+    return this.processEngine;
+  }
+
+  public void setDataSource(Object dataSource) {
+  }
+}


Property changes on: jbpm4/branches/tbaeyens/modules/jboss/src/main/java/org/jbpm/jboss/internal/JbpmService.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/branches/tbaeyens/modules/jboss/target/classes/org/jbpm/jboss/internal/JbpmService.class
===================================================================
(Binary files differ)


Property changes on: jbpm4/branches/tbaeyens/modules/jboss/target/classes/org/jbpm/jboss/internal/JbpmService.class
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/cfg/ProcessEngineImpl.java	2009-10-09 13:49:12 UTC (rev 5722)
@@ -23,12 +23,16 @@
 
 import java.io.File;
 import java.io.InputStream;
+import java.io.Serializable;
 import java.net.URL;
 import java.sql.Connection;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
 import org.jbpm.api.Configuration;
 import org.jbpm.api.ExecutionService;
 import org.jbpm.api.HistoryService;
@@ -47,6 +51,7 @@
 import org.jbpm.pvm.internal.env.JbpmConfigurationParser;
 import org.jbpm.pvm.internal.env.PvmEnvironment;
 import org.jbpm.pvm.internal.env.UserProvidedEnvironmentObject;
+import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
 import org.jbpm.pvm.internal.stream.FileStreamInput;
 import org.jbpm.pvm.internal.stream.InputStreamInput;
 import org.jbpm.pvm.internal.stream.ResourceStreamInput;
@@ -87,21 +92,22 @@
  * 
  * @author Tom Baeyens
  */
-public class ProcessEngineImpl extends Configuration implements Context, ProcessEngine, EnvironmentFactory {
+public class ProcessEngineImpl extends Configuration implements Context, ProcessEngine, EnvironmentFactory, Serializable {
 
   private static final long serialVersionUID = 1L;
   private static final Log log = Log.getLog(ProcessEngineImpl.class.getName());
   
   public static final String JBPM_LIBRARY_VERSION = "4.2-SNAPSHOT";
 
-  protected boolean isConfigured = false;
-  protected WireContext processEngineWireContext = new WireContext(new WireDefinition(), Context.CONTEXTNAME_PROCESS_ENGINE, true);
-  protected WireDefinition transactionWireDefinition = new WireDefinition();
+  transient protected String jndiName;
+  transient protected boolean isConfigured = false;
+  transient protected WireContext processEngineWireContext = new WireContext(new WireDefinition(), Context.CONTEXTNAME_PROCESS_ENGINE, true);
+  transient protected WireDefinition transactionWireDefinition = new WireDefinition();
   
-  protected ThreadLocal<List<UserProvidedEnvironmentObject>> userProvidedEnvironmentObjectsThreadLocal = new ThreadLocal<List<UserProvidedEnvironmentObject>>();
-  protected ThreadLocal<String> authenticatedUserIdThreadLocal = new ThreadLocal<String>();
+  transient protected ThreadLocal<List<UserProvidedEnvironmentObject>> userProvidedEnvironmentObjectsThreadLocal = new ThreadLocal<List<UserProvidedEnvironmentObject>>();
+  transient protected ThreadLocal<String> authenticatedUserIdThreadLocal = new ThreadLocal<String>();
   
-  protected CommandService userCommandService = null;
+  transient protected CommandService userCommandService = null;
   
   public ProcessEngineImpl() {
     super((Configuration)null);
@@ -111,6 +117,20 @@
     if (!isConfigured) {
       setResource("jbpm.cfg.xml");
     }
+    
+    if (jndiName!=null) {
+      try {
+        InitialContext initialContext = new InitialContext();
+        ProcessEngineImpl existing = (ProcessEngineImpl) initialContext.lookup(jndiName);
+        if (existing!=null) {
+          log.debug("found existing process engine under "+jndiName);
+          return existing;
+        }
+      } catch (NamingException e) {
+        log.debug("jndi name "+jndiName+" is not bound");
+      }
+    }
+    
     if (log.isTraceEnabled()) {
       log.trace("created ProcessEngine "+System.identityHashCode(this));
       if ( (processEngineWireContext!=null)
@@ -133,6 +153,17 @@
     }
     processEngineWireContext.create();
     userCommandService = (CommandService) processEngineWireContext.get(CommandService.NAME_TX_REQUIRED_COMMAND_SERVICE);
+
+    if (jndiName!=null) {
+      try {
+        log.debug("publishing jBPM ProcessEngine in jndi at "+jndiName);
+        InitialContext initialContext = new InitialContext();
+        initialContext.bind(jndiName, this);
+      } catch (NamingException e) {
+        throw new JbpmException("JNDI binding problem", e);
+      }
+    }
+
     return this;
   }
 
@@ -246,6 +277,11 @@
   }
 
   public void close() {
+    JobExecutor jobExecutor = get(JobExecutor.class);
+    if (jobExecutor!=null) {
+      // stop the job executor and wait till all job executor threads have stopped.
+      jobExecutor.stop(true);
+    }
     processEngineWireContext.fire(WireContext.EVENT_CLOSE, null);
   }
 
@@ -326,4 +362,11 @@
   public <T> T execute(Command<T> command) {
     return userCommandService.execute(command);
   }
+  
+  public String getJndiName() {
+    return jndiName;
+  }
+  public void setJndiName(String jndiName) {
+    this.jndiName = jndiName;
+  }
 }

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/JbpmConfigurationParser.java	2009-10-09 13:49:12 UTC (rev 5722)
@@ -57,17 +57,31 @@
     Element documentElement = document.getDocumentElement();
     
     // if the default environment factory was already set in the parse
-    ProcessEngineImpl processEngineImpl = (ProcessEngineImpl) parse.contextStackFind(ProcessEngineImpl.class);
-    if (processEngineImpl==null) {
-      processEngineImpl = new ProcessEngineImpl();
+    ProcessEngineImpl processEngine = (ProcessEngineImpl) parse.contextStackFind(ProcessEngineImpl.class);
+    if (processEngine==null) {
+      processEngine = new ProcessEngineImpl();
     }
     
+    // this code will be called for the original jbpm.cfg.xml document as 
+    // well as for the imported documents.  only one of those should specify
+    // a jndi-name.  for sure no 2 config files can specify different jndi-names
+    String jndiName = XmlUtil.attribute(documentElement, "jndi-name");
+    if (jndiName!=null) {
+      if ( (processEngine.getJndiName()!=null)
+           && (!jndiName.equals(processEngine.getJndiName()))
+         ) {
+        parse.addProblem("duplicate jndi name specification: "+jndiName+" != "+processEngine.getJndiName());
+      } else {
+        processEngine.setJndiName(jndiName);
+      }
+    }
+    
     for (Element importElement : XmlUtil.elements(documentElement, "import")) {
       if (importElement.hasAttribute("resource")) {
         String resource = importElement.getAttribute("resource");
         Parse importParse = createParse()
           .setResource(resource)
-          .contextStackPush(processEngineImpl)
+          .contextStackPush(processEngine)
           .execute();
         
         parse.addProblems(importParse.getProblems());
@@ -76,7 +90,7 @@
 
     Element processEngineElement = XmlUtil.element(documentElement, "process-engine-context");
     if (processEngineElement != null) {
-      WireDefinition processEngineContextDefinition = processEngineImpl.getProcessEngineWireContext().getWireDefinition();
+      WireDefinition processEngineContextDefinition = processEngine.getProcessEngineWireContext().getWireDefinition();
       parse.contextStackPush(processEngineContextDefinition);
       try {
         processEngineContextParser.parseDocumentElement(processEngineElement, parse);
@@ -87,7 +101,7 @@
 
     Element txCtxElement = XmlUtil.element(documentElement, "transaction-context");
     if (txCtxElement != null) {
-      WireDefinition transactionContextDefinition = processEngineImpl.getTransactionWireDefinition();
+      WireDefinition transactionContextDefinition = processEngine.getTransactionWireDefinition();
       parse.contextStackPush(transactionContextDefinition);
       try {
         transactionContextParser.parseDocumentElement(txCtxElement, parse);
@@ -96,9 +110,9 @@
       }
     }
 
-    parse.setDocumentObject(processEngineImpl);
+    parse.setDocumentObject(processEngine);
     
-    return processEngineImpl;
+    return processEngine;
   }
 
   public Parser getProcessEngineContextParser() {

Modified: jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobExecutorBinding.java
===================================================================
--- jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobExecutorBinding.java	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JobExecutorBinding.java	2009-10-09 13:49:12 UTC (rev 5722)
@@ -25,7 +25,6 @@
 import org.jbpm.pvm.internal.jobexecutor.JobExecutor;
 import org.jbpm.pvm.internal.util.XmlUtil;
 import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ContextTypeRefDescriptor;
 import org.jbpm.pvm.internal.wire.descriptor.IntegerDescriptor;
 import org.jbpm.pvm.internal.wire.descriptor.JobExecutorDescriptor;
 import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;

Modified: jbpm4/branches/tbaeyens/pom.xml
===================================================================
--- jbpm4/branches/tbaeyens/pom.xml	2009-10-08 22:51:44 UTC (rev 5721)
+++ jbpm4/branches/tbaeyens/pom.xml	2009-10-09 13:49:12 UTC (rev 5722)
@@ -100,6 +100,11 @@
       </dependency>
       <dependency>
         <groupId>org.jbpm.jbpm4</groupId>
+        <artifactId>jbpm-jboss</artifactId>
+        <version>${version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jbpm.jbpm4</groupId>
         <artifactId>jbpm-jpdl</artifactId>
         <version>${version}</version>
       </dependency>
@@ -499,6 +504,7 @@
       <id>distro</id>
       <modules>
         <module>modules/enterprise</module>
+        <module>modules/jboss</module>
         <module>modules/db</module>
         <module>modules/distro</module>
       </modules>



More information about the jbpm-commits mailing list