[jbpm-commits] JBoss JBPM SVN: r1660 - in jbpm3/trunk: modules/jpdl/core and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 17 03:01:18 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-07-17 03:01:18 -0400 (Thu, 17 Jul 2008)
New Revision: 1660

Modified:
   jbpm3/trunk/.classpath
   jbpm3/trunk/modules/jpdl/core/pom.xml
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java
   jbpm3/trunk/modules/jpdl/core/src/main/resources/jbpm-beans.xml
   jbpm3/trunk/modules/jpdl/core/src/test/resources/samples/sequence/basic-sequence-jbpm32.xml
   jbpm3/trunk/modules/jpdl/core/src/test/resources/samples/task/basic-task-jbpm32.xml
   jbpm3/trunk/pom.xml
Log:
jBPM3 integration uses API

Modified: jbpm3/trunk/.classpath
===================================================================
--- jbpm3/trunk/.classpath	2008-07-17 06:26:45 UTC (rev 1659)
+++ jbpm3/trunk/.classpath	2008-07-17 07:01:18 UTC (rev 1660)
@@ -1,35 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" output="modules/jpdl/core/target/classes" path="modules/jpdl/core/src/main/java"/>
+	<classpathentry kind="src" path="modules/jpdl/core/src/testsuite/java"/>
 	<classpathentry kind="src" output="modules/jpdl/core/target/test-classes" path="modules/jpdl/core/src/test/java"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/core/target/classes" path="modules/jpdl/core/src/main/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/core/target/test-classes" path="modules/jpdl/core/src/test/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/core/target/test-classes" path="modules/jpdl/core/src/testsuite/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/db/target/classes" path="modules/jpdl/db/src/main/resources"/>
-	<classpathentry kind="src" output="modules/jpdl/examples/target/test-classes" path="modules/jpdl/examples/src/test/java"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/examples/target/test-classes" path="modules/jpdl/examples/src/test/resources"/>
-	<classpathentry kind="src" output="modules/jpdl/identity/target/classes" path="modules/jpdl/identity/src/main/java"/>
-	<classpathentry kind="src" output="modules/jpdl/identity/target/test-classes" path="modules/jpdl/identity/src/test/java"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/identity/target/classes" path="modules/jpdl/identity/src/main/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/identity/target/test-classes" path="modules/jpdl/identity/src/test/resources"/>
-	<classpathentry kind="src" output="modules/jpdl/simulation/target/classes" path="modules/jpdl/simulation/src/main/java"/>
-	<classpathentry kind="src" output="modules/jpdl/simulation/target/test-classes" path="modules/jpdl/simulation/src/test/java"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/simulation/target/classes" path="modules/jpdl/simulation/src/main/resources"/>
-	<classpathentry kind="src" output="modules/jpdl/ws/target/classes" path="modules/jpdl/ws/src/main/java"/>
-	<classpathentry excluding="**" kind="src" output="modules/jpdl/ws/target/classes" path="modules/jpdl/ws/src/main/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/console/target/classes" path="modules/console/src/main/resources"/>
-	<classpathentry kind="src" output="modules/enterprise/target/classes" path="modules/enterprise/src/main/java"/>
-	<classpathentry kind="src" output="modules/enterprise/target/test-classes" path="modules/enterprise/src/test/java"/>
-	<classpathentry excluding="**" kind="src" output="modules/enterprise/target/classes" path="modules/enterprise/src/main/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/enterprise/target/test-classes" path="modules/enterprise/src/test/resources"/>
-	<classpathentry kind="src" output="modules/jbpm4jsf/target/classes" path="modules/jbpm4jsf/src/main/java"/>
-	<classpathentry excluding="**" kind="src" output="modules/jbpm4jsf/target/classes" path="modules/jbpm4jsf/src/main/resources"/>
-	<classpathentry kind="src" output="modules/bamconsole/ejb/target/classes" path="modules/bamconsole/ejb/src/main/java"/>
-	<classpathentry kind="src" output="modules/bamconsole/ejb/target/test-classes" path="modules/bamconsole/ejb/src/test/java"/>
-	<classpathentry excluding="**" kind="src" output="modules/bamconsole/ejb/target/classes" path="modules/bamconsole/ejb/src/main/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/bamconsole/ejb/target/test-classes" path="modules/bamconsole/ejb/src/test/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/bamconsole/war/target/classes" path="modules/bamconsole/war/src/main/resources"/>
-	<classpathentry excluding="**" kind="src" output="modules/bamconsole/ear/target/classes" path="modules/bamconsole/ear/src/main/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>

Modified: jbpm3/trunk/modules/jpdl/core/pom.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/pom.xml	2008-07-17 06:26:45 UTC (rev 1659)
+++ jbpm3/trunk/modules/jpdl/core/pom.xml	2008-07-17 07:01:18 UTC (rev 1660)
@@ -30,9 +30,15 @@
     <dependency>
       <groupId>org.jboss.jbpm</groupId>
       <artifactId>jbpm-api</artifactId>
+      <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>org.jboss.jbpm</groupId>
+      <artifactId>jbpm-api-impl</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.jbpm</groupId>
       <artifactId>jbpm-api-testsuite</artifactId>
       <type>zip</type>
     </dependency>

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java	2008-07-17 06:26:45 UTC (rev 1659)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java	2008-07-17 07:01:18 UTC (rev 1660)
@@ -23,23 +23,13 @@
 
 // $Id$
 
-import java.util.Iterator;
 import java.util.List;
 
 import org.jboss.bpm.InvalidProcessException;
-import org.jboss.bpm.model.ExecutionHandler;
-import org.jboss.bpm.model.Flow;
-import org.jboss.bpm.model.FlowObject;
-import org.jboss.bpm.model.MultipleOutFlowSupport;
 import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.SingleOutFlowSupport;
-import org.jboss.bpm.model.internal.EndEventImpl;
-import org.jboss.bpm.model.internal.ExecutionHandlerImpl;
-import org.jboss.bpm.model.internal.ProcessImpl;
-import org.jboss.bpm.model.internal.SequenceFlowImpl;
-import org.jboss.bpm.model.internal.StartEventImpl;
-import org.jboss.bpm.model.internal.TaskImpl;
-import org.jboss.bpm.model.internal.jaxb.JAXBExecutionHandler;
+import org.jboss.bpm.model.ProcessBuilder;
+import org.jboss.bpm.model.ProcessBuilderFactory;
+import org.jboss.bpm.runtime.ExecutionHandler;
 import org.jbpm.graph.def.Action;
 import org.jbpm.graph.def.Event;
 import org.jbpm.graph.def.Node;
@@ -57,40 +47,40 @@
 public class ProcessAdapter
 {
 
+  @SuppressWarnings("unchecked")
   public static Process buildProcess(org.jbpm.graph.def.ProcessDefinition oldPD)
   {
-    ProcessImpl apiProc = new ProcessImpl(oldPD.getName());
+    String procName = oldPD.getName();
+    ProcessBuilder procBuilder = ProcessBuilderFactory.newInstance().newProcessBuilder(procName);
     List<org.jbpm.graph.def.Node> oldNodes = oldPD.getNodes();
     for (org.jbpm.graph.def.Node oldNode : oldNodes)
     {
-      FlowObject flowObject = NodeAdapter.adaptNode(apiProc, oldNode);
-      apiProc.addFlowObject(flowObject);
+      NodeAdapter.adaptNode(procBuilder, oldNode);
     }
-    return apiProc;
+    return procBuilder.getProcess();
   }
 
   static class NodeAdapter
   {
-    static FlowObject adaptNode(Process apiProc, Node oldNode)
+    static void adaptNode(ProcessBuilder procBuilder, Node oldNode)
     {
-      FlowObject flowObject;
       if (oldNode instanceof StartState)
       {
-        flowObject = new StartEventImpl();
-        initTranstions(flowObject, oldNode);
+        procBuilder.addStartEvent();
+        initTranstions(procBuilder, oldNode);
       }
       else if (oldNode instanceof EndState)
       {
-        flowObject = new EndEventImpl(oldNode.getName());
-        initTranstions(flowObject, oldNode);
+        procBuilder.addEndEvent(oldNode.getName());
+        initTranstions(procBuilder, oldNode);
       }
       else if (oldNode instanceof State)
       {
-        flowObject = new TaskImpl(oldNode.getName());
+        procBuilder.addTask(oldNode.getName());
         Event event = oldNode.getEvent(Event.EVENTTYPE_NODE_ENTER);
         if (event != null)
         {
-          List actions = event.getActions();
+          List<?> actions = event.getActions();
           if (actions == null || actions.size() == 0)
             throw new InvalidProcessException("Cannot find action on event: " + event);
           if (actions.size() > 1)
@@ -101,47 +91,25 @@
           if (obj instanceof ExecutionHandler == false)
             throw new InvalidProcessException("Node action is not of type ExecutionHandler");
 
-          JAXBExecutionHandler jaxbHandler = new JAXBExecutionHandler();
-          jaxbHandler.setClassName(obj.getClass().getName());
-          ((TaskImpl)flowObject).setExecutionHandler(new ExecutionHandlerImpl(jaxbHandler));
+          procBuilder.addExecutionHandler(obj.getClass());
         }
-        initTranstions(flowObject, oldNode);
+        initTranstions(procBuilder, oldNode);
       }
       else
       {
         throw new InvalidProcessException("Unsupported node type: " + oldNode);
       }
-      return flowObject;
     }
 
-    private static void initTranstions(FlowObject flowObject, Node oldNode)
+    private static void initTranstions(ProcessBuilder procBuilder, Node oldNode)
     {
-      if (flowObject instanceof SingleOutFlowSupport)
+      List<?> outTrans = oldNode.getLeavingTransitions();
+      if (outTrans != null && outTrans.size() > 0)
       {
-        SingleOutFlowSupport sof = (SingleOutFlowSupport)flowObject;
-        List outTrans = oldNode.getLeavingTransitions();
-        if (outTrans != null && outTrans.size() > 0)
-        {
-          Transition trans = (Transition)outTrans.get(0);
-          Flow flow = new SequenceFlowImpl(trans.getTo().getName());
-          sof.setOutFlow(flow);
-        }
+        Transition trans = (Transition)outTrans.get(0);
+        String targetName = trans.getTo().getName();
+        procBuilder.addSequenceFlow(targetName);
       }
-      if (flowObject instanceof MultipleOutFlowSupport)
-      {
-        MultipleOutFlowSupport mof = (MultipleOutFlowSupport)flowObject;
-        List outTrans = oldNode.getLeavingTransitions();
-        if (outTrans != null && outTrans.size() > 0)
-        {
-          Iterator it = outTrans.iterator();
-          while (it.hasNext())
-          {
-            Transition trans = (Transition)it.next();
-            Flow flow = new SequenceFlowImpl(trans.getTo().getName());
-            mof.addOutFlow(flow);
-          }
-        }
-      }
     }
   }
 }

Modified: jbpm3/trunk/modules/jpdl/core/src/main/resources/jbpm-beans.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/resources/jbpm-beans.xml	2008-07-17 06:26:45 UTC (rev 1659)
+++ jbpm3/trunk/modules/jpdl/core/src/main/resources/jbpm-beans.xml	2008-07-17 07:01:18 UTC (rev 1660)
@@ -1,29 +1,30 @@
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
-  xmlns="urn:jboss:bean-deployer:2.0">
-
-  <!-- The Kernel Locator -->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ 
+  <!-- The KernelLocator -->
   <bean name="KernelLocator" class="org.jboss.kernel.plugins.util.KernelLocator"/>
   
-  <!-- The process engine -->
+  <!-- The ProcessEngine -->
   <bean name="jBPMProcessEngine" class="org.jboss.bpm.client.internal.ProcessEngineImpl">
     <property name="processManager"><inject bean="jBPMProcessManager"/></property>
     <property name="executionManager"><inject bean="jBPMExecutionManager"/></property>
     <property name="signalManager"><inject bean="jBPMSignalManager"/></property>
   </bean>
 
-  <!-- The process manager -->
+  <!-- The ProcessBuilderFactory -->
+  <bean name="jBPMProcessBuilderFactory" class="org.jboss.bpm.model.internal.ProcessBuilderFactoryImpl"/>
+  
+  <!-- The ProcessManager -->
   <bean name="jBPMProcessManager" class="org.jbpm.integration.client.ProcessManagerImpl">
     <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
   </bean>
 
-  <!-- The execution manager -->
+  <!-- The ExecutionManager -->
   <bean name="jBPMExecutionManager" class="org.jboss.bpm.client.internal.ExecutionManagerImpl">
     <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
   </bean>
 
-  <!-- The execution manager -->
+  <!-- The SignalManager -->
   <bean name="jBPMSignalManager" class="org.jboss.bpm.client.internal.SignalManagerImpl">
     <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
   </bean>
-
 </deployment>
\ No newline at end of file

Modified: jbpm3/trunk/modules/jpdl/core/src/test/resources/samples/sequence/basic-sequence-jbpm32.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/samples/sequence/basic-sequence-jbpm32.xml	2008-07-17 06:26:45 UTC (rev 1659)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/samples/sequence/basic-sequence-jbpm32.xml	2008-07-17 07:01:18 UTC (rev 1660)
@@ -1,4 +1,4 @@
-<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='basic-sequence'>
+<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='testBasicSequence'>
   <start-state>
     <transition to='stateA' />
   </start-state>

Modified: jbpm3/trunk/modules/jpdl/core/src/test/resources/samples/task/basic-task-jbpm32.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/samples/task/basic-task-jbpm32.xml	2008-07-17 06:26:45 UTC (rev 1659)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/samples/task/basic-task-jbpm32.xml	2008-07-17 07:01:18 UTC (rev 1660)
@@ -1,4 +1,4 @@
-<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='basic-task'>
+<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='testBasicTask'>
   <start-state>
     <transition to='stateA' />
   </start-state>

Modified: jbpm3/trunk/pom.xml
===================================================================
--- jbpm3/trunk/pom.xml	2008-07-17 06:26:45 UTC (rev 1659)
+++ jbpm3/trunk/pom.xml	2008-07-17 07:01:18 UTC (rev 1660)
@@ -90,6 +90,11 @@
       </dependency>
       <dependency>
         <groupId>org.jboss.jbpm</groupId>
+        <artifactId>jbpm-api-impl</artifactId>
+        <version>${jboss.jbpm.api.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.jbpm</groupId>
         <artifactId>jbpm-api-testsuite</artifactId>
         <version>${jboss.jbpm.api.version}</version>
         <type>zip</type>




More information about the jbpm-commits mailing list