Thu, 11 Jul 2019 00:03:18 +0100
Added tag jdk8u222-b10 for changeset d44170c2cece
duke@1 | 1 | /* |
ohair@158 | 2 | * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@158 | 7 | * published by the Free Software Foundation. Oracle designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@158 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | * |
ohair@158 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@158 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@158 | 23 | * questions. |
duke@1 | 24 | */ |
duke@1 | 25 | package org.omg.CORBA.portable; |
duke@1 | 26 | |
duke@1 | 27 | import org.omg.CORBA.Request; |
duke@1 | 28 | import org.omg.CORBA.NamedValue; |
duke@1 | 29 | import org.omg.CORBA.NVList; |
duke@1 | 30 | import org.omg.CORBA.ExceptionList; |
duke@1 | 31 | import org.omg.CORBA.ContextList; |
duke@1 | 32 | import org.omg.CORBA.Context; |
duke@1 | 33 | import org.omg.CORBA.TypeCode; |
duke@1 | 34 | import org.omg.CORBA.BAD_OPERATION; |
duke@1 | 35 | import org.omg.CORBA.SystemException; |
duke@1 | 36 | |
duke@1 | 37 | |
duke@1 | 38 | /** |
duke@1 | 39 | * The common base class for all stub classes; provides default implementations |
duke@1 | 40 | * of the <code>org.omg.CORBA.Object</code> methods. All method implementations are |
duke@1 | 41 | * forwarded to a <code>Delegate</code> object stored in the <code>ObjectImpl</code> |
duke@1 | 42 | * instance. <code>ObjectImpl</code> allows for portable stubs because the |
duke@1 | 43 | * <code>Delegate</code> can be implemented by a different vendor-specific ORB. |
duke@1 | 44 | */ |
duke@1 | 45 | |
duke@1 | 46 | abstract public class ObjectImpl implements org.omg.CORBA.Object |
duke@1 | 47 | { |
duke@1 | 48 | |
duke@1 | 49 | /** |
duke@1 | 50 | * The field that stores the <code>Delegate</code> instance for |
duke@1 | 51 | * this <code>ObjectImpl</code> object. This <code>Delegate</code> |
duke@1 | 52 | * instance can be implemented by a vendor-specific ORB. Stub classes, |
duke@1 | 53 | * which are derived from this <code>ObjectImpl</code> class, can be |
duke@1 | 54 | * portable because they delegate all of the methods called on them to this |
duke@1 | 55 | * <code>Delegate</code> object. |
duke@1 | 56 | */ |
duke@1 | 57 | private transient Delegate __delegate; |
duke@1 | 58 | |
duke@1 | 59 | |
duke@1 | 60 | /** |
duke@1 | 61 | * Retrieves the reference to the vendor-specific <code>Delegate</code> |
duke@1 | 62 | * object to which this <code>ObjectImpl</code> object delegates all |
duke@1 | 63 | * methods invoked on it. |
duke@1 | 64 | * |
duke@1 | 65 | * @return the Delegate contained in this ObjectImpl instance |
duke@1 | 66 | * @throws BAD_OPERATION if the delegate has not been set |
duke@1 | 67 | * @see #_set_delegate |
duke@1 | 68 | */ |
duke@1 | 69 | public Delegate _get_delegate() { |
duke@1 | 70 | if (__delegate == null) |
duke@1 | 71 | throw new BAD_OPERATION("The delegate has not been set!"); |
duke@1 | 72 | return __delegate; |
duke@1 | 73 | } |
duke@1 | 74 | |
duke@1 | 75 | |
duke@1 | 76 | /** |
duke@1 | 77 | * Sets the Delegate for this <code>ObjectImpl</code> instance to the given |
duke@1 | 78 | * <code>Delegate</code> object. All method invocations on this |
duke@1 | 79 | * <code>ObjectImpl</code> object will be forwarded to this delegate. |
duke@1 | 80 | * |
duke@1 | 81 | * @param delegate the <code>Delegate</code> instance to which |
duke@1 | 82 | * all method calls on this <code>ObjectImpl</code> object |
duke@1 | 83 | * will be delegated; may be implemented by a third-party ORB |
duke@1 | 84 | * @see #_get_delegate |
duke@1 | 85 | */ |
duke@1 | 86 | public void _set_delegate(Delegate delegate) { |
duke@1 | 87 | __delegate = delegate; |
duke@1 | 88 | } |
duke@1 | 89 | |
duke@1 | 90 | /** |
duke@1 | 91 | * Retrieves a string array containing the repository identifiers |
duke@1 | 92 | * supported by this <code>ObjectImpl</code> object. For example, |
duke@1 | 93 | * for a stub, this method returns information about all the |
duke@1 | 94 | * interfaces supported by the stub. |
duke@1 | 95 | * |
duke@1 | 96 | * @return the array of all repository identifiers supported by this |
duke@1 | 97 | * <code>ObjectImpl</code> instance |
duke@1 | 98 | */ |
duke@1 | 99 | public abstract String[] _ids(); |
duke@1 | 100 | |
duke@1 | 101 | |
duke@1 | 102 | /** |
duke@1 | 103 | * Returns a duplicate of this <code>ObjectImpl</code> object. |
duke@1 | 104 | * |
duke@1 | 105 | * @return an <code>orb.omg.CORBA.Object</code> object that is |
duke@1 | 106 | * a duplicate of this object |
duke@1 | 107 | */ |
duke@1 | 108 | public org.omg.CORBA.Object _duplicate() { |
duke@1 | 109 | return _get_delegate().duplicate(this); |
duke@1 | 110 | } |
duke@1 | 111 | |
duke@1 | 112 | /** |
duke@1 | 113 | * Releases the resources associated with this <code>ObjectImpl</code> object. |
duke@1 | 114 | */ |
duke@1 | 115 | public void _release() { |
duke@1 | 116 | _get_delegate().release(this); |
duke@1 | 117 | } |
duke@1 | 118 | |
duke@1 | 119 | /** |
duke@1 | 120 | * Checks whether the object identified by the given repository |
duke@1 | 121 | * identifier is an <code>ObjectImpl</code> object. |
duke@1 | 122 | * |
duke@1 | 123 | * @param repository_id a <code>String</code> object with the repository |
duke@1 | 124 | * identifier to check |
duke@1 | 125 | * @return <code>true</code> if the object identified by the given |
duke@1 | 126 | * repository id is an instance of <code>ObjectImpl</code>; |
duke@1 | 127 | * <code>false</code> otherwise |
duke@1 | 128 | */ |
duke@1 | 129 | public boolean _is_a(String repository_id) { |
duke@1 | 130 | return _get_delegate().is_a(this, repository_id); |
duke@1 | 131 | } |
duke@1 | 132 | |
duke@1 | 133 | /** |
duke@1 | 134 | * Checks whether the the given <code>ObjectImpl</code> object is |
duke@1 | 135 | * equivalent to this <code>ObjectImpl</code> object. |
duke@1 | 136 | * |
duke@1 | 137 | * @param that an instance of <code>ObjectImpl</code> to compare with |
duke@1 | 138 | * this <code>ObjectImpl</code> object |
duke@1 | 139 | * @return <code>true</code> if the given object is equivalent |
duke@1 | 140 | * to this <code>ObjectImpl</code> object; |
duke@1 | 141 | * <code>false</code> otherwise |
duke@1 | 142 | */ |
duke@1 | 143 | public boolean _is_equivalent(org.omg.CORBA.Object that) { |
duke@1 | 144 | return _get_delegate().is_equivalent(this, that); |
duke@1 | 145 | } |
duke@1 | 146 | |
duke@1 | 147 | /** |
duke@1 | 148 | * Checks whether the server object for this <code>ObjectImpl</code> |
duke@1 | 149 | * object has been destroyed. |
duke@1 | 150 | * |
duke@1 | 151 | * @return <code>true</code> if the ORB knows authoritatively that the |
duke@1 | 152 | * server object does not exist; <code>false</code> otherwise |
duke@1 | 153 | */ |
duke@1 | 154 | public boolean _non_existent() { |
duke@1 | 155 | return _get_delegate().non_existent(this); |
duke@1 | 156 | } |
duke@1 | 157 | |
duke@1 | 158 | /** |
duke@1 | 159 | * Retrieves the hash code that serves as an ORB-internal identifier for |
duke@1 | 160 | * this <code>ObjectImpl</code> object. |
duke@1 | 161 | * |
duke@1 | 162 | * @param maximum an <code>int</code> indicating the upper bound on the hash |
duke@1 | 163 | * value returned by the ORB |
duke@1 | 164 | * @return an <code>int</code> representing the hash code for this |
duke@1 | 165 | * <code>ObjectImpl</code> object |
duke@1 | 166 | */ |
duke@1 | 167 | public int _hash(int maximum) { |
duke@1 | 168 | return _get_delegate().hash(this, maximum); |
duke@1 | 169 | } |
duke@1 | 170 | |
duke@1 | 171 | /** |
duke@1 | 172 | * Creates a <code>Request</code> object containing the given method |
duke@1 | 173 | * that can be used with the Dynamic Invocation Interface. |
duke@1 | 174 | * |
duke@1 | 175 | * @param operation the method to be invoked by the new <code>Request</code> |
duke@1 | 176 | * object |
duke@1 | 177 | * @return a new <code>Request</code> object initialized with the |
duke@1 | 178 | * given method |
duke@1 | 179 | */ |
duke@1 | 180 | public Request _request(String operation) { |
duke@1 | 181 | return _get_delegate().request(this, operation); |
duke@1 | 182 | } |
duke@1 | 183 | |
duke@1 | 184 | /** |
duke@1 | 185 | * Creates a <code>Request</code> object that contains the given context, |
duke@1 | 186 | * method, argument list, and container for the result. |
duke@1 | 187 | * |
duke@1 | 188 | * @param ctx the Context for the request |
duke@1 | 189 | * @param operation the method that the new <code>Request</code> |
duke@1 | 190 | * object will invoke |
duke@1 | 191 | * @param arg_list the arguments for the method; an <code>NVList</code> |
duke@1 | 192 | * in which each argument is a <code>NamedValue</code> object |
duke@1 | 193 | * @param result a <code>NamedValue</code> object to be used for |
duke@1 | 194 | * returning the result of executing the request's method |
duke@1 | 195 | * @return a new <code>Request</code> object initialized with the |
duke@1 | 196 | * given context, method, argument list, and container for the |
duke@1 | 197 | * return value |
duke@1 | 198 | */ |
duke@1 | 199 | public Request _create_request(Context ctx, |
duke@1 | 200 | String operation, |
duke@1 | 201 | NVList arg_list, |
duke@1 | 202 | NamedValue result) { |
duke@1 | 203 | return _get_delegate().create_request(this, |
duke@1 | 204 | ctx, |
duke@1 | 205 | operation, |
duke@1 | 206 | arg_list, |
duke@1 | 207 | result); |
duke@1 | 208 | } |
duke@1 | 209 | |
duke@1 | 210 | /** |
duke@1 | 211 | * Creates a <code>Request</code> object that contains the given context, |
duke@1 | 212 | * method, argument list, container for the result, exceptions, and |
duke@1 | 213 | * list of property names to be used in resolving the context strings. |
duke@1 | 214 | * This <code>Request</code> object is for use in the Dynamic |
duke@1 | 215 | * Invocation Interface. |
duke@1 | 216 | * |
duke@1 | 217 | * @param ctx the <code>Context</code> object that contains the |
duke@1 | 218 | * context strings that must be resolved before they are |
duke@1 | 219 | * sent along with the request |
duke@1 | 220 | * @param operation the method that the new <code>Request</code> |
duke@1 | 221 | * object will invoke |
duke@1 | 222 | * @param arg_list the arguments for the method; an <code>NVList</code> |
duke@1 | 223 | * in which each argument is a <code>NamedValue</code> object |
duke@1 | 224 | * @param result a <code>NamedValue</code> object to be used for |
duke@1 | 225 | * returning the result of executing the request's method |
duke@1 | 226 | * @param exceptions a list of the exceptions that the given method |
duke@1 | 227 | * throws |
duke@1 | 228 | * @param contexts a list of the properties that are needed to |
duke@1 | 229 | * resolve the contexts in <i>ctx</i>; the strings in |
duke@1 | 230 | * <i>contexts</i> are used as arguments to the method |
duke@1 | 231 | * <code>Context.get_values</code>, |
duke@1 | 232 | * which returns the value associated with the given property |
duke@1 | 233 | * @return a new <code>Request</code> object initialized with the |
duke@1 | 234 | * given context strings to resolve, method, argument list, |
duke@1 | 235 | * container for the result, exceptions, and list of property |
duke@1 | 236 | * names to be used in resolving the context strings |
duke@1 | 237 | */ |
duke@1 | 238 | public Request _create_request(Context ctx, |
duke@1 | 239 | String operation, |
duke@1 | 240 | NVList arg_list, |
duke@1 | 241 | NamedValue result, |
duke@1 | 242 | ExceptionList exceptions, |
duke@1 | 243 | ContextList contexts) { |
duke@1 | 244 | return _get_delegate().create_request(this, |
duke@1 | 245 | ctx, |
duke@1 | 246 | operation, |
duke@1 | 247 | arg_list, |
duke@1 | 248 | result, |
duke@1 | 249 | exceptions, |
duke@1 | 250 | contexts); |
duke@1 | 251 | } |
duke@1 | 252 | |
duke@1 | 253 | /** |
duke@1 | 254 | * Retrieves the interface definition for this <code>ObjectImpl</code> |
duke@1 | 255 | * object. |
duke@1 | 256 | * |
duke@1 | 257 | * @return the <code>org.omg.CORBA.Object</code> instance that is the |
duke@1 | 258 | * interface definition for this <code>ObjectImpl</code> object |
duke@1 | 259 | */ |
duke@1 | 260 | public org.omg.CORBA.Object _get_interface_def() |
duke@1 | 261 | { |
duke@1 | 262 | // First try to call the delegate implementation class's |
duke@1 | 263 | // "Object get_interface_def(..)" method (will work for JDK1.2 ORBs). |
duke@1 | 264 | // Else call the delegate implementation class's |
duke@1 | 265 | // "InterfaceDef get_interface(..)" method using reflection |
duke@1 | 266 | // (will work for pre-JDK1.2 ORBs). |
duke@1 | 267 | |
duke@1 | 268 | org.omg.CORBA.portable.Delegate delegate = _get_delegate(); |
duke@1 | 269 | try { |
duke@1 | 270 | // If the ORB's delegate class does not implement |
duke@1 | 271 | // "Object get_interface_def(..)", this will call |
duke@1 | 272 | // get_interface_def(..) on portable.Delegate. |
duke@1 | 273 | return delegate.get_interface_def(this); |
duke@1 | 274 | } |
duke@1 | 275 | catch( org.omg.CORBA.NO_IMPLEMENT ex ) { |
duke@1 | 276 | // Call "InterfaceDef get_interface(..)" method using reflection. |
duke@1 | 277 | try { |
duke@1 | 278 | Class[] argc = { org.omg.CORBA.Object.class }; |
duke@1 | 279 | java.lang.reflect.Method meth = |
duke@1 | 280 | delegate.getClass().getMethod("get_interface", argc); |
duke@1 | 281 | Object[] argx = { this }; |
duke@1 | 282 | return (org.omg.CORBA.Object)meth.invoke(delegate, argx); |
duke@1 | 283 | } |
duke@1 | 284 | catch( java.lang.reflect.InvocationTargetException exs ) { |
duke@1 | 285 | Throwable t = exs.getTargetException(); |
duke@1 | 286 | if (t instanceof Error) { |
duke@1 | 287 | throw (Error) t; |
duke@1 | 288 | } |
duke@1 | 289 | else if (t instanceof RuntimeException) { |
duke@1 | 290 | throw (RuntimeException) t; |
duke@1 | 291 | } |
duke@1 | 292 | else { |
duke@1 | 293 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
duke@1 | 294 | } |
duke@1 | 295 | } catch( RuntimeException rex ) { |
duke@1 | 296 | throw rex; |
duke@1 | 297 | } catch( Exception exr ) { |
duke@1 | 298 | throw new org.omg.CORBA.NO_IMPLEMENT(); |
duke@1 | 299 | } |
duke@1 | 300 | } |
duke@1 | 301 | } |
duke@1 | 302 | |
duke@1 | 303 | /** |
duke@1 | 304 | * Returns a reference to the ORB associated with this object and |
duke@1 | 305 | * its delegate. This is the <code>ORB</code> object that created |
duke@1 | 306 | * the delegate. |
duke@1 | 307 | * |
duke@1 | 308 | * @return the <code>ORB</code> instance that created the |
duke@1 | 309 | * <code>Delegate</code> object contained in this |
duke@1 | 310 | * <code>ObjectImpl</code> object |
duke@1 | 311 | */ |
duke@1 | 312 | public org.omg.CORBA.ORB _orb() { |
duke@1 | 313 | return _get_delegate().orb(this); |
duke@1 | 314 | } |
duke@1 | 315 | |
duke@1 | 316 | |
duke@1 | 317 | /** |
duke@1 | 318 | * Retrieves the <code>Policy</code> object for this |
duke@1 | 319 | * <code>ObjectImpl</code> object that has the given |
duke@1 | 320 | * policy type. |
duke@1 | 321 | * |
duke@1 | 322 | * @param policy_type an int indicating the policy type |
duke@1 | 323 | * @return the <code>Policy</code> object that is the specified policy type |
duke@1 | 324 | * and that applies to this <code>ObjectImpl</code> object |
duke@1 | 325 | * @see org.omg.CORBA.PolicyOperations#policy_type |
duke@1 | 326 | */ |
duke@1 | 327 | public org.omg.CORBA.Policy _get_policy(int policy_type) { |
duke@1 | 328 | return _get_delegate().get_policy(this, policy_type); |
duke@1 | 329 | } |
duke@1 | 330 | |
duke@1 | 331 | /** |
duke@1 | 332 | * Retrieves a list of the domain managers for this |
duke@1 | 333 | * <code>ObjectImpl</code> object. |
duke@1 | 334 | * |
duke@1 | 335 | * @return an array containing the <code>DomainManager</code> |
duke@1 | 336 | * objects for this instance of <code>ObjectImpl</code> |
duke@1 | 337 | */ |
duke@1 | 338 | public org.omg.CORBA.DomainManager[] _get_domain_managers() { |
duke@1 | 339 | return _get_delegate().get_domain_managers(this); |
duke@1 | 340 | } |
duke@1 | 341 | |
duke@1 | 342 | /** |
duke@1 | 343 | * Sets this <code>ObjectImpl</code> object's override type for |
duke@1 | 344 | * the given policies to the given instance of |
duke@1 | 345 | * <code>SetOverrideType</code>. |
duke@1 | 346 | * |
duke@1 | 347 | * @param policies an array of <code>Policy</code> objects with the |
duke@1 | 348 | * policies that will replace the current policies or be |
duke@1 | 349 | * added to the current policies |
duke@1 | 350 | * @param set_add either <code>SetOverrideType.SET_OVERRIDE</code>, |
duke@1 | 351 | * indicating that the given policies will replace any existing |
duke@1 | 352 | * ones, or <code>SetOverrideType.ADD_OVERRIDE</code>, indicating |
duke@1 | 353 | * that the given policies should be added to any existing ones |
duke@1 | 354 | * @return an <code>Object</code> with the given policies replacing or |
duke@1 | 355 | * added to its previous policies |
duke@1 | 356 | */ |
duke@1 | 357 | public org.omg.CORBA.Object |
duke@1 | 358 | _set_policy_override(org.omg.CORBA.Policy[] policies, |
duke@1 | 359 | org.omg.CORBA.SetOverrideType set_add) { |
duke@1 | 360 | return _get_delegate().set_policy_override(this, policies, |
duke@1 | 361 | set_add); |
duke@1 | 362 | } |
duke@1 | 363 | |
duke@1 | 364 | /** |
duke@1 | 365 | * Checks whether this <code>ObjectImpl</code> object is implemented |
duke@1 | 366 | * by a local servant. If so, local invocation API's may be used. |
duke@1 | 367 | * |
duke@1 | 368 | * @return <code>true</code> if this object is implemented by a local |
duke@1 | 369 | * servant; <code>false</code> otherwise |
duke@1 | 370 | */ |
duke@1 | 371 | public boolean _is_local() { |
duke@1 | 372 | return _get_delegate().is_local(this); |
duke@1 | 373 | } |
duke@1 | 374 | |
duke@1 | 375 | /** |
duke@1 | 376 | * Returns a Java reference to the local servant that should be used for sending |
duke@1 | 377 | * a request for the method specified. If this <code>ObjectImpl</code> |
duke@1 | 378 | * object is a local stub, it will invoke the <code>_servant_preinvoke</code> |
duke@1 | 379 | * method before sending a request in order to obtain the |
duke@1 | 380 | * <code>ServantObject</code> instance to use. |
duke@1 | 381 | * <P> |
duke@1 | 382 | * If a <code>ServantObject</code> object is returned, its <code>servant</code> |
duke@1 | 383 | * field has been set to an object of the expected type (Note: the object may |
duke@1 | 384 | * or may not be the actual servant instance). The local stub may cast |
duke@1 | 385 | * the servant field to the expected type, and then invoke the operation |
duke@1 | 386 | * directly. The <code>ServantRequest</code> object is valid for only one |
duke@1 | 387 | * invocation and cannot be used for more than one invocation. |
duke@1 | 388 | * |
duke@1 | 389 | * @param operation a <code>String</code> containing the name of the method |
duke@1 | 390 | * to be invoked. This name should correspond to the method name as |
duke@1 | 391 | * it would be encoded in a GIOP request. |
duke@1 | 392 | * |
duke@1 | 393 | * @param expectedType a <code>Class</code> object representing the |
duke@1 | 394 | * expected type of the servant that is returned. This expected |
duke@1 | 395 | * type is the <code>Class</code> object associated with the |
duke@1 | 396 | * operations class for the stub's interface. For example, a |
duke@1 | 397 | * stub for an interface <code>Foo</code> would pass the |
duke@1 | 398 | * <code>Class</code> object for the <code>FooOperations</code> |
duke@1 | 399 | * interface. |
duke@1 | 400 | * |
duke@1 | 401 | * @return (1) a <code>ServantObject</code> object, which may or may |
duke@1 | 402 | * not be the actual servant instance, or (2) <code>null</code> if |
duke@1 | 403 | * (a) the servant is not local or (b) the servant has ceased to |
duke@1 | 404 | * be local due to a ForwardRequest from a POA ServantManager |
duke@1 | 405 | * @throws org.omg.CORBA.BAD_PARAM if the servant is not the expected type |
duke@1 | 406 | */ |
duke@1 | 407 | public ServantObject _servant_preinvoke(String operation, |
duke@1 | 408 | Class expectedType) { |
duke@1 | 409 | return _get_delegate().servant_preinvoke(this, operation, |
duke@1 | 410 | expectedType); |
duke@1 | 411 | } |
duke@1 | 412 | |
duke@1 | 413 | /** |
duke@1 | 414 | * Is called by the local stub after it has invoked an operation |
duke@1 | 415 | * on the local servant that was previously retrieved from a |
duke@1 | 416 | * call to the method <code>_servant_preinvoke</code>. |
duke@1 | 417 | * The <code>_servant_postinvoke</code> method must be called |
duke@1 | 418 | * if the <code>_servant_preinvoke</code> |
duke@1 | 419 | * method returned a non-null value, even if an exception was thrown |
duke@1 | 420 | * by the method invoked by the servant. For this reason, the call |
duke@1 | 421 | * to the method <code>_servant_postinvoke</code> should be placed |
duke@1 | 422 | * in a Java <code>finally</code> clause. |
duke@1 | 423 | * |
duke@1 | 424 | * @param servant the instance of the <code>ServantObject</code> |
duke@1 | 425 | * returned by the <code>_servant_preinvoke</code> method |
duke@1 | 426 | */ |
duke@1 | 427 | public void _servant_postinvoke(ServantObject servant) { |
duke@1 | 428 | _get_delegate().servant_postinvoke(this, servant); |
duke@1 | 429 | } |
duke@1 | 430 | |
duke@1 | 431 | /* |
duke@1 | 432 | * The following methods were added by orbos/98-04-03: Java to IDL |
duke@1 | 433 | * Mapping. These are used by RMI over IIOP. |
duke@1 | 434 | */ |
duke@1 | 435 | |
duke@1 | 436 | /** |
duke@1 | 437 | * Returns an <code>OutputStream</code> object to use for marshalling |
duke@1 | 438 | * the arguments of the given method. This method is called by a stub, |
duke@1 | 439 | * which must indicate if a response is expected, that is, whether or not |
duke@1 | 440 | * the call is oneway. |
duke@1 | 441 | * |
duke@1 | 442 | * @param operation a String giving the name of the method. |
duke@1 | 443 | * @param responseExpected a boolean -- <code>true</code> if the |
duke@1 | 444 | * request is not one way, that is, a response is expected |
duke@1 | 445 | * @return an <code>OutputStream</code> object for dispatching the request |
duke@1 | 446 | */ |
duke@1 | 447 | public OutputStream _request(String operation, |
duke@1 | 448 | boolean responseExpected) { |
duke@1 | 449 | return _get_delegate().request(this, operation, responseExpected); |
duke@1 | 450 | } |
duke@1 | 451 | |
duke@1 | 452 | /** |
duke@1 | 453 | * Invokes an operation and returns an <code>InputStream</code> |
duke@1 | 454 | * object for reading the response. The stub provides the |
duke@1 | 455 | * <code>OutputStream</code> object that was previously returned by a |
duke@1 | 456 | * call to the <code>_request</code> method. The method specified |
duke@1 | 457 | * as an argument to <code>_request</code> when it was |
duke@1 | 458 | * called previously is the method that this method invokes. |
duke@1 | 459 | * <P> |
duke@1 | 460 | * If an exception occurs, the <code>_invoke</code> method may throw an |
duke@1 | 461 | * <code>ApplicationException</code> object that contains an InputStream from |
duke@1 | 462 | * which the user exception state may be unmarshalled. |
duke@1 | 463 | * |
duke@1 | 464 | * @param output an OutputStream object for dispatching the request |
duke@1 | 465 | * @return an <code>InputStream</code> object containing the marshalled |
duke@1 | 466 | * response to the method invoked |
duke@1 | 467 | * @throws ApplicationException if the invocation |
duke@1 | 468 | * meets application-defined exception |
duke@1 | 469 | * @throws RemarshalException if the invocation leads |
duke@1 | 470 | * to a remarshalling error |
duke@1 | 471 | * @see #_request |
duke@1 | 472 | */ |
duke@1 | 473 | public InputStream _invoke(OutputStream output) |
duke@1 | 474 | throws ApplicationException, RemarshalException { |
duke@1 | 475 | return _get_delegate().invoke(this, output); |
duke@1 | 476 | } |
duke@1 | 477 | |
duke@1 | 478 | /** |
duke@1 | 479 | * Releases the given |
duke@1 | 480 | * reply stream back to the ORB when unmarshalling has |
duke@1 | 481 | * completed after a call to the method <code>_invoke</code>. |
duke@1 | 482 | * Calling this method is optional for the stub. |
duke@1 | 483 | * |
duke@1 | 484 | * @param input the <code>InputStream</code> object that was returned |
duke@1 | 485 | * by the <code>_invoke</code> method or the |
duke@1 | 486 | * <code>ApplicationException.getInputStream</code> method; |
duke@1 | 487 | * may be <code>null</code>, in which case this method does |
duke@1 | 488 | * nothing |
duke@1 | 489 | * @see #_invoke |
duke@1 | 490 | */ |
duke@1 | 491 | public void _releaseReply(InputStream input) { |
duke@1 | 492 | _get_delegate().releaseReply(this, input); |
duke@1 | 493 | } |
duke@1 | 494 | |
duke@1 | 495 | /** |
duke@1 | 496 | * Returns a <code>String</code> object that represents this |
duke@1 | 497 | * <code>ObjectImpl</code> object. |
duke@1 | 498 | * |
duke@1 | 499 | * @return the <code>String</code> representation of this object |
duke@1 | 500 | */ |
duke@1 | 501 | public String toString() { |
duke@1 | 502 | if ( __delegate != null ) |
duke@1 | 503 | return __delegate.toString(this); |
duke@1 | 504 | else |
duke@1 | 505 | return getClass().getName() + ": no delegate set"; |
duke@1 | 506 | } |
duke@1 | 507 | |
duke@1 | 508 | /** |
duke@1 | 509 | * Returns the hash code for this <code>ObjectImpl</code> object. |
duke@1 | 510 | * |
duke@1 | 511 | * @return the hash code for this object |
duke@1 | 512 | */ |
duke@1 | 513 | public int hashCode() { |
duke@1 | 514 | if ( __delegate != null ) |
duke@1 | 515 | return __delegate.hashCode(this); |
duke@1 | 516 | else |
duke@1 | 517 | return super.hashCode(); |
duke@1 | 518 | } |
duke@1 | 519 | |
duke@1 | 520 | /** |
duke@1 | 521 | * Compares this <code>ObjectImpl</code> object with the given one |
duke@1 | 522 | * for equality. |
duke@1 | 523 | * |
duke@1 | 524 | *@param obj the object with which to compare this object |
duke@1 | 525 | *@return <code>true</code> if the two objects are equal; |
duke@1 | 526 | * <code>false</code> otherwise |
duke@1 | 527 | */ |
duke@1 | 528 | public boolean equals(java.lang.Object obj) { |
duke@1 | 529 | if ( __delegate != null ) |
duke@1 | 530 | return __delegate.equals(this, obj); |
duke@1 | 531 | else |
duke@1 | 532 | return (this==obj); |
duke@1 | 533 | } |
duke@1 | 534 | } |