KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hivemind > test > lib > impl > FakeContext


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

15 package hivemind.test.lib.impl;
16
17 import java.util.HashMap JavaDoc;
18 import java.util.Hashtable JavaDoc;
19 import java.util.Map JavaDoc;
20
21 import javax.naming.Context JavaDoc;
22 import javax.naming.Name JavaDoc;
23 import javax.naming.NameParser JavaDoc;
24 import javax.naming.NamingEnumeration JavaDoc;
25 import javax.naming.NamingException JavaDoc;
26
27 public class FakeContext implements Context JavaDoc
28 {
29     private boolean _forceError;
30     private Map JavaDoc _names = new HashMap JavaDoc();
31
32     public Object JavaDoc lookup(Name JavaDoc name) throws NamingException JavaDoc
33     {
34
35         return null;
36     }
37
38     public Object JavaDoc lookup(String JavaDoc name) throws NamingException JavaDoc
39     {
40         if (_forceError)
41             throw new NamingException JavaDoc("Forced error: " + name);
42
43         return _names.get(name);
44     }
45
46     public void bind(Name JavaDoc name, Object JavaDoc obj) throws NamingException JavaDoc
47     {
48
49     }
50
51     public void bind(String JavaDoc name, Object JavaDoc obj) throws NamingException JavaDoc
52     {
53         _names.put(name, obj);
54     }
55
56     public void rebind(Name JavaDoc name, Object JavaDoc obj) throws NamingException JavaDoc
57     {
58
59     }
60
61     public void rebind(String JavaDoc name, Object JavaDoc obj) throws NamingException JavaDoc
62     {
63
64     }
65
66     public void unbind(Name JavaDoc name) throws NamingException JavaDoc
67     {
68
69     }
70
71     public void unbind(String JavaDoc name) throws NamingException JavaDoc
72     {
73
74     }
75
76     public void rename(Name JavaDoc oldName, Name JavaDoc newName) throws NamingException JavaDoc
77     {
78
79     }
80
81     public void rename(String JavaDoc oldName, String JavaDoc newName) throws NamingException JavaDoc
82     {
83
84     }
85
86     public NamingEnumeration JavaDoc list(Name JavaDoc name) throws NamingException JavaDoc
87     {
88         return null;
89     }
90
91     public NamingEnumeration JavaDoc list(String JavaDoc name) throws NamingException JavaDoc
92     {
93         return null;
94     }
95
96     public NamingEnumeration JavaDoc listBindings(Name JavaDoc name) throws NamingException JavaDoc
97     {
98         return null;
99     }
100
101     public NamingEnumeration JavaDoc listBindings(String JavaDoc name) throws NamingException JavaDoc
102     {
103         return null;
104     }
105
106     public void destroySubcontext(Name JavaDoc name) throws NamingException JavaDoc
107     {
108
109     }
110
111     public void destroySubcontext(String JavaDoc name) throws NamingException JavaDoc
112     {
113
114     }
115
116     public Context JavaDoc createSubcontext(Name JavaDoc name) throws NamingException JavaDoc
117     {
118         return null;
119     }
120
121     public Context JavaDoc createSubcontext(String JavaDoc name) throws NamingException JavaDoc
122     {
123         return null;
124     }
125
126     public Object JavaDoc lookupLink(Name JavaDoc name) throws NamingException JavaDoc
127     {
128         return null;
129     }
130
131     public Object JavaDoc lookupLink(String JavaDoc name) throws NamingException JavaDoc
132     {
133         return null;
134     }
135
136     public NameParser JavaDoc getNameParser(Name JavaDoc name) throws NamingException JavaDoc
137     {
138         return null;
139     }
140
141     public NameParser JavaDoc getNameParser(String JavaDoc name) throws NamingException JavaDoc
142     {
143         return null;
144     }
145
146     public Name JavaDoc composeName(Name JavaDoc name, Name JavaDoc prefix) throws NamingException JavaDoc
147     {
148         return null;
149     }
150
151     public String JavaDoc composeName(String JavaDoc name, String JavaDoc prefix) throws NamingException JavaDoc
152     {
153         return null;
154     }
155
156     public Object JavaDoc addToEnvironment(String JavaDoc propName, Object JavaDoc propVal) throws NamingException JavaDoc
157     {
158         return null;
159     }
160
161     public Object JavaDoc removeFromEnvironment(String JavaDoc propName) throws NamingException JavaDoc
162     {
163         return null;
164     }
165
166     public Hashtable JavaDoc getEnvironment() throws NamingException JavaDoc
167     {
168         return null;
169     }
170
171     public void close() throws NamingException JavaDoc
172     {
173
174     }
175
176     public String JavaDoc getNameInNamespace() throws NamingException JavaDoc
177     {
178         return null;
179     }
180
181     public boolean isForceError()
182     {
183         return _forceError;
184     }
185
186     public void setForceError(boolean b)
187     {
188         _forceError = b;
189     }
190
191 }
192
Popular Tags