Interface ActivityEventManager
-
- All Superinterfaces:
ADEPT2Service
,EventManager
- All Known Implementing Classes:
AbstractEventManager
,DefaultEventManager
public interface ActivityEventManager extends EventManager
To allow for event handler to execute activities and to control these executions, anActivityEventManager
provides a subset of the methods of aRuntimeService
. This includes starting and resuming the activity as well as the appropriate runtime environment and progress monitor. These methods should not be used from other services but are merely for more generic implementations of event handler plugins.
The correspondingactivity event handler
need to have the special plugin type "ActivityEventHandler".
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACT_CONF_EVENT_TYPE
The configuration key for an activity configuration providing the ID of an event type for which to create an event source for the activity.static String
ACT_CONF_RETRY_COUNT
The configuration key for an activity configuration for the number of retries when adding an event source for the corresponding activity.static String
ACT_CONF_RETRY_DELAY
The configuration key for an activity configuration for the delay (in milliseconds) between retries for adding an event source for the corresponding activity.static String
ACT_CONF_SOURCE_ID
The configuration key for an activity configuration providing the ID of a source in case one source should be used for several activities.static String
ACT_CONF_SOURCE_TYPE
The configuration key for an activity configuration providing the ID of a source type for which to create an event source for the activity.static String
PLUGIN_TYPE_ACTIVITY_EVENT_HANDLER
The plug-in type ID for activity event handler.-
Fields inherited from interface de.aristaflow.adept2.core.eventmanager.EventManager
PLUGIN_TYPE_EVENT_HANDLER
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
deselectActivity(EBPInstanceReference activity)
Deselects the designated activity and thus makes it available for reassigning.RemoteProgressMonitor
getProgressMonitor()
Gets the interface for remotely usingProgressMonitor
.RemoteRuntimeEnvironment
getRuntimeEnvironment()
Gets the interface for remotely usingRuntimeEnvironment
.SimpleSessionContext
getSimpleSessionContext(EBPInstanceReference activity, ProcessConstants.ExecutionMode executionMode)
Gets an incomplete simple session context for the designated activity.SimpleSessionContext
selectActivity(EBPInstanceReference activity)
Selects the designated activity and thus assigns it to this event manager.Pair<SessionToken,SimpleSessionContext>
startActivity(EBPInstanceReference activity, ProcessConstants.ExecutionMode executionMode)
Starts the designated activity if it is appropriate for aRuntimeService
and provides its process context.-
Methods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown, shutdown, start
-
Methods inherited from interface de.aristaflow.adept2.core.eventmanager.EventManager
addEventHandler, addEventHandler, addEventSource, getEventHandler, getEventSources, getSupportedEventTypes, removeEventHandler, removeEventSource
-
-
-
-
Field Detail
-
PLUGIN_TYPE_ACTIVITY_EVENT_HANDLER
static final String PLUGIN_TYPE_ACTIVITY_EVENT_HANDLER
The plug-in type ID for activity event handler.- See Also:
- Constant Field Values
-
ACT_CONF_EVENT_TYPE
static final String ACT_CONF_EVENT_TYPE
The configuration key for an activity configuration providing the ID of an event type for which to create an event source for the activity.- See Also:
- Constant Field Values
-
ACT_CONF_SOURCE_TYPE
static final String ACT_CONF_SOURCE_TYPE
The configuration key for an activity configuration providing the ID of a source type for which to create an event source for the activity.- See Also:
- Constant Field Values
-
ACT_CONF_SOURCE_ID
static final String ACT_CONF_SOURCE_ID
The configuration key for an activity configuration providing the ID of a source in case one source should be used for several activities.- See Also:
- Constant Field Values
-
ACT_CONF_RETRY_COUNT
static final String ACT_CONF_RETRY_COUNT
The configuration key for an activity configuration for the number of retries when adding an event source for the corresponding activity.- See Also:
- Constant Field Values
-
ACT_CONF_RETRY_DELAY
static final String ACT_CONF_RETRY_DELAY
The configuration key for an activity configuration for the delay (in milliseconds) between retries for adding an event source for the corresponding activity.- See Also:
- Constant Field Values
-
-
Method Detail
-
selectActivity
SimpleSessionContext selectActivity(EBPInstanceReference activity) throws InvalidActivityStateException, InvalidInstanceStateException, WrongAgentException
Selects the designated activity and thus assigns it to this event manager. This prevents other users from starting the activity. The simple session context of the activity will be returned which is similar to retrieving it without selection forProcessConstants.ExecutionMode.PRODUCTION
.
This method is used to indicate that an event source has been created or is about to be created for the activity and is waiting for the event to occur.- Parameters:
activity
- The activity to select for which an event source exists or is about to be created.- Returns:
- The session context of the activity providing more information on the activity waiting for an event.
- Throws:
InvalidActivityStateException
- If the activity (process step) is not activated, anInvalidActivityStateException
will be raised.InvalidInstanceStateException
- If the instance is not running but stopped, aborted, finished or changed, anInvalidInstanceStateException
will be thrown.WrongAgentException
- If the activity can be started or selected but not by the event manager agent aWrongAgentException
will be thrown.- See Also:
ActivityStarting.selectActivity(SessionToken, EBPInstanceReference)
-
deselectActivity
void deselectActivity(EBPInstanceReference activity) throws InvalidActivityStateException, InvalidInstanceStateException, WrongAgentException
Deselects the designated activity and thus makes it available for reassigning. This allows other users to start the activity. This method indicates that no event source is waiting for the event of the activity any more.- Parameters:
activity
- The activity to deselect.- Throws:
InvalidActivityStateException
- If the activity (process step) is not selected by the designated user, anInvalidActivityStateException
will be raised.InvalidInstanceStateException
- If the instance is not running but stopped, aborted, finished or changed, anInvalidInstanceStateException
will be thrown.WrongAgentException
- If the calling agent is not the same agent who selected the activity.- See Also:
ActivityStarting.deselectActivity(SessionToken, EBPInstanceReference)
-
getSimpleSessionContext
SimpleSessionContext getSimpleSessionContext(EBPInstanceReference activity, ProcessConstants.ExecutionMode executionMode) throws InvalidActivityStateException, InvalidInstanceStateException, WrongAgentException
Gets an incomplete simple session context for the designated activity. This just returns the simple session context without any state changes of the activity. This method can only be called for activities that the event manager may also start or resume, for instance by having calledselectActivity(EBPInstanceReference)
.The
SimpleSessionContext.getSessionID()
of the returned context will benull
and the flagSimpleSessionContext.isResumed()
will be unset since they cannot be determined.- Parameters:
activity
- The activity for which to retrieve the simple session context.executionMode
- The execution mode which to apply, which may have consequences on the configuration.- Returns:
- The simple session context for the designated activity as far as its attributes can be determined. This is only returned if the activity is assigned (selected, running or suspended) to this event manager.
- Throws:
InvalidActivityStateException
- If the activity (process step) is not selected, running or suspended this event manager, anInvalidActivityStateException
will be raised.InvalidInstanceStateException
- If the instance is not running but stopped, aborted, finished or changed, anInvalidInstanceStateException
is thrown.WrongAgentException
- If the activity can be started or resumed but not by the event manager agent aWrongAgentException
will be thrown.- See Also:
ActivityStarting.getExecutionContext(SessionToken, EBPInstanceReference)
-
startActivity
Pair<SessionToken,SimpleSessionContext> startActivity(EBPInstanceReference activity, ProcessConstants.ExecutionMode executionMode) throws InvalidActivityStateException, InvalidInstanceStateException, WrongAgentException
Starts the designated activity if it is appropriate for aRuntimeService
and provides its process context. This activity event manager registers asExecutionMessageListener
and forwards the messages to the appropriate event handler. Since starting the activity is internally asynchronous, a timeout is required. If this timeout elapses the start will be aborted andnull
will be returned.- Parameters:
activity
- The unique ID of the activity to start.executionMode
- The execution mode in which to start the activity, for instance, a test mode.- Returns:
- The session token which with the activity is started and the
SimpleSessionContext
providing the process context (e.g. the input parameter values) of the started activity. - Throws:
InvalidActivityStateException
- If the activity (process step) is not activated or selected by the designated user, anInvalidActivityStateException
will be raised.InvalidInstanceStateException
- If the instance is not running but stopped, aborted, finished or changed, anInvalidInstanceStateException
is thrown.WrongAgentException
- If the calling agent is not the same agent who selected the activity.IllegalArgumentException
- If the designated activity does not fulfil the constraints for running in the runtime service, anIllegalArgumentException
will be thrown.- See Also:
RemoteActivityStarting.startActivity(SessionToken, EBPInstanceReference, ExecutionMode, java.net.URI[])
-
getRuntimeEnvironment
RemoteRuntimeEnvironment getRuntimeEnvironment()
Gets the interface for remotely usingRuntimeEnvironment
. Since we do not have anExecutableComponent
, the interaction with theRuntimeEnvironment
needs to be done via a service.- Returns:
- The interface for remotely using
RuntimeEnvironment
clients executing activities proprietarily not usingExecutableComponent
. - See Also:
RuntimeService.getRuntimeEnvironment()
-
getProgressMonitor
RemoteProgressMonitor getProgressMonitor()
Gets the interface for remotely usingProgressMonitor
. Since we do not have anExecutableComponent
, the interaction with theProgressMonitor
needs to be done via a service.- Returns:
- The interface for remotely using
ProgressMonitor
clients executing activities proprietarily not usingExecutableComponent
. - See Also:
RuntimeService.getProgressMonitor()
-
-