src/share/classes/org/omg/CORBA/portable/Delegate.java

Wed, 27 Apr 2016 01:21:28 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:21:28 +0800
changeset 0
7ef37b2cdcad
child 748
6845b95cba6b
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/corba/
changeset: 765:f46df0af2ca8
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2002, 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 package org.omg.CORBA.portable;
aoqi@0 26
aoqi@0 27 import org.omg.CORBA.Request;
aoqi@0 28 import org.omg.CORBA.NamedValue;
aoqi@0 29 import org.omg.CORBA.NVList;
aoqi@0 30 import org.omg.CORBA.Context;
aoqi@0 31 import org.omg.CORBA.ContextList;
aoqi@0 32 import org.omg.CORBA.ExceptionList;
aoqi@0 33 import org.omg.CORBA.TypeCode;
aoqi@0 34 import org.omg.CORBA.SystemException;
aoqi@0 35
aoqi@0 36 /**
aoqi@0 37 * Specifies a portable API for ORB-vendor-specific
aoqi@0 38 * implementation of the org.omg.CORBA.Object methods.
aoqi@0 39 *
aoqi@0 40 * Each stub (proxy) contains a delegate
aoqi@0 41 * object, to which all org.omg.CORBA.Object methods are forwarded.
aoqi@0 42 * This allows a stub generated by one vendor's ORB to work with the delegate
aoqi@0 43 * from another vendor's ORB.
aoqi@0 44 *
aoqi@0 45 * @see org.omg.CORBA.Object
aoqi@0 46 * @author OMG
aoqi@0 47 */
aoqi@0 48
aoqi@0 49 public abstract class Delegate {
aoqi@0 50
aoqi@0 51 /**
aoqi@0 52 * Return an InterfaceDef for the object reference provided.
aoqi@0 53 * @param self The object reference whose InterfaceDef needs to be returned
aoqi@0 54 * @return the InterfaceDef
aoqi@0 55 */
aoqi@0 56 public abstract org.omg.CORBA.Object get_interface_def(
aoqi@0 57 org.omg.CORBA.Object self);
aoqi@0 58
aoqi@0 59 /**
aoqi@0 60 * Returns a duplicate of the object reference provided.
aoqi@0 61 * @param obj The object reference whose duplicate needs to be returned
aoqi@0 62 * @return the duplicate object reference
aoqi@0 63 */
aoqi@0 64 public abstract org.omg.CORBA.Object duplicate(org.omg.CORBA.Object obj);
aoqi@0 65
aoqi@0 66 /**
aoqi@0 67 * Releases resources associated with the object reference provided.
aoqi@0 68 * @param obj The object reference whose resources need to be released
aoqi@0 69 */
aoqi@0 70 public abstract void release(org.omg.CORBA.Object obj);
aoqi@0 71
aoqi@0 72 /**
aoqi@0 73 * Checks if the object reference is an instance of the given interface.
aoqi@0 74 * @param obj The object reference to be checked.
aoqi@0 75 * @param repository_id The repository identifier of the interface
aoqi@0 76 * to check against.
aoqi@0 77 * @return true if the object reference supports the interface
aoqi@0 78 */
aoqi@0 79 public abstract boolean is_a(org.omg.CORBA.Object obj, String repository_id);
aoqi@0 80
aoqi@0 81 /**
aoqi@0 82 * Determines whether the server object for the object reference has been
aoqi@0 83 * destroyed.
aoqi@0 84 * @param obj The object reference which delegated to this delegate.
aoqi@0 85 * @return true if the ORB knows authoritatively that the server object does
aoqi@0 86 * not exist, false otherwise
aoqi@0 87 */
aoqi@0 88 public abstract boolean non_existent(org.omg.CORBA.Object obj);
aoqi@0 89
aoqi@0 90 /**
aoqi@0 91 * Determines if the two object references are equivalent.
aoqi@0 92 * @param obj The object reference which delegated to this delegate.
aoqi@0 93 * @param other The object reference to check equivalence against.
aoqi@0 94 * @return true if the objects are CORBA-equivalent.
aoqi@0 95 */
aoqi@0 96 public abstract boolean is_equivalent(org.omg.CORBA.Object obj,
aoqi@0 97 org.omg.CORBA.Object other);
aoqi@0 98
aoqi@0 99 /**
aoqi@0 100 * Returns an ORB-internal identifier (hashcode) for this object reference.
aoqi@0 101 * @param obj The object reference which delegated to this delegate.
aoqi@0 102 * @param max specifies an upper bound on the hash value returned by
aoqi@0 103 * the ORB.
aoqi@0 104 * @return ORB-internal hash identifier for object reference
aoqi@0 105 */
aoqi@0 106 public abstract int hash(org.omg.CORBA.Object obj, int max);
aoqi@0 107
aoqi@0 108 /**
aoqi@0 109 * Creates a Request instance for use in the Dynamic Invocation Interface.
aoqi@0 110 * @param obj The object reference which delegated to this delegate.
aoqi@0 111 * @param operation The name of the operation to be invoked using the
aoqi@0 112 * Request instance.
aoqi@0 113 * @return the created Request instance
aoqi@0 114 */
aoqi@0 115 public abstract Request request(org.omg.CORBA.Object obj, String operation);
aoqi@0 116
aoqi@0 117 /**
aoqi@0 118 * Creates a Request instance for use in the Dynamic Invocation Interface.
aoqi@0 119 *
aoqi@0 120 * @param obj The object reference which delegated to this delegate.
aoqi@0 121 * @param ctx The context to be used.
aoqi@0 122 * @param operation The name of the operation to be
aoqi@0 123 * invoked.
aoqi@0 124 * @param arg_list The arguments to the operation in the
aoqi@0 125 * form of an NVList.
aoqi@0 126 * @param result A container for the result as a NamedValue.
aoqi@0 127 * @return The created Request object.
aoqi@0 128 *
aoqi@0 129 */
aoqi@0 130 public abstract Request create_request(org.omg.CORBA.Object obj,
aoqi@0 131 Context ctx,
aoqi@0 132 String operation,
aoqi@0 133 NVList arg_list,
aoqi@0 134 NamedValue result);
aoqi@0 135
aoqi@0 136 /**
aoqi@0 137 * Creates a Request instance for use in the Dynamic Invocation Interface.
aoqi@0 138 *
aoqi@0 139 * @param obj The object reference which delegated to this delegate.
aoqi@0 140 * @param ctx The context to be used.
aoqi@0 141 * @param operation The name of the operation to be
aoqi@0 142 * invoked.
aoqi@0 143 * @param arg_list The arguments to the operation in the
aoqi@0 144 * form of an NVList.
aoqi@0 145 * @param result A container for the result as a NamedValue.
aoqi@0 146 * @param exclist A list of possible exceptions the
aoqi@0 147 * operation can throw.
aoqi@0 148 * @param ctxlist A list of context strings that need
aoqi@0 149 * to be resolved and sent with the
aoqi@0 150 * Request.
aoqi@0 151 * @return The created Request object.
aoqi@0 152 */
aoqi@0 153 public abstract Request create_request(org.omg.CORBA.Object obj,
aoqi@0 154 Context ctx,
aoqi@0 155 String operation,
aoqi@0 156 NVList arg_list,
aoqi@0 157 NamedValue result,
aoqi@0 158 ExceptionList exclist,
aoqi@0 159 ContextList ctxlist);
aoqi@0 160
aoqi@0 161 /**
aoqi@0 162 * Provides a reference to the orb associated with its parameter.
aoqi@0 163 *
aoqi@0 164 * @param obj the object reference which delegated to this delegate.
aoqi@0 165 * @return the associated orb.
aoqi@0 166 * @see <a href="package-summary.html#unimpl"><code>portable</code>
aoqi@0 167 * package comments for unimplemented features</a>
aoqi@0 168 */
aoqi@0 169 public org.omg.CORBA.ORB orb(org.omg.CORBA.Object obj) {
aoqi@0 170 throw new org.omg.CORBA.NO_IMPLEMENT();
aoqi@0 171 }
aoqi@0 172
aoqi@0 173 /**
aoqi@0 174 * Returns the <code>Policy</code> object of the specified type
aoqi@0 175 * which applies to this object.
aoqi@0 176 *
aoqi@0 177 * @param self The object reference which delegated to this delegate.
aoqi@0 178 * @param policy_type The type of policy to be obtained.
aoqi@0 179 * @return A <code>Policy</code> object of the type specified by
aoqi@0 180 * the policy_type parameter.
aoqi@0 181 * @exception org.omg.CORBA.BAD_PARAM raised when the value of policy type
aoqi@0 182 * is not valid either because the specified type is not supported by this
aoqi@0 183 * ORB or because a policy object of that type is not associated with this
aoqi@0 184 * Object.
aoqi@0 185 * @see <a href="package-summary.html#unimpl"><code>portable</code>
aoqi@0 186 * package comments for unimplemented features</a>
aoqi@0 187 */
aoqi@0 188 public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self,
aoqi@0 189 int policy_type) {
aoqi@0 190 throw new org.omg.CORBA.NO_IMPLEMENT();
aoqi@0 191 }
aoqi@0 192
aoqi@0 193
aoqi@0 194 /**
aoqi@0 195 * Retrieves the <code>DomainManagers</code> of this object.
aoqi@0 196 * This allows administration services (and applications) to retrieve the
aoqi@0 197 * domain managers, and hence the security and other policies applicable
aoqi@0 198 * to individual objects that are members of the domain.
aoqi@0 199 *
aoqi@0 200 * @param self The object reference which delegated to this delegate.
aoqi@0 201 * @return The list of immediately enclosing domain managers of this object.
aoqi@0 202 * At least one domain manager is always returned in the list since by
aoqi@0 203 * default each object is associated with at least one domain manager at
aoqi@0 204 * creation.
aoqi@0 205 * @see <a href="package-summary.html#unimpl"><code>portable</code>
aoqi@0 206 * package comments for unimplemented features</a>
aoqi@0 207 */
aoqi@0 208 public org.omg.CORBA.DomainManager[] get_domain_managers(
aoqi@0 209 org.omg.CORBA.Object
aoqi@0 210 self) {
aoqi@0 211 throw new org.omg.CORBA.NO_IMPLEMENT();
aoqi@0 212 }
aoqi@0 213
aoqi@0 214
aoqi@0 215 /**
aoqi@0 216 * Associates the policies passed in
aoqi@0 217 * with a newly created object reference that it returns. Only certain
aoqi@0 218 * policies that pertain to the invocation of an operation at the client
aoqi@0 219 * end can be overridden using this operation. Attempts to override any
aoqi@0 220 * other policy will result in the raising of the CORBA::NO_PERMISSION
aoqi@0 221 * exception.
aoqi@0 222 *
aoqi@0 223 * @param self The object reference which delegated to this delegate.
aoqi@0 224 * @param policies A sequence of references to Policy objects.
aoqi@0 225 * @param set_add Indicates whether these policies should be added
aoqi@0 226 * onto any otheroverrides that already exist (ADD_OVERRIDE) in
aoqi@0 227 * the object reference, or they should be added to a clean
aoqi@0 228 * override free object reference (SET_OVERRIDE).
aoqi@0 229 * @return A new object reference with the new policies associated with it.
aoqi@0 230 *
aoqi@0 231 * @see <a href="package-summary.html#unimpl"><code>portable</code>
aoqi@0 232 * package comments for unimplemented features</a>
aoqi@0 233 */
aoqi@0 234 public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self,
aoqi@0 235 org.omg.CORBA.Policy[] policies,
aoqi@0 236 org.omg.CORBA.SetOverrideType set_add) {
aoqi@0 237 throw new org.omg.CORBA.NO_IMPLEMENT();
aoqi@0 238 }
aoqi@0 239
aoqi@0 240
aoqi@0 241 /**
aoqi@0 242 * Returns true if this object is implemented by a local servant.
aoqi@0 243 *
aoqi@0 244 * @param self The object reference which delegated to this delegate.
aoqi@0 245 * @return true only if the servant incarnating this object is located in
aoqi@0 246 * this Java VM. Return false if the servant is not local or the ORB
aoqi@0 247 * does not support local stubs for this particular servant. The default
aoqi@0 248 * behavior of is_local() is to return false.
aoqi@0 249 */
aoqi@0 250 public boolean is_local(org.omg.CORBA.Object self) {
aoqi@0 251 return false;
aoqi@0 252 }
aoqi@0 253
aoqi@0 254 /**
aoqi@0 255 * Returns a Java reference to the servant which should be used for this
aoqi@0 256 * request. servant_preinvoke() is invoked by a local stub.
aoqi@0 257 * If a ServantObject object is returned, then its servant field
aoqi@0 258 * has been set to an object of the expected type (Note: the object may
aoqi@0 259 * or may not be the actual servant instance). The local stub may cast
aoqi@0 260 * the servant field to the expected type, and then invoke the operation
aoqi@0 261 * directly. The ServantRequest object is valid for only one invocation,
aoqi@0 262 * and cannot be used for more than one invocation.
aoqi@0 263 *
aoqi@0 264 * @param self The object reference which delegated to this delegate.
aoqi@0 265 *
aoqi@0 266 * @param operation a string containing the operation name.
aoqi@0 267 * The operation name corresponds to the operation name as it would be
aoqi@0 268 * encoded in a GIOP request.
aoqi@0 269 *
aoqi@0 270 * @param expectedType a Class object representing the expected type of the servant.
aoqi@0 271 * The expected type is the Class object associated with the operations
aoqi@0 272 * class of the stub's interface (e.g. A stub for an interface Foo,
aoqi@0 273 * would pass the Class object for the FooOperations interface).
aoqi@0 274 *
aoqi@0 275 * @return a ServantObject object.
aoqi@0 276 * The method may return a null value if it does not wish to support
aoqi@0 277 * this optimization (e.g. due to security, transactions, etc).
aoqi@0 278 * The method must return null if the servant is not of the expected type.
aoqi@0 279 */
aoqi@0 280 public ServantObject servant_preinvoke(org.omg.CORBA.Object self,
aoqi@0 281 String operation,
aoqi@0 282 Class expectedType) {
aoqi@0 283 return null;
aoqi@0 284 }
aoqi@0 285
aoqi@0 286 /**
aoqi@0 287 * servant_postinvoke() is invoked by the local stub after the operation
aoqi@0 288 * has been invoked on the local servant.
aoqi@0 289 * This method must be called if servant_preinvoke() returned a non-null
aoqi@0 290 * value, even if an exception was thrown by the servant's method.
aoqi@0 291 * For this reason, the call to servant_postinvoke() should be placed
aoqi@0 292 * in a Java finally clause.
aoqi@0 293 *
aoqi@0 294 * @param self The object reference which delegated to this delegate.
aoqi@0 295 *
aoqi@0 296 * @param servant the instance of the ServantObject returned from
aoqi@0 297 * the servant_preinvoke() method.
aoqi@0 298 */
aoqi@0 299 public void servant_postinvoke(org.omg.CORBA.Object self,
aoqi@0 300 ServantObject servant) {
aoqi@0 301 }
aoqi@0 302
aoqi@0 303 /**
aoqi@0 304 * request is called by a stub to obtain an OutputStream for
aoqi@0 305 * marshaling arguments. The stub must supply the operation name,
aoqi@0 306 * and indicate if a response is expected (i.e is this a oneway
aoqi@0 307 * call).
aoqi@0 308 *
aoqi@0 309 * @param self The object reference which delegated to this delegate.
aoqi@0 310 * @param operation a string containing the operation name.
aoqi@0 311 * The operation name corresponds to the operation name as it would be
aoqi@0 312 * encoded in a GIOP request.
aoqi@0 313 * @param responseExpected false if the operation is a one way operation,
aoqi@0 314 * and true otherwise.
aoqi@0 315 * @return OutputStream the OutputStream into which request arguments
aoqi@0 316 * can be marshaled.
aoqi@0 317 * @see <a href="package-summary.html#unimpl"><code>portable</code>
aoqi@0 318 * package comments for unimplemented features</a>
aoqi@0 319 */
aoqi@0 320 public OutputStream request(org.omg.CORBA.Object self,
aoqi@0 321 String operation,
aoqi@0 322 boolean responseExpected) {
aoqi@0 323 throw new org.omg.CORBA.NO_IMPLEMENT();
aoqi@0 324 }
aoqi@0 325
aoqi@0 326 /**
aoqi@0 327 * invoke is called by a stub to invoke an operation. The stub provides an
aoqi@0 328 * OutputStream that was previously returned by a request()
aoqi@0 329 * call. invoke returns an InputStream which contains the
aoqi@0 330 * marshaled reply. If an exception occurs, invoke may throw an
aoqi@0 331 * ApplicationException object which contains an InputStream from
aoqi@0 332 * which the user exception state may be unmarshaled.
aoqi@0 333 *
aoqi@0 334 * @param self The object reference which delegated to this delegate.
aoqi@0 335 * @param output the OutputStream which contains marshaled arguments
aoqi@0 336 * @return input the InputStream from which reply parameters can be
aoqi@0 337 * unmarshaled.
aoqi@0 338 * @throws ApplicationException thrown when implementation throws
aoqi@0 339 * (upon invocation) an exception defined as part of its remote method
aoqi@0 340 * definition.
aoqi@0 341 * @throws RemarshalException thrown when remarshalling fails.
aoqi@0 342 * @see <a href="package-summary.html#unimpl"><code>portable</code>
aoqi@0 343 * package comments for unimplemented features</a>
aoqi@0 344 */
aoqi@0 345 public InputStream invoke(org.omg.CORBA.Object self,
aoqi@0 346 OutputStream output)
aoqi@0 347 throws ApplicationException, RemarshalException {
aoqi@0 348 throw new org.omg.CORBA.NO_IMPLEMENT();
aoqi@0 349 }
aoqi@0 350
aoqi@0 351 /**
aoqi@0 352 * releaseReply may optionally be called by a stub to release a
aoqi@0 353 * reply stream back to the ORB when the unmarshaling has
aoqi@0 354 * completed. The stub passes the InputStream returned by
aoqi@0 355 * invoke() or ApplicationException.getInputStream(). A null
aoqi@0 356 * value may also be passed to releaseReply, in which case the
aoqi@0 357 * method is a noop.
aoqi@0 358 *
aoqi@0 359 * @param self The object reference which delegated to this delegate.
aoqi@0 360 * @param input the InputStream returned from invoke().
aoqi@0 361 * @see <a href="package-summary.html#unimpl"><code>portable</code>
aoqi@0 362 * package comments for unimplemented features</a>
aoqi@0 363 */
aoqi@0 364 public void releaseReply(org.omg.CORBA.Object self,
aoqi@0 365 InputStream input) {
aoqi@0 366 throw new org.omg.CORBA.NO_IMPLEMENT();
aoqi@0 367 }
aoqi@0 368
aoqi@0 369 /**
aoqi@0 370 * Provides the implementation to override the toString() method
aoqi@0 371 * of the delegating CORBA object.
aoqi@0 372 *
aoqi@0 373 * @param self the object reference that delegated to this delegate
aoqi@0 374 * @return a <code>String</code> object that represents the object
aoqi@0 375 * reference that delegated to this <code>Delegate</code>
aoqi@0 376 * object
aoqi@0 377 */
aoqi@0 378
aoqi@0 379 public String toString(org.omg.CORBA.Object self) {
aoqi@0 380 return self.getClass().getName() + ":" + this.toString();
aoqi@0 381 }
aoqi@0 382
aoqi@0 383 /**
aoqi@0 384 * Provides the implementation to override the hashCode() method
aoqi@0 385 * of the delegating CORBA object.
aoqi@0 386 *
aoqi@0 387 * @param self the object reference that delegated to this delegate
aoqi@0 388 * @return an <code>int</code> that represents the hashcode for the
aoqi@0 389 * object reference that delegated to this <code>Delegate</code>
aoqi@0 390 * object
aoqi@0 391 */
aoqi@0 392 public int hashCode(org.omg.CORBA.Object self) {
aoqi@0 393 return System.identityHashCode(self);
aoqi@0 394 }
aoqi@0 395
aoqi@0 396 /**
aoqi@0 397 * Provides the implementation to override the equals(java.lang.Object obj)
aoqi@0 398 * method of the delegating CORBA object.
aoqi@0 399 *
aoqi@0 400 * @param self the object reference that delegated to this delegate
aoqi@0 401 * @param obj the <code>Object</code> with which to compare
aoqi@0 402 * @return <code>true</code> if <code>obj</code> equals <code>self</code>;
aoqi@0 403 * <code>false</code> otherwise
aoqi@0 404 */
aoqi@0 405 public boolean equals(org.omg.CORBA.Object self, java.lang.Object obj) {
aoqi@0 406 return (self == obj);
aoqi@0 407 }
aoqi@0 408 }

mercurial