org.jets3t.service.multi.event
Class ServiceEvent

java.lang.Object
  extended by org.jets3t.service.multi.event.ServiceEvent
Direct Known Subclasses:
CopyObjectsEvent, CreateBucketsEvent, CreateObjectsEvent, DeleteObjectsEvent, DownloadObjectsEvent, GetObjectHeadsEvent, GetObjectsEvent, ListObjectsEvent, LookupACLEvent, MultipartCompletesEvent, MultipartStartsEvent, MultipartUploadsEvent, ServiceEvent, UpdateACLEvent

public abstract class ServiceEvent
extends java.lang.Object

Base class of all events produced by ThreadedStorageService.

Every event has an event code that indicates the state of a process when the event was generated. The event code will also give a guide as to what information the event will contain.

The event codes, and their meanings, are:

EVENT_STARTED and EVENT_IN_PROGRESS events may include a ThreadWatcher object containing detailed information about the progress of an operation, such as how many threads have completed and, of uploads and downloads, how many bytes have been transferred at what speed and how long until the transfer is complete.

See the event object specific to the operation you are performing for more details about the information available in service events.


Field Summary
static int EVENT_CANCELLED
           
static int EVENT_COMPLETED
           
static int EVENT_ERROR
           
static int EVENT_IGNORED_ERRORS
           
static int EVENT_IN_PROGRESS
           
static int EVENT_STARTED
           
 
Constructor Summary
protected ServiceEvent(int eventCode, java.lang.Object uniqueOperationId)
           
 
Method Summary
 java.lang.Throwable getErrorCause()
           
 int getEventCode()
           
 java.lang.Throwable[] getIgnoredErrors()
           
 ThreadWatcher getThreadWatcher()
           
 java.lang.Object getUniqueOperationId()
           
protected  void setErrorCause(java.lang.Throwable t)
           
protected  void setIgnoredErrors(java.lang.Throwable[] ignoredErrors)
           
protected  void setThreadWatcher(ThreadWatcher threadWatcher)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EVENT_ERROR

public static final int EVENT_ERROR
See Also:
Constant Field Values

EVENT_STARTED

public static final int EVENT_STARTED
See Also:
Constant Field Values

EVENT_COMPLETED

public static final int EVENT_COMPLETED
See Also:
Constant Field Values

EVENT_IN_PROGRESS

public static final int EVENT_IN_PROGRESS
See Also:
Constant Field Values

EVENT_CANCELLED

public static final int EVENT_CANCELLED
See Also:
Constant Field Values

EVENT_IGNORED_ERRORS

public static final int EVENT_IGNORED_ERRORS
See Also:
Constant Field Values
Constructor Detail

ServiceEvent

protected ServiceEvent(int eventCode,
                       java.lang.Object uniqueOperationId)
Method Detail

setThreadWatcher

protected void setThreadWatcher(ThreadWatcher threadWatcher)

setErrorCause

protected void setErrorCause(java.lang.Throwable t)

setIgnoredErrors

protected void setIgnoredErrors(java.lang.Throwable[] ignoredErrors)

getUniqueOperationId

public java.lang.Object getUniqueOperationId()

getEventCode

public int getEventCode()
Returns:
the event code, which will match one of this class's public static EVENT_XXX variables.

getErrorCause

public java.lang.Throwable getErrorCause()
                                  throws java.lang.IllegalStateException
Returns:
the error that caused an operation to fail.
Throws:
java.lang.IllegalStateException - an error cause can only be retrieved from an EVENT_ERROR event.

getIgnoredErrors

public java.lang.Throwable[] getIgnoredErrors()
                                       throws java.lang.IllegalStateException
Returns:
a list of one or more errors that occurred during an operation, but which were ignored at the time (so the overall operation continued).
Throws:
java.lang.IllegalStateException - ignored errors can only be retrieved from an EVENT_IGNORED_ERRORS event.

getThreadWatcher

public ThreadWatcher getThreadWatcher()
                               throws java.lang.IllegalStateException
Returns:
a thread watcher object containing information about the progress of an operation.
Throws:
java.lang.IllegalStateException - a thread watcher can only be retrieved from an EVENET_STARTED or EVENT_IN_PROGRESS event.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object