org.globus.cog.abstraction.interfaces
Interface TaskHandler

All Known Implementing Classes:
ExecutionTaskHandler, FileOperationTaskHandler, FileTransferTaskHandler, GenericTaskHandler, SandboxingTaskHandler, TaskHandlerImpl

public interface TaskHandler

The TaskHandler can be viewed as an adaptor that translates the abstract definitions of a Taskinto implementation-specific constructs understood by the backend Grid services.

For example, a GT4 TaskHandler will extract the appropriate attributes from the Task and make the necessary calls to the remote Grid service factory, retrieve the Grid service handle, and interact with the newly created service instance. Symmetric translations would be done for other Grid implementations. A handler is specific to the backed implementation (GT2, GT3, GT4, Condor, or SSH) and is the only part of abstractions framework that needs to be extended for supporting additional Grid implementations.


Field Summary
static int EXECUTION
          Represents a task handler that can handle remote job submission tasks
static int FILE_OPERATION
          Represents a task handler that can handle file operation tasks
static int FILE_TRANSFER
          Represents a task handler that can handle file transfer tasks
static int GENERIC
          Represents a generic task handler
 
Method Summary
 void cancel(Task task)
          Cancels the execution of a task that was previously submitted by the 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 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.
 

Field Detail

GENERIC

public static final int GENERIC
Represents a generic task handler

See Also:
Constant Field Values

EXECUTION

public static final int EXECUTION
Represents a task handler that can handle remote job submission tasks

See Also:
Constant Field Values

FILE_OPERATION

public static final int FILE_OPERATION
Represents a task handler that can handle file operation tasks

See Also:
Constant Field Values

FILE_TRANSFER

public static final int FILE_TRANSFER
Represents a task handler that can handle file transfer tasks

See Also:
Constant Field Values
Method Detail

setType

public void setType(int type)
Sets the type of tasks handled by this TaskHandler

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

getType

public int getType()
Returns the type of tasks handled by this TaskHandler


submit

public void submit(Task task)
            throws IllegalSpecException,
                   InvalidSecurityContextException,
                   InvalidServiceContactException,
                   TaskSubmissionException
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.

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

suspend

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

Parameters:
task - the Task to be suspended
Throws:
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid
TaskSubmissionException - when generic errors occur

resume

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

Parameters:
task - the Task to be resumed
Throws:
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid
TaskSubmissionException - when generic errors occur

cancel

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

Parameters:
task - the Task to be canceled
Throws:
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid
TaskSubmissionException - when generic errors occur

remove

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

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()
Returns a collection of all the Tasks submitted to this TaskHandler

Returns:
a collection of Taskobjects

getActiveTasks

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

Returns:
a collection of Taskobjects

getFailedTasks

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

Returns:
a collection of Taskobjects

getCompletedTasks

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

Returns:
a collection of Taskobjects

getSuspendedTasks

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

Returns:
a collection of Taskobjects

getResumedTasks

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

Returns:
a collection of Taskobjects

getCanceledTasks

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

Returns:
a collection of Taskobjects