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

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

public class TGlobalTransactionMode
extends TTransactionMode
implements TGlobalTransaction

TGlobalTransactionMode is the implementation of TTransactionMode for global 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.

Version:
$Revision: 1.22 $
Author:
Marcus Schreyer

Constructor Summary
TGlobalTransactionMode(TTransactionModeCoordinator transactionModeCoordinator)
          Initializes with the given session state.
 
Method Summary
 void begin()
          Begin this transaction mode.
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.
 void enlist(TGlobalTransactionSpecifier globalTransactionSpecifier)
          Use the given parameter for a global transaction.
 boolean needsSessionState(TCommand command)
          Test whether the given command statement needs session state updating, i.e.
 void setGlobalTransactionSpecifier(TGlobalTransactionSpecifier globalTransactionSpecifier)
          Sets the global transaction specifier.
 boolean supports(TCommand command)
          Indicates if the given command is supported within the current transaction mode.
 java.lang.String toString()
          Writes the current transaction state 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

TGlobalTransactionMode

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

Method Detail

setGlobalTransactionSpecifier

public void setGlobalTransactionSpecifier(TGlobalTransactionSpecifier globalTransactionSpecifier)
Sets the global transaction specifier.

Parameters:
globalTransactionSpecifier - the global transaction specifier.

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.

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

enlist

public void enlist(TGlobalTransactionSpecifier globalTransactionSpecifier)
            throws TTransactionException
Use the given parameter for a global transaction. globalTransactionSpecifier the global transaction specifier. Should be originated by a transaction controller.

Specified by:
enlist in interface TGlobalTransaction
Parameters:
globalTransactionSpecifier - the global transaction specifier. Should be originated by a transaction controller.
Throws:
TTransactionException - signals an error while attempting the enlist operation.

doUpdate

protected void doUpdate(TStreamHeader header)
                 throws TSessionStateUpdateException
Updates the transaction state according to the transaction specific content of the stream header. Returns true of 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 state into a String.

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


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