[jbpm-commits] JBoss JBPM SVN: r1560 - in jbpm3/trunk: modules/jpdl/core and 7 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Jul 9 14:23:16 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-07-09 14:23:16 -0400 (Wed, 09 Jul 2008)
New Revision: 1560
Added:
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessManagerImpl.java
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/model/
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/ProcessAdapter.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/java/org/jbpm/integration/runtime/ExecutionContextImpl.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TaskWrapper.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TokenImpl.java
Removed:
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionImpl.java
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/ProcessDefinitionManagerImpl.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessInstanceImpl.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessInstanceManagerImpl.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/def/
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/ActivityWrapper.java
Modified:
jbpm3/trunk/.classpath
jbpm3/trunk/modules/jpdl/core/pom.xml
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Action.java
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/node/EndState.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/node/State.java
jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java
jbpm3/trunk/modules/jpdl/core/src/main/resources/jbpm-beans.xml
Log:
Align API with BPMN
Modified: jbpm3/trunk/.classpath
===================================================================
--- jbpm3/trunk/.classpath 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/.classpath 2008-07-09 18:23:16 UTC (rev 1560)
@@ -1,34 +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" output="modules/jpdl/core/target/test-classes" 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/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-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/pom.xml 2008-07-09 18:23:16 UTC (rev 1560)
@@ -117,6 +117,11 @@
<!-- Plugins -->
<build>
+ <testResources>
+ <testResource>
+ <directory>src/testsuite/resources</directory>
+ </testResource>
+ </testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Action.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Action.java 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Action.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -25,10 +25,10 @@
import java.util.Map;
import org.dom4j.Element;
-import org.jboss.bpm.runtime.Activity;
+import org.jboss.bpm.model.Task;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.instantiation.Delegation;
-import org.jbpm.integration.runtime.ActivityWrapper;
+import org.jbpm.integration.runtime.TaskWrapper;
import org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator;
import org.jbpm.jpdl.xml.JpdlXmlReader;
import org.jbpm.jpdl.xml.Parsable;
@@ -152,9 +152,9 @@
{
ActionHandler actionHandler;
Object obj = actionDelegation.getInstance();
- if (obj instanceof Activity)
+ if (obj instanceof Task)
{
- actionHandler = new ActivityWrapper(this, (Activity)obj);
+ actionHandler = new TaskWrapper(this);
}
else
{
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-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/Node.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -32,11 +32,16 @@
import java.util.Set;
import org.dom4j.Element;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Process;
import org.jbpm.JbpmException;
+import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.action.ActionTypes;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.Token;
import org.jbpm.graph.log.NodeLog;
+import org.jbpm.integration.model.ProcessImpl;
+import org.jbpm.integration.runtime.TokenImpl;
import org.jbpm.job.ExecuteNodeJob;
import org.jbpm.jpdl.xml.JpdlXmlReader;
import org.jbpm.jpdl.xml.Parsable;
@@ -44,10 +49,11 @@
import org.jbpm.svc.Services;
import org.jbpm.util.Clock;
-public class Node extends GraphElement implements Parsable {
-
+public class Node extends GraphElement implements Parsable
+{
+
private static final long serialVersionUID = 1L;
-
+
protected List leavingTransitions = null;
transient Map leavingTransitionMap = null;
protected Set arrivingTransitions = null;
@@ -58,8 +64,12 @@
// event types //////////////////////////////////////////////////////////////
- public static final String[] supportedEventTypes = new String[]{Event.EVENTTYPE_NODE_ENTER,Event.EVENTTYPE_NODE_LEAVE,Event.EVENTTYPE_BEFORE_SIGNAL,Event.EVENTTYPE_AFTER_SIGNAL};
- public String[] getSupportedEventTypes() {
+ public static final String[] supportedEventTypes = new String[] {
+ Event.EVENTTYPE_NODE_ENTER, Event.EVENTTYPE_NODE_LEAVE,
+ Event.EVENTTYPE_BEFORE_SIGNAL,Event.EVENTTYPE_AFTER_SIGNAL };
+
+ public String[] getSupportedEventTypes()
+ {
return supportedEventTypes;
}
@@ -68,22 +78,27 @@
/**
* creates an unnamed node.
*/
- public Node() {
+ public Node()
+ {
}
/**
* creates a node with the given name.
*/
- public Node(String name) {
+ public Node(String name)
+ {
super(name);
}
- public void read(Element nodeElement, JpdlXmlReader jpdlXmlReader) {
+ public void read(Element nodeElement, JpdlXmlReader jpdlXmlReader)
+ {
action = jpdlXmlReader.readSingleAction(nodeElement);
}
-
- public void write(Element nodeElement) {
- if (action!=null) {
+
+ public void write(Element nodeElement)
+ {
+ if (action != null)
+ {
String actionName = ActionTypes.getActionName(action.getClass());
Element actionElement = nodeElement.addElement(actionName);
action.write(actionElement);
@@ -91,22 +106,25 @@
}
// leaving transitions //////////////////////////////////////////////////////
-
- public List getLeavingTransitions() {
+
+ public List getLeavingTransitions()
+ {
return leavingTransitions;
}
/**
* are the leaving {@link Transition}s, mapped by their name (java.lang.String).
*/
- public Map getLeavingTransitionsMap() {
- if ( (leavingTransitionMap==null)
- && (leavingTransitions!=null) ){
+ public Map getLeavingTransitionsMap()
+ {
+ if ((leavingTransitionMap == null) && (leavingTransitions != null))
+ {
// initialize the cached leaving transition map
leavingTransitionMap = new HashMap();
ListIterator iter = leavingTransitions.listIterator(leavingTransitions.size());
- while (iter.hasPrevious()) {
- Transition leavingTransition = (Transition) iter.previous();
+ while (iter.hasPrevious())
+ {
+ Transition leavingTransition = (Transition)iter.previous();
leavingTransitionMap.put(leavingTransition.getName(), leavingTransition);
}
}
@@ -115,11 +133,15 @@
/**
* creates a bidirection relation between this node and the given leaving transition.
+ *
* @throws IllegalArgumentException if leavingTransition is null.
*/
- public Transition addLeavingTransition(Transition leavingTransition) {
- if (leavingTransition == null) throw new IllegalArgumentException("can't add a null leaving transition to an node");
- if (leavingTransitions == null) leavingTransitions = new ArrayList();
+ public Transition addLeavingTransition(Transition leavingTransition)
+ {
+ if (leavingTransition == null)
+ throw new IllegalArgumentException("can't add a null leaving transition to an node");
+ if (leavingTransitions == null)
+ leavingTransitions = new ArrayList();
leavingTransitions.add(leavingTransition);
leavingTransition.from = this;
leavingTransitionMap = null;
@@ -128,12 +150,17 @@
/**
* removes the bidirection relation between this node and the given leaving transition.
+ *
* @throws IllegalArgumentException if leavingTransition is null.
*/
- public void removeLeavingTransition(Transition leavingTransition) {
- if (leavingTransition == null) throw new IllegalArgumentException("can't remove a null leavingTransition from an node");
- if (leavingTransitions != null) {
- if (leavingTransitions.remove(leavingTransition)) {
+ public void removeLeavingTransition(Transition leavingTransition)
+ {
+ if (leavingTransition == null)
+ throw new IllegalArgumentException("can't remove a null leavingTransition from an node");
+ if (leavingTransitions != null)
+ {
+ if (leavingTransitions.remove(leavingTransition))
+ {
leavingTransition.from = null;
leavingTransitionMap = null;
}
@@ -142,61 +169,69 @@
/**
* checks for the presence of a leaving transition with the given name.
- * @return true if this node has a leaving transition with the given name,
- * false otherwise.
+ *
+ * @return true if this node has a leaving transition with the given name, false otherwise.
*/
- public boolean hasLeavingTransition(String transitionName) {
- if (leavingTransitions==null) return false;
+ public boolean hasLeavingTransition(String transitionName)
+ {
+ if (leavingTransitions == null)
+ return false;
return getLeavingTransitionsMap().containsKey(transitionName);
}
/**
- * retrieves a leaving transition by name. note that also the leaving
- * transitions of the supernode are taken into account.
+ * retrieves a leaving transition by name. note that also the leaving transitions of the supernode are taken into account.
*/
- public Transition getLeavingTransition(String transitionName) {
+ public Transition getLeavingTransition(String transitionName)
+ {
Transition transition = null;
- if (leavingTransitions!=null) {
- transition = (Transition) getLeavingTransitionsMap().get(transitionName);
+ if (leavingTransitions != null)
+ {
+ transition = (Transition)getLeavingTransitionsMap().get(transitionName);
}
- if ( (transition==null)
- && (superState!=null)
- ) {
- transition = superState.getLeavingTransition(transitionName);
+ if ((transition == null) && (superState != null))
+ {
+ transition = superState.getLeavingTransition(transitionName);
}
return transition;
}
/**
- * true if this transition has leaving transitions.
+ * true if this transition has leaving transitions.
*/
- public boolean hasNoLeavingTransitions() {
- return ( ( (leavingTransitions == null)
- || (leavingTransitions.size() == 0) )
- && ( (superState==null)
- || (superState.hasNoLeavingTransitions() ) ) );
+ public boolean hasNoLeavingTransitions()
+ {
+ return (((leavingTransitions == null) || (leavingTransitions.size() == 0)) && ((superState == null) || (superState.hasNoLeavingTransitions())));
}
/**
- * generates a new name for a transition that will be added as a leaving transition.
+ * generates a new name for a transition that will be added as a leaving transition.
*/
- public String generateNextLeavingTransitionName() {
+ public String generateNextLeavingTransitionName()
+ {
String name = null;
- if (leavingTransitions!=null && containsName(leavingTransitions, null)) {
+ if (leavingTransitions != null && containsName(leavingTransitions, null))
+ {
int n = 1;
- while (containsName(leavingTransitions, Integer.toString(n))) n++;
+ while (containsName(leavingTransitions, Integer.toString(n)))
+ n++;
name = Integer.toString(n);
}
return name;
}
- boolean containsName(List leavingTransitions, String name) {
+ boolean containsName(List leavingTransitions, String name)
+ {
Iterator iter = leavingTransitions.iterator();
- while (iter.hasNext()) {
- Transition transition = (Transition) iter.next();
- if ( (name==null) && (transition.getName()==null) ) {
+ while (iter.hasNext())
+ {
+ Transition transition = (Transition)iter.next();
+ if ((name == null) && (transition.getName() == null))
+ {
return true;
- } else if ( (name!=null) && (name.equals(transition.getName())) ) {
+ }
+ else if ((name != null) && (name.equals(transition.getName())))
+ {
return true;
}
}
@@ -208,12 +243,15 @@
/**
* is the default leaving transition.
*/
- public Transition getDefaultLeavingTransition() {
+ public Transition getDefaultLeavingTransition()
+ {
Transition defaultTransition = null;
- if ( (leavingTransitions!=null)
- && (leavingTransitions.size()>0) ) {
- defaultTransition = (Transition) leavingTransitions.get(0);
- } else if ( superState!=null ){
+ if ((leavingTransitions != null) && (leavingTransitions.size() > 0))
+ {
+ defaultTransition = (Transition)leavingTransitions.get(0);
+ }
+ else if (superState != null)
+ {
defaultTransition = superState.getDefaultLeavingTransition();
}
return defaultTransition;
@@ -222,16 +260,17 @@
/**
* moves one leaving transition from the oldIndex and inserts it at the newIndex.
*/
- public void reorderLeavingTransition( int oldIndex, int newIndex ) {
- if ( (leavingTransitions!=null)
- && (Math.min(oldIndex, newIndex)>=0)
- && (Math.max(oldIndex, newIndex)<leavingTransitions.size()) ) {
+ public void reorderLeavingTransition(int oldIndex, int newIndex)
+ {
+ if ((leavingTransitions != null) && (Math.min(oldIndex, newIndex) >= 0) && (Math.max(oldIndex, newIndex) < leavingTransitions.size()))
+ {
Object o = leavingTransitions.remove(oldIndex);
leavingTransitions.add(newIndex, o);
}
}
- public List getLeavingTransitionsList() {
+ public List getLeavingTransitionsList()
+ {
return leavingTransitions;
}
@@ -240,46 +279,55 @@
/**
* are the arriving transitions.
*/
- public Set getArrivingTransitions() {
+ public Set getArrivingTransitions()
+ {
return arrivingTransitions;
}
/**
- * add a bidirection relation between this node and the given arriving
- * transition.
+ * add a bidirection relation between this node and the given arriving transition.
+ *
* @throws IllegalArgumentException if t is null.
*/
- public Transition addArrivingTransition(Transition arrivingTransition) {
- if (arrivingTransition == null) throw new IllegalArgumentException("can't add a null arrivingTransition to a node");
- if (arrivingTransitions == null) arrivingTransitions = new HashSet();
+ public Transition addArrivingTransition(Transition arrivingTransition)
+ {
+ if (arrivingTransition == null)
+ throw new IllegalArgumentException("can't add a null arrivingTransition to a node");
+ if (arrivingTransitions == null)
+ arrivingTransitions = new HashSet();
arrivingTransitions.add(arrivingTransition);
arrivingTransition.to = this;
return arrivingTransition;
}
/**
- * removes the bidirection relation between this node and the given arriving
- * transition.
+ * removes the bidirection relation between this node and the given arriving transition.
+ *
* @throws IllegalArgumentException if t is null.
*/
- public void removeArrivingTransition(Transition arrivingTransition) {
- if (arrivingTransition == null) throw new IllegalArgumentException("can't remove a null arrivingTransition from a node");
- if (arrivingTransitions != null) {
- if (arrivingTransitions.remove(arrivingTransition)) {
+ public void removeArrivingTransition(Transition arrivingTransition)
+ {
+ if (arrivingTransition == null)
+ throw new IllegalArgumentException("can't remove a null arrivingTransition from a node");
+ if (arrivingTransitions != null)
+ {
+ if (arrivingTransitions.remove(arrivingTransition))
+ {
arrivingTransition.to = null;
}
}
}
-
+
// various //////////////////////////////////////////////////////////////////
/**
- * is the {@link SuperState} or the {@link ProcessDefinition} in which this
- * node is contained.
+ * is the {@link SuperState} or the {@link ProcessDefinition} in which this node is contained.
*/
- public GraphElement getParent() {
+ public GraphElement getParent()
+ {
GraphElement parent = processDefinition;
- if (superState!=null) parent = superState;
+ if (superState != null)
+ parent = superState;
return parent;
}
@@ -288,7 +336,8 @@
/**
* called by a transition to pass execution to this node.
*/
- public void enter(ExecutionContext executionContext) {
+ public void enter(ExecutionContext executionContext)
+ {
Token token = executionContext.getToken();
// update the runtime context information
@@ -296,7 +345,7 @@
// fire the leave-node event for this node
fireEvent(Event.EVENTTYPE_NODE_ENTER, executionContext);
-
+
// keep track of node entrance in the token, so that a node-log can be generated at node leave time.
token.setNodeEnter(Clock.getCurrentTime());
@@ -305,61 +354,94 @@
executionContext.setTransitionSource(null);
// execute the node
- if (isAsync) {
+ if (isAsync)
+ {
ExecuteNodeJob job = createAsyncContinuationJob(token);
- MessageService messageService = (MessageService) Services.getCurrentService(Services.SERVICENAME_MESSAGE);
+ MessageService messageService = (MessageService)Services.getCurrentService(Services.SERVICENAME_MESSAGE);
messageService.send(job);
token.lock(job.toString());
- } else {
+ }
+ else
+ {
execute(executionContext);
}
}
- protected ExecuteNodeJob createAsyncContinuationJob(Token token) {
+ protected ExecuteNodeJob createAsyncContinuationJob(Token token)
+ {
ExecuteNodeJob job = new ExecuteNodeJob(token);
job.setNode(this);
job.setDueDate(new Date());
job.setExclusive(isAsyncExclusive);
return job;
}
-
+
/**
* override this method to customize the node behaviour.
*/
- public void execute(ExecutionContext executionContext) {
+ public void execute(ExecutionContext executionContext)
+ {
+ // Call execute on an API FlowObject
+ callExecutableFlowObject(executionContext);
+
// if there is a custom action associated with this node
- if (action!=null) {
- try {
+ if (action != null)
+ {
+ try
+ {
// execute the action
executeAction(action, executionContext);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
// NOTE that Error's are not caught because that might halt the JVM and mask the original Error.
// search for an exception handler or throw to the client
raiseException(exception, executionContext);
}
- } else {
+ }
+ else
+ {
// let this node handle the token
// the default behaviour is to leave the node over the default transition.
leave(executionContext);
}
}
+ // Call execute on an API FlowObject
+ protected void callExecutableFlowObject(ExecutionContext executionContext)
+ {
+ ContextInstance ctxInst = executionContext.getContextInstance();
+ ProcessImpl proc = (ProcessImpl)ctxInst.getTransientVariable(Process.class.getName());
+ if (proc != null)
+ {
+ FlowObject fo = proc.findFlowObject(this);
+ if (fo == null)
+ throw new IllegalStateException("Cannot find flow object: " + getName());
+
+ TokenImpl token = new TokenImpl(proc, ctxInst);
+ fo.execute(token);
+ }
+ }
+
/**
* called by the implementation of this node to continue execution over the default transition.
*/
- public void leave(ExecutionContext executionContext) {
+ public void leave(ExecutionContext executionContext)
+ {
leave(executionContext, getDefaultLeavingTransition());
}
/**
* called by the implementation of this node to continue execution over the specified transition.
*/
- public void leave(ExecutionContext executionContext, String transitionName) {
+ public void leave(ExecutionContext executionContext, String transitionName)
+ {
Transition transition = getLeavingTransition(transitionName);
- if (transition==null) {
- throw new JbpmException("transition '"+transitionName+"' is not a leaving transition of node '"+this+"'");
+ if (transition == null)
+ {
+ throw new JbpmException("transition '" + transitionName + "' is not a leaving transition of node '" + this + "'");
}
leave(executionContext, transition);
}
@@ -367,17 +449,20 @@
/**
* called by the implementation of this node to continue execution over the given transition.
*/
- public void leave(ExecutionContext executionContext, Transition transition) {
- if (transition==null) throw new JbpmException("can't leave node '"+this+"' without leaving transition");
+ public void leave(ExecutionContext executionContext, Transition transition)
+ {
+ if (transition == null)
+ throw new JbpmException("can't leave node '" + this + "' without leaving transition");
Token token = executionContext.getToken();
token.setNode(this);
executionContext.setTransition(transition);
-
+
// fire the leave-node event for this node
fireEvent(Event.EVENTTYPE_NODE_LEAVE, executionContext);
-
+
// log this node
- if (token.getNodeEnter()!=null) {
+ if (token.getNodeEnter() != null)
+ {
addNodeLog(token);
}
@@ -389,15 +474,18 @@
transition.take(executionContext);
}
- protected void addNodeLog(Token token) {
+ protected void addNodeLog(Token token)
+ {
token.addLog(new NodeLog(this, token.getNodeEnter(), Clock.getCurrentTime()));
}
- /////////////////////////////////////////////////////////////////////////////
-
- public ProcessDefinition getProcessDefinition() {
+ // ///////////////////////////////////////////////////////////////////////////
+
+ public ProcessDefinition getProcessDefinition()
+ {
ProcessDefinition pd = this.processDefinition;
- if (superState!=null) {
+ if (superState != null)
+ {
pd = superState.getProcessDefinition();
}
return pd;
@@ -407,34 +495,45 @@
/**
* updates the name of this node
*/
- public void setName(String name) {
- if (isDifferent(this.name, name)) {
+ public void setName(String name)
+ {
+ if (isDifferent(this.name, name))
+ {
String oldName = this.name;
- if (superState!=null) {
- if ( superState.hasNode(name) ) {
- throw new IllegalArgumentException("couldn't set name '"+name+"' on node '"+this+"'cause the superState of this node has already another child node with the same name");
+ if (superState != null)
+ {
+ if (superState.hasNode(name))
+ {
+ throw new IllegalArgumentException("couldn't set name '" + name + "' on node '" + this
+ + "'cause the superState of this node has already another child node with the same name");
}
Map nodes = superState.getNodesMap();
nodes.remove(oldName);
- nodes.put(name,this);
- } else if (processDefinition!=null) {
- if ( processDefinition.hasNode(name) ) {
- throw new IllegalArgumentException("couldn't set name '"+name+"' on node '"+this+"'cause the process definition of this node has already another node with the same name");
+ nodes.put(name, this);
+ }
+ else if (processDefinition != null)
+ {
+ if (processDefinition.hasNode(name))
+ {
+ throw new IllegalArgumentException("couldn't set name '" + name + "' on node '" + this
+ + "'cause the process definition of this node has already another node with the same name");
}
Map nodeMap = processDefinition.getNodesMap();
nodeMap.remove(oldName);
- nodeMap.put(name,this);
+ nodeMap.put(name, this);
}
this.name = name;
}
}
-
- boolean isDifferent(String name1, String name2) {
- if ((name1!=null)
- && (name1.equals(name2))) {
+
+ boolean isDifferent(String name1, String name2)
+ {
+ if ((name1 != null) && (name1.equals(name2)))
+ {
return false;
- } else if ( (name1==null)
- && (name2==null) ) {
+ }
+ else if ((name1 == null) && (name2 == null))
+ {
return false;
}
return true;
@@ -443,45 +542,62 @@
/**
* the slash separated name that includes all the superstate names.
*/
- public String getFullyQualifiedName() {
+ public String getFullyQualifiedName()
+ {
String fullyQualifiedName = name;
- if (superState!=null) {
- fullyQualifiedName = superState.getFullyQualifiedName()+"/"+name;
+ if (superState != null)
+ {
+ fullyQualifiedName = superState.getFullyQualifiedName() + "/" + name;
}
return fullyQualifiedName;
}
/** indicates wether this node is a superstate. */
- public boolean isSuperStateNode() {
+ public boolean isSuperStateNode()
+ {
return false;
}
/** returns a list of child nodes (only applicable for {@link SuperState})s. */
- public List getNodes() {
+ public List getNodes()
+ {
return null;
}
// getters and setters //////////////////////////////////////////////////////
-
- public SuperState getSuperState() {
+
+ public SuperState getSuperState()
+ {
return superState;
}
- public Action getAction() {
+
+ public Action getAction()
+ {
return action;
}
- public void setAction(Action action) {
+
+ public void setAction(Action action)
+ {
this.action = action;
}
- public boolean isAsync() {
+
+ public boolean isAsync()
+ {
return isAsync;
}
- public void setAsync(boolean isAsync) {
+
+ public void setAsync(boolean isAsync)
+ {
this.isAsync = isAsync;
}
- public boolean isAsyncExclusive() {
+
+ public boolean isAsyncExclusive()
+ {
return isAsyncExclusive;
}
- public void setAsyncExclusive(boolean isAsyncExclusive) {
+
+ public void setAsyncExclusive(boolean isAsyncExclusive)
+ {
this.isAsyncExclusive = isAsyncExclusive;
}
}
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/node/EndState.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/node/EndState.java 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/node/EndState.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -25,42 +25,54 @@
import org.jbpm.graph.def.Event;
import org.jbpm.graph.def.Node;
import org.jbpm.graph.def.Transition;
-import org.jbpm.graph.exe.*;
+import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.jpdl.xml.JpdlXmlReader;
-public class EndState extends Node {
+public class EndState extends Node
+{
private static final long serialVersionUID = 1L;
-
+
String endCompleteProcess = null;
- public EndState() {
+ public EndState()
+ {
}
-
- public static final String[] supportedEventTypes = new String[]{Event.EVENTTYPE_NODE_ENTER};
- public String[] getSupportedEventTypes() {
+
+ public static final String[] supportedEventTypes = new String[] { Event.EVENTTYPE_NODE_ENTER };
+
+ public String[] getSupportedEventTypes()
+ {
return supportedEventTypes;
}
- public EndState(String name) {
+ public EndState(String name)
+ {
super(name);
}
-
- public void read(Element nodeElement, JpdlXmlReader jpdlXmlReader) {
+
+ public void read(Element nodeElement, JpdlXmlReader jpdlXmlReader)
+ {
endCompleteProcess = nodeElement.attributeValue("end-complete-process");
}
- public void execute(ExecutionContext executionContext) {
- if ( (endCompleteProcess!=null)
- && (endCompleteProcess.equalsIgnoreCase("true"))
- ) {
+ public void execute(ExecutionContext executionContext)
+ {
+ if ((endCompleteProcess != null) && (endCompleteProcess.equalsIgnoreCase("true")))
+ {
executionContext.getProcessInstance().end();
- } else {
+ }
+ else
+ {
executionContext.getToken().end();
}
+
+ // Call execute on an API FlowObject
+ callExecutableFlowObject(executionContext);
}
-
- public Transition addLeavingTransition(Transition t) {
+
+ public Transition addLeavingTransition(Transition t)
+ {
throw new UnsupportedOperationException("can't add a leaving transition to an end-state");
}
}
Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/node/State.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/node/State.java 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/node/State.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -21,21 +21,26 @@
*/
package org.jbpm.graph.node;
-import org.jbpm.graph.def.*;
-import org.jbpm.graph.exe.*;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.exe.ExecutionContext;
-public class State extends Node {
-
+public class State extends Node
+{
private static final long serialVersionUID = 1L;
- public State() {
+ public State()
+ {
this(null);
}
-
- public State(String name) {
- super( name );
+
+ public State(String name)
+ {
+ super(name);
}
- public void execute(ExecutionContext executionContext) {
+ public void execute(ExecutionContext executionContext)
+ {
+ // Call execute on an API FlowObject
+ callExecutableFlowObject(executionContext);
}
}
Deleted: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionImpl.java 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -1,177 +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 java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.jboss.bpm.client.ProcessInstance;
-import org.jboss.bpm.client.internal.AbstractExecution;
-import org.jboss.bpm.process.Execution;
-import org.jboss.bpm.process.Node;
-import org.jboss.bpm.runtime.Token;
-
-/**
- * Represents an execution of a process instance.
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class ExecutionImpl extends AbstractExecution
-{
- private org.jbpm.graph.exe.Execution oldEx;
- private Token context = new ContextImpl();
-
- ExecutionImpl(ProcessInstance pi, org.jbpm.graph.exe.Execution oldEx)
- {
- super(pi);
- this.oldEx = oldEx;
- init(oldEx.getKey());
- }
-
- @Override
- protected Node getNodeOverride()
- {
- org.jbpm.graph.def.Node oldNode = oldEx.getRootToken().getNode();
- Node apiNode = getProcessInstance().getProcessDefinition().findNode(oldNode.getName());
- return apiNode;
- }
-
- @Override
- protected void signalOverride()
- {
- oldEx.getContextInstance().setTransientVariable(Execution.class.getName(), this);
- oldEx.signal();
- }
-
- @Override
- public String getName()
- {
- return oldEx.getKey();
- }
-
- @Override
- protected void setName(String name)
- {
- oldEx.setKey(name);
- }
-
- @Override
- public Token getContext()
- {
- return context;
- }
-
- private class ContextImpl extends Token
- {
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(Class<T> clazz, Object value)
- {
- Key key = new Key(clazz, null);
- oldEx.getContextInstance().setTransientVariable(key, value);
- return (T)value;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(Class<T> clazz, String name, Object value)
- {
- Key key = new Key(clazz, name);
- oldEx.getContextInstance().setTransientVariable(key, value);
- return (T)value;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(String name, Object value)
- {
- Key key = new Key(null, name);
- oldEx.getContextInstance().setTransientVariable(key, value);
- return (T)value;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz)
- {
- Key key = new Key(clazz, null);
- Object value = oldEx.getContextInstance().getTransientVariable(key);
- return (T)value;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz, String name)
- {
- Key key = new Key(clazz, name);
- Object value = oldEx.getContextInstance().getTransientVariable(key);
- return (T)value;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(String name)
- {
- Key key = new Key(null, name);
- Object value = oldEx.getContextInstance().getTransientVariable(key);
- return (T)value;
- }
-
- public Collection<Key> getAttachmentKeys()
- {
- Set<Key> keys = new HashSet<Key>();
- Iterator<?> itKeys = oldEx.getContextInstance().getTransientVariables().keySet().iterator();
- while (itKeys.hasNext())
- {
- Object key = itKeys.next();
- if (key instanceof Key)
- {
- keys.add((Key)key);
- }
- }
- return keys;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz)
- {
- Key key = new Key(clazz, null);
- Object value = oldEx.getContextInstance().deleteTransientVariable(key);
- return (T)value;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz, String name)
- {
- Key key = new Key(clazz, name);
- Object value = oldEx.getContextInstance().deleteTransientVariable(key);
- return (T)value;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(String name)
- {
- Key key = new Key(null, name);
- Object value = oldEx.getContextInstance().deleteTransientVariable(key);
- return (T)value;
- }
- }
-}
Deleted: 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 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ExecutionManagerImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -1,54 +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.ExecutionManager;
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.ProcessInstance;
-import org.jboss.bpm.process.Execution;
-import org.jbpm.integration.def.ProcessDefinitionImpl;
-
-/**
- * TODO
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class ExecutionManagerImpl extends ExecutionManager
-{
-
- public void setProcessEngine(ProcessEngine engine)
- {
- this.engine = engine;
- }
-
- @Override
- protected Execution createExecutionOverride(ProcessInstance pi)
- {
- ProcessDefinitionImpl apiPD = (ProcessDefinitionImpl)pi.getProcessDefinition();
- org.jbpm.graph.exe.Execution oldEx = new org.jbpm.graph.exe.Execution(apiPD.oldPD);
- ExecutionImpl ex = new ExecutionImpl(pi, oldEx);
- return ex;
- }
-}
Deleted: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessDefinitionManagerImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessDefinitionManagerImpl.java 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessDefinitionManagerImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -1,83 +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 java.io.IOException;
-import java.net.URL;
-
-import org.jboss.bpm.InvalidProcessDefinitionException;
-import org.jboss.bpm.client.ProcessDefinitionManager;
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.process.ProcessDefinition;
-import org.jbpm.integration.def.ProcessDefinitionAdapter;
-import org.jbpm.jpdl.JpdlException;
-
-/**
- * An implementation of a process definition manager
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class ProcessDefinitionManagerImpl extends ProcessDefinitionManager
-{
-
- public void setProcessEngine(ProcessEngine engine)
- {
- this.engine = engine;
- }
-
- @Override
- protected ProcessDefinition createProcessDefinitionOverride(String jpdl)
- {
- org.jbpm.graph.def.ProcessDefinition oldPD;
- try
- {
- oldPD = org.jbpm.graph.def.ProcessDefinition.parseXmlString(jpdl);
- }
- catch (JpdlException ex)
- {
- throw new InvalidProcessDefinitionException(ex);
- }
- ProcessDefinition pdef = ProcessDefinitionAdapter.buildProcessDefinition(oldPD);
- addProcessDefinition(pdef);
- return pdef;
- }
-
- @Override
- protected ProcessDefinition createProcessDefinitionOverride(URL jpdl) throws IOException
- {
- org.jbpm.graph.def.ProcessDefinition oldPD;
- try
- {
- oldPD = org.jbpm.graph.def.ProcessDefinition.parseXmlInputStream(jpdl.openStream());
- }
- catch (JpdlException ex)
- {
- throw new InvalidProcessDefinitionException(ex);
- }
- ProcessDefinition pdef = ProcessDefinitionAdapter.buildProcessDefinition(oldPD);
- addProcessDefinition(pdef);
- return pdef;
- }
-}
Modified: 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-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessEngineImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -23,10 +23,9 @@
//$Id$
-import org.jboss.bpm.client.ExecutionManager;
-import org.jboss.bpm.client.ProcessDefinitionManager;
import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.ProcessInstanceManager;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.client.SignalManager;
/**
* A process engine with public access
@@ -36,19 +35,13 @@
*/
public class ProcessEngineImpl extends ProcessEngine
{
-
- public void setProcessDefinitionManager(ProcessDefinitionManager processDefinitionManager)
+ public void setProcessManager(ProcessManager processManager)
{
- this.processDefinitionManager = processDefinitionManager;
+ this.processManager = processManager;
}
- public void setProcessInstanceManager(ProcessInstanceManager processInstanceManager)
+ public void setSignalManager(SignalManager signalManager)
{
- this.processInstanceManager = processInstanceManager;
+ this.signalManager = signalManager;
}
-
- public void setExecutionManager(ExecutionManager executionManager)
- {
- this.executionManager = executionManager;
- }
}
Deleted: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessInstanceImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessInstanceImpl.java 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessInstanceImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -1,42 +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.internal.AbstractProcessInstance;
-import org.jboss.bpm.process.ProcessDefinition;
-
-/**
- * TODO
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class ProcessInstanceImpl extends AbstractProcessInstance
-{
- ProcessInstanceImpl(ProcessDefinition pdef)
- {
- super(pdef);
- init(null);
- }
-}
Deleted: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessInstanceManagerImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessInstanceManagerImpl.java 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessInstanceManagerImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -1,50 +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.ProcessInstance;
-import org.jboss.bpm.client.ProcessInstanceManager;
-import org.jboss.bpm.process.ProcessDefinition;
-
-/**
- * TODO
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class ProcessInstanceManagerImpl extends ProcessInstanceManager
-{
- public void setProcessEngine(ProcessEngine engine)
- {
- this.engine = engine;
- }
-
- @Override
- protected ProcessInstance createProcessInstanceOverride(ProcessDefinition pdef)
- {
- ProcessInstance pinst = new ProcessInstanceImpl(pdef);
- return pinst;
- }
-}
Added: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessManagerImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessManagerImpl.java (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessManagerImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,84 @@
+/*
+ * 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.io.IOException;
+import java.net.URL;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.client.ProcessEngine;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.model.Process;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.integration.model.ProcessAdapter;
+import org.jbpm.jpdl.JpdlException;
+
+/**
+ * An implementation of a process manager
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class ProcessManagerImpl extends ProcessManager
+{
+
+ public void setProcessEngine(ProcessEngine engine)
+ {
+ this.engine = engine;
+ }
+
+ @Override
+ protected Process createProcessOverride(String jpdl)
+ {
+ ProcessDefinition oldPD;
+ try
+ {
+ oldPD = ProcessDefinition.parseXmlString(jpdl);
+ }
+ catch (JpdlException ex)
+ {
+ throw new InvalidProcessException(ex);
+ }
+ Process pdef = ProcessAdapter.buildProcess(oldPD);
+ addProcess(pdef);
+ return pdef;
+ }
+
+ @Override
+ protected Process createProcessOverride(URL jpdl) throws IOException
+ {
+ ProcessDefinition oldPD;
+ try
+ {
+ oldPD = ProcessDefinition.parseXmlInputStream(jpdl.openStream());
+ }
+ catch (JpdlException ex)
+ {
+ throw new InvalidProcessException(ex);
+ }
+ Process pdef = ProcessAdapter.buildProcess(oldPD);
+ addProcess(pdef);
+ return pdef;
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/ProcessManagerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/SignalManagerImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,48 @@
+/*
+ * 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.runtime.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);
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/client/SignalManagerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,50 @@
+/*
+ * 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.model;
+
+//$Id$
+
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.internal.AbstractEndEvent;
+import org.jboss.bpm.runtime.Token;
+import org.jbpm.graph.def.Node;
+
+/**
+ * TODO
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class EndEventImpl extends AbstractEndEvent
+{
+ EndEventImpl(Process proc, Node oldNode)
+ {
+ setProcess(proc);
+ setImplObject(oldNode);
+ }
+
+ @Override
+ protected void executeOverwrite(Token token)
+ {
+ // nothing to do
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/EndEventImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,119 @@
+/*
+ * 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.model;
+
+// $Id$
+
+import java.util.List;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.model.internal.AbstractFlowObject;
+import org.jboss.bpm.runtime.BasicTask;
+import org.jbpm.graph.def.Action;
+import org.jbpm.graph.def.Event;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.node.EndState;
+import org.jbpm.graph.node.StartState;
+import org.jbpm.graph.node.State;
+
+/**
+ * Adapts on jBPM3 ProcessDefinition to an API Process
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class ProcessAdapter
+{
+
+ public static Process buildProcess(org.jbpm.graph.def.ProcessDefinition oldPD)
+ {
+ ProcessImpl apiProc = new ProcessImpl(oldPD);
+ List<org.jbpm.graph.def.Node> oldNodes = oldPD.getNodes();
+ for (org.jbpm.graph.def.Node oldNode : oldNodes)
+ {
+ AbstractFlowObject flowObject = NodeAdapter.adaptNode(apiProc, oldNode);
+ apiProc.addFlowObject(flowObject);
+ }
+
+ // validate
+ validateProcess(apiProc);
+
+ return apiProc;
+ }
+
+ private static void validateProcess(Process apiProc)
+ {
+ // These methods are expected to throw exceptions if there are no such states
+ apiProc.getStartEvent();
+ apiProc.getEndEvents();
+ }
+
+ static class NodeAdapter
+ {
+ static AbstractFlowObject adaptNode(Process apiProc, Node oldNode)
+ {
+ AbstractFlowObject flowObject;
+ if (oldNode instanceof StartState)
+ {
+ flowObject = new StartEventImpl(apiProc, oldNode);
+ }
+ else if (oldNode instanceof EndState)
+ {
+ flowObject = new EndEventImpl(apiProc, oldNode);
+ }
+ else if (oldNode instanceof State)
+ {
+ Task delegate = null;
+ Event event = oldNode.getEvent(Event.EVENTTYPE_NODE_ENTER);
+ if (event != null)
+ {
+ List actions = event.getActions();
+ if (actions == null || actions.size() == 0)
+ throw new InvalidProcessException("Cannot find action on event: " + event);
+ if (actions.size() > 1)
+ throw new InvalidProcessException("Multiple actions not supported: " + event);
+
+ Action action = (Action)actions.get(0);
+ Object obj = action.getActionDelegation().getInstance();
+ if (obj instanceof Task == false)
+ throw new InvalidProcessException("Node action is not of type Task");
+
+ delegate = (Task)obj;
+ }
+ flowObject = new TaskImpl(apiProc, oldNode, delegate);
+ if (delegate instanceof BasicTask)
+ {
+ BasicTask basic = (BasicTask)delegate;
+ basic.setProcess(apiProc);
+ basic.setName(oldNode.getName());
+ }
+ }
+ else
+ {
+ throw new InvalidProcessException("Unsupported node type: " + oldNode);
+ }
+ return flowObject;
+ }
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,94 @@
+/*
+ * 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.model;
+
+//$Id$
+
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.internal.AbstractFlowObject;
+import org.jboss.bpm.model.internal.AbstractProcess;
+import org.jboss.bpm.runtime.Token;
+import org.jbpm.graph.def.GraphElement;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.Execution;
+
+/**
+ * A jBPM3 implementation of a process definition
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class ProcessImpl extends AbstractProcess
+{
+ public ProcessImpl(ProcessDefinition oldPD)
+ {
+ setImplObject(oldPD);
+ init(oldPD.getName());
+ }
+
+ // Provide public access
+ public void addFlowObject(AbstractFlowObject flowObject)
+ {
+ super.addFlowObject(flowObject);
+ }
+
+ public FlowObject findFlowObject(GraphElement graphElement)
+ {
+ FlowObject fo = null;
+ for (FlowObject aux : getFlowObjects())
+ {
+ if (((AbstractFlowObject)aux).getImplObject() == graphElement)
+ {
+ fo = aux;
+ break;
+ }
+ }
+ return fo;
+ }
+
+ public String getName()
+ {
+ GraphElement oldEl = (GraphElement)getImplObject();
+ return oldEl.getName();
+ }
+
+ public void setName(String name)
+ {
+ GraphElement oldEl = (GraphElement)getImplObject();
+ oldEl.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();
+ }
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/ProcessImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,73 @@
+/*
+ * 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.model;
+
+//$Id$
+
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.internal.AbstractStartEvent;
+import org.jboss.bpm.runtime.Token;
+import org.jbpm.context.exe.ContextInstance;
+import org.jbpm.graph.def.GraphElement;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.exe.Execution;
+import org.jbpm.integration.runtime.ExecutionContextImpl;
+
+/**
+ * TODO
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class StartEventImpl extends AbstractStartEvent
+{
+ private Execution oldEx;
+
+ StartEventImpl(Process proc, Node oldNode)
+ {
+ setProcess(proc);
+ setImplObject(oldNode);
+ }
+
+ @Override
+ public void execute(Token token)
+ {
+ super.execute(token);
+ oldEx.signal();
+ }
+
+ @Override
+ protected void executeOverwrite(Token token)
+ {
+ // Create a new Execution and copy the attachments
+ GraphElement oldEl = (GraphElement)getImplObject();
+ oldEx = new Execution(oldEl.getProcessDefinition());
+ ContextInstance ctxInst = oldEx.getContextInstance();
+ new ExecutionContextImpl(ctxInst).copyAttachments(token.getExecutionContext());
+ ctxInst.setTransientVariable(Process.class.getName(), getProcess());
+ }
+
+ public Execution getExecution()
+ {
+ return oldEx;
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/StartEventImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -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.model;
+
+//$Id$
+
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.model.internal.AbstractTask;
+import org.jboss.bpm.runtime.Token;
+import org.jbpm.graph.def.GraphElement;
+import org.jbpm.graph.def.Node;
+
+/**
+ * A jBPM3 implementation of a flow object
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class TaskImpl extends AbstractTask
+{
+ private Task delegate;
+
+ TaskImpl(Process proc, Node oldNode, Task task)
+ {
+ setProcess(proc);
+ setImplObject(oldNode);
+ init(oldNode.getName());
+ this.delegate = task;
+ }
+
+ public String getName()
+ {
+ GraphElement oldEl = (GraphElement)getImplObject();
+ return oldEl.getName();
+ }
+
+ public void setName(String name)
+ {
+ GraphElement oldEl = (GraphElement)getImplObject();
+ oldEl.setName(name);
+ }
+
+ @Override
+ public void execute(Token token)
+ {
+ if (delegate != null)
+ {
+ delegate.execute(token);
+ }
+ else
+ {
+ super.execute(token);
+ }
+ }
+
+ @Override
+ protected void executeOverwrite(Token token)
+ {
+ // nothing to do
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/model/TaskImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/ActivityWrapper.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/ActivityWrapper.java 2008-07-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/ActivityWrapper.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -1,59 +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.runtime;
-
-// $Id$
-
-import org.jboss.bpm.process.Execution;
-import org.jboss.bpm.runtime.Activity;
-import org.jbpm.context.exe.ContextInstance;
-import org.jbpm.graph.def.Action;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.exe.ExecutionContext;
-
-/**
- * This is a wrapper arround an API Activity
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class ActivityWrapper implements ActionHandler
-{
- private static final long serialVersionUID = 3617376097428098837L;
-
- private Activity activity;
-
- public ActivityWrapper(Action action, Activity activity)
- {
- this.activity = activity;
- }
-
- public void execute(ExecutionContext executionContext) throws Exception
- {
- ContextInstance ctxInst = executionContext.getContextInstance();
- Execution ex = (Execution)ctxInst.getTransientVariable(Execution.class.getName());
- if (ex == null)
- throw new IllegalStateException("Cannot obtain API Execution");
-
- activity.execute(ex.getNode(), ex.getContext());
- }
-}
Added: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/ExecutionContextImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/ExecutionContextImpl.java (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/ExecutionContextImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,145 @@
+/*
+ * 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.runtime;
+
+//$Id$
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.jboss.bpm.client.Attachments;
+import org.jboss.bpm.runtime.ExecutionContext;
+import org.jbpm.context.exe.ContextInstance;
+
+/**
+ * An implementation that delegates to the jBPM3 ContextInstance
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class ExecutionContextImpl implements ExecutionContext
+{
+ private ContextInstance ctxInst;
+
+ public ExecutionContextImpl(ContextInstance ctxInst)
+ {
+ this.ctxInst = ctxInst;
+ }
+
+ public void copyAttachments(Attachments att)
+ {
+ for (Key key : att.getAttachmentKeys())
+ {
+ Object value = att.getAttachment(key.getClassPart(), key.getNamePart());
+ addAttachment(key.getClassPart(), key.getNamePart(), value);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, Object value)
+ {
+ Key key = new Key(clazz, null);
+ ctxInst.setTransientVariable(key, value);
+ return (T)value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, String name, Object value)
+ {
+ Key key = new Key(clazz, name);
+ ctxInst.setTransientVariable(key, value);
+ return (T)value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(String name, Object value)
+ {
+ Key key = new Key(null, name);
+ ctxInst.setTransientVariable(key, value);
+ return (T)value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ Key key = new Key(clazz, null);
+ Object value = ctxInst.getTransientVariable(key);
+ return (T)value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz, String name)
+ {
+ Key key = new Key(clazz, name);
+ Object value = ctxInst.getTransientVariable(key);
+ return (T)value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(String name)
+ {
+ Key key = new Key(null, name);
+ Object value = ctxInst.getTransientVariable(key);
+ return (T)value;
+ }
+
+ public Collection<Key> getAttachmentKeys()
+ {
+ Set<Key> keys = new HashSet<Key>();
+ Iterator<?> itKeys = ctxInst.getTransientVariables().keySet().iterator();
+ while (itKeys.hasNext())
+ {
+ Object key = itKeys.next();
+ if (key instanceof Key)
+ {
+ keys.add((Key)key);
+ }
+ }
+ return keys;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz)
+ {
+ Key key = new Key(clazz, null);
+ Object value = ctxInst.deleteTransientVariable(key);
+ return (T)value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz, String name)
+ {
+ Key key = new Key(clazz, name);
+ Object value = ctxInst.deleteTransientVariable(key);
+ return (T)value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(String name)
+ {
+ Key key = new Key(null, name);
+ Object value = ctxInst.deleteTransientVariable(key);
+ return (T)value;
+ }
+}
\ No newline at end of file
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/ExecutionContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TaskWrapper.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TaskWrapper.java (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TaskWrapper.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,48 @@
+/*
+ * 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.runtime;
+
+// $Id$
+
+import org.jbpm.graph.def.Action;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * This is a wrapper arround an API Task
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class TaskWrapper implements ActionHandler
+{
+ private static final long serialVersionUID = -1;
+
+ public TaskWrapper(Action action)
+ {
+ }
+
+ public void execute(ExecutionContext oldContext) throws Exception
+ {
+ // nothing to do
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TaskWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TokenImpl.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TokenImpl.java (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TokenImpl.java 2008-07-09 18:23:16 UTC (rev 1560)
@@ -0,0 +1,57 @@
+/*
+ * 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.runtime;
+
+// $Id$
+
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.runtime.ExecutionContext;
+import org.jboss.bpm.runtime.internal.AbstractToken;
+import org.jbpm.context.exe.ContextInstance;
+
+/**
+ * An implementation of an API token
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class TokenImpl extends AbstractToken
+{
+ private Process proc;
+
+ public TokenImpl(Process proc, ContextInstance ctxInst)
+ {
+ this.proc = proc;
+ setImplObject(ctxInst);
+ }
+
+ public Process getProcess()
+ {
+ return proc;
+ }
+
+ public ExecutionContext getExecutionContext()
+ {
+ ContextInstance ctxInst = (ContextInstance)getImplObject();
+ return new ExecutionContextImpl(ctxInst);
+ }
+}
Property changes on: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/integration/runtime/TokenImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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-09 18:22:54 UTC (rev 1559)
+++ jbpm3/trunk/modules/jpdl/core/src/main/resources/jbpm-beans.xml 2008-07-09 18:23:16 UTC (rev 1560)
@@ -6,23 +6,17 @@
<!-- The process engine -->
<bean name="jBPMProcessEngine" class="org.jbpm.integration.client.ProcessEngineImpl">
- <property name="processDefinitionManager"><inject bean="jBPMProcessDefinitionManager"/></property>
- <property name="processInstanceManager"><inject bean="jBPMProcessInstanceManager"/></property>
- <property name="executionManager"><inject bean="jBPMExecutionManager"/></property>
+ <property name="processManager"><inject bean="jBPMProcessManager"/></property>
+ <property name="signalManager"><inject bean="jBPMSignalManager"/></property>
</bean>
<!-- The process definition manager -->
- <bean name="jBPMProcessDefinitionManager" class="org.jbpm.integration.client.ProcessDefinitionManagerImpl">
+ <bean name="jBPMProcessManager" class="org.jbpm.integration.client.ProcessManagerImpl">
<property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
</bean>
- <!-- The process instance manager -->
- <bean name="jBPMProcessInstanceManager" class="org.jbpm.integration.client.ProcessInstanceManagerImpl">
- <property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
- </bean>
-
<!-- The execution manager -->
- <bean name="jBPMExecutionManager" class="org.jbpm.integration.client.ExecutionManagerImpl">
+ <bean name="jBPMSignalManager" class="org.jbpm.integration.client.SignalManagerImpl">
<property name="processEngine"><inject bean="jBPMProcessEngine" state="Instantiated"/></property>
</bean>
More information about the jbpm-commits
mailing list