com.metamatrix.common.transaction.manager
Class SimpleUserTransaction

java.lang.Object
  extended by com.metamatrix.common.transaction.manager.SimpleUserTransaction
All Implemented Interfaces:
UserTransaction

public class SimpleUserTransaction
extends java.lang.Object
implements UserTransaction


Constructor Summary
SimpleUserTransaction()
           
SimpleUserTransaction(java.lang.Object source)
           
 
Method Summary
 void begin()
          Create a new transaction and associate it with this object.
 void commit()
          Complete the transaction associated with this object.
 java.lang.Object getSource()
          Return the (optional) reference to the object that is considered the source of the transaction represented by this object.
 int getStatus()
          Obtain the status of the transaction represented by this object.
 void rollback()
          Roll back the transaction associated with this object.
 void setRollbackOnly()
          Modify the transaction associated with this object such that the only possible outcome of the transaction is to roll back the transaction.
 void setSource(java.lang.Object source)
           
 void setTransactionTimeout(int seconds)
          Modify the value of the timeout value that is associated with the transactions represented by this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleUserTransaction

public SimpleUserTransaction()

SimpleUserTransaction

public SimpleUserTransaction(java.lang.Object source)
Method Detail

setSource

public void setSource(java.lang.Object source)

getStatus

public int getStatus()
              throws TransactionException
Obtain the status of the transaction represented by this object.

Specified by:
getStatus in interface UserTransaction
Returns:
The transaction status.
Throws:
TransactionException

begin

public void begin()
           throws TransactionException
Create a new transaction and associate it with this object.

Specified by:
begin in interface UserTransaction
Throws:
TransactionNotSupportedException - if the current thread is already associated with a transaction and the manager does not support nested system transactions.
TransactionException

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws TransactionException
Modify the value of the timeout value that is associated with the transactions represented by this object. If an application has not called this method, the transaction service uses some default value for the transaction timeout.

Specified by:
setTransactionTimeout in interface UserTransaction
Parameters:
seconds - The value of the timeout in seconds. If the value is zero, the transaction service restores the default value.
Throws:
java.lang.IllegalStateException - Thrown if this object is not associated with a transaction
TransactionException

setRollbackOnly

public void setRollbackOnly()
                     throws TransactionException
Modify the transaction associated with this object such that the only possible outcome of the transaction is to roll back the transaction.

Specified by:
setRollbackOnly in interface UserTransaction
Throws:
java.lang.IllegalStateException - Thrown if this object is not associated with a transaction.
TransactionException

commit

public void commit()
            throws TransactionException
Complete the transaction associated with this object. When this method completes, the thread becomes associated with no transaction.

Specified by:
commit in interface UserTransaction
Throws:
java.lang.IllegalStateException - Thrown if this object is not associated with a transaction.
TransactionException

rollback

public void rollback()
              throws TransactionException
Roll back the transaction associated with this object. When this method completes, the thread becomes associated with no transaction.

Specified by:
rollback in interface UserTransaction
Throws:
java.lang.IllegalStateException - Thrown if this object is not associated with a transaction.
TransactionException

getSource

public java.lang.Object getSource()
                           throws TransactionException
Return the (optional) reference to the object that is considered the source of the transaction represented by this object. This is used, for example, to set the source of all events occuring within this transaction.

Specified by:
getSource in interface UserTransaction
Returns:
the source object, which may be null
Throws:
TransactionException


Copyright © 2009. All Rights Reserved.