ServerRequestInfoOperations.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. /* ServerRequestInfoOperations.java --
  2. Copyright (C) 2005, 2006 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package org.omg.PortableInterceptor;
  32. import org.omg.CORBA.Any;
  33. import org.omg.CORBA.BAD_INV_ORDER;
  34. import org.omg.CORBA.INV_POLICY;
  35. import org.omg.CORBA.Policy;
  36. import org.omg.IOP.ServiceContext;
  37. /**
  38. * Provides request information, accessible for the
  39. * {@link ClientRequestInterceptor}. Some methods of this interface are not
  40. * valid at all interception points. The following table shows the validity of
  41. * each method. If it is not valid, BAD_INV_ORDER minor 14 will be thrown.
  42. *
  43. * <table border="1">
  44. * <tr>
  45. * <th></th>
  46. * <th>{@link ServerRequestInterceptorOperations#receive_request_service_contexts receive_request_<br>service_contexts}</th>
  47. * <th>{@link ServerRequestInterceptorOperations#receive_request receive_request}</th>
  48. * <th>{@link ServerRequestInterceptorOperations#send_reply send_reply}</th>
  49. * <th>{@link ServerRequestInterceptorOperations#send_exception send_exception}</th>
  50. * <th>{@link ServerRequestInterceptorOperations#send_other send_other}</th>
  51. * </tr>
  52. * <tr>
  53. * <td colspan="6" align="center" bgcolor="#E0E0FF"><i>Inherited from
  54. * {@link RequestInfoOperations}:</i></td>
  55. * </tr>
  56. * <tr>
  57. * <th>{@linkplain RequestInfoOperations#arguments arguments}</th>
  58. * <td bgcolor="lightgray">no </td>
  59. * <td bgcolor="#E0E0E0" title="in and inout only">yes<sub><a href="#1">1</a></sub></td>
  60. * <td>yes</td>
  61. * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">no<sub><a
  62. * href="#2">2</a></sub></td>
  63. * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">no<sub><a
  64. * href="#2">2</a></sub> </td>
  65. * </tr>
  66. * <tr>
  67. * <th>{@linkplain RequestInfoOperations#exceptions exceptions}</th>
  68. * <td bgcolor="lightgray">no </td>
  69. * <td colspan="4" align ="center">yes</td>
  70. * </tr>
  71. * <tr>
  72. * <th>{@linkplain RequestInfoOperations#contexts contexts}</th>
  73. * <td bgcolor="lightgray">no </td>
  74. * <td colspan="4" align ="center">yes</td>
  75. * </tr>
  76. * <tr>
  77. * <th>{@linkplain RequestInfoOperations#operation_context operation_context}</th>
  78. * <td bgcolor="lightgray">no </td>
  79. * <td>yes</td>
  80. * <td>yes</td>
  81. * <td bgcolor="lightgray">no </td>
  82. * <td bgcolor="lightgray">no </td>
  83. * </tr>
  84. * <tr>
  85. * <th>{@linkplain RequestInfoOperations#result result}</th>
  86. * <td bgcolor="lightgray">no </td>
  87. * <td bgcolor="lightgray">no </td>
  88. * <td>yes</td>
  89. * <td bgcolor="lightgray">no </td>
  90. * <td bgcolor="lightgray">no </td>
  91. * </tr>
  92. * <tr>
  93. * <th>{@linkplain RequestInfoOperations#reply_status reply_status}</th>
  94. * <td bgcolor="lightgray">no </td>
  95. * <td bgcolor="lightgray">no </td>
  96. * <td colspan="3" align="center">yes</td> * </tr>
  97. * <tr>
  98. * <th>{@linkplain RequestInfoOperations#forward_reference forward_reference}</th>
  99. * <td bgcolor="lightgray" colspan="4" align="center">no</td>
  100. * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">yes<sub><a
  101. * href="#2">2</a></sub> </td>
  102. * </tr>
  103. * <tr>
  104. * <th>{@linkplain RequestInfoOperations#get_request_service_context get_request_service_context}</th>
  105. * <td>yes</td>
  106. * <td bgcolor="lightgray">no </td>
  107. * <td colspan="3" align="center">yes</td> * </tr>
  108. * <tr>
  109. * <th>{@linkplain RequestInfoOperations#get_reply_service_context get_reply_service_context}</th>
  110. * <td bgcolor="lightgray">no </td>
  111. * <td bgcolor="lightgray">no </td>
  112. * <td colspan="3" align="center">yes</td>
  113. * </tr>
  114. * <tr>
  115. * <th>{@linkplain RequestInfoOperations#request_id request_id}</th>
  116. * <td colspan="5" align ="center">yes</td>
  117. * </tr>
  118. * <tr>
  119. * <th>{@linkplain RequestInfoOperations#operation operation}</th>
  120. * <td colspan="5" align ="center">yes</td>
  121. * </tr>
  122. * <tr>
  123. * <th>{@linkplain RequestInfoOperations#response_expected response_expected}</th>
  124. * <td colspan="5" align ="center">yes</td>
  125. * </tr>
  126. * <tr>
  127. * <th>{@linkplain RequestInfoOperations#sync_scope sync_scope}</th>
  128. * <td colspan="5" align ="center">yes</td>
  129. * </tr>
  130. * <tr>
  131. * <th>{@linkplain RequestInfoOperations#get_slot get_slot}</th>
  132. * <td colspan="5" align ="center">yes</td>
  133. * </tr>
  134. * <tr>
  135. * <td colspan="6" align="center" bgcolor="#E0E0FF">
  136. * <i>ServerRequestInfo-specific:</i></td>
  137. * </tr>
  138. * <tr>
  139. * <th>{@linkplain #get_server_policy get_server_policy}</th>
  140. * <td colspan="5" align ="center">yes</td>
  141. * </tr>
  142. * <tr>
  143. * <th>{@linkplain #add_reply_service_context add_reply_service_context}</th>
  144. * <td colspan="5" align ="center">yes</td>
  145. * </tr>
  146. * <tr>
  147. * <th>{@linkplain #set_slot set_slot}</th>
  148. * <td colspan="5" align ="center">yes</td>
  149. * </tr>
  150. * <tr>
  151. * <th>{@linkplain #sending_exception sending_exception}</th>
  152. * <td bgcolor="lightgray" colspan="3" align="center">no</td>
  153. * <td>yes</td>
  154. * <td bgcolor="lightgray">no </td>
  155. * </tr>
  156. * <tr>
  157. * <th>{@linkplain #object_id object_id}</th>
  158. * <td bgcolor="lightgray">no </td>
  159. * <td>yes</td>
  160. * <td>yes</td>
  161. * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a
  162. * href="#3">3</a></sub></td>
  163. * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a
  164. * href="#3">3</a></sub> </td>
  165. * </tr>
  166. * <tr>
  167. * <th>{@linkplain #adapter_id adapter_id}</th>
  168. * <td bgcolor="lightgray">no </td>
  169. * <td>yes</td>
  170. * <td>yes</td>
  171. * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a
  172. * href="#3">3</a></sub></td>
  173. * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a
  174. * href="#3">3</a></sub> </td>
  175. * </tr>
  176. * <tr>
  177. * <th>{@linkplain #target_most_derived_interface target_most_derived_interface}</th>
  178. * <td bgcolor="lightgray">no </td>
  179. * <td>yes</td>
  180. * <td bgcolor="lightgray" colspan="3" align="center">no</td>
  181. * </tr>
  182. * <tr>
  183. * <th>{@linkplain #target_is_a target_is_a}</th>
  184. * <td bgcolor="lightgray">no </td>
  185. * <td>yes</td>
  186. * <td bgcolor="lightgray" colspan="3" align="center">no</td>
  187. * </tr>
  188. * <tr>
  189. * <th></th>
  190. * <th>{@link ServerRequestInterceptorOperations#receive_request_service_contexts receive_request_<br>service_contexts }</th>
  191. * <th>{@link ServerRequestInterceptorOperations#receive_request receive_request}</th>
  192. * <th>{@link ServerRequestInterceptorOperations#send_reply send_reply}</th>
  193. * <th>{@link ServerRequestInterceptorOperations#send_exception send_exception}</th>
  194. * <th>{@link ServerRequestInterceptorOperations#send_other send_other}</th>
  195. * </tr>
  196. * </table>
  197. * <ol>
  198. * <li><a name="1">When ServerRequestInfo is passed to receive_request, there
  199. * is an entry in the list for every argument. But only the in and inout
  200. * arguments will be available.</a></li>
  201. * <li><a name="2">If the reply_status attribute is not LOCATION_FORWARD,
  202. * accessing this attribute throws BAD_INV_ORDER minor code of 14.</a></li>
  203. * <li><a name="3">If the servant locator caused a location forward, or thrown
  204. * an exception, this attribute/operation may not be available (NO_RESOURCES
  205. * with a standard minor code of 1 will be thrown).</a></li>
  206. * </ol>
  207. *
  208. * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
  209. */
  210. public interface ServerRequestInfoOperations
  211. extends RequestInfoOperations
  212. {
  213. /**
  214. * Allows the interceptor to add service contexts to the request. Such added
  215. * contexts can carry arbitrary data and can be later accessed on the client
  216. * side by the client request interceptor using
  217. * {@link RequestInfoOperations#get_reply_service_context}.
  218. *
  219. * @param service_context the context to add.
  220. * @param replace if true, the existing context with the same Id will be
  221. * replaced. If false, the BAD_INV_ORDER will be thrown in that case.
  222. *
  223. * @throws BAD_INV_ORDER minor 15 if the context with the same Id already
  224. * exists and replace=false.
  225. */
  226. void add_reply_service_context(ServiceContext service_context, boolean replace);
  227. /**
  228. * Get the identifier for the object adapter (POA).
  229. */
  230. byte[] adapter_id();
  231. /**
  232. * Get the object_id describing the target of the operation invocation.
  233. */
  234. byte[] object_id();
  235. /**
  236. * Return the policy of the given type that applies to this operation. This
  237. * method should only be used with policies, produced by the registered
  238. * {@link PolicyFactory}.
  239. *
  240. * @param type the type of the policy being requested.
  241. *
  242. * @return the policy that applies to this operation.
  243. *
  244. * @throws INV_POLICY minor 2 if no factory was registered to produce this
  245. * type of policy or the policy is otherwise invalid.
  246. */
  247. Policy get_server_policy(int type)
  248. throws INV_POLICY;
  249. /**
  250. * Get the exception to be returned to the client. If the returned Any cannot
  251. * not support holding of that exception, it holds
  252. * {@link org.omg.CORBA.UNKNOWN} minor 1 instead.
  253. *
  254. * @return an Any, holding exception that has been thrown and will be returned
  255. * to client.
  256. */
  257. Any sending_exception();
  258. /**
  259. * Allows the interceptor to set a slot in the PortableInterceptor.Current
  260. * that is in the scope of the request.
  261. *
  262. * @param id the Id of the slot.
  263. * @param data the value of the slot, replacing the previous value.
  264. *
  265. * @throws InvalidSlot if the slot with the given Id does not exist.
  266. *
  267. * @see RequestInfoOperations#get_slot(int)
  268. * @see org.omg.PortableInterceptor#Current
  269. */
  270. void set_slot(int id, Any data)
  271. throws InvalidSlot;
  272. /**
  273. * Checks if the servant is the given repository id.
  274. *
  275. * @param id the repository id to compare.
  276. *
  277. * @return true if the servant repository id matches the parameter, false
  278. * otherwise.
  279. */
  280. boolean target_is_a(String id);
  281. /**
  282. * Get the most derived (most specific) repository Id of the servant.
  283. *
  284. * @return the repository id of the servant.
  285. */
  286. String target_most_derived_interface();
  287. /**
  288. * Returns the name of the adapter that is handling the current request.
  289. * The name is returned as a string array, representing full path from
  290. * the root poa till the current poa, for instance
  291. * {"RootPOA", "childPOA","grandchildPOA"}.
  292. */
  293. public String[] adapter_name();
  294. /**
  295. * Returns the id of the ORB that is handling the current request. The ORB
  296. * id can be specified as the property org.omg.CORBA.ORBid when creating
  297. * the ORB.
  298. */
  299. public String orb_id();
  300. /**
  301. * Returs the id of the server that is handling the current request. The server
  302. * id is the same for all POAs and ORBs in the current virtual machine and
  303. * can be set as the property org.omg.CORBA.ServerId when creating one of the
  304. * ORBs.
  305. */
  306. public String server_id();
  307. }