com.scooterframework.transaction
Class AbstractTransactionImpl

java.lang.Object
  extended by com.scooterframework.transaction.AbstractTransactionImpl
All Implemented Interfaces:
Transaction
Direct Known Subclasses:
CmtTransaction, JdbcTransaction, JtaTransaction

public abstract class AbstractTransactionImpl
extends java.lang.Object
implements Transaction

AbstractTransactionImpl class has common methods.


Field Summary
protected  boolean bAllResourcesReleased
           
protected  boolean bTransactionHasCommitted
           
protected  boolean bTransactionHasEnded
           
protected  boolean bTransactionHasRollbacked
           
protected  boolean bTransactionHasStarted
           
protected  java.util.List<UserDatabaseConnection> connList
           
protected  java.util.concurrent.ConcurrentHashMap<java.lang.String,UserDatabaseConnection> nameConnMap
           
protected  java.lang.String transactionType
           
 
Fields inherited from interface com.scooterframework.transaction.Transaction
CMT_TRANSACTION_TYPE, JDBC_TRANSACTION_TYPE, JTA_TRANSACTION_TYPE, USER_TRANSACTION_JNDI_STRING
 
Constructor Summary
AbstractTransactionImpl()
          Initialize JdbcTransaction
 
Method Summary
 void begin()
          Start a transaction.
 void commit()
          Commit a transaction.
 UserDatabaseConnection getConnection()
          Return a connection to the database
 UserDatabaseConnection getConnection(DatabaseConnectionContext dcc)
          Return a connection based on connection context
 UserDatabaseConnection getConnection(java.lang.String connectionName)
          Return a connection to the database
 java.lang.String getTransactionType()
          Return transaction type
 boolean isAllResourcesReleased()
          Check if all resources have been released.
 boolean isTransactionEnded()
          Check if transaction has ended.
 boolean isTransactionStarted()
          Check if transaction has started.
 void releaseResources()
          Release all resources managed by this transaction.
 void rollback()
          Rollback a transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nameConnMap

protected java.util.concurrent.ConcurrentHashMap<java.lang.String,UserDatabaseConnection> nameConnMap

connList

protected java.util.List<UserDatabaseConnection> connList

transactionType

protected java.lang.String transactionType

bTransactionHasStarted

protected boolean bTransactionHasStarted

bTransactionHasEnded

protected boolean bTransactionHasEnded

bTransactionHasCommitted

protected boolean bTransactionHasCommitted

bTransactionHasRollbacked

protected boolean bTransactionHasRollbacked

bAllResourcesReleased

protected boolean bAllResourcesReleased
Constructor Detail

AbstractTransactionImpl

public AbstractTransactionImpl()
Initialize JdbcTransaction

Method Detail

getTransactionType

public java.lang.String getTransactionType()
Return transaction type


releaseResources

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

Specified by:
releaseResources in interface Transaction

begin

public void begin()
Start a transaction.

Specified by:
begin in interface Transaction

commit

public void commit()
Commit a transaction.

Specified by:
commit in interface Transaction

rollback

public void rollback()
Rollback a transaction.

Specified by:
rollback in interface Transaction

isTransactionStarted

public boolean isTransactionStarted()
Check if transaction has started.

Specified by:
isTransactionStarted in interface Transaction

isTransactionEnded

public boolean isTransactionEnded()
Check if transaction has ended.

Specified by:
isTransactionEnded in interface Transaction

isAllResourcesReleased

public boolean isAllResourcesReleased()
Check if all resources have been released.


getConnection

public UserDatabaseConnection getConnection()
Return a connection to the database

Specified by:
getConnection in interface Transaction
Returns:
UserDatabaseConnection

getConnection

public UserDatabaseConnection getConnection(java.lang.String connectionName)
Return a connection to the database

Specified by:
getConnection in interface Transaction
Parameters:
connectionName - name of a connection
Returns:
UserDatabaseConnection

getConnection

public UserDatabaseConnection getConnection(DatabaseConnectionContext dcc)
Return a connection based on connection context

Specified by:
getConnection in interface Transaction
Parameters:
dcc - a DatabaseConnectionContext instance
Returns:
UserDatabaseConnection