SilverStream
Application Server 3.5

com.sssw.atg.persist
Class AgoPersistentStateManager

java.lang.Object
 |
 +--com.sssw.atg.persist.AgoPersistentStateManager

public class AgoPersistentStateManager
extends Object

Class that provides the programmer with a mechanism for the management and recovery of persistent application state.


Constructor Summary
AgoPersistentStateManager()
           
 
Method Summary
 void clear()
          Clears this AgoPersistentStateManager so that it contains no keys and values.
 boolean commit()
          Commits all key/value pairs that have been stored in this AgoPersistentStateManager to the persistent store.
 Integer evaluateState(AgiHttpServletRequest req, AgiHttpServletResponse resp)
          Evaluates the current state of this AgoPersistentStateManager object by comparing a cached persistent session ID to a persistent session ID that is stored in a temporary cookie in the browser.
 Object get(Serializable key)
          Returns the value to which the specified key is mapped in the AgoPersistentStateManager; returns null if the key is not mapped to any value in the AgoPersistentStateManager.
 boolean getAutoCommit()
          Returns the boolean value of the autocommit property within the AgoPersistentStateManager.
static AgoPersistentStateManager getPersistentStateManager(AgiHttpServletRequest req, AgiHttpServletResponse resp, String appID)
          Static factory method that returns a PersistentStateManager object containing the current state of the application.
 Hashtable getStateHashtable()
          Returns a hashtable containing all of the key/value pairs that have been stored in this AgoPersistentStateManager object.
 Integer getStatus()
          Returns an Integer representing the status of the AgoPersistentStateManager.
 void put(Serializable key, Serializable value)
          Maps the specified key to the specified value in the AgoPersistentStateManager.
 void remove(Serializable key)
          Removes the key (and its corresponding value) from this AgoPersistentStateManager.
 void setAutoCommit(boolean flag)
          Sets the autocommit property of this AgoPersistentStateManager.
 void setAutoCommit(boolean flag, boolean commitImmediate)
          Sets the autocommit property of this AgoPersistentStateManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgoPersistentStateManager

public AgoPersistentStateManager()
Method Detail

getPersistentStateManager

public static AgoPersistentStateManager getPersistentStateManager(AgiHttpServletRequest req,
                                                                  AgiHttpServletResponse resp,
                                                                  String appID)
                                                           throws Exception
Static factory method that returns a PersistentStateManager object containing the current state of the application.
Parameters:
req - The request from which the AgoPersistentStateManager object evaluates the current application state.
resp - The response on which the AgoPersistentStateManager object will set a temporary cookie holding the current persistent session ID.
appID - A String representing the application for which you would like an AgoPersistentStateManager object. This String must match an application ID that has been defined in the PersistentSession.props file.

put

public void put(Serializable key,
                Serializable value)
Maps the specified key to the specified value in the AgoPersistentStateManager. Neither the key nor the value can be null. The value can be retrieved by calling the get method with a key that is equal to the original key.
Parameters:
key - An AgoPersistentStateManager key
value - The value

get

public Object get(Serializable key)
Returns the value to which the specified key is mapped in the AgoPersistentStateManager; returns null if the key is not mapped to any value in the AgoPersistentStateManager.
Parameters:
key - A key in the AgoPersistentStateManager

remove

public void remove(Serializable key)
Removes the key (and its corresponding value) from this AgoPersistentStateManager. This method does nothing if the key is not in the AgoPersistentStateManager.
Parameters:
key - An AgoPersistentStateManager key

clear

public void clear()
Clears this AgoPersistentStateManager so that it contains no keys and values.

commit

public boolean commit()
Commits all key/value pairs that have been stored in this AgoPersistentStateManager to the persistent store. The persistent store must be implemented and specified in the PersistentSession.props file. This method will return a boolean true if successful and a false otherwise

getStateHashtable

public Hashtable getStateHashtable()
Returns a hashtable containing all of the key/value pairs that have been stored in this AgoPersistentStateManager object. The returned Hashtable represents the current application state

getStatus

public Integer getStatus()
Returns an Integer representing the status of the AgoPersistentStateManager.

setAutoCommit

public void setAutoCommit(boolean flag)
                   throws Exception
Sets the autocommit property of this AgoPersistentStateManager. If the autocommit property is true, the key/value pairs that are stored in the AgoPersistentStateManager object are written to the persistent store every time the put method is executed. If false, the commit method must be called explicitly in order to write state data to the persistent store. The autocommit property (and all pending key/value pairs) will be committed immediately to the persistent store.
Parameters:
flag - boolean indicating whether autocommit is true or false

setAutoCommit

public void setAutoCommit(boolean flag,
                          boolean commitImmediate)
                   throws Exception
Sets the autocommit property of this AgoPersistentStateManager. If the autocommit property is true, the key/value pairs that are stored in the AgoPersistentStateManager object are written to the persistent store every time the put method is executed. If false, the commit method must be called explicitly in order to write state data to the persistent store.
Parameters:
flag - boolean indicating whether autocommit is true or false
commitImmediate - boolean indicating whether the autocommit property (and all pending key/value pairs) should be committed immediately to the persistent store or committed when the next explicit commit is issued.

getAutoCommit

public boolean getAutoCommit()
Returns the boolean value of the autocommit property within the AgoPersistentStateManager.

evaluateState

public Integer evaluateState(AgiHttpServletRequest req,
                             AgiHttpServletResponse resp)
                      throws Exception
Evaluates the current state of this AgoPersistentStateManager object by comparing a cached persistent session ID to a persistent session ID that is stored in a temporary cookie in the browser.
Parameters:
req - The request from which the AgoPersistentStateManager object evaluates the current application state. This method returns an Integer representing the status of the AgoPersistentStateManager.
resp - The response on which the AgoPersistentStateManager object will set a temporary cookie holding the current persistent session ID.

SilverStream
Application Server 3.5