[jbpm-commits] JBoss JBPM SVN: r1640 - in api/trunk/modules/api/src/main/java/org/jboss/bpm: client/internal and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jul 15 12:03:55 EDT 2008
Author: thomas.diesler at jboss.com
Date: 2008-07-15 12:03:55 -0400 (Tue, 15 Jul 2008)
New Revision: 1640
Added:
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowScheduler.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MutableFlowScheduler.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeProcess.java
Removed:
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/HandlerSetterSupport.java
Modified:
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilderFactory.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/EventImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowHandler.java
api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java
Log:
Introduce FlowScheduler
Modified: 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-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/ExecutionManager.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -26,13 +26,13 @@
import java.util.concurrent.Future;
import org.jboss.bpm.model.FlowObject;
-import org.jboss.bpm.model.Process;
import org.jboss.bpm.model.Result;
import org.jboss.bpm.model.Signal;
import org.jboss.bpm.runtime.Attachments;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
import org.jboss.bpm.runtime.HandlerSupport;
+import org.jboss.bpm.runtime.RuntimeProcess;
import org.jboss.bpm.runtime.SignalHandler;
/**
@@ -57,7 +57,7 @@
* @param att The Attachments in the ExecutionContext
* @return The Future from which to obtain the process result
*/
- public abstract Future<Result> startProcess(Process proc, Attachments att);
+ public abstract Future<Result> startProcess(RuntimeProcess proc, Attachments att);
/**
* Locate the signal manager
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/client/internal/ExecutionManagerImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -45,8 +45,11 @@
import org.jboss.bpm.runtime.Attachments;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.MutableFlowScheduler;
+import org.jboss.bpm.runtime.RuntimeProcess;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
/**
* The process manager is the entry point to create, find and otherwise manage processes.
@@ -65,19 +68,23 @@
}
@Override
- public Future<Result> startProcess(Process proc, Attachments att)
+ public Future<Result> startProcess(RuntimeProcess proc, Attachments att)
{
throwSignal(new Signal(proc, Signal.Type.ENTER_PROCESS));
+ MutableFlowScheduler flowScheduler = proc.getFlowScheduler();
try
{
- Token token = new Token(proc, att);
+ Token initalToken = new Token(proc, att);
StartEvent start = proc.getStartEvent();
- token.addTailFlow(new InitialFlow(start));
+ Tuple tuple = new Tuple(new InitialFlow(start), initalToken);
+ flowScheduler.scheduleTuple(tuple);
- while (token.peekHeadFlow() != null)
+ while (flowScheduler.peekHeadTuple() != null)
{
// Peek the head flow
- Flow flow = token.peekHeadFlow();
+ tuple = flowScheduler.peekHeadTuple();
+ Flow flow = tuple.getFlow();
+ Token token = tuple.getToken();
// Get the target and its handlers
FlowObject target = flow.getTarget();
@@ -96,11 +103,11 @@
throwSignal(sigHandler.getExitSignal());
}
- // Remove the head flow
- token.removeHeadFlow();
+ // Remove the head tuple
+ flowScheduler.removeHeadTuple();
// Transfer the token to the FlowHandler
- flowHandler.execute(token);
+ flowHandler.execute(flowScheduler, token);
}
}
finally
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilderFactory.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilderFactory.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/ProcessBuilderFactory.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -33,6 +33,11 @@
*/
public abstract class ProcessBuilderFactory
{
+ // Hide the constructor
+ private ProcessBuilderFactory()
+ {
+ }
+
/**
* Get a {@link ProcessBuilder} for a given process name.
*/
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/EndEventImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -34,6 +34,7 @@
import org.jboss.bpm.runtime.Attachments;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
@@ -123,7 +124,7 @@
{
handler = new FlowHandler()
{
- public void execute(Token token)
+ public void execute(FlowScheduler scheduler, Token token)
{
log.debug("End reached in: " + getName());
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/EventImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/EventImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/EventImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -25,7 +25,6 @@
import org.jboss.bpm.model.internal.jaxb.JAXBEvent;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
-import org.jboss.bpm.runtime.HandlerSetterSupport;
import org.jboss.bpm.runtime.SignalHandler;
//$Id$
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowHandlerImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -25,6 +25,7 @@
import org.jboss.bpm.model.internal.jaxb.JAXBFlowHandler;
import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.Token;
/**
@@ -47,13 +48,13 @@
super(delegate);
}
- public void execute(Token token)
+ public void execute(FlowScheduler scheduler, Token token)
{
if (handler == null)
{
handler = newInstance(FlowHandler.class);
}
- handler.execute(token);
+ handler.execute(scheduler, token);
}
public static FlowHandler adaptHandler(JAXBFlowHandler jaxb)
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -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.model.internal;
+
+//$Id$
+
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.jboss.bpm.model.Flow;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.MutableFlowScheduler;
+import org.jboss.bpm.runtime.Token;
+
+/**
+ * The {@link FlowHandler} invokes the FlowScheduler to schedule
+ * {@link Flow} objects together with their associated {@link Token}.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public class FlowSchedulerImpl implements MutableFlowScheduler
+{
+ private Queue<Tuple> flowQueue = new ConcurrentLinkedQueue<Tuple>();
+
+ public void scheduleTuple(Tuple tuple)
+ {
+ flowQueue.add(tuple);
+ }
+
+ public Tuple peekHeadTuple()
+ {
+ return flowQueue.peek();
+ }
+
+ public Tuple removeHeadTuple()
+ {
+ return flowQueue.remove();
+ }
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/FlowSchedulerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/GatewayImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -37,9 +37,10 @@
import org.jboss.bpm.model.internal.jaxb.JAXBGateway;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
-import org.jboss.bpm.runtime.HandlerSetterSupport;
+import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
/**
* Gateways are modelling elements that are used to control how Sequence Flow interact as they converge and diverge within a Process. If the flow does not need to be
@@ -128,9 +129,10 @@
{
handler = new FlowHandler()
{
- public void execute(Token token)
+ public void execute(FlowScheduler scheduler, Token token)
{
- token.addTailFlow(outFlows.get(0));
+ Tuple tuple = new Tuple(outFlows.get(0), token);
+ scheduler.scheduleTuple(tuple);
}
};
}
Copied: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java (from rev 1637, api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/HandlerSetterSupport.java)
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/HandlerSetterSupport.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.model.internal;
+
+import org.jboss.bpm.runtime.ExecutionHandler;
+import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.HandlerSupport;
+import org.jboss.bpm.runtime.SignalHandler;
+
+
+//$Id$
+
+/**
+ * A combined interface for execution aspects
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface HandlerSetterSupport extends HandlerSupport
+{
+ /** Set the associated ExecutionHandler */
+ void setExecutionHandler(ExecutionHandler handler);
+
+ /** Set the associated SignalHandler */
+ void setSignalHandler(SignalHandler handler);
+
+ /** Set the associated FlowHandler */
+ void setFlowHandler(FlowHandler handler);
+}
\ No newline at end of file
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/IntermediateEventImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -33,8 +33,10 @@
import org.jboss.bpm.model.internal.jaxb.JAXBIntermediateEvent;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
/**
* An Intermediate Event is an Event that occurs after a Process has been started. It will affect the Flow of the Process, but will not start or (directly) terminate
@@ -119,9 +121,10 @@
{
handler = new FlowHandler()
{
- public void execute(Token token)
+ public void execute(FlowScheduler scheduler, Token token)
{
- token.addTailFlow(getOutFlow());
+ Tuple tuple = new Tuple(getOutFlow(), token);
+ scheduler.scheduleTuple(tuple);
}
};
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ParallelGatewayImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -27,7 +27,9 @@
import org.jboss.bpm.model.ParallelGateway;
import org.jboss.bpm.model.internal.jaxb.JAXBParallelGateway;
import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
/**
@@ -59,10 +61,13 @@
{
handler = new FlowHandler()
{
- public void execute(Token token)
+ public void execute(FlowScheduler scheduler, Token token)
{
for(Flow outFlow : getOutFlows())
- token.addTailFlow(outFlow);
+ {
+ Tuple tuple = new Tuple(outFlow, token.createCopy());
+ scheduler.scheduleTuple(tuple);
+ }
}
};
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ProcessBuilderImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -28,7 +28,6 @@
import org.jboss.bpm.model.ProcessBuilder;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
-import org.jboss.bpm.runtime.HandlerSetterSupport;
import org.jboss.bpm.runtime.SignalHandler;
/**
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -34,7 +34,6 @@
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.model.internal.jaxb.JAXBComplexGateway;
@@ -49,6 +48,8 @@
import org.jboss.bpm.model.internal.jaxb.JAXBSubProcess;
import org.jboss.bpm.model.internal.jaxb.JAXBTask;
import org.jboss.bpm.runtime.Attachments;
+import org.jboss.bpm.runtime.MutableFlowScheduler;
+import org.jboss.bpm.runtime.RuntimeProcess;
/**
* A Process is any Activity performed within a company or organization.
@@ -56,10 +57,11 @@
* @author thomas.diesler at jboss.com
* @since 08-Jul-2008
*/
-public class ProcessImpl extends ActivityImpl implements Process
+public class ProcessImpl extends ActivityImpl implements RuntimeProcess
{
private List<FlowObject> flowObjects = new ArrayList<FlowObject>();
private ProcessState processState = ProcessState.CREATED;
+ private MutableFlowScheduler scheduler = new FlowSchedulerImpl();
public ProcessImpl(String name)
{
@@ -159,6 +161,11 @@
return processState;
}
+ public MutableFlowScheduler getFlowScheduler()
+ {
+ return scheduler;
+ }
+
/**
* Set the process state
*/
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/StartEventImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -32,8 +32,10 @@
import org.jboss.bpm.model.internal.jaxb.JAXBStartEvent;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
+import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
/**
* A Start Event indicates where a particular Process will start. In terms of Sequence Flow, the Start Event starts the Flow of the Process, and thus, will not have any
@@ -95,9 +97,10 @@
{
handler = new FlowHandler()
{
- public void execute(Token token)
+ public void execute(FlowScheduler scheduler, Token token)
{
- token.addTailFlow(outFlow);
+ Tuple tuple = new Tuple(outFlow, token);
+ scheduler.scheduleTuple(tuple);
}
};
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/SubProcessImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -31,9 +31,10 @@
import org.jboss.bpm.model.internal.jaxb.JAXBSubProcess;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
-import org.jboss.bpm.runtime.HandlerSetterSupport;
+import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
/**
* A Sub-Process is Process that is included within another Process.
@@ -114,9 +115,10 @@
{
handler = new FlowHandler()
{
- public void execute(Token token)
+ public void execute(FlowScheduler scheduler, Token token)
{
- token.addTailFlow(outFlow);
+ Tuple tuple = new Tuple(outFlow, token);
+ scheduler.scheduleTuple(tuple);
}
};
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/model/internal/TaskImpl.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -30,9 +30,10 @@
import org.jboss.bpm.model.internal.jaxb.JAXBTask;
import org.jboss.bpm.runtime.ExecutionHandler;
import org.jboss.bpm.runtime.FlowHandler;
-import org.jboss.bpm.runtime.HandlerSetterSupport;
+import org.jboss.bpm.runtime.FlowScheduler;
import org.jboss.bpm.runtime.SignalHandler;
import org.jboss.bpm.runtime.Token;
+import org.jboss.bpm.runtime.FlowScheduler.Tuple;
//$Id$
@@ -127,9 +128,10 @@
{
handler = new FlowHandler()
{
- public void execute(Token token)
+ public void execute(FlowScheduler scheduler, Token token)
{
- token.addTailFlow(outFlow);
+ Tuple tuple = new Tuple(outFlow, token);
+ scheduler.scheduleTuple(tuple);
}
};
}
Modified: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowHandler.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowHandler.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowHandler.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -41,6 +41,6 @@
* The FlowHandler will add the active outgoing @{link Flow}s to
* some @{link Flow} queue for the {@link ProcessEngine} to execute.
*/
- void execute(Token token);
+ void execute(FlowScheduler scheduler, Token token);
}
\ No newline at end of file
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowScheduler.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowScheduler.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowScheduler.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -0,0 +1,72 @@
+/*
+ * 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.Flow;
+
+/**
+ * The {@link FlowHandler} invokes the FlowScheduler to schedule
+ * {@link Flow} objects together with their associated {@link Token}.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface FlowScheduler
+{
+ /**
+ * Schedule the given {@link Flow} and {@link Token}
+ */
+ void scheduleTuple(Tuple tuple);
+
+ /**
+ * A tuple of Flow and Token
+ */
+ class Tuple
+ {
+ private Flow flow;
+ private Token token;
+ /**
+ * Construct the Tuple with a given flow and Token
+ */
+ public Tuple(Flow flow, Token token)
+ {
+ this.flow = flow;
+ this.token = token;
+ }
+ /**
+ * Get the Flow
+ */
+ public Flow getFlow()
+ {
+ return flow;
+ }
+ /**
+ * Get the Token
+ */
+ public Token getToken()
+ {
+ return token;
+ }
+ }
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/FlowScheduler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/HandlerSetterSupport.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/HandlerSetterSupport.java 2008-07-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/HandlerSetterSupport.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -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$
-
-/**
- * A combined interface for execution aspects
- *
- * @author thomas.diesler at jboss.com
- * @since 08-Jul-2008
- */
-public interface HandlerSetterSupport extends HandlerSupport
-{
- /** Set the associated ExecutionHandler */
- void setExecutionHandler(ExecutionHandler handler);
-
- /** Set the associated SignalHandler */
- void setSignalHandler(SignalHandler handler);
-
- /** Set the associated FlowHandler */
- void setFlowHandler(FlowHandler handler);
-}
\ No newline at end of file
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MutableFlowScheduler.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MutableFlowScheduler.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MutableFlowScheduler.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -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.runtime;
+
+//$Id$
+
+
+/**
+ * The {@link FlowScheduler} that can be manipulated.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface MutableFlowScheduler extends FlowScheduler
+{
+ /**
+ * Peek the head {@link Tuple}
+ */
+ Tuple peekHeadTuple();
+
+ /**
+ * Remove the head {@link Tuple}
+ */
+ Tuple removeHeadTuple();
+}
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/MutableFlowScheduler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeProcess.java
===================================================================
--- api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeProcess.java (rev 0)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeProcess.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -0,0 +1,41 @@
+/*
+ * 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 RuntimeProcess add runtime behaviour to the {@link Process}
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 08-Jul-2008
+ */
+public interface RuntimeProcess extends Process
+{
+ /**
+ * Get the {@link FlowScheduler} for this {@link Process}
+ * @return
+ */
+ MutableFlowScheduler getFlowScheduler();
+}
\ No newline at end of file
Property changes on: api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/RuntimeProcess.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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-15 14:58:26 UTC (rev 1639)
+++ api/trunk/modules/api/src/main/java/org/jboss/bpm/runtime/Token.java 2008-07-15 16:03:55 UTC (rev 1640)
@@ -23,12 +23,7 @@
//$Id$
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.jboss.bpm.model.Flow;
import org.jboss.bpm.model.Process;
-import org.jboss.bpm.model.internal.FlowImpl;
/**
* A Token is a descriptive construct used to describe how the flow of a Process will proceed at runtime.
@@ -46,7 +41,6 @@
{
private Process proc;
private ExecutionContext context;
- private Queue<Flow> flowQueue = new ConcurrentLinkedQueue<Flow>();
public Token(Process proc, Attachments att)
{
@@ -64,21 +58,11 @@
return context;
}
- public Flow peekHeadFlow()
+ public Token createCopy()
{
- return flowQueue.peek();
+ return new Token(proc, context);
}
- public Flow removeHeadFlow()
- {
- return flowQueue.remove();
- }
-
- public void addTailFlow(Flow flow)
- {
- flowQueue.add(flow);
- }
-
static class InitialContext extends BasicAttachments implements ExecutionContext
{
InitialContext(Attachments att)
More information about the jbpm-commits
mailing list