org.globus.cog.gridface.impl.commands
Class GridCommandImpl

java.lang.Object
  extended byorg.globus.cog.gridface.impl.commands.GridCommandImpl
All Implemented Interfaces:
ExecutableObject, GridCommand, StatusListener
Direct Known Subclasses:
CHDIRCommandImpl, CHMODCommandImpl, CLOSECommandImpl, COPYCommandImpl, COPYDirCommandImpl, COPYFileCommandImpl, EXECCommandImpl, EXISTSCommandImpl, GETDIRCommandImpl, GETFILECommandImpl, ISDIRCommandImpl, LSCommandImpl, MKDIRCommandImpl, OPENCommandImpl, PUTDIRCommandImpl, PUTFILECommandImpl, PWDCommandImpl, RENAMECommandImpl, RMDIRCommandImpl, RMFILECommandImpl, URLCOPYCommandImpl

public abstract class GridCommandImpl
extends Object
implements GridCommand

Base class for all Grid Commands. Follows adapter pattern. Specific commands extend this class to override a few methods


Field Summary
protected  Task task
           
 
Fields inherited from interface org.globus.cog.abstraction.interfaces.ExecutableObject
TASK, TASKGRAPH
 
Constructor Summary
GridCommandImpl()
           
 
Method Summary
 void addArgument(String arg)
          Add one argument at a time
 void addStatusListener(StatusListener listener)
          Add status listener
 String getArgument(int n)
          Return the nth argument
 Vector getArguments()
          Returns all arguments in a vector.
 int getArgumentsSize()
          Return the total number of arguments
 Object getAttribute(String name)
          Get the attribute with given name
 Hashtable getAttributes()
          Get all attributes in the form of a hash table
 String getCommand()
          Return command name
 Calendar getCompletedTime()
           
 String getError()
          Get error message of the task belonging to this command
 Exception getException()
          Returns the exception for the current status object this is here so it can be overridden by the exec object to make sence of the error codes of jglobus
 String getExceptionString()
          returns an excpetion and its stack to a string using the static method in gridfaces.impl.util.LoggerImpl
 Integer getId()
           
 Identity getIdentity()
          Return id for this command
 String getName()
          Return name of this command
 int getObjectType()
           
 Status getStatus()
          Return status of the command
 Enumeration getStatusListeners()
          Get a list of status listeners
 Calendar getSubmittedTime()
           
 Task getTask()
           
 Object getTaskAttribute(String key)
          Return task attributes
 Task prepareFileOperationTask()
          prepare a file operation task
 Task prepareFileTransferTask()
          Prepares a file transfer task with File transfer specification
 Task prepareJobSubmissionTask()
          Prepares job submission task with JobSpecification
 void removeStatusListener(StatusListener listener)
          Remove status listener
 void setArguments(String[] args)
          Set many arguments at a time
 void setAttribute(String name, Object value)
          set attributes for the given command
 void setAttributes(Hashtable attribs)
           
 void setCommand(String command)
          set command name
 void setIdentity(Identity id)
          Set id for this command
 void setName(String name)
          Set name for this command
 void setStatus(int status)
          Set status of the command
 void setStatus(Status status)
          Set status of the command
 void setTask(Task newTask)
           
 void setTaskAttribute(String key, Object value)
          set attributes for the task
 void statusChanged(StatusEvent event)
          Listen to status of the tasks prepared by this command
 boolean validate()
          Validate the inputs for this command
 
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.gridface.interfaces.GridCommand
getOutput, prepareTask
 

Field Detail

task

protected Task task
Constructor Detail

GridCommandImpl

public GridCommandImpl()
Method Detail

setArguments

public void setArguments(String[] args)
Set many arguments at a time

Specified by:
setArguments in interface GridCommand

addArgument

public void addArgument(String arg)
Add one argument at a time

Specified by:
addArgument in interface GridCommand

setCommand

public void setCommand(String command)
set command name

Specified by:
setCommand in interface GridCommand

getCommand

public String getCommand()
Return command name

Specified by:
getCommand in interface GridCommand

getArgument

public String getArgument(int n)
Return the nth argument

Specified by:
getArgument in interface GridCommand

getArgumentsSize

public int getArgumentsSize()
Return the total number of arguments

Specified by:
getArgumentsSize in interface GridCommand

getArguments

public Vector getArguments()
Returns all arguments in a vector. This method enables easy copy of arguments into the specification

Specified by:
getArguments in interface GridCommand

prepareFileOperationTask

public Task prepareFileOperationTask()
                              throws Exception
prepare a file operation task

Throws:
Exception

prepareFileTransferTask

public Task prepareFileTransferTask()
                             throws Exception
Prepares a file transfer task with File transfer specification

Throws:
Exception

prepareJobSubmissionTask

public Task prepareJobSubmissionTask()
                              throws Exception
Prepares job submission task with JobSpecification

Throws:
Exception

setAttribute

public void setAttribute(String name,
                         Object value)
set attributes for the given command

Specified by:
setAttribute in interface GridCommand

setAttributes

public void setAttributes(Hashtable attribs)
Specified by:
setAttributes in interface GridCommand

getAttribute

public Object getAttribute(String name)
Get the attribute with given name

Specified by:
getAttribute in interface GridCommand

getAttributes

public Hashtable getAttributes()
Get all attributes in the form of a hash table

Specified by:
getAttributes in interface GridCommand

getCompletedTime

public Calendar getCompletedTime()
Specified by:
getCompletedTime in interface GridCommand

getId

public Integer getId()
Specified by:
getId in interface GridCommand

getSubmittedTime

public Calendar getSubmittedTime()
Specified by:
getSubmittedTime in interface GridCommand

getTask

public Task getTask()
Specified by:
getTask in interface GridCommand

setTask

public void setTask(Task newTask)
Specified by:
setTask in interface GridCommand

addStatusListener

public void addStatusListener(StatusListener listener)
Add status listener

Specified by:
addStatusListener in interface GridCommand

removeStatusListener

public void removeStatusListener(StatusListener listener)
Remove status listener

Specified by:
removeStatusListener in interface GridCommand

getStatusListeners

public Enumeration getStatusListeners()
Get a list of status listeners

Specified by:
getStatusListeners in interface GridCommand

validate

public boolean validate()
Validate the inputs for this command

Specified by:
validate in interface GridCommand

setStatus

public void setStatus(int status)
Set status of the command

Specified by:
setStatus in interface ExecutableObject

setStatus

public void setStatus(Status status)
Set status of the command

Specified by:
setStatus in interface ExecutableObject

getStatus

public Status getStatus()
Return status of the command

Specified by:
getStatus in interface ExecutableObject

statusChanged

public void statusChanged(StatusEvent event)
Listen to status of the tasks prepared by this command

Specified by:
statusChanged in interface StatusListener

setIdentity

public void setIdentity(Identity id)
Set id for this command

Specified by:
setIdentity in interface ExecutableObject

getIdentity

public Identity getIdentity()
Return id for this command

Specified by:
getIdentity in interface ExecutableObject

setName

public void setName(String name)
Set name for this command

Specified by:
setName in interface ExecutableObject

getName

public String getName()
Return name of this command

Specified by:
getName in interface ExecutableObject

getError

public String getError()
Get error message of the task belonging to this command

Specified by:
getError in interface GridCommand

setTaskAttribute

public void setTaskAttribute(String key,
                             Object value)
set attributes for the task

Specified by:
setTaskAttribute in interface GridCommand

getTaskAttribute

public Object getTaskAttribute(String key)
Return task attributes

Specified by:
getTaskAttribute in interface GridCommand

getObjectType

public int getObjectType()
Specified by:
getObjectType in interface ExecutableObject

getException

public Exception getException()
Description copied from interface: GridCommand
Returns the exception for the current status object this is here so it can be overridden by the exec object to make sence of the error codes of jglobus

Specified by:
getException in interface GridCommand

getExceptionString

public String getExceptionString()
Description copied from interface: GridCommand
returns an excpetion and its stack to a string using the static method in gridfaces.impl.util.LoggerImpl

Specified by:
getExceptionString in interface GridCommand
Returns: