@ConfigurationDescription(properties=) public abstract class AbstractGUIManager extends AbstractADEPT2Service implements RemoteGUIManager
RemoteGUIManager which
is the interaction between remotely executed component to GUI context (via
ActivityStateNotification and vice versa
(via terminateRemoteExecution(SessionToken, EBPInstanceReference, String)).
As soon as a termination notification is received for an activity, the
corresponding local GUI context will be closed. If closing is initiated by
the local GUI context, subclasses of this GUI manager or implementations
of the local GUI context should use
terminateRemoteExecution(SessionToken, EBPInstanceReference, String)
which terminates the remote execution under all circumstances using several
escalation steps in case the remotely executed component does not respond.
For simpler migration from GUIManager to
RemoteGUIManager this class provides a convenience
implementation for getLocalForRemoteGuiContext(SessionToken, TransferableGUIContext).
However, this is rather limited. It just forwards the data from the
transferred GUI context to
(GUIManager.getGUIContext(SessionToken, ActivityInstance, EBPInstanceReference, String, ExecutionContext, ExecutionControlManager, Thread)).
The thread will always be null and the
GUI context ID in the activity instance will be exchanged by the ID of the
transferred GUI context.
This ID then no longer specifies the ID of the requested GUI context but that
of the provided transferred GUI context! Usually, the additional information
provided by the (subclass of the) transferable GUI context is required and
thus simple forwarding is not sufficient at all.
Besides this class also provides a convenience method for
GUIManager2 that is creating a GUI context with the information
about whether the activity is resumed. The implementation just ignores this
information and forwards the call to the creating without this information.
TerminationExecutorAbstractADEPT2Service.ActiveSessions| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONF_TERMINATION_TIMEOUT
The key for the configuration value that specifies the total time in
milliseconds to wait for the component to terminate.
|
protected java.util.Set<Pair<EBPInstanceReference,java.lang.String>> |
earlyTerminates
The activities (identified by the EBP instance reference and the execution
session ID) of which the termination has already been notified but the
corresponding GUI context has not yet been created.
|
protected java.util.Map<Pair<EBPInstanceReference,java.lang.String>,Pair<GUIContext,de.aristaflow.adept2.model.runtimeenvironment.guicontext.TransferableGUIContext>> |
guiContexts
The local and the corresponding transferred GUI contexts that have been
created and not been closed yet, indexed by the pair that identifies the
corresponding activity and its execution session.
|
protected java.util.Map<EBPInstanceReference,Triple<ActivityStateListener,java.net.URI[],SessionToken>> |
listeners
The activity state listeners this GUI manager is registered at for the corresponding
activities.
|
protected long |
TERMINATION_TIMEOUT
The total time in milliseconds to wait for the termination of a component.
|
CONF_CSV_LOGGING, configuration, logger, registry, runtimeRequiredServices, startupRequiredServices| Constructor and Description |
|---|
AbstractGUIManager(Configuration configuration,
Registry registry)
Creates a new GUI manager providing the basic means for a
RemoteGUIManager. |
AbstractGUIManager(Configuration configuration,
Registry registry,
java.lang.String[] startupRequiredServices,
java.lang.String[] runtimeRequiredServices)
Creates a new GUI manager providing the basic means for a
RemoteGUIManager. |
| Modifier and Type | Method and Description |
|---|---|
void |
activityClosed(EBPInstanceReference activity,
java.lang.String sessionID)
Notifies that the designated activity in the designated execution session
has been closed.
|
void |
activityFailed(EBPInstanceReference activity,
java.lang.String sessionID,
java.lang.String errorMessage,
java.lang.String state,
long errorCode)
Notifies that the designated activity in the designated execution session
has failed with the designated additional failure information.
|
void |
activityReset(EBPInstanceReference activity,
java.lang.String sessionID)
Notifies that the designated activity in the designated execution session
has been reset.
|
void |
activityResumed(EBPInstanceReference activity,
java.lang.String sessionID,
java.net.URI[] newListener)
Notifies that the designated activity has been resumed.
|
void |
activitySignalled(EBPInstanceReference activity,
java.lang.String sessionID,
int signal)
Notifies that the designated activity in the designated execution session
has terminated with the designated signal.
|
void |
activitySuspended(EBPInstanceReference activity,
java.lang.String sessionID)
Notifies that the designated activity in the designated execution session
has been suspended normally.
|
void |
activitySuspended(EBPInstanceReference activity,
java.lang.String sessionID,
long timeout)
Notifies that the designated activity in the designated execution session
has been suspended and needs to be resumed after the designated timeout.
|
protected void |
closeGUIContext(EBPInstanceReference activity,
java.lang.String sessionID)
Closes the local GUI context of the designated activity.
|
GUIContext |
createGUIContext(SessionToken session,
de.aristaflow.adept2.model.runtimeenvironment.guicontext.TransferableGUIContext trCtxt,
ExecutionControlManager ecm)
Creates a GUI context for the designated
TransferrableGUIContext and the designated
ExecutionControlManager. |
java.net.URI[] |
getActivityStateListenerURIs(SessionToken session,
EBPInstanceReference activity)
Registers this GUI manager as state listener for the designated activity
and returns the URIs of the (local) notification service that needs to be
registered at the
SynchronousActivityStarting. |
protected ExecutionControlManager |
getExecutionControlManager(SessionToken session,
EBPInstanceReference activity)
Gets the execution control manager for the designated activity, that is,
the execution control manager of the runtime manager of the designated
activity.
|
GUIContext |
getLocalForRemoteGuiContext(SessionToken session,
de.aristaflow.adept2.model.runtimeenvironment.guicontext.TransferableGUIContext transfrdCtxt)
Gets an appropriate GUI context for the designated
TransferableGUIContext. |
ProcessConstants.NodeState |
terminateRemoteExecution(SessionToken session,
EBPInstanceReference activity,
java.lang.String sessionID)
Terminates the (remote) execution of the designated activity, that is, the
execution control manager of the designated activity is instructed
appropriately.
|
_sessionActive, _sessionFinished, activeOrInvalidServiceStateException, changeLogContext, changeLogContext, changeLogContext, consoleLog, csvLoggingEnabled, getClassSpecificJulLogger, getDependencyRegistry, getLocalUris, getLogger, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, getUserCredentials, init, isActive, isSessionActive, isShutdown, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, ping, preShutdown, privilegeSession, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionActive, sessionFinished, sessionFinished, shutdown, signalShutdown, signalStart, start, unprivilegeThreadclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetGUIContextgetLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown, shutdown, startpublic static final java.lang.String CONF_TERMINATION_TIMEOUT
protected final long TERMINATION_TIMEOUT
protected final java.util.Map<Pair<EBPInstanceReference,java.lang.String>,Pair<GUIContext,de.aristaflow.adept2.model.runtimeenvironment.guicontext.TransferableGUIContext>> guiContexts
protected final java.util.Set<Pair<EBPInstanceReference,java.lang.String>> earlyTerminates
guiContexts.protected final java.util.Map<EBPInstanceReference,Triple<ActivityStateListener,java.net.URI[],SessionToken>> listeners
guiContexts.public AbstractGUIManager(Configuration configuration, Registry registry)
RemoteGUIManager. This includes accepting and forwarding the
activity state notifications and allowing subclasses to terminate the
remote execution.configuration - The configuration of this service.registry - The registry to be used for accessing the execution control
managers of remotely executed activities.public AbstractGUIManager(Configuration configuration, Registry registry, java.lang.String[] startupRequiredServices, java.lang.String[] runtimeRequiredServices)
RemoteGUIManager. This includes accepting and forwarding the
activity state notifications and allowing subclasses to terminate the
remote execution. Subclasses can provide their required services.configuration - The configuration of this service.registry - The registry to be used for accessing the execution control
managers of remotely executed activities.startupRequiredServices - The service type names of services required
by subclasses at startup time (in AbstractADEPT2Service.init(URI[], URI[]) and
AbstractADEPT2Service.start()).runtimeRequiredServices - The service type names of services required
by subclasses at runtime (after startup time).public GUIContext getLocalForRemoteGuiContext(SessionToken session, de.aristaflow.adept2.model.runtimeenvironment.guicontext.TransferableGUIContext transfrdCtxt) throws GUIContextUnavailableException
RemoteGUIManagerTransferableGUIContext. The created context represents the
designated context locally and can be any arbitrary appropriate GUI
context. This can be the same GUI context provided by GUIManager
but usually the remote execution requires some special logic in the local
GUI context. getLocalForRemoteGuiContext in interface RemoteGUIManagersession - The session which is used to check for access rights on this
method.transfrdCtxt - The GUI context retrieved from the component that is
executed remotely. This needs to be wrapped appropriately in a
local GUI context.RemoteGUIContext.
This can usually be ignored since the RemoteGUIManager
integrates the GUIContext in the local GUI and handles
closing it.GUIContextUnavailableException - If no GUI context can be created for
the designated TransferableGUIContext, a
GUIContextUnavailableException will be thrown.public GUIContext createGUIContext(SessionToken session, de.aristaflow.adept2.model.runtimeenvironment.guicontext.TransferableGUIContext trCtxt, ExecutionControlManager ecm) throws GUIContextUnavailableException
TransferrableGUIContext and the designated
ExecutionControlManager. This is similar to
getLocalForRemoteGuiContext(SessionToken, TransferableGUIContext) but provides
the corresponding execution control manager and may be overridden in
subclasses. getLocalForRemoteGuiContext(SessionToken, TransferableGUIContext)
may not be overridden since it provides the means for the
ActivityStateNotification.session - The session which is used to check for access rights on this
method.trCtxt - The GUI context retrieved from the component that is executed
remotely. A local GUI context for this has to be created.RemoteGUIContext.
This can usually be ignored since this
RemoteGUIManager already handles closing and
displaying of the created local GUIContext.GUIContextUnavailableException - If no GUI context can be created for
the designated TransferableGUIContext, a
GUIContextUnavailableException will be thrown.public java.net.URI[] getActivityStateListenerURIs(SessionToken session, EBPInstanceReference activity) throws ServiceNotKnownException
RemoteGUIManagerSynchronousActivityStarting.getActivityStateListenerURIs in interface RemoteGUIManagersession - The session which is used to check for access rights on this
method.activity - The activity for which to receive activity state
notifications.SynchronousActivityStarting.ServiceNotKnownException - If the notification service cannot be
retrieved, a ServiceNotKnownException will be
thrown.public void activityClosed(EBPInstanceReference activity, java.lang.String sessionID)
ActivityStateNotificationactivityClosed in interface ActivityStateNotificationactivity - The activity that has been closed.sessionID - The ID of the execution session of the closed activity.public void activitySuspended(EBPInstanceReference activity, java.lang.String sessionID)
ActivityStateNotificationactivitySuspended in interface ActivityStateNotificationactivity - The activity that has been suspended normally.sessionID - The ID of the execution session of the suspended activity.public void activitySuspended(EBPInstanceReference activity, java.lang.String sessionID, long timeout)
ActivityStateNotificationResumingRuntimeManager and
thus there will be a
resume
and further notifications afterwards.activitySuspended in interface ActivityStateNotificationactivity - The activity that has been suspended normally.sessionID - The ID of the execution session of the suspended activity.timeout - The time period (in milliseconds) when the suspended
application wants to be resumed automatically.public void activityResumed(EBPInstanceReference activity, java.lang.String sessionID, java.net.URI[] newListener)
ActivityStateNotificationactivityResumed in interface ActivityStateNotificationactivity - The activity that has been suspended normally.sessionID - The ID of the new execution session of the resumed
activity.newListener - The URIs of the listener that has been registered when
resuming or null in case no listener has been
registered when resuming. If a new listener has been registered,
this listener will not be notified any more.SynchronousActivityStarting.resumeActivitySynchronously(de.aristaflow.adept2.base.sessionmanagement.SessionToken,
EBPInstanceReference)public void activityReset(EBPInstanceReference activity, java.lang.String sessionID)
ActivityStateNotificationactivityReset in interface ActivityStateNotificationactivity - The activity that has been reset.sessionID - The ID of the execution session of the reset activity.public void activitySignalled(EBPInstanceReference activity, java.lang.String sessionID, int signal)
ActivityStateNotificationactivitySignalled in interface ActivityStateNotificationactivity - The activity that has been terminated.sessionID - The ID of the execution session of the signalled activity.signal - The signal that led to the termination of the activity.public void activityFailed(EBPInstanceReference activity, java.lang.String sessionID, java.lang.String errorMessage, java.lang.String state, long errorCode)
ActivityStateNotificationactivityFailed in interface ActivityStateNotificationactivity - The activity that has failed.sessionID - The ID of the execution session of the failed activity.errorMessage - The error message to be interpreted by a user or by a
failure handling routine.state - Arbitrary state information specific to the instance,
comparable to the vendor code in
SQLException.errorCode - The error code specifying the type of error.protected void closeGUIContext(EBPInstanceReference activity, java.lang.String sessionID)
ActivityStateNotification. The GUI context will be removed
so that it will not be reached by any further notifications for the same
activity.activity - The activity of which to close the local GUI context.sessionID - The ID of the execution session of the activity of which
to close the local GUI context.public ProcessConstants.NodeState terminateRemoteExecution(SessionToken session, EBPInstanceReference activity, java.lang.String sessionID) throws ServiceNotKnownException
GUIContext.
If the designated activity (and session ID) is not known by this
RemoteGUIManager this will be logged but no further action
will be taken. Note that this does not prevent the activity state
notification! This should occur as consequence of this termination request
and then close the local GUI context. If
the GUI context has already been closed before or right after calling this
method, it will probably be called twice.
session - The session which is used to check for access rights on this
method.activity - The activity which to terminate.sessionID - The ID of the execution session of the activity to
terminate.RemoteGUIManager or the corresponding runtime manager,
null will be returned.ServiceNotKnownException - If the execution control manager/runtime
manager of the designated activity cannot be retrieved, a
ServiceNotKnownException will be thrown.protected ExecutionControlManager getExecutionControlManager(SessionToken session, EBPInstanceReference activity) throws ServiceNotKnownException
session - The session which is used to check for access rights on this
method.activity - The activity for which to retrieve the execution control
manager.ServiceNotKnownException - If the execution control manager/runtime
manager of the designated activity cannot be retrieved, a
ServiceNotKnownException will be thrown.