[jbpm-commits] JBoss JBPM SVN: r2361 - in jbpm4/trunk: modules and 12 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Sep 24 12:29:18 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-09-24 12:29:17 -0400 (Wed, 24 Sep 2008)
New Revision: 2361

Added:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineProvider.java
   jbpm4/trunk/modules/cts/
   jbpm4/trunk/modules/cts/.classpath
   jbpm4/trunk/modules/cts/.project
   jbpm4/trunk/modules/cts/pom.xml
   jbpm4/trunk/modules/cts/src/
   jbpm4/trunk/modules/cts/src/test/
   jbpm4/trunk/modules/cts/src/test/java/
   jbpm4/trunk/modules/cts/src/test/java/org/
   jbpm4/trunk/modules/cts/src/test/java/org/jbpm/
   jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/
   jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/
   jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/
   jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java
   jbpm4/trunk/modules/cts/src/test/resources/
Modified:
   jbpm4/trunk/modules/api/pom.xml
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NotImplementedException.java
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngine.java
   jbpm4/trunk/pom.xml
Log:
Add MC engine provider

Modified: jbpm4/trunk/modules/api/pom.xml
===================================================================
--- jbpm4/trunk/modules/api/pom.xml	2008-09-24 16:25:54 UTC (rev 2360)
+++ jbpm4/trunk/modules/api/pom.xml	2008-09-24 16:29:17 UTC (rev 2361)
@@ -13,10 +13,12 @@
 <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>JBoss jBPM4 - API</name>
-  <groupId>org.jbpm.spec</groupId>
+  <groupId>org.jbpm.jbpm4</groupId>
   <artifactId>jbpm-api</artifactId>
   <packaging>jar</packaging>
 
+  <version>1.0.0-SNAPSHOT</version>
+  
   <!-- Parent -->
   <parent>
     <groupId>org.jbpm.jbpm4</groupId>
@@ -25,9 +27,39 @@
     <relativePath>../../pom.xml</relativePath>
   </parent>
 
+  <!-- Properties -->
+  <properties>
+    <commons.logging.version>1.1.1</commons.logging.version>
+    <jboss.microcontainer.version>2.0.0.Beta15</jboss.microcontainer.version>
+  </properties>
+  
+  <!-- DependencyManagement -->
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>commons-logging</groupId>
+        <artifactId>commons-logging</artifactId>
+        <version>${commons.logging.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.microcontainer</groupId>
+        <artifactId>jboss-kernel</artifactId>
+        <version>${jboss.microcontainer.version}</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  
   <!-- Dependencies -->
   <dependencies>
     <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-kernel</artifactId>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NotImplementedException.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NotImplementedException.java	2008-09-24 16:25:54 UTC (rev 2360)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NotImplementedException.java	2008-09-24 16:29:17 UTC (rev 2361)
@@ -32,6 +32,15 @@
 @SuppressWarnings("serial")
 public class NotImplementedException extends RuntimeException
 {
+  public NotImplementedException()
+  {
+  }
+  
+  public NotImplementedException(String message)
+  {
+    super(message);
+  }
+  
   public NotImplementedException(String jiraIssue, String message)
   {
     super("[" + jiraIssue + "] " + message);

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngine.java	2008-09-24 16:25:54 UTC (rev 2360)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngine.java	2008-09-24 16:29:17 UTC (rev 2361)
@@ -21,6 +21,10 @@
  */
 package org.jbpm.api.client;
 
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
 // $Id$
 
 /**
@@ -31,6 +35,8 @@
  */
 public class ProcessEngine
 {
+  private static ProcessEngineProvider engineProvider;
+  
   // Flag to indicate that the Engine is shutting down
   private boolean prepareForShutdown;
 
@@ -44,9 +50,28 @@
    * 
    * @return The configured instance of a process engine
    */
-  public static ProcessEngine locateProcessEngine()
+  public static ProcessEngine getInstance()
   {
-    return null;
+    if (engineProvider == null)
+    {
+      ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+      InputStream instream = ctxLoader.getResourceAsStream(ProcessEngineProvider.class.getName());
+      if (instream == null)
+        throw new IllegalStateException("Cannot find resource: " + ProcessEngineProvider.class.getName());
+      
+      try
+      {
+        BufferedReader br = new BufferedReader(new InputStreamReader(instream));
+        String engineProviderName = br.readLine();
+        Class<?> engineProviderClass = ctxLoader.loadClass(engineProviderName);
+        engineProvider = (ProcessEngineProvider)engineProviderClass.newInstance();
+      }
+      catch (Exception ex)
+      {
+        throw new IllegalStateException("Cannot obtain engine provider", ex);
+      }
+    }
+    return engineProvider.getProcessEngine();
   }
 
   /**
@@ -54,7 +79,7 @@
    */
   public void prepareForShutdown()
   {
-    //log.debug("prepareForShutdown");
+    // log.debug("prepareForShutdown");
     prepareForShutdown = true;
   }
 
@@ -71,7 +96,7 @@
    */
   public void cancelShutdown()
   {
-    //log.debug("cancelShutdown");
+    // log.debug("cancelShutdown");
     prepareForShutdown = false;
   }
 }
\ No newline at end of file

Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineProvider.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineProvider.java	                        (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineProvider.java	2008-09-24 16:29:17 UTC (rev 2361)
@@ -0,0 +1,41 @@
+/*
+ * 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.api.client;
+
+// $Id$
+
+/**
+ * The ProcessEngineProvider provides a ProcessEngine through a given 
+ * configuration method
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public interface ProcessEngineProvider
+{
+  /**
+   * Get the ProcessEngine from this provider
+   * 
+   * @return The configured instance of a process engine
+   */
+  public ProcessEngine getProcessEngine();
+}
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/client/ProcessEngineProvider.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF


Property changes on: jbpm4/trunk/modules/cts
___________________________________________________________________
Name: svn:ignore
   + target
.settings


Added: jbpm4/trunk/modules/cts/.classpath
===================================================================
--- jbpm4/trunk/modules/cts/.classpath	                        (rev 0)
+++ jbpm4/trunk/modules/cts/.classpath	2008-09-24 16:29:17 UTC (rev 2361)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/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>

Added: jbpm4/trunk/modules/cts/.project
===================================================================
--- jbpm4/trunk/modules/cts/.project	                        (rev 0)
+++ jbpm4/trunk/modules/cts/.project	2008-09-24 16:29:17 UTC (rev 2361)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jbpm-cts</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: jbpm4/trunk/modules/cts/pom.xml
===================================================================
--- jbpm4/trunk/modules/cts/pom.xml	                        (rev 0)
+++ jbpm4/trunk/modules/cts/pom.xml	2008-09-24 16:29:17 UTC (rev 2361)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+<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>JBoss jBPM4 - CTS</name>
+  <groupId>org.jbpm.jbpm4</groupId>
+  <artifactId>jbpm-cts</artifactId>
+  <packaging>jar</packaging>
+
+  <version>1.0.0-SNAPSHOT</version>
+  
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jbpm.jbpm4</groupId>
+    <artifactId>jbpm</artifactId>
+    <version>4.0.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-api</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+  </dependencies>
+  
+  <!-- Plugins -->
+  <build>
+    <plugins>
+    </plugins>
+  </build>
+  
+  <!-- Profiles -->
+  <profiles>
+    <profile>
+      <id>no-impl</id>
+      <activation>
+        <property>
+          <name>!impl</name>
+        </property>
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>org.jbpm.spec</groupId>
+          <artifactId>jbpm-spec-ri</artifactId>
+          <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+      </dependencies>
+    </profile>
+  </profiles>
+  
+</project>
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/cts/pom.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java
===================================================================
--- jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java	2008-09-24 16:29:17 UTC (rev 2361)
@@ -0,0 +1,43 @@
+/*
+ * 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.test.cts.processengine;
+
+// $Id$
+
+import junit.framework.TestCase;
+
+import org.jbpm.api.client.ProcessEngine;
+
+/**
+ * Test the ProcessEngine
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Sep-2008
+ */
+public class ProcessEngineTest extends TestCase
+{
+  public void testGetProcessEngine() throws Exception
+  {
+    ProcessEngine engine = ProcessEngine.getInstance();
+    assertNotNull("ProcessEngine not null", engine);
+  }
+}


Property changes on: jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml	2008-09-24 16:25:54 UTC (rev 2360)
+++ jbpm4/trunk/pom.xml	2008-09-24 16:29:17 UTC (rev 2361)
@@ -34,6 +34,7 @@
   <!-- Modules -->
   <modules>
     <module>modules/api</module>
+    <module>modules/cts</module>
     <module>modules/pvm</module>
     <module>modules/jpdl</module>
   </modules>




More information about the jbpm-commits mailing list