KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gcc > naming > InitialContext


1 /*
2  * Copyright 2004 The Apache Software Foundation or its licensors, as
3  * applicable.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14  * implied.
15  *
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19 package gcc.naming;
20
21 import gcc.util.*;
22 import java.util.*;
23 import javax.naming.*;
24
25 public class InitialContext implements Context, java.io.Serializable
26 {
27     private static HashMap EMPTY_MAP = new HashMap();
28     private String _prefix;
29
30     InitialContext(String prefix)
31     {
32         _prefix = prefix;
33     }
34
35     public HashMap getMap()
36     {
37         NamingContext namingContext = NamingContext.getCurrent();
38         if (namingContext == null)
39         {
40             return EMPTY_MAP;
41         }
42         else
43         {
44             return namingContext.getMap();
45         }
46     }
47
48     public Object lookup(Name name) throws NamingException
49     {
50         return lookup(name.toString());
51     }
52
53     public Object lookup(String name) throws NamingException
54     {
55         NamingContext namingContext = NamingContext.getCurrent();
56         if (namingContext == null)
57         {
58             namingContext = NamingContext.getInstance(NameService.class);
59         }
60         return namingContext.lookup(name, _prefix);
61     }
62
63     public Object lookupReturnNullIfNotFound(String name)
64     {
65         NamingContext namingContext = NamingContext.getCurrent();
66         if (namingContext == null)
67         {
68             return null;
69         }
70         else
71         {
72             return namingContext.lookupReturnNullIfNotFound(name, _prefix);
73         }
74     }
75
76     public void bind(Name name, Object obj) throws NamingException
77     {
78         throw new OperationNotSupportedException();
79     }
80
81     public void bind(String name, Object obj) throws NamingException
82     {
83         throw new OperationNotSupportedException();
84     }
85
86     public void rebind(Name name, Object obj) throws NamingException
87     {
88         throw new OperationNotSupportedException();
89     }
90
91     public void rebind(String name, Object obj) throws NamingException
92     {
93         throw new OperationNotSupportedException();
94     }
95
96     public void unbind(Name name) throws NamingException
97     {
98         throw new OperationNotSupportedException();
99     }
100
101     public void unbind(String name) throws NamingException
102     {
103         throw new OperationNotSupportedException();
104     }
105
106     public void rename(Name oldName, Name newName) throws NamingException
107     {
108         throw new OperationNotSupportedException();
109     }
110
111     public void rename(String oldName, String newName) throws NamingException
112     {
113         throw new OperationNotSupportedException();
114     }
115
116     public NamingEnumeration list(Name name) throws NamingException
117     {
118         throw new OperationNotSupportedException();
119     }
120
121     public NamingEnumeration list(String name) throws NamingException
122     {
123         throw new OperationNotSupportedException();
124     }
125
126     public NamingEnumeration listBindings(Name name) throws NamingException
127     {
128         throw new OperationNotSupportedException();
129     }
130
131     public NamingEnumeration listBindings(String name) throws NamingException
132     {
133         throw new OperationNotSupportedException();
134     }
135
136     public void destroySubcontext(Name name) throws NamingException
137     {
138         throw new OperationNotSupportedException();
139     }
140
141     public void destroySubcontext(String name) throws NamingException
142     {
143         throw new OperationNotSupportedException();
144     }
145
146     public Context createSubcontext(Name name) throws NamingException
147     {
148         throw new OperationNotSupportedException();
149     }
150
151     public Context createSubcontext(String name) throws NamingException
152     {
153         throw new OperationNotSupportedException();
154     }
155
156     public Object lookupLink(Name name) throws NamingException
157     {
158         throw new OperationNotSupportedException();
159     }
160
161     public Object lookupLink(String name) throws NamingException
162     {
163         throw new OperationNotSupportedException();
164     }
165
166     public NameParser getNameParser(Name name) throws NamingException
167     {
168         throw new OperationNotSupportedException();
169     }
170
171     public NameParser getNameParser(String name) throws NamingException
172     {
173         throw new OperationNotSupportedException();
174     }
175
176     public Name composeName(Name name, Name prefix) throws NamingException
177     {
178         throw new OperationNotSupportedException();
179     }
180
181     public String composeName(String name, String prefix) throws NamingException
182     {
183         throw new OperationNotSupportedException();
184     }
185
186     public Object addToEnvironment(String propName, Object propVal) throws NamingException
187     {
188         throw new OperationNotSupportedException();
189     }
190
191     public Object removeFromEnvironment(String propName) throws NamingException
192     {
193         throw new OperationNotSupportedException();
194     }
195
196     public Hashtable getEnvironment() throws NamingException
197     {
198         throw new OperationNotSupportedException();
199     }
200
201     public String getNameInNamespace() throws NamingException
202     {
203         throw new OperationNotSupportedException();
204     }
205
206     public void close() throws NamingException
207     {
208         throw new OperationNotSupportedException();
209     }
210 }
211
Popular Tags