1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/org/omg/CORBA/ServerRequest.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,314 @@ 1.4 +/* 1.5 + * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package org.omg.CORBA; 1.30 + 1.31 +/** 1.32 + * An object that captures the explicit state of a request 1.33 + * for the Dynamic Skeleton Interface (DSI). This class, the 1.34 + * cornerstone of the DSI, is analogous to the <code>Request</code> 1.35 + * object in the DII. 1.36 + * <P> 1.37 + * The ORB is responsible for creating this embodiment of a request, 1.38 + * and delivering it to a Dynamic Implementation Routine (DIR). 1.39 + * A dynamic servant (a DIR) is created by implementing the 1.40 + * <code>DynamicImplementation</code> class, 1.41 + * which has a single <code>invoke</code> method. This method accepts a 1.42 + * <code>ServerRequest</code> object. 1.43 + * 1.44 + * The abstract class <code>ServerRequest</code> defines 1.45 + * methods for accessing the 1.46 + * method name, the arguments and the context of the request, as 1.47 + * well as methods for setting the result of the request either as a 1.48 + * return value or an exception. <p> 1.49 + * 1.50 + * A subtlety with accessing the arguments of the request is that the 1.51 + * DIR needs to provide type information about the 1.52 + * expected arguments, since there is no compiled information about 1.53 + * these. This information is provided through an <code>NVList</code>, 1.54 + * which is a list of <code>NamedValue</code> objects. 1.55 + * Each <code>NamedValue</code> object 1.56 + * contains an <code>Any</code> object, which in turn 1.57 + * has a <code>TypeCode</code> object representing the type 1.58 + * of the argument. <p> 1.59 + * 1.60 + * Similarly, type information needs to be provided for the response, 1.61 + * for either the expected result or for an exception, so the methods 1.62 + * <code>result</code> and <code>except</code> take an <code>Any</code> 1.63 + * object as a parameter. <p> 1.64 + * 1.65 + * @see org.omg.CORBA.DynamicImplementation 1.66 + * @see org.omg.CORBA.NVList 1.67 + * @see org.omg.CORBA.NamedValue 1.68 + * 1.69 + */ 1.70 + 1.71 +public abstract class ServerRequest { 1.72 + 1.73 + /** 1.74 + * Retrieves the name of the operation being 1.75 + * invoked. According to OMG IDL's rules, these names must be unique 1.76 + * among all operations supported by this object's "most-derived" 1.77 + * interface. Note that the operation names for getting and setting 1.78 + * attributes are <code>_get_<attribute_name></code> 1.79 + * and <code>_set_<attribute_name></code>, 1.80 + * respectively. 1.81 + * 1.82 + * @return the name of the operation to be invoked 1.83 + * @deprecated use operation() 1.84 + */ 1.85 + @Deprecated 1.86 + public String op_name() 1.87 + { 1.88 + return operation(); 1.89 + } 1.90 + 1.91 + 1.92 + /** 1.93 + * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception. 1.94 + * <P> 1.95 + * Retrieves the name of the operation being 1.96 + * invoked. According to OMG IDL's rules, these names must be unique 1.97 + * among all operations supported by this object's "most-derived" 1.98 + * interface. Note that the operation names for getting and setting 1.99 + * attributes are <code>_get_<attribute_name></code> 1.100 + * and <code>_set_<attribute_name></code>, 1.101 + * respectively. 1.102 + * 1.103 + * @return the name of the operation to be invoked 1.104 + * @see <a href="package-summary.html#unimpl"><code>CORBA</code> 1.105 + * package comments for unimplemented features</a> 1.106 + */ 1.107 + public String operation() 1.108 + { 1.109 + throw new org.omg.CORBA.NO_IMPLEMENT(); 1.110 + } 1.111 + 1.112 + 1.113 + /** 1.114 + * Specifies method parameter types and retrieves "in" and "inout" 1.115 + * argument values. 1.116 + * <P> 1.117 + * Note that this method is deprecated; use the method 1.118 + * <code>arguments</code> in its place. 1.119 + * <P> 1.120 + * Unless it calls the method <code>set_exception</code>, 1.121 + * the DIR must call this method exactly once, even if the 1.122 + * method signature contains no parameters. Once the method <code> 1.123 + * arguments</code> or <code>set_exception</code> 1.124 + * has been called, calling <code>arguments</code> on the same 1.125 + * <code>ServerRequest</code> object 1.126 + * will result in a <code>BAD_INV_ORDER</code> system exception. 1.127 + * The DIR must pass in to the method <code>arguments</code> 1.128 + * an NVList initialized with TypeCodes and Flags 1.129 + * describing the parameter types for the operation, in the order in which 1.130 + * they appear in the IDL specification (left to right). A 1.131 + * potentially-different NVList will be returned from 1.132 + * <code>arguments</code>, with the 1.133 + * "in" and "inout" argument values supplied. If it does not call 1.134 + * the method <code>set_exception</code>, 1.135 + * the DIR must supply the returned NVList with return 1.136 + * values for any "out" arguments before returning, and may also change 1.137 + * the return values for any "inout" arguments. 1.138 + * 1.139 + * @param params the arguments of the method, in the 1.140 + * form of an <code>NVList</code> object 1.141 + * @deprecated use the method <code>arguments</code> 1.142 + */ 1.143 + @Deprecated 1.144 + public void params(NVList params) 1.145 + { 1.146 + arguments(params); 1.147 + } 1.148 + 1.149 + /** 1.150 + * Specifies method parameter types and retrieves "in" and "inout" 1.151 + * argument values. 1.152 + * Unless it calls the method <code>set_exception</code>, 1.153 + * the DIR must call this method exactly once, even if the 1.154 + * method signature contains no parameters. Once the method <code> 1.155 + * arguments</code> or <code>set_exception</code> 1.156 + * has been called, calling <code>arguments</code> on the same 1.157 + * <code>ServerRequest</code> object 1.158 + * will result in a <code>BAD_INV_ORDER</code> system exception. 1.159 + * The DIR must pass in to the method <code>arguments</code> 1.160 + * an NVList initialized with TypeCodes and Flags 1.161 + * describing the parameter types for the operation, in the order in which 1.162 + * they appear in the IDL specification (left to right). A 1.163 + * potentially-different NVList will be returned from 1.164 + * <code>arguments</code>, with the 1.165 + * "in" and "inout" argument values supplied. If it does not call 1.166 + * the method <code>set_exception</code>, 1.167 + * the DIR must supply the returned NVList with return 1.168 + * values for any "out" arguments before returning, and it may also change 1.169 + * the return values for any "inout" arguments. 1.170 + * 1.171 + * @param args the arguments of the method, in the 1.172 + * form of an NVList 1.173 + * @see <a href="package-summary.html#unimpl"><code>CORBA</code> 1.174 + * package comments for unimplemented features</a> 1.175 + */ 1.176 + public void arguments(org.omg.CORBA.NVList args) { 1.177 + throw new org.omg.CORBA.NO_IMPLEMENT(); 1.178 + } 1.179 + 1.180 + 1.181 + 1.182 + /** 1.183 + * Specifies any return value for the call. 1.184 + * <P> 1.185 + * Note that this method is deprecated; use the method 1.186 + * <code>set_result</code> in its place. 1.187 + * <P> 1.188 + * Unless the method 1.189 + * <code>set_exception</code> is called, if the invoked method 1.190 + * has a non-void result type, the method <code>set_result</code> 1.191 + * must be called exactly once before the DIR returns. 1.192 + * If the operation has a void result type, the method 1.193 + * <code>set_result</code> may optionally be 1.194 + * called once with an <code>Any</code> object whose type is 1.195 + * <code>tk_void</code>. Calling the method <code>set_result</code> before 1.196 + * the method <code>arguments</code> has been called or after 1.197 + * the method <code>set_result</code> or <code>set_exception</code> has been 1.198 + * called will result in a BAD_INV_ORDER exception. Calling the method 1.199 + * <code>set_result</code> without having previously called 1.200 + * the method <code>ctx</code> when the IDL operation contains a 1.201 + * context expression, or when the NVList passed to arguments did not 1.202 + * describe all parameters passed by the client, may result in a MARSHAL 1.203 + * system exception. 1.204 + * 1.205 + * @param any an <code>Any</code> object containing the return value to be set 1.206 + * @deprecated use the method <code>set_result</code> 1.207 + */ 1.208 + @Deprecated 1.209 + public void result(Any any) 1.210 + { 1.211 + set_result(any); 1.212 + } 1.213 + 1.214 + 1.215 + /** 1.216 + * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception. 1.217 + * <P> 1.218 + * Specifies any return value for the call. Unless the method 1.219 + * <code>set_exception</code> is called, if the invoked method 1.220 + * has a non-void result type, the method <code>set_result</code> 1.221 + * must be called exactly once before the DIR returns. 1.222 + * If the operation has a void result type, the method 1.223 + * <code>set_result</code> may optionally be 1.224 + * called once with an <code>Any</code> object whose type is 1.225 + * <code>tk_void</code>. Calling the method <code>set_result</code> before 1.226 + * the method <code>arguments</code> has been called or after 1.227 + * the method <code>set_result</code> or <code>set_exception</code> has been 1.228 + * called will result in a BAD_INV_ORDER exception. Calling the method 1.229 + * <code>set_result</code> without having previously called 1.230 + * the method <code>ctx</code> when the IDL operation contains a 1.231 + * context expression, or when the NVList passed to arguments did not 1.232 + * describe all parameters passed by the client, may result in a MARSHAL 1.233 + * system exception. 1.234 + * 1.235 + * @param any an <code>Any</code> object containing the return value to be set 1.236 + * @see <a href="package-summary.html#unimpl"><code>CORBA</code> 1.237 + * package comments for unimplemented features</a> 1.238 + */ 1.239 + public void set_result(org.omg.CORBA.Any any) 1.240 + { 1.241 + throw new org.omg.CORBA.NO_IMPLEMENT(); 1.242 + } 1.243 + 1.244 + 1.245 + /** 1.246 + * The DIR may call set_exception at any time to return an exception to the 1.247 + * client. The Any passed to set_exception must contain either a system 1.248 + * exception or a user exception specified in the raises expression 1.249 + * of the invoked operation's IDL definition. Passing in an Any that does 1.250 + * not 1.251 + * contain an exception will result in a BAD_PARAM system exception. Passing 1.252 + * in an unlisted user exception will result in either the DIR receiving a 1.253 + * BAD_PARAM system exception or in the client receiving an 1.254 + * UNKNOWN_EXCEPTION system exception. 1.255 + * 1.256 + * @param any the <code>Any</code> object containing the exception 1.257 + * @deprecated use set_exception() 1.258 + */ 1.259 + @Deprecated 1.260 + public void except(Any any) 1.261 + { 1.262 + set_exception(any); 1.263 + } 1.264 + 1.265 + /** 1.266 + * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception. 1.267 + * <P> 1.268 + * Returns the given exception to the client. This method 1.269 + * is invoked by the DIR, which may call it at any time. 1.270 + * The <code>Any</code> object passed to this method must 1.271 + * contain either a system 1.272 + * exception or one of the user exceptions specified in the 1.273 + * invoked operation's IDL definition. Passing in an 1.274 + * <code>Any</code> object that does not contain an exception 1.275 + * will cause a BAD_PARAM system exception to be thrown. Passing 1.276 + * in an unlisted user exception will result in either the DIR receiving a 1.277 + * BAD_PARAM system exception or in the client receiving an 1.278 + * UNKNOWN_EXCEPTION system exception. 1.279 + * 1.280 + * @param any the <code>Any</code> object containing the exception 1.281 + * @exception BAD_PARAM if the given <code>Any</code> object does not 1.282 + * contain an exception or the exception is an 1.283 + * unlisted user exception 1.284 + * @exception UNKNOWN_EXCEPTION if the given exception is an unlisted 1.285 + * user exception and the DIR did not 1.286 + * receive a BAD_PARAM exception 1.287 + * @see <a href="package-summary.html#unimpl"><code>CORBA</code> 1.288 + * package comments for unimplemented features</a> 1.289 + */ 1.290 + public void set_exception(Any any) 1.291 + { 1.292 + throw new org.omg.CORBA.NO_IMPLEMENT(); 1.293 + } 1.294 + 1.295 + /** 1.296 + * Returns the context information specified in IDL for the operation 1.297 + * when the operation is not an attribute access and the operation's IDL 1.298 + * definition contains a context expression; otherwise it returns 1.299 + * a nil <code>Context</code> reference. Calling the method 1.300 + * <code>ctx</code> before the method <code>arguments</code> has 1.301 + * been called or after the method <code>ctx</code>, 1.302 + * <code>set_result</code>, or <code>set_exception</code> 1.303 + * has been called will result in a 1.304 + * BAD_INV_ORDER system exception. 1.305 + * 1.306 + * @return the context object that is to be used 1.307 + * to resolve any context strings whose 1.308 + * values need to be sent with the invocation. 1.309 + * @exception BAD_INV_ORDER if (1) the method <code>ctx</code> is called 1.310 + * before the method <code>arguments</code> or 1.311 + * (2) the method <code>ctx</code> is called 1.312 + * after calling <code>set_result</code> or 1.313 + * <code>set_exception</code> 1.314 + */ 1.315 + public abstract Context ctx(); 1.316 + 1.317 +}