de.danet.an.workflow.tools.util
Class SimpleApplicationAgent

java.lang.Object
  extended byde.danet.an.workflow.tools.util.SimpleApplicationAgent
All Implemented Interfaces:
ToolAgent

public abstract class SimpleApplicationAgent
extends java.lang.Object
implements ToolAgent

This is a base class for writing agents for applications that have a life cycle exceeding a single tool agent invocation, and have only state information that can efficiently be persisted as a binary large object in an RDBMs.

An example for such an application is the wait tool (see User Manual). A wait tool (or "wait application") is created by one tool agent invocation. Then another tool agent invocation waits for the completion of the wait, while yet another tool agent invocation may cause the wait tool to complete prematurely. The wait tool has state that is controlled by the tool agents and a timer provided by the enviroment. Its state is therefore completely serializable (no open sockets, tool controlled threads etc.).

This base class mainly provides access to the application directory that does all the important work.

Version:
$Revision: 1.2 $
Author:
Michael Lipp

Constructor Summary
SimpleApplicationAgent()
          Creates an instance of SimpleApplicationAgent with all attributes initialized to default values.
 
Method Summary
protected  SimpleApplicationDirectoryLocal applicationDirectory()
          Return the application directory.
 void terminate(Activity activity)
          Terminates execution of the given activity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.danet.an.workflow.spis.aii.ToolAgent
invoke
 

Constructor Detail

SimpleApplicationAgent

public SimpleApplicationAgent()
Creates an instance of SimpleApplicationAgent with all attributes initialized to default values.

Method Detail

applicationDirectory

protected SimpleApplicationDirectoryLocal applicationDirectory()
                                                        throws de.danet.an.util.ResourceNotAvailableException
Return the application directory.

Returns:
the application directory
Throws:
de.danet.an.util.ResourceNotAvailableException - if an application directory EJB cannot be instantiated

terminate

public void terminate(Activity activity)
               throws ApplicationNotStoppedException,
                      java.rmi.RemoteException
Terminates execution of the given activity. This base implementation simply removes the application instance fom the application directory.

Specified by:
terminate in interface ToolAgent
Parameters:
activity - the activity to be canceled
Throws:
ApplicationNotStoppedException - if execution cannot be terminated (see ApplicationNotStoppedException). workflow engine should retry the tool invocation
java.rmi.RemoteException - if a temporary problem occurs and the workflow engine should retry the tool invocation