duke@1: /* ohair@158: * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@158: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@158: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@158: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@158: * or visit www.oracle.com if you need additional information or have any ohair@158: * questions. duke@1: */ duke@1: duke@1: package org.omg.CORBA; duke@1: import org.omg.CORBA.portable.*; duke@1: duke@1: duke@1: /** duke@1: *

Used as a base class for implementation of a local IDL interface in the duke@1: * Java language mapping. It is a class which implements all the operations duke@1: * in the org.omg.CORBA.Object interface. duke@1: *

Local interfaces are implemented by using CORBA::LocalObject duke@1: * to provide implementations of Object pseudo duke@1: * operations and any other ORB-specific support mechanisms that are duke@1: * appropriate for such objects. Object implementation techniques are duke@1: * inherently language-mapping specific. Therefore, the duke@1: * LocalObject type is not defined in IDL, but is specified duke@1: * in each language mapping. duke@1: *

Methods that do not apply to local objects throw duke@1: * an org.omg.CORBA.NO_IMPLEMENT exception with the message, duke@1: * "This is a locally contrained object." Attempting to use a duke@1: * LocalObject to create a DII request results in NO_IMPLEMENT duke@1: * system exception. Attempting to marshal or stringify a duke@1: * LocalObject results in a MARSHAL system exception. Narrowing duke@1: * and widening references to LocalObjects must work as for regular duke@1: * object references. duke@1: *

LocalObject is to be used as the base class of locally duke@1: * constrained objects, such as those in the PortableServer module. duke@1: * The specification here is based on the CORBA Components duke@1: * Volume I - orbos/99-07-01

duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: duke@1: public class LocalObject implements org.omg.CORBA.Object duke@1: { duke@1: private static String reason = "This is a locally constrained object."; duke@1: duke@1: /** duke@1: * Constructs a default LocalObject instance. duke@1: */ duke@1: public LocalObject() {} duke@1: duke@1: /** duke@1: *

Determines whether the two object references are equivalent, duke@1: * so far as the ORB can easily determine. Two object references are equivalent duke@1: * if they are identical. Two distinct object references which in fact refer to duke@1: * the same object are also equivalent. However, ORBs are not required duke@1: * to attempt determination of whether two distinct object references duke@1: * refer to the same object, since such determination could be impractically duke@1: * expensive. duke@1: *

Default implementation of the org.omg.CORBA.Object method.

duke@1: * duke@1: * @param that the object reference with which to check for equivalence duke@1: * @return true if this object reference is known to be duke@1: * equivalent to the given object reference. duke@1: * Note that false indicates only that the two duke@1: * object references are distinct, not necessarily that duke@1: * they reference distinct objects. duke@1: */ duke@1: public boolean _is_equivalent(org.omg.CORBA.Object that) { duke@1: return equals(that) ; duke@1: } duke@1: duke@1: /** duke@1: * Always returns false. duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * duke@1: * @return false duke@1: */ duke@1: public boolean _non_existent() { duke@1: return false; duke@1: } duke@1: duke@1: /** duke@1: * Returns a hash value that is consistent for the duke@1: * lifetime of the object, using the given number as the maximum. duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @param maximum an int identifying maximum value of duke@1: * the hashcode duke@1: * @return this instance's hashcode duke@1: */ duke@1: public int _hash(int maximum) { duke@1: return hashCode() ; duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." This method duke@1: * does not apply to local objects and is therefore not implemented. duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * duke@1: * @param repository_id a String duke@1: * @return NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @exception NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public boolean _is_a(String repository_id) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @return a duplicate of this LocalObject instance. duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public org.omg.CORBA.Object _duplicate() { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public void _release() { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * duke@1: * @param operation a String giving the name of an operation duke@1: * to be performed by the request that is returned duke@1: * @return a Request object with the given operation duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public Request _request(String operation) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * duke@1: * @param ctx a Context object containing duke@1: * a list of properties duke@1: * @param operation the String representing the name of the duke@1: * method to be invoked duke@1: * @param arg_list an NVList containing the actual arguments duke@1: * to the method being invoked duke@1: * @param result a NamedValue object to serve as a duke@1: * container for the method's return value duke@1: * @return a new Request object initialized with the given duke@1: * arguments duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public Request _create_request(Context ctx, duke@1: String operation, duke@1: NVList arg_list, duke@1: NamedValue result) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * duke@1: * @param ctx a Context object containing duke@1: * a list of properties duke@1: * @param operation the name of the method to be invoked duke@1: * @param arg_list an NVList containing the actual arguments duke@1: * to the method being invoked duke@1: * @param result a NamedValue object to serve as a duke@1: * container for the method's return value duke@1: * @param exceptions an ExceptionList object containing a duke@1: * list of possible exceptions the method can throw duke@1: * @param contexts a ContextList object containing a list of duke@1: * context strings that need to be resolved and sent duke@1: * with the duke@1: * Request instance duke@1: * @return the new Request object initialized with the given duke@1: * arguments duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public Request _create_request(Context ctx, duke@1: String operation, duke@1: NVList arg_list, duke@1: NamedValue result, duke@1: ExceptionList exceptions, duke@1: ContextList contexts) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." This method duke@1: * does not apply to local objects and is therefore not implemented. duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @return NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @exception NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public org.omg.CORBA.Object _get_interface() duke@1: { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public org.omg.CORBA.Object _get_interface_def() duke@1: { duke@1: // First try to call the delegate implementation class's duke@1: // "Object get_interface_def(..)" method (will work for JDK1.2 duke@1: // ORBs). duke@1: // Else call the delegate implementation class's duke@1: // "InterfaceDef get_interface(..)" method using reflection duke@1: // (will work for pre-JDK1.2 ORBs). duke@1: duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @return the ORB instance that created the Delegate contained in this duke@1: * ObjectImpl duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public org.omg.CORBA.ORB _orb() { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." This method duke@1: * does not apply to local objects and is therefore not implemented. duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @param policy_type an int duke@1: * @return NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @exception NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public org.omg.CORBA.Policy _get_policy(int policy_type) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." This method duke@1: * does not apply to local objects and is therefore not implemented. duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public org.omg.CORBA.DomainManager[] _get_domain_managers() { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." This method duke@1: * does not apply to local objects and is therefore not implemented. duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method. duke@1: * duke@1: * @param policies an array duke@1: * @param set_add a flag duke@1: * @return NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @exception NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public org.omg.CORBA.Object duke@1: _set_policy_override(org.omg.CORBA.Policy[] policies, duke@1: org.omg.CORBA.SetOverrideType set_add) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * Returns true for this LocalObject instance.

duke@1: * @return true always duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public boolean _is_local() { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @param operation a String indicating which operation duke@1: * to preinvoke duke@1: * @param expectedType the class of the type of operation mentioned above duke@1: * @return NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @exception NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local object duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public ServantObject _servant_preinvoke(String operation, duke@1: Class expectedType) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @param servant the servant object on which to post-invoke duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public void _servant_postinvoke(ServantObject servant) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /* duke@1: * The following methods were added by orbos/98-04-03: Java to IDL duke@1: * Mapping. These are used by RMI over IIOP. duke@1: */ duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method. duke@1: *

Called by a stub to obtain an OutputStream for duke@1: * marshaling arguments. The stub must supply the operation name, duke@1: * and indicate if a response is expected (i.e is this a oneway duke@1: * call).

duke@1: * @param operation the name of the operation being requested duke@1: * @param responseExpected true if a response is expected, duke@1: * false if it is a one-way call duke@1: * @return NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @exception NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public OutputStream _request(String operation, duke@1: boolean responseExpected) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method. duke@1: *

Called to invoke an operation. The stub provides an duke@1: * OutputStream that was previously returned by a duke@1: * _request() duke@1: * call. _invoke returns an InputStream which duke@1: * contains the duke@1: * marshaled reply. If an exception occurs, _invoke may throw an duke@1: * ApplicationException object which contains an duke@1: * InputStream from duke@1: * which the user exception state may be unmarshaled.

duke@1: * @param output the OutputStream to invoke duke@1: * @return NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @throws ApplicationException If an exception occurs, duke@1: * _invoke may throw an duke@1: * ApplicationException object which contains duke@1: * an InputStream from duke@1: * which the user exception state may be unmarshaled. duke@1: * @throws RemarshalException If an exception occurs, duke@1: * _invoke may throw an duke@1: * ApplicationException object which contains duke@1: * an InputStream from duke@1: * which the user exception state may be unmarshaled. duke@1: * @exception NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public InputStream _invoke(OutputStream output) duke@1: throws ApplicationException, RemarshalException duke@1: { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method. duke@1: *

May optionally be called by a stub to release a duke@1: * reply stream back to the ORB when the unmarshaling has duke@1: * completed. The stub passes the InputStream returned by duke@1: * _invoke() or duke@1: * ApplicationException.getInputStream(). duke@1: * A null duke@1: * value may also be passed to _releaseReply, in which case the duke@1: * method is a no-op.

duke@1: * @param input the reply stream back to the ORB or null duke@1: * @exception NO_IMPLEMENT duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: public void _releaseReply(InputStream input) { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: duke@1: /** duke@1: * Throws an org.omg.CORBA.NO_IMPLEMENT exception with duke@1: * the message "This is a locally constrained object." This method duke@1: * does not apply to local objects and is therefore not implemented. duke@1: * This method is the default implementation of the duke@1: * org.omg.CORBA.Object method.

duke@1: * @return NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @exception NO_IMPLEMENT because this is a locally constrained object duke@1: * and this method does not apply to local objects duke@1: * @see CORBA package duke@1: * comments for unimplemented features duke@1: */ duke@1: duke@1: public boolean validate_connection() { duke@1: throw new org.omg.CORBA.NO_IMPLEMENT(reason); duke@1: } duke@1: }