KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > kilim > model > services > NamingContext


1 /**
2  * Copyright (C) 2002 Kelua SA
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package org.objectweb.kilim.model.services;
20
21 import java.util.Iterator JavaDoc;
22
23 import org.objectweb.kilim.KilimException;
24 import org.objectweb.kilim.model.Component;
25 import org.objectweb.kilim.model.ComponentElement;
26
27 /**
28  * This interface defines the method to be used when dealing which naming contexts.
29  * @author horn
30  */

31 public interface NamingContext {
32     
33     /**
34      * Naming contexts follow a tree-like structure. This method returns the parent context of the current context.
35      * It returns null when applied to the root context.
36      * @return ComponentFactory
37      */

38     NamingContext getParentNamingContext();
39     
40     /**
41      * sets a new parent naming context.
42      * @param aContext : the parent context. Is null for making thje current context a root context.
43      */

44     void setParentNamingContext(NamingContext aContext);
45     
46     /**
47      * adds a child naming context.
48      * @param aName : the local name of the naming context.
49      * @param aContext : the naming context
50      * @throws KilimException : generated if aName is null, if aName is already used, if aContext is null.
51      */

52     void addChildNamingContext(String JavaDoc aName, NamingContext aContext) throws KilimException;
53     
54     /**
55      * removes a child naming context.
56      * @param aName : the name of the naming context to be removed.
57      * @throws KilimException : generated if aName is null or unknown.
58      */

59     void removeChildNamingContext(String JavaDoc aName) throws KilimException;
60     
61     /**
62      * returns as an iterator the names of child naming contexts.
63      * @return Iterator
64      */

65     Iterator JavaDoc getChildNamingContexts();
66     
67     /**
68      * A map of external references can be associated to each naming context. This method sets an ExternalReferenceMap.
69      * @param xReferences : the external references map.
70      */

71     void setExternalReferences(ExternalValueReferences xReferences);
72     
73     /**
74      * gets the ExternalReferenceMap associated to the naming context.
75      * @return HashMap
76      */

77     ExternalValueReferences getExternalReferenceMap();
78     
79     /**
80      * returns the qualified name of the context.
81      * @return String
82      */

83     String JavaDoc getQualifiedName();
84     
85     /**
86      * returns the local name of the context.
87      * @return String
88      */

89     String JavaDoc getLocalName();
90     
91     /**
92      * adds a new lname in the naming context.
93      * @param aName : the name to be bound.
94      * @param aElement : the element.
95      * @throws KilimException : generated if aName is null or is already known.
96      */

97     void addBoundName(String JavaDoc aName, ComponentElement aElement) throws KilimException;
98     
99     /**
100      * removes a name from the naming context.
101      * @param aName : the name of the context to remove.
102      * @throws KilimException : generated if aName is null or unknown in the naming context.
103      */

104     void removeBoundName(String JavaDoc aName) throws KilimException;
105         
106     /**
107      * returns as an iterator all names known in the naming context.
108      * @return Iterator
109      */

110     Iterator JavaDoc getBoundNames();
111     
112     /**
113      * returns the element associated to a name.
114      * @param aName : the name to be resolved.
115      * @param aOrigin : the component from which the resolve request is performed (required for printing error messages)
116      * @return ComponentElement
117      * @throws KilimException : generated if aName is null or unknown.
118      */

119     ComponentElement resolveReference(String JavaDoc aName, Component aOrigin) throws KilimException;
120 }
Popular Tags