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 {
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 list(Name name) throws NamingException {
113 Context ctx = getTargetContext();
114 return ctx.list(name);
115 }
116 public NamingEnumeration list(String name) throws NamingException {
117 Context ctx = getTargetContext();
118 return ctx.list(name);
119 }
120
121
122 public NamingEnumeration listBindings(Name name)
123 throws NamingException
124 {
125 Context ctx = getTargetContext();
126 return ctx.listBindings(name);
127 }
128
129 public NamingEnumeration 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);
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);
|
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 {
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);
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);
|