org.globus.cog.abstraction.impl.fileTransfer
Class DelegatedFileTransferHandler

java.lang.Object
  extended byorg.globus.cog.abstraction.impl.fileTransfer.DelegatedFileTransferHandler
All Implemented Interfaces:
DelegatedTaskHandler, Runnable, UrlCopyListener
Direct Known Subclasses:
CachingDelegatedFileTransferHandler

public class DelegatedFileTransferHandler
extends Object
implements DelegatedTaskHandler, Runnable, UrlCopyListener


Constructor Summary
DelegatedFileTransferHandler()
           
 
Method Summary
 void cancel()
          Cancels the execution of a task that was previously submitted by the DelegatedTaskHandler.submit(Task)method.
protected  FileResource getDestinationResource()
           
protected  FileResource getSourceResource()
           
 void resume()
          Resumes the execution of a task that was previously suspended by the DelegatedTaskHandler.suspend()method.
 void run()
           
protected  void setDestinationResource(FileResource destinationResource)
           
protected  void setSourceResource(FileResource sourceResource)
           
protected  FileResource startResource(Service service)
           
protected  void stopResources()
           
 void submit(Task task)
          This method is responsible for submitting the given Task to the remote Service in compliance with the appropriate provider.
 void suspend()
          Suspends the currently active task.
 void transfer(long current, long total)
           
 void transferCompleted()
           
 void transferError(Exception error)
           
protected  void transferUsingFileResources(Service sourceService, Service destinationService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatedFileTransferHandler

public DelegatedFileTransferHandler()
Method Detail

submit

public void submit(Task task)
            throws IllegalSpecException,
                   InvalidSecurityContextException,
                   InvalidServiceContactException,
                   TaskSubmissionException
Description copied from interface: DelegatedTaskHandler
This method is responsible for submitting the given Task to the remote Service in compliance with the appropriate provider. It executes in a seperate thread so that it doesnt block the submission of other tasks.

Specified by:
submit in interface DelegatedTaskHandler
Parameters:
task - the task to be executed
Throws:
TaskSubmissionException - when a generic exception occurs prohibiting the submission of the task.
InvalidServiceContactException - when the ServiceContactof the remote service in invalid.
IllegalSpecException - when the Specificationdoes not confirm to the type of the task and the given provider.
InvalidSecurityContextException - when the SecurityContextassociated with the task in invalid.

suspend

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

Specified by:
suspend in interface DelegatedTaskHandler
Throws:
TaskSubmissionException - when generic errors occur
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid

resume

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

Specified by:
resume in interface DelegatedTaskHandler
Throws:
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid
TaskSubmissionException - when generic errors occur

cancel

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

Specified by:
cancel in interface DelegatedTaskHandler
Throws:
InvalidSecurityContextException - when the SecurityContextassociated with the task is invalid
TaskSubmissionException - when generic errors occur

transferUsingFileResources

protected void transferUsingFileResources(Service sourceService,
                                          Service destinationService)
                                   throws InvalidServiceContactException,
                                          TaskSubmissionException,
                                          IllegalSpecException
Throws:
InvalidServiceContactException
TaskSubmissionException
IllegalSpecException

startResource

protected FileResource startResource(Service service)
                              throws InvalidProviderException,
                                     ProviderMethodException,
                                     IllegalHostException,
                                     InvalidSecurityContextException,
                                     GeneralException
Throws:
InvalidProviderException
ProviderMethodException
IllegalHostException
InvalidSecurityContextException
GeneralException

run

public void run()
Specified by:
run in interface Runnable

stopResources

protected void stopResources()

setDestinationResource

protected void setDestinationResource(FileResource destinationResource)

setSourceResource

protected void setSourceResource(FileResource sourceResource)

getDestinationResource

protected FileResource getDestinationResource()

getSourceResource

protected FileResource getSourceResource()

transfer

public void transfer(long current,
                     long total)
Specified by:
transfer in interface UrlCopyListener

transferError

public void transferError(Exception error)
Specified by:
transferError in interface UrlCopyListener

transferCompleted

public void transferCompleted()
Specified by:
transferCompleted in interface UrlCopyListener