org.enhydra.shark.toolagent
Class ToolAgentLoader

java.lang.Object
  extended by org.enhydra.shark.toolagent.ToolAgentLoader

public class ToolAgentLoader
extends java.lang.Object

Use the static load method to load classes that implement tool agents from jars encountered in CLASSPATH like properties or located in a plugin directory. There a three properties that may be set in Shark's configuration file (conf/Shark.conf).

  1. ToolAgentClassPath: This property specifies a colon separated list of bytecode containers, i.e. jar files or directories containing class files. Tool agent implementations found in one of these bytecode containers are loaded by a single static class loader, i.e. they can not be reloaded during the lifetime of the engine.
  2. ToolAgentPluginPath: This property specifies a colon separated list of bytecode containers, i.e. jar files or directories containing class files. Tool agent implementations found in one of these bytecode containers are loaded by individual class loaders, i.e. they are reloaded on each tool agent invocation.
  3. ToolAgentPluginDir: This property specifies a directory that may contain jar files which are loaded as if they were encountered in the ToolAgentPluginPath.
Tool agent implementations are first looked up by the default class loader, then if not found by the static class loader according to the ToolAgentClassPath and finally by an individual class loader according to the ToolAgentPluginPath.

That means that if you want your tool agent implementation to be reloadable it must neither be encountered in the ToolAgentClassPath nor in the default CLASSPATH.

If any of the properties mentioned above do not exist or are empty they will not be used for the search.

Note that classes that depend on your tool agent implementation are normally loaded by the same class loader that looked up the tool agent's byte code. That means that you can make even these classes being reloaded on each tool agent invocation if the are encountered in the ToolAgentPluginPath.

This feature is nice in the phase of development as you need not restart the whole workflow engine after you modified your tool agent classes or those classes it depends on.

If you think your classes do not change anymore move them from the ToolAgentPluginPath to the ToolAgentClassPath to avoid unnecessary class loading operations.

Author:
Dirk Hoffmann, H+BEDV (www.antivir.de)

Constructor Summary
ToolAgentLoader()
           
 
Method Summary
static java.lang.Class load(CallbackUtilities cus, java.lang.String name)
          Load a tool agent class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolAgentLoader

public ToolAgentLoader()
Method Detail

load

public static java.lang.Class load(CallbackUtilities cus,
                                   java.lang.String name)
                            throws java.lang.ClassNotFoundException,
                                   java.io.IOException
Load a tool agent class.

Parameters:
cus - callback utilities used to query shark's properties
name - name of the class
Returns:
the tool agent class
Throws:
java.lang.ClassNotFoundException - if tool agent class could not be found.
java.io.IOException - if plugin dir could not be listed