org.enhydra.barracuda.plankton.data
Class HttpSessionStateMap

java.lang.Object
  extended byorg.enhydra.barracuda.plankton.data.HttpSessionStateMap
All Implemented Interfaces:
StateMap

public class HttpSessionStateMap
extends Object
implements StateMap

The implementation provides a StateMap bridge to a HttpSession object. By this, we mean that this class allows you to treat an HttpSession as a StateMap. Unlike the HttpSession, this class will handle null keys, values.


Field Summary
protected  javax.servlet.http.HttpSession session
           
 
Constructor Summary
HttpSessionStateMap(javax.servlet.http.HttpSession isession)
          Public constructor.
 
Method Summary
 void clearState()
          clear all state information
 javax.servlet.http.HttpSession getSession()
          get a reference to the underlying HttpSession
 Object getState(Object key)
          get a property in this StateMap
 List getStateKeys()
          get a List of the keys for this StateMap (implementation is an ArrayList)
 Map getStateValues()
          get a copy of the underlying Map (in this case, we map all the attributes of the HttpSession structure into a Map and return that)
 void putState(Object key, Object val)
          set a property in this StateMap
 Object removeState(Object key)
          remove a property in this StateMap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected javax.servlet.http.HttpSession session
Constructor Detail

HttpSessionStateMap

public HttpSessionStateMap(javax.servlet.http.HttpSession isession)
Public constructor.

Parameters:
isession - the underlying servlet session structure
Method Detail

putState

public void putState(Object key,
                     Object val)
set a property in this StateMap

Specified by:
putState in interface StateMap
Parameters:
key - the key object
val - the value object

getState

public Object getState(Object key)
get a property in this StateMap

Specified by:
getState in interface StateMap
Parameters:
key - the key object
Returns:
the value for the given key

removeState

public Object removeState(Object key)
remove a property in this StateMap. This function was expanded in csc_082103_1 to support the notion of wildcarding, allowing you to remove multiple keys in one fell swoop. Basically, if the key is a String, which ends with an '*', then any keys that start with that string will be removed (and in this case, the method returns a Map of key/val pairs that got removed, rather than a single object that got removed). This approach is not quite as flexible as using regular expressions, but that would make us dependent on jdk1.4 (so we won't go there for now). Note that this class backs the ObjectRepository data structures, so this functionality applies there as well.

Specified by:
removeState in interface StateMap
Parameters:
key - the key object
Returns:
the object which was removed

getStateKeys

public List getStateKeys()
get a List of the keys for this StateMap (implementation is an ArrayList)

Specified by:
getStateKeys in interface StateMap
Returns:
a List the keys for this StateMap

getStateValues

public Map getStateValues()
get a copy of the underlying Map (in this case, we map all the attributes of the HttpSession structure into a Map and return that)

Specified by:
getStateValues in interface StateMap
Returns:
a copy of the underlying state Map

clearState

public void clearState()
clear all state information

Specified by:
clearState in interface StateMap

getSession

public javax.servlet.http.HttpSession getSession()
get a reference to the underlying HttpSession

Returns:
a reference to the underlying HttpSession


Copyright © 2003 BarracudaMVC.org All Rights Reserved.