org.barracudamvc.plankton.data
Class ServletContextStateMap

java.lang.Object
  extended byorg.barracudamvc.plankton.data.ServletContextStateMap
All Implemented Interfaces:
StateMap

public class ServletContextStateMap
extends Object
implements StateMap

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


Field Summary
protected  javax.servlet.ServletContext context
           
 
Constructor Summary
ServletContextStateMap(javax.servlet.ServletContext icontext)
          Public constructor.
 
Method Summary
 void clearState()
          clear all state information
 javax.servlet.ServletContext getContext()
          get a reference to the underlying ServletContext
 Object getState(Object key)
          get a property in this StateMap
 Set getStateKeys()
          get a keyset for this StateMap (whether or not the set is backed by the data store depends on the implementation).
 Map getStateStore()
          get a Map that holds the state values (whether or not the Map is backed by the data store depends on the implementation).
 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

context

protected javax.servlet.ServletContext context
Constructor Detail

ServletContextStateMap

public ServletContextStateMap(javax.servlet.ServletContext icontext)
Public constructor.

Parameters:
icontext - the underlying servlet context 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

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

getStateKeys

public Set getStateKeys()
get a keyset for this StateMap (whether or not the set is backed by the data store depends on the implementation). In this particular case, the set is just a COPY of the underlying data structure

Specified by:
getStateKeys in interface StateMap
Returns:
a Set of keys for this StateMap

getStateStore

public Map getStateStore()
get a Map that holds the state values (whether or not the Map is backed by the data store depends on the implementation). In this particular case, the map is a COPY of the underlying data store itself (ServletContext)

Specified by:
getStateStore in interface StateMap
Returns:
a Map of key/val pairs for this StateMap

clearState

public void clearState()
clear all state information

Specified by:
clearState in interface StateMap

getContext

public javax.servlet.ServletContext getContext()
get a reference to the underlying ServletContext

Returns:
a reference to the underlying ServletContext


Copyright © 2004 BarracudaMVC.org All Rights Reserved.