1. /*
  2. * @(#)ServerRequest.java 1.29 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package org.omg.CORBA;
  8. /**
  9. * An object that captures the explicit state of a request
  10. * for the Dynamic Skeleton Interface (DSI). This class, the
  11. * cornerstone of the DSI, is analogous to the <code>Request</code>
  12. * object in the DII.
  13. * <P>
  14. * The ORB is responsible for creating this embodiment of a request,
  15. * and delivering it to a Dynamic Implementation Routine (DIR).
  16. * A dynamic servant (a DIR) is created by implementing the
  17. * <code>DynamicImplementation</code> class,
  18. * which has a single <code>invoke</code> method. This method accepts a
  19. * <code>ServerRequest</code> object.
  20. *
  21. * The abstract class <code>ServerRequest</code> defines
  22. * methods for accessing the
  23. * method name, the arguments and the context of the request, as
  24. * well as methods for setting the result of the request either as a
  25. * return value or an exception. <p>
  26. *
  27. * A subtlety with accessing the arguments of the request is that the
  28. * DIR needs to provide type information about the
  29. * expected arguments, since there is no compiled information about
  30. * these. This information is provided through an <code>NVList</code>,
  31. * which is a list of <code>NamedValue</code> objects.
  32. * Each <code>NamedValue</code> object
  33. * contains an <code>Any</code> object, which in turn
  34. * has a <code>TypeCode</code> object representing the type
  35. * of the argument. <p>
  36. *
  37. * Similarly, type information needs to be provided for the response,
  38. * for either the expected result or for an exception, so the methods
  39. * <code>result</code> and <code>except</code> take an <code>Any</code>
  40. * object as a parameter. <p>
  41. *
  42. * @see org.omg.CORBA.DynamicImplementation
  43. * @see org.omg.CORBA.NVList
  44. * @see org.omg.CORBA.NamedValue
  45. *
  46. * @version 1.15 09/09/97
  47. */
  48. public abstract class ServerRequest {
  49. /**
  50. * Retrieves the name of the operation being
  51. * invoked. According to OMG IDL's rules, these names must be unique
  52. * among all operations supported by this object's "most-derived"
  53. * interface. Note that the operation names for getting and setting
  54. * attributes are <code>_get_<attribute_name></code>
  55. * and <code>_set_<attribute_name></code>,
  56. * respectively.
  57. *
  58. * @return the name of the operation to be invoked
  59. * @deprecated use operation()
  60. */
  61. public String op_name()
  62. {
  63. return operation();
  64. }
  65. /**
  66. * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception.
  67. * <P>
  68. * Retrieves the name of the operation being
  69. * invoked. According to OMG IDL's rules, these names must be unique
  70. * among all operations supported by this object's "most-derived"
  71. * interface. Note that the operation names for getting and setting
  72. * attributes are <code>_get_<attribute_name></code>
  73. * and <code>_set_<attribute_name></code>,
  74. * respectively.
  75. *
  76. * @return the name of the operation to be invoked
  77. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  78. * package comments for unimplemented features</a>
  79. */
  80. public String operation()
  81. {
  82. throw new org.omg.CORBA.NO_IMPLEMENT();
  83. }
  84. /**
  85. * Specifies method parameter types and retrieves "in" and "inout"
  86. * argument values.
  87. * <P>
  88. * Note that this method is deprecated; use the method
  89. * <code>arguments</code> in its place.
  90. * <P>
  91. * Unless it calls the method <code>set_exception</code>,
  92. * the DIR must call this method exactly once, even if the
  93. * method signature contains no parameters. Once the method <code>
  94. * arguments</code> or <code>set_exception</code>
  95. * has been called, calling <code>arguments</code> on the same
  96. * <code>ServerRequest</code> object
  97. * will result in a <code>BAD_INV_ORDER</code> system exception.
  98. * The DIR must pass in to the method <code>arguments</code>
  99. * an NVList initialized with TypeCodes and Flags
  100. * describing the parameter types for the operation, in the order in which
  101. * they appear in the IDL specification (left to right). A
  102. * potentially-different NVList will be returned from
  103. * <code>arguments</code>, with the
  104. * "in" and "inout" argument values supplied. If it does not call
  105. * the method <code>set_exception</code>,
  106. * the DIR must supply the returned NVList with return
  107. * values for any "out" arguments before returning, and may also change
  108. * the return values for any "inout" arguments.
  109. *
  110. * @param params the arguments of the method, in the
  111. * form of an <code>NVList</code> object
  112. * @deprecated use the method <code>arguments</code>
  113. */
  114. public void params(NVList params)
  115. {
  116. arguments(params);
  117. }
  118. /**
  119. * Specifies method parameter types and retrieves "in" and "inout"
  120. * argument values.
  121. * Unless it calls the method <code>set_exception</code>,
  122. * the DIR must call this method exactly once, even if the
  123. * method signature contains no parameters. Once the method <code>
  124. * arguments</code> or <code>set_exception</code>
  125. * has been called, calling <code>arguments</code> on the same
  126. * <code>ServerRequest</code> object
  127. * will result in a <code>BAD_INV_ORDER</code> system exception.
  128. * The DIR must pass in to the method <code>arguments</code>
  129. * an NVList initialized with TypeCodes and Flags
  130. * describing the parameter types for the operation, in the order in which
  131. * they appear in the IDL specification (left to right). A
  132. * potentially-different NVList will be returned from
  133. * <code>arguments</code>, with the
  134. * "in" and "inout" argument values supplied. If it does not call
  135. * the method <code>set_exception</code>,
  136. * the DIR must supply the returned NVList with return
  137. * values for any "out" arguments before returning, and it may also change
  138. * the return values for any "inout" arguments.
  139. *
  140. * @param args the arguments of the method, in the
  141. * form of an NVList
  142. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  143. * package comments for unimplemented features</a>
  144. */
  145. public void arguments(org.omg.CORBA.NVList args) {
  146. throw new org.omg.CORBA.NO_IMPLEMENT();
  147. }
  148. /**
  149. * Specifies any return value for the call.
  150. * <P>
  151. * Note that this method is deprecated; use the method
  152. * <code>set_result</code> in its place.
  153. * <P>
  154. * Unless the method
  155. * <code>set_exception</code> is called, if the invoked method
  156. * has a non-void result type, the method <code>set_result</code>
  157. * must be called exactly once before the DIR returns.
  158. * If the operation has a void result type, the method
  159. * <code>set_result</code> may optionally be
  160. * called once with an <code>Any</code> object whose type is
  161. * <code>tk_void</code>. Calling the method <code>set_result</code> before
  162. * the method <code>arguments</code> has been called or after
  163. * the method <code>set_result</code> or <code>set_exception</code> has been
  164. * called will result in a BAD_INV_ORDER exception. Calling the method
  165. * <code>set_result</code> without having previously called
  166. * the method <code>ctx</code> when the IDL operation contains a
  167. * context expression, or when the NVList passed to arguments did not
  168. * describe all parameters passed by the client, may result in a MARSHAL
  169. * system exception.
  170. *
  171. * @param any an <code>Any</code> object containing the return value to be set
  172. * @deprecated use the method <code>set_result</code>
  173. */
  174. public void result(Any any)
  175. {
  176. set_result(any);
  177. }
  178. /**
  179. * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception.
  180. * <P>
  181. * Specifies any return value for the call. Unless the method
  182. * <code>set_exception</code> is called, if the invoked method
  183. * has a non-void result type, the method <code>set_result</code>
  184. * must be called exactly once before the DIR returns.
  185. * If the operation has a void result type, the method
  186. * <code>set_result</code> may optionally be
  187. * called once with an <code>Any</code> object whose type is
  188. * <code>tk_void</code>. Calling the method <code>set_result</code> before
  189. * the method <code>arguments</code> has been called or after
  190. * the method <code>set_result</code> or <code>set_exception</code> has been
  191. * called will result in a BAD_INV_ORDER exception. Calling the method
  192. * <code>set_result</code> without having previously called
  193. * the method <code>ctx</code> when the IDL operation contains a
  194. * context expression, or when the NVList passed to arguments did not
  195. * describe all parameters passed by the client, may result in a MARSHAL
  196. * system exception.
  197. *
  198. * @param any an <code>Any</code> object containing the return value to be set
  199. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  200. * package comments for unimplemented features</a>
  201. */
  202. public void set_result(org.omg.CORBA.Any any)
  203. {
  204. throw new org.omg.CORBA.NO_IMPLEMENT();
  205. }
  206. /**
  207. * The DIR may call set_exception at any time to return an exception to the
  208. * client. The Any passed to set_exception must contain either a system
  209. * exception or a user exception specified in the raises expression
  210. * of the invoked operation's IDL definition. Passing in an Any that does
  211. * not
  212. * contain an exception will result in a BAD_PARAM system exception. Passing
  213. * in an unlisted user exception will result in either the DIR receiving a
  214. * BAD_PARAM system exception or in the client receiving an
  215. * UNKNOWN_EXCEPTION system exception.
  216. *
  217. * @param any the <code>Any</code> object containing the exception
  218. * @deprecated use set_exception()
  219. */
  220. public void except(Any any)
  221. {
  222. set_exception(any);
  223. }
  224. /**
  225. * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception.
  226. * <P>
  227. * Returns the given exception to the client. This method
  228. * is invoked by the DIR, which may call it at any time.
  229. * The <code>Any</code> object passed to this method must
  230. * contain either a system
  231. * exception or one of the user exceptions specified in the
  232. * invoked operation's IDL definition. Passing in an
  233. * <code>Any</code> object that does not contain an exception
  234. * will cause a BAD_PARAM system exception to be thrown. Passing
  235. * in an unlisted user exception will result in either the DIR receiving a
  236. * BAD_PARAM system exception or in the client receiving an
  237. * UNKNOWN_EXCEPTION system exception.
  238. *
  239. * @param any the <code>Any</code> object containing the exception
  240. * @exception BAD_PARAM if the given <code>Any</code> object does not
  241. * contain an exception or the exception is an
  242. * unlisted user exception
  243. * @exception UNKNOWN_EXCEPTION if the given exception is an unlisted
  244. * user exception and the DIR did not
  245. * receive a BAD_PARAM exception
  246. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  247. * package comments for unimplemented features</a>
  248. */
  249. public void set_exception(Any any)
  250. {
  251. throw new org.omg.CORBA.NO_IMPLEMENT();
  252. }
  253. /**
  254. * Returns the context information specified in IDL for the operation
  255. * when the operation is not an attribute access and the operation's IDL
  256. * definition contains a context expression; otherwise it returns
  257. * a nil <code>Context</code> reference. Calling the method
  258. * <code>ctx</code> before the method <code>arguments</code> has
  259. * been called or after the method <code>ctx</code>,
  260. * <code>set_result</code>, or <code>set_exception</code>
  261. * has been called will result in a
  262. * BAD_INV_ORDER system exception.
  263. *
  264. * @return the context object that is to be used
  265. * to resolve any context strings whose
  266. * values need to be sent with the invocation.
  267. * @exception BAD_INV_ORDER if (1) the method <code>ctx</code> is called
  268. * before the method <code>arguments</code> or
  269. * (2) the method <code>ctx</code> is called
  270. * after calling <code>set_result</code> or
  271. * <code>set_exception</code>
  272. */
  273. public abstract Context ctx();
  274. }