Package jadex.bpmn.runtime.impl
Class BpmnProcessFeature
java.lang.Object
jadex.bpmn.runtime.impl.BpmnProcessFeature
- All Implemented Interfaces:
IBpmnComponentFeature
,IInternalBpmnComponentFeature
public class BpmnProcessFeature
extends Object
implements IInternalBpmnComponentFeature, IBpmnComponentFeature
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map
<String, IActivityHandler> The activity handlers.static final Map
<String, IActivityHandler> The activity execution handlers (activity type -> handler).static final Map
<String, IStepHandler> The step execution handlers (activity type -> handler).protected int
The thread id counter.The messages waitqueue.protected jadex.rules.eca.RuleSystem
The rule system.protected BpmnProcess
protected Map
<String, IStepHandler> The step handlers.protected ProcessThread
The top level process thread.Fields inherited from interface jadex.bpmn.runtime.impl.IInternalBpmnComponentFeature
TYPE_ACTIVITY, TYPE_THREAD
-
Constructor Summary
ConstructorsConstructorDescriptionFactory method constructor for instance level. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
construct
(Map<String, IActivityHandler> activityhandlers, Map<String, IStepHandler> stephandlers) Init method holds constructor code for both implementations.createProcessThreadInfo
(ProcessThread thread) Create a new process thread info for logging / debug tools.getActivityHandler
(MActivity activity) Get the activity handler for an activity.getActivityHandler
(String type) Get the activity handler for an activity.getContextVariable
(String name) Get the value of the given context variable.Get the messages.getModel()
Get the top level thread (is not executed and just acts as top level thread container).boolean
hasContextVariable
(String name) Test if the given context variable is declared.void
init()
protected boolean
isCurrentActivity
(MActivity activity, ProcessThread thread) Test if the notification is relevant for the current thread.boolean
Check, if the process has terminated.boolean
isFinished
(String pool, String lane) Check, if the process has terminated.boolean
isReady()
Check if the process is ready, i.e.boolean
Check if the process is ready, i.e.void
notify
(MActivity activity, ProcessThread thread, Object event) Method that should be called, when an activity is finished and the following activity should be scheduled.void
setContextVariable
(String name, Object value) Set the value of the given context variable.void
setContextVariable
(String name, Object key, Object value) Set the value of the given context variable.void
step
(MActivity activity, jadex.core.IComponent instance, ProcessThread thread, Object event) Make a process step, i.e.void
-
Field Details
-
DEFAULT_ACTIVITY_HANDLERS
The activity execution handlers (activity type -> handler). -
DEFAULT_STEP_HANDLERS
The step execution handlers (activity type -> handler). -
rulesystem
protected jadex.rules.eca.RuleSystem rulesystemThe rule system. -
activityhandlers
The activity handlers. -
stephandlers
The step handlers. -
topthread
The top level process thread. -
messages
The messages waitqueue. -
idcnt
protected int idcntThe thread id counter. -
self
-
-
Constructor Details
-
BpmnProcessFeature
Factory method constructor for instance level.
-
-
Method Details
-
getComponent
-
getModel
-
construct
protected void construct(Map<String, IActivityHandler> activityhandlers, Map<String, IStepHandler> stephandlers) Init method holds constructor code for both implementations. -
init
public void init()- Specified by:
init
in interfaceIInternalBpmnComponentFeature
-
terminate
public void terminate()- Specified by:
terminate
in interfaceIInternalBpmnComponentFeature
-
hasContextVariable
Test if the given context variable is declared.- Specified by:
hasContextVariable
in interfaceIInternalBpmnComponentFeature
- Parameters:
name
- The variable name.- Returns:
- True, if the variable is declared.
-
getContextVariable
Get the value of the given context variable.- Specified by:
getContextVariable
in interfaceIInternalBpmnComponentFeature
- Parameters:
name
- The variable name.- Returns:
- The variable value.
-
setContextVariable
Set the value of the given context variable.- Specified by:
setContextVariable
in interfaceIInternalBpmnComponentFeature
- Parameters:
name
- The variable name.value
- The variable value.
-
setContextVariable
Set the value of the given context variable.- Specified by:
setContextVariable
in interfaceIInternalBpmnComponentFeature
- Parameters:
name
- The variable name.value
- The variable value.
-
createProcessThreadInfo
Create a new process thread info for logging / debug tools. -
getActivityHandler
Get the activity handler for an activity.- Specified by:
getActivityHandler
in interfaceIInternalBpmnComponentFeature
- Parameters:
actvity
- The activity.- Returns:
- The activity handler.
-
getActivityHandler
Get the activity handler for an activity.- Specified by:
getActivityHandler
in interfaceIInternalBpmnComponentFeature
- Parameters:
type
- The activity type.- Returns:
- The activity handler.
-
getTopLevelThread
Get the top level thread (is not executed and just acts as top level thread container).- Specified by:
getTopLevelThread
in interfaceIInternalBpmnComponentFeature
-
step
public void step(MActivity activity, jadex.core.IComponent instance, ProcessThread thread, Object event) Make a process step, i.e. find the next edge or activity for a just executed thread.- Specified by:
step
in interfaceIInternalBpmnComponentFeature
- Parameters:
activity
- The activity to execute.instance
- The process instance.thread
- The process thread.
-
notify
Method that should be called, when an activity is finished and the following activity should be scheduled. Can safely be called from external threads.- Specified by:
notify
in interfaceIInternalBpmnComponentFeature
- Parameters:
activity
- The timing event activity.thread
- The process thread.event
- The event that has occurred, if any.instance
- The process instance.
-
isCurrentActivity
Test if the notification is relevant for the current thread. The normal test is if thread.getActivity().equals(activity). This method must handle the additional cases that the current activity of the thread is a multiple event activity or when the activity is a subprocess with an attached timer event. In this case the notification could be for one of the child/attached events. -
isReady
public boolean isReady()Check if the process is ready, i.e. if at least one process thread can currently execute a step.- Specified by:
isReady
in interfaceIInternalBpmnComponentFeature
- Parameters:
pool
- The pool to be executed or null for any.lane
- The lane to be executed or null for any. Nested lanes may be addressed by dot-notation, e.g. 'OuterLane.InnerLane'.
-
isReady
Check if the process is ready, i.e. if at least one process thread can currently execute a step.- Specified by:
isReady
in interfaceIInternalBpmnComponentFeature
- Parameters:
pool
- The pool to be executed or null for any.lane
- The lane to be executed or null for any. Nested lanes may be addressed by dot-notation, e.g. 'OuterLane.InnerLane'.
-
isFinished
public boolean isFinished()Check, if the process has terminated.- Specified by:
isFinished
in interfaceIInternalBpmnComponentFeature
- Parameters:
pool
- The pool to be executed or null for any.lane
- The lane to be executed or null for any. Nested lanes may be addressed by dot-notation, e.g. 'OuterLane.InnerLane'.- Returns:
- True, when the process instance is finished with regards to the specified pool/lane. When both pool and lane are null, true is returned only when all pools/lanes are finished.
-
isFinished
Check, if the process has terminated.- Specified by:
isFinished
in interfaceIInternalBpmnComponentFeature
- Parameters:
pool
- The pool to be executed or null for any.lane
- The lane to be executed or null for any. Nested lanes may be addressed by dot-notation, e.g. 'OuterLane.InnerLane'.- Returns:
- True, when the process instance is finished with regards to the specified pool/lane. When both pool and lane are null, true is returned only when all pools/lanes are finished.
-
getMessages
Get the messages.- Specified by:
getMessages
in interfaceIInternalBpmnComponentFeature
- Returns:
- The messages
-