| org.enhydra.shark.api.internal.toolagent.ToolAgent
All known Subclasses: org.enhydra.shark.toolagent.AbstractToolAgent,
ToolAgent | public interface ToolAgent (Code) | | This interface is based on WfMC's definition of ToolAgents. It is pretty
close to the WfMC's specification, but expressed in Object oriented way.
The following is different then WfMC spec proposes:
- Every method is throwing additional
ToolAgentGeneralException
-
AppParameter class is different then WfMC's WMTPAttribute type -
it defines some additional fields.
- It has additional configure() method, that is used to pass
CallbackUtilities to tool agent, which provides ToolAgent to get
some configuration information from Shark, and provides a way to log tool
agent events.
- It has additional getInfo() method, that is used to get some information
about tool agent.
Also, when calling invokeApplication() method, as the first
AppParameter parameter in array, Shark is always passing a string representing
ExtendedAttributes section of the corresponding XPDL application, chopped
out from the XPDL definition, i.e.:
<ExtendedAttributes>
<ExtendedAttribute Name="ToolAgentClass" Value="org.enhydra.shark.toolagent.JavaScriptToolAgent"/>
<ExtendedAttribute Name="Script" Value="java.lang.Thread.sleep(wait_ms);"/>
</ExtendedAttributes>
Shark uses tool agents like the following:
- It aquires ToolAgent instance from
ToolAgentManager . When it
creates ToolAgent instance,
ToolAgentManager implementation has to
call ToolAgent's configure() method.
- It calls connect() method, and gets handle to ToolAgent
- It calls invokeApplication() method (the
AppParameter array
passed to this method should be considered to be passed as a value, not as
a reference, because Shark doesn't care about it after calling this method).
- It calls requestAppStatus() method. Tool agent implementation
has to fill the
AppParameter array that Shark passes to this method,
with the values of appropriate parameters (These parameters are the one
passed in invokeApplication() method call, that could be changed
during tool agent execution). It also expects the information on application
status to be returned, and in our standard implementation, if the status is
equal to -1, shark throws exception (Of course, ToolAgent can also signal an
exception to shark by throwing any of defined exceptions for a method).
- finally, shark calls disconnect().
author: Sasa Bojanic author: Vladimir Puskas |
Method Summary | |
void | configure(CallbackUtilities cus) Used to configure tool agent if needed. | WMSessionHandle | connect(WMConnectInfo wmci) This is the first method that shark calls when accessing some tool agent. | void | disconnect(WMSessionHandle shandle) Method disconnect. | String | getInfo(WMSessionHandle shandle) Method getInfo. | void | invokeApplication(WMSessionHandle shandle, long handle, WMEntity appInfo, WMEntity toolInfo, String applicationName, String processInstanceId, String workitemId, AppParameter[] parameters, Integer applicationMode) Executes tool agent application.
Parameters: handle - a long representing unique session Id. Parameters: applicationName - the name of application which will beexecuted by this tool agent Parameters: processInstanceId - Id of process instance for which toolagent application is called. Parameters: workitemId - Id of assignment that is associated withinvoked application. Parameters: parameters - array of parameters (engine variables)passed to tool agent application. | long | requestAppStatus(WMSessionHandle shandle, long handle, WMEntity toolInfo, String processInstanceId, String workitemId, AppParameter[] parameters) Returns the status of tool agent application execution, and fills
the parameters with the results of tool agent application execution.
Parameters: handle - a long representing unique session Id. Parameters: processInstanceId - Id of process instance for which toolagent application is called. Parameters: workitemId - Id of assignment that is associated withinvoked application. Parameters: parameters - array of parameters (engine variables)passed to application. | void | terminateApp(WMSessionHandle shandle, long handle, WMEntity toolInfo, String processInstanceId, String workitemId) Terminates tool agent application. |
APP_STATUS_ACTIVE | final public static long APP_STATUS_ACTIVE(Code) | | |
APP_STATUS_FINISHED | final public static long APP_STATUS_FINISHED(Code) | | |
APP_STATUS_INVALID | final public static long APP_STATUS_INVALID(Code) | | |
APP_STATUS_RUNNING | final public static long APP_STATUS_RUNNING(Code) | | |
APP_STATUS_TERMINATED | final public static long APP_STATUS_TERMINATED(Code) | | |
APP_STATUS_WAITING | final public static long APP_STATUS_WAITING(Code) | | |
invokeApplication | void invokeApplication(WMSessionHandle shandle, long handle, WMEntity appInfo, WMEntity toolInfo, String applicationName, String processInstanceId, String workitemId, AppParameter[] parameters, Integer applicationMode) throws ApplicationNotStarted, ApplicationNotDefined, ApplicationBusy, ToolAgentGeneralException(Code) | | Executes tool agent application.
Parameters: handle - a long representing unique session Id. Parameters: applicationName - the name of application which will beexecuted by this tool agent Parameters: processInstanceId - Id of process instance for which toolagent application is called. Parameters: workitemId - Id of assignment that is associated withinvoked application. Parameters: parameters - array of parameters (engine variables)passed to tool agent application. Some of these parameters will be changedduring application execution. These parameters should be considered theinput ones - the engine will not read there value after this method isfinished, but it will give to the ToolAgent.requestAppStatus methodthe array of parameters to be filled with the result of tool agentapplication execution. The value field of the first parameter in the parameter arrayis always a string representing ExtendedAttributes section of thecorresponding XPDL application, chopped out from the XPDL definition, i.e.: <ExtendedAttributes><ExtendedAttribute Name="ToolAgentClass" Value="org.enhydra.shark.toolagent.JavaScriptToolAgent"/><ExtendedAttribute Name="Script" Value="java.lang.Thread.sleep(wait_ms);"/></ExtendedAttributes> Parameters: applicationMode - an Integer representing application mode. throws: ApplicationNotStarted - If application can't be started. throws: ApplicationNotDefined - If there is no such application. throws: ApplicationBusy - If application is bussy. throws: ToolAgentGeneralException - If something unexpected happens. |
requestAppStatus | long requestAppStatus(WMSessionHandle shandle, long handle, WMEntity toolInfo, String processInstanceId, String workitemId, AppParameter[] parameters) throws ApplicationBusy, InvalidToolAgentHandle, InvalidWorkitem, InvalidProcessInstance, ToolAgentGeneralException(Code) | | Returns the status of tool agent application execution, and fills
the parameters with the results of tool agent application execution.
Parameters: handle - a long representing unique session Id. Parameters: processInstanceId - Id of process instance for which toolagent application is called. Parameters: workitemId - Id of assignment that is associated withinvoked application. Parameters: parameters - array of parameters (engine variables)passed to application. This is a subset of parameters passed to theinvokeApplication() method, and these parameters need to be filled withthe result of tool agent's application execution. The status of tool agent application. throws: ApplicationBusy - If application is bussy. throws: InvalidToolAgentHandle - If handle is invalid. throws: InvalidWorkitem - If there is no such workitem as the onerepresented by given Id parameters. throws: InvalidProcessInstance - If there is no process instance withgiven Id. throws: ToolAgentGeneralException - If something unexpected happens. |
|
|