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