org.globus.cog.abstraction.impl.common.task
Class ExecutionTaskHandler

java.lang.Object
  extended byorg.globus.cog.abstraction.impl.common.task.ExecutionTaskHandler
All Implemented Interfaces:
TaskHandler

public class ExecutionTaskHandler
extends Object
implements TaskHandler


Field Summary
 
Fields inherited from interface org.globus.cog.abstraction.interfaces.TaskHandler
EXECUTION, FILE_OPERATION, FILE_TRANSFER, GENERIC
 
Constructor Summary
ExecutionTaskHandler()
           
 
Method Summary
 void cancel(Task task)
          Cancels the execution of a task that was previously submitted by the TaskHandler.submit(Task)method.
 Collection getActiveTasks()
          Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.ACTIVEstate
 Collection getAllTasks()
          Returns a collection of all the Tasks submitted to this TaskHandler
 Collection getCanceledTasks()
          Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.CANCELEDstate
 Collection getCompletedTasks()
          Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.COMPLETEDstate
 Collection getFailedTasks()
          Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.FAILEDstate
 Collection getResumedTasks()
          Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.RESUMEDstate
 Collection getSuspendedTasks()
          Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.SUSPENDEDstate
 int getType()
          Returns the type of tasks handled by this TaskHandler
 void remove(Task task)
          Removes the given Task from the TaskHandler cache.
 void resume(Task task)
          Resumes the execution of a task that was previously suspended by the TaskHandler.suspend(Task)method.
 void setType(int type)
          Sets the type of tasks handled by this TaskHandler
 void submit(Task task)
          Submits the given Taskfor execuiton.
 void suspend(Task task)
          Suspends the currently active task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionTaskHandler

public ExecutionTaskHandler()
Method Detail

setType

public void setType(int type)
Description copied from interface: TaskHandler
Sets the type of tasks handled by this TaskHandler

Specified by:
setType in interface TaskHandler
Parameters:
type - an integer representing the type of TaskHandler. Valid options are TaskHandler.GENERIC, TaskHandler.EXECUTION, TaskHandler.FILE_OPERATION, and TaskHandler.FILE_TRANSFER

getType

public int getType()
Description copied from interface: TaskHandler
Returns the type of tasks handled by this TaskHandler

Specified by:
getType in interface TaskHandler

submit

public void submit(Task task)
            throws IllegalSpecException,
                   InvalidSecurityContextException,
                   InvalidServiceContactException,
                   TaskSubmissionException
Description copied from interface: TaskHandler
Submits the given Taskfor execuiton. The Task is submitted to the TaskHandler in an asynchronous mode, whereby the method returns immediately after submitting the task to the remote machine. The status and output of the task can be monitored asynchronously by the ExecutableObject.addStatusListener(StatusListener)and Task.addOutputListener(OutputListener)methods respectively.

Specified by:
submit in interface TaskHandler
Parameters:
task - the Task to be submitted
Throws:
InvalidServiceContactException - when the ServiceContactassociated with the task is invalid
TaskSubmissionException - when generic errors occur during task submission
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid
IllegalSpecException - when the Specificationassociated with the task is illegal

suspend

public void suspend(Task task)
             throws InvalidSecurityContextException,
                    TaskSubmissionException
Description copied from interface: TaskHandler
Suspends the currently active task. A suspended task can be resumed using the TaskHandler.resume(Task)method

Specified by:
suspend in interface TaskHandler
Parameters:
task - the Task to be suspended
Throws:
TaskSubmissionException - when generic errors occur
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid

resume

public void resume(Task task)
            throws InvalidSecurityContextException,
                   TaskSubmissionException
Description copied from interface: TaskHandler
Resumes the execution of a task that was previously suspended by the TaskHandler.suspend(Task)method.

Specified by:
resume in interface TaskHandler
Parameters:
task - the Task to be resumed
Throws:
TaskSubmissionException - when generic errors occur
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid

cancel

public void cancel(Task task)
            throws InvalidSecurityContextException,
                   TaskSubmissionException
Description copied from interface: TaskHandler
Cancels the execution of a task that was previously submitted by the TaskHandler.submit(Task)method. Tasks once canceled cannot be resumed for execution later.

Specified by:
cancel in interface TaskHandler
Parameters:
task - the Task to be canceled
Throws:
TaskSubmissionException - when generic errors occur
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid

remove

public void remove(Task task)
            throws ActiveTaskException
Description copied from interface: TaskHandler
Removes the given Task from the TaskHandler cache. After invoking this method, the TaskHandler will lose all references to the given Task

Specified by:
remove in interface TaskHandler
Parameters:
task - the Task object to be removed from the cache
Throws:
ActiveTaskException - when the task to be removed in an Status.ACTIVE state.

getAllTasks

public Collection getAllTasks()
Description copied from interface: TaskHandler
Returns a collection of all the Tasks submitted to this TaskHandler

Specified by:
getAllTasks in interface TaskHandler
Returns:
a collection of Taskobjects

getActiveTasks

public Collection getActiveTasks()
Description copied from interface: TaskHandler
Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.ACTIVEstate

Specified by:
getActiveTasks in interface TaskHandler
Returns:
a collection of Taskobjects

getFailedTasks

public Collection getFailedTasks()
Description copied from interface: TaskHandler
Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.FAILEDstate

Specified by:
getFailedTasks in interface TaskHandler
Returns:
a collection of Taskobjects

getCompletedTasks

public Collection getCompletedTasks()
Description copied from interface: TaskHandler
Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.COMPLETEDstate

Specified by:
getCompletedTasks in interface TaskHandler
Returns:
a collection of Taskobjects

getSuspendedTasks

public Collection getSuspendedTasks()
Description copied from interface: TaskHandler
Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.SUSPENDEDstate

Specified by:
getSuspendedTasks in interface TaskHandler
Returns:
a collection of Taskobjects

getResumedTasks

public Collection getResumedTasks()
Description copied from interface: TaskHandler
Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.RESUMEDstate

Specified by:
getResumedTasks in interface TaskHandler
Returns:
a collection of Taskobjects

getCanceledTasks

public Collection getCanceledTasks()
Description copied from interface: TaskHandler
Returns a collection of all the Tasks submitted to this TaskHandler that are currently in the Status.CANCELEDstate

Specified by:
getCanceledTasks in interface TaskHandler
Returns:
a collection of Taskobjects