1. /*
  2. * @(#)ServerRequest.java 1.21 01/11/29
  3. *
  4. * Copyright 2002 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. * Retrieves the name of the operation being
  67. * invoked. According to OMG IDL's rules, these names must be unique
  68. * among all operations supported by this object's "most-derived"
  69. * interface. Note that the operation names for getting and setting
  70. * attributes are _get_<attribute_name> and _set_<attribute_name>,
  71. * respectively.
  72. *
  73. * @return the name of the operation to be invoked
  74. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  75. * package comments for unimplemented features</a>
  76. */
  77. public String operation()
  78. {
  79. throw new org.omg.CORBA.NO_IMPLEMENT();
  80. }
  81. /**
  82. * Specifies method parameter types and retrieves "in" and "inout"
  83. * argument values.
  84. * <P>
  85. * Note that this method is deprecated; use the method
  86. * <code>arguments</code> in its place.
  87. * <P>
  88. * Unless it calls the method <code>set_exception</code>,
  89. * the DIR must call this method exactly once, even if the
  90. * method signature contains no parameters. Once the method <code>
  91. * arguments</code> or <code>set_exception</code>
  92. * has been called, calling <code>arguments</code> on the same
  93. * <code>ServerRequest</code> object
  94. * will result in a <code>BAD_INV_ORDER</code> system exception.
  95. * The DIR must pass in to the method <code>arguments</code>
  96. * an NVList initialized with TypeCodes and Flags
  97. * describing the parameter types for the operation, in the order in which
  98. * they appear in the IDL specification (left to right). A
  99. * potentially-different NVList will be returned from
  100. * <code>arguments</code>, with the
  101. * "in" and "inout" argument values supplied. If it does not call
  102. * the method <code>set_exception</code>,
  103. * the DIR must supply the returned NVList with return
  104. * values for any "out" arguments before returning, and may also change
  105. * the return values for any "inout" arguments.
  106. *
  107. * @param params the arguments of the method, in the
  108. * form of an <code>NVList</code> object
  109. * @deprecated use the method <code>arguments</code>
  110. */
  111. public void params(NVList params)
  112. {
  113. arguments(params);
  114. }
  115. /**
  116. * Specifies method parameter types and retrieves "in" and "inout"
  117. * argument values.
  118. * Unless it calls the method <code>set_exception</code>,
  119. * the DIR must call this method exactly once, even if the
  120. * method signature contains no parameters. Once the method <code>
  121. * arguments</code> or <code>set_exception</code>
  122. * has been called, calling <code>arguments</code> on the same
  123. * <code>ServerRequest</code> object
  124. * will result in a <code>BAD_INV_ORDER</code> system exception.
  125. * The DIR must pass in to the method <code>arguments</code>
  126. * an NVList initialized with TypeCodes and Flags
  127. * describing the parameter types for the operation, in the order in which
  128. * they appear in the IDL specification (left to right). A
  129. * potentially-different NVList will be returned from
  130. * <code>arguments</code>, with the
  131. * "in" and "inout" argument values supplied. If it does not call
  132. * the method <code>set_exception</code>,
  133. * the DIR must supply the returned NVList with return
  134. * values for any "out" arguments before returning, and it may also change
  135. * the return values for any "inout" arguments.
  136. *
  137. * @param args the arguments of the method, in the
  138. * form of an NVList
  139. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  140. * package comments for unimplemented features</a>
  141. */
  142. public void arguments(org.omg.CORBA.NVList args) {
  143. throw new org.omg.CORBA.NO_IMPLEMENT();
  144. }
  145. /**
  146. * Specifies any return value for the call.
  147. * <P>
  148. * Note that this method is deprecated; use the method
  149. * <code>set_result</code> in its place.
  150. * <P>
  151. * Unless the method
  152. * <code>set_exception</code> is called, if the invoked method
  153. * has a non-void result type, the method <code>set_result</code>
  154. * must be called exactly once before the DIR returns.
  155. * If the operation has a void result type, the method
  156. * <code>set_result</code> may optionally be
  157. * called once with an <code>Any</code> object whose type is
  158. * <code>tk_void</code>. Calling the method <code>set_result</code> before
  159. * the method <code>arguments</code> has been called or after
  160. * the method <code>set_result</code> or <code>set_exception</code> has been
  161. * called will result in a BAD_INV_ORDER exception. Calling the method
  162. * <code>set_result</code> without having previously called
  163. * the method <code>ctx</code> when the IDL operation contains a
  164. * context expression, or when the NVList passed to arguments did not
  165. * describe all parameters passed by the client, may result in a MARSHAL
  166. * system exception.
  167. *
  168. * @deprecated use the method <code>set_result</code>
  169. */
  170. public void result(Any any)
  171. {
  172. set_result(any);
  173. }
  174. /**
  175. * Specifies any return value for the call. Unless the method
  176. * <code>set_exception</code> is called, if the invoked method
  177. * has a non-void result type, the method <code>set_result</code>
  178. * must be called exactly once before the DIR returns.
  179. * If the operation has a void result type, the method
  180. * <code>set_result</code> may optionally be
  181. * called once with an <code>Any</code> object whose type is
  182. * <code>tk_void</code>. Calling the method <code>set_result</code> before
  183. * the method <code>arguments</code> has been called or after
  184. * the method <code>set_result</code> or <code>set_exception</code> has been
  185. * called will result in a BAD_INV_ORDER exception. Calling the method
  186. * <code>set_result</code> without having previously called
  187. * the method <code>ctx</code> when the IDL operation contains a
  188. * context expression, or when the NVList passed to arguments did not
  189. * describe all parameters passed by the client, may result in a MARSHAL
  190. * system exception.
  191. *
  192. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  193. * package comments for unimplemented features</a>
  194. */
  195. public void set_result(org.omg.CORBA.Any any)
  196. {
  197. throw new org.omg.CORBA.NO_IMPLEMENT();
  198. }
  199. /**
  200. * The DIR may call set_exception at any time to return an exception to the
  201. * client. The Any passed to set_exception must contain either a system
  202. * exception or a user exception specified in the raises expression
  203. * of the invoked operation's IDL definition. Passing in an Any that does
  204. * not
  205. * contain an exception will result in a BAD_PARAM system exception. Passing
  206. * in an unlisted user exception will result in either the DIR receiving a
  207. * BAD_PARAM system exception or in the client receiving an
  208. * UNKNOWN_EXCEPTION system exception.
  209. *
  210. * @param any the <code>Any</code> object containing the exception
  211. * @deprecated use set_exception()
  212. */
  213. public void except(Any any)
  214. {
  215. set_exception(any);
  216. }
  217. /**
  218. * Returns the given exception to the client. This method
  219. * is invoked by the DIR, which may call it at any time.
  220. * The <code>Any</code> object passed to this method must
  221. * contain either a system
  222. * exception or one of the user exceptions specified in the
  223. * invoked operation's IDL definition. Passing in an
  224. * <code>Any</code> object that does not contain an exception
  225. * will cause a BAD_PARAM system exception to be thrown. Passing
  226. * in an unlisted user exception will result in either the DIR receiving a
  227. * BAD_PARAM system exception or in the client receiving an
  228. * UNKNOWN_EXCEPTION system exception.
  229. *
  230. * @param any the <code>Any</code> object containing the exception
  231. * @exception BAD_PARAM if the given <code>Any</code> object does not
  232. * contain an exception or the exception is an
  233. * unlisted user exception
  234. * @exception UNKNOWN_EXCEPTION if the given exception is an unlisted
  235. * user exception and the DIR did not
  236. * receive a BAD_PARAM exception
  237. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  238. * package comments for unimplemented features</a>
  239. */
  240. public void set_exception(Any any)
  241. {
  242. throw new org.omg.CORBA.NO_IMPLEMENT();
  243. }
  244. /**
  245. * Returns the context information specified in IDL for the operation
  246. * when the operation is not an attribute access and the operation's IDL
  247. * definition contains a context expression; otherwise it returns
  248. * a nil <code>Context</code> reference. Calling the method
  249. * <code>ctx</code> before the method <code>arguments</code> has
  250. * been called or after the method <code>ctx</code>,
  251. * <code>set_result</code>, or <code>set_exception</code>
  252. * has been called will result in a
  253. * BAD_INV_ORDER system exception.
  254. *
  255. * @return the context object that is to be used
  256. * to resolve any context strings whose
  257. * values need to be sent with the invocation.
  258. * @exception BAD_INV_ORDER if (1) the method <code>ctx</code> is called
  259. * before the method <code>arguments</code> or
  260. * (2) the method <code>ctx</code> is called
  261. * after calling <code>set_result</code> or
  262. * <code>set_exception</code>
  263. */
  264. public abstract Context ctx();
  265. }