1. /*
  2. * @(#)Request.java 1.21 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 containing the information necessary for
  13. * invoking a method. This class is
  14. * the cornerstone of the ORB Dynamic
  15. * Invocation Interface (DII), which allows dynamic creation and
  16. * invocation of requests.
  17. * A server cannot tell the difference between a client
  18. * invocation using a client stub and a request using the DII.
  19. * <P>
  20. * A <code>Request</code> object consists of:
  21. * <UL>
  22. * <LI>the name of the operation to be invoked
  23. * <LI>an <code>NVList</code> containing arguments for the operation.<BR>
  24. * Each item in the list is a <code>NamedValue</code> object, which has three
  25. * parts:
  26. * <OL>
  27. * <LI>the name of the argument
  28. * <LI>the value of the argument (as an <code>Any</code> object)
  29. * <LI>the argument mode flag indicating whether the argument is
  30. * for input, output, or both
  31. * </OL>
  32. * </UL>
  33. * <P>
  34. * <code>Request</code> objects may also contain additional information,
  35. * depending on how an operation was defined in the original IDL
  36. * interface definition. For example, where appropriate, they may contain
  37. * a <code>NamedValue</code> object to hold the return value or exception,
  38. * a context, a list of possible exceptions, and a list of
  39. * context strings that need to be resolved.
  40. * <P>
  41. * New <code>Request</code> objects are created using one of the
  42. * <code>create_request</code> methods in the <code>Object</code> class.
  43. * In other words, a <code>create_request</code> method is performed on the
  44. * object which is to be invoked.
  45. *
  46. * @see org.omg.CORBA.NamedValue
  47. *
  48. * @version 1.13 09/09/97
  49. */
  50. public abstract class Request {
  51. /**
  52. * Retrieves the the target object reference.
  53. *
  54. * @return the object reference that points to the
  55. * object implementation for the method
  56. * to be invoked
  57. */
  58. public abstract org.omg.CORBA.Object target();
  59. /**
  60. * Retrieves the name of the method to be invoked.
  61. *
  62. * @return the name of the method to be invoked
  63. */
  64. public abstract String operation();
  65. /**
  66. * Retrieves the <code>NVList</code> object containing the arguments
  67. * to the method being invoked. The elements in the list are
  68. * <code>NamedValue</code> objects, with each one describing an argument
  69. * to the method.
  70. *
  71. * @return the <code>NVList</code> object containing the arguments
  72. * for the method
  73. *
  74. */
  75. public abstract NVList arguments();
  76. /**
  77. * Retrieves the <code>NamedValue</code> object containing the return
  78. * value for the method.
  79. *
  80. * @return the <code>NamedValue</code> object containing the result
  81. * of the method
  82. */
  83. public abstract NamedValue result();
  84. /**
  85. * Retrieves the <code>Environment</code> object for this request.
  86. * It contains the exception that the method being invoked has
  87. * thrown (after the invocation returns).
  88. *
  89. *
  90. * @return the <code>Environment</code> object for this request
  91. */
  92. public abstract Environment env();
  93. /**
  94. * Retrieves the <code>ExceptionList</code> object for this request.
  95. * This list contains <code>TypeCode</code> objects describing the
  96. * exceptions that may be thrown by the method being invoked.
  97. *
  98. * @return the <code>ExceptionList</code> object describing the exceptions
  99. * that may be thrown by the method being invoked
  100. */
  101. public abstract ExceptionList exceptions();
  102. /**
  103. * Retrieves the <code>ContextList</code> object for this request.
  104. * This list contains context <code>String</code>s that need to
  105. * be resolved and sent with the invocation.
  106. *
  107. *
  108. * @return the list of context strings whose values
  109. * need to be resolved and sent with the
  110. * invocation.
  111. */
  112. public abstract ContextList contexts();
  113. /**
  114. * Retrieves the <code>Context</code> object for this request.
  115. * This is a list of properties giving information about the
  116. * client, the environment, or the circumstances of this request.
  117. *
  118. * @return the <code>Context</code> object that is to be used
  119. * to resolve any context strings whose
  120. * values need to be sent with the invocation
  121. */
  122. public abstract Context ctx();
  123. /**
  124. * Sets this request's <code>Context</code> object to the one given.
  125. *
  126. * @param c the new <code>Context</code> object to be used for
  127. * resolving context strings
  128. */
  129. public abstract void ctx(Context c);
  130. /**
  131. * Creates an input argument and adds it to this <code>Request</code>
  132. * object.
  133. *
  134. * @return an <code>Any</code> object that contains the
  135. * value and typecode for the input argument added
  136. */
  137. public abstract Any add_in_arg();
  138. /**
  139. * Creates an input argument with the given name and adds it to
  140. * this <code>Request</code> object.
  141. *
  142. * @param name the name of the argument being added
  143. * @return an <code>Any</code> object that contains the
  144. * value and typecode for the input argument added
  145. */
  146. public abstract Any add_named_in_arg(String name);
  147. /**
  148. * Adds an input/output argument to this <code>Request</code> object.
  149. *
  150. * @return an <code>Any</code> object that contains the
  151. * value and typecode for the input/output argument added
  152. */
  153. public abstract Any add_inout_arg();
  154. /**
  155. * Adds an input/output argument with the given name to this
  156. * <code>Request</code> object.
  157. *
  158. * @param name the name of the argument being added
  159. * @return an <code>Any</code> object that contains the
  160. * value and typecode for the input/output argument added
  161. */
  162. public abstract Any add_named_inout_arg(String name);
  163. /**
  164. * Adds an output argument to this <code>Request</code> object.
  165. *
  166. * @return an <code>Any</code> object that contains the
  167. * value and typecode for the output argument added
  168. */
  169. public abstract Any add_out_arg();
  170. /**
  171. * Adds an output argument with the given name to this
  172. * <code>Request</code> object.
  173. *
  174. * @param name the name of the argument being added
  175. * @return an <code>Any</code> object that contains the
  176. * value and typecode for the output argument added
  177. */
  178. public abstract Any add_named_out_arg(String name);
  179. /**
  180. * Sets the typecode for the return
  181. * value of the method.
  182. *
  183. * @param tc the <code>TypeCode</code> object containing type information
  184. * for the return value
  185. */
  186. public abstract void set_return_type(TypeCode tc);
  187. /**
  188. * Returns the <code>Any</code> object that contains the value for the
  189. * result of the method.
  190. *
  191. * @return an <code>Any</code> object containing the value and
  192. * typecode for the return value
  193. */
  194. public abstract Any return_value();
  195. /**
  196. * Makes a synchronous invocation using the
  197. * information in the <code>Request</code> object. Exception information is
  198. * placed into the <code>Request</code> object's environment object.
  199. */
  200. public abstract void invoke();
  201. /**
  202. * Makes a oneway invocation on the
  203. * request. In other words, it does not expect or wait for a
  204. * response. Note that this can be used even if the operation was
  205. * not declared as oneway in the IDL declaration. No response or
  206. * exception information is returned.
  207. */
  208. public abstract void send_oneway();
  209. /**
  210. * Makes an asynchronous invocation on
  211. * the request. In other words, it does not wait for a response before it
  212. * returns to the user. The user can then later use the methods
  213. * <code>poll_response</code> and <code>get_response</code> to get
  214. * the result or exception information for the invocation.
  215. */
  216. public abstract void send_deferred();
  217. /**
  218. * Allows the user to determine
  219. * whether a response has been received for the invocation triggered
  220. * earlier with the <code>send_deferred</code> method.
  221. *
  222. * @return <code>true</code> if the method response has
  223. * been received; <code>false</code> otherwise
  224. */
  225. public abstract boolean poll_response();
  226. /**
  227. * Allows the user to access the
  228. * response for the invocation triggered earlier with the
  229. * <code>send_deferred</code> method.
  230. *
  231. * @exception WrongTransaction if the method <code>get_response</code> was invoked
  232. * from a different transaction's scope than the one from which the
  233. * request was originally sent. See the OMG Transaction Service specification
  234. * for details.
  235. */
  236. public abstract void get_response() throws WrongTransaction;
  237. };