[jbpm-commits] JBoss JBPM SVN: r2694 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm and 13 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Oct 31 05:13:32 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-10-31 05:13:32 -0400 (Fri, 31 Oct 2008)
New Revision: 2694
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client/ClientExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/Environment.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Comment.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/IdGenerator.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Node.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ProcessFactory.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/PvmDbSession.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/TimerSession.java
jbpm4/trunk/modules/cts/src/test/java/org/jbpm/cts/
jbpm4/trunk/modules/cts/src/test/java/org/jbpm/cts/db/
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client/ClientExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/Environment.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Comment.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/IdGenerator.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Node.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenExecution.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ProcessFactory.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/PvmDbSession.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/TimerSession.java
jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/MockProcessEngine.java
jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java
Modified:
jbpm4/trunk/modules/api/pom.xml
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentFactory.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/MessageSession.java
jbpm4/trunk/modules/cts/pom.xml
jbpm4/trunk/modules/enterprise/pom.xml
Log:
unification api proposals
Modified: jbpm4/trunk/modules/api/pom.xml
===================================================================
--- jbpm4/trunk/modules/api/pom.xml 2008-10-31 09:12:32 UTC (rev 2693)
+++ jbpm4/trunk/modules/api/pom.xml 2008-10-31 09:13:32 UTC (rev 2694)
@@ -12,13 +12,11 @@
<!-- $Id$ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBoss jBPM4 - API</name>
+ <name>jBPM 4 - API</name>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-api</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-SNAPSHOT</version>
-
<!-- Parent -->
<parent>
<groupId>org.jbpm.jbpm4</groupId>
@@ -39,6 +37,10 @@
<!-- Dependencies -->
<dependencies>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
+ </dependency>
</dependencies>
<!-- Plugins -->
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity (from rev 2677, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/activity)
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,272 +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.pvm.activity;
-
-import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.PvmException;
-import org.jbpm.pvm.client.ClientProcessDefinition;
-import org.jbpm.pvm.client.ClientProcessInstance;
-import org.jbpm.pvm.env.Environment;
-import org.jbpm.pvm.model.Node;
-import org.jbpm.pvm.model.ObservableElement;
-import org.jbpm.pvm.model.OpenExecution;
-import org.jbpm.pvm.model.Transition;
-import org.jbpm.pvm.processlog.ProcessLog;
-import org.jbpm.pvm.session.PvmDbSession;
-
-
-/** view upon an {@link Execution path of execution} exposed to
- * {@link Activity} implementations.
- *
- * @author Tom Baeyens
- */
-public interface ActivityExecution extends OpenExecution {
-
- // wait state behaviour /////////////////////////////////////////////////////
-
- /** makes this execution wait in the current node until an external trigger is given
- * with one of the {@link #signal()} methods. */
- void waitForSignal();
-
- // taking a transition //////////////////////////////////////////////////////
-
- /** takes the default transition.
- *
- * <p>This method can only be called from inside
- * {@link ExternalActivity} implementations and in rare occasions also from outside
- * of the execution (from an external client while the process is in a wait state).
- * For external clients, it is more normal to use the {@link #signal()}
- * method as in that case, it's the current node (hence the process language)that
- * will decide how to interpret the signal.
- * </p>
- *
- * @throws PvmException in case there is no default transition in the current node
- * or in case this method is called from inside an {@link Activity} */
- void takeDefaultTransition();
-
- /** takes the outgoing transition with the given name.
- *
- * <p>This method can only be called
- * from inside {@link ExternalActivity} implementations and in rare occasions also from
- * outside of the execution (from an external client while the process is in a wait state).
- * For external clients, it is more normal to use the {@link #signal(String)}
- * method as in that case, it's the current node (hence the process language)that
- * will decide how to interpret the signal.</p>
- *
- * <p>Transitions will be looked up recursively starting from the
- * {@link #getNode() current node} and then up the {@link Node#getParent() node-parent-hierarchy} </p>
- *
- * @param transitionName is the name of the transition to take. A null value will
- * match the first unnamed transition.
- *
- * @throws PvmException in case no such transition is found in {@link #getNode() the current node}
- * or in case this method is called from inside an {@link Activity}.*/
- void take(String transitionName);
-
- /** takes the given outgoing transition.
- *
- * <p>This method can only be called
- * from inside {@link ExternalActivity} implementations and in rare occasions also from
- * outside of the execution (from an external client while the process is in a wait state).
- * For external clients, it is more normal to use the {@link #signal(String)}
- * method as in that case, it's the current node (hence the process language)that
- * will decide how to interpret the signal.</p>
- *
- * <p>CAUTION: It's up to the client to make sure
- * that this transition makes sense as there is no check whether the given transition
- * is an outgoing transition of the current node. The motivation for that is
- * that in case of superstates, that check can become too 'expensive'. </p> */
- void take(Transition transition);
-
- /** let's the given execution take the transition.
- * @throws PvmException if the execution is not part of this process instance. */
- void take(Transition transition, Execution execution);
-
- // execute a child node /////////////////////////////////////////////////////
-
- /** executes the given nested node.
- *
- * <p>The nodeName is looked up in the current node's nested nodes.</p>
- *
- * <p>This method can only be called
- * from inside {@link ExternalActivity} implementations and in rare occasions also from
- * outside of the execution (from an external client while the process is in a wait state).
- * For external clients, it is more normal to use the {@link #signal(String)}
- * method as in that case, it's the current node (hence the process language)that
- * will decide how to interpret the signal.</p> */
- void execute(String nodeName);
-
- /** executes the given node.
- *
- * <p>This method can only be called
- * from inside {@link ExternalActivity} implementations and in rare occasions also from
- * outside of the execution (from an external client while the process is in a wait state).
- * For external clients, it is more normal to use the {@link #signal(String)}
- * method as in that case, it's the current node (hence the process language)that
- * will decide how to interpret the signal.</p>
- */
- void execute(Node node);
-
- // reposition the execution in another node /////////////////////////////////
-
- /** position this execution in the destination node. */
- void move(Node destination);
-
- /** position the given execution in the destination node */
- void move(Node destination, Execution execution);
-
- // managing the parent-child relation ///////////////////////////////////////
-
- /** creates a child execution. See
- * {@link #createExecution(Execution, String)} for more information. */
- Execution createExecution();
-
- /** creates a child execution with the given name. See
- * {@link #createExecution(Execution, String)} for more information. */
- Execution createExecution(String name);
-
- /** creates a new child execution under the given parent. See
- * {@link #createExecution(Execution, String)} for more information.
- * @throws PvmException if the given parent is not in this execution's
- * process instance. */
- Execution createExecution(Execution parent);
-
- /** creates a new child execution under the given parent with the given name.
- * Only leaf executions can be active. So creating the first child execution
- * will {@link Execution#STATE_INACTIVE inactivate} the parent execution
- * automatically.
- * @throws PvmException if the given parent is not in this execution's
- * process instance. */
- Execution createExecution(String name, Execution parent);
-
- /** removes the child execution from this execution. Removing the last
- * child execution of a parent will cause the parent's state to become
- * {@link Execution#STATE_ACTIVE active}. */
- void removeExecution(Execution child);
-
- /** removes the child execution from the given parent. Removing the last
- * child execution of a parent will cause the parent's state to become
- * {@link Execution#STATE_ACTIVE active}. */
- void removeExecution(Execution child, Execution parent);
-
- // create sub process execution /////////////////////////////////////////////
-
- /** creates a sub process related to this path of execution.
- * ProcessDefinitions can be obtained from the {@link PvmDbSession}
- * in the {@link Environment}. */
- ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition);
-
- /** creates a sub process related to this path of execution.
- * ProcessDefinitions can be obtained from the {@link PvmDbSession}
- * in the {@link Environment}. */
- ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition, String key);
-
- /** creates and begins a sub process related to this path of execution.
- * ProcessDefinitions can be obtained from the {@link PvmDbSession}
- * in the {@link Environment}. */
- ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition processDefinition);
-
- /** creates and begins a sub process related to this path of execution.
- * ProcessDefinitions can be obtained from the {@link PvmDbSession}
- * in the {@link Environment}. */
- ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition processDefinition, String key);
-
- // ending an execution //////////////////////////////////////////////////////
-
- /** ends this execution and all of its child executions.
- *
- * <p>The execution will be removed from it's parent. Potentially this can cause
- * a parent execution to start executing in case this is the last concurrent
- * execution for which the parent is waiting.</p>
- *
- * <p>This method should not be called in {@link Activity}s. It can be called from
- * outside the process execution and in {@link ExternalActivity}s. </p> */
- void stop();
-
- /** ends this execution and assigns the state {@link #STATE_CANCELLED}.
- * @see #stop(String) */
- void cancel();
-
- /** ends this execution and all it's child executions with a user defined
- * status.
- *
- * <p>It is not recommended to use any of
- * {@link #STATE_ACTIVE the defined statuses} as that may case unpredictable
- * side effects.</p>
- *
- * <p>The execution will be removed from it's parent.</p> */
- void stop(String state);
-
- // firing events ////////////////////////////////////////////////////////////
-
- /** fires the event on the given eventSource and then propagates the event
- * up to the eventSource's parent chain. All the actions will see the given
- * eventSource in {@link #getEventSource()}, event if the events are
- * registered to parent's of the given eventSource. */
- void fire(String eventName, ObservableElement eventSource);
-
- // logs /////////////////////////////////////////////////////////////////////
-
- /** adds a <a href="package-summary.html#logs">log</a> to this execution. */
- void addLog(ProcessLog processLog);
-
- // extra state information methods //////////////////////////////////////////
-
- /** the current transition indicating the position in the process definition graph.
- * Can be null in case this execution is not taking a transition. */
- Transition getTransition();
-
- // extensions //////////////////////////////////////////////////////////////
-
- /** way to access process language extensions in the execution without
- * having to cast. Casting can be problematic for persistence. */
- <T> T getExtension(Class<T> extensionClass);
-
- /** setter for the priority. The default priority is 0, which means
- * NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1),
- * LOW (-1) and LOWEST (-2). For the rest, the user can set any other
- * priority integer value, but then, the UI will have to display it as
- * an integer and not the named value.*/
- void setPriority(int priority);
-
-
- // previous methods /////////////////////////////////////////////////////////
-
- // TODO evaluate the previous methods (JBPM-)
- // these methods are kind of performance optimisations. a sequence and
- // some other specific control flow implementations can be optimised if they
- // have access to the previous node or transition.
- // Those activities could also be implemented by letting the activities store
- // the contextual information in process variables or some other execution
- // context. But with the previous properties as done now, these control flow
- // nodes can be implemented without storing an extra record. It's only a property
- // that is only updated when the node configuration indicates that it's needed.
- // (see also Node.isPreviousNeeded())
-
- /** returns the previously executed node only if {@link Node#isPreviousNeeded()}
- * is set to true. */
- Node getPreviousNode();
-
- /** returns the previously taken transition only if {@link Node#isPreviousNeeded()}
- * is set to true. */
- Transition getPreviousTransition();
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ActivityExecution.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,272 @@
+/*
+ * 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.pvm.activity;
+
+import org.jbpm.Execution;
+import org.jbpm.PvmException;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.client.ClientProcessInstance;
+import org.jbpm.pvm.env.Environment;
+import org.jbpm.pvm.model.Node;
+import org.jbpm.pvm.model.ObservableElement;
+import org.jbpm.pvm.model.OpenExecution;
+import org.jbpm.pvm.model.Transition;
+import org.jbpm.pvm.processlog.ProcessLog;
+import org.jbpm.pvm.session.PvmDbSession;
+
+
+/** view upon an {@link Execution path of execution} exposed to
+ * {@link Activity} implementations.
+ *
+ * @author Tom Baeyens
+ */
+public interface ActivityExecution extends OpenExecution {
+
+ // wait state behaviour /////////////////////////////////////////////////////
+
+ /** makes this execution wait in the current node until an external trigger is given
+ * with one of the {@link #signal()} methods. */
+ void waitForSignal();
+
+ // taking a transition //////////////////////////////////////////////////////
+
+ /** takes the default transition.
+ *
+ * <p>This method can only be called from inside
+ * {@link ExternalActivity} implementations and in rare occasions also from outside
+ * of the execution (from an external client while the process is in a wait state).
+ * For external clients, it is more normal to use the {@link #signal()}
+ * method as in that case, it's the current node (hence the process language)that
+ * will decide how to interpret the signal.
+ * </p>
+ *
+ * @throws PvmException in case there is no default transition in the current node
+ * or in case this method is called from inside an {@link Activity} */
+ void takeDefaultTransition();
+
+ /** takes the outgoing transition with the given name.
+ *
+ * <p>This method can only be called
+ * from inside {@link ExternalActivity} implementations and in rare occasions also from
+ * outside of the execution (from an external client while the process is in a wait state).
+ * For external clients, it is more normal to use the {@link #signal(String)}
+ * method as in that case, it's the current node (hence the process language)that
+ * will decide how to interpret the signal.</p>
+ *
+ * <p>Transitions will be looked up recursively starting from the
+ * {@link #getNode() current node} and then up the {@link Node#getParent() node-parent-hierarchy} </p>
+ *
+ * @param transitionName is the name of the transition to take. A null value will
+ * match the first unnamed transition.
+ *
+ * @throws PvmException in case no such transition is found in {@link #getNode() the current node}
+ * or in case this method is called from inside an {@link Activity}.*/
+ void take(String transitionName);
+
+ /** takes the given outgoing transition.
+ *
+ * <p>This method can only be called
+ * from inside {@link ExternalActivity} implementations and in rare occasions also from
+ * outside of the execution (from an external client while the process is in a wait state).
+ * For external clients, it is more normal to use the {@link #signal(String)}
+ * method as in that case, it's the current node (hence the process language)that
+ * will decide how to interpret the signal.</p>
+ *
+ * <p>CAUTION: It's up to the client to make sure
+ * that this transition makes sense as there is no check whether the given transition
+ * is an outgoing transition of the current node. The motivation for that is
+ * that in case of superstates, that check can become too 'expensive'. </p> */
+ void take(Transition transition);
+
+ /** let's the given execution take the transition.
+ * @throws PvmException if the execution is not part of this process instance. */
+ void take(Transition transition, Execution execution);
+
+ // execute a child node /////////////////////////////////////////////////////
+
+ /** executes the given nested node.
+ *
+ * <p>The nodeName is looked up in the current node's nested nodes.</p>
+ *
+ * <p>This method can only be called
+ * from inside {@link ExternalActivity} implementations and in rare occasions also from
+ * outside of the execution (from an external client while the process is in a wait state).
+ * For external clients, it is more normal to use the {@link #signal(String)}
+ * method as in that case, it's the current node (hence the process language)that
+ * will decide how to interpret the signal.</p> */
+ void execute(String nodeName);
+
+ /** executes the given node.
+ *
+ * <p>This method can only be called
+ * from inside {@link ExternalActivity} implementations and in rare occasions also from
+ * outside of the execution (from an external client while the process is in a wait state).
+ * For external clients, it is more normal to use the {@link #signal(String)}
+ * method as in that case, it's the current node (hence the process language)that
+ * will decide how to interpret the signal.</p>
+ */
+ void execute(Node node);
+
+ // reposition the execution in another node /////////////////////////////////
+
+ /** position this execution in the destination node. */
+ void move(Node destination);
+
+ /** position the given execution in the destination node */
+ void move(Node destination, Execution execution);
+
+ // managing the parent-child relation ///////////////////////////////////////
+
+ /** creates a child execution. See
+ * {@link #createExecution(Execution, String)} for more information. */
+ Execution createExecution();
+
+ /** creates a child execution with the given name. See
+ * {@link #createExecution(Execution, String)} for more information. */
+ Execution createExecution(String name);
+
+ /** creates a new child execution under the given parent. See
+ * {@link #createExecution(Execution, String)} for more information.
+ * @throws PvmException if the given parent is not in this execution's
+ * process instance. */
+ Execution createExecution(Execution parent);
+
+ /** creates a new child execution under the given parent with the given name.
+ * Only leaf executions can be active. So creating the first child execution
+ * will {@link Execution#STATE_INACTIVE inactivate} the parent execution
+ * automatically.
+ * @throws PvmException if the given parent is not in this execution's
+ * process instance. */
+ Execution createExecution(String name, Execution parent);
+
+ /** removes the child execution from this execution. Removing the last
+ * child execution of a parent will cause the parent's state to become
+ * {@link Execution#STATE_ACTIVE active}. */
+ void removeExecution(Execution child);
+
+ /** removes the child execution from the given parent. Removing the last
+ * child execution of a parent will cause the parent's state to become
+ * {@link Execution#STATE_ACTIVE active}. */
+ void removeExecution(Execution child, Execution parent);
+
+ // create sub process execution /////////////////////////////////////////////
+
+ /** creates a sub process related to this path of execution.
+ * ProcessDefinitions can be obtained from the {@link PvmDbSession}
+ * in the {@link Environment}. */
+ ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition);
+
+ /** creates a sub process related to this path of execution.
+ * ProcessDefinitions can be obtained from the {@link PvmDbSession}
+ * in the {@link Environment}. */
+ ClientProcessInstance createSubProcessInstance(ClientProcessDefinition processDefinition, String key);
+
+ /** creates and begins a sub process related to this path of execution.
+ * ProcessDefinitions can be obtained from the {@link PvmDbSession}
+ * in the {@link Environment}. */
+ ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition processDefinition);
+
+ /** creates and begins a sub process related to this path of execution.
+ * ProcessDefinitions can be obtained from the {@link PvmDbSession}
+ * in the {@link Environment}. */
+ ClientProcessInstance beginSubProcessInstance(ClientProcessDefinition processDefinition, String key);
+
+ // ending an execution //////////////////////////////////////////////////////
+
+ /** ends this execution and all of its child executions.
+ *
+ * <p>The execution will be removed from it's parent. Potentially this can cause
+ * a parent execution to start executing in case this is the last concurrent
+ * execution for which the parent is waiting.</p>
+ *
+ * <p>This method should not be called in {@link Activity}s. It can be called from
+ * outside the process execution and in {@link ExternalActivity}s. </p> */
+ void stop();
+
+ /** ends this execution and assigns the state {@link #STATE_CANCELLED}.
+ * @see #stop(String) */
+ void cancel();
+
+ /** ends this execution and all it's child executions with a user defined
+ * status.
+ *
+ * <p>It is not recommended to use any of
+ * {@link #STATE_ACTIVE the defined statuses} as that may case unpredictable
+ * side effects.</p>
+ *
+ * <p>The execution will be removed from it's parent.</p> */
+ void stop(String state);
+
+ // firing events ////////////////////////////////////////////////////////////
+
+ /** fires the event on the given eventSource and then propagates the event
+ * up to the eventSource's parent chain. All the actions will see the given
+ * eventSource in {@link #getEventSource()}, event if the events are
+ * registered to parent's of the given eventSource. */
+ void fire(String eventName, ObservableElement eventSource);
+
+ // logs /////////////////////////////////////////////////////////////////////
+
+ /** adds a <a href="package-summary.html#logs">log</a> to this execution. */
+ void addLog(ProcessLog processLog);
+
+ // extra state information methods //////////////////////////////////////////
+
+ /** the current transition indicating the position in the process definition graph.
+ * Can be null in case this execution is not taking a transition. */
+ Transition getTransition();
+
+ // extensions //////////////////////////////////////////////////////////////
+
+ /** way to access process language extensions in the execution without
+ * having to cast. Casting can be problematic for persistence. */
+ <T> T getExtension(Class<T> extensionClass);
+
+ /** setter for the priority. The default priority is 0, which means
+ * NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1),
+ * LOW (-1) and LOWEST (-2). For the rest, the user can set any other
+ * priority integer value, but then, the UI will have to display it as
+ * an integer and not the named value.*/
+ void setPriority(int priority);
+
+
+ // previous methods /////////////////////////////////////////////////////////
+
+ // TODO evaluate the previous methods (JBPM-)
+ // these methods are kind of performance optimisations. a sequence and
+ // some other specific control flow implementations can be optimised if they
+ // have access to the previous node or transition.
+ // Those activities could also be implemented by letting the activities store
+ // the contextual information in process variables or some other execution
+ // context. But with the previous properties as done now, these control flow
+ // nodes can be implemented without storing an extra record. It's only a property
+ // that is only updated when the node configuration indicates that it's needed.
+ // (see also Node.isPreviousNeeded())
+
+ /** returns the previously executed node only if {@link Node#isPreviousNeeded()}
+ * is set to true. */
+ Node getPreviousNode();
+
+ /** returns the previously taken transition only if {@link Node#isPreviousNeeded()}
+ * is set to true. */
+ Transition getPreviousTransition();
+}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,68 +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.pvm.activity;
-
-import java.util.Map;
-
-import org.jbpm.pvm.Execution;
-
-
-/** extends {@link Activity} for handling external triggers after a wait state.
- *
- * <p>Process languages will provide a set of these node implementations. But
- * languages like jPDL even allow users to provide their own node behaviour with
- * this interface.
- * </p>
- *
- * @author Tom Baeyens
- */
-public interface ExternalActivity extends Activity {
-
- /** handles an external trigger.
- *
- * <p>An external trigger that comes into an execution
- * through one of the {@link Execution#signal()} methods, will be delegated to
- * the node in which the execution is positioned when it receives the external
- * trigger.
- * </p>
- *
- * <p>The signal method implements how the
- * node will react on that signal. For example, the outgoing transition
- * could be taken that corresponds with the given signal.
- * </p>
- *
- * @param execution the {@link Execution} for which the signal is given
- *
- * @param signalName is an abstract text that can be associated with a signal. this
- * corresponds to e.g. a method name in a java class interface. The implementation
- * can decide e.g. to use the signal to identify the outgoing transition.
- *
- * @param parameters is extra information that can be provided with a signal.
- * In this way, it is somewhat similar to the parameters that can be fed into a method
- * invocation through reflection.
- *
- * @throws Exception to indicate any kind of failure. Note that exceptions are
- * considered non recoverable. After an Exception, the execution should not be
- * used any more and if this is during a transaction, the transaction should be
- * rolled back. */
- void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception;
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/activity/ExternalActivity.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,68 @@
+/*
+ * 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.pvm.activity;
+
+import java.util.Map;
+
+import org.jbpm.Execution;
+
+
+/** extends {@link Activity} for handling external triggers after a wait state.
+ *
+ * <p>Process languages will provide a set of these node implementations. But
+ * languages like jPDL even allow users to provide their own node behaviour with
+ * this interface.
+ * </p>
+ *
+ * @author Tom Baeyens
+ */
+public interface ExternalActivity extends Activity {
+
+ /** handles an external trigger.
+ *
+ * <p>An external trigger that comes into an execution
+ * through one of the {@link Execution#signal()} methods, will be delegated to
+ * the node in which the execution is positioned when it receives the external
+ * trigger.
+ * </p>
+ *
+ * <p>The signal method implements how the
+ * node will react on that signal. For example, the outgoing transition
+ * could be taken that corresponds with the given signal.
+ * </p>
+ *
+ * @param execution the {@link Execution} for which the signal is given
+ *
+ * @param signalName is an abstract text that can be associated with a signal. this
+ * corresponds to e.g. a method name in a java class interface. The implementation
+ * can decide e.g. to use the signal to identify the outgoing transition.
+ *
+ * @param parameters is extra information that can be provided with a signal.
+ * In this way, it is somewhat similar to the parameters that can be fed into a method
+ * invocation through reflection.
+ *
+ * @throws Exception to indicate any kind of failure. Note that exceptions are
+ * considered non recoverable. After an Exception, the execution should not be
+ * used any more and if this is during a transaction, the transaction should be
+ * rolled back. */
+ void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception;
+}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client (from rev 2677, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/client)
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client/ClientExecution.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/client/ClientExecution.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client/ClientExecution.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,196 +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.pvm.client;
-
-import java.util.Map;
-
-import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.PvmException;
-import org.jbpm.pvm.activity.Activity;
-import org.jbpm.pvm.activity.ExternalActivity;
-import org.jbpm.pvm.model.OpenExecution;
-
-/** view upon an {@link Execution path of execution} exposed to
- * external clients.
- *
- * @author Tom Baeyens
- */
-public interface ClientExecution extends OpenExecution {
-
- // stop /////////////////////////////////////////////////////////////////////
-
- // ending an execution //////////////////////////////////////////////////////
-
- /** ends this execution and all of its child executions.
- *
- * <p>All child executions will be stopped and removed. This execution
- * will not be removed from its parent.</p>
- *
- * <p>This method should not be called in {@link Activity}s. It can be called from
- * outside the process execution and in {@link ExternalActivity}s. </p> */
- void stop();
-
- /** ends this execution and assigns the state {@link #STATE_CANCELLED}.
- * @see #stop(String) */
- void cancel();
-
- /** ends this execution and all it's child executions with a user defined
- * status.
- *
- *
- *
- * Giving states {@link */
- void stop(String state);
-
- // signal ///////////////////////////////////////////////////////////////////
-
- /** feeds a external trigger into this execution.
- *
- * <p>Typically a signal causes the execution to proceed, but that doesn't necessarily
- * has to be the case . The {@link ExternalActivity} is responsible for interpreting
- * the signal and acting upon it.
- * </p>
- *
- * <p>A signal can optionally be given {@link #signal(String) a signal name},
- * {@link #signal(Map) a map of parameters} or {@link #signal(String, Map) both}.
- * </p>
- *
- * <p>Since it's an external trigger, this method requires that this execution is
- * waiting for an external trigger. So this method must be called as an external client
- * and can not be called while this execution is executing. In an {@link Activity} for
- * example you're not allowed to call the signal on the execution cause it is executing.
- * But you are allowed to invoke this method on any other execution (at least, if that
- * one is waiting for an external trigger).</p>
- *
- * <p>Typically a signal will cause the execution to start executing, but that is
- * not a must. What happens with this signal is defined in the
- * {@link ExternalActivity#signal(Execution, String, Map)} of
- * the {@link #getNode() current node}. </p>
- *
- * @see #signal(String) */
- void signal();
-
- /** feeds a named {@link #signal() external trigger} into the execution.
- *
- * <p>In each state, a number of things can happen. The signal parameter specifies
- * which of these things is happening. It's somewhat similar to a method name in
- * the invocation of an object.
- * </p>
- *
- * @see #signal() See the unnamed signal for more information
- */
- void signal(String signalName);
-
- /** feeds {@link #signal() an external trigger} into the execution with parameters.
- *
- * @see #signal() See the unnamed signal for more information
- */
- void signal(Map<String, Object> parameters);
-
- /** feeds a named {@link #signal() external trigger} into the execution with parameters.
- *
- * <p>In each state, a number of things can happen. The signal parameter specifies
- * which of these things is happening. It's somewhat similar to a method name in
- * the invocation of an object.
- * </p>
- *
- * <p>The parameters parameter provide extra information to the signal.
- * Typically, the parameters are set as variables but
- * the process language can overwrite that behaviour in the current node.
- * See {@link ExternalActivity#signal(Execution, String, Map)} for more information.
- * </p>
- *
- * @see #signal() See the unnamed signal for more information
- */
- void signal(String signalName, Map<String, Object> parameters);
-
- /** feeds a external trigger into the given execution.
- *
- * <p>Typically a signal causes the execution to proceed, but that doesn't necessarily
- * has to be the case . The {@link ExternalActivity} is responsible for interpreting
- * the signal and acting upon it.
- * </p>
- *
- * <p>A signal can optionally be given {@link #signal(String) a signal name},
- * {@link #signal(Map) a map of parameters} or {@link #signal(String, Map) both}.
- * </p>
- *
- * <p>Since it's an external trigger, this method requires that this execution is
- * waiting for an external trigger. So this method must be called as an external client
- * and can not be called while this execution is executing. In an {@link Activity} for
- * example you're not allowed to call the signal on the execution cause it is executing.
- * But you are allowed to invoke this method on any other execution (at least, if that
- * one is waiting for an external trigger).</p>
- *
- * <p>Typically a signal will cause the execution to start executing, but that is
- * not a must. What happens with this signal is defined in the
- * {@link ExternalActivity#signal(Execution, String, Map)} of
- * the {@link #getNode() current node}. </p>
- *
- * @see #signal(String) */
- void signal(Execution execution);
-
- /** feeds a named {@link #signal() external trigger} into a given execution.
- *
- * <p>In each state, a number of things can happen. The signal parameter specifies
- * which of these things is happening. It's somewhat similar to a method name in
- * the invocation of an object.
- * </p>
- *
- * @see #signal() See the unnamed signal for more information
- */
- void signal(String signalName, Execution execution);
-
- /** feeds {@link #signal() an external trigger} into a given execution with parameters.
- *
- * @see #signal() See the unnamed signal for more information
- */
- void signal(Map<String, Object> parameters, Execution execution);
-
- /** feeds a named {@link #signal() external trigger} into a given execution with parameters.
- *
- * <p>In each state, a number of things can happen. The signal parameter specifies
- * which of these things is happening. It's somewhat similar to a method name in
- * the invocation of an object.
- * </p>
- *
- * <p>The parameters parameter provide extra information to the signal.
- * Typically, the parameters are set as variables but
- * the process language can overwrite that behaviour in the current node.
- * See {@link ExternalActivity#signal(Execution, String, Map)} for more information.
- * </p>
- *
- * @see #signal() See the unnamed signal for more information
- */
- void signal(String signalName, Map<String, Object> parameters, Execution execution);
-
-
- /** suspends this execution and all it's child executions. Human tasks
- * of a suspended execution shouldn't show up in people's task list and
- * timers of suspended executions shouldn't fire.
- * @throws PvmException if this execution is already suspended. */
- void suspend();
-
- /** resumes an execution. Inverse of {@link #suspend()}.
- * @throws PvmException if this execution is not suspended. */
- void resume();
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client/ClientExecution.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/client/ClientExecution.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client/ClientExecution.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/client/ClientExecution.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,196 @@
+/*
+ * 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.pvm.client;
+
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.PvmException;
+import org.jbpm.pvm.activity.Activity;
+import org.jbpm.pvm.activity.ExternalActivity;
+import org.jbpm.pvm.model.OpenExecution;
+
+/** view upon an {@link Execution path of execution} exposed to
+ * external clients.
+ *
+ * @author Tom Baeyens
+ */
+public interface ClientExecution extends OpenExecution {
+
+ // stop /////////////////////////////////////////////////////////////////////
+
+ // ending an execution //////////////////////////////////////////////////////
+
+ /** ends this execution and all of its child executions.
+ *
+ * <p>All child executions will be stopped and removed. This execution
+ * will not be removed from its parent.</p>
+ *
+ * <p>This method should not be called in {@link Activity}s. It can be called from
+ * outside the process execution and in {@link ExternalActivity}s. </p> */
+ void stop();
+
+ /** ends this execution and assigns the state {@link #STATE_CANCELLED}.
+ * @see #stop(String) */
+ void cancel();
+
+ /** ends this execution and all it's child executions with a user defined
+ * status.
+ *
+ *
+ *
+ * Giving states {@link */
+ void stop(String state);
+
+ // signal ///////////////////////////////////////////////////////////////////
+
+ /** feeds a external trigger into this execution.
+ *
+ * <p>Typically a signal causes the execution to proceed, but that doesn't necessarily
+ * has to be the case . The {@link ExternalActivity} is responsible for interpreting
+ * the signal and acting upon it.
+ * </p>
+ *
+ * <p>A signal can optionally be given {@link #signal(String) a signal name},
+ * {@link #signal(Map) a map of parameters} or {@link #signal(String, Map) both}.
+ * </p>
+ *
+ * <p>Since it's an external trigger, this method requires that this execution is
+ * waiting for an external trigger. So this method must be called as an external client
+ * and can not be called while this execution is executing. In an {@link Activity} for
+ * example you're not allowed to call the signal on the execution cause it is executing.
+ * But you are allowed to invoke this method on any other execution (at least, if that
+ * one is waiting for an external trigger).</p>
+ *
+ * <p>Typically a signal will cause the execution to start executing, but that is
+ * not a must. What happens with this signal is defined in the
+ * {@link ExternalActivity#signal(Execution, String, Map)} of
+ * the {@link #getNode() current node}. </p>
+ *
+ * @see #signal(String) */
+ void signal();
+
+ /** feeds a named {@link #signal() external trigger} into the execution.
+ *
+ * <p>In each state, a number of things can happen. The signal parameter specifies
+ * which of these things is happening. It's somewhat similar to a method name in
+ * the invocation of an object.
+ * </p>
+ *
+ * @see #signal() See the unnamed signal for more information
+ */
+ void signal(String signalName);
+
+ /** feeds {@link #signal() an external trigger} into the execution with parameters.
+ *
+ * @see #signal() See the unnamed signal for more information
+ */
+ void signal(Map<String, Object> parameters);
+
+ /** feeds a named {@link #signal() external trigger} into the execution with parameters.
+ *
+ * <p>In each state, a number of things can happen. The signal parameter specifies
+ * which of these things is happening. It's somewhat similar to a method name in
+ * the invocation of an object.
+ * </p>
+ *
+ * <p>The parameters parameter provide extra information to the signal.
+ * Typically, the parameters are set as variables but
+ * the process language can overwrite that behaviour in the current node.
+ * See {@link ExternalActivity#signal(Execution, String, Map)} for more information.
+ * </p>
+ *
+ * @see #signal() See the unnamed signal for more information
+ */
+ void signal(String signalName, Map<String, Object> parameters);
+
+ /** feeds a external trigger into the given execution.
+ *
+ * <p>Typically a signal causes the execution to proceed, but that doesn't necessarily
+ * has to be the case . The {@link ExternalActivity} is responsible for interpreting
+ * the signal and acting upon it.
+ * </p>
+ *
+ * <p>A signal can optionally be given {@link #signal(String) a signal name},
+ * {@link #signal(Map) a map of parameters} or {@link #signal(String, Map) both}.
+ * </p>
+ *
+ * <p>Since it's an external trigger, this method requires that this execution is
+ * waiting for an external trigger. So this method must be called as an external client
+ * and can not be called while this execution is executing. In an {@link Activity} for
+ * example you're not allowed to call the signal on the execution cause it is executing.
+ * But you are allowed to invoke this method on any other execution (at least, if that
+ * one is waiting for an external trigger).</p>
+ *
+ * <p>Typically a signal will cause the execution to start executing, but that is
+ * not a must. What happens with this signal is defined in the
+ * {@link ExternalActivity#signal(Execution, String, Map)} of
+ * the {@link #getNode() current node}. </p>
+ *
+ * @see #signal(String) */
+ void signal(Execution execution);
+
+ /** feeds a named {@link #signal() external trigger} into a given execution.
+ *
+ * <p>In each state, a number of things can happen. The signal parameter specifies
+ * which of these things is happening. It's somewhat similar to a method name in
+ * the invocation of an object.
+ * </p>
+ *
+ * @see #signal() See the unnamed signal for more information
+ */
+ void signal(String signalName, Execution execution);
+
+ /** feeds {@link #signal() an external trigger} into a given execution with parameters.
+ *
+ * @see #signal() See the unnamed signal for more information
+ */
+ void signal(Map<String, Object> parameters, Execution execution);
+
+ /** feeds a named {@link #signal() external trigger} into a given execution with parameters.
+ *
+ * <p>In each state, a number of things can happen. The signal parameter specifies
+ * which of these things is happening. It's somewhat similar to a method name in
+ * the invocation of an object.
+ * </p>
+ *
+ * <p>The parameters parameter provide extra information to the signal.
+ * Typically, the parameters are set as variables but
+ * the process language can overwrite that behaviour in the current node.
+ * See {@link ExternalActivity#signal(Execution, String, Map)} for more information.
+ * </p>
+ *
+ * @see #signal() See the unnamed signal for more information
+ */
+ void signal(String signalName, Map<String, Object> parameters, Execution execution);
+
+
+ /** suspends this execution and all it's child executions. Human tasks
+ * of a suspended execution shouldn't show up in people's task list and
+ * timers of suspended executions shouldn't fire.
+ * @throws PvmException if this execution is already suspended. */
+ void suspend();
+
+ /** resumes an execution. Inverse of {@link #suspend()}.
+ * @throws PvmException if this execution is not suspended. */
+ void resume();
+}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env (from rev 2677, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env)
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/Environment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/Environment.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/Environment.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,268 +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.pvm.env;
-
-import java.io.Serializable;
-import java.util.Stack;
-
-import org.jbpm.pvm.PvmException;
-
-
-/**
- * maintains contextual information for a thread in a set of
- * {@link Context}s.
- *
- * <h3>Introduction</h3>
- *
- * <p>Objects have different lifecycles and different context's (aka scopes). An
- * environment provides the structure to easily manage objects with different
- * contexts.
- * </p>
- *
- * <p>Examples of contexts are:
- * <ul>
- * <li><b>environment-factory</b>: The environment-factory context is used to store e.g. data sources,
- * session factories and other static resources needed by an application.
- * The environment-factory context lives for the complete duration of the {@link EnvironmentFactory}.
- * So if the {@link EnvironmentFactory} is maintained in a static member field, the
- * environment-factory context lives for the duration of the application.
- * The same environment-factory context is shared for all the Environments produced by one
- * EnvironmentFactory.</li>
- * <li><b>environment</b>: The environment context is used for e.g. a transaction
- * and transactional resources, user authentication. This results in an efficient and
- * configurable use of transactional resources that need to be lazily initialized.</li>
- * <li>The environment can accomodate other contexts as well. They can be added
- * and removed dynamically. Examples of other potential contexts are web-request, web-session,
- * web-application, business processDefinition, jobImpl, ... </li>
- * </ul>
- *
- * <center><img src="environment.gif"/></center>
- *
- * <p>An environment is typically installed like this
- * </p>
- *
- * <b><pre>static EnvironmentFactory environmentFactory = new DefaultEnvironmentFactory();
- *
- * ...
- *
- * Environment environment = environmentFactory.openEnvironment();
- * try {
- *
- * ... everything available in this block ...
- *
- * } finally {
- * environment.close();
- * }
- * </pre></b>
- *
- * <h3>Purpose</h3>
- *
- * <p>The first purpose of the environment is to separate the application from the
- * environment. Standard Java and Enterprise Java are quite different and an environment
- * abstraction like this allows for the development of applications that can run in
- * both Standard and Enterprise environments. Also test environments are easier to
- * tweak this way.
- * </p>
- *
- * <p>A second purpose of the environment is to enable specific to global searching
- * of resources. E.g. you could search for an 'adminEmailAddress' in the contexts
- * 'processDefinition-execution', 'processDefinition-definition' and 'environment-factory' in the given order.
- * That way, a global adminEmailAddress can be specified in the environment-factory context
- * and it can be refined in more specific contexts processDefinition-definition or processDefinition-execution.
- * </p>
- *
- * <h3>Search order</h3>
- *
- * <p>To find an object in the environment, a searchOrder can be specified. A
- * search order is an sequence that specifies the order in which the contexts should
- * be searched.
- * </p>
- *
- * <p>The default search order is the inverse sequence of how the contexts are
- * added to the environment. This is because in general, we can assume that the
- * more recent a context was added, the more specific it is.
- * </p>
- *
- * <h3>Transaction, username and classloader</h3>
- *
- * <p>Three objects are used so frequently in an environment that they get
- * special treatment:
- * </p>
- *
- * <ul>
- * <li><b>Transaction</b>: an abstraction for marking a transaction with
- * setRollbackOnly.</li>
- * <li><b>Classloader</b>: the current class loader.</li>
- * <li><b>Username</b>: the name of the currently authenticated user.</li>
- * </ul>
- *
- * <p>For these special properties, setters are also available. That is to support
- * programmatic injection into the environment. Alternatively, they can be configured
- * in one of the contexts.
- * </p>
- *
- *
- * @see EnvironmentFactory
- * @author Tom Baeyens
- */
-public abstract class Environment implements Serializable {
-
- /**
- * searches a named object in all the contexts in the default search order.
- * @return the object if it exists in the environment, <code>null</code> if there is no object with the given name in the environment.
- */
- public abstract Object get(String name);
-
- /**
- * searches a named object in all the contexts in the given search order. The given
- * search order doesn't have to include all contexts. It can be a subset of the
- * contexts available.
- * @param searchOrder list of contexts names. The object will be searched in these contexts, in the given order.
- * @return the object if it exists in the environment, <code>null</code> if there is no object with the given name in the specified searchOrder contexts.
- */
- public abstract Object get(String name, String[] searchOrder);
-
- /** searches an object based on type. The search doesn take superclasses of the context elements
- * into account.
- * @return the first object of the given type or null in case no such element was found.
- */
- public abstract <T> T get(Class<T> type);
-
-
- /** searches an object based on type. The search doesn take superclasses of the context elements
- * into account.
- * @return the first object of the given type or null in case no such element was found.
- */
- public abstract <T> T get(Class<T> type, String[] searchOrder);
-
- /** get the authenticated user id */
- public abstract String getUserId();
-
- /** set the authenticated user id */
- public abstract void setUserId(String userId);
-
- /**
- * closes the Environment by removing all its contexts.
- */
- public abstract void close();
-
- public abstract Context getContext(String contextName);
- public abstract void addContext(Context context);
- public abstract void removeContext(Context context);
-
- public abstract ClassLoader getClassLoader();
- public abstract void setClassLoader(ClassLoader classLoader);
-
- // current environment //////////////////////////////////////////////////////
- /** the current environment is maintained in the currentEnvironment thread local */
- static ThreadLocal<Environment> currentEnvironment = new ThreadLocal<Environment>();
-
- /** in case of nested environments, the current environment stack maintains the outer environments */
- static ThreadLocal<Stack<Environment>> currentEnvironmentStack = new ThreadLocal<Stack<Environment>>();
-
- /** gets the most inner open environment. */
- public static Environment getCurrent() {
- return currentEnvironment.get();
- }
-
- public static <T> T getFromCurrent(Class<T> type) {
- return getFromCurrent(type, true);
- }
-
- public static <T> T getFromCurrent(Class<T> type, boolean required) {
- Environment environment = getCurrent();
- if (environment==null) {
- if (required) {
- throw new PvmException("no environment to get "+type.getName());
- }
- return null;
- }
- T object = environment.get(type);
- if (object==null) {
- if (required) {
- throw new PvmException("no "+type.getName()+" in current environment");
- }
- return null;
- }
- return object;
- }
-
- public static Object getFromCurrent(String name) {
- return getFromCurrent(name, true);
- }
-
- public static Object getFromCurrent(String name, boolean required) {
- Environment environment = getCurrent();
- if (environment==null) {
- if (required) {
- throw new PvmException("no environment to get '"+name+"'");
- }
- return null;
- }
- Object object = environment.get(name);
- if (object==null) {
- if (required) {
- throw new PvmException("no '"+name+"' in current environment");
- }
- return null;
- }
- return object;
- }
-
- static Stack<Environment> getStack() {
- // lazy initialize the current environment stack
- Stack<Environment> stack = currentEnvironmentStack.get();
- if (stack==null) {
- stack = new Stack<Environment>();
- currentEnvironmentStack.set(stack);
- }
- return stack;
- }
-
-
- /** pops the closing context from the stack of current contexts. This
- * is the first thing that needs to be done when an environment is closed.
- * @see EnvironmentFactory#push(Environment) */
- protected static synchronized Environment popEnvironment() {
- Environment popped = currentEnvironment.get();
- currentEnvironment.set(null);
- Stack<Environment> stack = currentEnvironmentStack.get();
- if ( (stack!=null)
- && (! stack.isEmpty())
- ) {
- currentEnvironment.set(stack.pop());
- }
- return popped;
- }
-
- /** after opening of a new environment succeeded, the environment
- * must be pushed in the stack of current environments.
- *
- * @see Environment#pop() */
- protected static synchronized void pushEnvironment(Environment environment) {
- Environment current = currentEnvironment.get();
- if (current!=null) {
- getStack().push(current);
- }
- currentEnvironment.set(environment);
- }
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/Environment.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/Environment.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/Environment.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/Environment.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,268 @@
+/*
+ * 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.pvm.env;
+
+import java.io.Serializable;
+import java.util.Stack;
+
+import org.jbpm.PvmException;
+
+
+/**
+ * maintains contextual information for a thread in a set of
+ * {@link Context}s.
+ *
+ * <h3>Introduction</h3>
+ *
+ * <p>Objects have different lifecycles and different context's (aka scopes). An
+ * environment provides the structure to easily manage objects with different
+ * contexts.
+ * </p>
+ *
+ * <p>Examples of contexts are:
+ * <ul>
+ * <li><b>environment-factory</b>: The environment-factory context is used to store e.g. data sources,
+ * session factories and other static resources needed by an application.
+ * The environment-factory context lives for the complete duration of the {@link EnvironmentFactory}.
+ * So if the {@link EnvironmentFactory} is maintained in a static member field, the
+ * environment-factory context lives for the duration of the application.
+ * The same environment-factory context is shared for all the Environments produced by one
+ * EnvironmentFactory.</li>
+ * <li><b>environment</b>: The environment context is used for e.g. a transaction
+ * and transactional resources, user authentication. This results in an efficient and
+ * configurable use of transactional resources that need to be lazily initialized.</li>
+ * <li>The environment can accomodate other contexts as well. They can be added
+ * and removed dynamically. Examples of other potential contexts are web-request, web-session,
+ * web-application, business processDefinition, jobImpl, ... </li>
+ * </ul>
+ *
+ * <center><img src="environment.gif"/></center>
+ *
+ * <p>An environment is typically installed like this
+ * </p>
+ *
+ * <b><pre>static EnvironmentFactory environmentFactory = new DefaultEnvironmentFactory();
+ *
+ * ...
+ *
+ * Environment environment = environmentFactory.openEnvironment();
+ * try {
+ *
+ * ... everything available in this block ...
+ *
+ * } finally {
+ * environment.close();
+ * }
+ * </pre></b>
+ *
+ * <h3>Purpose</h3>
+ *
+ * <p>The first purpose of the environment is to separate the application from the
+ * environment. Standard Java and Enterprise Java are quite different and an environment
+ * abstraction like this allows for the development of applications that can run in
+ * both Standard and Enterprise environments. Also test environments are easier to
+ * tweak this way.
+ * </p>
+ *
+ * <p>A second purpose of the environment is to enable specific to global searching
+ * of resources. E.g. you could search for an 'adminEmailAddress' in the contexts
+ * 'processDefinition-execution', 'processDefinition-definition' and 'environment-factory' in the given order.
+ * That way, a global adminEmailAddress can be specified in the environment-factory context
+ * and it can be refined in more specific contexts processDefinition-definition or processDefinition-execution.
+ * </p>
+ *
+ * <h3>Search order</h3>
+ *
+ * <p>To find an object in the environment, a searchOrder can be specified. A
+ * search order is an sequence that specifies the order in which the contexts should
+ * be searched.
+ * </p>
+ *
+ * <p>The default search order is the inverse sequence of how the contexts are
+ * added to the environment. This is because in general, we can assume that the
+ * more recent a context was added, the more specific it is.
+ * </p>
+ *
+ * <h3>Transaction, username and classloader</h3>
+ *
+ * <p>Three objects are used so frequently in an environment that they get
+ * special treatment:
+ * </p>
+ *
+ * <ul>
+ * <li><b>Transaction</b>: an abstraction for marking a transaction with
+ * setRollbackOnly.</li>
+ * <li><b>Classloader</b>: the current class loader.</li>
+ * <li><b>Username</b>: the name of the currently authenticated user.</li>
+ * </ul>
+ *
+ * <p>For these special properties, setters are also available. That is to support
+ * programmatic injection into the environment. Alternatively, they can be configured
+ * in one of the contexts.
+ * </p>
+ *
+ *
+ * @see EnvironmentFactory
+ * @author Tom Baeyens
+ */
+public abstract class Environment implements Serializable {
+
+ /**
+ * searches a named object in all the contexts in the default search order.
+ * @return the object if it exists in the environment, <code>null</code> if there is no object with the given name in the environment.
+ */
+ public abstract Object get(String name);
+
+ /**
+ * searches a named object in all the contexts in the given search order. The given
+ * search order doesn't have to include all contexts. It can be a subset of the
+ * contexts available.
+ * @param searchOrder list of contexts names. The object will be searched in these contexts, in the given order.
+ * @return the object if it exists in the environment, <code>null</code> if there is no object with the given name in the specified searchOrder contexts.
+ */
+ public abstract Object get(String name, String[] searchOrder);
+
+ /** searches an object based on type. The search doesn take superclasses of the context elements
+ * into account.
+ * @return the first object of the given type or null in case no such element was found.
+ */
+ public abstract <T> T get(Class<T> type);
+
+
+ /** searches an object based on type. The search doesn take superclasses of the context elements
+ * into account.
+ * @return the first object of the given type or null in case no such element was found.
+ */
+ public abstract <T> T get(Class<T> type, String[] searchOrder);
+
+ /** get the authenticated user id */
+ public abstract String getUserId();
+
+ /** set the authenticated user id */
+ public abstract void setUserId(String userId);
+
+ /**
+ * closes the Environment by removing all its contexts.
+ */
+ public abstract void close();
+
+ public abstract Context getContext(String contextName);
+ public abstract void addContext(Context context);
+ public abstract void removeContext(Context context);
+
+ public abstract ClassLoader getClassLoader();
+ public abstract void setClassLoader(ClassLoader classLoader);
+
+ // current environment //////////////////////////////////////////////////////
+ /** the current environment is maintained in the currentEnvironment thread local */
+ static ThreadLocal<Environment> currentEnvironment = new ThreadLocal<Environment>();
+
+ /** in case of nested environments, the current environment stack maintains the outer environments */
+ static ThreadLocal<Stack<Environment>> currentEnvironmentStack = new ThreadLocal<Stack<Environment>>();
+
+ /** gets the most inner open environment. */
+ public static Environment getCurrent() {
+ return currentEnvironment.get();
+ }
+
+ public static <T> T getFromCurrent(Class<T> type) {
+ return getFromCurrent(type, true);
+ }
+
+ public static <T> T getFromCurrent(Class<T> type, boolean required) {
+ Environment environment = getCurrent();
+ if (environment==null) {
+ if (required) {
+ throw new PvmException("no environment to get "+type.getName());
+ }
+ return null;
+ }
+ T object = environment.get(type);
+ if (object==null) {
+ if (required) {
+ throw new PvmException("no "+type.getName()+" in current environment");
+ }
+ return null;
+ }
+ return object;
+ }
+
+ public static Object getFromCurrent(String name) {
+ return getFromCurrent(name, true);
+ }
+
+ public static Object getFromCurrent(String name, boolean required) {
+ Environment environment = getCurrent();
+ if (environment==null) {
+ if (required) {
+ throw new PvmException("no environment to get '"+name+"'");
+ }
+ return null;
+ }
+ Object object = environment.get(name);
+ if (object==null) {
+ if (required) {
+ throw new PvmException("no '"+name+"' in current environment");
+ }
+ return null;
+ }
+ return object;
+ }
+
+ static Stack<Environment> getStack() {
+ // lazy initialize the current environment stack
+ Stack<Environment> stack = currentEnvironmentStack.get();
+ if (stack==null) {
+ stack = new Stack<Environment>();
+ currentEnvironmentStack.set(stack);
+ }
+ return stack;
+ }
+
+
+ /** pops the closing context from the stack of current contexts. This
+ * is the first thing that needs to be done when an environment is closed.
+ * @see EnvironmentFactory#push(Environment) */
+ protected static synchronized Environment popEnvironment() {
+ Environment popped = currentEnvironment.get();
+ currentEnvironment.set(null);
+ Stack<Environment> stack = currentEnvironmentStack.get();
+ if ( (stack!=null)
+ && (! stack.isEmpty())
+ ) {
+ currentEnvironment.set(stack.pop());
+ }
+ return popped;
+ }
+
+ /** after opening of a new environment succeeded, the environment
+ * must be pushed in the stack of current environments.
+ *
+ * @see Environment#pop() */
+ protected static synchronized void pushEnvironment(Environment environment) {
+ Environment current = currentEnvironment.get();
+ if (current!=null) {
+ getStack().push(current);
+ }
+ currentEnvironment.set(environment);
+ }
+}
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/EnvironmentFactory.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentFactory.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -23,9 +23,7 @@
import java.io.InputStream;
import java.io.Serializable;
-import java.util.Stack;
-import org.jbpm.pvm.internal.env.PvmEnvironmentFactoryParser;
import org.xml.sax.InputSource;
/**
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,60 +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.pvm.env;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jbpm.pvm.PvmException;
-
-/**
- * @author Tom Baeyens
- */
-public abstract class EnvironmentHelper {
-
- static Map<Class<?>, Object> defaultObjectCache = new HashMap<Class<?>, Object>();
-
- public static <T> T get(Class<T> type) {
- if (type==null) {
- return null;
- }
- Environment environment = Environment.getCurrent();
- if (environment!=null) {
- return environment.get(type);
- }
- if (defaultObjectCache.containsKey(type)) {
- return (T) defaultObjectCache.get(type);
- }
- try {
- Method defaultFactoryMethod = type.getMethod("createDefault");
- if (defaultFactoryMethod!=null) {
- Object defaultObject = defaultFactoryMethod.invoke(null);
- defaultObjectCache.put(type, defaultObject);
- return (T) defaultObject;
- }
- } catch (Exception e) {
- throw new PvmException("couldn't create default "+type.getName(), e);
- }
- return null;
- }
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/env/EnvironmentHelper.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,60 @@
+/*
+ * 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.pvm.env;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.PvmException;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class EnvironmentHelper {
+
+ static Map<Class<?>, Object> defaultObjectCache = new HashMap<Class<?>, Object>();
+
+ public static <T> T get(Class<T> type) {
+ if (type==null) {
+ return null;
+ }
+ Environment environment = Environment.getCurrent();
+ if (environment!=null) {
+ return environment.get(type);
+ }
+ if (defaultObjectCache.containsKey(type)) {
+ return (T) defaultObjectCache.get(type);
+ }
+ try {
+ Method defaultFactoryMethod = type.getMethod("createDefault");
+ if (defaultFactoryMethod!=null) {
+ Object defaultObject = defaultFactoryMethod.invoke(null);
+ defaultObjectCache.put(type, defaultObject);
+ return (T) defaultObject;
+ }
+ } catch (Exception e) {
+ throw new PvmException("couldn't create default "+type.getName(), e);
+ }
+ return null;
+ }
+}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener (from rev 2677, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/listener)
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,87 +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.pvm.listener;
-
-import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.activity.Activity;
-import org.jbpm.pvm.model.Event;
-import org.jbpm.pvm.model.ObservableElement;
-import org.jbpm.pvm.model.OpenExecution;
-import org.jbpm.pvm.model.Transition;
-import org.jbpm.pvm.processlog.ProcessLog;
-
-
-/** view upon an {@link Execution path of execution} exposed to
- * {@link EventListener} implementations.
- *
- * @author Tom Baeyens
- */
-public interface EventListenerExecution extends OpenExecution {
-
-
- /** the original object that fired the event, part of the current position in the
- * process graph. Can be null in case no event is being fired. This is mostly the
- * object that is listened to with an {@link Activity}, but the eventSource can also
- * be a child of the object to which is listened in case of event propagation. */
- ObservableElement getEventSource();
-
- /** the event that is being fired, part of the current position in the process
- * graph. Can be null in case no event is being fired. */
- Event getEvent();
-
- // candidates to be moved to OpenExecution:
-
- // logs /////////////////////////////////////////////////////////////////////
-
- /** adds a <a href="package-summary.html#logs">log</a> to this execution. */
- void addLog(ProcessLog processLog);
-
- // extra state information methods //////////////////////////////////////////
-
- /** the current transition indicating the position in the process definition graph.
- * Can be null in case this execution is not taking a transition. */
- Transition getTransition();
-
- /** fires the event on the given eventSource and then propagates the event
- * up to the eventSource's parent chain. All the actions will see the given
- * eventSource in {@link #getEventSource()}, event if the events are
- * registered to parent's of the given eventSource. */
- void fire(String eventName, ObservableElement eventSource);
-
- /** the exception in case an exception handler is handling an exception. */
- Exception getException();
-
- // extensions //////////////////////////////////////////////////////////////
-
- /** way to access process language extensions in the execution without
- * having to cast. Casting can be problematic for persistence. */
- <T> T getExtension(Class<T> extensionClass);
-
-
- /** setter for the priority. The default priority is 0, which means
- * NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1),
- * LOW (-1) and LOWEST (-2). For the rest, the user can set any other
- * priority integer value, but then, the UI will have to display it as
- * an integer and not the named value.*/
- void setPriority(int priority);
-
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/listener/EventListenerExecution.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,87 @@
+/*
+ * 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.pvm.listener;
+
+import org.jbpm.Execution;
+import org.jbpm.pvm.activity.Activity;
+import org.jbpm.pvm.model.Event;
+import org.jbpm.pvm.model.ObservableElement;
+import org.jbpm.pvm.model.OpenExecution;
+import org.jbpm.pvm.model.Transition;
+import org.jbpm.pvm.processlog.ProcessLog;
+
+
+/** view upon an {@link Execution path of execution} exposed to
+ * {@link EventListener} implementations.
+ *
+ * @author Tom Baeyens
+ */
+public interface EventListenerExecution extends OpenExecution {
+
+
+ /** the original object that fired the event, part of the current position in the
+ * process graph. Can be null in case no event is being fired. This is mostly the
+ * object that is listened to with an {@link Activity}, but the eventSource can also
+ * be a child of the object to which is listened in case of event propagation. */
+ ObservableElement getEventSource();
+
+ /** the event that is being fired, part of the current position in the process
+ * graph. Can be null in case no event is being fired. */
+ Event getEvent();
+
+ // candidates to be moved to OpenExecution:
+
+ // logs /////////////////////////////////////////////////////////////////////
+
+ /** adds a <a href="package-summary.html#logs">log</a> to this execution. */
+ void addLog(ProcessLog processLog);
+
+ // extra state information methods //////////////////////////////////////////
+
+ /** the current transition indicating the position in the process definition graph.
+ * Can be null in case this execution is not taking a transition. */
+ Transition getTransition();
+
+ /** fires the event on the given eventSource and then propagates the event
+ * up to the eventSource's parent chain. All the actions will see the given
+ * eventSource in {@link #getEventSource()}, event if the events are
+ * registered to parent's of the given eventSource. */
+ void fire(String eventName, ObservableElement eventSource);
+
+ /** the exception in case an exception handler is handling an exception. */
+ Exception getException();
+
+ // extensions //////////////////////////////////////////////////////////////
+
+ /** way to access process language extensions in the execution without
+ * having to cast. Casting can be problematic for persistence. */
+ <T> T getExtension(Class<T> extensionClass);
+
+
+ /** setter for the priority. The default priority is 0, which means
+ * NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1),
+ * LOW (-1) and LOWEST (-2). For the rest, the user can set any other
+ * priority integer value, but then, the UI will have to display it as
+ * an integer and not the named value.*/
+ void setPriority(int priority);
+
+}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model (from rev 2677, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model)
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Comment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/Comment.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Comment.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,52 +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.pvm.model;
-
-import java.util.Date;
-
-import org.jbpm.pvm.Execution;
-
-/** a free text comment that can be made to an {@link Execution}
- * or a task.
- *
- * This class also supports threaded discussions with the
- * {@link #getParent() parent}-{@link #getComments() child}
- * relation.
- *
- * @author Tom Baeyens
- */
-public interface Comment extends Discussable {
-
- /** the meaningless database primary key */
- long getDbid();
-
- /** the id of the user that made this comment. The term actorId is an abstract
- * reference to an entity in an external identity component. */
- String getUserId();
-
- /** the actual message. Both plain text as well as HTML can be stored
- * as the message. */
- String getMessage();
-
- /** time that specifies when the comment was made */
- Date getTime();
-}
\ No newline at end of file
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Comment.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/Comment.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Comment.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Comment.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,52 @@
+/*
+ * 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.pvm.model;
+
+import java.util.Date;
+
+import org.jbpm.Execution;
+
+/** a free text comment that can be made to an {@link Execution}
+ * or a task.
+ *
+ * This class also supports threaded discussions with the
+ * {@link #getParent() parent}-{@link #getComments() child}
+ * relation.
+ *
+ * @author Tom Baeyens
+ */
+public interface Comment extends Discussable {
+
+ /** the meaningless database primary key */
+ long getDbid();
+
+ /** the id of the user that made this comment. The term actorId is an abstract
+ * reference to an entity in an external identity component. */
+ String getUserId();
+
+ /** the actual message. Both plain text as well as HTML can be stored
+ * as the message. */
+ String getMessage();
+
+ /** time that specifies when the comment was made */
+ Date getTime();
+}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,34 +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.pvm.model;
-
-import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.ProcessDefinition;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface ExecutionKeyGenerator {
-
- String createKey(ProcessDefinition processDefinition, Execution execution, String executionRef);
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ExecutionKeyGenerator.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,34 @@
+/*
+ * 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.pvm.model;
+
+import org.jbpm.Execution;
+import org.jbpm.ProcessDefinition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ExecutionKeyGenerator {
+
+ String createKey(ProcessDefinition processDefinition, Execution execution, String executionRef);
+}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/IdGenerator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/IdGenerator.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/IdGenerator.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,36 +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.pvm.model;
-
-import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.ProcessDefinition;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface IdGenerator {
-
- /** generates a unique id for the given execution. */
- String createId(ProcessDefinition processDefinition, Execution parent, Execution execution);
-
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/IdGenerator.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/IdGenerator.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/IdGenerator.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/IdGenerator.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,36 @@
+/*
+ * 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.pvm.model;
+
+import org.jbpm.Execution;
+import org.jbpm.ProcessDefinition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface IdGenerator {
+
+ /** generates a unique id for the given execution. */
+ String createId(ProcessDefinition processDefinition, Execution parent, Execution execution);
+
+}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Node.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/Node.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Node.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,132 +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.pvm.model;
-
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.pvm.Execution;
-
-
-/**
- * a node in a {@link OpenProcessDefinition} graph.
- *
- * <p>The node supports both graph based process models as well as
- * block structured (tree based) process models. First we describe
- * tranisions that can be used to form graph based process structures
- * and then we'll describe node composition to form block structured
- * process models. Both models can be combined as well.
- * </p>
- *
- * <p>Nodes have {@link #getIncomingTransitions() incoming}
- * and {@link #getOutgoingTransitions() outgoing transitions}.
- * These are lists of transitions.
- * </p>
- *
- * <p>Optionally, transitions can have names. In that case the
- * transition {@link #getOutgoingTransition(String) names are associated
- * to node's outgoing transitions}. The {@link #getOutgoingTransitionsMap() map
- * of outgoing transitions} provides easy access to the named transitions.
- * </p>
- *
- * <p>One of the outgoing transitions can optionally be marked as
- * {@link #getDefaultTransition() the default transition}.
- * </p>
- *
- * <p>Block structured process languages have composite nodes that can be
- * modeled with the {@link #getParent() parent}-{@link #getNodes() child}
- * relation.
- * </p>
- *
- * @author Tom Baeyens
- */
-public interface Node extends CompositeElement {
-
- /** the list of outgoing transitions.
- * Caution: the actual member is returned. No copy is made. */
- List<Transition> getOutgoingTransitions();
-
- /** the default outgoing transition. */
- Transition getDefaultTransition();
-
- /** the first leaving transition with the given name or null of no
- * such leaving transition exists. If the multiple transitions have
- * the given transition name, the first (in order of {@link #getOutgoingTransitions()})
- * will be returned.
- *
- * @param transitionName is the name of the transition to take. A null value will
- * match the first unnamed transition. */
- Transition getOutgoingTransition(String transitionName);
-
- /** indicates if a leaving transition with the given transitionName exists.
- * A null value matches an unnamed transition. */
- boolean hasOutgoingTransition(String transitionName);
-
- /** indicates if this node has leaving transitions */
- boolean hasOutgoingTransitions();
-
- /** the leaving transitions, keyed by transition name. If a transition with
- * the same name occurs mutltiple times, the first one is returned.
- * Leaving transitions with a null value for their name are not included
- * in the map.
- * Beware: the actual member is returned. No copy is made. In fact, the
- * returned map is maintained as a cache. So updates to the map will
- * influence subsequent retrievals of outgoing transitions by name. */
- Map<String, Transition> getOutgoingTransitionsMap();
-
- /** searches for the given transitionName in this node and then up the
- * parent chain. Returns null if no such transition is found. */
- Transition findOutgoingTransition(String transitionName);
-
- /** the list of arriving transitions.
- * Beware: the actual member is returned. No copy is made. */
- List<Transition> getIncomingTransitions();
-
- /** indicates if this node has arriving transitions */
- boolean hasIncomingTransitions();
-
- /** retrieve the parent node in the composite node structure. This is
- * different from {@link ObservableElement#getParent()} in that it is restricted
- * to the parent nodes. It doesn't take into account the process definition. */
- Node getParentNode();
-
- /** indicates if this node should be executed
- * <a href="package-summary.html#asynchronouscontinuations">asynchronously</a>. */
- boolean isExecutionAsync();
-
- /** indicates if signals should be processed
- * <a href="package-summary.html#asynchronouscontinuations">asynchronously</a>. */
- boolean isSignalAsync();
-
- /** indicates if execution should proceed
- * <a href="package-summary.html#asynchronouscontinuations">asynchronously</a>
- * when this node is left over any of the outgoing transitions. */
- boolean isLeaveAsync();
-
- /** indicates if this node behaviour needs to know
- * {@link Execution#getPreviousNode() the previous node} or
- * {@link Execution#getPreviousTransition() previous transition}.
- * If this property is set to true, the properties {@link Execution#getPreviousNode()}
- * and {@link Execution#getPreviousTransition()} will be available to the
- * node behaviour when it is executed or signalled. */
- boolean isPreviousNeeded();
-}
\ No newline at end of file
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Node.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/Node.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Node.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/Node.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,132 @@
+/*
+ * 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.pvm.model;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.Execution;
+
+
+/**
+ * a node in a {@link OpenProcessDefinition} graph.
+ *
+ * <p>The node supports both graph based process models as well as
+ * block structured (tree based) process models. First we describe
+ * tranisions that can be used to form graph based process structures
+ * and then we'll describe node composition to form block structured
+ * process models. Both models can be combined as well.
+ * </p>
+ *
+ * <p>Nodes have {@link #getIncomingTransitions() incoming}
+ * and {@link #getOutgoingTransitions() outgoing transitions}.
+ * These are lists of transitions.
+ * </p>
+ *
+ * <p>Optionally, transitions can have names. In that case the
+ * transition {@link #getOutgoingTransition(String) names are associated
+ * to node's outgoing transitions}. The {@link #getOutgoingTransitionsMap() map
+ * of outgoing transitions} provides easy access to the named transitions.
+ * </p>
+ *
+ * <p>One of the outgoing transitions can optionally be marked as
+ * {@link #getDefaultTransition() the default transition}.
+ * </p>
+ *
+ * <p>Block structured process languages have composite nodes that can be
+ * modeled with the {@link #getParent() parent}-{@link #getNodes() child}
+ * relation.
+ * </p>
+ *
+ * @author Tom Baeyens
+ */
+public interface Node extends CompositeElement {
+
+ /** the list of outgoing transitions.
+ * Caution: the actual member is returned. No copy is made. */
+ List<Transition> getOutgoingTransitions();
+
+ /** the default outgoing transition. */
+ Transition getDefaultTransition();
+
+ /** the first leaving transition with the given name or null of no
+ * such leaving transition exists. If the multiple transitions have
+ * the given transition name, the first (in order of {@link #getOutgoingTransitions()})
+ * will be returned.
+ *
+ * @param transitionName is the name of the transition to take. A null value will
+ * match the first unnamed transition. */
+ Transition getOutgoingTransition(String transitionName);
+
+ /** indicates if a leaving transition with the given transitionName exists.
+ * A null value matches an unnamed transition. */
+ boolean hasOutgoingTransition(String transitionName);
+
+ /** indicates if this node has leaving transitions */
+ boolean hasOutgoingTransitions();
+
+ /** the leaving transitions, keyed by transition name. If a transition with
+ * the same name occurs mutltiple times, the first one is returned.
+ * Leaving transitions with a null value for their name are not included
+ * in the map.
+ * Beware: the actual member is returned. No copy is made. In fact, the
+ * returned map is maintained as a cache. So updates to the map will
+ * influence subsequent retrievals of outgoing transitions by name. */
+ Map<String, Transition> getOutgoingTransitionsMap();
+
+ /** searches for the given transitionName in this node and then up the
+ * parent chain. Returns null if no such transition is found. */
+ Transition findOutgoingTransition(String transitionName);
+
+ /** the list of arriving transitions.
+ * Beware: the actual member is returned. No copy is made. */
+ List<Transition> getIncomingTransitions();
+
+ /** indicates if this node has arriving transitions */
+ boolean hasIncomingTransitions();
+
+ /** retrieve the parent node in the composite node structure. This is
+ * different from {@link ObservableElement#getParent()} in that it is restricted
+ * to the parent nodes. It doesn't take into account the process definition. */
+ Node getParentNode();
+
+ /** indicates if this node should be executed
+ * <a href="package-summary.html#asynchronouscontinuations">asynchronously</a>. */
+ boolean isExecutionAsync();
+
+ /** indicates if signals should be processed
+ * <a href="package-summary.html#asynchronouscontinuations">asynchronously</a>. */
+ boolean isSignalAsync();
+
+ /** indicates if execution should proceed
+ * <a href="package-summary.html#asynchronouscontinuations">asynchronously</a>
+ * when this node is left over any of the outgoing transitions. */
+ boolean isLeaveAsync();
+
+ /** indicates if this node behaviour needs to know
+ * {@link Execution#getPreviousNode() the previous node} or
+ * {@link Execution#getPreviousTransition() previous transition}.
+ * If this property is set to true, the properties {@link Execution#getPreviousNode()}
+ * and {@link Execution#getPreviousTransition()} will be available to the
+ * node behaviour when it is executed or signalled. */
+ boolean isPreviousNeeded();
+}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenExecution.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/OpenExecution.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenExecution.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,159 +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.pvm.model;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.PvmException;
-import org.jbpm.pvm.job.Timer;
-
-
-/** execution that opens up access to the related
- * objects in the execution and process definition
- * model.
- *
- * This execution exposes the execution hierarchy,
- * variable access and associated timers.
- *
- * This is an execution that can be used backed by
- * an open persistence session. Typically inside of
- * an environment block. Navigation over the
- * related model objects will load the related objects
- * transparantly with lazy loading.
- *
- * @author Tom Baeyens
- */
-public interface OpenExecution extends Execution, Discussable {
-
- /** the process definition for this execution.*/
- OpenProcessDefinition getProcessDefinition();
-
- /** the current node */
- Node getNode();
-
- /** the related sub process execution. */
- OpenExecution getSubProcessInstance();
-
- // variable access //////////////////////////////////////////////////////////
-
- /** retrieve the value for the given key.
- * The value can be null.
- * If there is no value for the given key, the returned
- * value will also be null. The value for key <code>null</code>
- * will always be null as null keys are not allowed. */
- Object getVariable(String key);
-
- /** updates or creates a variable for the given value.
- * Values are allowed to be null.
- * @throws PvmException if key is null. */
- void setVariable(String key, Object value);
-
- /** {@link #setVariable(String, Object) sets} all given variables.
- * Existing key-value pairs for which there is no key in the provided
- * variables will <b>not</b> be removed.
- * @throws PvmException is variables is not null and if null is present
- * as a key in the provided variables map. */
- void setVariables(Map<String, Object> variables);
-
- /** indicates presenve of the given key.
- * No exception will be thrown if key is null.
- * @return true if the key is present and false if the key doesn't exist
- * or if key is null. */
- boolean hasVariable(String key);
-
- /** remove the key-value pair for the given key from this scope.
- * No exception will be thrown when the variable is not present.
- * @returns whether a variable was actually found and removed. */
- boolean removeVariable(String key);
-
- /** removes all variables in this scope */
- void removeVariables();
-
- /** indicates if there are keys in this scope. */
- boolean hasVariables();
-
- /** a non-null set that contains all the keys present in this scope.
- * Even if there are no variable keys, an empty, non-null set will
- * be returned. */
- Set<String> getVariableKeys();
-
- /** a non-null map containing all the key-value pairs in this scope.
- * Even if there are no variable keys, an empty, non-null map will
- * be returned. */
- Map<String, Object> getVariables();
-
- /** create a new variable in this execution scope and determine
- * the type automagically. */
- void createVariable(String key, Object value);
-
- /** create a new variable in this execution scope with
- * the given type name. */
- void createVariable(String key, Object value, String typeName);
-
- // execution hierarchy access ///////////////////////////////////////////////
-
- /** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution
- * structure</a>. Null will be returned in case this execution itself is the
- * main execution path. */
- OpenExecution getProcessInstance();
-
- /** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution
- * structure</a>. Null will be returned in case this execution itself is the
- * main execution path. */
- OpenExecution getParent();
-
- /** the child executions in the <a href="package-summary.html#basicexecutionstructure">execution
- * structure</a>. Can be null and can be an empty collection. */
- Collection<OpenExecution> getExecutions();
-
- /** maps child execution names to execution objects. In case multiple executions
- * have the same name, the first one is taken. Can be null or can be an empty
- * map. The first execution without a name is also included with null as the key.
- */
- Map<String, OpenExecution> getExecutionsMap();
-
- /** the child execution for the given name or null in case such execution doesn't exist. */
- OpenExecution getExecution(String name);
-
- /** indicates if this execution has a child execution with the given executionName */
- boolean hasExecution(String executionName);
-
- // timer access /////////////////////////////////////////////////////////////
-
- /** indicates if this execution scope has timers */
- boolean hasTimers();
-
- /** timers for this execution scope */
- Set<Timer> getTimers();
-
- // priority /////////////////////////////////////////////////////////////////
-
- /** setter for the priority. The default priority is 0, which means
- * NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1),
- * LOW (-1) and LOWEST (-2). For the rest, the user can set any other
- * priority integer value, but then, the UI will have to display it as
- * an integer and not the named value.*/
- void setPriority(int priority);
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenExecution.java (from rev 2685, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/OpenExecution.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenExecution.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenExecution.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,159 @@
+/*
+ * 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.pvm.model;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.Execution;
+import org.jbpm.PvmException;
+import org.jbpm.job.Timer;
+
+
+/** execution that opens up access to the related
+ * objects in the execution and process definition
+ * model.
+ *
+ * This execution exposes the execution hierarchy,
+ * variable access and associated timers.
+ *
+ * This is an execution that can be used backed by
+ * an open persistence session. Typically inside of
+ * an environment block. Navigation over the
+ * related model objects will load the related objects
+ * transparantly with lazy loading.
+ *
+ * @author Tom Baeyens
+ */
+public interface OpenExecution extends Execution, Discussable {
+
+ /** the process definition for this execution.*/
+ OpenProcessDefinition getProcessDefinition();
+
+ /** the current node */
+ Node getNode();
+
+ /** the related sub process execution. */
+ OpenExecution getSubProcessInstance();
+
+ // variable access //////////////////////////////////////////////////////////
+
+ /** retrieve the value for the given key.
+ * The value can be null.
+ * If there is no value for the given key, the returned
+ * value will also be null. The value for key <code>null</code>
+ * will always be null as null keys are not allowed. */
+ Object getVariable(String key);
+
+ /** updates or creates a variable for the given value.
+ * Values are allowed to be null.
+ * @throws PvmException if key is null. */
+ void setVariable(String key, Object value);
+
+ /** {@link #setVariable(String, Object) sets} all given variables.
+ * Existing key-value pairs for which there is no key in the provided
+ * variables will <b>not</b> be removed.
+ * @throws PvmException is variables is not null and if null is present
+ * as a key in the provided variables map. */
+ void setVariables(Map<String, Object> variables);
+
+ /** indicates presenve of the given key.
+ * No exception will be thrown if key is null.
+ * @return true if the key is present and false if the key doesn't exist
+ * or if key is null. */
+ boolean hasVariable(String key);
+
+ /** remove the key-value pair for the given key from this scope.
+ * No exception will be thrown when the variable is not present.
+ * @returns whether a variable was actually found and removed. */
+ boolean removeVariable(String key);
+
+ /** removes all variables in this scope */
+ void removeVariables();
+
+ /** indicates if there are keys in this scope. */
+ boolean hasVariables();
+
+ /** a non-null set that contains all the keys present in this scope.
+ * Even if there are no variable keys, an empty, non-null set will
+ * be returned. */
+ Set<String> getVariableKeys();
+
+ /** a non-null map containing all the key-value pairs in this scope.
+ * Even if there are no variable keys, an empty, non-null map will
+ * be returned. */
+ Map<String, Object> getVariables();
+
+ /** create a new variable in this execution scope and determine
+ * the type automagically. */
+ void createVariable(String key, Object value);
+
+ /** create a new variable in this execution scope with
+ * the given type name. */
+ void createVariable(String key, Object value, String typeName);
+
+ // execution hierarchy access ///////////////////////////////////////////////
+
+ /** the main path of execution in the <a href="package-summary.html#basicexecutionstructure">execution
+ * structure</a>. Null will be returned in case this execution itself is the
+ * main execution path. */
+ OpenExecution getProcessInstance();
+
+ /** the parent execution in the <a href="package-summary.html#basicexecutionstructure">execution
+ * structure</a>. Null will be returned in case this execution itself is the
+ * main execution path. */
+ OpenExecution getParent();
+
+ /** the child executions in the <a href="package-summary.html#basicexecutionstructure">execution
+ * structure</a>. Can be null and can be an empty collection. */
+ Collection<OpenExecution> getExecutions();
+
+ /** maps child execution names to execution objects. In case multiple executions
+ * have the same name, the first one is taken. Can be null or can be an empty
+ * map. The first execution without a name is also included with null as the key.
+ */
+ Map<String, OpenExecution> getExecutionsMap();
+
+ /** the child execution for the given name or null in case such execution doesn't exist. */
+ OpenExecution getExecution(String name);
+
+ /** indicates if this execution has a child execution with the given executionName */
+ boolean hasExecution(String executionName);
+
+ // timer access /////////////////////////////////////////////////////////////
+
+ /** indicates if this execution scope has timers */
+ boolean hasTimers();
+
+ /** timers for this execution scope */
+ Set<Timer> getTimers();
+
+ // priority /////////////////////////////////////////////////////////////////
+
+ /** setter for the priority. The default priority is 0, which means
+ * NORMAL. Other recognized named priorities are HIGHEST (2), HIGH (1),
+ * LOW (-1) and LOWEST (-2). For the rest, the user can set any other
+ * priority integer value, but then, the UI will have to display it as
+ * an integer and not the named value.*/
+ void setPriority(int priority);
+}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -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.pvm.model;
-
-import org.jbpm.pvm.ProcessDefinition;
-
-
-
-/**
- * a graph (or tree) structure that can be executed.
- *
- * <h2>Purpose</h2>
- * <p>ProcessDefinition is a base implementation that can be leveraged to build
- * graph based execution languages. While the ProcessDefinition class is concrete and
- * can be used as-is (e.g. by aggregation), most likely processDefinition languages
- * will inherit from this ProcessDefinition and create more specialized implementations.
- * </p>
- *
- * <p>The specialized processDefinition language classes can extend this ProcessDefinition
- * with new datastructures relevant for that perticular processDefinition language.
- * </p>
- *
- * <h2>Structure</h2>
- * <p>A processDefinition contains a set of nodes. Nodes can be connected with
- * transitions or nodes can have nested nodes. But the transitions and
- * nested nodes can be combined.
- * </p>
- *
- * <h2>Execution</h2>
- * <p>To create a new execution for a given processDefinition, see {@link #startExecution()}.
- * </p>
- *
- * @author Tom Baeyens
- */
-public interface OpenProcessDefinition extends ProcessDefinition, CompositeElement {
-
- /** the initial node of this process definition */
- Node getInitial();
-
-}
\ No newline at end of file
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/OpenProcessDefinition.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,59 @@
+/*
+ * 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.pvm.model;
+
+import org.jbpm.ProcessDefinition;
+
+
+
+/**
+ * a graph (or tree) structure that can be executed.
+ *
+ * <h2>Purpose</h2>
+ * <p>ProcessDefinition is a base implementation that can be leveraged to build
+ * graph based execution languages. While the ProcessDefinition class is concrete and
+ * can be used as-is (e.g. by aggregation), most likely processDefinition languages
+ * will inherit from this ProcessDefinition and create more specialized implementations.
+ * </p>
+ *
+ * <p>The specialized processDefinition language classes can extend this ProcessDefinition
+ * with new datastructures relevant for that perticular processDefinition language.
+ * </p>
+ *
+ * <h2>Structure</h2>
+ * <p>A processDefinition contains a set of nodes. Nodes can be connected with
+ * transitions or nodes can have nested nodes. But the transitions and
+ * nested nodes can be combined.
+ * </p>
+ *
+ * <h2>Execution</h2>
+ * <p>To create a new execution for a given processDefinition, see {@link #startExecution()}.
+ * </p>
+ *
+ * @author Tom Baeyens
+ */
+public interface OpenProcessDefinition extends ProcessDefinition, CompositeElement {
+
+ /** the initial node of this process definition */
+ Node getInitial();
+
+}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ProcessFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/ProcessFactory.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ProcessFactory.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,685 +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.pvm.model;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Stack;
-
-import org.jbpm.pvm.ProcessDefinition;
-import org.jbpm.pvm.PvmException;
-import org.jbpm.pvm.activity.Activity;
-import org.jbpm.pvm.client.ClientProcessDefinition;
-import org.jbpm.pvm.internal.model.CompositeElementImpl;
-import org.jbpm.pvm.internal.model.EventImpl;
-import org.jbpm.pvm.internal.model.EventListenerReference;
-import org.jbpm.pvm.internal.model.ExceptionHandlerImpl;
-import org.jbpm.pvm.internal.model.NodeImpl;
-import org.jbpm.pvm.internal.model.ObjectReference;
-import org.jbpm.pvm.internal.model.ObservableElementImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.model.ProcessElementImpl;
-import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
-import org.jbpm.pvm.listener.EventListener;
-
-/** factory for process definitions.
- *
- * <p>Use this factory as a <a href="http://martinfowler.com/bliki/FluentInterface.html">fluent interface</a>
- * for building a process definition. To use it in this way, start with instantiating a ProcessFactory object.
- * Then a number of methods can be invoked concatenated with dots cause all the methods return
- * the same process factory object. When done, end that sequence with
- * {@link #done()} to get the constructed ProcessDefinition.
- * </p>
- *
- * <p>The idea is that this results into a more compact and more readable
- * code to build process definitions as opposed to including xml inline. For example :
- * </p>
- * <pre>
- * ProcessDefinition processDefinition = ProcessFactory.build()
- * .node().initial().behaviour(new WaitState())
- * .transition("normal").to("a")
- * .transition("shortcut").to("c")
- * .node("a").behaviour(new WaitState())
- * .transition().to("b")
- * .node("b").behaviour(new WaitState())
- * .transition().to("c")
- * .node("c").behaviour(new WaitState())
- * .done();
- * </pre>
- *
- * <hr />
- *
- * <p>If more control is needed over the creation of the process definition
- * objects, then consider using the concrete implementation classes from
- * package {@link org.jbpm.pvm.internal.model} directly. The implementation code
- * of this class might be a good guide to get you on your way.
- * </p>
- *
- * @author Tom Baeyens
- */
-public class ProcessFactory {
-
- // static factory methods ///////////////////////////////////////////////////
-
- protected ProcessDefinitionImpl processDefinition;
- protected NodeImpl node;
- protected TransitionImpl transition;
- protected List<DestinationReference> destinationReferences;
- protected ObservableElementImpl observableElement;
- protected EventImpl event;
- protected EventListenerReference eventListenerReference;
- protected ExceptionHandlerImpl exceptionHandler;
- protected CompositeElementImpl compositeElement;
- protected CompositeElementImpl scope;
- protected Stack<CompositeElementImpl> compositeElementStack;
-
- /** start building a process definition without a name. */
- protected ProcessFactory() {
- this(null);
- }
-
- /** start building a process definition with the given name. */
- protected ProcessFactory(String processName) {
- this(processName, null);
- }
-
- /** start building a process definition with the given name. */
- protected ProcessFactory(String processName, ProcessDefinitionImpl processDefinition) {
- if (processDefinition!=null) {
- this.processDefinition = processDefinition;
- } else {
- this.processDefinition = instantiateProcessDefinition();
- }
- this.processDefinition.setName(processName);
- this.observableElement = this.processDefinition;
- this.compositeElement = this.processDefinition;
- this.scope = this.processDefinition;
- }
-
- /** starts building a process definition */
- public static ProcessFactory build() {
- return new ProcessFactory();
- }
-
- /** starts building a process definition */
- public static ProcessFactory build(String processName) {
- return new ProcessFactory(processName);
- }
-
- /** starts populating a given process definition */
- public static ProcessFactory build(String processName, ProcessDefinitionImpl processDefinition) {
- return new ProcessFactory(processName, processDefinition);
- }
-
- /** to be overwritten by specific process language factories */
- protected ProcessDefinitionImpl instantiateProcessDefinition() {
- return new ProcessDefinitionImpl();
- }
-
- /** marks the last created node as the initial node in the process. */
- public ProcessFactory initial() {
- if (node==null) {
- throw new PvmException("no current node");
- }
- if (processDefinition.getInitial()!=null) {
- throw new PvmException("duplicate initial node");
- }
- processDefinition.setInitial(node);
- return this;
- }
-
- /** applies on a node and makes it create a local activity instance scope.
- * This is automatically implied when {@link #variable(String) adding a variable}
- * or {@link #timer() adding a timer} */
- public ProcessFactory scope() {
- if (node==null) {
- throw new PvmException("no current node");
- }
- node.setLocalScope(true);
- scope = node;
- return this;
- }
-
- /** declares a local variable. {@link #scope()} is automatically implied. */
- public ProcessFactory variable(String key) {
- if (node!=null) {
- scope();
- }
- VariableDefinitionImpl variableDefinition = compositeElement.createVariableDefinition();
- variableDefinition.setKey(key);
- return this;
- }
-
- /** declares a local variable. {@link #scope()} is automatically implied. */
- public ProcessFactory variable(Descriptor sourceDescriptor) {
- if (node!=null && scope==null) {
- scope();
- }
- VariableDefinitionImpl variableDefinition = scope.createVariableDefinition();
- variableDefinition.setKey(sourceDescriptor.getName());
- variableDefinition.setSourceDescriptor(sourceDescriptor);
- return this;
- }
-
- /** declares a local variable. {@link #scope()} is automatically implied. */
- public ProcessFactory variable(String key, String initialValue) {
- return variable(new StringDescriptor(key, initialValue));
- }
-
- /** declares a timer on the current node or process. {@link #scope()} is
- * automatically implied. */
- public ProcessFactory timer(String dueDateDescription, String signalName) {
- return timer(dueDateDescription, null, signalName, null);
- }
-
- /** declares a timer on the current node or process. {@link #scope()} is
- * automatically implied. */
- public ProcessFactory timer(String dueDateDescription, String signalName, String repeat) {
- return timer(dueDateDescription, null, signalName, repeat);
- }
-
- /** declares a timer on the current node or process. {@link #scope()} is
- * automatically implied. */
- public ProcessFactory timer(Date dueDate, String signalName) {
- return timer(null, dueDate, signalName, null);
- }
-
- protected ProcessFactory timer(String dueDateDescription, Date dueDate,
- String signalName, String repeat) {
- if (node!=null && scope==null) {
- scope();
- }
- TimerDefinitionImpl timerDefinition = scope.createTimerDefinition();
- if (dueDate!=null) {
- timerDefinition.setDueDate(dueDate);
- } else {
- timerDefinition.setDueDateDescription(dueDateDescription);
- }
- timerDefinition.setSignalName(signalName);
- timerDefinition.setRepeat(repeat);
- return this;
- }
-
- /** creates a node in the current parent.
- * The current parent is either the process definition or a composite node
- * in case method {@link #compositeNode(String)} was called previously. */
- public ProcessFactory node() {
- return node(null);
- }
-
- /** creates a named node.
- * The current parent is either the process definition or a composite node
- * in case method {@link #compositeNode(String)} was called previously. */
- public ProcessFactory node(String nodeName) {
- if (exceptionHandler!=null) {
- exceptionHandler.setNodeName(nodeName);
- } else {
- node = compositeElement.createNode(nodeName);
- scope = null;
-
- observableElement = node;
- event = null;
- eventListenerReference = null;
- transition = null;
- exceptionHandler = null;
- }
- return this;
- }
-
- /** sets the behaviour on the current node.
- * A current node is required. */
- public ProcessFactory behaviour(Activity activity) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (node==null) {
- throw new PvmException("no current node");
- }
- node.setBehaviour(activity);
- return this;
- }
-
- /** sets the behaviour on the current node.
- * A current node is required. */
- public ProcessFactory behaviour(Descriptor descriptor) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (node==null) {
- throw new PvmException("no current node");
- }
- node.setBehaviour(descriptor);
- return this;
- }
-
- /** sets the behaviour on the current node.
- * A current node is required. */
- public ProcessFactory behaviour(Class<? extends Activity> activityClass) {
- return behaviour(new ObjectDescriptor(activityClass));
- }
-
- /** sets the behaviour on the current node.
- * A current node is required. */
- public ProcessFactory behaviour(String expression) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (node==null) {
- throw new PvmException("no current node");
- }
- node.setBehaviour(expression);
- return this;
- }
-
-
- /** sets the asyncExecute property on the current node.
- * A current node is required. */
- public ProcessFactory asyncExecute() {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (node==null) {
- throw new PvmException("no current node");
- }
- node.setExecutionAsync(true);
- return this;
- }
-
- /** sets the asyncLeave property on the current node.
- * A current node is required. */
- public ProcessFactory asyncLeave() {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (node==null) {
- throw new PvmException("no current node");
- }
- node.setLeaveAsync(true);
- return this;
- }
-
- /** sets the asyncSignal property on the current node.
- * A current node is required. */
- public ProcessFactory asyncSignal() {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (node==null) {
- throw new PvmException("no current node");
- }
- node.setSignalAsync(true);
- return this;
- }
-
- /** sets the property needsPrevious on the current node.
- * A current node is required. */
- public ProcessFactory needsPrevious() {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (node==null) {
- throw new PvmException("no current node");
- }
- node.setPreviousNeeded(true);
- return this;
- }
-
- /** starts a block in which nested nodes can be created.
- * This block can be ended with {@link #compositeEnd()}.
- * A current node is required. */
- public ProcessFactory compositeNode() {
- return compositeNode(null);
- }
-
- /** starts a block in which nested nodes can be created.
- * This block can be ended with {@link #compositeEnd()}.
- * A current node is required. */
- public ProcessFactory compositeNode(String nodeName) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
-
- if (compositeElementStack==null) {
- compositeElementStack = new Stack<CompositeElementImpl>();
- }
-
- compositeElementStack.push(compositeElement);
- node(nodeName);
- compositeElement = node;
-
- return this;
- }
-
- /** ends a block in which nested nodes are created.
- * This method requires that a nested node block was started before
- * with {@link #compositeNode(String)} */
- public ProcessFactory compositeEnd() {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
-
- if (compositeElementStack==null) {
- throw new PvmException("no composite node was started");
- }
-
- compositeElement = compositeElementStack.pop();
-
- if (compositeElementStack.isEmpty()) {
- compositeElementStack = null;
- }
-
- return this;
- }
-
- /** creates a transition on the current node.
- * This method requires a current node */
- public ProcessFactory transition() {
- return transition(null);
- }
-
- /** creates a named transition on the current node.
- * This method requires a current node */
- public ProcessFactory transition(String transitionName) {
- if (exceptionHandler!=null) {
- exceptionHandler.setTransitionName(transitionName);
- } else {
- if (node==null) {
- throw new PvmException("no current node");
- }
- transition = node.createOutgoingTransition(null, transitionName);
- observableElement = transition;
- event = null;
- eventListenerReference = null;
- exceptionHandler = null;
- }
- return this;
- }
-
- /** sets the takeAsync property on the current transition
- * This method requires a current transition. */
- public ProcessFactory asyncTake() {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (transition==null) {
- throw new PvmException("no current transition");
- }
- transition.setTakeAsync(true);
- return this;
- }
-
- /** sets the destination node on the current transition.
- * This method requires a current transition. */
- public ProcessFactory to(String destination) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (transition==null) {
- throw new PvmException("no current transition");
- }
- if (destinationReferences==null) {
- destinationReferences = new ArrayList<DestinationReference>();
- }
- destinationReferences.add(new DestinationReference(transition, destination));
- return this;
- }
-
- /** sets the wait condition on the current transition.
- * This method requires a current transition. */
- public ProcessFactory waitCondition(Condition condition) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (transition==null) {
- throw new PvmException("no current transition");
- }
- Descriptor conditionDescriptor= new ProvidedObjectDescriptor(condition);
- transition.setWaitConditionDescriptor(conditionDescriptor);
- return this;
- }
-
- /** sets the guard condition on the current transition.
- * This method requires a current transition. */
- public ProcessFactory guardCondition(Condition condition) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (transition==null) {
- throw new PvmException("no current transition");
- }
- Descriptor conditionDescriptor= new ProvidedObjectDescriptor(condition);
- transition.setConditionDescriptor(conditionDescriptor);
- return this;
- }
-
- /** creates the given event on the current process element.
- * This method requires a process element. A process element is
- * either a process definition or a node. This method doesn't need to be
- * called for transitions. If you have exception handlers and listeners
- * on an event, make sure that you put the invocations of
- * {@link #exceptionHandler(Class)} first. */
- public ProcessFactory event(String eventName) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (observableElement==null) {
- throw new PvmException("no current process element");
- }
- if (observableElement instanceof Transition) {
- throw new PvmException("for actions on transitions, you don't need to call event");
- }
- event = observableElement.createEvent(eventName);
- exceptionHandler = null;
- return this;
- }
-
- /** creates an exception handler for the given exception class on the current process element;
- * until the {@link #exceptionHandlerEnd()}. Subsequent invocations of
- * {@link #listener(Activity) listeners} or {@link #transition() transitions} will
- * have the created exception handler as a target.
- *
- * DONT'T FORGET TO CLOSE THE EXCEPTION HANDLER WITH exceptionHandlerEnd. */
- public ProcessFactory exceptionHandler(Class<? extends Exception> exceptionClass) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
-
- ProcessElementImpl processElement = null;
- if (eventListenerReference!=null) {
- processElement = eventListenerReference;
- } else if (event!=null) {
- processElement = event;
- } else if (observableElement!=null) {
- processElement = observableElement;
- } else {
- throw new PvmException("no current process element, event or action");
- }
-
- exceptionHandler = processElement.createExceptionHandler();
-
- if (exceptionClass!=null) {
- exceptionHandler.setExceptionClassName(exceptionClass.getName());
- }
-
- return this;
- }
-
- public ProcessFactory exceptionHandlerEnd() {
- exceptionHandler = null;
- return this;
- }
-
- public ProcessFactory transactional() {
- if (exceptionHandler==null) {
- throw new PvmException("transactional is a property of an exception handler");
- }
- exceptionHandler.setTransactional(true);
- return this;
- }
-
- /** adds an action to the current event. The current event was either
- * created by {@link #event(String)} or by a {@link #transition()}.
- * Subsequent invocations of {@link #exceptionHandler(Class)} will
- * be associated to this event listener. */
- public ProcessFactory listener(Descriptor descriptor) {
- if (exceptionHandler!=null) {
- exceptionHandler.createEventListenerReference(descriptor);
- } else {
- getEvent().createEventListenerReference(descriptor);
- }
- return this;
- }
-
- /** adds an action to the current event. The current event was either
- * created by {@link #event(String)} or by a {@link #transition()}.
- * Subsequent invocations of {@link #exceptionHandler(Class)} will
- * be associated to this event listener. */
- public ProcessFactory listener(EventListener eventListener) {
- if (exceptionHandler!=null) {
- exceptionHandler.createEventListenerReference(eventListener);
- } else {
- eventListenerReference = getEvent().createEventListenerReference(eventListener);
- }
- return this;
- }
-
- /** adds an action to the current event. The current event was either
- * created by {@link #event(String)} or by a {@link #transition()}.
- * Subsequent invocations of {@link #exceptionHandler(Class)} will
- * be associated to this event listener. */
- public ProcessFactory listener(String expression) {
- if (exceptionHandler!=null) {
- exceptionHandler.createActivityReference(expression);
- } else {
- eventListenerReference = getEvent().createEventListenerReference(expression);
- }
- return this;
- }
-
- /** disables propagated events. This means that this action will only be executed
- * if the event is fired on the actual process element of the event. The current
- * action will not be executed if an event is fired on one of the children of the
- * process element to which this event relates. */
- public ProcessFactory propagationDisabled() {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (eventListenerReference==null) {
- throw new PvmException("no current event action");
- }
- eventListenerReference.setPropagationEnabled(false);
- return this;
- }
-
- private EventImpl getEvent() {
- if ( (event==null)
- && (observableElement instanceof TransitionImpl)
- ) {
- event = ((TransitionImpl)observableElement).createEvent();
- return event;
- }
- if (event==null) {
- throw new PvmException("no current event");
- }
- return event;
- }
-
- /** adds a string-valued configuration to the current process element */
- public ProcessFactory property(String name, String stringValue) {
- StringDescriptor stringDescriptor = new StringDescriptor();
- stringDescriptor.setName(name);
- stringDescriptor.setValue(stringValue);
- property(stringDescriptor);
- return this;
- }
-
- /** adds a configuration to the current process element */
- public ProcessFactory property(Descriptor descriptor) {
- if (exceptionHandler!=null) {
- throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
- }
- if (observableElement==null) {
- throw new PvmException("no current process element");
- }
- if (event!=null) {
- event.addProperty(descriptor);
- } else {
- observableElement.addProperty(descriptor);
- }
- return this;
- }
-
- public class DestinationReference {
- TransitionImpl transition;
- String destinationName;
- public DestinationReference(TransitionImpl transition, String destinationName) {
- this.transition = transition;
- this.destinationName = destinationName;
- }
- public void resolve() {
- NodeImpl destination = (NodeImpl) processDefinition.findNode(destinationName);
- if (destination==null) {
- throw new PvmException("couldn't find destination node '"+destinationName+"' for transition "+transition);
- }
- destination.addIncomingTransition(transition);
- transition.setDestination(destination);
- }
- }
-
- /** extract the process definition from the factory. This should be
- * the last method in the chain of subsequent invoked methods on this
- * factory object. */
- public ClientProcessDefinition done() {
- resolveDestinations();
- if (processDefinition.getInitial()==null) {
- throw new PvmException("no initial node");
- }
- return processDefinition;
- }
-
- /** sets the {@link ProcessDefinition#getVersion() version} of the process definition explicitely */
- public ProcessFactory version(int version) {
- processDefinition.setVersion(version);
- return this;
- }
-
- /** sets the {@link ProcessDefinition#getKey() key} of the process definition explicitely */
- public ProcessFactory key(String key) {
- processDefinition.setKey(key);
- return this;
- }
-
- private void resolveDestinations() {
- if (destinationReferences!=null) {
- for (DestinationReference destinationReference : destinationReferences) {
- destinationReference.resolve();
- }
- }
- }
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ProcessFactory.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/model/ProcessFactory.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ProcessFactory.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/model/ProcessFactory.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,685 @@
+/*
+ * 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.pvm.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Stack;
+
+import org.jbpm.ProcessDefinition;
+import org.jbpm.PvmException;
+import org.jbpm.pvm.activity.Activity;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.internal.model.CompositeElementImpl;
+import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.EventListenerReference;
+import org.jbpm.pvm.internal.model.ExceptionHandlerImpl;
+import org.jbpm.pvm.internal.model.NodeImpl;
+import org.jbpm.pvm.internal.model.ObjectReference;
+import org.jbpm.pvm.internal.model.ObservableElementImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.ProcessElementImpl;
+import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.model.VariableDefinitionImpl;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
+import org.jbpm.pvm.listener.EventListener;
+
+/** factory for process definitions.
+ *
+ * <p>Use this factory as a <a href="http://martinfowler.com/bliki/FluentInterface.html">fluent interface</a>
+ * for building a process definition. To use it in this way, start with instantiating a ProcessFactory object.
+ * Then a number of methods can be invoked concatenated with dots cause all the methods return
+ * the same process factory object. When done, end that sequence with
+ * {@link #done()} to get the constructed ProcessDefinition.
+ * </p>
+ *
+ * <p>The idea is that this results into a more compact and more readable
+ * code to build process definitions as opposed to including xml inline. For example :
+ * </p>
+ * <pre>
+ * ProcessDefinition processDefinition = ProcessFactory.build()
+ * .node().initial().behaviour(new WaitState())
+ * .transition("normal").to("a")
+ * .transition("shortcut").to("c")
+ * .node("a").behaviour(new WaitState())
+ * .transition().to("b")
+ * .node("b").behaviour(new WaitState())
+ * .transition().to("c")
+ * .node("c").behaviour(new WaitState())
+ * .done();
+ * </pre>
+ *
+ * <hr />
+ *
+ * <p>If more control is needed over the creation of the process definition
+ * objects, then consider using the concrete implementation classes from
+ * package {@link org.jbpm.pvm.internal.model} directly. The implementation code
+ * of this class might be a good guide to get you on your way.
+ * </p>
+ *
+ * @author Tom Baeyens
+ */
+public class ProcessFactory {
+
+ // static factory methods ///////////////////////////////////////////////////
+
+ protected ProcessDefinitionImpl processDefinition;
+ protected NodeImpl node;
+ protected TransitionImpl transition;
+ protected List<DestinationReference> destinationReferences;
+ protected ObservableElementImpl observableElement;
+ protected EventImpl event;
+ protected EventListenerReference eventListenerReference;
+ protected ExceptionHandlerImpl exceptionHandler;
+ protected CompositeElementImpl compositeElement;
+ protected CompositeElementImpl scope;
+ protected Stack<CompositeElementImpl> compositeElementStack;
+
+ /** start building a process definition without a name. */
+ protected ProcessFactory() {
+ this(null);
+ }
+
+ /** start building a process definition with the given name. */
+ protected ProcessFactory(String processName) {
+ this(processName, null);
+ }
+
+ /** start building a process definition with the given name. */
+ protected ProcessFactory(String processName, ProcessDefinitionImpl processDefinition) {
+ if (processDefinition!=null) {
+ this.processDefinition = processDefinition;
+ } else {
+ this.processDefinition = instantiateProcessDefinition();
+ }
+ this.processDefinition.setName(processName);
+ this.observableElement = this.processDefinition;
+ this.compositeElement = this.processDefinition;
+ this.scope = this.processDefinition;
+ }
+
+ /** starts building a process definition */
+ public static ProcessFactory build() {
+ return new ProcessFactory();
+ }
+
+ /** starts building a process definition */
+ public static ProcessFactory build(String processName) {
+ return new ProcessFactory(processName);
+ }
+
+ /** starts populating a given process definition */
+ public static ProcessFactory build(String processName, ProcessDefinitionImpl processDefinition) {
+ return new ProcessFactory(processName, processDefinition);
+ }
+
+ /** to be overwritten by specific process language factories */
+ protected ProcessDefinitionImpl instantiateProcessDefinition() {
+ return new ProcessDefinitionImpl();
+ }
+
+ /** marks the last created node as the initial node in the process. */
+ public ProcessFactory initial() {
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ if (processDefinition.getInitial()!=null) {
+ throw new PvmException("duplicate initial node");
+ }
+ processDefinition.setInitial(node);
+ return this;
+ }
+
+ /** applies on a node and makes it create a local activity instance scope.
+ * This is automatically implied when {@link #variable(String) adding a variable}
+ * or {@link #timer() adding a timer} */
+ public ProcessFactory scope() {
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ node.setLocalScope(true);
+ scope = node;
+ return this;
+ }
+
+ /** declares a local variable. {@link #scope()} is automatically implied. */
+ public ProcessFactory variable(String key) {
+ if (node!=null) {
+ scope();
+ }
+ VariableDefinitionImpl variableDefinition = compositeElement.createVariableDefinition();
+ variableDefinition.setKey(key);
+ return this;
+ }
+
+ /** declares a local variable. {@link #scope()} is automatically implied. */
+ public ProcessFactory variable(Descriptor sourceDescriptor) {
+ if (node!=null && scope==null) {
+ scope();
+ }
+ VariableDefinitionImpl variableDefinition = scope.createVariableDefinition();
+ variableDefinition.setKey(sourceDescriptor.getName());
+ variableDefinition.setSourceDescriptor(sourceDescriptor);
+ return this;
+ }
+
+ /** declares a local variable. {@link #scope()} is automatically implied. */
+ public ProcessFactory variable(String key, String initialValue) {
+ return variable(new StringDescriptor(key, initialValue));
+ }
+
+ /** declares a timer on the current node or process. {@link #scope()} is
+ * automatically implied. */
+ public ProcessFactory timer(String dueDateDescription, String signalName) {
+ return timer(dueDateDescription, null, signalName, null);
+ }
+
+ /** declares a timer on the current node or process. {@link #scope()} is
+ * automatically implied. */
+ public ProcessFactory timer(String dueDateDescription, String signalName, String repeat) {
+ return timer(dueDateDescription, null, signalName, repeat);
+ }
+
+ /** declares a timer on the current node or process. {@link #scope()} is
+ * automatically implied. */
+ public ProcessFactory timer(Date dueDate, String signalName) {
+ return timer(null, dueDate, signalName, null);
+ }
+
+ protected ProcessFactory timer(String dueDateDescription, Date dueDate,
+ String signalName, String repeat) {
+ if (node!=null && scope==null) {
+ scope();
+ }
+ TimerDefinitionImpl timerDefinition = scope.createTimerDefinition();
+ if (dueDate!=null) {
+ timerDefinition.setDueDate(dueDate);
+ } else {
+ timerDefinition.setDueDateDescription(dueDateDescription);
+ }
+ timerDefinition.setSignalName(signalName);
+ timerDefinition.setRepeat(repeat);
+ return this;
+ }
+
+ /** creates a node in the current parent.
+ * The current parent is either the process definition or a composite node
+ * in case method {@link #compositeNode(String)} was called previously. */
+ public ProcessFactory node() {
+ return node(null);
+ }
+
+ /** creates a named node.
+ * The current parent is either the process definition or a composite node
+ * in case method {@link #compositeNode(String)} was called previously. */
+ public ProcessFactory node(String nodeName) {
+ if (exceptionHandler!=null) {
+ exceptionHandler.setNodeName(nodeName);
+ } else {
+ node = compositeElement.createNode(nodeName);
+ scope = null;
+
+ observableElement = node;
+ event = null;
+ eventListenerReference = null;
+ transition = null;
+ exceptionHandler = null;
+ }
+ return this;
+ }
+
+ /** sets the behaviour on the current node.
+ * A current node is required. */
+ public ProcessFactory behaviour(Activity activity) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ node.setBehaviour(activity);
+ return this;
+ }
+
+ /** sets the behaviour on the current node.
+ * A current node is required. */
+ public ProcessFactory behaviour(Descriptor descriptor) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ node.setBehaviour(descriptor);
+ return this;
+ }
+
+ /** sets the behaviour on the current node.
+ * A current node is required. */
+ public ProcessFactory behaviour(Class<? extends Activity> activityClass) {
+ return behaviour(new ObjectDescriptor(activityClass));
+ }
+
+ /** sets the behaviour on the current node.
+ * A current node is required. */
+ public ProcessFactory behaviour(String expression) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ node.setBehaviour(expression);
+ return this;
+ }
+
+
+ /** sets the asyncExecute property on the current node.
+ * A current node is required. */
+ public ProcessFactory asyncExecute() {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ node.setExecutionAsync(true);
+ return this;
+ }
+
+ /** sets the asyncLeave property on the current node.
+ * A current node is required. */
+ public ProcessFactory asyncLeave() {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ node.setLeaveAsync(true);
+ return this;
+ }
+
+ /** sets the asyncSignal property on the current node.
+ * A current node is required. */
+ public ProcessFactory asyncSignal() {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ node.setSignalAsync(true);
+ return this;
+ }
+
+ /** sets the property needsPrevious on the current node.
+ * A current node is required. */
+ public ProcessFactory needsPrevious() {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ node.setPreviousNeeded(true);
+ return this;
+ }
+
+ /** starts a block in which nested nodes can be created.
+ * This block can be ended with {@link #compositeEnd()}.
+ * A current node is required. */
+ public ProcessFactory compositeNode() {
+ return compositeNode(null);
+ }
+
+ /** starts a block in which nested nodes can be created.
+ * This block can be ended with {@link #compositeEnd()}.
+ * A current node is required. */
+ public ProcessFactory compositeNode(String nodeName) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+
+ if (compositeElementStack==null) {
+ compositeElementStack = new Stack<CompositeElementImpl>();
+ }
+
+ compositeElementStack.push(compositeElement);
+ node(nodeName);
+ compositeElement = node;
+
+ return this;
+ }
+
+ /** ends a block in which nested nodes are created.
+ * This method requires that a nested node block was started before
+ * with {@link #compositeNode(String)} */
+ public ProcessFactory compositeEnd() {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+
+ if (compositeElementStack==null) {
+ throw new PvmException("no composite node was started");
+ }
+
+ compositeElement = compositeElementStack.pop();
+
+ if (compositeElementStack.isEmpty()) {
+ compositeElementStack = null;
+ }
+
+ return this;
+ }
+
+ /** creates a transition on the current node.
+ * This method requires a current node */
+ public ProcessFactory transition() {
+ return transition(null);
+ }
+
+ /** creates a named transition on the current node.
+ * This method requires a current node */
+ public ProcessFactory transition(String transitionName) {
+ if (exceptionHandler!=null) {
+ exceptionHandler.setTransitionName(transitionName);
+ } else {
+ if (node==null) {
+ throw new PvmException("no current node");
+ }
+ transition = node.createOutgoingTransition(null, transitionName);
+ observableElement = transition;
+ event = null;
+ eventListenerReference = null;
+ exceptionHandler = null;
+ }
+ return this;
+ }
+
+ /** sets the takeAsync property on the current transition
+ * This method requires a current transition. */
+ public ProcessFactory asyncTake() {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (transition==null) {
+ throw new PvmException("no current transition");
+ }
+ transition.setTakeAsync(true);
+ return this;
+ }
+
+ /** sets the destination node on the current transition.
+ * This method requires a current transition. */
+ public ProcessFactory to(String destination) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (transition==null) {
+ throw new PvmException("no current transition");
+ }
+ if (destinationReferences==null) {
+ destinationReferences = new ArrayList<DestinationReference>();
+ }
+ destinationReferences.add(new DestinationReference(transition, destination));
+ return this;
+ }
+
+ /** sets the wait condition on the current transition.
+ * This method requires a current transition. */
+ public ProcessFactory waitCondition(Condition condition) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (transition==null) {
+ throw new PvmException("no current transition");
+ }
+ Descriptor conditionDescriptor= new ProvidedObjectDescriptor(condition);
+ transition.setWaitConditionDescriptor(conditionDescriptor);
+ return this;
+ }
+
+ /** sets the guard condition on the current transition.
+ * This method requires a current transition. */
+ public ProcessFactory guardCondition(Condition condition) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (transition==null) {
+ throw new PvmException("no current transition");
+ }
+ Descriptor conditionDescriptor= new ProvidedObjectDescriptor(condition);
+ transition.setConditionDescriptor(conditionDescriptor);
+ return this;
+ }
+
+ /** creates the given event on the current process element.
+ * This method requires a process element. A process element is
+ * either a process definition or a node. This method doesn't need to be
+ * called for transitions. If you have exception handlers and listeners
+ * on an event, make sure that you put the invocations of
+ * {@link #exceptionHandler(Class)} first. */
+ public ProcessFactory event(String eventName) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (observableElement==null) {
+ throw new PvmException("no current process element");
+ }
+ if (observableElement instanceof Transition) {
+ throw new PvmException("for actions on transitions, you don't need to call event");
+ }
+ event = observableElement.createEvent(eventName);
+ exceptionHandler = null;
+ return this;
+ }
+
+ /** creates an exception handler for the given exception class on the current process element;
+ * until the {@link #exceptionHandlerEnd()}. Subsequent invocations of
+ * {@link #listener(Activity) listeners} or {@link #transition() transitions} will
+ * have the created exception handler as a target.
+ *
+ * DONT'T FORGET TO CLOSE THE EXCEPTION HANDLER WITH exceptionHandlerEnd. */
+ public ProcessFactory exceptionHandler(Class<? extends Exception> exceptionClass) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+
+ ProcessElementImpl processElement = null;
+ if (eventListenerReference!=null) {
+ processElement = eventListenerReference;
+ } else if (event!=null) {
+ processElement = event;
+ } else if (observableElement!=null) {
+ processElement = observableElement;
+ } else {
+ throw new PvmException("no current process element, event or action");
+ }
+
+ exceptionHandler = processElement.createExceptionHandler();
+
+ if (exceptionClass!=null) {
+ exceptionHandler.setExceptionClassName(exceptionClass.getName());
+ }
+
+ return this;
+ }
+
+ public ProcessFactory exceptionHandlerEnd() {
+ exceptionHandler = null;
+ return this;
+ }
+
+ public ProcessFactory transactional() {
+ if (exceptionHandler==null) {
+ throw new PvmException("transactional is a property of an exception handler");
+ }
+ exceptionHandler.setTransactional(true);
+ return this;
+ }
+
+ /** adds an action to the current event. The current event was either
+ * created by {@link #event(String)} or by a {@link #transition()}.
+ * Subsequent invocations of {@link #exceptionHandler(Class)} will
+ * be associated to this event listener. */
+ public ProcessFactory listener(Descriptor descriptor) {
+ if (exceptionHandler!=null) {
+ exceptionHandler.createEventListenerReference(descriptor);
+ } else {
+ getEvent().createEventListenerReference(descriptor);
+ }
+ return this;
+ }
+
+ /** adds an action to the current event. The current event was either
+ * created by {@link #event(String)} or by a {@link #transition()}.
+ * Subsequent invocations of {@link #exceptionHandler(Class)} will
+ * be associated to this event listener. */
+ public ProcessFactory listener(EventListener eventListener) {
+ if (exceptionHandler!=null) {
+ exceptionHandler.createEventListenerReference(eventListener);
+ } else {
+ eventListenerReference = getEvent().createEventListenerReference(eventListener);
+ }
+ return this;
+ }
+
+ /** adds an action to the current event. The current event was either
+ * created by {@link #event(String)} or by a {@link #transition()}.
+ * Subsequent invocations of {@link #exceptionHandler(Class)} will
+ * be associated to this event listener. */
+ public ProcessFactory listener(String expression) {
+ if (exceptionHandler!=null) {
+ exceptionHandler.createActivityReference(expression);
+ } else {
+ eventListenerReference = getEvent().createEventListenerReference(expression);
+ }
+ return this;
+ }
+
+ /** disables propagated events. This means that this action will only be executed
+ * if the event is fired on the actual process element of the event. The current
+ * action will not be executed if an event is fired on one of the children of the
+ * process element to which this event relates. */
+ public ProcessFactory propagationDisabled() {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (eventListenerReference==null) {
+ throw new PvmException("no current event action");
+ }
+ eventListenerReference.setPropagationEnabled(false);
+ return this;
+ }
+
+ private EventImpl getEvent() {
+ if ( (event==null)
+ && (observableElement instanceof TransitionImpl)
+ ) {
+ event = ((TransitionImpl)observableElement).createEvent();
+ return event;
+ }
+ if (event==null) {
+ throw new PvmException("no current event");
+ }
+ return event;
+ }
+
+ /** adds a string-valued configuration to the current process element */
+ public ProcessFactory property(String name, String stringValue) {
+ StringDescriptor stringDescriptor = new StringDescriptor();
+ stringDescriptor.setName(name);
+ stringDescriptor.setValue(stringValue);
+ property(stringDescriptor);
+ return this;
+ }
+
+ /** adds a configuration to the current process element */
+ public ProcessFactory property(Descriptor descriptor) {
+ if (exceptionHandler!=null) {
+ throw new PvmException("exceptionHandler needs to be closed with exceptionHandlerEnd");
+ }
+ if (observableElement==null) {
+ throw new PvmException("no current process element");
+ }
+ if (event!=null) {
+ event.addProperty(descriptor);
+ } else {
+ observableElement.addProperty(descriptor);
+ }
+ return this;
+ }
+
+ public class DestinationReference {
+ TransitionImpl transition;
+ String destinationName;
+ public DestinationReference(TransitionImpl transition, String destinationName) {
+ this.transition = transition;
+ this.destinationName = destinationName;
+ }
+ public void resolve() {
+ NodeImpl destination = (NodeImpl) processDefinition.findNode(destinationName);
+ if (destination==null) {
+ throw new PvmException("couldn't find destination node '"+destinationName+"' for transition "+transition);
+ }
+ destination.addIncomingTransition(transition);
+ transition.setDestination(destination);
+ }
+ }
+
+ /** extract the process definition from the factory. This should be
+ * the last method in the chain of subsequent invoked methods on this
+ * factory object. */
+ public ClientProcessDefinition done() {
+ resolveDestinations();
+ if (processDefinition.getInitial()==null) {
+ throw new PvmException("no initial node");
+ }
+ return processDefinition;
+ }
+
+ /** sets the {@link ProcessDefinition#getVersion() version} of the process definition explicitely */
+ public ProcessFactory version(int version) {
+ processDefinition.setVersion(version);
+ return this;
+ }
+
+ /** sets the {@link ProcessDefinition#getKey() key} of the process definition explicitely */
+ public ProcessFactory key(String key) {
+ processDefinition.setKey(key);
+ return this;
+ }
+
+ private void resolveDestinations() {
+ if (destinationReferences!=null) {
+ for (DestinationReference destinationReference : destinationReferences) {
+ destinationReference.resolve();
+ }
+ }
+ }
+}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog (from rev 2677, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/processlog)
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,68 +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.pvm.processlog;
-
-import java.util.Date;
-import java.util.List;
-
-import org.jbpm.pvm.Execution;
-
-/**
- * @author Tom Baeyens
- */
-public interface ProcessLog {
-
- long getDbid();
-
- Execution getExecution();
-
- Execution getProcessInstance();
-
- /** text id of the type of this process log used for
- * XML serialization. */
- String getType();
-
- /** xml representation of the process log properties
- * used for XML serialization. Properties time, execution
- * and processInstance should not be included. This method
- * is made abstract to remind and encourage
- * implementors to provide XML serialization capabilities to
- * the fixed process log XML schema. But it is allowed to
- * return null if XML serialisation if you're sure that
- * XML serialization will never be necessary. */
- List<ProcessLogProperty> getProperties();
-
- /** provides a text description for this update
- * which can be used e.g. in the admin web console.
- * This texts hould not contain time, execution
- * nor processInstance.
- * The default implementation will include the
- * {@link #getType() type} and then append all the top
- * level properties. */
- String toString();
-
- Date getTime();
-
- void setExecution(Execution execution);
-
- void setTime(Date currentTime);
-}
\ No newline at end of file
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLog.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,68 @@
+/*
+ * 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.pvm.processlog;
+
+import java.util.Date;
+import java.util.List;
+
+import org.jbpm.Execution;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ProcessLog {
+
+ long getDbid();
+
+ Execution getExecution();
+
+ Execution getProcessInstance();
+
+ /** text id of the type of this process log used for
+ * XML serialization. */
+ String getType();
+
+ /** xml representation of the process log properties
+ * used for XML serialization. Properties time, execution
+ * and processInstance should not be included. This method
+ * is made abstract to remind and encourage
+ * implementors to provide XML serialization capabilities to
+ * the fixed process log XML schema. But it is allowed to
+ * return null if XML serialisation if you're sure that
+ * XML serialization will never be necessary. */
+ List<ProcessLogProperty> getProperties();
+
+ /** provides a text description for this update
+ * which can be used e.g. in the admin web console.
+ * This texts hould not contain time, execution
+ * nor processInstance.
+ * The default implementation will include the
+ * {@link #getType() type} and then append all the top
+ * level properties. */
+ String toString();
+
+ Date getTime();
+
+ void setExecution(Execution execution);
+
+ void setTime(Date currentTime);
+}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,124 +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.pvm.processlog;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-
-import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.session.LogSession;
-
-/** base class for process logs. Process logs are dispatched to the
- * {@link LogSession} that is configured in the environment.
- *
- * <p>ProcessLogs that are send to a LogSession is the probe mechanism
- * provided to listen into the process execution progress and details.
- * It is the mechanism to collect process history and process statistics.
- * </p>
- *
- * @author Tom Baeyens
- */
-public abstract class ProcessLogImpl implements Serializable, ProcessLog {
-
- private static final long serialVersionUID = 1L;
-
- protected long dbid;
- protected int index = -1;
- protected Date time;
- protected Execution execution;
- protected Execution processInstance;
-
- public ProcessLogImpl() {
- }
-
- public void setExecution(ExecutionImpl execution) {
- this.execution = execution;
- this.processInstance = (execution!=null ? execution.getProcessInstance() : null);
- }
-
- /** text id of the type of this process log used for
- * XML serialization. */
- public abstract String getType();
-
- /** xml representation of the process log properties
- * used for XML serialization. Properties time, execution
- * and processInstance should not be included. This method
- * is made abstract to remind and encourage
- * implementors to provide XML serialization capabilities to
- * the fixed process log XML schema. But it is allowed to
- * return null if XML serialisation if you're sure that
- * XML serialization will never be necessary. */
- public abstract List<ProcessLogProperty> getProperties();
-
- /** provides a text description for this update
- * which can be used e.g. in the admin web console.
- * This texts hould not contain time, execution
- * nor processInstance.
- * The default implementation will include the
- * {@link #getType() type} and then append all the top
- * level properties. */
- public String toString() {
- StringBuffer text = new StringBuffer();
- text.append(getType());
- text.append('[');
- List<ProcessLogProperty> properties = getProperties();
- if (properties!=null) {
- for (int i=0; i<properties.size(); i++) {
- ProcessLogProperty property = properties.get(i);
- text.append(property.name);
- if (property.value!=null) {
- text.append('=');
- text.append(property.value);
- }
- if (i < (properties.size()-1)) {
- text.append('|');
- }
- }
- }
- text.append(']');
- return text.toString();
- }
-
- public long getDbid() {
- return dbid;
- }
- public Date getTime() {
- return time;
- }
- public void setTime(Date date) {
- this.time = date;
- }
- public Execution getExecution() {
- return execution;
- }
- public int getIndex() {
- return index;
- }
- public Execution getProcessInstance() {
- return processInstance;
- }
- public void setIndex(int index) {
- this.index = index;
- }
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogImpl.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,124 @@
+/*
+ * 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.pvm.processlog;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import org.jbpm.Execution;
+import org.jbpm.pvm.model.OpenExecution;
+import org.jbpm.pvm.session.LogSession;
+
+/** base class for process logs. Process logs are dispatched to the
+ * {@link LogSession} that is configured in the environment.
+ *
+ * <p>ProcessLogs that are send to a LogSession is the probe mechanism
+ * provided to listen into the process execution progress and details.
+ * It is the mechanism to collect process history and process statistics.
+ * </p>
+ *
+ * @author Tom Baeyens
+ */
+public abstract class ProcessLogImpl implements Serializable, ProcessLog {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+ protected int index = -1;
+ protected Date time;
+ protected Execution execution;
+ protected Execution processInstance;
+
+ public ProcessLogImpl() {
+ }
+
+ public void setExecution(OpenExecution execution) {
+ this.execution = execution;
+ this.processInstance = (execution!=null ? execution.getProcessInstance() : null);
+ }
+
+ /** text id of the type of this process log used for
+ * XML serialization. */
+ public abstract String getType();
+
+ /** xml representation of the process log properties
+ * used for XML serialization. Properties time, execution
+ * and processInstance should not be included. This method
+ * is made abstract to remind and encourage
+ * implementors to provide XML serialization capabilities to
+ * the fixed process log XML schema. But it is allowed to
+ * return null if XML serialisation if you're sure that
+ * XML serialization will never be necessary. */
+ public abstract List<ProcessLogProperty> getProperties();
+
+ /** provides a text description for this update
+ * which can be used e.g. in the admin web console.
+ * This texts hould not contain time, execution
+ * nor processInstance.
+ * The default implementation will include the
+ * {@link #getType() type} and then append all the top
+ * level properties. */
+ public String toString() {
+ StringBuffer text = new StringBuffer();
+ text.append(getType());
+ text.append('[');
+ List<ProcessLogProperty> properties = getProperties();
+ if (properties!=null) {
+ for (int i=0; i<properties.size(); i++) {
+ ProcessLogProperty property = properties.get(i);
+ text.append(property.name);
+ if (property.value!=null) {
+ text.append('=');
+ text.append(property.value);
+ }
+ if (i < (properties.size()-1)) {
+ text.append('|');
+ }
+ }
+ }
+ text.append(']');
+ return text.toString();
+ }
+
+ public long getDbid() {
+ return dbid;
+ }
+ public Date getTime() {
+ return time;
+ }
+ public void setTime(Date date) {
+ this.time = date;
+ }
+ public Execution getExecution() {
+ return execution;
+ }
+ public int getIndex() {
+ return index;
+ }
+ public Execution getProcessInstance() {
+ return processInstance;
+ }
+ public void setIndex(int index) {
+ this.index = index;
+ }
+}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,105 +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.pvm.processlog;
-
-import java.text.SimpleDateFormat;
-import java.util.List;
-
-import org.jbpm.pvm.Execution;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ProcessLogXmlSerializer {
-
- public static final SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss,SSS");
-
- protected List<ProcessLogProperty> properties;
-
- public void appendLog(Document document, Element parent, ProcessLog processLog) {
- String logType = getEventType(processLog);
- String time = getTime(processLog);
- String executionDbid = getExecutionDbid(processLog);
- String processInstanceDbid = getProcessInstanceDbid(processLog);
- String processInstanceKey = getProcessInstanceKey(processLog);
-
- Element logElement = document.createElement("log");
- parent.appendChild(logElement);
-
- logElement.setAttribute("type", logType);
- logElement.setAttribute("time", time);
- if (executionDbid!=null) {
- logElement.setAttribute("execution", executionDbid);
- }
- if (processInstanceDbid!=null) {
- logElement.setAttribute("instance", processInstanceDbid);
- }
- if (processInstanceKey!=null) {
- logElement.setAttribute("key", processInstanceKey);
- }
-
- appendProperties(document, logElement, processLog.getProperties());
- }
-
- protected void appendProperties(Document document, Element parent, List<ProcessLogProperty> properties) {
- if (properties!=null) {
- for (ProcessLogProperty property: properties) {
- Element propertyElement = document.createElement("property");
- parent.appendChild(propertyElement);
-
- if (property.name!=null) {
- propertyElement.setAttribute("name", property.name);
- }
- if (property.value!=null) {
- propertyElement.setAttribute("value", property.value);
- }
- appendProperties(document, propertyElement, property.getProperties());
- }
- }
- }
-
- protected String getEventType(ProcessLog processLog) {
- return processLog.getType();
- }
-
- protected String getTime(ProcessLog processLog) {
- return dateFormatter.format(processLog.getTime());
- }
-
- protected String getExecutionDbid(ProcessLog processLog) {
- Execution execution = processLog.getExecution();
- return (execution!=null ? Long.toString(execution.getDbid()) : null);
- }
-
- protected String getProcessInstanceDbid(ProcessLog processLog) {
- Execution processInstance = processLog.getProcessInstance();
- return (processInstance!=null ? Long.toString(processInstance.getDbid()) : null);
- }
-
- protected String getProcessInstanceKey(ProcessLog processLog) {
- Execution processInstance = processLog.getProcessInstance();
- return (processInstance!=null ? processInstance.getKey() : null);
- }
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java (from rev 2682, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/processlog/ProcessLogXmlSerializer.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,105 @@
+/*
+ * 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.pvm.processlog;
+
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+import org.jbpm.Execution;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ProcessLogXmlSerializer {
+
+ public static final SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss,SSS");
+
+ protected List<ProcessLogProperty> properties;
+
+ public void appendLog(Document document, Element parent, ProcessLog processLog) {
+ String logType = getEventType(processLog);
+ String time = getTime(processLog);
+ String executionDbid = getExecutionDbid(processLog);
+ String processInstanceDbid = getProcessInstanceDbid(processLog);
+ String processInstanceKey = getProcessInstanceKey(processLog);
+
+ Element logElement = document.createElement("log");
+ parent.appendChild(logElement);
+
+ logElement.setAttribute("type", logType);
+ logElement.setAttribute("time", time);
+ if (executionDbid!=null) {
+ logElement.setAttribute("execution", executionDbid);
+ }
+ if (processInstanceDbid!=null) {
+ logElement.setAttribute("instance", processInstanceDbid);
+ }
+ if (processInstanceKey!=null) {
+ logElement.setAttribute("key", processInstanceKey);
+ }
+
+ appendProperties(document, logElement, processLog.getProperties());
+ }
+
+ protected void appendProperties(Document document, Element parent, List<ProcessLogProperty> properties) {
+ if (properties!=null) {
+ for (ProcessLogProperty property: properties) {
+ Element propertyElement = document.createElement("property");
+ parent.appendChild(propertyElement);
+
+ if (property.name!=null) {
+ propertyElement.setAttribute("name", property.name);
+ }
+ if (property.value!=null) {
+ propertyElement.setAttribute("value", property.value);
+ }
+ appendProperties(document, propertyElement, property.getProperties());
+ }
+ }
+ }
+
+ protected String getEventType(ProcessLog processLog) {
+ return processLog.getType();
+ }
+
+ protected String getTime(ProcessLog processLog) {
+ return dateFormatter.format(processLog.getTime());
+ }
+
+ protected String getExecutionDbid(ProcessLog processLog) {
+ Execution execution = processLog.getExecution();
+ return (execution!=null ? Long.toString(execution.getDbid()) : null);
+ }
+
+ protected String getProcessInstanceDbid(ProcessLog processLog) {
+ Execution processInstance = processLog.getProcessInstance();
+ return (processInstance!=null ? Long.toString(processInstance.getDbid()) : null);
+ }
+
+ protected String getProcessInstanceKey(ProcessLog processLog) {
+ Execution processInstance = processLog.getProcessInstance();
+ return (processInstance!=null ? processInstance.getKey() : null);
+ }
+}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session (from rev 2677, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/session)
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/MessageSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/session/MessageSession.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/MessageSession.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.session;
-import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.job.Message;
/**
@@ -29,5 +29,5 @@
*/
public interface MessageSession {
- void send(MessageImpl<?> message);
+ void send(Message message);
}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/PvmDbSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/session/PvmDbSession.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/PvmDbSession.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,70 +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.pvm.session;
-
-import java.util.List;
-
-import org.jbpm.pvm.Execution;
-import org.jbpm.pvm.client.ClientExecution;
-import org.jbpm.pvm.client.ClientProcessDefinition;
-import org.jbpm.pvm.job.Job;
-import org.jbpm.pvm.job.Message;
-import org.jbpm.pvm.job.Timer;
-
-/**
- * @author Tom Baeyens, Pascal Verdage
- */
-public interface PvmDbSession extends DbSession {
-
- /** all deployed process names. */
- List<String> findProcessDefinitionNames();
-
- /** all versions of the given process. */
- List<ClientProcessDefinition> findProcessDefinitionsByName(String name);
-
- /** specific version of a named processDefinition. */
- ClientProcessDefinition findProcessDefinitionByName(String name, int version);
-
- /** latest version of the processDefinition with the given name. */
- ClientProcessDefinition findLatestProcessDefinitionByName(String name);
-
- /** the process definition uniquely identified by the given
- * processDefinition id. */
- ClientProcessDefinition findProcessDefinitionById(String processDefinitionId);
-
- /** the execution uniquely identified by the given executionKey. */
- ClientExecution findExecutionById(String executionId);
-
- /** the execution uniquely identified by the given processDefinition name
- * and the execution key. */
- Execution findExecutionByKey(String processDefinitionName, String executionKey);
-
- /** timers */
- List<Timer> findTimers(int firstResult, int maxResults);
-
- /** timers */
- List<Message> findMessages(int firstResult, int maxResults);
-
- /** the jobs for which all the retries have failed and which will not be
- * picked up any more by the jobImpl executor */
- public List<Job> findJobsWithException(int firstResult, int maxResults);
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/PvmDbSession.java (from rev 2685, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/session/PvmDbSession.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/PvmDbSession.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/PvmDbSession.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,70 @@
+/*
+ * 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.pvm.session;
+
+import java.util.List;
+
+import org.jbpm.Execution;
+import org.jbpm.job.Job;
+import org.jbpm.job.Message;
+import org.jbpm.job.Timer;
+import org.jbpm.pvm.client.ClientExecution;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+
+/**
+ * @author Tom Baeyens, Pascal Verdage
+ */
+public interface PvmDbSession extends DbSession {
+
+ /** all deployed process names. */
+ List<String> findProcessDefinitionNames();
+
+ /** all versions of the given process. */
+ List<ClientProcessDefinition> findProcessDefinitionsByName(String name);
+
+ /** specific version of a named processDefinition. */
+ ClientProcessDefinition findProcessDefinitionByName(String name, int version);
+
+ /** latest version of the processDefinition with the given name. */
+ ClientProcessDefinition findLatestProcessDefinitionByName(String name);
+
+ /** the process definition uniquely identified by the given
+ * processDefinition id. */
+ ClientProcessDefinition findProcessDefinitionById(String processDefinitionId);
+
+ /** the execution uniquely identified by the given executionKey. */
+ ClientExecution findExecutionById(String executionId);
+
+ /** the execution uniquely identified by the given processDefinition name
+ * and the execution key. */
+ Execution findExecutionByKey(String processDefinitionName, String executionKey);
+
+ /** timers */
+ List<Timer> findTimers(int firstResult, int maxResults);
+
+ /** timers */
+ List<Message> findMessages(int firstResult, int maxResults);
+
+ /** the jobs for which all the retries have failed and which will not be
+ * picked up any more by the jobImpl executor */
+ public List<Job> findJobsWithException(int firstResult, int maxResults);
+}
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/TimerSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/session/TimerSession.java 2008-10-30 13:20:37 UTC (rev 2677)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/TimerSession.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,55 +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.pvm.session;
-
-import org.jbpm.pvm.job.Timer;
-
-/**
- * @author Tom Baeyens, Pascal Verdage
- */
-public interface TimerSession {
-
- /**
- * Schedule the execution of a timer.
- * @param timerImpl the timer to be executed.
- * @throws IllegalArgumentException if the timer is null
- * or if its activity is null or if its dueDate is null
- * or if its dueDate is negative or if its dueDate is past
- * or if its dueDate is equals to Long.MAX_VALUE
- */
- public void schedule(Timer timer);
-
- /**
- * Cancels a timer.
- * <br />
- * If a transaction is in progress, the cancellation will be effective
- * at the end of the transaction.
- * If the timer has been created in the same transaction or
- * if there is no transaction, the cancellation is immediately effective.
- * <br />
- * If the timer is executing when the cancellation becomes effective,
- * the execution in progress will not be stopped.
- * @param timerImpl the timer to be cancelled.
- */
- public void cancel(Timer timer);
-
-}
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/TimerSession.java (from rev 2685, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/session/TimerSession.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/TimerSession.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/pvm/session/TimerSession.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -0,0 +1,55 @@
+/*
+ * 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.pvm.session;
+
+import org.jbpm.job.Timer;
+
+/**
+ * @author Tom Baeyens, Pascal Verdage
+ */
+public interface TimerSession {
+
+ /**
+ * Schedule the execution of a timer.
+ * @param timerImpl the timer to be executed.
+ * @throws IllegalArgumentException if the timer is null
+ * or if its activity is null or if its dueDate is null
+ * or if its dueDate is negative or if its dueDate is past
+ * or if its dueDate is equals to Long.MAX_VALUE
+ */
+ public void schedule(Timer timer);
+
+ /**
+ * Cancels a timer.
+ * <br />
+ * If a transaction is in progress, the cancellation will be effective
+ * at the end of the transaction.
+ * If the timer has been created in the same transaction or
+ * if there is no transaction, the cancellation is immediately effective.
+ * <br />
+ * If the timer is executing when the cancellation becomes effective,
+ * the execution in progress will not be stopped.
+ * @param timerImpl the timer to be cancelled.
+ */
+ public void cancel(Timer timer);
+
+}
Modified: jbpm4/trunk/modules/cts/pom.xml
===================================================================
--- jbpm4/trunk/modules/cts/pom.xml 2008-10-31 09:12:32 UTC (rev 2693)
+++ jbpm4/trunk/modules/cts/pom.xml 2008-10-31 09:13:32 UTC (rev 2694)
@@ -12,7 +12,7 @@
<!-- $Id$ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBoss jBPM4 - CTS</name>
+ <name>jBPM 4 - CTS DB</name>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-cts</artifactId>
<packaging>jar</packaging>
Deleted: jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/MockProcessEngine.java
===================================================================
--- jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/MockProcessEngine.java 2008-10-31 09:12:32 UTC (rev 2693)
+++ jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/MockProcessEngine.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,41 +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.test.cts.processengine;
-
-// $Id$
-
-import org.jbpm.api.client.ProcessEngine;
-
-/**
- * A mock ProcessEngine
- *
- * @author thomas.diesler at jboss.com
- * @since 24-Sep-2008
- */
-public class MockProcessEngine extends ProcessEngine
-{
- @Override
- public void setName(String name)
- {
- super.setName(name);
- }
-}
Deleted: jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java
===================================================================
--- jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java 2008-10-31 09:12:32 UTC (rev 2693)
+++ jbpm4/trunk/modules/cts/src/test/java/org/jbpm/test/cts/processengine/ProcessEngineTest.java 2008-10-31 09:13:32 UTC (rev 2694)
@@ -1,63 +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.test.cts.processengine;
-
-// $Id$
-
-import java.net.URL;
-
-import org.jbpm.api.client.MicrocontainerConfiguration;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.test.CTSTestCase;
-
-/**
- * Test the ProcessEngine
- *
- * @author thomas.diesler at jboss.com
- * @since 24-Sep-2008
- */
-public class ProcessEngineTest extends CTSTestCase
-{
- public void testDefaultProcessEngine() throws Exception
- {
- ProcessEngine engine = ProcessEngine.getProcessEngine();
- assertNotNull("ProcessEngine not null", engine);
- }
-
- public void testUnregisteredProcessEngine() throws Exception
- {
- ProcessEngine engine = ProcessEngine.getProcessEngine("bogus");
- assertNull("ProcessEngine null", engine);
- }
-
- public void testMicrocontainerConfiguration() throws Exception
- {
- URL cfgURL = getResourceURL("cts/processengine/test-cfg-beans.xml");
- ProcessEngine engineOne = new MicrocontainerConfiguration(cfgURL).getProcessEngine();
- assertNotNull("ProcessEngine not null", engineOne);
-
- ProcessEngine engineTwo = ProcessEngine.getProcessEngine("mock engine");
- assertNotNull("ProcessEngine not null", engineTwo);
-
- assertSame("ProcessEngine same", engineOne, engineTwo);
- }
-}
Modified: jbpm4/trunk/modules/enterprise/pom.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/pom.xml 2008-10-31 09:12:32 UTC (rev 2693)
+++ jbpm4/trunk/modules/enterprise/pom.xml 2008-10-31 09:13:32 UTC (rev 2694)
@@ -15,7 +15,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBoss jBPM4 - Enterprise</name>
+ <name>jBPM 4 - Enterprise</name>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-enterprise</artifactId>
<packaging>jar</packaging>
More information about the jbpm-commits
mailing list