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

Tue, 25 Mar 2008 14:42:28 -0700

author
ohair
date
Tue, 25 Mar 2008 14:42:28 -0700
changeset 5
5e61d5df6258
parent 1
55540e827aef
child 158
91006f157c46
permissions
-rw-r--r--

6627817: Remove ^M characters in all files (Makefiles too)
Summary: Some files included the use of the ^M character, which has been deleted
Reviewed-by: xdono

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

mercurial