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

java.lang.Object
  extended by com.softwareag.tamino.db.api.connection.TSessionState

public class TSessionState
extends java.lang.Object

TSesssionState is the abstraction of the state information of a Tamino session. Such a session provides setters and getters for the sessionid, sessionkey.

Version:
$Revision: 1.26 $
Author:
Marcus Schreyer

Constructor Summary
protected TSessionState()
          Initializes the session state.
 
Method Summary
 java.lang.String getSessionId()
          Gets the session id.
 java.lang.String getSessionKey()
          Gets the session key.
 boolean isGiven()
          Indicates if a session state (sessionId,sessionKey) is given.
protected  boolean isHealthy()
          Indicates whether the session state is healthy or not.
 void reset()
          Resets the current session state.
 void setLocale(java.util.Locale locale)
          Sets the locale.
protected  void setSessionId(java.lang.String newSessionId)
          Sets the session id.
protected  void setSessionKey(java.lang.String newSessionKey)
          Sets the session key.
 java.lang.String toString()
          Writes the current session state into a String.
 void update(java.lang.String newSessionId, java.lang.String newSessionKey)
          Updates the session state with given sessionId and sessionKey.
protected  void update(TStreamHeader header)
          Updates the session state according to the session specific content of the stream header.
protected  void writeTo(TCommandStatement commandStatement)
          Writes the current session state to the given commandStatement.
protected  void writeTo(TStreamHeader streamHeader)
          Writes the current transaction state to the given stream header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TSessionState

protected TSessionState()
Initializes the session state.

Method Detail

writeTo

protected void writeTo(TCommandStatement commandStatement)
Writes the current session state to the given commandStatement.

Parameters:
commandStatement - gets the current transaction state.

writeTo

protected void writeTo(TStreamHeader streamHeader)
Writes the current transaction state to the given stream header. This is done by writing to the connections request properties (header).

Parameters:
streamHeader - get the current transaction mode within its header.

update

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

Parameters:
header - is the TStreamHeader of a TInputStream instance.
Throws:
TSessionStateUpdateException - in case of a failure.

update

public void update(java.lang.String newSessionId,
                   java.lang.String newSessionKey)
            throws TSessionStateUpdateException
Updates the session state with given sessionId and sessionKey.

Parameters:
newSessionId - is the new newSessionId.
newSessionKey - is the new newSessionKey.
Throws:
TSessionStateUpdateException - in case of a failure.

reset

public void reset()
Resets the current session state.


setSessionId

protected void setSessionId(java.lang.String newSessionId)
Sets the session id.

Parameters:
sessionId - is the current session id.

setSessionKey

protected void setSessionKey(java.lang.String newSessionKey)
Sets the session key.

Parameters:
sessionKey - is the current session key.

getSessionId

public java.lang.String getSessionId()
Gets the session id.

Returns:
The session id.

getSessionKey

public java.lang.String getSessionKey()
Gets the session key.

Returns:
The session key.

isGiven

public boolean isGiven()
Indicates if a session state (sessionId,sessionKey) is given.

Returns:
true if session state is referred to a given (open) session, false otherwise.

isHealthy

protected boolean isHealthy()
Indicates whether the session state is healthy or not. It is not healthy when no valid session id/key are available. Once this happens no commands can be sent successfully to Tamino anymore.

Returns:
boolean indicating whether the session state is healthy or not.

toString

public java.lang.String toString()
Writes the current session state into a String.

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

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale.



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