org.compass.core.transaction
Class UserTransactionAdapter

java.lang.Object
  extended by org.compass.core.transaction.UserTransactionAdapter
All Implemented Interfaces:
UserTransaction

public class UserTransactionAdapter
extends Object
implements UserTransaction

Adapter for a JTA UserTransaction handle, taking a JTA TransactionManager reference and creating a JTA UserTransaction handle for it.

The JTA UserTransaction interface is an exact subset of the JTA TransactionManager interface. Unfortunately, it does not serve as super-interface of TransactionManager, though, which requires an adapter such as this class to be used when intending to talk to a TransactionManager handle through the UserTransaction interface.

Author:
Wayne Robinson, kimchy

Constructor Summary
UserTransactionAdapter(TransactionManager transactionManager)
          Create a new UserTransactionAdapter.
 
Method Summary
 void begin()
           
 void commit()
           
 int getStatus()
           
 TransactionManager getTransactionManager()
          Return the JTA TransactionManager that this adapter delegates to.
 void rollback()
           
 void setRollbackOnly()
           
 void setTransactionTimeout(int timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserTransactionAdapter

public UserTransactionAdapter(TransactionManager transactionManager)
                       throws CompassException
Create a new UserTransactionAdapter.

Parameters:
transactionManager - the JTA TransactionManager
Throws:
CompassException
Method Detail

getTransactionManager

public TransactionManager getTransactionManager()
Return the JTA TransactionManager that this adapter delegates to.


begin

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

commit

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

getStatus

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

rollback

public void rollback()
              throws IllegalStateException,
                     SecurityException,
                     SystemException
Specified by:
rollback in interface UserTransaction
Throws:
IllegalStateException
SecurityException
SystemException

setRollbackOnly

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

setTransactionTimeout

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


Copyright (c) 2004-2008 The Compass Project.