| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectatg.naming.NameContextImpl
public class NameContextImpl
This is a straightforward implementation of NameContext. This also implements NameContextBindingEventSource, meaning that it notifies listeners whenever a binding or removal occurs.
In this implementation, the absolute name of a child is formed by taking the parent's absolute name, adding a '/', and appending the child's name. This behavior can be changed by overriding getAbsoluteElementName().
This implementation attempts to avoid creating any objects if the Context is not used to store elements - if no elements or listeners are added, then no Dictionaries or Vectors will be created.
| Field Summary | |
|---|---|
| static java.lang.String | CLASS_VERSIONClass version string | 
| Constructor Summary | |
|---|---|
| NameContextImpl()Constructs a new NameContextImpl | |
| Method Summary | |
|---|---|
|  void | addNameContextBindingListener(NameContextBindingListener pListener)Adds the specified listener to the list of listeners that will be notified whenever an element is bound into or unbound from this NameContext. | 
| protected  java.util.Dictionary | createElementsDictionary()Create the dictionary used to create elements. | 
|  java.lang.Object | getElement(java.lang.String pName)Returns the element bound to the specified name. | 
|  java.lang.String | getName()Returns the name by which this element is know within its enclosing NameContext. | 
|  NameContext | getNameContext()Returns the NameContext into which this element has been bound, or null if the element is not bound in a NameContext. | 
|  NameContextBindingListener[] | getNameContextBindingListeners()Returns property NameContextBindingListeners | 
|  NameContext | getRoot()Searches up the tree until it finds the root NameContext | 
|  boolean | isElementBound(java.lang.String pName)Returns true if the name has and element bound to it, false if not. | 
|  java.util.Enumeration | listElementNames()Returns the list of element names as an Enumeration | 
|  java.util.Enumeration | listElements()Returns the list of bound elements as an Enumeration | 
|  void | nameContextElementBound(NameContextBindingEvent pEvent)This is called to notify this context that it is being bound into a NameContext. | 
|  void | nameContextElementUnbound(NameContextBindingEvent pEvent)This is called to notify this context that it is being unbound from a NameContext. | 
|  void | putElement(java.lang.String pName,
           java.lang.Object pElement)Binds the specified element to the specified name. | 
|  void | removeElement(java.lang.String pName)Removes the binding for the specified name. | 
|  void | removeNameContextBindingListener(NameContextBindingListener pListener)Removes the specified listener from the list of listeners that will be notified whenever an element is bound into or unbound from this NameContext. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static java.lang.String CLASS_VERSION
| Constructor Detail | 
|---|
public NameContextImpl()
| Method Detail | 
|---|
public NameContextBindingListener[] getNameContextBindingListeners()
public NameContext getRoot()
public java.lang.Object getElement(java.lang.String pName)
getElement in interface NameContext
public void putElement(java.lang.String pName,
                       java.lang.Object pElement)
putElement in interface NameContextpublic void removeElement(java.lang.String pName)
removeElement in interface NameContextpublic boolean isElementBound(java.lang.String pName)
isElementBound in interface NameContextpublic java.util.Enumeration listElementNames()
listElementNames in interface NameContextpublic java.util.Enumeration listElements()
listElements in interface NameContextpublic void addNameContextBindingListener(NameContextBindingListener pListener)
addNameContextBindingListener in interface NameContextBindingEventSourcepublic void removeNameContextBindingListener(NameContextBindingListener pListener)
removeNameContextBindingListener in interface NameContextBindingEventSourcepublic void nameContextElementBound(NameContextBindingEvent pEvent)
nameContextElementBound in interface NameContextBindingListenerpublic void nameContextElementUnbound(NameContextBindingEvent pEvent)
nameContextElementUnbound in interface NameContextBindingListenerpublic NameContext getNameContext()
getNameContext in interface NameContextElementpublic java.lang.String getName()
getName in interface NameContextElementprotected java.util.Dictionary createElementsDictionary()
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||