How does Shark Use Tool Agents

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:

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:

  1. If "Tool" activity's Start mode is AUTOMATIC (if Start mode is not defined, the automatic mode is assumed)

  2. 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.