📄 objectimpl.java
字号:
/* * @(#)ObjectImpl.java 1.39 06/01/27 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package org.omg.CORBA.portable;import org.omg.CORBA.Request;import org.omg.CORBA.NamedValue;import org.omg.CORBA.NVList;import org.omg.CORBA.ExceptionList;import org.omg.CORBA.ContextList;import org.omg.CORBA.Context;import org.omg.CORBA.TypeCode;import org.omg.CORBA.BAD_OPERATION;import org.omg.CORBA.SystemException;/** * The common base class for all stub classes; provides default implementations * of the <code>org.omg.CORBA.Object</code> methods. All method implementations are * forwarded to a <code>Delegate</code> object stored in the <code>ObjectImpl</code> * instance. <code>ObjectImpl</code> allows for portable stubs because the * <code>Delegate</code> can be implemented by a different vendor-specific ORB. */abstract public class ObjectImpl implements org.omg.CORBA.Object{ /** * The field that stores the <code>Delegate</code> instance for * this <code>ObjectImpl</code> object. This <code>Delegate</code> * instance can be implemented by a vendor-specific ORB. Stub classes, * which are derived from this <code>ObjectImpl</code> class, can be * portable because they delegate all of the methods called on them to this * <code>Delegate</code> object. */ private transient Delegate __delegate; /** * Retrieves the reference to the vendor-specific <code>Delegate</code> * object to which this <code>ObjectImpl</code> object delegates all * methods invoked on it. * * @return the Delegate contained in this ObjectImpl instance * @throws BAD_OPERATION if the delegate has not been set * @see #_set_delegate */ public Delegate _get_delegate() { if (__delegate == null) throw new BAD_OPERATION("The delegate has not been set!"); return __delegate; } /** * Sets the Delegate for this <code>ObjectImpl</code> instance to the given * <code>Delegate</code> object. All method invocations on this * <code>ObjectImpl</code> object will be forwarded to this delegate. * * @param delegate the <code>Delegate</code> instance to which * all method calls on this <code>ObjectImpl</code> object * will be delegated; may be implemented by a third-party ORB * @see #_get_delegate */ public void _set_delegate(Delegate delegate) { __delegate = delegate; } /** * Retrieves a string array containing the repository identifiers * supported by this <code>ObjectImpl</code> object. For example, * for a stub, this method returns information about all the * interfaces supported by the stub. * * @return the array of all repository identifiers supported by this * <code>ObjectImpl</code> instance */ public abstract String[] _ids(); /** * Returns a duplicate of this <code>ObjectImpl</code> object. * * @return an <code>orb.omg.CORBA.Object</code> object that is * a duplicate of this object */ public org.omg.CORBA.Object _duplicate() { return _get_delegate().duplicate(this); } /** * Releases the resources associated with this <code>ObjectImpl</code> object. */ public void _release() { _get_delegate().release(this); } /** * Checks whether the object identified by the given repository * identifier is an <code>ObjectImpl</code> object. * * @param repository_id a <code>String</code> object with the repository * identifier to check * @return <code>true</code> if the object identified by the given * repository id is an instance of <code>ObjectImpl</code>; * <code>false</code> otherwise */ public boolean _is_a(String repository_id) { return _get_delegate().is_a(this, repository_id); } /** * Checks whether the the given <code>ObjectImpl</code> object is * equivalent to this <code>ObjectImpl</code> object. * * @param that an instance of <code>ObjectImpl</code> to compare with * this <code>ObjectImpl</code> object * @return <code>true</code> if the given object is equivalent * to this <code>ObjectImpl</code> object; * <code>false</code> otherwise */ public boolean _is_equivalent(org.omg.CORBA.Object that) { return _get_delegate().is_equivalent(this, that); } /** * Checks whether the server object for this <code>ObjectImpl</code> * object has been destroyed. * * @return <code>true</code> if the ORB knows authoritatively that the * server object does not exist; <code>false</code> otherwise */ public boolean _non_existent() { return _get_delegate().non_existent(this); } /** * Retrieves the hash code that serves as an ORB-internal identifier for * this <code>ObjectImpl</code> object. * * @param maximum an <code>int</code> indicating the upper bound on the hash * value returned by the ORB * @return an <code>int</code> representing the hash code for this * <code>ObjectImpl</code> object */ public int _hash(int maximum) { return _get_delegate().hash(this, maximum); } /** * Creates a <code>Request</code> object containing the given method * that can be used with the Dynamic Invocation Interface. * * @param operation the method to be invoked by the new <code>Request</code> * object * @return a new <code>Request</code> object initialized with the * given method */ public Request _request(String operation) { return _get_delegate().request(this, operation); } /** * Creates a <code>Request</code> object that contains the given context, * method, argument list, and container for the result. * * @param ctx the Context for the request * @param operation the method that the new <code>Request</code> * object will invoke * @param arg_list the arguments for the method; an <code>NVList</code> * in which each argument is a <code>NamedValue</code> object * @param result a <code>NamedValue</code> object to be used for * returning the result of executing the request's method * @return a new <code>Request</code> object initialized with the * given context, method, argument list, and container for the * return value */ public Request _create_request(Context ctx, String operation, NVList arg_list, NamedValue result) { return _get_delegate().create_request(this, ctx, operation, arg_list, result); } /** * Creates a <code>Request</code> object that contains the given context, * method, argument list, container for the result, exceptions, and * list of property names to be used in resolving the context strings. * This <code>Request</code> object is for use in the Dynamic * Invocation Interface. * * @param ctx the <code>Context</code> object that contains the * context strings that must be resolved before they are * sent along with the request * @param operation the method that the new <code>Request</code> * object will invoke * @param arg_list the arguments for the method; an <code>NVList</code> * in which each argument is a <code>NamedValue</code> object * @param result a <code>NamedValue</code> object to be used for * returning the result of executing the request's method * @param exceptions a list of the exceptions that the given method * throws * @param contexts a list of the properties that are needed to * resolve the contexts in <i>ctx</i>; the strings in * <i>contexts</i> are used as arguments to the method * <code>Context.get_values</code>, * which returns the value associated with the given property * @return a new <code>Request</code> object initialized with the * given context strings to resolve, method, argument list, * container for the result, exceptions, and list of property * names to be used in resolving the context strings */ public Request _create_request(Context ctx, String operation, NVList arg_list, NamedValue result, ExceptionList exceptions, ContextList contexts) { return _get_delegate().create_request(this, ctx, operation, arg_list, result, exceptions, contexts); } /** * Retrieves the interface definition for this <code>ObjectImpl</code> * object. * * @return the <code>org.omg.CORBA.Object</code> instance that is the * interface definition for this <code>ObjectImpl</code> object */ public org.omg.CORBA.Object _get_interface_def() { // First try to call the delegate implementation class's // "Object get_interface_def(..)" method (will work for JDK1.2 ORBs). // Else call the delegate implementation class's // "InterfaceDef get_interface(..)" method using reflection // (will work for pre-JDK1.2 ORBs). org.omg.CORBA.portable.Delegate delegate = _get_delegate(); try { // If the ORB's delegate class does not implement // "Object get_interface_def(..)", this will call // get_interface_def(..) on portable.Delegate. return delegate.get_interface_def(this); } catch( org.omg.CORBA.NO_IMPLEMENT ex ) { // Call "InterfaceDef get_interface(..)" method using reflection. try {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -