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

java.lang.Object
  extended byorg.globus.cog.abstraction.impl.common.task.FileTransferTaskHandler
All Implemented Interfaces:
StatusListener, TaskHandler
Direct Known Subclasses:
CachingFileTransferTaskHandler

public class FileTransferTaskHandler
extends Object
implements TaskHandler, StatusListener


Field Summary
 
Fields inherited from interface org.globus.cog.abstraction.interfaces.TaskHandler
EXECUTION, FILE_OPERATION, FILE_TRANSFER, GENERIC
 
Constructor Summary
FileTransferTaskHandler()
           
 
Method Summary
 void cancel(Task task)
          Cancels the execution of a task that was previously submitted by the TaskHandler.submit(Task)method.
 Collection getActiveTasks()
          return a collection of active tasks
 Collection getAllTasks()
          return a collection of all tasks submitted to the handler
 Collection getCanceledTasks()
          return a collection of canceled tasks
 Collection getCompletedTasks()
          return a collection of completed tasks
 Collection getFailedTasks()
          return a collection of failed tasks
protected  Hashtable getHandleMap()
           
 Collection getResumedTasks()
          return a collection of resumed tasks
 Collection getSuspendedTasks()
          return a collection of suspended tasks
 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 statusChanged(StatusEvent event)
           
 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

FileTransferTaskHandler

public FileTransferTaskHandler()
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()
return a collection of all tasks submitted to the handler

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

getActiveTasks

public Collection getActiveTasks()
return a collection of active tasks

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

getFailedTasks

public Collection getFailedTasks()
return a collection of failed tasks

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

getCompletedTasks

public Collection getCompletedTasks()
return a collection of completed tasks

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

getSuspendedTasks

public Collection getSuspendedTasks()
return a collection of suspended tasks

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

getResumedTasks

public Collection getResumedTasks()
return a collection of resumed tasks

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

getCanceledTasks

public Collection getCanceledTasks()
return a collection of canceled tasks

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

statusChanged

public void statusChanged(StatusEvent event)
Specified by:
statusChanged in interface StatusListener

getHandleMap

protected Hashtable getHandleMap()