org.mmbase.bridge.jsp.taglib.util
Class BasicBacking

java.lang.Object
  extended by java.util.AbstractMap<String,Object>
      extended by org.mmbase.bridge.jsp.taglib.util.BasicBacking
All Implemented Interfaces:
Map<String,Object>, Backing
Direct Known Subclasses:
CollectorBacking

public class BasicBacking
extends AbstractMap<String,Object>
implements Backing

A basic implementation for the backing of a ContextContainter. It uses a HashMap, but is also writes every entry to the temporary to the page-context, to make them available to JSP2's expression language, unless the 'ELIgnored' parameter of the MMBase taglib is true, or no pageContext is given in the constructor.

Since:
MMBase-1.8
Version:
$Id: BasicBacking.java 40228 2009-12-14 10:53:46Z michiel $
Author:
Michiel Meeuwissen

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  boolean isELIgnored
           
protected  Set<String> myPageContextKeys
           
protected  Map<String,Object> originalPageContextValues
          In this map we keep track of what should be in the page context when this backing is release()d.
protected  PageContext pageContext
           
 
Constructor Summary
BasicBacking(Map<String,Object> backing, boolean ignoreEL)
           
BasicBacking(PageContext pc, boolean ignoreEL)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsOwnKey(String key)
          Whether this map contains the given key, but by its own, so not because of possible reflection of another structure (like the page context).
 Set<Map.Entry<String,Object>> entrySet()
           
 Object get(Object key)
           
 Object getOriginal(String key)
          Get the original value as stored in this Map, so without every wrapping which may have been done.
 Map<String,Object> getOriginalMap()
           
 PageContext getPageContext()
           
 boolean isELIgnored()
           
protected  void mirrorPut(String key, Object value)
           
protected  void mirrorPut(String key, Object value, boolean reset)
          Put the value also in the 'parent' of this backing.
 void pullPageContext(PageContext pc)
           
 void pushPageContext(PageContext pc)
          When the container gets used in a different page-context (e.g.
 Object put(String key, Object value)
           
 Object put(String key, Object value, boolean reset)
           
(package private)  void release()
           
 Object remove(Object key)
           
 void setJspVar(PageContext pc, String jspvar, int vartype, Object value)
           
 String toString()
           
 
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsValue, equals, hashCode, isEmpty, keySet, putAll, size, values
 

Field Detail

originalPageContextValues

protected Map<String,Object> originalPageContextValues
In this map we keep track of what should be in the page context when this backing is release()d.


myPageContextKeys

protected Set<String> myPageContextKeys

isELIgnored

protected final boolean isELIgnored

pageContext

protected transient PageContext pageContext
Constructor Detail

BasicBacking

public BasicBacking(PageContext pc,
                    boolean ignoreEL)
Parameters:
pc - The page-context to which variables must be reflected or null if this must not happen.

BasicBacking

public BasicBacking(Map<String,Object> backing,
                    boolean ignoreEL)
Since:
MMBase-1.9
Method Detail

pushPageContext

public void pushPageContext(PageContext pc)
Description copied from interface: Backing
When the container gets used in a different page-context (e.g. because it was stored in the request or in the session), the new one must be pushed. And pulled again when ready.

Specified by:
pushPageContext in interface Backing

pullPageContext

public void pullPageContext(PageContext pc)
Specified by:
pullPageContext in interface Backing
See Also:
Backing.pushPageContext(PageContext)

getPageContext

public PageContext getPageContext()
Specified by:
getPageContext in interface Backing

setJspVar

public void setJspVar(PageContext pc,
                      String jspvar,
                      int vartype,
                      Object value)
Specified by:
setJspVar in interface Backing

entrySet

public Set<Map.Entry<String,Object>> entrySet()
Specified by:
entrySet in interface Map<String,Object>
Specified by:
entrySet in class AbstractMap<String,Object>

mirrorPut

protected void mirrorPut(String key,
                         Object value,
                         boolean reset)
Put the value also in the 'parent' of this backing.

Parameters:
reset - If true (default it's false) allow the already existing value in the parent to be replaced.
Since:
MMBase-1.9.2

mirrorPut

protected void mirrorPut(String key,
                         Object value)

put

public Object put(String key,
                  Object value,
                  boolean reset)
           throws JspTagException
Throws:
JspTagException

put

public Object put(String key,
                  Object value)
Specified by:
put in interface Map<String,Object>
Overrides:
put in class AbstractMap<String,Object>

get

public Object get(Object key)
Specified by:
get in interface Map<String,Object>
Overrides:
get in class AbstractMap<String,Object>

remove

public Object remove(Object key)
Specified by:
remove in interface Map<String,Object>
Overrides:
remove in class AbstractMap<String,Object>

clear

public void clear()
Specified by:
clear in interface Map<String,Object>
Overrides:
clear in class AbstractMap<String,Object>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<String,Object>
Overrides:
containsKey in class AbstractMap<String,Object>

getOriginal

public Object getOriginal(String key)
Description copied from interface: Backing
Get the original value as stored in this Map, so without every wrapping which may have been done.

Specified by:
getOriginal in interface Backing

getOriginalMap

public Map<String,Object> getOriginalMap()
Specified by:
getOriginalMap in interface Backing

containsOwnKey

public boolean containsOwnKey(String key)
Description copied from interface: Backing
Whether this map contains the given key, but by its own, so not because of possible reflection of another structure (like the page context).

Specified by:
containsOwnKey in interface Backing

release

void release()

isELIgnored

public boolean isELIgnored()
Specified by:
isELIgnored in interface Backing
Since:
MMBase-1.9.1

toString

public String toString()
Overrides:
toString in class AbstractMap<String,Object>


MMBase 2.0-SNAPSHOT - null