org.wso2.carbon.registry.core.jdbc.dataaccess
Class JDBCDatabaseTransaction

java.lang.Object
  extended by org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction
All Implemented Interfaces:
DatabaseTransaction

public class JDBCDatabaseTransaction
extends Object
implements DatabaseTransaction

This class represents a database transaction, which is used for databases that support JDBC.


Nested Class Summary
static class JDBCDatabaseTransaction.ManagedRegistryConnection
          Wrapped connection that manages connections making it possible to have connections to multiple databases.
 
Constructor Summary
JDBCDatabaseTransaction()
           
 
Method Summary
 void decNestedDepth()
          This method will decrement the nested depth of the transaction on the current session.
static JDBCDatabaseTransaction.ManagedRegistryConnection getConnection()
          Method to get connection.
static JDBCDatabaseTransaction.ManagedRegistryConnection getManagedRegistryConnection(Connection conn)
          Method to obtain a connection that is managed by the registry transactions implementation.
 int getNestedDepth()
          Method to obtain the depth of nesting of this transaction at a given point in time.
 void incNestedDepth()
          This method will increment the nested depth of the transaction on the current session.
 boolean isRollbacked()
          Method to determine whether this transaction has been rollbacked at least once.
 boolean isStarted()
          Method to determine whether a transaction is started or not.
 void popTransaction()
          Pop stacked transaction and replace the existing one with that.
 void pushTransaction()
          Push current transaction to a stack and make room for a new one.
static void removeConnection()
          Method to remove the connection from the transaction.
static void setConnection(Connection connection)
          Method to set connection.
 void setRollbacked(boolean rollbacked)
          Method to set whether this transaction has been rollbacked or not.
 void setStarted(boolean started)
          Method to set whether a transaction is started or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCDatabaseTransaction

public JDBCDatabaseTransaction()
Method Detail

pushTransaction

public void pushTransaction()
Description copied from interface: DatabaseTransaction
Push current transaction to a stack and make room for a new one.

Specified by:
pushTransaction in interface DatabaseTransaction

popTransaction

public void popTransaction()
Description copied from interface: DatabaseTransaction
Pop stacked transaction and replace the existing one with that.

Specified by:
popTransaction in interface DatabaseTransaction

isStarted

public boolean isStarted()
Description copied from interface: DatabaseTransaction
Method to determine whether a transaction is started or not.

Specified by:
isStarted in interface DatabaseTransaction
Returns:
whether a transaction is started or not.

setStarted

public void setStarted(boolean started)
Description copied from interface: DatabaseTransaction
Method to set whether a transaction is started or not.

Specified by:
setStarted in interface DatabaseTransaction
Parameters:
started - whether a transaction is started or not.

getConnection

public static JDBCDatabaseTransaction.ManagedRegistryConnection getConnection()
Method to get connection.

Returns:
the connection.

setConnection

public static void setConnection(Connection connection)
Method to set connection.

Parameters:
connection - the connection.

removeConnection

public static void removeConnection()
Method to remove the connection from the transaction.


incNestedDepth

public void incNestedDepth()
Description copied from interface: DatabaseTransaction
This method will increment the nested depth of the transaction on the current session.

Specified by:
incNestedDepth in interface DatabaseTransaction

decNestedDepth

public void decNestedDepth()
Description copied from interface: DatabaseTransaction
This method will decrement the nested depth of the transaction on the current session.

Specified by:
decNestedDepth in interface DatabaseTransaction

getNestedDepth

public int getNestedDepth()
Description copied from interface: DatabaseTransaction
Method to obtain the depth of nesting of this transaction at a given point in time.

Specified by:
getNestedDepth in interface DatabaseTransaction
Returns:
the nested depth.

isRollbacked

public boolean isRollbacked()
Description copied from interface: DatabaseTransaction
Method to determine whether this transaction has been rollbacked at least once. This applies to the out as well as inner transactions as a whole.

Specified by:
isRollbacked in interface DatabaseTransaction
Returns:
whether this transaction has been rollbacked.

setRollbacked

public void setRollbacked(boolean rollbacked)
Description copied from interface: DatabaseTransaction
Method to set whether this transaction has been rollbacked or not.

Specified by:
setRollbacked in interface DatabaseTransaction
Parameters:
rollbacked - whether this transaction has been rollbacked or not.

getManagedRegistryConnection

public static JDBCDatabaseTransaction.ManagedRegistryConnection getManagedRegistryConnection(Connection conn)
Method to obtain a connection that is managed by the registry transactions implementation. If the managed transaction is already closed, committed or rollbacked, this method will reinstate it.

Parameters:
conn - un-managed connection.
Returns:
managed connection.


Copyright © 2014 WSO2 Inc. All Rights Reserved.