org.globus.cog.abstraction.impl.file
Class TaskHandlerImpl

java.lang.Object
  extended byorg.globus.cog.abstraction.impl.file.TaskHandlerImpl
All Implemented Interfaces:
StatusListener, TaskHandler
Direct Known Subclasses:
CachingDelegatedFileOperationHandler

public class TaskHandlerImpl
extends Object
implements TaskHandler, StatusListener

The base class for task handlers in all file providers


Field Summary
 
Fields inherited from interface org.globus.cog.abstraction.interfaces.TaskHandler
EXECUTION, FILE_OPERATION, FILE_TRANSFER, GENERIC
 
Constructor Summary
TaskHandlerImpl()
           
 
Method Summary
 void addValidCommands()
          Add a list of valid commands to a vector
 void cancel(Task task)
          cancel a task
protected  Object execute(FileResource fileResource, FileOperationSpecification spec)
          execute the command on the file resource.
 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  FileResource getResource()
           
 Collection getResumedTasks()
          return a collection of resumed tasks
 Collection getSuspendedTasks()
          return a collection of suspended tasks
 int getType()
          return type of task handler
 boolean isValidSpecification(FileOperationSpecification spec)
          is the specification valid
 void remove(Task task)
          remove a task completely
 void resume(Task task)
          resume a task
 void setType(int type)
          set type of task handler
 void statusChanged(StatusEvent event)
          listen to the status changes of the task
 void submit(Task task)
          submit the task for execution.
 void submit(Task task, FileResource fileResource)
          submit task to the appropriate file resource to carry out the operation.
 void suspend(Task task)
          Suspend a task
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskHandlerImpl

public TaskHandlerImpl()
Method Detail

setType

public void setType(int type)
set type of task handler

Specified by:
setType in interface TaskHandler

getType

public int getType()
return type of task handler

Specified by:
getType in interface TaskHandler

submit

public void submit(Task task)
            throws IllegalSpecException,
                   InvalidSecurityContextException,
                   InvalidServiceContactException,
                   TaskSubmissionException
submit the task for execution. Synchronized because additions and deletions are made to the same data resource

Specified by:
submit in interface TaskHandler
Throws:
IllegalSpecException
InvalidSecurityContextException
InvalidServiceContactException
TaskSubmissionException

submit

public void submit(Task task,
                   FileResource fileResource)
            throws TaskSubmissionException,
                   IllegalSpecException,
                   InvalidProviderException,
                   ProviderMethodException,
                   IllegalHostException,
                   InvalidSecurityContextException,
                   DirectoryNotFoundException,
                   FileNotFoundException,
                   GeneralException
submit task to the appropriate file resource to carry out the operation. Called from submit(Task)

Throws:
TaskSubmissionException
IllegalSpecException
InvalidProviderException
ProviderMethodException
InvalidSecurityContextException
IllegalHostException
GeneralException
FileNotFoundException
DirectoryNotFoundException

execute

protected Object execute(FileResource fileResource,
                         FileOperationSpecification spec)
                  throws DirectoryNotFoundException,
                         FileNotFoundException,
                         GeneralException
execute the command on the file resource. Called from submit(Task, FileResource)

Throws:
GeneralException
DirectoryNotFoundException
GeneralException
FileNotFoundException

isValidSpecification

public boolean isValidSpecification(FileOperationSpecification spec)
is the specification valid


suspend

public void suspend(Task task)
             throws InvalidSecurityContextException,
                    TaskSubmissionException
Suspend a task

Specified by:
suspend in interface TaskHandler
Throws:
InvalidSecurityContextException
TaskSubmissionException

resume

public void resume(Task task)
            throws InvalidSecurityContextException,
                   TaskSubmissionException
resume a task

Specified by:
resume in interface TaskHandler
Throws:
InvalidSecurityContextException
TaskSubmissionException

cancel

public void cancel(Task task)
            throws InvalidSecurityContextException,
                   TaskSubmissionException
cancel a task

Specified by:
cancel in interface TaskHandler
Throws:
InvalidSecurityContextException
TaskSubmissionException

remove

public void remove(Task task)
            throws ActiveTaskException
remove a task completely

Specified by:
remove in interface TaskHandler
Throws:
ActiveTaskException

getAllTasks

public Collection getAllTasks()
return a collection of all tasks submitted to the handler

Specified by:
getAllTasks in interface TaskHandler

getActiveTasks

public Collection getActiveTasks()
return a collection of active tasks

Specified by:
getActiveTasks in interface TaskHandler

getFailedTasks

public Collection getFailedTasks()
return a collection of failed tasks

Specified by:
getFailedTasks in interface TaskHandler

getCompletedTasks

public Collection getCompletedTasks()
return a collection of completed tasks

Specified by:
getCompletedTasks in interface TaskHandler

getSuspendedTasks

public Collection getSuspendedTasks()
return a collection of suspended tasks

Specified by:
getSuspendedTasks in interface TaskHandler

getResumedTasks

public Collection getResumedTasks()
return a collection of resumed tasks

Specified by:
getResumedTasks in interface TaskHandler

getCanceledTasks

public Collection getCanceledTasks()
return a collection of canceled tasks

Specified by:
getCanceledTasks in interface TaskHandler

statusChanged

public void statusChanged(StatusEvent event)
listen to the status changes of the task

Specified by:
statusChanged in interface StatusListener

addValidCommands

public void addValidCommands()
Add a list of valid commands to a vector


getResource

protected FileResource getResource()