Class ProcessEngineAgent
- java.lang.Object
-
- jadex.platform.service.processengine.ProcessEngineAgent
-
- All Implemented Interfaces:
IInternalProcessEngineService
,IProcessEngineService
public class ProcessEngineAgent extends java.lang.Object implements IProcessEngineService, IInternalProcessEngineService
Agent that implements the bpmn monitoring starter interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ProcessEngineAgent.EventInfo
static class
ProcessEngineAgent.ProcessInfo
Process info struct.
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
agent
The agent.protected java.util.Set<Future<java.lang.Void>>
creating
The set of currently creating process instances.protected EventMapper
eventmapper
The event mapper.protected java.util.Map<IComponentIdentifier,ProcessEngineAgent.ProcessInfo>
processes
The managed process instances.protected java.util.Map<Tuple2<java.lang.String,IResourceIdentifier>,java.util.List<java.lang.Runnable>>
remcoms
The remove commands.protected java.util.Map<java.lang.String,java.util.Set<java.lang.Object>>
waitqueue
The event waitqueue.protected java.util.Map<java.lang.String,java.util.Set<Tuple2<java.lang.String,IResourceIdentifier>>>
waitqueuetypes
The event types to be put in waitqueue.
-
Constructor Summary
Constructors Constructor Description ProcessEngineAgent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ISubscriptionIntermediateFuture<ProcessEngineEvent>
addBpmnModel(java.lang.String model, IResourceIdentifier urid)
Add a bpmn model that is monitored for start events.protected Tuple2<IFuture<java.lang.Void>,ISubscriptionIntermediateFuture<CMSStatusEvent>>
addCronJob(CronJob<CMSStatusEvent> cj, Tuple2<java.lang.String,IResourceIdentifier> key)
Add a cron job to the cron service.IFuture<java.lang.String>
addEventMatcher(java.lang.String[] events, UnparsedExpression uexp, java.lang.String[] imports, java.util.Map<java.lang.String,java.lang.Object> vals, boolean remove, IResultCommand<IFuture<java.lang.Void>,java.lang.Object> cmd)
Register an event description to be notified, when the event happens.protected void
addRemoveCommand(java.lang.Runnable com, Tuple2<java.lang.String,IResourceIdentifier> key)
protected static CronCreateCommand
createCronCreateCommand(IResourceIdentifier rid, java.lang.String model, java.lang.String mactid)
Create a new cron create component command.protected IFuture<java.lang.Void>
createProcessInstance(java.lang.Object event, EventMapper.ModelDetails det)
protected IFuture<java.lang.Void>
defer()
protected void
dispatchFromWaitqueue(java.lang.String type, boolean add)
Dispatch events from the waitqueue.protected void
dispatchToWaitqueue(java.lang.Object event, java.lang.String type)
protected void
extractDomainEventTypes(MActivity mevent, Tuple2<java.lang.String,IResourceIdentifier> model, java.util.Set<java.lang.String> evs)
IIntermediateFuture<Tuple2<java.lang.String,IResourceIdentifier>>
getBpmnModels()
Get the currently monitored processes.IFuture<java.lang.Void>
init()
Init method.protected IFuture<java.lang.Void>
internalProcessEvent(java.lang.Object event, java.lang.String atype, boolean add)
Process an event and get the consequence events.IFuture<java.lang.Void>
processEvent(java.lang.Object event, java.lang.String type)
Process an event and get the consequence events.IFuture<java.lang.Void>
removeBpmnModel(java.lang.String model, IResourceIdentifier rid)
Remove a bpmn model.IFuture<java.lang.Void>
removeEventMatcher(java.lang.String id)
Register an event description to be notified, when the event happens.
-
-
-
Field Detail
-
agent
protected IInternalAccess agent
The agent.
-
remcoms
protected java.util.Map<Tuple2<java.lang.String,IResourceIdentifier>,java.util.List<java.lang.Runnable>> remcoms
The remove commands.
-
processes
protected java.util.Map<IComponentIdentifier,ProcessEngineAgent.ProcessInfo> processes
The managed process instances.
-
eventmapper
protected EventMapper eventmapper
The event mapper.
-
waitqueue
protected java.util.Map<java.lang.String,java.util.Set<java.lang.Object>> waitqueue
The event waitqueue.
-
waitqueuetypes
protected java.util.Map<java.lang.String,java.util.Set<Tuple2<java.lang.String,IResourceIdentifier>>> waitqueuetypes
The event types to be put in waitqueue.
-
creating
protected java.util.Set<Future<java.lang.Void>> creating
The set of currently creating process instances.
-
-
Method Detail
-
init
public IFuture<java.lang.Void> init()
Init method.
-
addBpmnModel
public ISubscriptionIntermediateFuture<ProcessEngineEvent> addBpmnModel(java.lang.String model, IResourceIdentifier urid)
Add a bpmn model that is monitored for start events.- Specified by:
addBpmnModel
in interfaceIProcessEngineService
- Parameters:
model
- The bpmn modelrid
- The resource identifier (null for all platform jar resources).
-
extractDomainEventTypes
protected void extractDomainEventTypes(MActivity mevent, Tuple2<java.lang.String,IResourceIdentifier> model, java.util.Set<java.lang.String> evs)
-
removeBpmnModel
public IFuture<java.lang.Void> removeBpmnModel(java.lang.String model, IResourceIdentifier rid)
Remove a bpmn model.- Specified by:
removeBpmnModel
in interfaceIProcessEngineService
- Parameters:
model
- The bpmn modelrid
- The resource identifier (null for all platform jar resources).
-
getBpmnModels
public IIntermediateFuture<Tuple2<java.lang.String,IResourceIdentifier>> getBpmnModels()
Get the currently monitored processes.- Specified by:
getBpmnModels
in interfaceIProcessEngineService
- Returns:
- The currently observed bpmn models.
-
processEvent
public IFuture<java.lang.Void> processEvent(java.lang.Object event, java.lang.String type)
Process an event and get the consequence events.- Specified by:
processEvent
in interfaceIProcessEngineService
-
internalProcessEvent
protected IFuture<java.lang.Void> internalProcessEvent(java.lang.Object event, java.lang.String atype, boolean add)
Process an event and get the consequence events. Called internally when event should not be added to waitqueue.
-
createProcessInstance
protected IFuture<java.lang.Void> createProcessInstance(java.lang.Object event, EventMapper.ModelDetails det)
-
dispatchToWaitqueue
protected void dispatchToWaitqueue(java.lang.Object event, java.lang.String type)
-
dispatchFromWaitqueue
protected void dispatchFromWaitqueue(java.lang.String type, boolean add)
Dispatch events from the waitqueue.- Parameters:
type
- The event type. Events of that type will be redispatched.
-
defer
protected IFuture<java.lang.Void> defer()
-
addEventMatcher
public IFuture<java.lang.String> addEventMatcher(java.lang.String[] events, UnparsedExpression uexp, java.lang.String[] imports, java.util.Map<java.lang.String,java.lang.Object> vals, boolean remove, IResultCommand<IFuture<java.lang.Void>,java.lang.Object> cmd)
Register an event description to be notified, when the event happens.- Specified by:
addEventMatcher
in interfaceIInternalProcessEngineService
- Returns:
- An id to be used for deregistration.
-
removeEventMatcher
public IFuture<java.lang.Void> removeEventMatcher(java.lang.String id)
Register an event description to be notified, when the event happens.- Specified by:
removeEventMatcher
in interfaceIInternalProcessEngineService
-
addCronJob
protected Tuple2<IFuture<java.lang.Void>,ISubscriptionIntermediateFuture<CMSStatusEvent>> addCronJob(CronJob<CMSStatusEvent> cj, Tuple2<java.lang.String,IResourceIdentifier> key)
Add a cron job to the cron service. Also adds a remove command that is triggered when someone calls removeBPMN.
-
addRemoveCommand
protected void addRemoveCommand(java.lang.Runnable com, Tuple2<java.lang.String,IResourceIdentifier> key)
-
createCronCreateCommand
protected static CronCreateCommand createCronCreateCommand(IResourceIdentifier rid, java.lang.String model, java.lang.String mactid)
Create a new cron create component command.
-
-