1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55: import ;
56: import ;
57: import ;
58: import ;
59: import ;
60: import ;
61: import ;
62:
63: import ;
64:
65:
70: public abstract class _NamingContextImplBase
71: extends DynamicImplementation
72: implements NamingContext, InvokeHandler
73: {
74:
77: private static final long serialVersionUID = -114280294134561035L;
78:
79:
83: static Hashtable methods = new Hashtable();
84:
85:
88: static
89: {
90: methods.put("bind", new Integer(0));
91: methods.put("rebind", new Integer(1));
92: methods.put("bind_context", new Integer(2));
93: methods.put("rebind_context", new Integer(3));
94: methods.put("resolve", new Integer(4));
95: methods.put("unbind", new Integer(5));
96: methods.put("new_context", new Integer(6));
97: methods.put("bind_new_context", new Integer(7));
98: methods.put("destroy", new Integer(8));
99: methods.put("list", new Integer(9));
100: }
101:
102:
105: public String[] _ids()
106: {
107: return new String[] { NamingContextHelper.id() };
108: }
109:
110:
121: public OutputStream _invoke(String method, InputStream in, ResponseHandler rh)
122: {
123: OutputStream out = null;
124: Integer call_method = (Integer) methods.get(method);
125: if (call_method == null)
126: throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
127:
128: switch (call_method.intValue())
129: {
130: case 0 :
131: {
132: try
133: {
134: NameComponent[] a_name = NameHelper.read(in);
135: org.omg.CORBA.Object an_object = ObjectHelper.read(in);
136: bind(a_name, an_object);
137: out = rh.createReply();
138: }
139: catch (NotFound ex)
140: {
141: out = rh.createExceptionReply();
142: NotFoundHelper.write(out, ex);
143: }
144: catch (CannotProceed ex)
145: {
146: out = rh.createExceptionReply();
147: CannotProceedHelper.write(out, ex);
148: }
149: catch (InvalidName ex)
150: {
151: out = rh.createExceptionReply();
152: InvalidNameHelper.write(out, ex);
153: }
154: catch (AlreadyBound ex)
155: {
156: out = rh.createExceptionReply();
157: AlreadyBoundHelper.write(out, ex);
158: }
159: break;
160: }
161:
162: case 1 :
163: {
164: try
165: {
166: NameComponent[] a_name = NameHelper.read(in);
167: org.omg.CORBA.Object an_object = ObjectHelper.read(in);
168: rebind(a_name, an_object);
169: out = rh.createReply();
170: }
171: catch (NotFound ex)
172: {
173: out = rh.createExceptionReply();
174: NotFoundHelper.write(out, ex);
175: }
176: catch (CannotProceed ex)
177: {
178: out = rh.createExceptionReply();
179: CannotProceedHelper.write(out, ex);
180: }
181: catch (InvalidName ex)
182: {
183: out = rh.createExceptionReply();
184: InvalidNameHelper.write(out, ex);
185: }
186: break;
187: }
188:
189: case 2 :
190: {
191: try
192: {
193: NameComponent[] a_name = NameHelper.read(in);
194: NamingContext a_context = NamingContextHelper.read(in);
195: bind_context(a_name, a_context);
196: out = rh.createReply();
197: }
198: catch (NotFound ex)
199: {
200: out = rh.createExceptionReply();
201: NotFoundHelper.write(out, ex);
202: }
203: catch (CannotProceed ex)
204: {
205: out = rh.createExceptionReply();
206: CannotProceedHelper.write(out, ex);
207: }
208: catch (InvalidName ex)
209: {
210: out = rh.createExceptionReply();
211: InvalidNameHelper.write(out, ex);
212: }
213: catch (AlreadyBound ex)
214: {
215: out = rh.createExceptionReply();
216: AlreadyBoundHelper.write(out, ex);
217: }
218: break;
219: }
220:
221: case 3 :
222: {
223: try
224: {
225: NameComponent[] a_name = NameHelper.read(in);
226: NamingContext a_context = NamingContextHelper.read(in);
227: rebind_context(a_name, a_context);
228: out = rh.createReply();
229: }
230: catch (NotFound ex)
231: {
232: out = rh.createExceptionReply();
233: NotFoundHelper.write(out, ex);
234: }
235: catch (CannotProceed ex)
236: {
237: out = rh.createExceptionReply();
238: CannotProceedHelper.write(out, ex);
239: }
240: catch (InvalidName ex)
241: {
242: out = rh.createExceptionReply();
243: InvalidNameHelper.write(out, ex);
244: }
245: break;
246: }
247:
248: case 4 :
249: {
250: try
251: {
252: NameComponent[] a_name = NameHelper.read(in);
253: org.omg.CORBA.Object __result = null;
254: __result = resolve(a_name);
255: out = rh.createReply();
256: ObjectHelper.write(out, __result);
257: }
258: catch (NotFound ex)
259: {
260: out = rh.createExceptionReply();
261: NotFoundHelper.write(out, ex);
262: }
263: catch (CannotProceed ex)
264: {
265: out = rh.createExceptionReply();
266: CannotProceedHelper.write(out, ex);
267: }
268: catch (InvalidName ex)
269: {
270: out = rh.createExceptionReply();
271: InvalidNameHelper.write(out, ex);
272: }
273: break;
274: }
275:
276: case 5 :
277: {
278: try
279: {
280: NameComponent[] a_name = NameHelper.read(in);
281: unbind(a_name);
282: out = rh.createReply();
283: }
284: catch (NotFound ex)
285: {
286: out = rh.createExceptionReply();
287: NotFoundHelper.write(out, ex);
288: }
289: catch (CannotProceed ex)
290: {
291: out = rh.createExceptionReply();
292: CannotProceedHelper.write(out, ex);
293: }
294: catch (InvalidName ex)
295: {
296: out = rh.createExceptionReply();
297: InvalidNameHelper.write(out, ex);
298: }
299: break;
300: }
301:
302: case 6 :
303: {
304: NamingContext __result = null;
305: __result = new_context();
306: out = rh.createReply();
307: NamingContextHelper.write(out, __result);
308: break;
309: }
310:
311: case 7 :
312: {
313: try
314: {
315: NameComponent[] a_name = NameHelper.read(in);
316: NamingContext __result = null;
317: __result = bind_new_context(a_name);
318: out = rh.createReply();
319: NamingContextHelper.write(out, __result);
320: }
321: catch (NotFound ex)
322: {
323: out = rh.createExceptionReply();
324: NotFoundHelper.write(out, ex);
325: }
326: catch (AlreadyBound ex)
327: {
328: out = rh.createExceptionReply();
329: AlreadyBoundHelper.write(out, ex);
330: }
331: catch (CannotProceed ex)
332: {
333: out = rh.createExceptionReply();
334: CannotProceedHelper.write(out, ex);
335: }
336: catch (InvalidName ex)
337: {
338: out = rh.createExceptionReply();
339: InvalidNameHelper.write(out, ex);
340: }
341: break;
342: }
343:
344: case 8 :
345: {
346: try
347: {
348: destroy();
349: out = rh.createReply();
350: }
351: catch (NotEmpty ex)
352: {
353: out = rh.createExceptionReply();
354: NotEmptyHelper.write(out, ex);
355: }
356: break;
357: }
358:
359: case 9 :
360: {
361: int amount = in.read_ulong();
362: BindingListHolder a_list = new BindingListHolder();
363: BindingIteratorHolder an_iter = new BindingIteratorHolder();
364: list(amount, a_list, an_iter);
365: out = rh.createReply();
366: BindingListHelper.write(out, a_list.value);
367: BindingIteratorHelper.write(out, an_iter.value);
368: break;
369: }
370:
371: default :
372: throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
373: }
374:
375: return out;
376: }
377:
378:
385: public void invoke(ServerRequest request)
386: {
387: Streamable result = null;
388:
389:
390: Integer call_method = (Integer) methods.get(request.operation());
391: if (call_method == null)
392: throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
393:
394: switch (call_method.intValue())
395: {
396: case 4 :
397: result = new ObjectHolder();
398: break;
399:
400: case 6 :
401: case 7 :
402: {
403: result = new NamingContextHolder();
404: break;
405: }
406:
407: default :
408: result = null;
409: }
410:
411: gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result);
412: }