org.caleigo.core
Interface IDataTransaction

All Superinterfaces:
IDistributable, java.io.Serializable
All Known Implementing Classes:
AbstractDataService.AbstractDataTransaction

public interface IDataTransaction
extends java.io.Serializable, IDistributable

IDataTransaction handles transactions for IDataService API. IDataTransaction differ somewhat from traditional transactions in the fact that none off the operations are actually performed until the commit method is called. Before that the operations is simple stored in ordered queue. IDataTransaction can be used as a reusable batch queue of operations that can be called and recalled at any convinance. The classes that implements the interface may NOT lock any system resources.

Version:
1.00
Author:
Dennis Zikovic

Nested Class Summary
static interface IDataTransaction.IProgressListener
          Listener interface for the Job class.
static class IDataTransaction.Job
          Instances of this class is returned from the commitAsynchroniesly method.
static class IDataTransaction.ProgressAdapter
           
static class IDataTransaction.ProgressEvent
          Event classed used by IProgressListener.
 
Method Summary
 void abortTransaction()
          Tries to abort the currently executing transaction.
 void addCreate(IEntityDescriptor entityDescriptor)
           
 void addDelete(IEntity entity)
           
 void addLoad(Qualifier identitQualifier, IEntity resultEntity)
           
 void addLoadSelection(DataQuery dataQuery, ISelection resultSelection)
           
 void addLoadSelection(IEntityDescriptor entityDescriptor, Qualifier qualifier, IEntityRelationPath relationPath, ISelection resultSelection)
           
 void addLoadSelection(IEntityDescriptor entityDescriptor, Qualifier qualifier, ISelection resultSelection)
           
 void addRefresh(IEntity entity)
           
 void addRelation(IEntityRelation relation)
           
 void addStore(IEntity entity)
           
 void commit()
          Commit performs all the stored operations in the transaction.
 IDataTransaction.Job commitAsynchroniesly(java.lang.Object lock)
          This method creates a Job that when executed will perform the same actions as the commit method.
 int getID()
          Returns a unique id for this data transaction.
 boolean isEmpty()
          Help methods that returns true if the transaction is empty, wich means that no operations has been added to it and that commit neads no be called.
 boolean isMutating()
          Help methods that returns true if one or more store or delete methods has been added to the transaction.
 

Method Detail

commit

public void commit()
            throws DataServiceException
Commit performs all the stored operations in the transaction. If any of the operations fail a rollback on all operations will be automatically performed and a TransactionFailedException will be thrown.

Throws:
DataServiceException

commitAsynchroniesly

public IDataTransaction.Job commitAsynchroniesly(java.lang.Object lock)
                                          throws DataServiceException
This method creates a Job that when executed will perform the same actions as the commit method.

Parameters:
lock - when the commit finishes all threads that waits on this object will be notified. This parameter may be null.
Throws:
DataServiceException

abortTransaction

public void abortTransaction()
                      throws DataServiceException
Tries to abort the currently executing transaction.

Throws:
DataServiceException

getID

public int getID()
Returns a unique id for this data transaction.


addLoad

public void addLoad(Qualifier identitQualifier,
                    IEntity resultEntity)

addLoadSelection

public void addLoadSelection(IEntityDescriptor entityDescriptor,
                             Qualifier qualifier,
                             ISelection resultSelection)

addLoadSelection

public void addLoadSelection(IEntityDescriptor entityDescriptor,
                             Qualifier qualifier,
                             IEntityRelationPath relationPath,
                             ISelection resultSelection)

addLoadSelection

public void addLoadSelection(DataQuery dataQuery,
                             ISelection resultSelection)

addStore

public void addStore(IEntity entity)

addDelete

public void addDelete(IEntity entity)

addRefresh

public void addRefresh(IEntity entity)

addCreate

public void addCreate(IEntityDescriptor entityDescriptor)

addRelation

public void addRelation(IEntityRelation relation)

isEmpty

public boolean isEmpty()
Help methods that returns true if the transaction is empty, wich means that no operations has been added to it and that commit neads no be called.


isMutating

public boolean isMutating()
Help methods that returns true if one or more store or delete methods has been added to the transaction.



Copyright © 2005 Caleigo. All Rights Reserved.