org.caleigo.core
Class IDataTransaction.Job

java.lang.Object
  extended byorg.caleigo.core.IDataTransaction.Job
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
IDataTransaction

public static class IDataTransaction.Job
extends java.lang.Object
implements java.io.Serializable

Instances of this class is returned from the commitAsynchroniesly method.

See Also:
Serialized Form

Field Summary
static int CANCELED
           
static int COMPLETED
           
static int FAILED
           
static int STARTED
           
static int WAITING_TO_START
           
 
Constructor Summary
IDataTransaction.Job(IDataTransaction dataTransaction)
           
 
Method Summary
 void addProgressListener(IDataTransaction.IProgressListener listener)
          Adds a listener that will recevie events from this jab.
 void cancel()
          Tries to cancel this job.
 void fireJobCanceledEvent()
           
 void fireJobCompletedEvent()
           
 void fireJobFailedEvent(java.lang.Throwable exception)
           
 void fireJobStartedEvent()
           
 void fireProgressChangedEvent(int maxProgress, int currentProgress)
           
 IDataTransaction.IProgressListener[] getAllProgressListeners()
           
 IDataTransaction getDataTransaction()
          Returns the data transaction that this job commits.
 java.lang.Throwable getException()
          Returns the most recent exception that was caught while this job was executed.
 int getId()
          Returns a unique id for this job.
 int getStatus()
          Returns the current status of this job.
 boolean isFinished()
           
 void removeProgressListener(IDataTransaction.IProgressListener listener)
          Removes a progress listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WAITING_TO_START

public static final int WAITING_TO_START
See Also:
Constant Field Values

STARTED

public static final int STARTED
See Also:
Constant Field Values

CANCELED

public static final int CANCELED
See Also:
Constant Field Values

FAILED

public static final int FAILED
See Also:
Constant Field Values

COMPLETED

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

IDataTransaction.Job

public IDataTransaction.Job(IDataTransaction dataTransaction)
Parameters:
dataTransaction - the data transaction that should be commited when this job is executed.
Method Detail

cancel

public void cancel()
            throws DataServiceException
Tries to cancel this job. All registered listeners will receive a cancel event when the job has been successfully canceled.

Throws:
DataServiceException

getId

public int getId()
Returns a unique id for this job.


getStatus

public int getStatus()
Returns the current status of this job. This method is thread safe.


isFinished

public boolean isFinished()

addProgressListener

public void addProgressListener(IDataTransaction.IProgressListener listener)
Adds a listener that will recevie events from this jab.


removeProgressListener

public void removeProgressListener(IDataTransaction.IProgressListener listener)
Removes a progress listener.


getAllProgressListeners

public IDataTransaction.IProgressListener[] getAllProgressListeners()

getDataTransaction

public IDataTransaction getDataTransaction()
Returns the data transaction that this job commits.


getException

public java.lang.Throwable getException()
Returns the most recent exception that was caught while this job was executed. This is typically called after receiving a job failed event.


fireJobStartedEvent

public void fireJobStartedEvent()

fireJobCompletedEvent

public void fireJobCompletedEvent()

fireJobCanceledEvent

public void fireJobCanceledEvent()

fireJobFailedEvent

public void fireJobFailedEvent(java.lang.Throwable exception)

fireProgressChangedEvent

public void fireProgressChangedEvent(int maxProgress,
                                     int currentProgress)


Copyright © 2005 Caleigo. All Rights Reserved.