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:
61:
68: public class _NamingContextStub
69: extends ObjectImpl
70: implements NamingContext
71: {
72:
75: private static final long serialVersionUID = 6835430958405349379L;
76:
77:
80: public _NamingContextStub()
81: {
82: super();
83: }
84:
85:
88: public _NamingContextStub(Delegate delegate)
89: {
90: super();
91: _set_delegate(delegate);
92: }
93:
94:
97: public String[] _ids()
98: {
99: return new String[] { NamingContextHelper.id() };
100: }
101:
102:
103: public void bind(NameComponent[] a_name, org.omg.CORBA.Object an_object)
104: throws NotFound, CannotProceed, InvalidName, AlreadyBound
105: {
106: InputStream in = null;
107: try
108: {
109: OutputStream out = _request("bind", true);
110: NameHelper.write(out, a_name);
111: ObjectHelper.write(out, an_object);
112: in = _invoke(out);
113: }
114: catch (ApplicationException ex)
115: {
116: in = ex.getInputStream();
117:
118: String id = ex.getId();
119: throw5(in, id);
120: }
121: catch (RemarshalException remarsh)
122: {
123: bind(a_name, an_object);
124: }
125: finally
126: {
127: _releaseReply(in);
128: }
129: }
130:
131:
132: public void bind_context(NameComponent[] a_name, NamingContext a_context)
133: throws NotFound, CannotProceed, InvalidName, AlreadyBound
134: {
135: InputStream in = null;
136: try
137: {
138: OutputStream out = _request("bind_context", true);
139: NameHelper.write(out, a_name);
140: NamingContextHelper.write(out, a_context);
141: in = _invoke(out);
142: }
143: catch (ApplicationException ex)
144: {
145: in = ex.getInputStream();
146:
147: String id = ex.getId();
148: throw5(in, id);
149: }
150: catch (RemarshalException remarsh)
151: {
152: bind_context(a_name, a_context);
153: }
154: finally
155: {
156: _releaseReply(in);
157: }
158: }
159:
160:
161: public NamingContext bind_new_context(NameComponent[] a_name)
162: throws NotFound, AlreadyBound, CannotProceed,
163: InvalidName
164: {
165: InputStream in = null;
166: try
167: {
168: OutputStream out = _request("bind_new_context", true);
169: NameHelper.write(out, a_name);
170: in = _invoke(out);
171:
172: NamingContext __result = NamingContextHelper.read(in);
173: return __result;
174: }
175: catch (ApplicationException ex)
176: {
177: in = ex.getInputStream();
178:
179: String id = ex.getId();
180: throw5(in, id);
181: throw new InternalError();
182: }
183: catch (RemarshalException remarsh)
184: {
185: return bind_new_context(a_name);
186: }
187: finally
188: {
189: _releaseReply(in);
190: }
191: }
192:
193:
194: public void destroy()
195: throws NotEmpty
196: {
197: InputStream in = null;
198: try
199: {
200: OutputStream out = _request("destroy", true);
201: in = _invoke(out);
202: }
203: catch (ApplicationException ex)
204: {
205: in = ex.getInputStream();
206:
207: String id = ex.getId();
208: if (id.equals(NotEmptyHelper.id()))
209: throw NotEmptyHelper.read(in);
210: else
211: throw new MARSHAL(id);
212: }
213: catch (RemarshalException remarsh)
214: {
215: destroy();
216: }
217: finally
218: {
219: _releaseReply(in);
220: }
221: }
222:
223:
224: public void list(int amount, BindingListHolder a_list,
225: BindingIteratorHolder an_iter
226: )
227: {
228: InputStream in = null;
229: try
230: {
231: OutputStream out = _request("list", true);
232: out.write_ulong(amount);
233: in = _invoke(out);
234: a_list.value = BindingListHelper.read(in);
235: an_iter.value = BindingIteratorHelper.read(in);
236: }
237: catch (ApplicationException ex)
238: {
239: in = ex.getInputStream();
240: throw new MARSHAL(ex.getId());
241: }
242: catch (RemarshalException remarsh)
243: {
244: list(amount, a_list, an_iter);
245: }
246: finally
247: {
248: _releaseReply(in);
249: }
250: }
251:
252:
253: public NamingContext new_context()
254: {
255: InputStream in = null;
256: try
257: {
258: OutputStream out = _request("new_context", true);
259: in = _invoke(out);
260:
261: NamingContext __result = NamingContextHelper.read(in);
262: return __result;
263: }
264: catch (ApplicationException ex)
265: {
266: in = ex.getInputStream();
267: throw new MARSHAL(ex.getId());
268: }
269: catch (RemarshalException remarsh)
270: {
271: return new_context();
272: }
273: finally
274: {
275: _releaseReply(in);
276: }
277: }
278:
279:
280: public void rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object)
281: throws NotFound, CannotProceed, InvalidName
282: {
283: InputStream in = null;
284: try
285: {
286: OutputStream out = _request("rebind", true);
287: NameHelper.write(out, a_name);
288: ObjectHelper.write(out, an_object);
289: in = _invoke(out);
290: }
291: catch (ApplicationException ex)
292: {
293: in = ex.getInputStream();
294:
295: String id = ex.getId();
296: throw4(in, id);
297: }
298: catch (RemarshalException remarsh)
299: {
300: rebind(a_name, an_object);
301: }
302: finally
303: {
304: _releaseReply(in);
305: }
306: }
307:
308:
309: public void rebind_context(NameComponent[] a_name, NamingContext a_context)
310: throws NotFound, CannotProceed, InvalidName
311: {
312: InputStream in = null;
313: try
314: {
315: OutputStream out = _request("rebind_context", true);
316: NameHelper.write(out, a_name);
317: NamingContextHelper.write(out, a_context);
318: in = _invoke(out);
319: }
320: catch (ApplicationException ex)
321: {
322: in = ex.getInputStream();
323:
324: String id = ex.getId();
325: throw4(in, id);
326: }
327: catch (RemarshalException remarsh)
328: {
329: rebind_context(a_name, a_context);
330: }
331: finally
332: {
333: _releaseReply(in);
334: }
335: }
336:
337:
338: public org.omg.CORBA.Object resolve(NameComponent[] a_name)
339: throws NotFound, CannotProceed, InvalidName
340: {
341: InputStream in = null;
342: try
343: {
344: OutputStream out = _request("resolve", true);
345: NameHelper.write(out, a_name);
346: in = _invoke(out);
347:
348: org.omg.CORBA.Object __result = ObjectHelper.read(in);
349: return __result;
350: }
351: catch (ApplicationException ex)
352: {
353: in = ex.getInputStream();
354:
355: String id = ex.getId();
356: throw4(in, id);
357: throw new InternalError();
358: }
359: catch (RemarshalException remarsh)
360: {
361: return resolve(a_name);
362: }
363: finally
364: {
365: _releaseReply(in);
366: }
367: }
368:
369:
370: public void unbind(NameComponent[] a_name)
371: throws NotFound, CannotProceed, InvalidName
372: {
373: InputStream in = null;
374: try
375: {
376: OutputStream out = _request("unbind", true);
377: NameHelper.write(out, a_name);
378: in = _invoke(out);
379: }
380: catch (ApplicationException ex)
381: {
382: in = ex.getInputStream();
383:
384: String id = ex.getId();
385: if (id.equals(NotFoundHelper.id()))
386: throw NotFoundHelper.read(in);
387: else if (id.equals(CannotProceedHelper.id()))
388: throw CannotProceedHelper.read(in);
389: else if (id.equals(InvalidNameHelper.id()))
390: throw InvalidNameHelper.read(in);
391: else
392: throw new MARSHAL(id);
393: }
394: catch (RemarshalException remarsh)
395: {
396: unbind(a_name);
397: }
398: finally
399: {
400: _releaseReply(in);
401: }
402: }
403:
404:
418: protected void throw4(InputStream in, String id)
419: throws MARSHAL, InvalidName, CannotProceed, NotFound
420: {
421: if (id.equals(NotFoundHelper.id()))
422: throw NotFoundHelper.read(in);
423: else if (id.equals(CannotProceedHelper.id()))
424: throw CannotProceedHelper.read(in);
425: else if (id.equals(InvalidNameHelper.id()))
426: throw InvalidNameHelper.read(in);
427: else
428: throw new MARSHAL(id);
429: }
430:
431:
446: protected void throw5(InputStream in, String id)
447: throws MARSHAL, AlreadyBound, InvalidName, CannotProceed,
448: NotFound
449: {
450: if (id.equals(AlreadyBoundHelper.id()))
451: throw AlreadyBoundHelper.read(in);
452: else
453: throw4(in, id);
454: }