Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.naming/share/classes/javax/naming/spi/ContinuationContext.java
41159 views
1
/*
2
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.naming.spi;
27
28
import java.util.Hashtable;
29
import javax.naming.*;
30
31
/**
32
* This class is for dealing with federations/continuations.
33
*
34
* @author Rosanna Lee
35
* @author Scott Seligman
36
* @since 1.3
37
*/
38
39
class ContinuationContext implements Context, Resolver {
40
protected CannotProceedException cpe;
41
protected Hashtable<?,?> env;
42
protected Context contCtx = null;
43
44
protected ContinuationContext(CannotProceedException cpe,
45
Hashtable<?,?> env) {
46
this.cpe = cpe;
47
this.env = env;
48
}
49
50
protected Context getTargetContext() throws NamingException {
51
if (contCtx == null) {
52
if (cpe.getResolvedObj() == null)
53
throw (NamingException)cpe.fillInStackTrace();
54
55
contCtx = NamingManager.getContext(cpe.getResolvedObj(),
56
cpe.getAltName(),
57
cpe.getAltNameCtx(),
58
env);
59
if (contCtx == null)
60
throw (NamingException)cpe.fillInStackTrace();
61
}
62
return contCtx;
63
}
64
65
public Object lookup(Name name) throws NamingException {
66
Context ctx = getTargetContext();
67
return ctx.lookup(name);
68
}
69
70
public Object lookup(String name) throws NamingException {
71
Context ctx = getTargetContext();
72
return ctx.lookup(name);
73
}
74
75
public void bind(Name name, Object newObj) throws NamingException {
76
Context ctx = getTargetContext();
77
ctx.bind(name, newObj);
78
}
79
80
public void bind(String name, Object newObj) throws NamingException {
81
Context ctx = getTargetContext();
82
ctx.bind(name, newObj);
83
}
84
85
public void rebind(Name name, Object newObj) throws NamingException {
86
Context ctx = getTargetContext();
87
ctx.rebind(name, newObj);
88
}
89
public void rebind(String name, Object newObj) throws NamingException {
90
Context ctx = getTargetContext();
91
ctx.rebind(name, newObj);
92
}
93
94
public void unbind(Name name) throws NamingException {
95
Context ctx = getTargetContext();
96
ctx.unbind(name);
97
}
98
public void unbind(String name) throws NamingException {
99
Context ctx = getTargetContext();
100
ctx.unbind(name);
101
}
102
103
public void rename(Name name, Name newName) throws NamingException {
104
Context ctx = getTargetContext();
105
ctx.rename(name, newName);
106
}
107
public void rename(String name, String newName) throws NamingException {
108
Context ctx = getTargetContext();
109
ctx.rename(name, newName);
110
}
111
112
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
113
Context ctx = getTargetContext();
114
return ctx.list(name);
115
}
116
public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
117
Context ctx = getTargetContext();
118
return ctx.list(name);
119
}
120
121
122
public NamingEnumeration<Binding> listBindings(Name name)
123
throws NamingException
124
{
125
Context ctx = getTargetContext();
126
return ctx.listBindings(name);
127
}
128
129
public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
130
Context ctx = getTargetContext();
131
return ctx.listBindings(name);
132
}
133
134
public void destroySubcontext(Name name) throws NamingException {
135
Context ctx = getTargetContext();
136
ctx.destroySubcontext(name);
137
}
138
public void destroySubcontext(String name) throws NamingException {
139
Context ctx = getTargetContext();
140
ctx.destroySubcontext(name);
141
}
142
143
public Context createSubcontext(Name name) throws NamingException {
144
Context ctx = getTargetContext();
145
return ctx.createSubcontext(name);
146
}
147
public Context createSubcontext(String name) throws NamingException {
148
Context ctx = getTargetContext();
149
return ctx.createSubcontext(name);
150
}
151
152
public Object lookupLink(Name name) throws NamingException {
153
Context ctx = getTargetContext();
154
return ctx.lookupLink(name);
155
}
156
public Object lookupLink(String name) throws NamingException {
157
Context ctx = getTargetContext();
158
return ctx.lookupLink(name);
159
}
160
161
public NameParser getNameParser(Name name) throws NamingException {
162
Context ctx = getTargetContext();
163
return ctx.getNameParser(name);
164
}
165
166
public NameParser getNameParser(String name) throws NamingException {
167
Context ctx = getTargetContext();
168
return ctx.getNameParser(name);
169
}
170
171
public Name composeName(Name name, Name prefix)
172
throws NamingException
173
{
174
Context ctx = getTargetContext();
175
return ctx.composeName(name, prefix);
176
}
177
178
public String composeName(String name, String prefix)
179
throws NamingException {
180
Context ctx = getTargetContext();
181
return ctx.composeName(name, prefix);
182
}
183
184
public Object addToEnvironment(String propName, Object value)
185
throws NamingException {
186
Context ctx = getTargetContext();
187
return ctx.addToEnvironment(propName, value);
188
}
189
190
public Object removeFromEnvironment(String propName)
191
throws NamingException {
192
Context ctx = getTargetContext();
193
return ctx.removeFromEnvironment(propName);
194
}
195
196
public Hashtable<?,?> getEnvironment() throws NamingException {
197
Context ctx = getTargetContext();
198
return ctx.getEnvironment();
199
}
200
201
public String getNameInNamespace() throws NamingException {
202
Context ctx = getTargetContext();
203
return ctx.getNameInNamespace();
204
}
205
206
public ResolveResult
207
resolveToClass(Name name, Class<? extends Context> contextType)
208
throws NamingException
209
{
210
if (cpe.getResolvedObj() == null)
211
throw (NamingException)cpe.fillInStackTrace();
212
213
Resolver res = NamingManager.getResolver(cpe.getResolvedObj(),
214
cpe.getAltName(),
215
cpe.getAltNameCtx(),
216
env);
217
if (res == null)
218
throw (NamingException)cpe.fillInStackTrace();
219
return res.resolveToClass(name, contextType);
220
}
221
222
public ResolveResult
223
resolveToClass(String name, Class<? extends Context> contextType)
224
throws NamingException
225
{
226
if (cpe.getResolvedObj() == null)
227
throw (NamingException)cpe.fillInStackTrace();
228
229
Resolver res = NamingManager.getResolver(cpe.getResolvedObj(),
230
cpe.getAltName(),
231
cpe.getAltNameCtx(),
232
env);
233
if (res == null)
234
throw (NamingException)cpe.fillInStackTrace();
235
return res.resolveToClass(name, contextType);
236
}
237
238
public void close() throws NamingException {
239
cpe = null;
240
env = null;
241
if (contCtx != null) {
242
contCtx.close();
243
contCtx = null;
244
}
245
}
246
}
247
248