org.globus.cog.gridshell.commands
Class AbstractCommand

java.lang.Object
  extended byorg.globus.cog.gridshell.commands.AbstractCommand
All Implemented Interfaces:
Command, Comparable, EventListener, PropertyChangeListener, PropertyChangeNotifier, Runnable
Direct Known Subclasses:
AbstractExecutableCommand, AbstractProgram, AbstractShellCommand

public abstract class AbstractCommand
extends Object
implements Command, PropertyChangeListener

This class is an abstract implementation of a command


Field Summary
static String PROPERTY_STATUS_CODE
           
 
Constructor Summary
AbstractCommand()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener pcListener)
          Add a property change listener
 void addPropertyChangeListener(String propertyName, PropertyChangeListener pcListener)
          Add a property change listener for propertyName
static Map arrayToMap(Object[] array)
           
 int compareTo(Object thatObj)
           
 Identity getIdentity()
          Returns an identity for this command
 Command getParent()
          Returns the parent of this command
 Object getResult()
          Returns a result for this command once the status is COMPLETED
 Scope getScope()
          Returns the scope associated with this command
 Status getStatus()
          The status of this command
 Object init(Map args)
          Accepts the arguments: Scope scope - the scope of this command Command parent - the parent of this command String resultVariableName - the variable in this scope to store a result by default
 void removePropertyChangeListener(PropertyChangeListener pcListener)
          Remove a property change listener
protected  void setResult(Object result)
           
 void setStatusCode(int value)
          Sets the status of this Command
 void setStatusCompleted()
          A helper method that calls this.setStatusCode(Status.COMPLETED);
 void setStatusFailed(String message)
           
 void setStatusFailed(String message, Exception thrown)
           
protected  void unsupported()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.globus.cog.gridshell.interfaces.Command
destroy, execute, kill, resume, suspend
 
Methods inherited from interface java.lang.Runnable
run
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Field Detail

PROPERTY_STATUS_CODE

public static final String PROPERTY_STATUS_CODE
See Also:
Constant Field Values
Constructor Detail

AbstractCommand

public AbstractCommand()
Method Detail

init

public Object init(Map args)
            throws Exception
Accepts the arguments: Scope scope - the scope of this command Command parent - the parent of this command String resultVariableName - the variable in this scope to store a result by default

Specified by:
init in interface Command
Parameters:
args - - a mapping of variable name to variable value
Returns:
Throws:
Exception

setResult

protected void setResult(Object result)

getResult

public Object getResult()
Description copied from interface: Command
Returns a result for this command once the status is COMPLETED

Specified by:
getResult in interface Command
Returns:

getScope

public Scope getScope()
Description copied from interface: Command
Returns the scope associated with this command

Specified by:
getScope in interface Command
Returns:

getIdentity

public Identity getIdentity()
Description copied from interface: Command
Returns an identity for this command

Specified by:
getIdentity in interface Command
Returns:

getParent

public Command getParent()
Description copied from interface: Command
Returns the parent of this command

Specified by:
getParent in interface Command
Returns:

setStatusCompleted

public final void setStatusCompleted()
A helper method that calls this.setStatusCode(Status.COMPLETED);


setStatusCode

public final void setStatusCode(int value)
Description copied from interface: Command
Sets the status of this Command

Specified by:
setStatusCode in interface Command
Parameters:
value -

setStatusFailed

public final void setStatusFailed(String message)

setStatusFailed

public final void setStatusFailed(String message,
                                  Exception thrown)

getStatus

public final Status getStatus()
Description copied from interface: Command
The status of this command

Specified by:
getStatus in interface Command
Returns:

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener pcListener)
Description copied from interface: PropertyChangeNotifier
Add a property change listener

Specified by:
addPropertyChangeListener in interface PropertyChangeNotifier
Parameters:
pcListener -

addPropertyChangeListener

public final void addPropertyChangeListener(String propertyName,
                                            PropertyChangeListener pcListener)
Description copied from interface: PropertyChangeNotifier
Add a property change listener for propertyName

Specified by:
addPropertyChangeListener in interface PropertyChangeNotifier
Parameters:
propertyName -
pcListener -

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener pcListener)
Description copied from interface: PropertyChangeNotifier
Remove a property change listener

Specified by:
removePropertyChangeListener in interface PropertyChangeNotifier
Parameters:
pcListener -

compareTo

public int compareTo(Object thatObj)
Specified by:
compareTo in interface Comparable

arrayToMap

public static Map arrayToMap(Object[] array)

unsupported

protected void unsupported()