org.objectweb.kilim.model.services
Class DefaultNamingContext

java.lang.Object
  extended byorg.objectweb.kilim.model.services.DefaultNamingContext
All Implemented Interfaces:
NamingContext
Direct Known Subclasses:
ComponentFactory, SlotFactory

public class DefaultNamingContext
extends java.lang.Object
implements NamingContext

Author:
horn

Field Summary
private  java.util.HashMap boundNames
           
private  java.util.HashMap childContexts
           
private  ExternalValueReferences externalNames
           
private  java.lang.String localName
           
private  NamingContext parentContext
           
 
Constructor Summary
DefaultNamingContext(java.lang.String aName, NamingContext aParent)
          a public constructor for a naming context.
DefaultNamingContext(java.lang.String aName, NamingContext aParent, ExternalValueReferences extNames)
          a public constructor for a naming context.
 
Method Summary
 void addBoundName(java.lang.String aName, ComponentElement aElement)
          adds a new lname in the naming context.
 void addChildNamingContext(java.lang.String aName, NamingContext aContext)
          adds a child naming context.
 java.util.Iterator getBoundNames()
          returns as an iterator all names known in the naming context.
 java.util.Iterator getChildNamingContexts()
          returns as an iterator the names of child naming contexts.
 ExternalValueReferences getExternalReferenceMap()
          gets the ExternalReferenceMap associated to the naming context.
 java.lang.String getLocalName()
          returns the local name of the context.
 NamingContext getParentNamingContext()
          Naming contexts follow a tree-like structure.
 java.lang.String getQualifiedName()
          returns the qualified name of the context.
 void removeBoundName(java.lang.String aName)
          removes a name from the naming context.
 void removeChildNamingContext(java.lang.String aName)
          removes a child naming context.
 ComponentElement resolveReference(java.lang.String aName, Component origin)
          returns the element associated to a name.
 void setExternalReferences(ExternalValueReferences xReferences)
          A map of external references can be associated to each naming context.
 void setParentNamingContext(NamingContext aContext)
          sets a new parent naming context.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

localName

private java.lang.String localName

parentContext

private NamingContext parentContext

childContexts

private java.util.HashMap childContexts

boundNames

private java.util.HashMap boundNames

externalNames

private ExternalValueReferences externalNames
Constructor Detail

DefaultNamingContext

public DefaultNamingContext(java.lang.String aName,
                            NamingContext aParent,
                            ExternalValueReferences extNames)
                     throws KilimException
a public constructor for a naming context.

Parameters:
aName - : the local name of the naming context.
aParent - : the parent naming context.
extNames - : a table of external references (instanciateds objects not associated to a kilim representation).
Throws:
KilimException - : generated if aName is null.

DefaultNamingContext

public DefaultNamingContext(java.lang.String aName,
                            NamingContext aParent)
                     throws KilimException
a public constructor for a naming context. It is strictly equivalent to DefaultNamingContext(aName, aParent, null).

Parameters:
aName - : the local name of the naming context.
aParent - : the parent naming context.
Throws:
KilimException - :: generated if aName is null.
Method Detail

getParentNamingContext

public NamingContext getParentNamingContext()
Description copied from interface: NamingContext
Naming contexts follow a tree-like structure. This method returns the parent context of the current context. It returns null when applied to the root context.

Specified by:
getParentNamingContext in interface NamingContext
Returns:
ComponentFactory
See Also:
NamingContext.getParentNamingContext()

addChildNamingContext

public void addChildNamingContext(java.lang.String aName,
                                  NamingContext aContext)
                           throws KilimException
Description copied from interface: NamingContext
adds a child naming context.

Specified by:
addChildNamingContext in interface NamingContext
Parameters:
aName - : the local name of the naming context.
aContext - : the naming context
Throws:
KilimException - : generated if aName is null, if aName is already used, if aContext is null.
See Also:
NamingContext.addChildNamingContext(String, NamingContext)

removeChildNamingContext

public void removeChildNamingContext(java.lang.String aName)
                              throws KilimException
Description copied from interface: NamingContext
removes a child naming context.

Specified by:
removeChildNamingContext in interface NamingContext
Parameters:
aName - : the name of the naming context to be removed.
Throws:
KilimException - : generated if aName is null or unknown.
See Also:
NamingContext.removeChildNamingContext(String)

getChildNamingContexts

public java.util.Iterator getChildNamingContexts()
Description copied from interface: NamingContext
returns as an iterator the names of child naming contexts.

Specified by:
getChildNamingContexts in interface NamingContext
Returns:
Iterator
See Also:
NamingContext.getChildNamingContexts()

setParentNamingContext

public void setParentNamingContext(NamingContext aContext)
Description copied from interface: NamingContext
sets a new parent naming context.

Specified by:
setParentNamingContext in interface NamingContext
Parameters:
aContext - : the parent context. Is null for making thje current context a root context.
See Also:
NamingContext.setParentNamingContext(NamingContext)

setExternalReferences

public void setExternalReferences(ExternalValueReferences xReferences)
Description copied from interface: NamingContext
A map of external references can be associated to each naming context. This method sets an ExternalReferenceMap.

Specified by:
setExternalReferences in interface NamingContext
Parameters:
xReferences - : the external references map.
See Also:
org.objectweb.kilim.model.services.NamingContext#setExternalReferenceMap(HashMap)

getExternalReferenceMap

public ExternalValueReferences getExternalReferenceMap()
Description copied from interface: NamingContext
gets the ExternalReferenceMap associated to the naming context.

Specified by:
getExternalReferenceMap in interface NamingContext
Returns:
HashMap
See Also:
NamingContext.getExternalReferenceMap()

getQualifiedName

public java.lang.String getQualifiedName()
Description copied from interface: NamingContext
returns the qualified name of the context.

Specified by:
getQualifiedName in interface NamingContext
Returns:
String
See Also:
NamingContext.getQualifiedName()

getLocalName

public java.lang.String getLocalName()
Description copied from interface: NamingContext
returns the local name of the context.

Specified by:
getLocalName in interface NamingContext
Returns:
String
See Also:
NamingContext.getLocalName()

toString

public java.lang.String toString()
See Also:
Object.toString()

addBoundName

public void addBoundName(java.lang.String aName,
                         ComponentElement aElement)
                  throws KilimException
Description copied from interface: NamingContext
adds a new lname in the naming context.

Specified by:
addBoundName in interface NamingContext
Parameters:
aName - : the name to be bound.
aElement - : the element.
Throws:
KilimException - : generated if aName is null or is already known.
See Also:
org.objectweb.kilim.model.services.NamingContext#addBoundName(String, Object)

removeBoundName

public void removeBoundName(java.lang.String aName)
                     throws KilimException
Description copied from interface: NamingContext
removes a name from the naming context.

Specified by:
removeBoundName in interface NamingContext
Parameters:
aName - : the name of the context to remove.
Throws:
KilimException - : generated if aName is null or unknown in the naming context.
See Also:
NamingContext.removeBoundName(String)

getBoundNames

public java.util.Iterator getBoundNames()
Description copied from interface: NamingContext
returns as an iterator all names known in the naming context.

Specified by:
getBoundNames in interface NamingContext
Returns:
Iterator
See Also:
NamingContext.getBoundNames()

resolveReference

public ComponentElement resolveReference(java.lang.String aName,
                                         Component origin)
                                  throws KilimException
Description copied from interface: NamingContext
returns the element associated to a name.

Specified by:
resolveReference in interface NamingContext
Parameters:
aName - : the name to be resolved.
origin - : the component from which the resolve request is performed (required for printing error messages)
Returns:
ComponentElement
Throws:
KilimException - : generated if aName is null or unknown.
See Also:
NamingContext.resolveReference(String, Component)