org.apache.openejb.core.transaction
Class TxBeanManaged

java.lang.Object
  extended by org.apache.openejb.core.transaction.JtaTransactionPolicy
      extended by org.apache.openejb.core.transaction.TxBeanManaged
All Implemented Interfaces:
BeanTransactionPolicy, TransactionPolicy

public class TxBeanManaged
extends JtaTransactionPolicy
implements BeanTransactionPolicy


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.openejb.core.transaction.BeanTransactionPolicy
BeanTransactionPolicy.SuspendedTransaction
 
Nested classes/interfaces inherited from interface org.apache.openejb.core.transaction.TransactionPolicy
TransactionPolicy.TransactionSynchronization
 
Field Summary
 
Fields inherited from class org.apache.openejb.core.transaction.JtaTransactionPolicy
logger, transactionManager, transactionType, txLogger
 
Constructor Summary
TxBeanManaged(TransactionManager transactionManager)
           
 
Method Summary
 void commit()
          Commits or rolls back this TransactionPolicy.
 Transaction getCurrentTransaction()
           
 UserTransaction getUserTransaction()
          Gets the UserTransaction the bean uses to manage the transaction.
 boolean isClientTransaction()
          Is this policy running in an inhreited transaction? Some TransactionTypes, such as Required or Supported, use the caller's transaction instead of starting a new transaction.
 boolean isNewTransaction()
          Is this a new transaction and not an inhreited transaction or no transaction? Some TransactionTypes, such as Required or Supported, use the caller's transaction instead of starting a new transaction.
 void resumeUserTransaction(BeanTransactionPolicy.SuspendedTransaction suspendedTransaction)
          Resumes the transaction contained in the suspended transaction token.
 BeanTransactionPolicy.SuspendedTransaction suspendUserTransaction()
          Syspends the bean managed transaction.
 
Methods inherited from class org.apache.openejb.core.transaction.JtaTransactionPolicy
beginTransaction, completeTransaction, enlistResource, fireNonTransactionalCompletion, getResource, getTransaction, getTransactionType, isRollbackOnly, isTransactionActive, putResource, registerSynchronization, removeResource, resumeTransaction, rollbackTransaction, setRollbackOnly, setRollbackOnly, suspendTransaction, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.openejb.core.transaction.TransactionPolicy
enlistResource, getResource, getTransactionType, isRollbackOnly, isTransactionActive, putResource, registerSynchronization, removeResource, setRollbackOnly
 

Constructor Detail

TxBeanManaged

public TxBeanManaged(TransactionManager transactionManager)
              throws SystemException
Throws:
SystemException
Method Detail

isNewTransaction

public boolean isNewTransaction()
Description copied from interface: TransactionPolicy
Is this a new transaction and not an inhreited transaction or no transaction? Some TransactionTypes, such as Required or Supported, use the caller's transaction instead of starting a new transaction. If there is no active transaction (e.g., TransactionType is NotSupported), this method will

Specified by:
isNewTransaction in interface TransactionPolicy
Returns:
true if this not an inherited transaction

isClientTransaction

public boolean isClientTransaction()
Description copied from interface: TransactionPolicy
Is this policy running in an inhreited transaction? Some TransactionTypes, such as Required or Supported, use the caller's transaction instead of starting a new transaction. If there is no active transaction (e.g., TransactionType is NotSupported), this method will return false.

Specified by:
isClientTransaction in interface TransactionPolicy
Returns:
true if this is an inherited transaction

getCurrentTransaction

public Transaction getCurrentTransaction()
Specified by:
getCurrentTransaction in class JtaTransactionPolicy

getUserTransaction

public UserTransaction getUserTransaction()
Description copied from interface: BeanTransactionPolicy
Gets the UserTransaction the bean uses to manage the transaction.

Specified by:
getUserTransaction in interface BeanTransactionPolicy
Returns:
the UserTransaction the bean uses to manage the transaction

suspendUserTransaction

public BeanTransactionPolicy.SuspendedTransaction suspendUserTransaction()
                                                                  throws SystemException
Description copied from interface: BeanTransactionPolicy
Syspends the bean managed transaction. This is mainly used by stateful session beans which are required to maintain the bean managed transaction between calls. After this method completes the transaction will be suspended or if there is a problem it will be rolled back.

Specified by:
suspendUserTransaction in interface BeanTransactionPolicy
Returns:
the syspended transaction token or null if no transaction was active
Throws:
SystemException - if there was a problem suspending the transaction

resumeUserTransaction

public void resumeUserTransaction(BeanTransactionPolicy.SuspendedTransaction suspendedTransaction)
                           throws SystemException
Description copied from interface: BeanTransactionPolicy
Resumes the transaction contained in the suspended transaction token. After this method completes the transaction will be resumes or if there is a problem it will be rolled back.

Specified by:
resumeUserTransaction in interface BeanTransactionPolicy
Parameters:
suspendedTransaction - the transaction to resume; not null
Throws:
SystemException - if there was a problem resuming the transaction

commit

public void commit()
            throws ApplicationException,
                   SystemException
Description copied from interface: TransactionPolicy
Commits or rolls back this TransactionPolicy. If there the actual transaction is completed or there is no actual transaction, the registered TransactionSynchronization are called. Otherwise, the registered TransactionSynchronization are called when the actual transaction is completed.

Specified by:
commit in interface TransactionPolicy
Throws:
ApplicationException - if recoverable exception is encountered
SystemException - if an unrecoverable exception is encountered


Copyright © 1999-2013 The Apache OpenEJB development community. All Rights Reserved.