Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » core » transaction » [javadoc | source]
org.apache.openejb.core.transaction
public interface: TransactionPolicy [javadoc | source]

All Known Implementing Classes:
    TxMandatory, SpringBeanTransactionPolicy, TxRequiresNew, StatefulBeanManagedTxPolicy, TxRequired, TxBeanManaged, BeanTransactionPolicy, TxSupports, TxNotSupported, JtaTransactionPolicy, SpringTransactionPolicy, MessageDrivenBeanManagedTxPolicy, StatelessBeanManagedTxPolicy, StatefulContainerManagedTxPolicy, TxNever, SessionSynchronizationTxPolicy

TransactionPolicy represents a JEE container managed or bean manage transaction.

This class can be used to query the transaction status, set the transaction rollback only flag, associate resources with the transaction and to register a listener for transaction completion events.
Nested Class Summary:
interface  TransactionPolicy.TransactionSynchronization  TransactionSynchronization receives notifications as the Transaction completes. 
Method from org.apache.openejb.core.transaction.TransactionPolicy Summary:
commit,   enlistResource,   getResource,   getTransactionType,   isClientTransaction,   isNewTransaction,   isRollbackOnly,   isTransactionActive,   putResource,   registerSynchronization,   removeResource,   setRollbackOnly
Method from org.apache.openejb.core.transaction.TransactionPolicy Detail:
 public  void commit() throws ApplicationException, SystemException
    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.
 public  void enlistResource(XAResource xaResource) throws SystemException
    Enlists a XAResource in the actual active transaction. This only works if the TransactionPolicy is associated with an actual transaction and the TransactionPolicy supports XAResouce enlistment.
 public Object getResource(Object key)
    Gets a resource associated with the specified key. If there is an actual transaction active, the resource associated with the transaction is returned; otherwise the resource is scoped to this TransactionPolicy.
 public TransactionType getTransactionType()
    Gets the TransactionType for this policy.
 public 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. If there is no active transaction (e.g., TransactionType is NotSupported), this method will return false.
 public 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. If there is no active transaction (e.g., TransactionType is NotSupported), this method will
 public boolean isRollbackOnly()
    If true, this TransactionPolicy will ultimately end with rollback.
 public boolean isTransactionActive()
    Is there a actual transaction active?
 public  void putResource(Object key,
    Object value)
    Associates the specified resource with the specified key. If there is an actual transaction active, the resource associated with the transaction is set; otherwise the resource is scoped to this TransactionPolicy.
 public  void registerSynchronization(TransactionSynchronization synchronization)
    Registers a listener for transaction synchronization events. If there is an actual transaction active, the events are fired when the acutal transaction is commited; otherwise the events are fired when this TransactionPolicy completes.
 public Object removeResource(Object key)
    Removes and returns the resource associated with the specified key. If there is an actual transaction active, the resource associated with the transaction is returned; otherwise the resource is scoped to this TransactionPolicy.
 public  void setRollbackOnly()
    Sets this TransactionPolicy to rollback when completed