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