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