org.obe.client.api.tool
Interface ToolAgent


public interface ToolAgent

Enables the workflow engine or a client to invoke a tool (application or procedure). Implementations can be stateful only to the extent of containing service configuration information; their methods must be threadsafe.

Author:
Adrian Price

Field Summary
static int ACTIVE
          The tool is active.
static int ERROR
          The agent or tool encountered an error.
static int EXIT_CANCEL
          The tool was cancelled by the user.
static int EXIT_NORMAL
          The tool finished normally.
static int FINISHED
          The tool has finished running.
static int RUNNING
          The tool agent is running.
static int TERMINATED
          The tool was terminated.
static int WAITING
          The tool has not yet been invoked.
 
Method Summary
 int invokeApplication(ToolInvocation ti)
          Invokes the tool.
 void renderInvocationScript(ToolInvocation ti, java.io.Writer writer)
          Renders the JavaScript necessary to invoke the tool from an HTML browser.
 int requestAppStatus()
          Returns the tool status.
 void terminateApp()
          Terminates the running tool.
 

Field Detail

WAITING

public static final int WAITING
The tool has not yet been invoked.

See Also:
Constant Field Values

RUNNING

public static final int RUNNING
The tool agent is running.

See Also:
Constant Field Values

ACTIVE

public static final int ACTIVE
The tool is active.

See Also:
Constant Field Values

ERROR

public static final int ERROR
The agent or tool encountered an error.

See Also:
Constant Field Values

TERMINATED

public static final int TERMINATED
The tool was terminated.

See Also:
Constant Field Values

FINISHED

public static final int FINISHED
The tool has finished running.

See Also:
Constant Field Values

EXIT_NORMAL

public static final int EXIT_NORMAL
The tool finished normally.

See Also:
Constant Field Values

EXIT_CANCEL

public static final int EXIT_CANCEL
The tool was cancelled by the user.

See Also:
Constant Field Values
Method Detail

renderInvocationScript

public void renderInvocationScript(ToolInvocation ti,
                                   java.io.Writer writer)
                            throws java.io.IOException
Renders the JavaScript necessary to invoke the tool from an HTML browser.

Parameters:
ti -
writer -
Throws:
java.io.IOException

invokeApplication

public int invokeApplication(ToolInvocation ti)
                      throws java.lang.reflect.InvocationTargetException
Invokes the tool. The implementation must update the values of any INOUT and OUT parameters appropriately, and should set the values of any IN parameters to null.

Parameters:
ti - The tool invocation context.
Returns:
The tool's exit code. One of EXIT_NORMAL, EXIT_CANCEL.
Throws:
java.lang.IllegalStateException - if the ToolAgent is not in the WAITING state.
java.lang.reflect.InvocationTargetException - As thrown prior to or during during tool execution.

requestAppStatus

public int requestAppStatus()
Returns the tool status.

Returns:
One of: WAITING, RUNNING, ACTIVE, TERMINATED, FINISHED.

terminateApp

public void terminateApp()
Terminates the running tool.

Throws:
java.lang.IllegalStateException - if the tool is not running.


SourceForge.net Logo OBE-1.0 Copyright (c) 2002-2006 Adrian Price. All Rights Reserved.