[jbpm-commits] JBoss JBPM SVN: r1559 - in api/trunk/modules: api/src/main/java/org/jboss/bpm/client and 20 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Jul 9 14:22:54 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-07-09 14:22:54 -0400 (Wed, 09 Jul 2008)
New Revision: 1559
Added:
api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/BasicAttachments.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractActivity.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEndEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractFlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractProcess.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractStartEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractTask.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/InitialToken.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/BasicTask.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractToken.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessTest.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/TaskA.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java
api/trunk/modules/testsuite/src/test/resources/model/
api/trunk/modules/testsuite/src/test/resources/model/basic-sequence.xml
api/trunk/modules/testsuite/src/test/resources/samples/
api/trunk/modules/testsuite/src/test/resources/samples/context/
api/trunk/modules/testsuite/src/test/resources/samples/context/basic-context.xml
api/trunk/modules/testsuite/src/test/resources/samples/engine/
api/trunk/modules/testsuite/src/test/resources/samples/engine/basic-engine.xml
api/trunk/modules/testsuite/src/test/resources/samples/sequence/
api/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence.xml
api/trunk/modules/testsuite/src/test/resources/samples/task/
api/trunk/modules/testsuite/src/test/resources/samples/task/basic-task.xml
Removed:
api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessDefinitionException.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessDefinitionManager.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessInstance.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessInstanceManager.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/AbstractExecution.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/AbstractProcessInstance.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/ProcessInstanceContext.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/process/
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Activity.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/EndSignal.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeExecution.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeNode.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/StartSignal.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Transition.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/TransitionRouter.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractRuntimeNode.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessDefinitionTest.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/activity/
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/basic/
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/ContextActivity.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
Modified:
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngine.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Result.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/ExecutionContext.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Signal.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/test/DefaultEngineTestCase.java
api/trunk/modules/api/src/test/java/org/jboss/bpm/client/MockProcessEngine.java
api/trunk/modules/api/src/test/java/org/jboss/bpm/client/ProcessEngineLocatorTest.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/ExecutionContextTest.java
api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/engine/EngineShutdownTest.java
Log:
Align API with BPMN
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessDefinitionException.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessDefinitionException.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessDefinitionException.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -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.jboss.bpm;
-
-
-// $Id$
-
-/**
- * A RuntimeException that is thrown for invalid process definitions
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public class InvalidProcessDefinitionException extends JBPMException
-{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public InvalidProcessDefinitionException()
- {
- super();
- }
-
- public InvalidProcessDefinitionException(String message)
- {
- super(message);
- }
-
- public InvalidProcessDefinitionException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public InvalidProcessDefinitionException(Throwable cause)
- {
- super(cause);
- }
-}
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -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.jboss.bpm;
+
+
+// $Id$
+
+/**
+ * A RuntimeException that is thrown for invalid processes
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 18-Jun-2008
+ */
+public class InvalidProcessException extends JBPMException
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public InvalidProcessException()
+ {
+ super();
+ }
+
+ public InvalidProcessException(String message)
+ {
+ super(message);
+ }
+
+ public InvalidProcessException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public InvalidProcessException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/InvalidProcessException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/BasicAttachments.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/BasicAttachments.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/BasicAttachments.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,118 @@
+/*
+ * 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.jboss.bpm.client;
+
+//$Id$
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * Basic attachments.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Apr-2007
+ */
+public class BasicAttachments implements Attachments
+{
+ private Map<Key, Object> attachments = new HashMap<Key, Object>();
+
+ /** Construct the execution context with no attachments */
+ public BasicAttachments()
+ {
+
+ }
+
+ /** Construct the execution context with given attachments */
+ public BasicAttachments(Attachments att)
+ {
+ if (att != null)
+ {
+ for (Key key : att.getAttachmentKeys())
+ {
+ Object value = att.getAttachment(key.getClassPart(), key.getNamePart());
+ this.attachments.put(key, value);
+ }
+ }
+ }
+
+ public Collection<Key> getAttachmentKeys()
+ {
+ return attachments.keySet();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return (T)attachments.get(new Key(clazz, null));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz, String name)
+ {
+ return (T)attachments.get(new Key(clazz, name));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(String name)
+ {
+ return (T)attachments.get(new Key(null, name));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, Object obj)
+ {
+ return (T)attachments.put(new Key(clazz, null), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, String name, Object obj)
+ {
+ return (T)attachments.put(new Key(clazz, name), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(String name, Object obj)
+ {
+ return (T)attachments.put(new Key(null, name), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz)
+ {
+ return (T)attachments.remove(new Key(clazz, null));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz, String name)
+ {
+ return (T)attachments.remove(new Key(clazz, name));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(String name)
+ {
+ return (T)attachments.remove(new Key(null, name));
+ }
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/BasicAttachments.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,91 +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.jboss.bpm.client;
-
-// $Id$
-
-import org.jboss.bpm.EngineShutdownException;
-import org.jboss.bpm.client.Attachments.Key;
-import org.jboss.bpm.process.Execution;
-
-/**
- * The execution manager is the entry point to create, find and otherwise manage process executions.
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public abstract class ExecutionManager
-{
- // Injected through the MC
- protected ProcessEngine engine;
-
- // Hide public constructor
- protected ExecutionManager()
- {
- }
-
- /**
- * Get the associated process engine
- */
- public ProcessEngine getProcessEngine()
- {
- if (engine == null)
- throw new IllegalStateException("ProcessEngine not available through kernel configuration");
-
- return engine;
- }
-
- /**
- * Locate the execution manager
- */
- public static ExecutionManager locateExecutionManager()
- {
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
- return engine.getExecutionManager();
- }
-
- /**
- * Create an execution for a given process instance.
- * The process instance context is copied to the execution context.
- * Note, that this is a shallow copy. Mutable objects should generally not be put into the context.
- */
- public final Execution createExecution(ProcessInstance pinst)
- {
- // TODO: test this
- if (engine.isPrepareForShutdown())
- throw new EngineShutdownException("Cannot create new Execution while engine is shutting down");
-
- // Copy the instance context to the execution context
- Attachments context = pinst.getAttachments();
- Execution ex = createExecutionOverride(pinst);
- for (Key key : context.getAttachmentKeys())
- {
- Object att = context.getAttachment(key.getClassPart(), key.getNamePart());
- ex.getContext().addAttachment(key.getClassPart(), key.getNamePart(), att);
- }
-
- return ex;
- }
-
- // Override to implement execution creation
- protected abstract Execution createExecutionOverride(ProcessInstance pinst);
-}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessDefinitionManager.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessDefinitionManager.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessDefinitionManager.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,146 +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.jboss.bpm.client;
-
-// $Id$
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.bpm.EngineShutdownException;
-import org.jboss.bpm.process.ProcessDefinition;
-
-/**
- * The process definition manager is the entry point to create, find and otherwise manage process definitions.
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public abstract class ProcessDefinitionManager
-{
- // Injected through the MC
- protected ProcessEngine engine;
- // The set of process definitions
- private Set<ProcessDefinition> pdefs = new HashSet<ProcessDefinition>();
-
- // Hide public constructor
- protected ProcessDefinitionManager()
- {
- }
-
- /* Get the associated process engine */
- public ProcessEngine getProcessEngine()
- {
- if (engine == null)
- throw new IllegalStateException("ProcessEngine not available through kernel configuration");
-
- return engine;
- }
-
- /* Locate the process definition manager */
- public static ProcessDefinitionManager locateProcessDefinitionManager()
- {
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
- return engine.getProcessDefinitionManager();
- }
-
- /*
- * Create a process defintion from a XML string in one of the supported formats
- */
- public final ProcessDefinition createProcessDefinition(String pdDescriptor)
- {
- // TODO: test this
- if (engine.isPrepareForShutdown())
- throw new EngineShutdownException("Cannot create new ProcessDefinition while engine is shutting down");
-
- ProcessDefinition pd = createProcessDefinitionOverride(pdDescriptor);
- return pd;
- }
-
- /*
- * Override to implement process definition creation
- */
- protected abstract ProcessDefinition createProcessDefinitionOverride(String pdDescriptor);
-
- /*
- * Create a process defintion from an URL to a XML descritor in one of the supported formats
- */
- public final ProcessDefinition createProcessDefinition(URL pdURL) throws IOException
- {
- // TODO: test this
- if (engine.isPrepareForShutdown())
- throw new EngineShutdownException("Cannot create new ProcessDefinition while engine is shutting down");
-
- ProcessDefinition pd = createProcessDefinitionOverride(pdURL);
- return pd;
- }
-
- /*
- * Override to implement process definition creation
- */
- protected abstract ProcessDefinition createProcessDefinitionOverride(URL pdURL) throws IOException;
-
- /*
- * Get the set of registered process definitions
- */
- public Set<ProcessDefinition> getProcessDefinitions()
- {
- return Collections.unmodifiableSet(pdefs);
- }
-
- /*
- * Find a process definition for a given name
- *
- * @return null if the process definition is not defined
- */
- public ProcessDefinition findProcessDefinition(String name)
- {
- ProcessDefinition pdef = null;
- for (ProcessDefinition aux : pdefs)
- {
- if (aux.getName().equals(name))
- {
- pdef = aux;
- break;
- }
- }
- return pdef;
- }
-
- /*
- * Remove a process definition and all its associated process instances
- */
- public void removeProcessDefinition(ProcessDefinition pdef)
- {
- // Remove the preocess definition
- pdefs.remove(pdef.getName());
- }
-
- // Add a process definition
- protected void addProcessDefinition(ProcessDefinition pdef)
- {
- pdefs.add(pdef);
- }
-}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngine.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngine.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessEngine.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -36,15 +36,8 @@
/** The default bean config: jbpm-beans.xml */
public static final String JBPM_ENGINE_CONFIG = "jbpm-beans.xml";
- // Injected through the MC
- protected ProcessDefinitionManager processDefinitionManager;
- // Injected through the MC
protected ProcessManager processManager;
// Injected through the MC
- protected ProcessInstanceManager processInstanceManager;
- // Injected through the MC
- protected ExecutionManager executionManager;
- // Injected through the MC
protected SignalManager signalManager;
// Flag to indicate that the Engine is shutting down
private boolean prepareForShutdown;
@@ -79,23 +72,9 @@
}
/**
- * Get the configured instance of the process definition manager
- *
- * @return The process definition manager
+ * Get the configured instance of the process manager
+ * @return The process manager
*/
- public ProcessDefinitionManager getProcessDefinitionManager()
- {
- if (processDefinitionManager == null)
- throw new IllegalStateException("ProcessDefinitionManager not available through kernel configuration");
-
- return processDefinitionManager;
- }
-
- /**
- * Get the configured instance of the process definition manager
- *
- * @return The process definition manager
- */
public ProcessManager getProcessManager()
{
if (processManager == null)
@@ -105,31 +84,9 @@
}
/**
- * Get the configured instance of the process instance manager
- *
- * @return The process instance manager
+ * Get the configured instance of the signal manager
+ * @return The signal manager
*/
- public ProcessInstanceManager getProcessInstanceManager()
- {
- if (processInstanceManager == null)
- throw new IllegalStateException("ProcessInstanceManager not available through kernel configuration");
-
- return processInstanceManager;
- }
-
- /**
- * Get the configured instance of the execution manager
- *
- * @return The execution manager
- */
- public ExecutionManager getExecutionManager()
- {
- if (executionManager == null)
- throw new IllegalStateException("ExecutionManager not available through kernel configuration");
-
- return executionManager;
- }
-
public SignalManager getSignalManager()
{
if (signalManager == null)
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessInstance.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessInstance.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessInstance.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,78 +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.jboss.bpm.client;
-
-//$Id$
-
-import java.util.Set;
-
-import org.jboss.bpm.process.Execution;
-import org.jboss.bpm.process.ProcessDefinition;
-
-/**
- * Represents an instance of a BPM process.
- *
- * It is the combination of a process definition plus its associated instance data
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public interface ProcessInstance
-{
- /**
- * Get the associated process definition
- */
- ProcessDefinition getProcessDefinition();
-
- /**
- * Get the name of this process instance
- */
- String getName();
-
- /**
- * Get the attachments for this process instance
- */
- Attachments getAttachments();
-
- /**
- * Create an execution for this process instance
- */
- Execution createExecution();
-
- /**
- * Get the set of registered executions
- */
- Set<Execution> getExecutions();
-
- /**
- * Find an execution for a given name
- *
- * @return null if it cannot be found
- */
- Execution findExecution(String name);
-
- /**
- * Remove an execution for a given name
- */
- void removeExecution(String name);
-
-}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessInstanceManager.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessInstanceManager.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessInstanceManager.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,84 +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.jboss.bpm.client;
-
-//$Id$
-
-import org.jboss.bpm.EngineShutdownException;
-import org.jboss.bpm.process.ProcessDefinition;
-
-/**
- * The process instance manager is the entry point to create process instances.
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public abstract class ProcessInstanceManager
-{
- // Injected through the MC
- protected ProcessEngine engine;
-
- // Hide public constructor
- protected ProcessInstanceManager()
- {
- }
-
- /**
- * Get the associated process engine
- */
- public ProcessEngine getProcessEngine()
- {
- if (engine == null)
- throw new IllegalStateException("ProcessEngine not available through kernel configuration");
-
- return engine;
- }
-
- /**
- * Locate the process instance manager
- */
- public static ProcessInstanceManager locateProcessInstanceManager()
- {
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
- return engine.getProcessInstanceManager();
- }
-
- /**
- * Create a process instance for a given process definition
- *
- * @param pdef the process definition
- * @return A process instance
- */
- public final ProcessInstance createProcessInstance(ProcessDefinition pdef)
- {
- // TODO: test this
- if (engine.isPrepareForShutdown())
- throw new EngineShutdownException("Cannot create new ProcessInstance while engine is shutting down");
-
- ProcessInstance pinst = createProcessInstanceOverride(pdef);
- return pinst;
- }
-
- // Override to implement process instance creation
- protected abstract ProcessInstance createProcessInstanceOverride(ProcessDefinition pdef);
-
-}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ProcessManager.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -105,7 +105,7 @@
/*
* Get the set of registered process definitions
*/
- public Set<Process> getProcesss()
+ public Set<Process> getProcesses()
{
return Collections.unmodifiableSet(procs);
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/SignalManager.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -28,6 +28,8 @@
import java.util.Map;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.bpm.runtime.Signal;
/**
@@ -38,10 +40,13 @@
*/
public abstract class SignalManager
{
+ // provide logging
+ private static final Log log = LogFactory.getLog(SignalManager.class);
+
// Injected through the MC
protected ProcessEngine engine;
// The map of registered signal listeners
- private Map<String,Set<SignalListener>> listeners = new HashMap<String,Set<SignalListener>>();
+ private Map<String, Set<SignalListener>> listeners = new HashMap<String, Set<SignalListener>>();
// Hide public constructor
protected SignalManager()
@@ -67,10 +72,11 @@
ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
return engine.getSignalManager();
}
-
+
/** Add a signal listener for a given process */
public void addListener(String procName, SignalListener listener)
{
+ log.debug("addListener: " + listener);
Set<SignalListener> set = listeners.get(procName);
if (set == null)
{
@@ -79,27 +85,30 @@
}
set.add(listener);
}
-
+
/** Remove an signal listener for a given process */
public void removeListener(String procName, SignalListener listener)
{
+ log.debug("removeListener: " + listener);
Set<SignalListener> set = listeners.get(procName);
if (set != null)
{
set.remove(listener);
}
}
-
+
/** Remove all signal listeners for a given process */
public void removeListeners(String procName)
{
+ log.debug("removeListeners: " + procName);
listeners.remove(procName);
}
-
+
/** Throw a signal to all registered listeners */
public void throwSignal(Signal signal)
{
- String procName = signal.getProcessName();
+ log.debug("throwSignal: " + signal);
+ String procName = signal.getProcess().getName();
Set<SignalListener> set = listeners.get(procName);
if (set != null)
{
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/AbstractExecution.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/AbstractExecution.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/AbstractExecution.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,116 +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.jboss.bpm.client.internal;
-
-//$Id$
-
-import org.jboss.bpm.client.ProcessInstance;
-import org.jboss.bpm.process.Execution;
-import org.jboss.bpm.process.Node;
-import org.jboss.bpm.runtime.Token;
-
-/**
- * Represents an execution of a process instance.
- *
- * The name of an execution is unique in the scope of the process instance.
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public abstract class AbstractExecution implements Execution
-{
- // The associated process instance
- private ProcessInstance pinst;
-
- // Construct the execution
- protected AbstractExecution(ProcessInstance pinst)
- {
- if (pinst == null)
- throw new IllegalArgumentException("Process instance cannot be null");
-
- this.pinst = pinst;
- }
-
- // Construct the execution from a copy
- protected AbstractExecution(Execution ex)
- {
- this(ex.getProcessInstance());
- }
-
- // Call to initialize fully
- protected void init(String name)
- {
- if (name == null)
- {
- name = "AnonymousExecution#" + pinst.getExecutions().size();
- setName(name);
- }
- }
-
- /*
- * Get the associated process instance
- */
- /* (non-Javadoc)
- * @see org.jboss.bpm.client.Execution#getProcessInstance()
- */
- public ProcessInstance getProcessInstance()
- {
- return pinst;
- }
-
- /**
- * Get the name for the execution
- */
- public abstract String getName();
-
- /**
- * Get the context for this execution
- */
- public abstract Token getContext();
-
- // Set the name for the execution
- protected abstract void setName(String name);
-
- /**
- * Get the current node for this execution
- */
- public final Node getNode()
- {
- Node node = getNodeOverride();
- return node;
- }
-
- // Override to get the node
- protected abstract Node getNodeOverride();
-
- /**
- * Signal this execution
- */
- public final void signal()
- {
- signalOverride();
- }
-
- // Override to implement execution signalling
- protected abstract void signalOverride();
-
-}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/AbstractProcessInstance.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/AbstractProcessInstance.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/AbstractProcessInstance.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,149 +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.jboss.bpm.client.internal;
-
-// $Id$
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.bpm.client.Attachments;
-import org.jboss.bpm.client.ExecutionManager;
-import org.jboss.bpm.client.ProcessInstance;
-import org.jboss.bpm.process.Execution;
-import org.jboss.bpm.process.ProcessDefinition;
-
-/**
- * Represents an instance of a BPM process.
- *
- * It is the combination of a process definition plus its associated instance data
- *
- * @author thomas.diesler at jboss.com
- * @since 18-Jun-2008
- */
-public abstract class AbstractProcessInstance implements ProcessInstance
-{
- // The process definition
- private ProcessDefinition pdef;
- // The name
- private String name;
- // The map of executions
- private Set<Execution> execs = new HashSet<Execution>();
- // The meta data for this process instance
- private Attachments attachments = new ProcessInstanceContext();
-
- // Construct a process instance with a given process definition
- protected AbstractProcessInstance(ProcessDefinition pdef)
- {
- if (pdef == null)
- throw new IllegalArgumentException("Process definition cannot be null");
-
- this.pdef = pdef;
- }
-
- // Call to initialize fully
- protected void init(String name)
- {
- if (name == null)
- {
- name = "AnonymousInst#" + pdef.getProcessInstances().size();
- setName(name);
- }
- }
-
- /**
- * Get the associated process definition
- */
- public ProcessDefinition getProcessDefinition()
- {
- return pdef;
- }
-
- /**
- * Get the name of this process instance
- */
- public String getName()
- {
- return name;
- }
-
- // This is private and MUST NOT leak into the public API
- private void setName(String name)
- {
- this.name = name;
- }
-
- /**
- * Get the context for this process instance
- */
- public Attachments getAttachments()
- {
- return attachments;
- }
-
- /**
- * Create an execution for this process instance
- */
- public Execution createExecution()
- {
- ExecutionManager exm = ExecutionManager.locateExecutionManager();
- return exm.createExecution(this);
- }
-
- /**
- * Get the set of registered executions
- */
- public Set<Execution> getExecutions()
- {
- return Collections.unmodifiableSet(execs);
- }
-
- /**
- * Find an execution for a given name
- *
- * @return null if it cannot be found
- */
- public Execution findExecution(String name)
- {
- for (Execution ex : execs)
- {
- if (ex.getName() == name)
- return ex;
- }
- return null;
- }
-
- /**
- * Remove an execution for a given name
- */
- public void removeExecution(String name)
- {
- for (Execution ex : execs)
- {
- if (ex.getName() == name)
- {
- execs.remove(ex);
- }
- }
- }
-}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/ProcessInstanceContext.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/ProcessInstanceContext.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/ProcessInstanceContext.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,100 +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.jboss.bpm.client.internal;
-
-//$Id$
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.bpm.client.Attachments;
-
-/**
- * An process instance context that can take attachments.
- *
- * @author Thomas.Diesler at jboss.com
- * @since 20-Apr-2007
- */
-public class ProcessInstanceContext implements Attachments
-{
- private Map<Key, Object> attachments = new HashMap<Key, Object>();
-
- public Collection<Key> getAttachmentKeys()
- {
- return attachments.keySet();
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz)
- {
- return (T)attachments.get(new Key(clazz, null));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz, String name)
- {
- return (T)attachments.get(new Key(clazz, name));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(String name)
- {
- return (T)attachments.get(new Key(null, name));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(Class<T> clazz, Object obj)
- {
- return (T)attachments.put(new Key(clazz, null), obj);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(Class<T> clazz, String name, Object obj)
- {
- return (T)attachments.put(new Key(clazz, name), obj);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(String name, Object obj)
- {
- return (T)attachments.put(new Key(null, name), obj);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz)
- {
- return (T)attachments.remove(new Key(clazz, null));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz, String name)
- {
- return (T)attachments.remove(new Key(clazz, name));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(String name)
- {
- return (T)attachments.remove(new Key(null, name));
- }
-}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Activity.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -22,6 +22,7 @@
package org.jboss.bpm.model;
+
// $Id$
/**
@@ -32,8 +33,6 @@
* @author thomas.diesler at jboss.com
* @since 08-Jul-2008
*/
-public interface Activity extends FlowObject
+public interface Activity extends NamedFlowObject
{
- /** Get the name */
- String getName();
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Event.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -22,6 +22,7 @@
package org.jboss.bpm.model;
+
// $Id$
/**
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -21,15 +21,28 @@
*/
package org.jboss.bpm.model;
+import org.jboss.bpm.runtime.Signal;
+import org.jboss.bpm.runtime.Token;
-// $Id$
+//$Id$
/**
- * A Flow Object is one of the set of following graphical objects: Event, Activity, and Gateway.
+ * A Flow Object is one of the set of following graphical objects: Event, Activity, and Gateway.
*
* @author thomas.diesler at jboss.com
* @since 08-Jul-2008
*/
public interface FlowObject
{
+ /** Get the associated Process */
+ Process getProcess();
+
+ /** Get signal for enter */
+ Signal getEnterSignal();
+
+ /** Get signal for exit */
+ Signal getExitSignal();
+
+ /** Execute this flow object*/
+ void execute(Token token);
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Gateway.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -22,6 +22,7 @@
package org.jboss.bpm.model;
+
// $Id$
/**
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,37 @@
+/*
+ * 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.jboss.bpm.model;
+
+//$Id$
+
+
+/**
+ * A Flow Object with a name
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface NamedFlowObject extends FlowObject
+{
+ /** Get the name */
+ String getName();
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/NamedFlowObject.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -21,7 +21,12 @@
*/
package org.jboss.bpm.model;
+import java.util.Set;
+import java.util.concurrent.Future;
+import org.jboss.bpm.client.Attachments;
+
+
// $Id$
/**
@@ -30,8 +35,26 @@
* @author thomas.diesler at jboss.com
* @since 08-Jul-2008
*/
-public interface Process extends Activity
+public interface Process extends Activity, NamedFlowObject
{
+ /** Start the process */
+ Future<Result> startProcess();
+
+ /** Start the process, with a given execution context */
+ Future<Result> startProcess(Attachments att);
+
/** Get the start event */
StartEvent getStartEvent();
+
+ /** Get the set of end events */
+ Set<EndEvent> getEndEvents();
+
+ /** Get the set of flow objects */
+ Set<FlowObject> getFlowObjects();
+
+ /**
+ * Find a flow object by name
+ * @return null if not found
+ */
+ NamedFlowObject findFlowObject(String name);
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Result.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Result.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Result.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -26,13 +26,15 @@
import org.jboss.bpm.client.Attachments;
/**
- * A Result is consequence of reaching an End Event.
+ * A Result is consequence of reaching an End Event.
*
- * Results can be of different types, including: Message, Error, Compensation, Link, and Multiple.
+ * Results can be of different types, including: Message, Error, Compensation, Link, and Multiple.
*
* @author thomas.diesler at jboss.com
* @since 08-Jul-2008
*/
-public interface Result extends Attachments
+public interface Result
{
+ /** Get the Attachments from the result */
+ Attachments getAttachments();
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/StartEvent.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -23,7 +23,6 @@
//$Id$
-import org.jboss.bpm.runtime.ExecutionContext;
/**
* A Start Event indicates where a particular Process will start.
@@ -36,9 +35,4 @@
*/
public interface StartEvent extends Event
{
- /** Start the flow of the process */
- void execute();
-
- /** Start the flow of the process, with a given execution context */
- void execute(ExecutionContext ctx);
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/SubProcess.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -21,7 +21,6 @@
*/
package org.jboss.bpm.model;
-
// $Id$
/**
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/Task.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -23,8 +23,6 @@
//$Id$
-import org.jboss.bpm.runtime.ExecutionContext;
-
/**
* A Task is an Atomic Activity that is included within a Process.
*
@@ -36,6 +34,4 @@
*/
public interface Task extends Activity
{
- /** Execute the task */
- void execute(ExecutionContext ctx);
}
\ No newline at end of file
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractActivity.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractActivity.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractActivity.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,74 @@
+/*
+ * 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.jboss.bpm.model.internal;
+
+// $Id$
+import org.jboss.bpm.client.SignalManager;
+import org.jboss.bpm.model.Activity;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * Extend to implement an Activity
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class AbstractActivity extends AbstractFlowObject implements Activity
+{
+ // Construct the Activity
+ protected AbstractActivity()
+ {
+ }
+
+ // Call to initialize fully
+ protected void init(String name)
+ {
+ if (name == null)
+ {
+ Process proc = getProcess();
+ name = "AnonymousActivity#" + proc.getFlowObjects().size();
+ setName(name);
+ }
+ }
+
+ // Set the name. Note, this MUST NOT leak into the public API
+ public abstract void setName(String name);
+
+ /** Execute the activity with a given token */
+ public void execute(Token token)
+ {
+ SignalManager sm = SignalManager.locateSignalManager();
+ try
+ {
+ sm.throwSignal(getEnterSignal());
+ executeOverwrite(token);
+ }
+ finally
+ {
+ sm.throwSignal(getExitSignal());
+ }
+ }
+
+ // Overwrite to implement execute
+ protected abstract void executeOverwrite(Token token);
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEndEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEndEvent.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEndEvent.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,78 @@
+/*
+ * 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.jboss.bpm.model.internal;
+
+// $Id$
+
+import org.jboss.bpm.client.Attachments;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.Result;
+import org.jboss.bpm.runtime.Signal;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * Extend to implement an EndEvent
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class AbstractEndEvent extends AbstractEvent implements EndEvent
+{
+ private Result result;
+
+ // Construct the StartEvent
+ protected AbstractEndEvent()
+ {
+ }
+
+ /** Get signal for enter */
+ public Signal getEnterSignal()
+ {
+ return new Signal(getProcess(), Signal.Type.ENTER_END_EVENT);
+ }
+
+ /** Get signal for exit */
+ public Signal getExitSignal()
+ {
+ return new Signal(getProcess(), Signal.Type.EXIT_END_EVENT);
+ }
+
+ @Override
+ public void execute(final Token token)
+ {
+ super.execute(token);
+
+ // Provide the result
+ result = new Result()
+ {
+ public Attachments getAttachments()
+ {
+ return token.getExecutionContext();
+ }
+ };
+ }
+
+ public Result getResult()
+ {
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEndEvent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEvent.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEvent.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -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.jboss.bpm.model.internal;
+
+// $Id$
+
+import org.jboss.bpm.client.SignalManager;
+import org.jboss.bpm.model.Event;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * Extend to implement an Event
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class AbstractEvent extends AbstractFlowObject implements Event
+{
+ // Construct the Event
+ protected AbstractEvent()
+ {
+ }
+
+ /** Execute the task with a given token */
+ public void execute(Token token)
+ {
+ SignalManager sm = SignalManager.locateSignalManager();
+ try
+ {
+ sm.throwSignal(getEnterSignal());
+ executeOverwrite(token);
+ }
+ finally
+ {
+ sm.throwSignal(getExitSignal());
+ }
+ }
+
+ // Overwrite to implement execute
+ protected abstract void executeOverwrite(Token token);
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractEvent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractFlowObject.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractFlowObject.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractFlowObject.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,69 @@
+/*
+ * 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.jboss.bpm.model.internal;
+
+// $Id$
+
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.Process;
+
+/**
+ * Extend to implement a FlowObject
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class AbstractFlowObject implements FlowObject
+{
+ // The Process this flow object is associated with
+ private Process process;
+ // The implementaion object
+ private Object implObject;
+
+ // Construct the FlowObject
+ protected AbstractFlowObject()
+ {
+ }
+
+ public Process getProcess()
+ {
+ return process;
+ }
+
+ public void setProcess(Process process)
+ {
+ if (this.process != null)
+ throw new IllegalStateException("Cannot reassign task to process");
+
+ this.process = process;
+ }
+
+ public Object getImplObject()
+ {
+ return implObject;
+ }
+
+ public void setImplObject(Object implObject)
+ {
+ this.implObject = implObject;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractFlowObject.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractProcess.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractProcess.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractProcess.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,231 @@
+/*
+ * 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.jboss.bpm.model.internal;
+
+// $Id$
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.NameNotUniqueException;
+import org.jboss.bpm.NotImplementedException;
+import org.jboss.bpm.client.Attachments;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.NamedFlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Result;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.runtime.Signal;
+
+/**
+ * Extend to implement a Process
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class AbstractProcess extends AbstractActivity implements Process
+{
+ // The list of nodes
+ private Set<FlowObject> flowObjects = new HashSet<FlowObject>();
+
+ // Construct the process
+ protected AbstractProcess()
+ {
+ }
+
+ // Call to initialize fully
+ protected void init(String name)
+ {
+ if (name == null)
+ {
+ ProcessManager pdm = ProcessManager.locateProcessManager();
+ name = "AnonymousProcess#" + pdm.getProcesses().size();
+ setName(name);
+ }
+ }
+
+ /** Get the set of flow objects */
+ public Set<FlowObject> getFlowObjects()
+ {
+ return Collections.unmodifiableSet(flowObjects);
+ }
+
+ // Add a flow object. Note, this MUST NOT leak into the public API
+ protected void addFlowObject(AbstractFlowObject flowObject)
+ {
+ if (flowObject instanceof StartEvent && getStartEventInternal() != null)
+ throw new InvalidProcessException("Process cannot have multiple start events: " + flowObject);
+
+ if (flowObject instanceof NamedFlowObject)
+ {
+ String name = ((NamedFlowObject)flowObject).getName();
+ if (findFlowObject(name) != null)
+ throw new NameNotUniqueException("NamedFlowObject: " + name);
+ }
+
+ flowObjects.add(flowObject);
+ }
+
+ /** Start the process */
+ public Future<Result> startProcess()
+ {
+ return startProcess(null);
+ }
+
+ /** Start the process with given attachments */
+ public Future<Result> startProcess(Attachments att)
+ {
+ execute(new InitialToken(this, att));
+ return new ResultFuture();
+ }
+
+ /** Get the start event */
+ public StartEvent getStartEvent()
+ {
+ StartEvent start = getStartEventInternal();
+ if (start == null)
+ throw new InvalidProcessException("Process does not have a start event");
+
+ return start;
+ }
+
+ private StartEvent getStartEventInternal()
+ {
+ StartEvent start = null;
+ for (FlowObject aux : flowObjects)
+ {
+ if (aux instanceof StartEvent)
+ {
+ start = (StartEvent)aux;
+ break;
+ }
+ }
+ return start;
+ }
+
+ /** Get the set of end events */
+ public Set<EndEvent> getEndEvents()
+ {
+ Set<EndEvent> ends = getEndEventsInternal();
+ if (ends.size() == 0)
+ throw new InvalidProcessException("Process does not have end events");
+
+ return ends;
+ }
+
+ private Set<EndEvent> getEndEventsInternal()
+ {
+ Set<EndEvent> ends = new HashSet<EndEvent>();
+ for (FlowObject aux : flowObjects)
+ {
+ if (aux instanceof EndEvent)
+ {
+ ends.add((EndEvent)aux);
+ }
+ }
+ return ends;
+ }
+
+ /** Get signal for enter */
+ public Signal getEnterSignal()
+ {
+ return new Signal(this, Signal.Type.ENTER_PROCESS);
+ }
+
+ /** Get signal for exit */
+ public Signal getExitSignal()
+ {
+ return new Signal(this, Signal.Type.EXIT_PROCESS);
+ }
+
+ /**
+ * Find a flow object by name
+ * @return null if not found
+ */
+ public NamedFlowObject findFlowObject(String name)
+ {
+ NamedFlowObject nfo = null;
+ for (FlowObject aux : flowObjects)
+ {
+ if (aux instanceof NamedFlowObject && ((NamedFlowObject)aux).getName().equals(name))
+ {
+ nfo = (NamedFlowObject)aux;
+ break;
+ }
+ }
+ return nfo;
+ }
+
+ class ResultFuture implements Future<Result>
+ {
+ private Result result;
+
+ public boolean cancel(boolean mayInterruptIfRunning)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Result get() throws InterruptedException, ExecutionException
+ {
+ return getResult();
+ }
+
+ public Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
+ {
+ throw new NotImplementedException();
+ }
+
+ public boolean isCancelled()
+ {
+ return false;
+ }
+
+ public boolean isDone()
+ {
+ return getResult() != null;
+ }
+
+ private Result getResult()
+ {
+ if (result == null)
+ {
+ Set<EndEvent> ends = getEndEventsInternal();
+ for (EndEvent aux : ends)
+ {
+ result = aux.getResult();
+ if (result != null)
+ {
+ break;
+ }
+ }
+ }
+ return result;
+ }
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractProcess.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractStartEvent.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractStartEvent.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractStartEvent.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -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.jboss.bpm.model.internal;
+
+// $Id$
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.runtime.Signal;
+
+/**
+ * Extend to implement an StartEvent
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class AbstractStartEvent extends AbstractEvent implements StartEvent
+{
+ // Construct the StartEvent
+ protected AbstractStartEvent()
+ {
+ }
+
+ /** Get signal for enter */
+ public Signal getEnterSignal()
+ {
+ return new Signal(getProcess(), Signal.Type.ENTER_START_EVENT);
+ }
+
+ /** Get signal for exit */
+ public Signal getExitSignal()
+ {
+ return new Signal(getProcess(), Signal.Type.EXIT_START_EVENT);
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractStartEvent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractTask.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractTask.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractTask.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,53 @@
+/*
+ * 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.jboss.bpm.model.internal;
+
+// $Id$
+
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.runtime.Signal;
+
+/**
+ * Extend to implement an Task
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public abstract class AbstractTask extends AbstractActivity implements Task
+{
+ // Construct the Task
+ protected AbstractTask()
+ {
+ }
+
+ /** Get signal for enter */
+ public Signal getEnterSignal()
+ {
+ return new Signal(getProcess(), Signal.Type.ENTER_TASK, getName());
+ }
+
+ /** Get signal for exit */
+ public Signal getExitSignal()
+ {
+ return new Signal(getProcess(), Signal.Type.EXIT_TASK, getName());
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/AbstractTask.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/InitialToken.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/InitialToken.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/InitialToken.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,66 @@
+/*
+ * 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.jboss.bpm.model.internal;
+
+// $Id$
+
+import org.jboss.bpm.client.Attachments;
+import org.jboss.bpm.client.BasicAttachments;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.runtime.ExecutionContext;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * An initial token
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+class InitialToken implements Token
+{
+ private Process proc;
+ private ExecutionContext context;
+
+ public InitialToken(Process proc, Attachments att)
+ {
+ this.proc = proc;
+ this.context = new InitialContext(att);
+ }
+
+ public Process getProcess()
+ {
+ return proc;
+ }
+
+ public ExecutionContext getExecutionContext()
+ {
+ return context;
+ }
+
+ class InitialContext extends BasicAttachments implements ExecutionContext
+ {
+ InitialContext(Attachments att)
+ {
+ super(att);
+ }
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/InitialToken.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Activity.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Activity.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Activity.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,46 +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.jboss.bpm.runtime;
-
-//$Id$
-
-import org.jboss.bpm.process.Node;
-
-/**
- * An Activity is associated with a node to execute arbitrary business logic.
- *
- * It does not effect the execution of the process graph. Instead it reads/writes
- * values from/to the execution context and leaves it to the Engine
- * to proceed to the next node.
- *
- * @author Thomas.Diesler at jboss.com
- * @since 03-Jul-2008
- */
-public interface Activity
-{
- /**
- * Execute business logic associated with a Node
- * @param node The node this activity is associated with
- * @param ctx The execution context
- */
- void execute(Node node, Token ctx);
-}
\ No newline at end of file
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/BasicTask.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/BasicTask.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/BasicTask.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -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.jboss.bpm.runtime;
+
+//$Id$
+
+import org.jboss.bpm.model.internal.AbstractTask;
+
+/**
+ * Extend to implement a named task
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class BasicTask extends AbstractTask
+{
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ if (this.name != null)
+ throw new IllegalStateException("Cannot rename task");
+
+ this.name = name;
+ }
+
+ // Overwrite to implement execute
+ protected void executeOverwrite(Token token)
+ {
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/BasicTask.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/EndSignal.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/EndSignal.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/EndSignal.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,51 +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.jboss.bpm.runtime;
-
-//$Id$
-
-import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.Result;
-
-/**
- * A Signal thrown when the Process ends
- *
- * @author Thomas.Diesler at jboss.com
- * @since 08-Jul-2008
- */
-public class EndSignal extends Signal
-{
- private Result result;
-
- /** Create the signal for a given process */
- public EndSignal(Process proc, Result result)
- {
- super(proc);
- this.result = result;
- }
-
- /** Get the result */
- public Result getResult()
- {
- return result;
- }
-}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/ExecutionContext.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/ExecutionContext.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/ExecutionContext.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -21,20 +21,16 @@
*/
package org.jboss.bpm.runtime;
-import org.jboss.bpm.client.Attachments;
-
//$Id$
+import org.jboss.bpm.client.Attachments;
+
/**
* An execution context that can take attachments.
*
* @author Thomas.Diesler at jboss.com
* @since 20-Apr-2007
*/
-public abstract class ExecutionContext implements Attachments
+public interface ExecutionContext extends Attachments
{
- // Hide public constructor
- protected ExecutionContext()
- {
- }
}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeExecution.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeExecution.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeExecution.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.runtime;
-
-//$Id$
-
-import org.jboss.bpm.process.Execution;
-
-/**
- * Represents a runtime execution in the process definition.
- *
- * A runtime node gives access to its leaving transitions.
- *
- * @author thomas.diesler at jboss.com
- * @since 03-Jul-2008
- */
-public interface RuntimeExecution extends Execution
-{
- /**
- * Signal this execution with a named transition
- */
- void signal(String name);
-}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeNode.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeNode.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeNode.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,44 +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.jboss.bpm.runtime;
-
-//$Id$
-
-import java.util.List;
-
-/**
- * Represents a runtime node in the process definition.
- *
- * A runtime node gives access to its leaving transitions.
- *
- * @author thomas.diesler at jboss.com
- * @since 03-Jul-2008
- */
-public interface RuntimeNode
-{
- /**
- * Get the unmodifieable list of leaving transitions
- * @return an empty list if there are none
- */
- List<Transition> getLeavingTransitions();
-
-}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Signal.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Signal.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Signal.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -26,39 +26,69 @@
import org.jboss.bpm.model.Process;
/**
- * A Signal thrown by the ProcessEngine
+ * A Signal thrown by the ProcessEngine
*
* @author Thomas.Diesler at jboss.com
* @since 08-Jul-2008
*/
-public abstract class Signal
+public class Signal
{
- private String shortName;
- private String procName;
-
+ public enum Type
+ {
+ ENTER_START_EVENT, EXIT_START_EVENT,
+ ENTER_EVENT, EXIT_EVENT,
+ ENTER_END_EVENT, EXIT_END_EVENT,
+ ENTER_GATEWAY, EXIT_GATEWAY,
+ ENTER_PROCESS, EXIT_PROCESS,
+ ENTER_SUB_PROCESS, EXIT_SUB_PROCESS,
+ ENTER_TASK, EXIT_TASK,
+ USER_SIGNAL
+ }
+
+ private Process proc;
+ private Type type;
+ private String message;
+
/** Create the signal for a given process */
- public Signal(Process proc)
+ public Signal(Process proc, Type type)
{
- this.procName = proc.getName();
+ this.proc = proc;
+ this.type = type;
+ }
+
+ /** Create the signal for a given process */
+ public Signal(Process proc, Type type, String message)
+ {
+ this.proc = proc;
+ this.type = type;
+ this.message = message;
- shortName = getClass().getName();
- shortName = shortName.substring(shortName.lastIndexOf('.') + 1);
}
- /** Get the short name for this signal */
- public String getShortName()
+ /** Get the proccess */
+ public Process getProcess()
{
- return shortName;
+ return proc;
}
- /** Get the proccess name */
- public String getProcessName()
+ public Type getType()
{
- return procName;
+ return type;
}
-
+
+ public String getMessage()
+ {
+ return message;
+ }
+
public String toString()
{
- return shortName + "[" + procName + "]";
+ StringBuilder string = new StringBuilder(type + "[" + proc.getName());
+ if (message != null)
+ {
+ string.append(":" + message);
+ }
+ string.append("]");
+ return string.toString();
}
}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/StartSignal.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/StartSignal.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/StartSignal.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -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.jboss.bpm.runtime;
-
-//$Id$
-
-import org.jboss.bpm.model.Process;
-
-/**
- * A signal thrown by the Process starts
- *
- * @author Thomas.Diesler at jboss.com
- * @since 08-Jul-2008
- */
-public class StartSignal extends Signal
-{
- /** Create the signal for a given process */
- public StartSignal(Process proc)
- {
- super(proc);
- }
-}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -23,20 +23,25 @@
//$Id$
-import org.jboss.bpm.client.Attachments;
+import org.jboss.bpm.model.Process;
/**
* A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
- *
- * By tracking how the Token traverses the Flow Objects, gets diverted through alternative paths, and gets split into parallel paths,
- * the normal Sequence Flow should be completely definable.
- *
- * A Token will have a unique identity that can be used to separate multiple Tokens that may exist because
- * of concurrent process instances or the splitting of the Token for parallel processing within a single process instance.
*
+ * By tracking how the Token traverses the Flow Objects, gets diverted through alternative paths, and gets split into parallel paths, the normal Sequence Flow should be
+ * completely definable.
+ *
+ * A Token will have a unique identity that can be used to separate multiple Tokens that may exist because of concurrent process instances or the splitting of the Token
+ * for parallel processing within a single process instance.
+ *
* @author Thomas.Diesler at jboss.com
* @since 20-Apr-2007
*/
-public abstract class Token implements Attachments
+public interface Token
{
+ /** Get the associated execution context */
+ ExecutionContext getExecutionContext();
+
+ /** Get the current process */
+ Process getProcess();
}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Transition.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Transition.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Transition.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,43 +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.jboss.bpm.runtime;
-
-//$Id$
-
-/**
- * Represents the named connection between two nodes
- *
- * @author Thomas.Diesler at jboss.com
- * @since 03-Jul-2008
- */
-public abstract class Transition
-{
- // Hide public constructor
- protected Transition()
- {
- }
-
- /**
- * Get the name for this transition
- */
- public abstract String getName();
-}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/TransitionRouter.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/TransitionRouter.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/TransitionRouter.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -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.jboss.bpm.runtime;
-
-// $Id$
-
-/**
- * A TransitionRouter is responsible for choosing the leaving transition on a node.
- * <p/>
- * A typical implementation would signal the RuntimeExecution with a named Transition.
- *
- * <pre>
- * public void choosePath(RuntimeNode node, RuntimeExecution ex)
- * {
- * Boolean flag = ex.getContext().getAttachment(Boolean.class);
- * if (flag == true)
- * {
- * ex.signal("good");
- * }
- * else
- * {
- * ex.signal("bad");
- * }
- * }
- * </pre>
- *
- * @author Thomas.Diesler at jboss.com
- * @since 03-Jul-2008
- */
-public interface TransitionRouter
-{
- /**
- * Implement to signal the RuntimeExecution with a named Transition
- */
- void choosePath(RuntimeNode node, RuntimeExecution ex);
-}
\ No newline at end of file
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractRuntimeNode.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractRuntimeNode.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractRuntimeNode.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,61 +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.jboss.bpm.runtime.internal;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.bpm.process.Node;
-import org.jboss.bpm.process.internal.AbstractNode;
-import org.jboss.bpm.runtime.RuntimeNode;
-import org.jboss.bpm.runtime.Transition;
-
-/**
- * Represents a runtime node in the process definition.
- *
- * A runtime node gives access to its leaving transitions.
- *
- * @author thomas.diesler at jboss.com
- * @since 03-Jul-2008
- */
-public abstract class AbstractRuntimeNode extends AbstractNode implements RuntimeNode
-{
- private List<Transition> leavingTransitions = new ArrayList<Transition>();
-
- // Contruct the runtime node for a copy
- protected AbstractRuntimeNode(Node node)
- {
- super(node);
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bpm.runtime.internal.RuntimeNode#getLeavingTransitions()
- */
- public List<Transition> getLeavingTransitions()
- {
- return Collections.unmodifiableList(leavingTransitions);
- }
-
-}
\ No newline at end of file
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractToken.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractToken.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractToken.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,54 @@
+/*
+ * 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.jboss.bpm.runtime.internal;
+
+//$Id$
+
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
+ *
+ * By tracking how the Token traverses the Flow Objects, gets diverted through alternative paths, and gets split into parallel paths, the normal Sequence Flow should be
+ * completely definable.
+ *
+ * A Token will have a unique identity that can be used to separate multiple Tokens that may exist because of concurrent process instances or the splitting of the Token
+ * for parallel processing within a single process instance.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Apr-2007
+ */
+public abstract class AbstractToken implements Token
+{
+ // The implementaion object
+ private Object implObject;
+
+ public Object getImplObject()
+ {
+ return implObject;
+ }
+
+ public void setImplObject(Object implObject)
+ {
+ this.implObject = implObject;
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/internal/AbstractToken.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/test/AbstractAPITestCase.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -75,6 +75,17 @@
deployer = null;
}
+ // Get the URL for an resource
+ protected URL getResourceURL(String resource)
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ URL url = ctxLoader.getResource(resource);
+ if (url == null)
+ throw new IllegalStateException("Cannot find resource: " + resource);
+
+ return url;
+ }
+
private URL getBeansConfigURL(String resourceName)
{
URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
@@ -82,4 +93,5 @@
throw new JBPMException("Cannot find resource: " + resourceName);
return url;
}
+
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/test/DefaultEngineTestCase.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/test/DefaultEngineTestCase.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/test/DefaultEngineTestCase.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -56,7 +56,7 @@
public void catchSignal(Signal signal)
{
signals.add(signal);
- log.debug(signal);
+ log.debug("catchSignal: " + signal);
}
public List<Signal> getCaughtSignals()
Modified: api/trunk/modules/api/src/test/java/org/jboss/bpm/client/MockProcessEngine.java
===================================================================
--- api/trunk/modules/api/src/test/java/org/jboss/bpm/client/MockProcessEngine.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/test/java/org/jboss/bpm/client/MockProcessEngine.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -23,28 +23,13 @@
//$Id$
-import org.jboss.bpm.client.ExecutionManager;
-import org.jboss.bpm.client.ProcessDefinitionManager;
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.ProcessInstanceManager;
-
/**
* A process engine with public access
*
* @author thomas.diesler at jboss.com
* @since 18-Jun-2008
*/
-public class MockProcessEngine extends ProcessEngine {
+public class MockProcessEngine extends ProcessEngine
+{
- public void setProcessDefinitionManager(ProcessDefinitionManager processDefinitionManager) {
- this.processDefinitionManager = processDefinitionManager;
- }
-
- public void setProcessInstanceFactory(ProcessInstanceManager processInstanceFactory) {
- this.processInstanceManager = processInstanceFactory;
- }
-
- public void setExecutionManager(ExecutionManager executionManager) {
- this.executionManager = executionManager;
- }
}
\ No newline at end of file
Modified: api/trunk/modules/api/src/test/java/org/jboss/bpm/client/ProcessEngineLocatorTest.java
===================================================================
--- api/trunk/modules/api/src/test/java/org/jboss/bpm/client/ProcessEngineLocatorTest.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/api/src/test/java/org/jboss/bpm/client/ProcessEngineLocatorTest.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -24,8 +24,6 @@
// $Id$
import org.jboss.bpm.AbstractMockEngineTestCase;
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.ProcessEngineLocator;
public class ProcessEngineLocatorTest extends AbstractMockEngineTestCase
{
Deleted: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessDefinitionTest.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessDefinitionTest.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessDefinitionTest.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,148 +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.jboss.bpm.client;
-
-// $Id$
-
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.bpm.InvalidProcessDefinitionException;
-import org.jboss.bpm.process.EndNode;
-import org.jboss.bpm.process.Node;
-import org.jboss.bpm.process.ProcessDefinition;
-import org.jboss.bpm.process.StartNode;
-import org.jboss.bpm.test.DefaultEngineTestCase;
-
-public class ProcessDefinitionTest extends DefaultEngineTestCase
-{
-
- public void testBasicSequence() throws Exception
- {
- String jpdl =
- "<process-definition>" +
- " <start-state>" +
- " <transition to='stateA' />" +
- " </start-state>" +
- " <state name='stateA'>" +
- " <transition to='end' />" +
- " </state>" +
- " <end-state name='end' />" +
- "</process-definition>";
-
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
- assertEquals("AnonymousDef#0", pd.getName());
-
- StartNode startState = pd.getStartNode();
- assertEquals("AnonymousNode#0", startState.getName());
-
- List<Node> nodes = pd.getNodes();
- assertEquals(3, nodes.size());
-
- assertNotNull(pd.findNode("stateA"));
-
- Set<EndNode> endStates = pd.getEndNodes();
- assertEquals(1, endStates.size());
-
- EndNode endState = endStates.iterator().next();
- assertEquals(endState, pd.findNode("end"));
- }
-
- public void testNoStartState() throws Exception
- {
- String jpdl =
- "<process-definition>" +
- " <state>" +
- " <transition to='stateA' />" +
- " </state>" +
- " <state name='stateA'>" +
- " <transition to='end' />" +
- " </state>" +
- " <end-state name='end' />" +
- "</process-definition>";
-
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- try
- {
- pdm.createProcessDefinition(jpdl);
- fail("InvalidProcessDefinitionException expected");
- }
- catch (InvalidProcessDefinitionException ex)
- {
- assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("start node") > 0);
- }
- }
-
- public void testNoEndState() throws Exception
- {
- String jpdl =
- "<process-definition>" +
- " <start-state>" +
- " <transition to='stateA' />" +
- " </start-state>" +
- " <state name='stateA'>" +
- " <transition to='end' />" +
- " </state>" +
- " <state name='end' />" +
- "</process-definition>";
-
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- try
- {
- pdm.createProcessDefinition(jpdl);
- fail("InvalidProcessDefinitionException expected");
- }
- catch (InvalidProcessDefinitionException ex)
- {
- assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("end node") > 0);
- }
- }
-
- public void testNodeNameUniqueness() throws Exception
- {
- String jpdl =
- "<process-definition>" +
- " <start-state>" +
- " <transition to='stateA' />" +
- " </start-state>" +
- " <state name='stateA'>" +
- " <transition to='end' />" +
- " </state>" +
- " <state name='stateA'>" +
- " <transition to='end' />" +
- " </state>" +
- " <end-state name='end' />" +
- "</process-definition>";
-
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- try
- {
- pdm.createProcessDefinition(jpdl);
- fail("InvalidProcessDefinitionException expected");
- }
- catch (InvalidProcessDefinitionException ex)
- {
- // expected;
- }
- }
-}
Copied: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessTest.java (from rev 1541, api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessDefinitionTest.java)
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessTest.java (rev 0)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/client/ProcessTest.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,148 @@
+/*
+ * 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.jboss.bpm.client;
+
+// $Id$
+
+import java.util.Set;
+
+import org.jboss.bpm.InvalidProcessException;
+import org.jboss.bpm.model.EndEvent;
+import org.jboss.bpm.model.FlowObject;
+import org.jboss.bpm.model.NamedFlowObject;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.StartEvent;
+import org.jboss.bpm.model.Task;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+public class ProcessTest extends DefaultEngineTestCase
+{
+ public void testBasicSequence() throws Exception
+ {
+ String jpdl =
+ "<process-definition>" +
+ " <start-state>" +
+ " <transition to='stateA' />" +
+ " </start-state>" +
+ " <state name='stateA'>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <end-state name='end' />" +
+ "</process-definition>";
+
+ // Create a Process through the ProcessManager
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ Process proc = pm.createProcess(jpdl);
+ assertEquals("AnonymousProcess#0", proc.getName());
+
+ StartEvent start = proc.getStartEvent();
+ assertNotNull("Start expected", start);
+
+ Set<FlowObject> fos = proc.getFlowObjects();
+ assertEquals(3, fos.size());
+
+ NamedFlowObject nfo = proc.findFlowObject("stateA");
+ assertNotNull("FlowObject expected", nfo);
+ assertTrue("Task expected", nfo instanceof Task);
+
+ Set<EndEvent> ends = proc.getEndEvents();
+ assertEquals(1, ends.size());
+ }
+
+ public void testNoStartState() throws Exception
+ {
+ String jpdl =
+ "<process-definition>" +
+ " <state>" +
+ " <transition to='stateA' />" +
+ " </state>" +
+ " <state name='stateA'>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <end-state name='end' />" +
+ "</process-definition>";
+
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ try
+ {
+ pm.createProcess(jpdl);
+ fail("InvalidProcessException expected");
+ }
+ catch (InvalidProcessException ex)
+ {
+ assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("start event") > 0);
+ }
+ }
+
+ public void testNoEndState() throws Exception
+ {
+ String jpdl =
+ "<process-definition>" +
+ " <start-state>" +
+ " <transition to='stateA' />" +
+ " </start-state>" +
+ " <state name='stateA'>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <state name='end' />" +
+ "</process-definition>";
+
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ try
+ {
+ pm.createProcess(jpdl);
+ fail("InvalidProcessException expected");
+ }
+ catch (InvalidProcessException ex)
+ {
+ assertTrue("Unexpected message: " + ex.getMessage(), ex.getMessage().indexOf("end event") > 0);
+ }
+ }
+
+ public void testNodeNameUniqueness() throws Exception
+ {
+ String jpdl =
+ "<process-definition>" +
+ " <start-state>" +
+ " <transition to='stateA' />" +
+ " </start-state>" +
+ " <state name='stateA'>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <state name='stateA'>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <end-state name='end' />" +
+ "</process-definition>";
+
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ try
+ {
+ pm.createProcess(jpdl);
+ fail("InvalidProcessException expected");
+ }
+ catch (InvalidProcessException ex)
+ {
+ // expected;
+ }
+ }
+}
Deleted: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/ContextActivity.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/ContextActivity.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/ContextActivity.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,38 +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.jboss.bpm.samples.context;
-
-// $Id$
-
-import org.jboss.bpm.process.Node;
-import org.jboss.bpm.runtime.Activity;
-import org.jboss.bpm.runtime.Token;
-
-public class ContextActivity implements Activity
-{
- public void execute(Node node, Token ctx)
- {
- String name = node.getName();
- ctx.addAttachment(String.class, "ActivityMessage", "Activity on '" + name + "' has: " + ctx.getAttachmentKeys());
- ctx.addAttachment(ContextValue.class, "ActivityAttachment", new ContextValue("bar"));
- }
-}
Modified: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/ExecutionContextTest.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/ExecutionContextTest.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/ExecutionContextTest.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -23,9 +23,15 @@
// $Id$
-import org.jboss.bpm.client.ProcessDefinitionManager;
-import org.jboss.bpm.process.Execution;
-import org.jboss.bpm.process.ProcessDefinition;
+import java.net.URL;
+import java.util.concurrent.Future;
+
+import org.jboss.bpm.client.Attachments;
+import org.jboss.bpm.client.BasicAttachments;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.client.SignalManager;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Result;
import org.jboss.bpm.test.DefaultEngineTestCase;
/**
@@ -36,46 +42,44 @@
*/
public class ExecutionContextTest extends DefaultEngineTestCase
{
- String jpdl =
- "<process-definition>" +
- " <start-state>" +
- " <transition to='stateA' />" +
- " </start-state>" +
- " <state name='stateA'>" +
- " <event type='node-enter'>" +
- " <action class='org.jboss.bpm.samples.context.ContextActivity' />" +
- " </event>" +
- " <transition to='end'/>" +
- " </state>" +
- " <end-state name='end' />" +
- "</process-definition>";
+ private URL jpdlURL;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ jpdlURL = getResourceURL("samples/context/basic-context.xml");
+ SignalManager em = SignalManager.locateSignalManager();
+ em.addListener("basic-context", this);
+ }
/**
* Test that the execution context variables
*/
public void testTransientValues() throws Exception
{
- // Create an Execution through the ProcessDefinition
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
- Execution ex = pd.createExecution();
+ // Create a Process through the ProcessManager
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ Process proc = pm.createProcess(jpdlURL);
- // Set a context variable
- ex.getContext().addAttachment(ContextValue.class, new ContextValue("foo"));
+ BasicAttachments inCtx = new BasicAttachments();
+ inCtx.addAttachment(ContextValue.class, new ContextValue("foo"));
- // Signal the execution
- ex.signal();
+ // Start the Process
+ Future<Result> end = proc.startProcess(inCtx);
+ Result result = end.get();
// Verify context variables
- String msg = ex.getContext().getAttachment(String.class, "ActivityMessage");
- assertEquals("Activity on 'stateA' has: [[org.jboss.bpm.samples.context.ContextValue,null]]", msg);
+ Attachments att = result.getAttachments();
+ String msg = att.getAttachment(String.class, "TaskMessage");
+ assertEquals("stateA has: [[org.jboss.bpm.samples.context.ContextValue,null]]", msg);
// Validate original attachement
- ContextValue att1 = ex.getContext().getAttachment(ContextValue.class);
+ ContextValue att1 = att.getAttachment(ContextValue.class);
assertEquals("foo", att1.getMsg());
// Validate activity attachement
- ContextValue att2 = ex.getContext().getAttachment(ContextValue.class, "ActivityAttachment");
+ ContextValue att2 = att.getAttachment(ContextValue.class, "TaskAttachment");
assertEquals("bar", att2.getMsg());
}
}
Added: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/TaskA.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/TaskA.java (rev 0)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/TaskA.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,44 @@
+/*
+ * 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.jboss.bpm.samples.context;
+
+// $Id$
+
+import org.jboss.bpm.runtime.BasicTask;
+import org.jboss.bpm.runtime.ExecutionContext;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * A task that adds stuff to the execution context
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2008
+ */
+public class TaskA extends BasicTask
+{
+ protected void executeOverwrite(Token token)
+ {
+ ExecutionContext ctx = token.getExecutionContext();
+ ctx.addAttachment(String.class, "TaskMessage", getName() + " has: " + ctx.getAttachmentKeys());
+ ctx.addAttachment(ContextValue.class, "TaskAttachment", new ContextValue("bar"));
+ }
+}
Property changes on: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/context/TaskA.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/engine/EngineShutdownTest.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/engine/EngineShutdownTest.java 2008-07-09 07:28:58 UTC (rev 1558)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/engine/EngineShutdownTest.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -23,12 +23,12 @@
// $Id$
+import java.net.URL;
+
import org.jboss.bpm.EngineShutdownException;
-import org.jboss.bpm.client.ProcessDefinitionManager;
import org.jboss.bpm.client.ProcessEngine;
import org.jboss.bpm.client.ProcessEngineLocator;
-import org.jboss.bpm.client.ProcessInstance;
-import org.jboss.bpm.process.ProcessDefinition;
+import org.jboss.bpm.client.ProcessManager;
import org.jboss.bpm.test.DefaultEngineTestCase;
/**
@@ -41,22 +41,13 @@
{
private ProcessEngine engine;
- String jpdl =
- "<process-definition>" +
- " <start-state>" +
- " <transition to='stateA' />" +
- " </start-state>" +
- " <state name='stateA'>" +
- " <transition to='end' />" +
- " </state>" +
- " <end-state name='end' />" +
- "</process-definition>";
-
+ private URL jpdlURL;
+
@Override
protected void setUp() throws Exception
{
super.setUp();
-
+ jpdlURL = getResourceURL("samples/engine/basic-engine.xml");
engine = ProcessEngineLocator.locateProcessEngine();
engine.cancelShutdown();
}
@@ -66,64 +57,19 @@
*/
public void testCreateProcessDefinition() throws Exception
{
- // Create a ProcessDefinition through the ProcessDefinitionManager
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- assertNotNull("ProcessDefinition expected", pdm.createProcessDefinition(jpdl));
+ // Create a Process through the ProcessManager
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ assertNotNull("ProcessDefinition expected", pm.createProcess(jpdlURL));
// Try to create a ProcessDefinition during shutdown
try
{
engine.prepareForShutdown();
- pdm.createProcessDefinition(jpdl);
+ pm.createProcess(jpdlURL);
}
catch (EngineShutdownException ex)
{
- assertEquals("Cannot create new ProcessDefinition while engine is shutting down", ex.getMessage());
+ assertEquals("Cannot create new Process while engine is shutting down", ex.getMessage());
}
}
-
- /**
- * Try to create a ProcessInstance during shutdown
- */
- public void testCreateProcessInstance() throws Exception
- {
- // Create a ProcessDefinition through the ProcessDefinitionManager
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
- assertNotNull("ProcessInstance expected", pd.createProcessInstance());
-
- // Try to create a ProcessInstance during shutdown
- try
- {
- engine.prepareForShutdown();
- pd.createProcessInstance();
- }
- catch (EngineShutdownException ex)
- {
- assertEquals("Cannot create new ProcessInstance while engine is shutting down", ex.getMessage());
- }
- }
-
- /**
- * Try to create a Execution during shutdown
- */
- public void testCreateExecution() throws Exception
- {
- // Create a ProcessDefinition through the ProcessDefinitionManager
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
- assertNotNull("Execution expected", pd.createExecution());
-
- // Try to create a Execution during shutdown
- try
- {
- ProcessInstance pinst = pd.createProcessInstance();
- engine.prepareForShutdown();
- pinst.createExecution();
- }
- catch (EngineShutdownException ex)
- {
- assertEquals("Cannot create new Execution while engine is shutting down", ex.getMessage());
- }
- }
}
Copied: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence (from rev 1541, api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/basic)
Deleted: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/basic/BasicSequenceTest.java 2008-07-08 09:21:42 UTC (rev 1541)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -1,109 +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.jboss.bpm.samples.basic;
-
-// $Id$
-
-import org.jboss.bpm.client.ExecutionManager;
-import org.jboss.bpm.client.ProcessDefinitionManager;
-import org.jboss.bpm.client.ProcessEngine;
-import org.jboss.bpm.client.ProcessEngineLocator;
-import org.jboss.bpm.client.ProcessInstance;
-import org.jboss.bpm.client.ProcessInstanceManager;
-import org.jboss.bpm.process.Execution;
-import org.jboss.bpm.process.ProcessDefinition;
-import org.jboss.bpm.test.DefaultEngineTestCase;
-
-/**
- * Test the basic execution sequence
- *
- * @author thomas.diesler at jboss.com
- * @since 03-Jul-2008
- */
-public class BasicSequenceTest extends DefaultEngineTestCase
-{
- String jpdl =
- "<process-definition>" +
- " <start-state>" +
- " <transition to='stateA' />" +
- " </start-state>" +
- " <state name='stateA'>" +
- " <transition to='end' />" +
- " </state>" +
- " <end-state name='end' />" +
- "</process-definition>";
-
- /**
- * Test basic sequence doing it the long way
- */
- public void testBasicSequenceLong() throws Exception
- {
-
- // Locate the ProcessEngine
- ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
-
- // Create a ProcessDefinition through the ProcessDefinitionManager
- ProcessDefinitionManager pdm = engine.getProcessDefinitionManager();
- ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
-
- // Create a ProcessInstance through the ProcessInstanceManager
- ProcessInstanceManager pim = engine.getProcessInstanceManager();
- ProcessInstance pi = pim.createProcessInstance(pd);
-
- // Create an Execution through the ExecutionManager
- ExecutionManager pem = engine.getExecutionManager();
- Execution ex = pem.createExecution(pi);
- assertEquals(pd.getStartNode(), ex.getNode());
-
- // Signal the execution
- ex.signal();
- assertEquals(pd.findNode("stateA"), ex.getNode());
-
- // Signal the execution
- ex.signal();
- assertEquals(pd.findNode("end"), ex.getNode());
- assertEquals(pd.getEndNodes().iterator().next(), ex.getNode());
- }
-
- /**
- * Test basic sequence doing it the short way
- */
- public void testBasicSequence() throws Exception
- {
- // Create a ProcessDefinition through the ProcessDefinitionManager
- ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
- ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
-
- // Create an Execution through the ProcessDefinition
- Execution ex = pd.createExecution();
- assertEquals(pd.getStartNode(), ex.getNode());
-
- // Signal the execution
- ex.signal();
- assertEquals(pd.findNode("stateA"), ex.getNode());
-
- // Signal the execution
- ex.signal();
- assertEquals(pd.findNode("end"), ex.getNode());
- assertEquals(pd.getEndNodes().iterator().next(), ex.getNode());
- }
-}
Copied: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java (from rev 1558, api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/basic/BasicSequenceTest.java)
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java (rev 0)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/sequence/BasicSequenceTest.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.samples.sequence;
+
+// $Id$
+
+import java.net.URL;
+import java.util.List;
+import java.util.concurrent.Future;
+
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.client.SignalManager;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Result;
+import org.jboss.bpm.runtime.Signal;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+/**
+ * Test the basic execution sequence
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 03-Jul-2008
+ */
+public class BasicSequenceTest extends DefaultEngineTestCase
+{
+ private URL jpdlURL;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ jpdlURL = getResourceURL("samples/sequence/basic-sequence.xml");
+ SignalManager em = SignalManager.locateSignalManager();
+ em.addListener("basic-sequence", this);
+ }
+
+ /**
+ * Test a basic sequence
+ */
+ public void testBasicSequence() throws Exception
+ {
+ // Create a Process through the ProcessManager
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ Process proc = pm.createProcess(jpdlURL);
+
+ // Start the Process
+ Future<Result> end = proc.startProcess();
+ Result result = end.get();
+
+ // Validate the Result
+ assertNotNull("Result expected", result);
+ assertEquals("No attachments expected", 0, result.getAttachments().getAttachmentKeys().size());
+
+ // Validate received signals
+ List<Signal> signals = getCaughtSignals();
+ assertEquals("ENTER_PROCESS[basic-sequence]", signals.get(0).toString());
+ assertEquals("ENTER_START_EVENT[basic-sequence]", signals.get(1).toString());
+ assertEquals("EXIT_START_EVENT[basic-sequence]", signals.get(2).toString());
+ assertEquals("ENTER_TASK[basic-sequence:stateA]", signals.get(3).toString());
+ assertEquals("EXIT_TASK[basic-sequence:stateA]", signals.get(4).toString());
+ assertEquals("ENTER_END_EVENT[basic-sequence]", signals.get(5).toString());
+ assertEquals("EXIT_END_EVENT[basic-sequence]", signals.get(6).toString());
+ assertEquals("EXIT_PROCESS[basic-sequence]", signals.get(7).toString());
+ }
+}
Added: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java (rev 0)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,88 @@
+/*
+ * 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.jboss.bpm.samples.task;
+
+// $Id$
+
+import java.net.URL;
+import java.util.List;
+import java.util.concurrent.Future;
+
+import org.jboss.bpm.client.Attachments;
+import org.jboss.bpm.client.ProcessManager;
+import org.jboss.bpm.client.SignalManager;
+import org.jboss.bpm.model.Process;
+import org.jboss.bpm.model.Result;
+import org.jboss.bpm.runtime.Signal;
+import org.jboss.bpm.test.DefaultEngineTestCase;
+
+/**
+ * Test the basic activity execution
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 03-Jul-2008
+ */
+public class BasicTaskTest extends DefaultEngineTestCase
+{
+ private URL jpdlURL;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ jpdlURL = getResourceURL("samples/task/basic-task.xml");
+ SignalManager em = SignalManager.locateSignalManager();
+ em.addListener("basic-task", this);
+ }
+
+ /**
+ * Test that the execution context variables set by the Activity
+ * are visible to the client.
+ */
+ public void testBasicActivity() throws Exception
+ {
+ // Create a Process through the ProcessManager
+ ProcessManager pm = ProcessManager.locateProcessManager();
+ Process proc = pm.createProcess(jpdlURL);
+
+ // Start the Process
+ Future<Result> end = proc.startProcess();
+ Result result = end.get();
+
+ // Validate the Result
+ assertNotNull("Result expected", result);
+ Attachments att = result.getAttachments();
+ assertEquals("Attachments expected", 1, att.getAttachmentKeys().size());
+ assertEquals("Task: stateA", att.getAttachment(String.class));
+
+ // Validate received signals
+ List<Signal> signals = getCaughtSignals();
+ assertEquals("ENTER_PROCESS[basic-task]", signals.get(0).toString());
+ assertEquals("ENTER_START_EVENT[basic-task]", signals.get(1).toString());
+ assertEquals("EXIT_START_EVENT[basic-task]", signals.get(2).toString());
+ assertEquals("ENTER_TASK[basic-task:stateA]", signals.get(3).toString());
+ assertEquals("EXIT_TASK[basic-task:stateA]", signals.get(4).toString());
+ assertEquals("ENTER_END_EVENT[basic-task]", signals.get(5).toString());
+ assertEquals("EXIT_END_EVENT[basic-task]", signals.get(6).toString());
+ assertEquals("EXIT_PROCESS[basic-task]", signals.get(7).toString());
+ }
+}
Property changes on: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/BasicTaskTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java
===================================================================
--- api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java (rev 0)
+++ api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.samples.task;
+
+// $Id$
+
+import org.jboss.bpm.runtime.BasicTask;
+import org.jboss.bpm.runtime.ExecutionContext;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * A task that adds stuff to the execution context
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2008
+ */
+public class TaskA extends BasicTask
+{
+ protected void executeOverwrite(Token token)
+ {
+ ExecutionContext ctx = token.getExecutionContext();
+ ctx.addAttachment(String.class, "Task: " + getName());
+ }
+}
Property changes on: api/trunk/modules/testsuite/src/test/java/org/jboss/bpm/samples/task/TaskA.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/testsuite/src/test/resources/model/basic-sequence.xml
===================================================================
--- api/trunk/modules/testsuite/src/test/resources/model/basic-sequence.xml (rev 0)
+++ api/trunk/modules/testsuite/src/test/resources/model/basic-sequence.xml 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,9 @@
+<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='basic-sequence'>
+ <start-state>
+ <transition to='stateA' />
+ </start-state>
+ <state name='stateA'>
+ <transition to='end' />
+ </state>
+ <end-state name='end' />
+</process-definition>
\ No newline at end of file
Property changes on: api/trunk/modules/testsuite/src/test/resources/model/basic-sequence.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/testsuite/src/test/resources/samples/context/basic-context.xml
===================================================================
--- api/trunk/modules/testsuite/src/test/resources/samples/context/basic-context.xml (rev 0)
+++ api/trunk/modules/testsuite/src/test/resources/samples/context/basic-context.xml 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,12 @@
+<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='basic-context'>
+ <start-state>
+ <transition to='stateA' />
+ </start-state>
+ <state name='stateA'>
+ <event type='node-enter'>
+ <action class='org.jboss.bpm.samples.context.TaskA' />
+ </event>
+ <transition to='end' />
+ </state>
+ <end-state name='end' />
+</process-definition>
\ No newline at end of file
Property changes on: api/trunk/modules/testsuite/src/test/resources/samples/context/basic-context.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/testsuite/src/test/resources/samples/engine/basic-engine.xml
===================================================================
--- api/trunk/modules/testsuite/src/test/resources/samples/engine/basic-engine.xml (rev 0)
+++ api/trunk/modules/testsuite/src/test/resources/samples/engine/basic-engine.xml 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,9 @@
+<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='basic-engine'>
+ <start-state>
+ <transition to='stateA' />
+ </start-state>
+ <state name='stateA'>
+ <transition to='end' />
+ </state>
+ <end-state name='end' />
+</process-definition>
\ No newline at end of file
Property changes on: api/trunk/modules/testsuite/src/test/resources/samples/engine/basic-engine.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence.xml
===================================================================
--- api/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence.xml (rev 0)
+++ api/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence.xml 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,9 @@
+<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='basic-sequence'>
+ <start-state>
+ <transition to='stateA' />
+ </start-state>
+ <state name='stateA'>
+ <transition to='end' />
+ </state>
+ <end-state name='end' />
+</process-definition>
\ No newline at end of file
Property changes on: api/trunk/modules/testsuite/src/test/resources/samples/sequence/basic-sequence.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/testsuite/src/test/resources/samples/task/basic-task.xml
===================================================================
--- api/trunk/modules/testsuite/src/test/resources/samples/task/basic-task.xml (rev 0)
+++ api/trunk/modules/testsuite/src/test/resources/samples/task/basic-task.xml 2008-07-09 18:22:54 UTC (rev 1559)
@@ -0,0 +1,12 @@
+<process-definition xmlns='urn:jbpm.org:jpdl-3.2' name='basic-task'>
+ <start-state>
+ <transition to='stateA' />
+ </start-state>
+ <state name='stateA'>
+ <event type='node-enter'>
+ <action class='org.jboss.bpm.samples.task.TaskA' />
+ </event>
+ <transition to='end' />
+ </state>
+ <end-state name='end' />
+</process-definition>
\ No newline at end of file
Property changes on: api/trunk/modules/testsuite/src/test/resources/samples/task/basic-task.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jbpm-commits
mailing list