org.oreodata.transaction
Interface TransactionalDataSource

All Superinterfaces:
DataListener, java.util.EventListener, OreoDataSource, java.rmi.Remote
All Known Implementing Classes:
JDBCTransactionalDataSource

public interface TransactionalDataSource
extends OreoDataSource

An interface that represents the contract of an Oreo DataSource that supports transactions. Note that this interface defines methods for the basic CRUD operations that take an extra parameter, the txnID (transaction ID). To start a transaction, you use the newTransaction() method to get a transactionID parameter. In a web-based application the txnID is a parameter that becomes associated with a user session. Note that concrete implementations of this interface will typically wrap some external transactional data source, so the exact transaction isolation semantics will depend on the underlying implementation.


Method Summary
 void abortTransaction(java.lang.String txnID)
          cancel the transaction associated with the ID
 void commit(java.lang.String txnID)
          Commit the transaction that is identified by this txnID
 void delete(java.lang.String type, java.lang.Object key, java.lang.String txnID)
          delete the Record of the given type and primary key taking into account the transaction which this is part of.
 Record get(java.lang.String type, java.lang.Object key, java.lang.String txnID)
           
 Transaction getTransaction(java.lang.String txnID)
           
 void insert(Record rec, java.lang.String txnID)
          update the Record taking into account the transaction which this is part of.
 java.lang.String newTransaction()
           
 void rollback(java.lang.String txnID)
          Roll back the transaction
 java.util.List select(RecordFilter filter, java.lang.String txnID)
           
 void update(Record oldRec, Record newRec, java.lang.String txnID)
          update the Record taking into account the transaction which this is part of.
 
Methods inherited from interface org.oreodata.OreoDataSource
addDataListener, close, delete, delete, get, get, getName, init, insert, keys, keys, lookup, reload, reload, removeDataListener, select, select, update, wipeCache, writeElement, writeSnapshot
 
Methods inherited from interface org.oreodata.DataListener
handleEvent
 

Method Detail

insert

public void insert(Record rec,
                   java.lang.String txnID)
            throws java.io.IOException
update the Record taking into account the transaction which this is part of.

java.io.IOException

update

public void update(Record oldRec,
                   Record newRec,
                   java.lang.String txnID)
            throws java.io.IOException
update the Record taking into account the transaction which this is part of.

java.io.IOException

delete

public void delete(java.lang.String type,
                   java.lang.Object key,
                   java.lang.String txnID)
            throws java.io.IOException
delete the Record of the given type and primary key taking into account the transaction which this is part of.

java.io.IOException

get

public Record get(java.lang.String type,
                  java.lang.Object key,
                  java.lang.String txnID)
           throws java.io.IOException
Returns:
the Record of the given type and primary key taking into account the transaction which this is part of.
java.io.IOException

select

public java.util.List select(RecordFilter filter,
                             java.lang.String txnID)
                      throws java.io.IOException
Returns:
a List of records that meet the criterion encapsulated by the filter arg, taking into account the transaction which this is part of.
java.io.IOException

commit

public void commit(java.lang.String txnID)
            throws java.io.IOException
Commit the transaction that is identified by this txnID

java.io.IOException

rollback

public void rollback(java.lang.String txnID)
              throws java.io.IOException
Roll back the transaction

java.io.IOException

newTransaction

public java.lang.String newTransaction()
                                throws java.io.IOException
Returns:
a unique ID for a new transaction.
java.io.IOException

abortTransaction

public void abortTransaction(java.lang.String txnID)
                      throws java.io.IOException
cancel the transaction associated with the ID

java.io.IOException

getTransaction

public Transaction getTransaction(java.lang.String txnID)
                           throws java.io.IOException
Returns:
the actual org.oreodata.transaction.Transaction object associated with this transaction ID.
java.io.IOException