Shark knows only about tool agent interface. It doesn't know anything about any particular tool agent implementation. When automatic* activity of "Tool" type is performed, shark searches for the appropriate tool agent:
if mapping information for the application definition which is referenced from this activity's tool exists (Admin has previously mapped the application definitions to tool agents), shark finds this mapping, and gets the information which tool agent to call, and what are the mapping parameters to be passed to tool agent. Shark then tries to connect tool agent, and gets a handle to it. Then it calls invokeApplication() method of tool agent, and passes the relevant parameters (some of them contained in the mapping information, more precisely the application name and application mode parameter). After that, it calls its method requestAppStatus(), to check the tool agent's status and to retrieve the results, and set appropriate activity variables.
If mapping information does not exist, shark calls "Default tool agent", whose class name is specified in shark's configuration (i.e in file Shark.conf if shark is configured through the file), and does the same as previously mentioned.
When calling tool agent's invokeApplication() method, for the first AppParameter in the AppParameter array, shark is always passing a string representing ExtendedAttributes section of 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="c=a-b;"/> </ExtendedAttributes>
As previously mentioned, if shark can't found mapping information, it executes Default tool agent. The default tool agent is responsible to execute proper tool agent if it finds in ExtendedAttributes information which tool agent to execute. Default tool agent gets this information from XPDL application extended attribute whose name has to be ToolAgentClass and value has to be the full class name of wanted tool agent. Other extended attributes are supposed to be read by tool agent specified to be executed, and are "Tool agent specific".
* NOTE: Shark automatically starts "Tool" activities under following conditions:
If "Tool" activity's Start mode is AUTOMATIC (if Start mode is not defined, the automatic mode is assumed)
If "Tool" activity has a performer different then "SYSTEM" type participant, and its Start mode is MANUAL
In the second case, the activity will first be assigned to participant, and after he completes activity, the tools specified will be executed automatically by the shark, through tool agent calls.