com.scalagent.task.util.Program Class Reference

Inherits com.scalagent.task.Task.

Inherited by com.scalagent.task.util.JavaMain.

Inheritance diagram for com.scalagent.task.util.Program:

Inheritance graph
[legend]
Collaboration diagram for com.scalagent.task.util.Program:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Program ()
 Program (short to, AgentId parent, String[] command)
 Program (short to, String name)
void setCommandLine (String commandLine)
 Program (short to, AgentId parent, String commandLine)
String toString ()
void react (AgentId from, Notification not) throws Exception
void doReact (ProcessEnd not) throws Exception

Protected Member Functions

void start () throws Exception
void endProcess (ProcessEnd not) throws Exception
void delete (AgentId agent)
void taskStop () throws Exception

Static Protected Member Functions

static String[] parseCommand (String commandLine)

Protected Attributes

String[] command

Detailed Description

Task whose goal is to execute a program in a separate process.

The command line may be given as a list of arguments, or as a single line which is parsed. The program completing with value 0 is interpreted as a successful completion of the task. Another exit value leads to a FAIL status, with an error message read from the process error stream.

The created process is registered with a local ProcessManager, which will eventually signal the process end to this agent by an external ProcessEnd notification.

See also:
ProcessManager

ProcessEnd

Definition at line 47 of file Program.java.


Constructor & Destructor Documentation

com.scalagent.task.util.Program.Program (  ) 

Default constructor

Definition at line 54 of file Program.java.

com.scalagent.task.util.Program.Program ( short  to,
AgentId  parent,
String[]  command 
)

Creates an agent to be deployed remotely.

Parameters:
to agent server id where agent is to be deployed
parent agent to report status to
command program command line

Definition at line 65 of file Program.java.

com.scalagent.task.util.Program.Program ( short  to,
String  name 
)

Creates an agent to be deployed remotely. Invoked by the Configurator.

Parameters:
to agent server id where agent is to be deployed
name name of agent

Definition at line 76 of file Program.java.

com.scalagent.task.util.Program.Program ( short  to,
AgentId  parent,
String  commandLine 
)

Creates an agent to be deployed remotely. Parses command line with a StringTokenizer which does not recognize blanks in strings. If blanks in program arguments are needed use constructor with arguments table.

Parameters:
to agent server id where agent is to be deployed
parent agent to report status to
commandLine program command line

Definition at line 99 of file Program.java.

References com.scalagent.task.util.Program.command, and com.scalagent.task.util.Program.parseCommand().

Here is the call graph for this function:


Member Function Documentation

void com.scalagent.task.util.Program.setCommandLine ( String  commandLine  ) 

A set command used in the GCT

Definition at line 84 of file Program.java.

References com.scalagent.task.util.Program.command, and com.scalagent.task.util.Program.parseCommand().

Here is the call graph for this function:

String com.scalagent.task.util.Program.toString (  ) 

Provides a string image for this object.

Returns:
a string image for this object

Reimplemented from com.scalagent.task.Task.

Definition at line 110 of file Program.java.

References com.scalagent.task.util.Program.command.

Referenced by com.scalagent.task.util.Program.react().

void com.scalagent.task.util.Program.react ( AgentId  from,
Notification  not 
) throws Exception

Reacts to Program specific notifications. Analyzes the notification type, then calls the appropriate doReact function. By default calls react from base class. Handled notification types are : ProcessEnd.

Parameters:
from agent sending notification
not notification to react to

Reimplemented from com.scalagent.task.Task.

Definition at line 141 of file Program.java.

References com.scalagent.task.util.Program.doReact(), com.scalagent.task.Task.setErrorMessage(), com.scalagent.task.Task.setStatus(), and com.scalagent.task.util.Program.toString().

Here is the call graph for this function:

void com.scalagent.task.util.Program.doReact ( ProcessEnd  not  )  throws Exception

Reacts to ProcessEnd notifications. Calls endProcess.

Parameters:
not notification to react to

Definition at line 168 of file Program.java.

References com.scalagent.task.util.Program.endProcess().

Referenced by com.scalagent.task.util.Program.react().

Here is the call graph for this function:

void com.scalagent.task.util.Program.start (  )  throws Exception [protected, virtual]

Starts program execution, overloads start from base class.

Implements com.scalagent.task.Task.

Definition at line 175 of file Program.java.

References com.scalagent.task.util.Program.command, and com.scalagent.task.Task.setStatus().

Here is the call graph for this function:

void com.scalagent.task.util.Program.endProcess ( ProcessEnd  not  )  throws Exception [protected]

Analyzes process report.

Parameters:
not the process report

Definition at line 188 of file Program.java.

References com.scalagent.task.Task.getStatus(), com.scalagent.task.Task.setErrorMessage(), and com.scalagent.task.Task.setStatus().

Referenced by com.scalagent.task.util.Program.doReact().

Here is the call graph for this function:

static String [] com.scalagent.task.util.Program.parseCommand ( String  commandLine  )  [static, protected]

Parses command line arguments.

This function does not recognize blanks in strings

Parameters:
commandLine the line to parse

Definition at line 207 of file Program.java.

References com.scalagent.task.util.Program.command.

Referenced by com.scalagent.task.util.JavaMain.JavaMain(), com.scalagent.task.util.Program.Program(), and com.scalagent.task.util.Program.setCommandLine().

void com.scalagent.task.util.Program.delete ( AgentId  agent  )  [protected]

Deletes this agent.

Should unregister from ProcessManager.

Definition at line 220 of file Program.java.

void com.scalagent.task.util.Program.taskStop (  )  throws Exception [protected, virtual]

Stops task execution, must be defined in derived classes. This function must ensure that setStatus(Status.DONE/FAIL/STOP) is eventually called.

Implements com.scalagent.task.Task.

Definition at line 229 of file Program.java.


Member Data Documentation

String [] com.scalagent.task.util.Program.command [protected]

program arguments

Definition at line 49 of file Program.java.

Referenced by com.scalagent.task.util.Program.parseCommand(), com.scalagent.task.util.Program.Program(), com.scalagent.task.util.Program.setCommandLine(), com.scalagent.task.util.Program.start(), and com.scalagent.task.util.Program.toString().


The documentation for this class was generated from the following file:
Generated on Tue Sep 16 16:16:02 2008 for joram by  doxygen 1.5.0