Thu, 31 Aug 2017 18:10:36 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package org.omg.CORBA; |
aoqi@0 | 27 | |
aoqi@0 | 28 | /** |
aoqi@0 | 29 | * An object that captures the explicit state of a request |
aoqi@0 | 30 | * for the Dynamic Skeleton Interface (DSI). This class, the |
aoqi@0 | 31 | * cornerstone of the DSI, is analogous to the <code>Request</code> |
aoqi@0 | 32 | * object in the DII. |
aoqi@0 | 33 | * <P> |
aoqi@0 | 34 | * The ORB is responsible for creating this embodiment of a request, |
aoqi@0 | 35 | * and delivering it to a Dynamic Implementation Routine (DIR). |
aoqi@0 | 36 | * A dynamic servant (a DIR) is created by implementing the |
aoqi@0 | 37 | * <code>DynamicImplementation</code> class, |
aoqi@0 | 38 | * which has a single <code>invoke</code> method. This method accepts a |
aoqi@0 | 39 | * <code>ServerRequest</code> object. |
aoqi@0 | 40 | * |
aoqi@0 | 41 | * The abstract class <code>ServerRequest</code> defines |
aoqi@0 | 42 | * methods for accessing the |
aoqi@0 | 43 | * method name, the arguments and the context of the request, as |
aoqi@0 | 44 | * well as methods for setting the result of the request either as a |
aoqi@0 | 45 | * return value or an exception. <p> |
aoqi@0 | 46 | * |
aoqi@0 | 47 | * A subtlety with accessing the arguments of the request is that the |
aoqi@0 | 48 | * DIR needs to provide type information about the |
aoqi@0 | 49 | * expected arguments, since there is no compiled information about |
aoqi@0 | 50 | * these. This information is provided through an <code>NVList</code>, |
aoqi@0 | 51 | * which is a list of <code>NamedValue</code> objects. |
aoqi@0 | 52 | * Each <code>NamedValue</code> object |
aoqi@0 | 53 | * contains an <code>Any</code> object, which in turn |
aoqi@0 | 54 | * has a <code>TypeCode</code> object representing the type |
aoqi@0 | 55 | * of the argument. <p> |
aoqi@0 | 56 | * |
aoqi@0 | 57 | * Similarly, type information needs to be provided for the response, |
aoqi@0 | 58 | * for either the expected result or for an exception, so the methods |
aoqi@0 | 59 | * <code>result</code> and <code>except</code> take an <code>Any</code> |
aoqi@0 | 60 | * object as a parameter. <p> |
aoqi@0 | 61 | * |
aoqi@0 | 62 | * @see org.omg.CORBA.DynamicImplementation |
aoqi@0 | 63 | * @see org.omg.CORBA.NVList |
aoqi@0 | 64 | * @see org.omg.CORBA.NamedValue |
aoqi@0 | 65 | * |
aoqi@0 | 66 | */ |
aoqi@0 | 67 | |
aoqi@0 | 68 | public abstract class ServerRequest { |
aoqi@0 | 69 | |
aoqi@0 | 70 | /** |
aoqi@0 | 71 | * Retrieves the name of the operation being |
aoqi@0 | 72 | * invoked. According to OMG IDL's rules, these names must be unique |
aoqi@0 | 73 | * among all operations supported by this object's "most-derived" |
aoqi@0 | 74 | * interface. Note that the operation names for getting and setting |
aoqi@0 | 75 | * attributes are <code>_get_<attribute_name></code> |
aoqi@0 | 76 | * and <code>_set_<attribute_name></code>, |
aoqi@0 | 77 | * respectively. |
aoqi@0 | 78 | * |
aoqi@0 | 79 | * @return the name of the operation to be invoked |
aoqi@0 | 80 | * @deprecated use operation() |
aoqi@0 | 81 | */ |
aoqi@0 | 82 | @Deprecated |
aoqi@0 | 83 | public String op_name() |
aoqi@0 | 84 | { |
aoqi@0 | 85 | return operation(); |
aoqi@0 | 86 | } |
aoqi@0 | 87 | |
aoqi@0 | 88 | |
aoqi@0 | 89 | /** |
aoqi@0 | 90 | * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception. |
aoqi@0 | 91 | * <P> |
aoqi@0 | 92 | * Retrieves the name of the operation being |
aoqi@0 | 93 | * invoked. According to OMG IDL's rules, these names must be unique |
aoqi@0 | 94 | * among all operations supported by this object's "most-derived" |
aoqi@0 | 95 | * interface. Note that the operation names for getting and setting |
aoqi@0 | 96 | * attributes are <code>_get_<attribute_name></code> |
aoqi@0 | 97 | * and <code>_set_<attribute_name></code>, |
aoqi@0 | 98 | * respectively. |
aoqi@0 | 99 | * |
aoqi@0 | 100 | * @return the name of the operation to be invoked |
aoqi@0 | 101 | * @see <a href="package-summary.html#unimpl"><code>CORBA</code> |
aoqi@0 | 102 | * package comments for unimplemented features</a> |
aoqi@0 | 103 | */ |
aoqi@0 | 104 | public String operation() |
aoqi@0 | 105 | { |
aoqi@0 | 106 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
aoqi@0 | 107 | } |
aoqi@0 | 108 | |
aoqi@0 | 109 | |
aoqi@0 | 110 | /** |
aoqi@0 | 111 | * Specifies method parameter types and retrieves "in" and "inout" |
aoqi@0 | 112 | * argument values. |
aoqi@0 | 113 | * <P> |
aoqi@0 | 114 | * Note that this method is deprecated; use the method |
aoqi@0 | 115 | * <code>arguments</code> in its place. |
aoqi@0 | 116 | * <P> |
aoqi@0 | 117 | * Unless it calls the method <code>set_exception</code>, |
aoqi@0 | 118 | * the DIR must call this method exactly once, even if the |
aoqi@0 | 119 | * method signature contains no parameters. Once the method <code> |
aoqi@0 | 120 | * arguments</code> or <code>set_exception</code> |
aoqi@0 | 121 | * has been called, calling <code>arguments</code> on the same |
aoqi@0 | 122 | * <code>ServerRequest</code> object |
aoqi@0 | 123 | * will result in a <code>BAD_INV_ORDER</code> system exception. |
aoqi@0 | 124 | * The DIR must pass in to the method <code>arguments</code> |
aoqi@0 | 125 | * an NVList initialized with TypeCodes and Flags |
aoqi@0 | 126 | * describing the parameter types for the operation, in the order in which |
aoqi@0 | 127 | * they appear in the IDL specification (left to right). A |
aoqi@0 | 128 | * potentially-different NVList will be returned from |
aoqi@0 | 129 | * <code>arguments</code>, with the |
aoqi@0 | 130 | * "in" and "inout" argument values supplied. If it does not call |
aoqi@0 | 131 | * the method <code>set_exception</code>, |
aoqi@0 | 132 | * the DIR must supply the returned NVList with return |
aoqi@0 | 133 | * values for any "out" arguments before returning, and may also change |
aoqi@0 | 134 | * the return values for any "inout" arguments. |
aoqi@0 | 135 | * |
aoqi@0 | 136 | * @param params the arguments of the method, in the |
aoqi@0 | 137 | * form of an <code>NVList</code> object |
aoqi@0 | 138 | * @deprecated use the method <code>arguments</code> |
aoqi@0 | 139 | */ |
aoqi@0 | 140 | @Deprecated |
aoqi@0 | 141 | public void params(NVList params) |
aoqi@0 | 142 | { |
aoqi@0 | 143 | arguments(params); |
aoqi@0 | 144 | } |
aoqi@0 | 145 | |
aoqi@0 | 146 | /** |
aoqi@0 | 147 | * Specifies method parameter types and retrieves "in" and "inout" |
aoqi@0 | 148 | * argument values. |
aoqi@0 | 149 | * Unless it calls the method <code>set_exception</code>, |
aoqi@0 | 150 | * the DIR must call this method exactly once, even if the |
aoqi@0 | 151 | * method signature contains no parameters. Once the method <code> |
aoqi@0 | 152 | * arguments</code> or <code>set_exception</code> |
aoqi@0 | 153 | * has been called, calling <code>arguments</code> on the same |
aoqi@0 | 154 | * <code>ServerRequest</code> object |
aoqi@0 | 155 | * will result in a <code>BAD_INV_ORDER</code> system exception. |
aoqi@0 | 156 | * The DIR must pass in to the method <code>arguments</code> |
aoqi@0 | 157 | * an NVList initialized with TypeCodes and Flags |
aoqi@0 | 158 | * describing the parameter types for the operation, in the order in which |
aoqi@0 | 159 | * they appear in the IDL specification (left to right). A |
aoqi@0 | 160 | * potentially-different NVList will be returned from |
aoqi@0 | 161 | * <code>arguments</code>, with the |
aoqi@0 | 162 | * "in" and "inout" argument values supplied. If it does not call |
aoqi@0 | 163 | * the method <code>set_exception</code>, |
aoqi@0 | 164 | * the DIR must supply the returned NVList with return |
aoqi@0 | 165 | * values for any "out" arguments before returning, and it may also change |
aoqi@0 | 166 | * the return values for any "inout" arguments. |
aoqi@0 | 167 | * |
aoqi@0 | 168 | * @param args the arguments of the method, in the |
aoqi@0 | 169 | * form of an NVList |
aoqi@0 | 170 | * @see <a href="package-summary.html#unimpl"><code>CORBA</code> |
aoqi@0 | 171 | * package comments for unimplemented features</a> |
aoqi@0 | 172 | */ |
aoqi@0 | 173 | public void arguments(org.omg.CORBA.NVList args) { |
aoqi@0 | 174 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
aoqi@0 | 175 | } |
aoqi@0 | 176 | |
aoqi@0 | 177 | |
aoqi@0 | 178 | |
aoqi@0 | 179 | /** |
aoqi@0 | 180 | * Specifies any return value for the call. |
aoqi@0 | 181 | * <P> |
aoqi@0 | 182 | * Note that this method is deprecated; use the method |
aoqi@0 | 183 | * <code>set_result</code> in its place. |
aoqi@0 | 184 | * <P> |
aoqi@0 | 185 | * Unless the method |
aoqi@0 | 186 | * <code>set_exception</code> is called, if the invoked method |
aoqi@0 | 187 | * has a non-void result type, the method <code>set_result</code> |
aoqi@0 | 188 | * must be called exactly once before the DIR returns. |
aoqi@0 | 189 | * If the operation has a void result type, the method |
aoqi@0 | 190 | * <code>set_result</code> may optionally be |
aoqi@0 | 191 | * called once with an <code>Any</code> object whose type is |
aoqi@0 | 192 | * <code>tk_void</code>. Calling the method <code>set_result</code> before |
aoqi@0 | 193 | * the method <code>arguments</code> has been called or after |
aoqi@0 | 194 | * the method <code>set_result</code> or <code>set_exception</code> has been |
aoqi@0 | 195 | * called will result in a BAD_INV_ORDER exception. Calling the method |
aoqi@0 | 196 | * <code>set_result</code> without having previously called |
aoqi@0 | 197 | * the method <code>ctx</code> when the IDL operation contains a |
aoqi@0 | 198 | * context expression, or when the NVList passed to arguments did not |
aoqi@0 | 199 | * describe all parameters passed by the client, may result in a MARSHAL |
aoqi@0 | 200 | * system exception. |
aoqi@0 | 201 | * |
aoqi@0 | 202 | * @param any an <code>Any</code> object containing the return value to be set |
aoqi@0 | 203 | * @deprecated use the method <code>set_result</code> |
aoqi@0 | 204 | */ |
aoqi@0 | 205 | @Deprecated |
aoqi@0 | 206 | public void result(Any any) |
aoqi@0 | 207 | { |
aoqi@0 | 208 | set_result(any); |
aoqi@0 | 209 | } |
aoqi@0 | 210 | |
aoqi@0 | 211 | |
aoqi@0 | 212 | /** |
aoqi@0 | 213 | * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception. |
aoqi@0 | 214 | * <P> |
aoqi@0 | 215 | * Specifies any return value for the call. Unless the method |
aoqi@0 | 216 | * <code>set_exception</code> is called, if the invoked method |
aoqi@0 | 217 | * has a non-void result type, the method <code>set_result</code> |
aoqi@0 | 218 | * must be called exactly once before the DIR returns. |
aoqi@0 | 219 | * If the operation has a void result type, the method |
aoqi@0 | 220 | * <code>set_result</code> may optionally be |
aoqi@0 | 221 | * called once with an <code>Any</code> object whose type is |
aoqi@0 | 222 | * <code>tk_void</code>. Calling the method <code>set_result</code> before |
aoqi@0 | 223 | * the method <code>arguments</code> has been called or after |
aoqi@0 | 224 | * the method <code>set_result</code> or <code>set_exception</code> has been |
aoqi@0 | 225 | * called will result in a BAD_INV_ORDER exception. Calling the method |
aoqi@0 | 226 | * <code>set_result</code> without having previously called |
aoqi@0 | 227 | * the method <code>ctx</code> when the IDL operation contains a |
aoqi@0 | 228 | * context expression, or when the NVList passed to arguments did not |
aoqi@0 | 229 | * describe all parameters passed by the client, may result in a MARSHAL |
aoqi@0 | 230 | * system exception. |
aoqi@0 | 231 | * |
aoqi@0 | 232 | * @param any an <code>Any</code> object containing the return value to be set |
aoqi@0 | 233 | * @see <a href="package-summary.html#unimpl"><code>CORBA</code> |
aoqi@0 | 234 | * package comments for unimplemented features</a> |
aoqi@0 | 235 | */ |
aoqi@0 | 236 | public void set_result(org.omg.CORBA.Any any) |
aoqi@0 | 237 | { |
aoqi@0 | 238 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
aoqi@0 | 239 | } |
aoqi@0 | 240 | |
aoqi@0 | 241 | |
aoqi@0 | 242 | /** |
aoqi@0 | 243 | * The DIR may call set_exception at any time to return an exception to the |
aoqi@0 | 244 | * client. The Any passed to set_exception must contain either a system |
aoqi@0 | 245 | * exception or a user exception specified in the raises expression |
aoqi@0 | 246 | * of the invoked operation's IDL definition. Passing in an Any that does |
aoqi@0 | 247 | * not |
aoqi@0 | 248 | * contain an exception will result in a BAD_PARAM system exception. Passing |
aoqi@0 | 249 | * in an unlisted user exception will result in either the DIR receiving a |
aoqi@0 | 250 | * BAD_PARAM system exception or in the client receiving an |
aoqi@0 | 251 | * UNKNOWN_EXCEPTION system exception. |
aoqi@0 | 252 | * |
aoqi@0 | 253 | * @param any the <code>Any</code> object containing the exception |
aoqi@0 | 254 | * @deprecated use set_exception() |
aoqi@0 | 255 | */ |
aoqi@0 | 256 | @Deprecated |
aoqi@0 | 257 | public void except(Any any) |
aoqi@0 | 258 | { |
aoqi@0 | 259 | set_exception(any); |
aoqi@0 | 260 | } |
aoqi@0 | 261 | |
aoqi@0 | 262 | /** |
aoqi@0 | 263 | * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception. |
aoqi@0 | 264 | * <P> |
aoqi@0 | 265 | * Returns the given exception to the client. This method |
aoqi@0 | 266 | * is invoked by the DIR, which may call it at any time. |
aoqi@0 | 267 | * The <code>Any</code> object passed to this method must |
aoqi@0 | 268 | * contain either a system |
aoqi@0 | 269 | * exception or one of the user exceptions specified in the |
aoqi@0 | 270 | * invoked operation's IDL definition. Passing in an |
aoqi@0 | 271 | * <code>Any</code> object that does not contain an exception |
aoqi@0 | 272 | * will cause a BAD_PARAM system exception to be thrown. Passing |
aoqi@0 | 273 | * in an unlisted user exception will result in either the DIR receiving a |
aoqi@0 | 274 | * BAD_PARAM system exception or in the client receiving an |
aoqi@0 | 275 | * UNKNOWN_EXCEPTION system exception. |
aoqi@0 | 276 | * |
aoqi@0 | 277 | * @param any the <code>Any</code> object containing the exception |
aoqi@0 | 278 | * @exception BAD_PARAM if the given <code>Any</code> object does not |
aoqi@0 | 279 | * contain an exception or the exception is an |
aoqi@0 | 280 | * unlisted user exception |
aoqi@0 | 281 | * @exception UNKNOWN_EXCEPTION if the given exception is an unlisted |
aoqi@0 | 282 | * user exception and the DIR did not |
aoqi@0 | 283 | * receive a BAD_PARAM exception |
aoqi@0 | 284 | * @see <a href="package-summary.html#unimpl"><code>CORBA</code> |
aoqi@0 | 285 | * package comments for unimplemented features</a> |
aoqi@0 | 286 | */ |
aoqi@0 | 287 | public void set_exception(Any any) |
aoqi@0 | 288 | { |
aoqi@0 | 289 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
aoqi@0 | 290 | } |
aoqi@0 | 291 | |
aoqi@0 | 292 | /** |
aoqi@0 | 293 | * Returns the context information specified in IDL for the operation |
aoqi@0 | 294 | * when the operation is not an attribute access and the operation's IDL |
aoqi@0 | 295 | * definition contains a context expression; otherwise it returns |
aoqi@0 | 296 | * a nil <code>Context</code> reference. Calling the method |
aoqi@0 | 297 | * <code>ctx</code> before the method <code>arguments</code> has |
aoqi@0 | 298 | * been called or after the method <code>ctx</code>, |
aoqi@0 | 299 | * <code>set_result</code>, or <code>set_exception</code> |
aoqi@0 | 300 | * has been called will result in a |
aoqi@0 | 301 | * BAD_INV_ORDER system exception. |
aoqi@0 | 302 | * |
aoqi@0 | 303 | * @return the context object that is to be used |
aoqi@0 | 304 | * to resolve any context strings whose |
aoqi@0 | 305 | * values need to be sent with the invocation. |
aoqi@0 | 306 | * @exception BAD_INV_ORDER if (1) the method <code>ctx</code> is called |
aoqi@0 | 307 | * before the method <code>arguments</code> or |
aoqi@0 | 308 | * (2) the method <code>ctx</code> is called |
aoqi@0 | 309 | * after calling <code>set_result</code> or |
aoqi@0 | 310 | * <code>set_exception</code> |
aoqi@0 | 311 | */ |
aoqi@0 | 312 | public abstract Context ctx(); |
aoqi@0 | 313 | |
aoqi@0 | 314 | } |