KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > interop > naming > InitialContext


1 /**
2  *
3  * Copyright 2004-2005 The Apache Software Foundation
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 implied.
14  *
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

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