public interface RemoteRuntimeEnvironment
RuntimeEnvironments for
clients executing activities proprietarily not using
ExecutableComponent. Usually this interface is called remotely.
Therefore not all methods of the RuntimeEnvironment are provided
here. Additionally, dispatching needs to be done by the client, therefore
messages are provided and need to be replied to. This can be done either by
polling (getUnrepliedRequests(SessionToken, String),
replyMessage(SessionToken, ReplyMessage)) or asynchronously via
ExecutionMessageListener. Due to the loose coupling between execution
and runtime manager, there are no checks for the valid executor thread.
Since this handles several executions concurrently, each method requires the
sessionID of the execution. If the designated session ID does not exist, an
UnknownSessionException will be thrown for each method. This
usually indicates that the execution has been terminated from server side but
the executing client has not responded in time. Clients should check the
state of the corresponding process step.
If the session token does not match the designated session ID, that is the
session token has not the same credentials as the starting token, a
ServiceAccessControlException will be thrown. That means the
session token needs to have the same top-level session token as the
starting/resuming session token.
The methods of these interface are similar to the ones of
RuntimeEnvironment.
They need an additional session ID to identify the execution session and a
session token to verify it. Additionally methods for terminating the
execution have to provide the data context (since the data cannot be stored
as side-effect like in a
DataContext). Note that
this data context only needs to provide the values of the output parameters
but not the values of the input parameters like the data context provided
when starting/resuming the activity. However, it can also be the very same
DataContext-instance.
And unlike the normal runtime environment, only one of the termination
methods must be called which immediately indicates the termination of the
execution. With ExecutableComponents, the termination is
indicated by leaving the run-method which allows to call the termination
methods arbitrarily. Obviously calling a termination method renders the
corresponding session ID invalid.
| Modifier and Type | Method and Description |
|---|---|
void |
applicationClosed(SessionToken token,
java.lang.String sessionID,
SerialisableDataContext dataContext)
Signals the termination of the designated execution session that is the
execution is closed.
|
void |
applicationFailed(SessionToken token,
java.lang.String sessionID,
ApplicationEnvironmentException excpt,
SerialisableDataContext dataContext)
Signals the failing of the designated execution session that is the
execution is terminated due to the designated application environment
exception and all data produced yet is invalidated.
|
void |
applicationFailed(SessionToken token,
java.lang.String sessionID,
ApplicationFailedException excpt,
SerialisableDataContext dataContext)
Signals the failing of the designated execution session that is the
execution is terminated due to the designated application failed exception
and all data produced yet is invalidated.
|
void |
applicationFailed(SessionToken token,
java.lang.String sessionID,
java.lang.String errorMessage,
java.lang.String state,
long errorCode,
SerialisableDataContext dataContext)
Signals the failing of the designated execution session that is the
execution is terminated due to a failure and all data produced yet is
invalidated.
|
void |
applicationReset(SessionToken token,
java.lang.String sessionID,
SerialisableDataContext dataContext)
Signals the termination of the designated execution session that is the execution is reset and
all data produced yet (including from previous execution sessions) is invalidated.
|
void |
applicationResetTo(SessionToken token,
java.lang.String sessionId,
java.lang.String savepoint,
SerialisableDataContext dataContext)
Signals the termination of the designated execution session that is the execution is reset to
the designated savepoint.
|
void |
applicationResetToPreviousSavepoint(SessionToken token,
java.lang.String sessionId,
SerialisableDataContext dataContext)
Signals the termination of the designated execution session that is the execution is reset to
the last savepoint before the execution started.
|
void |
applicationSuspended(SessionToken token,
java.lang.String sessionID,
SerialisableDataContext dataContext)
Signals the termination of the designated execution session that is the
execution is suspended.
|
byte[] |
getApplicationState(SessionToken token,
java.lang.String sessionId,
java.lang.String savepoint)
|
java.lang.String |
getLastSavepoint(SessionToken token,
java.lang.String sessionId)
|
ActivityInstance |
getLocalisedActivityInstance(SessionToken token,
java.lang.String sessionId)
Gets the activity instance localised with respect to the rich agent of the designated execution
session.
|
java.util.List<de.aristaflow.adept2.model.runtimeenvironment.messages.execution.ExecutionMessage> |
getUnrepliedRequests(SessionToken token,
java.lang.String sessionID)
Gets the request messages that have been sent to the designated execution
session.
|
boolean |
replyMessage(SessionToken token,
de.aristaflow.adept2.model.runtimeenvironment.messages.execution.ReplyMessage<?> reply)
Replies to a request message received by
getUnrepliedRequests(SessionToken, String). |
void |
setApplicationState(SessionToken token,
java.lang.String sessionId,
byte[] applicationState)
|
void |
setSavepoint(SessionToken token,
java.lang.String sessionId,
java.lang.String savepoint,
boolean flush,
SerialisableDataContext dataContext)
|
ActivityInstance getLocalisedActivityInstance(SessionToken token, java.lang.String sessionId) throws UnknownSessionException
token - The session token which is used to check for access rights on
this method. This has to be a session token having the same
credentials (top-level session token) as the session token used
for starting the corresponding activity.sessionId - The session ID of the execution to get the localised activity instance of.null if no localisation can apply.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.java.util.List<de.aristaflow.adept2.model.runtimeenvironment.messages.execution.ExecutionMessage> getUnrepliedRequests(SessionToken token, java.lang.String sessionID) throws UnknownSessionException
ExecutableComponent and
dispatched in the runtime environment. Due to the loose coupling
dispatching has to be done by the proprietarily executing client. This can
either be done by providing an ExecutionMessageListener when
starting/resuming the activity or by calling this method regularly (just
like
RuntimeEnvironment.dispatch()
). Messages should be
replied fast since
the signaller sending the message usually waits if a reply is expected
(depends on the message).token - The session token which is used to check for access rights on
this method. This has to be a session token having the same
credentials (top-level session token) as the session token used
for starting the corresponding activity.sessionID - The session ID of the execution to get messages for.ExecutionMessageListener null will be
returned.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.boolean replyMessage(SessionToken token, de.aristaflow.adept2.model.runtimeenvironment.messages.execution.ReplyMessage<?> reply) throws UnknownSessionException
getUnrepliedRequests(SessionToken, String). This should be done
fast since the requestor may wait for this reply. ReplyMessage
-instance. CloseMessage does not mean, the execution has terminated when
the reply is sent but rather the execution will close shortly.token - The session token which is used to check for access rights on
this method. This has to be a session token having the same
credentials (top-level session token) as the session token used
for starting the corresponding activity.reply - The message containing the reply for the corresponding request
message.false will be returned.UnknownSessionException - If the session ID of the reply is not
known, an UnknownSessionException will be thrown.
This usually indicates that the server has terminated the
execution because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the session ID of the reply,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.byte[] getApplicationState(SessionToken token, java.lang.String sessionId, java.lang.String savepoint) throws UnknownSessionException
token - The session token which is used to check for access rights on
this method. This has to be a session token having the same
credentials (top-level session token) as the session token used
for starting the corresponding activity.sessionId - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.savepoint - Identifies the requested session state. Use
null to get the current session state that has no
savepoint yet.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.java.lang.String getLastSavepoint(SessionToken token, java.lang.String sessionId) throws UnknownSessionException
token - The session token which is used to check for access rights on
this method. This has to be a session token having the same
credentials (top-level session token) as the session token used
for starting the corresponding activity.sessionId - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.null in case no savepoint has been stored
yet.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.void setApplicationState(SessionToken token, java.lang.String sessionId, byte[] applicationState) throws UnknownSessionException
token - The session token which is used to check for access rights on
this method. This has to be a session token having the same
credentials (top-level session token) as the session token used
for starting the corresponding activity.sessionId - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.applicationState - Byte array that keeps the current internal state of
the application.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.void setSavepoint(SessionToken token, java.lang.String sessionId, java.lang.String savepoint, boolean flush, SerialisableDataContext dataContext) throws UnknownSessionException
token - The session token which is used to check for access rights on
this method. This has to be a session token having the same
credentials (top-level session token) as the session token used
for starting the corresponding activity.sessionId - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.savepoint - The identifier by which the current data state could be
retrieved. This must neither be null nor the empty
string.flush - Whether to flush all data since the last savepoint and store
it in the data manager.dataContext - The data context providing the output parameters
produced in the execution yet. These need not be complete since
they are just flushed and may be used when resuming. This may be
null to indicate that no output parameter values have
been produced yet.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.void applicationSuspended(SessionToken token, java.lang.String sessionID, SerialisableDataContext dataContext) throws UnknownSessionException
token - The session token which is used to check for access rights on
this method and to suspend the activity. This has to be a session
token having the same credentials (top-level session token) as the
session token used for starting the corresponding activity.sessionID - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.dataContext - The data context providing the output parameters
produced in the execution yet. These need not be complete since
the execution is suspended and will be resumed. This may be
null to indicate that no output parameter values have
been produced yet.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.RuntimeEnvironment.applicationSuspended()void applicationReset(SessionToken token, java.lang.String sessionID, SerialisableDataContext dataContext) throws UnknownSessionException
token - The session token which is used to check for access rights on this method and to
reset the activity. This has to be a session token having the same credentials
(top-level session token) as the session token used for starting the corresponding
activity.sessionID - The session ID of the execution. This is the same session ID provided to an
ExecutableComponent.dataContext - The data context providing the output parameters produced in the execution.
These is for information purpose only, that is the values will be stored in the data
manager but invalidated right afterwards since the execution has been reset. Therefore
this may be null.UnknownSessionException - If the designated session ID is not known, an
UnknownSessionException will be thrown. This usually indicates that the
server has terminated the execution because the client did not respond in time.RuntimeEnvironment.applicationReset()void applicationResetTo(SessionToken token, java.lang.String sessionId, java.lang.String savepoint, SerialisableDataContext dataContext) throws UnknownSessionException
token - The session token which is used to check for access rights on this method and to
reset the activity. This has to be a session token having the same credentials
(top-level session token) as the session token used for starting the corresponding
activity.sessionId - The session ID of the execution. This is the same session ID provided to an
ExecutableComponent.savepoint - The savepoint to which to reset the execution. If this is null
the last implicit savepoint will be used. If the savepoint does not exist, the
execution will be
reset
completely.dataContext - The data context providing the output parameters produced in the execution.
These is for information purpose only, that is the values will be stored in the data
manager but invalidated right afterwards since the execution has been reset. Therefore
this may be null.UnknownSessionException - If the designated session ID is not known, an
UnknownSessionException will be thrown. This usually indicates that the
server has terminated the execution because the client did not respond in time.RuntimeEnvironment.applicationResetTo(String)void applicationResetToPreviousSavepoint(SessionToken token, java.lang.String sessionId, SerialisableDataContext dataContext) throws UnknownSessionException
token - The session token which is used to check for access rights on this method and to
reset the activity. This has to be a session token having the same credentials
(top-level session token) as the session token used for starting the corresponding
activity.sessionId - The session ID of the execution. This is the same session ID provided to an
ExecutableComponent.dataContext - The data context providing the output parameters produced in the execution.
These is for information purpose only, that is the values will be stored in the data
manager but invalidated right afterwards since the execution has been reset. Therefore
this may be null.UnknownSessionException - If the designated session ID is not known, an
UnknownSessionException will be thrown. This usually indicates that the
server has terminated the execution because the client did not respond in time.RuntimeEnvironment.applicationResetToPreviousSavepoint()void applicationClosed(SessionToken token, java.lang.String sessionID, SerialisableDataContext dataContext) throws UnknownSessionException
ApplicationFailedException will
be thrown by this method so that the caller knows the problem. Since the
application will be failed, the runtime service will not know it any more
afterwards.token - The session token which is used to check for access rights on
this method and to close the activity. This has to be a session
token having the same credentials (top-level session token) as the
session token used for starting the corresponding activity.sessionID - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.dataContext - The data context providing the output parameters produced in the execution
yet. There have to be values for all mandatory output parameters and at least null
values for optional output parameters. This may only be null when closing
a view-only execution session.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.ApplicationFailedException - If not all mandatory output parameters
have been written, an ApplicationFailedException
will be thrown.RuntimeEnvironment.applicationClosed()void applicationFailed(SessionToken token, java.lang.String sessionID, java.lang.String errorMessage, java.lang.String state, long errorCode, SerialisableDataContext dataContext) throws UnknownSessionException
ApplicationFailedException which is
usually thrown by
ExecutableComponent.run().token - The session token which is used to check for access rights on
this method and to fail the activity. This has to be a session
token having the same credentials (top-level session token) as the
session token used for starting the corresponding activity.sessionID - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.errorMessage - The corresponding error message that describes the
error in detailstate - Arbitrary state information specific to the component,
comparable to the vendor code in
SQLException.errorCode - A well-defined error code.dataContext - The data context providing the output parameters
produced in the execution. These is for information purpose only,
that is the values will be stored in the data manager but they are
not used in the process since the execution failed. However,
providing these values may help in determining the cause of the
failure. Therefore this may be null.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.ApplicationFailedExceptionvoid applicationFailed(SessionToken token, java.lang.String sessionID, ApplicationFailedException excpt, SerialisableDataContext dataContext) throws UnknownSessionException
ApplicationFailedException which is usually thrown by
ExecutableComponent.run().token - The session token which is used to check for access rights on
this method and to fail the activity. This has to be a session
token having the same credentials (top-level session token) as the
session token used for starting the corresponding activity.sessionID - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.excpt - The ApplicationFailedException for failing the
the execution session.dataContext - The data context providing the output parameters
produced in the execution. These is for information purpose only,
that is the values will be stored in the data manager but they are
not used in the process since the execution failed. However,
providing these values may help in determining the cause of the
failure. Therefore this may be null.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.void applicationFailed(SessionToken token, java.lang.String sessionID, ApplicationEnvironmentException excpt, SerialisableDataContext dataContext) throws UnknownSessionException
ApplicationEnvironmentException which is usually thrown by
ExecutableComponent.run().token - The session token which is used to check for access rights on
this method and to fail the activity. This has to be a session
token having the same credentials (top-level session token) as the
session token used for starting the corresponding activity.sessionID - The session ID of the execution. This is the same session
ID provided to an ExecutableComponent.excpt - The ApplicationEnvironmentException for failing
the execution session.dataContext - The data context providing the output parameters
produced in the execution. These is for information purpose only,
that is the values will be stored in the data manager but they are
not used in the process since the execution failed. However,
providing these values may help in determining the cause of the
failure. Therefore this may be null.UnknownSessionException - If the designated session ID is not known,
an UnknownSessionException will be thrown. This
usually indicates that the server has terminated the execution
because the client did not respond in time.ServiceAccessControlException - If
the designated token does not match the designated session ID,
that is the session token has not the same credentials as the
token starting the designated execution session, a
ServiceAccessControlException will be thrown.