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

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended byorg.mmbase.bridge.jsp.taglib.util.ContextContainer
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class ContextContainer
extends java.util.HashMap

This is a HashMap, but the keys can contain 'dots', in which case there is searched for HashMaps in the HashMap.

Version:
$Id: ContextContainer.java,v 1.21.2.2 2004/08/31 16:45:16 rob Exp $
Author:
Michiel Meeuwissen
See Also:
Serialized Form

Field Summary
static int LOCATION_ATTRIBUTES
           
static int LOCATION_COOKIE
           
static int LOCATION_MULTIPART
           
static int LOCATION_NOTSET
           
static int LOCATION_PAGE
           
static int LOCATION_PARAMETERS
           
static int LOCATION_PARENT
           
static int LOCATION_SESSION
           
static int LOCATION_THIS
           
protected  ContextContainer parent
           
 
Constructor Summary
ContextContainer(java.lang.String i, ContextContainer p)
          Since a ContextContainer can contain other ContextContainer, it has to know which ContextContainer contains this.
 
Method Summary
 boolean containsKey(java.lang.Object key)
           
 boolean containsKey(java.lang.String key)
           
 boolean containsKey(java.lang.String key, boolean checkParent)
          Like the containsKey of HashMap.
 java.lang.Object find(javax.servlet.jsp.PageContext pageContext, int from, java.lang.String referId)
           
 java.lang.Object find(javax.servlet.jsp.PageContext pageContext, java.lang.String externid)
           
 java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext, int from, java.lang.String referId, java.lang.String newId)
          Searches a key in request, postparameters, session, parent context and registers it in this one.
 java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext, int from, java.lang.String referId, java.lang.String newId, boolean check)
           
 java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext, java.lang.String id)
           
 java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext, java.lang.String externid, java.lang.String newId)
           
 java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext, java.lang.String externid, java.lang.String newId, boolean check)
           
 java.lang.String findAndRegisterString(javax.servlet.jsp.PageContext pageContext, java.lang.String id)
           
 java.lang.String findAndRegisterString(javax.servlet.jsp.PageContext pageContext, java.lang.String id, boolean check)
           
 java.lang.Object get(java.lang.String key)
           
 java.lang.Object get(java.lang.String key, boolean checkParent)
          Like get, but you can explicity indicate if to search 'parent' Contextes as well.
 java.lang.String getId()
           
 java.lang.Object getObject(java.lang.String key)
           
 boolean isPresent(java.lang.String key)
           
 boolean isRegistered(java.lang.String key)
           
 java.util.Set keySet()
           
static java.lang.String locationToString(int i)
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Keys must be Strings, so put(Object, ..) is forbidden in this HashMap!
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Not all Strings can be allowed as keys.
 void register(java.lang.String newId, java.lang.Object n)
           
 void register(java.lang.String newId, java.lang.Object n, boolean check)
           
protected  void register(java.lang.String newId, java.lang.Object n, boolean check, boolean checkParent)
           
 void registerNode(java.lang.String newId, Node n)
           
 void reregister(java.lang.String id, java.lang.Object n)
           
static int stringToLocation(java.lang.String s)
           
 java.lang.String toString()
           
 void unRegister(java.lang.String key)
           
protected  void unRegister(java.lang.String key, boolean checkParent)
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsValue, entrySet, get, isEmpty, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

LOCATION_NOTSET

public static final int LOCATION_NOTSET
See Also:
Constant Field Values

LOCATION_PAGE

public static final int LOCATION_PAGE
See Also:
Constant Field Values

LOCATION_PARENT

public static final int LOCATION_PARENT
See Also:
Constant Field Values

LOCATION_PARAMETERS

public static final int LOCATION_PARAMETERS
See Also:
Constant Field Values

LOCATION_MULTIPART

public static final int LOCATION_MULTIPART
See Also:
Constant Field Values

LOCATION_SESSION

public static final int LOCATION_SESSION
See Also:
Constant Field Values

LOCATION_COOKIE

public static final int LOCATION_COOKIE
See Also:
Constant Field Values

LOCATION_ATTRIBUTES

public static final int LOCATION_ATTRIBUTES
See Also:
Constant Field Values

LOCATION_THIS

public static final int LOCATION_THIS
See Also:
Constant Field Values

parent

protected ContextContainer parent
Constructor Detail

ContextContainer

public ContextContainer(java.lang.String i,
                        ContextContainer p)
Since a ContextContainer can contain other ContextContainer, it has to know which ContextContainer contains this. And it also has an id.

Method Detail

stringToLocation

public static int stringToLocation(java.lang.String s)
                            throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

locationToString

public static java.lang.String locationToString(int i)

getId

public java.lang.String getId()

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Keys must be Strings, so put(Object, ..) is forbidden in this HashMap!


put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
                     throws javax.servlet.jsp.JspTagException
Not all Strings can be allowed as keys. Keys are like variable names.

Throws:
javax.servlet.jsp.JspTagException

containsKey

public boolean containsKey(java.lang.Object key)

containsKey

public boolean containsKey(java.lang.String key,
                           boolean checkParent)
                    throws javax.servlet.jsp.JspTagException
Like the containsKey of HashMap.

Parameters:
key - The key to search
checkParent - If this is false, it will only look in the current Container (and below).
Throws:
javax.servlet.jsp.JspTagException

containsKey

public boolean containsKey(java.lang.String key)
                    throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

get

public java.lang.Object get(java.lang.String key,
                            boolean checkParent)
                     throws javax.servlet.jsp.JspTagException
Like get, but you can explicity indicate if to search 'parent' Contextes as well.

Throws:
javax.servlet.jsp.JspTagException

get

public java.lang.Object get(java.lang.String key)
                     throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

keySet

public java.util.Set keySet()

getObject

public java.lang.Object getObject(java.lang.String key)
                           throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7 (here)

register

public void register(java.lang.String newId,
                     java.lang.Object n,
                     boolean check)
              throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7 (here)

register

protected void register(java.lang.String newId,
                        java.lang.Object n,
                        boolean check,
                        boolean checkParent)
                 throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7

register

public void register(java.lang.String newId,
                     java.lang.Object n)
              throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7 (here)

registerNode

public void registerNode(java.lang.String newId,
                         Node n)
                  throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7 (here)

isRegistered

public boolean isRegistered(java.lang.String key)
                     throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7 (here)

unRegister

public void unRegister(java.lang.String key)
                throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7 (here)

unRegister

protected void unRegister(java.lang.String key,
                          boolean checkParent)
                   throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7

reregister

public void reregister(java.lang.String id,
                       java.lang.Object n)
                throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7 (here)

find

public java.lang.Object find(javax.servlet.jsp.PageContext pageContext,
                             int from,
                             java.lang.String referId)
                      throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7

find

public java.lang.Object find(javax.servlet.jsp.PageContext pageContext,
                             java.lang.String externid)
                      throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException
Since:
MMBase-1.7

findAndRegister

public java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext,
                                        int from,
                                        java.lang.String referId,
                                        java.lang.String newId)
                                 throws javax.servlet.jsp.JspTagException
Searches a key in request, postparameters, session, parent context and registers it in this one. Returns null if it could not be found.

Throws:
javax.servlet.jsp.JspTagException

findAndRegister

public java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext,
                                        int from,
                                        java.lang.String referId,
                                        java.lang.String newId,
                                        boolean check)
                                 throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

findAndRegister

public java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext,
                                        java.lang.String externid,
                                        java.lang.String newId)
                                 throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

findAndRegister

public java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext,
                                        java.lang.String externid,
                                        java.lang.String newId,
                                        boolean check)
                                 throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

findAndRegister

public java.lang.Object findAndRegister(javax.servlet.jsp.PageContext pageContext,
                                        java.lang.String id)
                                 throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

findAndRegisterString

public java.lang.String findAndRegisterString(javax.servlet.jsp.PageContext pageContext,
                                              java.lang.String id)
                                       throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

findAndRegisterString

public java.lang.String findAndRegisterString(javax.servlet.jsp.PageContext pageContext,
                                              java.lang.String id,
                                              boolean check)
                                       throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

isPresent

public boolean isPresent(java.lang.String key)
                  throws javax.servlet.jsp.JspTagException
Throws:
javax.servlet.jsp.JspTagException

toString

public java.lang.String toString()


MMBase build 1.7.1.20041002