org.apache.commons.workflow.web
Class HttpSessionScope

java.lang.Object
  extended by org.apache.commons.workflow.base.BaseScope
      extended by org.apache.commons.workflow.web.HttpSessionScope
All Implemented Interfaces:
Map, Scope

public class HttpSessionScope
extends BaseScope

HttpSessionScope is a specialized Scope implementation corresponding the the attributes of a specified HttpSession.

Version:
$Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
Author:
Craig R. McClanahan

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry
 
Field Summary
protected  javax.servlet.http.HttpSession httpSession
          The HTTP session with which we are associated.
 
Fields inherited from class org.apache.commons.workflow.base.BaseScope
map, support
 
Constructor Summary
HttpSessionScope()
          Construct a new HttpSessionScope with no attached HttpSession.
HttpSessionScope(javax.servlet.http.HttpSession httpSession)
          Construct a HttpSessionScope associated with the specified HttpSession.
 
Method Summary
 void clear()
          Remove all beans from this Map and call scopeCleared() on all registered ScopeListeners.
 boolean containsKey(Object key)
          Return true if this map contains the specified key.
 boolean containsValue(Object value)
          Return true if this map contains the specified value.
 Set entrySet()
          Return a set view of the mappings contained in this map.
 boolean equals(Object object)
          Compare the specified object with this map for equality.
 Object get(Object key)
          Return the value to which this map maps the specified key.
 Object get(String key)
          Return the value to which this map maps the specified key.
 javax.servlet.http.HttpSession getHttpSession()
           
 int hashCode()
          Return the hash code value for this map.
 boolean isEmpty()
          Return true if this map is empty.
 Set keySet()
          Return a set view of the keys contained in this map.
 Object put(Object key, Object bean)
          Add or replace the bean associated with the specified key.
 Object put(String key, Object bean)
          Add the specified bean, associated with the specified key, to this scope and replace any previous bean associated with this key.
 void putAll(Map in)
          Copy all of the mappings from the specified map into this map, firing appropriate beanAdded() and beanReplaced() events along the way.
 Object remove(Object key)
          Remove the bean associated with the specified key (if any), and return the old value if removed.
 Object remove(String key)
          Remove the bean associated with the specified key (if any).
 void setHttpSession(javax.servlet.http.HttpSession httpSession)
           
 int size()
          Return the number of key-value mappings in this map.
 Collection values()
          Return a Collection view of the values contained in this map.
 
Methods inherited from class org.apache.commons.workflow.base.BaseScope
addScopeListener, removeScopeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

httpSession

protected javax.servlet.http.HttpSession httpSession
The HTTP session with which we are associated.

Constructor Detail

HttpSessionScope

public HttpSessionScope()
Construct a new HttpSessionScope with no attached HttpSession.


HttpSessionScope

public HttpSessionScope(javax.servlet.http.HttpSession httpSession)
Construct a HttpSessionScope associated with the specified HttpSession.

Parameters:
httpSession - The associated HttpSession
Method Detail

getHttpSession

public javax.servlet.http.HttpSession getHttpSession()

setHttpSession

public void setHttpSession(javax.servlet.http.HttpSession httpSession)

clear

public void clear()
Remove all beans from this Map and call scopeCleared() on all registered ScopeListeners.

Specified by:
clear in interface Map
Specified by:
clear in interface Scope
Overrides:
clear in class BaseScope

containsKey

public boolean containsKey(Object key)
Return true if this map contains the specified key.

Specified by:
containsKey in interface Map
Overrides:
containsKey in class BaseScope
Parameters:
key - Key to be looked up

containsValue

public boolean containsValue(Object value)
Return true if this map contains the specified value.

Specified by:
containsValue in interface Map
Overrides:
containsValue in class BaseScope
Parameters:
value - Value to be looked up

entrySet

public Set entrySet()
Return a set view of the mappings contained in this map.

Specified by:
entrySet in interface Map
Overrides:
entrySet in class BaseScope

equals

public boolean equals(Object object)
Compare the specified object with this map for equality.

Specified by:
equals in interface Map
Overrides:
equals in class BaseScope
Parameters:
object - Object to be compared

get

public Object get(Object key)
Return the value to which this map maps the specified key.

Specified by:
get in interface Map
Overrides:
get in class BaseScope
Parameters:
key - Key to be looked up

get

public Object get(String key)
Return the value to which this map maps the specified key.

Overrides:
get in class BaseScope
Parameters:
key - Key to be looked up

hashCode

public int hashCode()
Return the hash code value for this map.

Specified by:
hashCode in interface Map
Overrides:
hashCode in class BaseScope

isEmpty

public boolean isEmpty()
Return true if this map is empty.

Specified by:
isEmpty in interface Map
Overrides:
isEmpty in class BaseScope

keySet

public Set keySet()
Return a set view of the keys contained in this map.

Specified by:
keySet in interface Map
Overrides:
keySet in class BaseScope

put

public Object put(Object key,
                  Object bean)
Add or replace the bean associated with the specified key.

Specified by:
put in interface Map
Overrides:
put in class BaseScope
Parameters:
key - Key with which the new value should be associated (cannot be null)
bean - Bean to be associated with this key (cannot be null)

put

public Object put(String key,
                  Object bean)
Add the specified bean, associated with the specified key, to this scope and replace any previous bean associated with this key. If the bean was added, call beanAdded() on all registered listeners after the add is done. If an old bean was replaced, call beanReplaced() (passing the old value in the event) on all registered ScopeListeners after the removal is done. If a bean was replaced, the old value is also returned; otherwise null is returned.

Specified by:
put in interface Scope
Overrides:
put in class BaseScope
Parameters:
key - Key with which the new value should be associated (cannot be null)
bean - Bean to be associated with this key (cannot be null)
Throws:
IllegalArgumentException - if key or bean is null

putAll

public void putAll(Map in)
Copy all of the mappings from the specified map into this map, firing appropriate beanAdded() and beanReplaced() events along the way.

Specified by:
putAll in interface Map
Overrides:
putAll in class BaseScope
Parameters:
in - Map whose contents are to be added

remove

public Object remove(Object key)
Remove the bean associated with the specified key (if any), and return the old value if removed.

Specified by:
remove in interface Map
Overrides:
remove in class BaseScope
Parameters:
key - Key of the bean to remove (cannot be null)

remove

public Object remove(String key)
Remove the bean associated with the specified key (if any). If such a bean is found and removed, call beanRemoved() on all registered ScopeListeners after the removal is done. Return the old value (if any); otherwise return null.

Specified by:
remove in interface Scope
Overrides:
remove in class BaseScope
Parameters:
key - Key of the bean to remove (cannot be null)
Throws:
IllegalArgumentException - if key is null

size

public int size()
Return the number of key-value mappings in this map.

Specified by:
size in interface Map
Overrides:
size in class BaseScope

values

public Collection values()
Return a Collection view of the values contained in this map.

Specified by:
values in interface Map
Overrides:
values in class BaseScope


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.