com.scooterframework.transaction
Class ThreadLocalTransactionManager

java.lang.Object
  extended by com.scooterframework.transaction.ThreadLocalTransactionManager
All Implemented Interfaces:
ImplicitTransactionManager, TransactionManager, TransactionStarterType

public class ThreadLocalTransactionManager
extends java.lang.Object
implements TransactionStarterType, TransactionManager, ImplicitTransactionManager

ThreadLocalTransactionManager class implements TransactionStarterType, TransactionManager and ImplicitTransactionManager interfaces.


Field Summary
 
Fields inherited from interface com.scooterframework.transaction.TransactionStarterType
TRANSACTION_STARTER_IMPLICIT
 
Constructor Summary
ThreadLocalTransactionManager()
           
 
Method Summary
 void beginTransaction()
          Begin a transaction.
 void beginTransaction(java.lang.String type)
          Begin a transaction of a specific type.
 void beginTransactionImplicit()
          Begin a transaction implicitly.
 void commitTransaction()
          Commit a transaction.
 void commitTransactionImplicit()
          Commit a transaction implicitly.
 Transaction getTransaction()
          Returns a Transaction instance associated with current thread.
 java.lang.String getTransactionStarterType()
          Set a type of transaction starter.
 boolean isAutoTransaction()
          Return true if the transaction is started automatically, false if the transaction is started by client calls beginTransaciton() or beginTransaciton(type) explicitly.
 void releaseResources()
          Release all resources hold by this transaction.
 void releaseResourcesImplicit()
          Release all resources hold by this transaction implicitly.
 void rollbackTransaction()
          Rollback a transaction.
 void rollbackTransactionImplicit()
          Rollback a transaction implicitly.
 void setTransaction(Transaction tx)
          Set a Transaction instance associated with the current thread.
 void setTransactionStarterType(java.lang.String type)
          Set a type of transaction starter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadLocalTransactionManager

public ThreadLocalTransactionManager()
Method Detail

beginTransaction

public void beginTransaction()
Begin a transaction.

Specified by:
beginTransaction in interface TransactionManager

beginTransaction

public void beginTransaction(java.lang.String type)
Begin a transaction of a specific type.

Specified by:
beginTransaction in interface TransactionManager

commitTransaction

public void commitTransaction()
Commit a transaction.

Specified by:
commitTransaction in interface TransactionManager

rollbackTransaction

public void rollbackTransaction()
Rollback a transaction.

Specified by:
rollbackTransaction in interface TransactionManager

releaseResources

public void releaseResources()
Release all resources hold by this transaction.

Specified by:
releaseResources in interface TransactionManager

getTransaction

public Transaction getTransaction()
Returns a Transaction instance associated with current thread.

Specified by:
getTransaction in interface TransactionManager
Returns:
Transaction

setTransaction

public void setTransaction(Transaction tx)
Set a Transaction instance associated with the current thread.

Specified by:
setTransaction in interface TransactionManager

isAutoTransaction

public boolean isAutoTransaction()
Return true if the transaction is started automatically, false if the transaction is started by client calls beginTransaciton() or beginTransaciton(type) explicitly.

Specified by:
isAutoTransaction in interface TransactionStarterType
Returns:
true if auto started transaction, false otherwise.

getTransactionStarterType

public java.lang.String getTransactionStarterType()
Set a type of transaction starter.

Specified by:
getTransactionStarterType in interface TransactionStarterType

setTransactionStarterType

public void setTransactionStarterType(java.lang.String type)
Set a type of transaction starter.

Specified by:
setTransactionStarterType in interface TransactionStarterType

beginTransactionImplicit

public void beginTransactionImplicit()
Begin a transaction implicitly.

Specified by:
beginTransactionImplicit in interface ImplicitTransactionManager

commitTransactionImplicit

public void commitTransactionImplicit()
Commit a transaction implicitly.

Specified by:
commitTransactionImplicit in interface ImplicitTransactionManager

rollbackTransactionImplicit

public void rollbackTransactionImplicit()
Rollback a transaction implicitly.

Specified by:
rollbackTransactionImplicit in interface ImplicitTransactionManager

releaseResourcesImplicit

public void releaseResourcesImplicit()
Release all resources hold by this transaction implicitly.

Specified by:
releaseResourcesImplicit in interface ImplicitTransactionManager