[jbpm-commits] JBoss JBPM SVN: r1592 - in jbpm3/trunk/modules/jpdl/core/src/main: java/org/jbpm/integration/client and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jul 11 12:01:41 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-07-11 12:01:41 -0400 (Fri, 11 Jul 2008)
New Revision: 1592

Added:
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionManagerImpl.java
Removed:
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/SignalManagerImpl.java
Modified:
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Node.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessImpl.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java
   jbpm3/trunk/modules/jpdl/core/src/main/resources/jbpm-beans.xml
Log:
Delegate to ExecutionManager

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Node.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Node.java	2008-07-11 16:01:29 UTC (rev 1591)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Node.java	2008-07-11 16:01:41 UTC (rev 1592)
@@ -32,6 +32,7 @@
 import java.util.Set;
 
 import org.dom4j.Element;
+import org.jboss.bpm.model.ExecutableFlowObject;
 import org.jboss.bpm.model.FlowObject;
 import org.jboss.bpm.model.Process;
 import org.jbpm.JbpmException;
@@ -421,7 +422,7 @@
         throw new IllegalStateException("Cannot find flow object: " + getName());
       
       TokenImpl token = new TokenImpl(proc, ctxInst);
-      fo.execute(token);
+      ((ExecutableFlowObject)fo).execute(token);
     }
   }
   

Added: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionManagerImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionManagerImpl.java	                        (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionManagerImpl.java	2008-07-11 16:01:41 UTC (rev 1592)
@@ -0,0 +1,81 @@
+/*
+ * 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.integration.client;
+
+// $Id$
+
+import java.util.concurrent.Future;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.client.ExecutionManager;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.internal.InitialToken;
+import org.jboss.bpm.model.ExecutableFlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Result;
+import org.jboss.bpm.model.Signal;
+import org.jboss.bpm.runtime.Attachments;
+import org.jboss.bpm.runtime.Token;
+import org.jbpm.graph.exe.Execution;
+import org.jbpm.integration.model.StartEventImpl;
+
+/**
+ * The process manager is the entry point to create, find and otherwise manage processes.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class ExecutionManagerImpl extends ExecutionManager
+{
+  // provide logging
+  private static final Log log = LogFactory.getLog(ExecutionManagerImpl.class);
+
+  public void setProcessEngine(ProcessEngine engine)
+  {
+    this.engine = engine;
+  }
+  
+  public Future<Result> startProcess(Process proc, Attachments att)
+  {
+    throwSignal(new Signal(proc, Signal.Type.ENTER_PROCESS));
+    try
+    {
+      // Repeatetly signal the Execution until we reach the end
+      StartEventImpl start = (StartEventImpl)proc.getStartEvent();
+      
+      Token token = new InitialToken(proc, att);
+      start.execute(token);
+      
+      Execution oldEx = start.getExecution();
+      while (oldEx.getRootToken().hasEnded() == false)
+      {
+        oldEx.signal();
+      }
+    }
+    finally
+    {
+      throwSignal(new Signal(proc, Signal.Type.EXIT_PROCESS));
+    }
+    return new ResultFuture(proc);
+  }
+}
\ No newline at end of file


Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionManagerImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java	2008-07-11 16:01:29 UTC (rev 1591)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java	2008-07-11 16:01:41 UTC (rev 1592)
@@ -1,47 +0,0 @@
-/*
- * 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.integration.client;
-
-//$Id$
-
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.ProcessManager;
-import org.jboss.bpm.client.SignalManager;
-
-/**
- * A process engine with public access
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class ProcessEngineImpl extends ProcessEngine
-{
-  public void setProcessManager(ProcessManager processManager)
-  {
-    this.processManager = processManager;
-  }
-
-  public void setSignalManager(SignalManager signalManager)
-  {
-    this.signalManager = signalManager;
-  }
-}

Deleted: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/SignalManagerImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/SignalManagerImpl.java	2008-07-11 16:01:29 UTC (rev 1591)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/SignalManagerImpl.java	2008-07-11 16:01:41 UTC (rev 1592)
@@ -1,48 +0,0 @@
-/*
- * 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.integration.client;
-
-// $Id$
-
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.SignalManager;
-import org.jboss.bpm.model.Signal;
-
-/**
- * An implementation of a signal manager
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class SignalManagerImpl extends SignalManager
-{
-  public void setProcessEngine(ProcessEngine engine)
-  {
-    this.engine = engine;
-  }
-
-  @Override
-  public void throwSignal(Signal signal)
-  {
-    super.throwSignal(signal);
-  }
-}

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java	2008-07-11 16:01:29 UTC (rev 1591)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java	2008-07-11 16:01:41 UTC (rev 1592)
@@ -23,8 +23,10 @@
 
 //$Id$
 
+import org.jboss.bpm.client.SignalManager;
 import org.jboss.bpm.model.EndEvent;
 import org.jboss.bpm.model.Process;
+import org.jboss.bpm.runtime.Token;
 import org.jbpm.graph.def.Node;
 
 /**
@@ -51,4 +53,19 @@
   {
     oldNode.setName(name);
   }
+
+  @Override
+  public void execute(Token token)
+  {
+    SignalManager sm = SignalManager.locateSignalManager();
+    sm.throwSignal(getEnterSignal());
+    try
+    {
+      super.execute(token);
+    }
+    finally
+    {
+      sm.throwSignal(getExitSignal());
+    }
+  }
 }

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessImpl.java	2008-07-11 16:01:29 UTC (rev 1591)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessImpl.java	2008-07-11 16:01:41 UTC (rev 1592)
@@ -26,12 +26,10 @@
 import org.jboss.bpm.client.ProcessManager;
 import org.jboss.bpm.model.FlowObject;
 import org.jboss.bpm.model.Process;
-import org.jboss.bpm.runtime.Token;
 import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.Execution;
 
 /**
- * A jBPM3 implementation of a process definition
+ * An implementation of a Process
  * 
  * @author thomas.diesler at jboss.com
  * @since 18-Jun-2008
@@ -71,18 +69,4 @@
   {
     oldPD.setName(name);
   }
-
-  public void executeOverwrite(Token token)
-  {
-    Process proc = token.getProcess();
-    StartEventImpl start = (StartEventImpl)proc.getStartEvent();
-    start.execute(token);
-    
-    // Repeatetly signal the Execution until we reach the end
-    Execution oldEx = start.getExecution();
-    while (oldEx.getRootToken().hasEnded() == false)
-    {
-      oldEx.signal();
-    }
-  }
 }

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java	2008-07-11 16:01:29 UTC (rev 1591)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java	2008-07-11 16:01:41 UTC (rev 1592)
@@ -23,6 +23,7 @@
 
 //$Id$
 
+import org.jboss.bpm.client.SignalManager;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.StartEvent;
 import org.jboss.bpm.runtime.Token;
@@ -41,31 +42,31 @@
 {
   private Node oldNode;
   private Execution oldEx;
-  
+
   StartEventImpl(Process proc, Node oldNode)
   {
     this.oldNode = oldNode;
   }
 
-  @Override
-  public void execute(Token token)
+  public Execution getExecution()
   {
-    super.execute(token);
-    oldEx.signal();
+    return oldEx;
   }
 
-  @Override
-  protected void executeOverwrite(Token token)
+  public void execute(Token token)
   {
-    // Create a new Execution and copy the attachments
-    oldEx = new Execution(oldNode.getProcessDefinition());
-    ContextInstance ctxInst = oldEx.getContextInstance();
-    new ExecutionContextImpl(ctxInst).copyAttachments(token.getExecutionContext());
-    ctxInst.setTransientVariable(Process.class.getName(), getProcess());
+    SignalManager sm = SignalManager.locateSignalManager();
+    sm.throwSignal(getEnterSignal());
+    try
+    {
+      this.oldEx = new Execution(oldNode.getProcessDefinition());
+      ContextInstance ctxInst = oldEx.getContextInstance();
+      new ExecutionContextImpl(ctxInst).copyAttachments(token.getExecutionContext());
+      ctxInst.setTransientVariable(Process.class.getName(), getProcess());
+    }
+    finally
+    {
+      sm.throwSignal(getExitSignal());
+    }
   }
-
-  public Execution getExecution()
-  {
-    return oldEx;
-  }
 }

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java	2008-07-11 16:01:29 UTC (rev 1591)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java	2008-07-11 16:01:41 UTC (rev 1592)
@@ -23,6 +23,7 @@
 
 //$Id$
 
+import org.jboss.bpm.client.SignalManager;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.Task;
 import org.jboss.bpm.runtime.Token;
@@ -65,16 +66,20 @@
     oldNode.setName(name);
   }
 
-  @Override
   public void execute(Token token)
   {
-    if (delegate != null)
+    SignalManager sm = SignalManager.locateSignalManager();
+    sm.throwSignal(getEnterSignal());
+    try
     {
-      delegate.execute(token);
+      if (delegate != null)
+      {
+        delegate.execute(token);
+      }
     }
-    else
+    finally
     {
-      super.execute(token);
+      sm.throwSignal(getExitSignal());
     }
   }
 }

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-11 16:01:29 UTC (rev 1591)
+++ jbpm3/trunk/modules/jpdl/core/src/main/resources/jbpm-beans.xml	2008-07-11 16:01:41 UTC (rev 1592)
@@ -5,19 +5,25 @@
   <bean name="KernelLocator" class="org.jboss.kernel.plugins.util.KernelLocator"/>
   
   <!-- The process engine -->
-  <bean name="jBPMProcessEngine" class="org.jbpm.integration.client.ProcessEngineImpl">
+  <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 definition manager -->
+  <!-- The process manager -->
   <bean name="jBPMProcessManager" class="org.jbpm.integration.client.ProcessManagerImpl">
     <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
   </bean>
 
   <!-- The execution manager -->
-  <bean name="jBPMSignalManager" class="org.jbpm.integration.client.SignalManagerImpl">
+  <bean name="jBPMExecutionManager" class="org.jbpm.integration.client.ExecutionManagerImpl">
     <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
   </bean>
 
+  <!-- The execution manager -->
+  <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




More information about the jbpm-commits mailing list