org.exolab.core.foundation
Interface TransactionIfc

All Known Implementing Classes:
PMDSession

public interface TransactionIfc

This is an protocol for a Transaction. A Transaction is associated with one and only one session (a session serialises transactions) but may have be associated with one or more threads. A transaction can be in one three possible states.open, committed or closed. You can also begin, commit, abort or rollback a transaction (in this context abort and rollback are sematically identical since their is no support for savepoints). It also has a method called 'setRollbackOnly' which will force the transaction to be rolledback even if a commit is issued.

Version:
$Revision: 1.1 $ $Date: 2000/03/09 23:52:43 $
Author:
Jim Alateras

Method Summary
 void abort()
          Abort the current transaction.
 void begin()
          Put the transaction in the open state.
 void commit()
          Close the current transaction.
 TransactionContext getTransactionContext()
          Return the transaction context assoicated with this transaction
 boolean isOpened()
          Test if the transaction is opened.
 void rollback()
          Rollback the current transaction.
 void setRollbackOnly(boolean status)
          Set the transaction so that the only outcome is rollback.
 

Method Detail

begin

public void begin()
           throws TransactionInProgressException
Put the transaction in the open state. If the transaction is already opened then throw TransactionInProgressException

Throws:
TransactionInProgressException

commit

public void commit()
            throws TransactionNotInProgressException,
                   TransactionException,
                   DatabaseIOException
Close the current transaction. If the setRollbackOnly has been called while the transaction was open then a rollback is forced and the TransactionException exception is thrown.

If the transaction is not currently opened then TransactionNotInProg- ressException is raised.

Throws:
TransactionException
TransactionNotInProgressException
DatabaseIOException

abort

public void abort()
           throws TransactionNotInProgressException,
                  DatabaseIOException
Abort the current transaction. If there is no transaction currently in progress then throw TransactionNotInProgressException

Throws:
TransactionNotInProgressException
DatabaseIOException

rollback

public void rollback()
              throws TransactionNotInProgressException,
                     DatabaseIOException
Rollback the current transaction. If there is no transaction currently in progress then throw TransactionNotInProgressException

Throws:
TransactionNotInProgressException
DatabaseIOException

setRollbackOnly

public void setRollbackOnly(boolean status)
                     throws TransactionNotInProgressException
Set the transaction so that the only outcome is rollback. If there is no transaction in progress raise TransactionNotInProgressException.

Parameters:
status - true to set rollback only; false to clear the rollback only flag
Throws:
TransactionNotInProgressException

isOpened

public boolean isOpened()
Test if the transaction is opened.

Returns:
boolean true if opened; false otherwise

getTransactionContext

public TransactionContext getTransactionContext()
Return the transaction context assoicated with this transaction

Returns:
TransactionContext


Copyright © 1999-2005 The Exolab Group. All Rights Reserved.