Class AsyncResult

java.lang.Object
com.enterprisedt.net.ftp.async.AsyncResult
Direct Known Subclasses:
ChangeDirectoryResult, ConnectResult, CreateDirectoryResult, DeleteDirectoryResult, DeleteMultipleFilesResult, DirectoryListCallbackResult, DirectoryListResult, DirectoryNameListResult, DisconnectResult, ExecuteCommandResult, GetSystemTypeResult, PermissionsResult, RemoteTransferResult, RenameResult

public abstract class AsyncResult extends Object
Base class for all result classes.
Version:
$Revision$
Author:
Bruce Blackshaw
  • Constructor Details

    • AsyncResult

      public AsyncResult()
  • Method Details

    • getLocalContext

      public com.enterprisedt.net.ftp.async.internal.SecureConnectionContext getLocalContext()
      Get a reference to the local connection context. Only valid within the callback, set to null otherwise.
      Returns:
      reference to local context, or null
    • setLocalContext

      public void setLocalContext(com.enterprisedt.net.ftp.async.internal.SecureConnectionContext localContext)
      Set the local context
      Parameters:
      localContext - local context
    • getClient

      public AsyncFileTransferClient getClient()
      Get a reference to the asynchronous client
      Returns:
    • setClient

      public void setClient(AsyncFileTransferClient asyncClient)
      Set the async client
      Parameters:
      asyncClient - reference to the client
    • setTag

      public void setTag(Object tag)
      Set the tag object
      Parameters:
      tag - tag to save in result
    • getTag

      public Object getTag()
      Get the tag object that has been saved in the result
      Returns:
      tag object
    • getTaskDescription

      public String getTaskDescription()
      Get a description of the task this result is for
      Returns:
      task description
    • isSuccessful

      public boolean isSuccessful()
      Was the operation successful, i.e. did it complete without any exceptions being thrown?
      Returns:
      true for successful, false otherwise
    • setSuccessful

      public void setSuccessful(boolean success)
      Set the flag for success (or failure).
      Parameters:
      success - true if operation succeeded, false otherwise
    • setTask

      public void setTask(com.enterprisedt.net.ftp.async.internal.Task task)
      Set the task associated with this result
      Parameters:
      task - associated task
    • getTask

      public com.enterprisedt.net.ftp.async.internal.Task getTask()
    • cancelTask

      public boolean cancelTask() throws FTPException
      Cancel the asynchronous task that this result is for.
      Returns:
      Throws:
      FTPException
    • getTaskId

      public int getTaskId()
      Get the task id
      Returns:
      -1 if unknown or the task id
    • getThrowable

      public Throwable getThrowable()
      If endAsync() is not called, the thrown exception (if indeed an exception has been thrown) can be accessed via this method.
      Returns:
      thrown exception or null if no exception thrown
    • endAsyncCalled

      public boolean endAsyncCalled()
      Has endAsync() been called?
      Returns:
      true if called, false otherwise
    • setEndAsyncCalled

      protected void setEndAsyncCalled()
      Set the flag indicating if endAsync() has been called to true.
    • isCompleted

      public boolean isCompleted()
      Has the asynchronous operation completed? This can be used to poll for completion.
      Returns:
      true if the operation has completed, false if not.
    • setThrowable

      public void setThrowable(Throwable throwable)
    • setAsIfCompleted

      public void setAsIfCompleted()
      Calls everything needed to pretend this is the result of a task that has completed
    • waitTillComplete

      protected void waitTillComplete()
      Waits until the async operation is completed.
    • endAsyncInternal

      protected void endAsyncInternal() throws FTPException, IOException
      Internal method that returns when the async method is completed.
      Throws:
      FTPException
      IOException
    • notifyComplete

      public void notifyComplete()
      Notifies waiting threads that the operation is complete