1. package org.omg.CosNaming;
  2. /**
  3. * org/omg/CosNaming/NamingContextPOA.java .
  4. * Generated by the IDL-to-Java compiler (portable), version "3.1"
  5. * from ../../../../src/share/classes/org/omg/CosNaming/nameservice.idl
  6. * Monday, February 23, 2004 7:03:07 AM GMT
  7. */
  8. /**
  9. * A naming context is an object that contains a set of name bindings in
  10. * which each name is unique. Different names can be bound to an object
  11. * in the same or different contexts at the same time. <p>
  12. *
  13. * See <a href="http://www.omg.org/technology/documents/formal/naming_service.htm">
  14. * CORBA COS
  15. * Naming Specification.</a>
  16. */
  17. public abstract class NamingContextPOA extends org.omg.PortableServer.Servant
  18. implements org.omg.CosNaming.NamingContextOperations, org.omg.CORBA.portable.InvokeHandler
  19. {
  20. // Constructors
  21. private static java.util.Hashtable _methods = new java.util.Hashtable ();
  22. static
  23. {
  24. _methods.put ("bind", new java.lang.Integer (0));
  25. _methods.put ("bind_context", new java.lang.Integer (1));
  26. _methods.put ("rebind", new java.lang.Integer (2));
  27. _methods.put ("rebind_context", new java.lang.Integer (3));
  28. _methods.put ("resolve", new java.lang.Integer (4));
  29. _methods.put ("unbind", new java.lang.Integer (5));
  30. _methods.put ("list", new java.lang.Integer (6));
  31. _methods.put ("new_context", new java.lang.Integer (7));
  32. _methods.put ("bind_new_context", new java.lang.Integer (8));
  33. _methods.put ("destroy", new java.lang.Integer (9));
  34. }
  35. public org.omg.CORBA.portable.OutputStream _invoke (String $method,
  36. org.omg.CORBA.portable.InputStream in,
  37. org.omg.CORBA.portable.ResponseHandler $rh)
  38. {
  39. org.omg.CORBA.portable.OutputStream out = null;
  40. java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
  41. if (__method == null)
  42. throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
  43. switch (__method.intValue ())
  44. {
  45. /**
  46. * Creates a binding of a name and an object in the naming context.
  47. * Naming contexts that are bound using bind do not participate in name
  48. * resolution when compound names are passed to be resolved.
  49. *
  50. * @param n Name of the object <p>
  51. *
  52. * @param obj The Object to bind with the given name<p>
  53. *
  54. * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates
  55. * the name does not identify a binding.<p>
  56. *
  57. * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
  58. * Indicates that the implementation has given up for some reason.
  59. * The client, however, may be able to continue the operation
  60. * at the returned naming context.<p>
  61. *
  62. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
  63. * Indicates that the name is invalid. <p>
  64. *
  65. * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
  66. * Indicates an object is already bound to the specified name.<p>
  67. */
  68. case 0: // CosNaming/NamingContext/bind
  69. {
  70. try {
  71. org.omg.CosNaming.NameComponent n[] = org.omg.CosNaming.NameHelper.read (in);
  72. org.omg.CORBA.Object obj = org.omg.CORBA.ObjectHelper.read (in);
  73. this.bind (n, obj);
  74. out = $rh.createReply();
  75. } catch (org.omg.CosNaming.NamingContextPackage.NotFound $ex) {
  76. out = $rh.createExceptionReply ();
  77. org.omg.CosNaming.NamingContextPackage.NotFoundHelper.write (out, $ex);
  78. } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed $ex) {
  79. out = $rh.createExceptionReply ();
  80. org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.write (out, $ex);
  81. } catch (org.omg.CosNaming.NamingContextPackage.InvalidName $ex) {
  82. out = $rh.createExceptionReply ();
  83. org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.write (out, $ex);
  84. } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound $ex) {
  85. out = $rh.createExceptionReply ();
  86. org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.write (out, $ex);
  87. }
  88. break;
  89. }
  90. /**
  91. * Names an object that is a naming context. Naming contexts that
  92. * are bound using bind_context() participate in name resolution
  93. * when compound names are passed to be resolved.
  94. *
  95. * @param n Name of the object <p>
  96. *
  97. * @param nc NamingContect object to bind with the given name <p>
  98. *
  99. * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
  100. *
  101. * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  102. * given up for some reason. The client, however, may be able to
  103. * continue the operation at the returned naming context.<p>
  104. *
  105. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
  106. *
  107. * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates an object is already
  108. * bound to the specified name.<p>
  109. */
  110. case 1: // CosNaming/NamingContext/bind_context
  111. {
  112. try {
  113. org.omg.CosNaming.NameComponent n[] = org.omg.CosNaming.NameHelper.read (in);
  114. org.omg.CosNaming.NamingContext nc = org.omg.CosNaming.NamingContextHelper.read (in);
  115. this.bind_context (n, nc);
  116. out = $rh.createReply();
  117. } catch (org.omg.CosNaming.NamingContextPackage.NotFound $ex) {
  118. out = $rh.createExceptionReply ();
  119. org.omg.CosNaming.NamingContextPackage.NotFoundHelper.write (out, $ex);
  120. } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed $ex) {
  121. out = $rh.createExceptionReply ();
  122. org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.write (out, $ex);
  123. } catch (org.omg.CosNaming.NamingContextPackage.InvalidName $ex) {
  124. out = $rh.createExceptionReply ();
  125. org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.write (out, $ex);
  126. } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound $ex) {
  127. out = $rh.createExceptionReply ();
  128. org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.write (out, $ex);
  129. }
  130. break;
  131. }
  132. /**
  133. * Creates a binding of a name and an object in the naming context
  134. * even if the name is already bound in the context. Naming contexts
  135. * that are bound using rebind do not participate in name resolution
  136. * when compound names are passed to be resolved.
  137. *
  138. * @param n Name of the object <p>
  139. *
  140. * @parm obj The Object to rebind with the given name <p>
  141. *
  142. * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
  143. *
  144. * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  145. * given up for some reason. The client, however, may be able to
  146. * continue the operation at the returned naming context.<p>
  147. *
  148. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
  149. */
  150. case 2: // CosNaming/NamingContext/rebind
  151. {
  152. try {
  153. org.omg.CosNaming.NameComponent n[] = org.omg.CosNaming.NameHelper.read (in);
  154. org.omg.CORBA.Object obj = org.omg.CORBA.ObjectHelper.read (in);
  155. this.rebind (n, obj);
  156. out = $rh.createReply();
  157. } catch (org.omg.CosNaming.NamingContextPackage.NotFound $ex) {
  158. out = $rh.createExceptionReply ();
  159. org.omg.CosNaming.NamingContextPackage.NotFoundHelper.write (out, $ex);
  160. } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed $ex) {
  161. out = $rh.createExceptionReply ();
  162. org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.write (out, $ex);
  163. } catch (org.omg.CosNaming.NamingContextPackage.InvalidName $ex) {
  164. out = $rh.createExceptionReply ();
  165. org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.write (out, $ex);
  166. }
  167. break;
  168. }
  169. /**
  170. * Creates a binding of a name and a naming context in the naming
  171. * context even if the name is already bound in the context. Naming
  172. * contexts that are bound using rebind_context() participate in name
  173. * resolution when compound names are passed to be resolved.
  174. *
  175. * @param n Name of the object <p>
  176. *
  177. * @param nc NamingContect object to rebind with the given name <p>
  178. *
  179. * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
  180. *
  181. * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  182. * given up for some reason. The client, however, may be able to
  183. * continue the operation at the returned naming context.<p>
  184. *
  185. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
  186. */
  187. case 3: // CosNaming/NamingContext/rebind_context
  188. {
  189. try {
  190. org.omg.CosNaming.NameComponent n[] = org.omg.CosNaming.NameHelper.read (in);
  191. org.omg.CosNaming.NamingContext nc = org.omg.CosNaming.NamingContextHelper.read (in);
  192. this.rebind_context (n, nc);
  193. out = $rh.createReply();
  194. } catch (org.omg.CosNaming.NamingContextPackage.NotFound $ex) {
  195. out = $rh.createExceptionReply ();
  196. org.omg.CosNaming.NamingContextPackage.NotFoundHelper.write (out, $ex);
  197. } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed $ex) {
  198. out = $rh.createExceptionReply ();
  199. org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.write (out, $ex);
  200. } catch (org.omg.CosNaming.NamingContextPackage.InvalidName $ex) {
  201. out = $rh.createExceptionReply ();
  202. org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.write (out, $ex);
  203. }
  204. break;
  205. }
  206. /**
  207. * The resolve operation is the process of retrieving an object
  208. * bound to a name in a given context. The given name must exactly
  209. * match the bound name. The naming service does not return the type
  210. * of the object. Clients are responsible for "narrowing" the object
  211. * to the appropriate type. That is, clients typically cast the returned
  212. * object from Object to a more specialized interface.
  213. *
  214. * @param n Name of the object <p>
  215. *
  216. * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
  217. *
  218. * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  219. * given up for some reason. The client, however, may be able to
  220. * continue the operation at the returned naming context.<p>
  221. *
  222. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
  223. */
  224. case 4: // CosNaming/NamingContext/resolve
  225. {
  226. try {
  227. org.omg.CosNaming.NameComponent n[] = org.omg.CosNaming.NameHelper.read (in);
  228. org.omg.CORBA.Object $result = null;
  229. $result = this.resolve (n);
  230. out = $rh.createReply();
  231. org.omg.CORBA.ObjectHelper.write (out, $result);
  232. } catch (org.omg.CosNaming.NamingContextPackage.NotFound $ex) {
  233. out = $rh.createExceptionReply ();
  234. org.omg.CosNaming.NamingContextPackage.NotFoundHelper.write (out, $ex);
  235. } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed $ex) {
  236. out = $rh.createExceptionReply ();
  237. org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.write (out, $ex);
  238. } catch (org.omg.CosNaming.NamingContextPackage.InvalidName $ex) {
  239. out = $rh.createExceptionReply ();
  240. org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.write (out, $ex);
  241. }
  242. break;
  243. }
  244. /**
  245. * The unbind operation removes a name binding from a context.
  246. *
  247. * @param n Name of the object <p>
  248. *
  249. * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
  250. *
  251. * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  252. * given up for some reason. The client, however, may be able to
  253. * continue the operation at the returned naming context.<p>
  254. *
  255. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
  256. */
  257. case 5: // CosNaming/NamingContext/unbind
  258. {
  259. try {
  260. org.omg.CosNaming.NameComponent n[] = org.omg.CosNaming.NameHelper.read (in);
  261. this.unbind (n);
  262. out = $rh.createReply();
  263. } catch (org.omg.CosNaming.NamingContextPackage.NotFound $ex) {
  264. out = $rh.createExceptionReply ();
  265. org.omg.CosNaming.NamingContextPackage.NotFoundHelper.write (out, $ex);
  266. } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed $ex) {
  267. out = $rh.createExceptionReply ();
  268. org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.write (out, $ex);
  269. } catch (org.omg.CosNaming.NamingContextPackage.InvalidName $ex) {
  270. out = $rh.createExceptionReply ();
  271. org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.write (out, $ex);
  272. }
  273. break;
  274. }
  275. /**
  276. * The list operation allows a client to iterate through a set of
  277. * bindings in a naming context. <p>
  278. *
  279. * The list operation returns at most the requested number of
  280. * bindings in BindingList bl.
  281. * <ul>
  282. * <li>If the naming context contains additional
  283. * bindings, the list operation returns a BindingIterator with the
  284. * additional bindings.
  285. * <li>If the naming context does not contain additional
  286. * bindings, the binding iterator is a nil object reference.
  287. * </ul>
  288. *
  289. * @param how_many the maximum number of bindings to return <p>
  290. *
  291. * @param bl the returned list of bindings <p>
  292. *
  293. * @param bi the returned binding iterator <p>
  294. */
  295. case 6: // CosNaming/NamingContext/list
  296. {
  297. int how_many = in.read_ulong ();
  298. org.omg.CosNaming.BindingListHolder bl = new org.omg.CosNaming.BindingListHolder ();
  299. org.omg.CosNaming.BindingIteratorHolder bi = new org.omg.CosNaming.BindingIteratorHolder ();
  300. this.list (how_many, bl, bi);
  301. out = $rh.createReply();
  302. org.omg.CosNaming.BindingListHelper.write (out, bl.value);
  303. org.omg.CosNaming.BindingIteratorHelper.write (out, bi.value);
  304. break;
  305. }
  306. /**
  307. * This operation returns a naming context implemented by the same
  308. * naming server as the context on which the operation was invoked.
  309. * The new context is not bound to any name.
  310. */
  311. case 7: // CosNaming/NamingContext/new_context
  312. {
  313. org.omg.CosNaming.NamingContext $result = null;
  314. $result = this.new_context ();
  315. out = $rh.createReply();
  316. org.omg.CosNaming.NamingContextHelper.write (out, $result);
  317. break;
  318. }
  319. /**
  320. * This operation creates a new context and binds it to the name
  321. * supplied as an argument. The newly-created context is implemented
  322. * by the same naming server as the context in which it was bound (that
  323. * is, the naming server that implements the context denoted by the
  324. * name argument excluding the last component).
  325. *
  326. * @param n Name of the object <p>
  327. *
  328. * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.<p>
  329. *
  330. * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates an object is already
  331. * bound to the specified name.<p>
  332. *
  333. * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
  334. * given up for some reason. The client, however, may be able to
  335. * continue the operation at the returned naming context.<p>
  336. *
  337. * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. <p>
  338. */
  339. case 8: // CosNaming/NamingContext/bind_new_context
  340. {
  341. try {
  342. org.omg.CosNaming.NameComponent n[] = org.omg.CosNaming.NameHelper.read (in);
  343. org.omg.CosNaming.NamingContext $result = null;
  344. $result = this.bind_new_context (n);
  345. out = $rh.createReply();
  346. org.omg.CosNaming.NamingContextHelper.write (out, $result);
  347. } catch (org.omg.CosNaming.NamingContextPackage.NotFound $ex) {
  348. out = $rh.createExceptionReply ();
  349. org.omg.CosNaming.NamingContextPackage.NotFoundHelper.write (out, $ex);
  350. } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound $ex) {
  351. out = $rh.createExceptionReply ();
  352. org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.write (out, $ex);
  353. } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed $ex) {
  354. out = $rh.createExceptionReply ();
  355. org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.write (out, $ex);
  356. } catch (org.omg.CosNaming.NamingContextPackage.InvalidName $ex) {
  357. out = $rh.createExceptionReply ();
  358. org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.write (out, $ex);
  359. }
  360. break;
  361. }
  362. /**
  363. * The destroy operation deletes a naming context. If the naming
  364. * context contains bindings, the NotEmpty exception is raised.
  365. *
  366. * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty Indicates that the Naming Context contains bindings.
  367. */
  368. case 9: // CosNaming/NamingContext/destroy
  369. {
  370. try {
  371. this.destroy ();
  372. out = $rh.createReply();
  373. } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty $ex) {
  374. out = $rh.createExceptionReply ();
  375. org.omg.CosNaming.NamingContextPackage.NotEmptyHelper.write (out, $ex);
  376. }
  377. break;
  378. }
  379. default:
  380. throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
  381. }
  382. return out;
  383. } // _invoke
  384. // Type-specific CORBA::Object operations
  385. private static String[] __ids = {
  386. "IDL:omg.org/CosNaming/NamingContext:1.0"};
  387. public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
  388. {
  389. return (String[])__ids.clone ();
  390. }
  391. public NamingContext _this()
  392. {
  393. return NamingContextHelper.narrow(
  394. super._this_object());
  395. }
  396. public NamingContext _this(org.omg.CORBA.ORB orb)
  397. {
  398. return NamingContextHelper.narrow(
  399. super._this_object(orb));
  400. }
  401. } // class NamingContextPOA