aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: package org.omg.CORBA.portable; aoqi@0: aoqi@0: import org.omg.CORBA.Request; aoqi@0: import org.omg.CORBA.NamedValue; aoqi@0: import org.omg.CORBA.NVList; aoqi@0: import org.omg.CORBA.Context; aoqi@0: import org.omg.CORBA.ContextList; aoqi@0: import org.omg.CORBA.ExceptionList; aoqi@0: import org.omg.CORBA.TypeCode; aoqi@0: import org.omg.CORBA.SystemException; aoqi@0: aoqi@0: /** aoqi@0: * Specifies a portable API for ORB-vendor-specific aoqi@0: * implementation of the org.omg.CORBA.Object methods. aoqi@0: * aoqi@0: * Each stub (proxy) contains a delegate aoqi@0: * object, to which all org.omg.CORBA.Object methods are forwarded. aoqi@0: * This allows a stub generated by one vendor's ORB to work with the delegate aoqi@0: * from another vendor's ORB. aoqi@0: * aoqi@0: * @see org.omg.CORBA.Object aoqi@0: * @author OMG aoqi@0: */ aoqi@0: aoqi@0: public abstract class Delegate { aoqi@0: aoqi@0: /** aoqi@0: * Return an InterfaceDef for the object reference provided. aoqi@0: * @param self The object reference whose InterfaceDef needs to be returned aoqi@0: * @return the InterfaceDef aoqi@0: */ aoqi@0: public abstract org.omg.CORBA.Object get_interface_def( aoqi@0: org.omg.CORBA.Object self); aoqi@0: aoqi@0: /** aoqi@0: * Returns a duplicate of the object reference provided. aoqi@0: * @param obj The object reference whose duplicate needs to be returned aoqi@0: * @return the duplicate object reference aoqi@0: */ aoqi@0: public abstract org.omg.CORBA.Object duplicate(org.omg.CORBA.Object obj); aoqi@0: aoqi@0: /** aoqi@0: * Releases resources associated with the object reference provided. aoqi@0: * @param obj The object reference whose resources need to be released aoqi@0: */ aoqi@0: public abstract void release(org.omg.CORBA.Object obj); aoqi@0: aoqi@0: /** aoqi@0: * Checks if the object reference is an instance of the given interface. aoqi@0: * @param obj The object reference to be checked. aoqi@0: * @param repository_id The repository identifier of the interface aoqi@0: * to check against. aoqi@0: * @return true if the object reference supports the interface aoqi@0: */ aoqi@0: public abstract boolean is_a(org.omg.CORBA.Object obj, String repository_id); aoqi@0: aoqi@0: /** aoqi@0: * Determines whether the server object for the object reference has been aoqi@0: * destroyed. aoqi@0: * @param obj The object reference which delegated to this delegate. aoqi@0: * @return true if the ORB knows authoritatively that the server object does aoqi@0: * not exist, false otherwise aoqi@0: */ aoqi@0: public abstract boolean non_existent(org.omg.CORBA.Object obj); aoqi@0: aoqi@0: /** aoqi@0: * Determines if the two object references are equivalent. aoqi@0: * @param obj The object reference which delegated to this delegate. aoqi@0: * @param other The object reference to check equivalence against. aoqi@0: * @return true if the objects are CORBA-equivalent. aoqi@0: */ aoqi@0: public abstract boolean is_equivalent(org.omg.CORBA.Object obj, aoqi@0: org.omg.CORBA.Object other); aoqi@0: aoqi@0: /** aoqi@0: * Returns an ORB-internal identifier (hashcode) for this object reference. aoqi@0: * @param obj The object reference which delegated to this delegate. aoqi@0: * @param max specifies an upper bound on the hash value returned by aoqi@0: * the ORB. aoqi@0: * @return ORB-internal hash identifier for object reference aoqi@0: */ aoqi@0: public abstract int hash(org.omg.CORBA.Object obj, int max); aoqi@0: aoqi@0: /** aoqi@0: * Creates a Request instance for use in the Dynamic Invocation Interface. aoqi@0: * @param obj The object reference which delegated to this delegate. aoqi@0: * @param operation The name of the operation to be invoked using the aoqi@0: * Request instance. aoqi@0: * @return the created Request instance aoqi@0: */ aoqi@0: public abstract Request request(org.omg.CORBA.Object obj, String operation); aoqi@0: aoqi@0: /** aoqi@0: * Creates a Request instance for use in the Dynamic Invocation Interface. aoqi@0: * aoqi@0: * @param obj The object reference which delegated to this delegate. aoqi@0: * @param ctx The context to be used. aoqi@0: * @param operation The name of the operation to be aoqi@0: * invoked. aoqi@0: * @param arg_list The arguments to the operation in the aoqi@0: * form of an NVList. aoqi@0: * @param result A container for the result as a NamedValue. aoqi@0: * @return The created Request object. aoqi@0: * aoqi@0: */ aoqi@0: public abstract Request create_request(org.omg.CORBA.Object obj, aoqi@0: Context ctx, aoqi@0: String operation, aoqi@0: NVList arg_list, aoqi@0: NamedValue result); aoqi@0: aoqi@0: /** aoqi@0: * Creates a Request instance for use in the Dynamic Invocation Interface. aoqi@0: * aoqi@0: * @param obj The object reference which delegated to this delegate. aoqi@0: * @param ctx The context to be used. aoqi@0: * @param operation The name of the operation to be aoqi@0: * invoked. aoqi@0: * @param arg_list The arguments to the operation in the aoqi@0: * form of an NVList. aoqi@0: * @param result A container for the result as a NamedValue. aoqi@0: * @param exclist A list of possible exceptions the aoqi@0: * operation can throw. aoqi@0: * @param ctxlist A list of context strings that need aoqi@0: * to be resolved and sent with the aoqi@0: * Request. aoqi@0: * @return The created Request object. aoqi@0: */ aoqi@0: public abstract Request create_request(org.omg.CORBA.Object obj, aoqi@0: Context ctx, aoqi@0: String operation, aoqi@0: NVList arg_list, aoqi@0: NamedValue result, aoqi@0: ExceptionList exclist, aoqi@0: ContextList ctxlist); aoqi@0: aoqi@0: /** aoqi@0: * Provides a reference to the orb associated with its parameter. aoqi@0: * aoqi@0: * @param obj the object reference which delegated to this delegate. aoqi@0: * @return the associated orb. aoqi@0: * @see portable aoqi@0: * package comments for unimplemented features aoqi@0: */ aoqi@0: public org.omg.CORBA.ORB orb(org.omg.CORBA.Object obj) { aoqi@0: throw new org.omg.CORBA.NO_IMPLEMENT(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Returns the Policy object of the specified type aoqi@0: * which applies to this object. aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * @param policy_type The type of policy to be obtained. aoqi@0: * @return A Policy object of the type specified by aoqi@0: * the policy_type parameter. aoqi@0: * @exception org.omg.CORBA.BAD_PARAM raised when the value of policy type aoqi@0: * is not valid either because the specified type is not supported by this aoqi@0: * ORB or because a policy object of that type is not associated with this aoqi@0: * Object. aoqi@0: * @see portable aoqi@0: * package comments for unimplemented features aoqi@0: */ aoqi@0: public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self, aoqi@0: int policy_type) { aoqi@0: throw new org.omg.CORBA.NO_IMPLEMENT(); aoqi@0: } aoqi@0: aoqi@0: aoqi@0: /** aoqi@0: * Retrieves the DomainManagers of this object. aoqi@0: * This allows administration services (and applications) to retrieve the aoqi@0: * domain managers, and hence the security and other policies applicable aoqi@0: * to individual objects that are members of the domain. aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * @return The list of immediately enclosing domain managers of this object. aoqi@0: * At least one domain manager is always returned in the list since by aoqi@0: * default each object is associated with at least one domain manager at aoqi@0: * creation. aoqi@0: * @see portable aoqi@0: * package comments for unimplemented features aoqi@0: */ aoqi@0: public org.omg.CORBA.DomainManager[] get_domain_managers( aoqi@0: org.omg.CORBA.Object aoqi@0: self) { aoqi@0: throw new org.omg.CORBA.NO_IMPLEMENT(); aoqi@0: } aoqi@0: aoqi@0: aoqi@0: /** aoqi@0: * Associates the policies passed in aoqi@0: * with a newly created object reference that it returns. Only certain aoqi@0: * policies that pertain to the invocation of an operation at the client aoqi@0: * end can be overridden using this operation. Attempts to override any aoqi@0: * other policy will result in the raising of the CORBA::NO_PERMISSION aoqi@0: * exception. aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * @param policies A sequence of references to Policy objects. aoqi@0: * @param set_add Indicates whether these policies should be added aoqi@0: * onto any otheroverrides that already exist (ADD_OVERRIDE) in aoqi@0: * the object reference, or they should be added to a clean aoqi@0: * override free object reference (SET_OVERRIDE). aoqi@0: * @return A new object reference with the new policies associated with it. aoqi@0: * aoqi@0: * @see portable aoqi@0: * package comments for unimplemented features aoqi@0: */ aoqi@0: public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self, aoqi@0: org.omg.CORBA.Policy[] policies, aoqi@0: org.omg.CORBA.SetOverrideType set_add) { aoqi@0: throw new org.omg.CORBA.NO_IMPLEMENT(); aoqi@0: } aoqi@0: aoqi@0: aoqi@0: /** aoqi@0: * Returns true if this object is implemented by a local servant. aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * @return true only if the servant incarnating this object is located in aoqi@0: * this Java VM. Return false if the servant is not local or the ORB aoqi@0: * does not support local stubs for this particular servant. The default aoqi@0: * behavior of is_local() is to return false. aoqi@0: */ aoqi@0: public boolean is_local(org.omg.CORBA.Object self) { aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Returns a Java reference to the servant which should be used for this aoqi@0: * request. servant_preinvoke() is invoked by a local stub. aoqi@0: * If a ServantObject object is returned, then its servant field aoqi@0: * has been set to an object of the expected type (Note: the object may aoqi@0: * or may not be the actual servant instance). The local stub may cast aoqi@0: * the servant field to the expected type, and then invoke the operation aoqi@0: * directly. The ServantRequest object is valid for only one invocation, aoqi@0: * and cannot be used for more than one invocation. aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * aoqi@0: * @param operation a string containing the operation name. aoqi@0: * The operation name corresponds to the operation name as it would be aoqi@0: * encoded in a GIOP request. aoqi@0: * aoqi@0: * @param expectedType a Class object representing the expected type of the servant. aoqi@0: * The expected type is the Class object associated with the operations aoqi@0: * class of the stub's interface (e.g. A stub for an interface Foo, aoqi@0: * would pass the Class object for the FooOperations interface). aoqi@0: * aoqi@0: * @return a ServantObject object. aoqi@0: * The method may return a null value if it does not wish to support aoqi@0: * this optimization (e.g. due to security, transactions, etc). aoqi@0: * The method must return null if the servant is not of the expected type. aoqi@0: */ aoqi@0: public ServantObject servant_preinvoke(org.omg.CORBA.Object self, aoqi@0: String operation, aoqi@0: Class expectedType) { aoqi@0: return null; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * servant_postinvoke() is invoked by the local stub after the operation aoqi@0: * has been invoked on the local servant. aoqi@0: * This method must be called if servant_preinvoke() returned a non-null aoqi@0: * value, even if an exception was thrown by the servant's method. aoqi@0: * For this reason, the call to servant_postinvoke() should be placed aoqi@0: * in a Java finally clause. aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * aoqi@0: * @param servant the instance of the ServantObject returned from aoqi@0: * the servant_preinvoke() method. aoqi@0: */ aoqi@0: public void servant_postinvoke(org.omg.CORBA.Object self, aoqi@0: ServantObject servant) { aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * request is called by a stub to obtain an OutputStream for aoqi@0: * marshaling arguments. The stub must supply the operation name, aoqi@0: * and indicate if a response is expected (i.e is this a oneway aoqi@0: * call). aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * @param operation a string containing the operation name. aoqi@0: * The operation name corresponds to the operation name as it would be aoqi@0: * encoded in a GIOP request. aoqi@0: * @param responseExpected false if the operation is a one way operation, aoqi@0: * and true otherwise. aoqi@0: * @return OutputStream the OutputStream into which request arguments aoqi@0: * can be marshaled. aoqi@0: * @see portable aoqi@0: * package comments for unimplemented features aoqi@0: */ aoqi@0: public OutputStream request(org.omg.CORBA.Object self, aoqi@0: String operation, aoqi@0: boolean responseExpected) { aoqi@0: throw new org.omg.CORBA.NO_IMPLEMENT(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * invoke is called by a stub to invoke an operation. The stub provides an aoqi@0: * OutputStream that was previously returned by a request() aoqi@0: * call. invoke returns an InputStream which contains the aoqi@0: * marshaled reply. If an exception occurs, invoke may throw an aoqi@0: * ApplicationException object which contains an InputStream from aoqi@0: * which the user exception state may be unmarshaled. aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * @param output the OutputStream which contains marshaled arguments aoqi@0: * @return input the InputStream from which reply parameters can be aoqi@0: * unmarshaled. aoqi@0: * @throws ApplicationException thrown when implementation throws aoqi@0: * (upon invocation) an exception defined as part of its remote method aoqi@0: * definition. aoqi@0: * @throws RemarshalException thrown when remarshalling fails. aoqi@0: * @see portable aoqi@0: * package comments for unimplemented features aoqi@0: */ aoqi@0: public InputStream invoke(org.omg.CORBA.Object self, aoqi@0: OutputStream output) aoqi@0: throws ApplicationException, RemarshalException { aoqi@0: throw new org.omg.CORBA.NO_IMPLEMENT(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * releaseReply may optionally be called by a stub to release a aoqi@0: * reply stream back to the ORB when the unmarshaling has aoqi@0: * completed. The stub passes the InputStream returned by aoqi@0: * invoke() or ApplicationException.getInputStream(). A null aoqi@0: * value may also be passed to releaseReply, in which case the aoqi@0: * method is a noop. aoqi@0: * aoqi@0: * @param self The object reference which delegated to this delegate. aoqi@0: * @param input the InputStream returned from invoke(). aoqi@0: * @see portable aoqi@0: * package comments for unimplemented features aoqi@0: */ aoqi@0: public void releaseReply(org.omg.CORBA.Object self, aoqi@0: InputStream input) { aoqi@0: throw new org.omg.CORBA.NO_IMPLEMENT(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Provides the implementation to override the toString() method aoqi@0: * of the delegating CORBA object. aoqi@0: * aoqi@0: * @param self the object reference that delegated to this delegate aoqi@0: * @return a String object that represents the object aoqi@0: * reference that delegated to this Delegate aoqi@0: * object aoqi@0: */ aoqi@0: aoqi@0: public String toString(org.omg.CORBA.Object self) { aoqi@0: return self.getClass().getName() + ":" + this.toString(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Provides the implementation to override the hashCode() method aoqi@0: * of the delegating CORBA object. aoqi@0: * aoqi@0: * @param self the object reference that delegated to this delegate aoqi@0: * @return an int that represents the hashcode for the aoqi@0: * object reference that delegated to this Delegate aoqi@0: * object aoqi@0: */ aoqi@0: public int hashCode(org.omg.CORBA.Object self) { aoqi@0: return System.identityHashCode(self); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Provides the implementation to override the equals(java.lang.Object obj) aoqi@0: * method of the delegating CORBA object. aoqi@0: * aoqi@0: * @param self the object reference that delegated to this delegate aoqi@0: * @param obj the Object with which to compare aoqi@0: * @return true if obj equals self; aoqi@0: * false otherwise aoqi@0: */ aoqi@0: public boolean equals(org.omg.CORBA.Object self, java.lang.Object obj) { aoqi@0: return (self == obj); aoqi@0: } aoqi@0: }