1. /*
  2. * @(#)ServerRequest.java 1.25 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package org.omg.CORBA;
  11. /**
  12. * An object that captures the explicit state of a request
  13. * for the Dynamic Skeleton Interface (DSI). This class, the
  14. * cornerstone of the DSI, is analogous to the <code>Request</code>
  15. * object in the DII.
  16. * <P>
  17. * The ORB is responsible for creating this embodiment of a request,
  18. * and delivering it to a Dynamic Implementation Routine (DIR).
  19. * A dynamic servant (a DIR) is created by implementing the
  20. * <code>DynamicImplementation</code> class,
  21. * which has a single <code>invoke</code> method. This method accepts a
  22. * <code>ServerRequest</code> object.
  23. *
  24. * The abstract class <code>ServerRequest</code> defines
  25. * methods for accessing the
  26. * method name, the arguments and the context of the request, as
  27. * well as methods for setting the result of the request either as a
  28. * return value or an exception. <p>
  29. *
  30. * A subtlety with accessing the arguments of the request is that the
  31. * DIR needs to provide type information about the
  32. * expected arguments, since there is no compiled information about
  33. * these. This information is provided through an <code>NVList</code>,
  34. * which is a list of <code>NamedValue</code> objects.
  35. * Each <code>NamedValue</code> object
  36. * contains an <code>Any</code> object, which in turn
  37. * has a <code>TypeCode</code> object representing the type
  38. * of the argument. <p>
  39. *
  40. * Similarly, type information needs to be provided for the response,
  41. * for either the expected result or for an exception, so the methods
  42. * <code>result</code> and <code>except</code> take an <code>Any</code>
  43. * object as a parameter. <p>
  44. *
  45. * @see org.omg.CORBA.DynamicImplementation
  46. * @see org.omg.CORBA.NVList
  47. * @see org.omg.CORBA.NamedValue
  48. *
  49. * @version 1.15 09/09/97
  50. */
  51. public abstract class ServerRequest {
  52. /**
  53. * Retrieves the name of the operation being
  54. * invoked. According to OMG IDL's rules, these names must be unique
  55. * among all operations supported by this object's "most-derived"
  56. * interface. Note that the operation names for getting and setting
  57. * attributes are <code>_get_<attribute_name></code>
  58. * and <code>_set_<attribute_name></code>,
  59. * respectively.
  60. *
  61. * @return the name of the operation to be invoked
  62. * @deprecated use operation()
  63. */
  64. public String op_name()
  65. {
  66. return operation();
  67. }
  68. /**
  69. * Retrieves the name of the operation being
  70. * invoked. According to OMG IDL's rules, these names must be unique
  71. * among all operations supported by this object's "most-derived"
  72. * interface. Note that the operation names for getting and setting
  73. * attributes are _get_<attribute_name> and _set_<attribute_name>,
  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. * @deprecated use the method <code>set_result</code>
  172. */
  173. public void result(Any any)
  174. {
  175. set_result(any);
  176. }
  177. /**
  178. * Specifies any return value for the call. Unless the method
  179. * <code>set_exception</code> is called, if the invoked method
  180. * has a non-void result type, the method <code>set_result</code>
  181. * must be called exactly once before the DIR returns.
  182. * If the operation has a void result type, the method
  183. * <code>set_result</code> may optionally be
  184. * called once with an <code>Any</code> object whose type is
  185. * <code>tk_void</code>. Calling the method <code>set_result</code> before
  186. * the method <code>arguments</code> has been called or after
  187. * the method <code>set_result</code> or <code>set_exception</code> has been
  188. * called will result in a BAD_INV_ORDER exception. Calling the method
  189. * <code>set_result</code> without having previously called
  190. * the method <code>ctx</code> when the IDL operation contains a
  191. * context expression, or when the NVList passed to arguments did not
  192. * describe all parameters passed by the client, may result in a MARSHAL
  193. * system exception.
  194. *
  195. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  196. * package comments for unimplemented features</a>
  197. */
  198. public void set_result(org.omg.CORBA.Any any)
  199. {
  200. throw new org.omg.CORBA.NO_IMPLEMENT();
  201. }
  202. /**
  203. * The DIR may call set_exception at any time to return an exception to the
  204. * client. The Any passed to set_exception must contain either a system
  205. * exception or a user exception specified in the raises expression
  206. * of the invoked operation's IDL definition. Passing in an Any that does
  207. * not
  208. * contain an exception will result in a BAD_PARAM system exception. Passing
  209. * in an unlisted user exception will result in either the DIR receiving a
  210. * BAD_PARAM system exception or in the client receiving an
  211. * UNKNOWN_EXCEPTION system exception.
  212. *
  213. * @param any the <code>Any</code> object containing the exception
  214. * @deprecated use set_exception()
  215. */
  216. public void except(Any any)
  217. {
  218. set_exception(any);
  219. }
  220. /**
  221. * Returns the given exception to the client. This method
  222. * is invoked by the DIR, which may call it at any time.
  223. * The <code>Any</code> object passed to this method must
  224. * contain either a system
  225. * exception or one of the user exceptions specified in the
  226. * invoked operation's IDL definition. Passing in an
  227. * <code>Any</code> object that does not contain an exception
  228. * will cause a BAD_PARAM system exception to be thrown. Passing
  229. * in an unlisted user exception will result in either the DIR receiving a
  230. * BAD_PARAM system exception or in the client receiving an
  231. * UNKNOWN_EXCEPTION system exception.
  232. *
  233. * @param any the <code>Any</code> object containing the exception
  234. * @exception BAD_PARAM if the given <code>Any</code> object does not
  235. * contain an exception or the exception is an
  236. * unlisted user exception
  237. * @exception UNKNOWN_EXCEPTION if the given exception is an unlisted
  238. * user exception and the DIR did not
  239. * receive a BAD_PARAM exception
  240. * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
  241. * package comments for unimplemented features</a>
  242. */
  243. public void set_exception(Any any)
  244. {
  245. throw new org.omg.CORBA.NO_IMPLEMENT();
  246. }
  247. /**
  248. * Returns the context information specified in IDL for the operation
  249. * when the operation is not an attribute access and the operation's IDL
  250. * definition contains a context expression; otherwise it returns
  251. * a nil <code>Context</code> reference. Calling the method
  252. * <code>ctx</code> before the method <code>arguments</code> has
  253. * been called or after the method <code>ctx</code>,
  254. * <code>set_result</code>, or <code>set_exception</code>
  255. * has been called will result in a
  256. * BAD_INV_ORDER system exception.
  257. *
  258. * @return the context object that is to be used
  259. * to resolve any context strings whose
  260. * values need to be sent with the invocation.
  261. * @exception BAD_INV_ORDER if (1) the method <code>ctx</code> is called
  262. * before the method <code>arguments</code> or
  263. * (2) the method <code>ctx</code> is called
  264. * after calling <code>set_result</code> or
  265. * <code>set_exception</code>
  266. */
  267. public abstract Context ctx();
  268. }