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