com.softwareag.tamino.db.api.connection
Class TLocalTransactionMode

java.lang.Object
  extended by com.softwareag.tamino.db.api.connection.TTransactionMode
      extended by com.softwareag.tamino.db.api.connection.TLocalTransactionMode
All Implemented Interfaces:
TLocalTransaction, TTransaction

public class TLocalTransactionMode
extends TTransactionMode
implements TLocalTransaction

TLocalTransactionMode is the implementation of TTransactionMode for local transaction mode. It implements the update plug in method for the transaction mode. Also it implements the behaviour of writing the transaction mode to a TCommandStatement instance. It also implements the TLocalTransaction interface which the client uses for commiting and rolling back a transaction.

Version:
$Revision: 1.29 $
Author:
Marcus Schreyer

Constructor Summary
TLocalTransactionMode(TTransactionModeCoordinator transactionModeCoordinator)
          Initializes with the given session state.
 
Method Summary
 void begin()
          Begin this transaction mode.
 void commit()
          Performs a commit on the running transaction.
protected  void doUpdate(TStreamHeader header)
          Updates the transaction state according to the transaction specific content of the stream header.
 void end()
          End this transaction mode.
 boolean needsSessionState(TCommand command)
          Test whether the given command statement needs session state updating, i.e.
 void rollback()
          Performs a rollback on the running transaction.
 boolean supports(TCommand command)
          Indicates if the given command is supported within the current transaction mode.
 java.lang.String toString()
          Writes the current transaction mode into a String.
 void writeTo(TCommandStatement commandStatement)
          Writes the current transaction state to the given commandStatement.
 
Methods inherited from class com.softwareag.tamino.db.api.connection.TTransactionMode
getGenericAccessor, getLocale, getSessionState, getTransactionModeCoordinator, getTransactionParameters, getTransactionTimeoutParameters, isReleased, release, setLocale, update, use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.softwareag.tamino.db.api.connection.TTransaction
getLocale, setLocale
 

Constructor Detail

TLocalTransactionMode

public TLocalTransactionMode(TTransactionModeCoordinator transactionModeCoordinator)
Initializes with the given session state.

Method Detail

begin

public void begin()
           throws TAccessorException
Begin this transaction mode.

Specified by:
begin in class TTransactionMode
Throws:
TAccessorException

end

public void end()
         throws TAccessorException
End this transaction mode.

Specified by:
end in class TTransactionMode
Throws:
TAccessorException

commit

public void commit()
            throws TTransactionException
Performs a commit on the running transaction.

Specified by:
commit in interface TLocalTransaction
Throws:
TTransactionException - is thrown if the commit fails.

rollback

public void rollback()
              throws TTransactionException
Performs a rollback on the running transaction.

Specified by:
rollback in interface TLocalTransaction
Throws:
TTransactionException - is thrown if the rollback fails.

writeTo

public void writeTo(TCommandStatement commandStatement)
Writes the current transaction state to the given commandStatement.

Specified by:
writeTo in class TTransactionMode
Parameters:
commandStatement - gets the current transaction state.

supports

public boolean supports(TCommand command)
Indicates if the given command is supported within the current transaction mode. This is needed because there might be commands (currently only cursor specific commands) that cannot be used in a specific transaction mode.

Specified by:
supports in class TTransactionMode
Parameters:
command - is checked wheter it can be use with the current transaction mode.
Returns:
true if the given commandStatement can be used, false otherwise.

needsSessionState

public boolean needsSessionState(TCommand command)
Test whether the given command statement needs session state updating, i.e. sending sessionId/Key and updating.

Specified by:
needsSessionState in class TTransactionMode
Parameters:
command - test for this command.
Returns:
true -> session state update is needed, otherwise false.

doUpdate

protected void doUpdate(TStreamHeader header)
                 throws TSessionStateUpdateException
Updates the transaction state according to the transaction specific content of the stream header. Returns true if transaction state has been updated, false otherwise.

Specified by:
doUpdate in class TTransactionMode
Parameters:
header - is the TStreamHeader of a TInputStream instance.
Throws:
TSessionStateUpdateException - in case of a failure.

toString

public java.lang.String toString()
Writes the current transaction mode into a String.

Overrides:
toString in class java.lang.Object
Returns:
the current transaction mode as a String.


Copyright (c) 2013 Software AG. All Rights Reserved.