com.exoftware.exactor
Class ExecutionSet

java.lang.Object
  extended bycom.exoftware.exactor.ExecutionSet

public class ExecutionSet
extends java.lang.Object

A collection of scripts to be executed together. ExecutionSetListeners can be added to the ExecutionSet to be notified of script and command events. The ExecutionSet contains a global context for all scripts it contains.

Author:
Brian Swan

Field Summary
static java.lang.String SCRIPT_EXTENSION
           
 
Constructor Summary
ExecutionSet()
           
 
Method Summary
 void addCommandMapping(java.lang.String name, java.lang.Class c)
          Add a mapping of a command class to the specified name.
 void addCompositeMapping(java.lang.String name, java.io.File scriptFile)
          Add a mapping of a composite scriptFile to the specified name.
 void addListener(ExecutionSetListener listener)
          Add a listener to the ExecutionSet.
 void addScript(Script s)
          Add a script to the ExecutionSet.
 void execute()
          Execute all the scripts in the ExecutionSet.
 Command findCommand(java.lang.String name)
          Find a Command with the specified name.
 void fireCommandEnded(Command c, java.lang.Throwable t)
          Notify all added listeners that the specified command has ended, possibly in error.
 void fireCommandStarted(Command c)
          Notify all added listeners that the specified command has started.
 void fireExecutionSetEnded()
          Notify all added listeners that the execution set has ended.
 void fireExecutionSetStarted()
          Notify all added listeners that the execution set has started.
 void fireScriptEnded(Script s)
          Notify all added listeners that the specified script has ended.
 void fireScriptStarted(Script s)
          Notify all added listeners that the specified script has started.
 java.util.Map getContext()
          Returns the context for all scripts in this ExecutionSet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCRIPT_EXTENSION

public static final java.lang.String SCRIPT_EXTENSION
See Also:
Constant Field Values
Constructor Detail

ExecutionSet

public ExecutionSet()
Method Detail

getContext

public java.util.Map getContext()
Returns the context for all scripts in this ExecutionSet. This context map also contains all of the entries from System.getProperties().

Returns:
the context for all scripts in this ExecutionSet.
See Also:
System.getProperties()

addScript

public void addScript(Script s)
Add a script to the ExecutionSet.

Parameters:
s - the script to add.

addListener

public void addListener(ExecutionSetListener listener)
Add a listener to the ExecutionSet.

Parameters:
listener - the listener to add.

execute

public void execute()
Execute all the scripts in the ExecutionSet.


fireExecutionSetStarted

public void fireExecutionSetStarted()
Notify all added listeners that the execution set has started.


fireExecutionSetEnded

public void fireExecutionSetEnded()
Notify all added listeners that the execution set has ended.


fireScriptStarted

public void fireScriptStarted(Script s)
Notify all added listeners that the specified script has started.

Parameters:
s - the started script.

fireScriptEnded

public void fireScriptEnded(Script s)
Notify all added listeners that the specified script has ended.

Parameters:
s - the ended script.

fireCommandStarted

public void fireCommandStarted(Command c)
Notify all added listeners that the specified command has started.

Parameters:
c - the started command.

fireCommandEnded

public void fireCommandEnded(Command c,
                             java.lang.Throwable t)
Notify all added listeners that the specified command has ended, possibly in error.

Parameters:
c - the ended command
t - the reason the commanded ended or null.

findCommand

public Command findCommand(java.lang.String name)
Find a Command with the specified name.

Parameters:
name - the name of the Command to find.
Returns:
A Command for the specified name, or null if no command could be found.

addCommandMapping

public void addCommandMapping(java.lang.String name,
                              java.lang.Class c)
                       throws java.lang.RuntimeException
Add a mapping of a command class to the specified name.

Parameters:
name - the name to use to reference this command in a script
c - the command class to execute for the supplied name.
Throws:
java.lang.RuntimeException - if name or c are null, or if c is not a Command class.

addCompositeMapping

public void addCompositeMapping(java.lang.String name,
                                java.io.File scriptFile)
Add a mapping of a composite scriptFile to the specified name.

Parameters:
name - the name to use to reference this command in a scriptFile
scriptFile - the scriptFile to execute for the suppied name.
Throws:
java.lang.RuntimeException - if name or scriptFile are null.