pt.ist.fenixframework.backend.ogm
Class OgmTransactionManager

Package class diagram package OgmTransactionManager
java.lang.Object
  extended by pt.ist.fenixframework.backend.ogm.OgmTransactionManager
All Implemented Interfaces:
TransactionManager

public class OgmTransactionManager
extends Object
implements TransactionManager


Constructor Summary
OgmTransactionManager()
           
 
Method Summary
 void addCommitListener(CommitListener listener)
          Registers a commit listener, that will be called whenever any Transaction managed by this Manager is committed.
 void begin()
           
 void begin(boolean readOnly)
          Create a new transaction and associate it with the current thread.
 void commit()
           
 int getStatus()
           
 Transaction getTransaction()
          Get the Transaction object that represents the transaction context of the calling thread.
 void removeCommitListener(CommitListener listener)
          Unregisters the given commit listener.
 void resume(Transaction tx)
           
 void rollback()
           
 void setRollbackOnly()
           
 void setTransactionTimeout(int timeout)
           
 Transaction suspend()
           
<T> T
withTransaction(Callable<T> command)
          Transactionally execute a command, possibly returning a result.
<T> T
withTransaction(Callable<T> command, Atomic atomic)
          For now, it ignores the value of the atomic parameter.
<T> T
withTransaction(CallableWithoutException<T> command)
          Transactionally execute a command, possibly returning a result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OgmTransactionManager

public OgmTransactionManager()
Method Detail

begin

public void begin()
           throws NotSupportedException,
                  SystemException
Specified by:
begin in interface TransactionManager
Throws:
NotSupportedException
SystemException

begin

public void begin(boolean readOnly)
           throws NotSupportedException,
                  SystemException
Description copied from interface: TransactionManager
Create a new transaction and associate it with the current thread. This method can be used as a hint from the programmer that she does (or does not) intend do perform write operations. As such, implementations may optimize for the read-only case, and fail as soon as a write is attempted. However, if during the transaction the program attempts any write, and the transactional system is able to cope with the request, it may proceed without failing. In other words, write transactions are not guaranteed to rollback (i.e. they may commit) when invoking this method with true.

Throws:
NotSupportedException - Thrown if the thread is already associated with a transaction and the Transaction Manager implementation does not support nested transactions.
SystemException - Thrown if the transaction manager encounters an unexpected error condition that prevents future transaction services from proceeding.

commit

public void commit()
            throws RollbackException,
                   HeuristicMixedException,
                   HeuristicRollbackException,
                   SystemException
Specified by:
commit in interface TransactionManager
Throws:
RollbackException
HeuristicMixedException
HeuristicRollbackException
SystemException

getTransaction

public Transaction getTransaction()
Description copied from interface: TransactionManager
Get the Transaction object that represents the transaction context of the calling thread. Subsequent calls to this method, while in the scope of a given transaction, will always return the same instance.

Specified by:
getTransaction in interface TransactionManager

rollback

public void rollback()
              throws SystemException
Specified by:
rollback in interface TransactionManager
Throws:
SystemException

withTransaction

public <T> T withTransaction(CallableWithoutException<T> command)
Description copied from interface: TransactionManager
Transactionally execute a command, possibly returning a result. Implementations of this method normally invoke #withTransaction(Callable, Atomic) with a default atomic behaviour.

Parameters:
command - The command to execute.

withTransaction

public <T> T withTransaction(Callable<T> command)
                  throws Exception
Description copied from interface: TransactionManager
Transactionally execute a command, possibly returning a result. Implementations of this method normally invoke #withTransaction(Callable, Atomic) with a default atomic behaviour.

Parameters:
command - The command to execute.
Throws:
Exception

withTransaction

public <T> T withTransaction(Callable<T> command,
                             Atomic atomic)
                  throws Exception
For now, it ignores the value of the atomic parameter.

Parameters:
command - The command to execute
atomic - the configuration for the execution of this command.
Throws:
Exception

getStatus

public int getStatus()
              throws SystemException
Specified by:
getStatus in interface TransactionManager
Throws:
SystemException

resume

public void resume(Transaction tx)
            throws InvalidTransactionException,
                   IllegalStateException,
                   SystemException
Specified by:
resume in interface TransactionManager
Throws:
InvalidTransactionException
IllegalStateException
SystemException

setRollbackOnly

public void setRollbackOnly()
                     throws IllegalStateException,
                            SystemException
Specified by:
setRollbackOnly in interface TransactionManager
Throws:
IllegalStateException
SystemException

setTransactionTimeout

public void setTransactionTimeout(int timeout)
                           throws SystemException
Specified by:
setTransactionTimeout in interface TransactionManager
Throws:
SystemException

suspend

public Transaction suspend()
                    throws SystemException
Specified by:
suspend in interface TransactionManager
Throws:
SystemException

addCommitListener

public void addCommitListener(CommitListener listener)
Description copied from interface: TransactionManager
Registers a commit listener, that will be called whenever any Transaction managed by this Manager is committed.

Parameters:
listener - The listener to be added.
See Also:
TransactionManager.addCommitListener(pt.ist.fenixframework.CommitListener)

removeCommitListener

public void removeCommitListener(CommitListener listener)
Description copied from interface: TransactionManager
Unregisters the given commit listener.

Parameters:
listener - The listener to be removed.
See Also:
TransactionManager.removeCommitListener(pt.ist.fenixframework.CommitListener)


Copyright © 2013. All Rights Reserved.