requestinfoimpl.java

来自「java jdk 1.4的源码」· Java 代码 · 共 982 行 · 第 1/3 页

JAVA
982
字号
/* * @(#)RequestInfoImpl.java	1.42 03/01/23 * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package com.sun.corba.se.internal.Interceptors;             import org.omg.Dynamic.Parameter;import com.sun.corba.se.interceptor.RequestInfoExt;import com.sun.corba.se.internal.corba.ClientDelegate;import com.sun.corba.se.internal.core.ClientResponse;import com.sun.corba.se.internal.core.ClientSubcontract;import com.sun.corba.se.internal.core.DuplicateServiceContext;import com.sun.corba.se.internal.core.GIOPVersion;import com.sun.corba.se.internal.core.IOR;import com.sun.corba.se.internal.core.NoSuchServiceContext;//import com.sun.corba.se.internal.core.ServiceContext;import com.sun.corba.se.internal.core.ServiceContexts;import com.sun.corba.se.internal.core.UnknownServiceContext;import com.sun.corba.se.internal.iiop.CDRInputStream_1_0;import com.sun.corba.se.internal.corba.EncapsOutputStream;import com.sun.corba.se.internal.iiop.Connection;import com.sun.corba.se.internal.corba.CORBAObjectImpl;import com.sun.corba.se.internal.ior.IIOPProfile;import com.sun.corba.se.internal.ior.IIOPProfileTemplate;import com.sun.corba.se.internal.ior.ObjectKeyTemplate ; import com.sun.corba.se.internal.orbutil.ORBUtility;import com.sun.corba.se.internal.orbutil.ORBClassLoader;import com.sun.corba.se.internal.util.RepositoryId;import org.omg.PortableInterceptor.ForwardRequest;import org.omg.PortableInterceptor.InvalidSlot;import org.omg.PortableInterceptor.RequestInfo;import org.omg.PortableInterceptor.LOCATION_FORWARD;import org.omg.IOP.TaggedProfile;import org.omg.IOP.TaggedComponent;//import org.omg.IOP.ServiceContext;import org.omg.IOP.ServiceContextHelper;import org.omg.Messaging.SYNC_WITH_TRANSPORT;import org.omg.CORBA.ParameterMode;import org.omg.CORBA.Any;import org.omg.CORBA.BAD_INV_ORDER;import org.omg.CORBA.BAD_PARAM;import org.omg.CORBA.CompletionStatus;import org.omg.CORBA.Context;import org.omg.CORBA.ContextList;import org.omg.CORBA.CTX_RESTRICT_SCOPE;import org.omg.CORBA.ExceptionList;import org.omg.CORBA.INTERNAL;import org.omg.CORBA.LocalObject;import org.omg.CORBA.NamedValue;import org.omg.CORBA.NO_IMPLEMENT;import org.omg.CORBA.NO_RESOURCES;import org.omg.CORBA.NVList;import org.omg.CORBA.Object;import org.omg.CORBA.Policy;import org.omg.CORBA.SystemException;import org.omg.CORBA.TypeCode;import org.omg.CORBA.UNKNOWN;import org.omg.CORBA.UserException;import org.omg.CORBA.portable.ApplicationException;import org.omg.CORBA.portable.Delegate;import org.omg.CORBA.portable.InputStream;import org.omg.CORBA.portable.ObjectImpl;import java.io.*;import java.lang.reflect.*;import java.util.*;/** * Implementation of the RequestInfo interface as specified in * orbos/99-12-02 section 5.4.1. */public abstract class RequestInfoImpl     extends LocalObject     implements RequestInfo, RequestInfoExt{    //////////////////////////////////////////////////////////////////////    //    // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();    //    //////////////////////////////////////////////////////////////////////    // The ORB from which to get PICurrent and other info    protected PIORB piOrb;        // The number of interceptors actually invoked for this client request.    // See setFlowStackIndex for a detailed description.    protected int flowStackIndex = 0;    // The type of starting point call to make to the interceptors    // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of     // appropriate constants.    protected int startingPointCall;        // The type of intermediate point call to make to the interceptors    // See ServerRequestInfoImpl for a list of appropriate constants.    // This does not currently apply to client request interceptors but is    // here in case intermediate points are introduced in the future.    protected int intermediatePointCall;        // The type of ending point call to make to the interceptors    // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of     // appropriate constants.    protected int endingPointCall;        // The reply status to return in reply_status.  This is initialized    // to UNINITIALIZED so that we can tell if this has been set or not.    protected short replyStatus = UNINITIALIZED;        // Constant for an uninitizlied reply status.    protected static final short UNINITIALIZED = -1;        // Which points we are currently executing (so we can implement the    // validity table).      protected int currentExecutionPoint;    protected static final int EXECUTION_POINT_STARTING = 0;    protected static final int EXECUTION_POINT_INTERMEDIATE = 1;    protected static final int EXECUTION_POINT_ENDING = 2;        // Set to true if all interceptors have had all their points    // executed.    protected boolean alreadyExecuted;        // Sources of request information    protected Connection     connection;    protected ServiceContexts serviceContexts;        // The ForwardRequest object if this request is being forwarded.    // Either the forwardRequest or the forwardRequestIOR field is set.    // When set, the other field is set to null initially.  If the other    // field is queried, it is lazily calculated and cached.  These    // two attributes are always kept in sync.    protected ForwardRequest forwardRequest;    protected IOR forwardRequestIOR;    // PICurrent's  SlotTable    protected SlotTable slotTable;    // The exception to be returned by received_exception and     // received_exception_id    protected Exception exception;        //////////////////////////////////////////////////////////////////////    //    // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();    //    //////////////////////////////////////////////////////////////////////        /**     * Reset the info object so that it can be reused for a retry,     * for example.     */    void reset() {	// Please keep these in the same order as declared above.        flowStackIndex = 0;        startingPointCall = 0;        intermediatePointCall = 0;        endingPointCall = 0;        replyStatus = UNINITIALIZED;        currentExecutionPoint = EXECUTION_POINT_STARTING;        alreadyExecuted = false;	connection = null;        serviceContexts = null;        forwardRequest = null;	forwardRequestIOR = null;        exception = null;        // We don't need to reset the Slots because they are        // already in the clean state after recieve_<point> interceptor        // are called.     }    /*     **********************************************************************     * Access protection     **********************************************************************/    // Method IDs for all methods in RequestInfo.  This allows for a     // convenient O(1) lookup for checkAccess().    protected static final int MID_REQUEST_ID                   =  0;    protected static final int MID_OPERATION                    =  1;    protected static final int MID_ARGUMENTS                    =  2;    protected static final int MID_EXCEPTIONS                   =  3;    protected static final int MID_CONTEXTS                     =  4;    protected static final int MID_OPERATION_CONTEXT            =  5;    protected static final int MID_RESULT                       =  6;    protected static final int MID_RESPONSE_EXPECTED            =  7;    protected static final int MID_SYNC_SCOPE                   =  8;    protected static final int MID_REPLY_STATUS                 =  9;    protected static final int MID_FORWARD_REFERENCE            = 10;    protected static final int MID_GET_SLOT                     = 11;    protected static final int MID_GET_REQUEST_SERVICE_CONTEXT  = 12;    protected static final int MID_GET_REPLY_SERVICE_CONTEXT    = 13;    // The last value from RequestInfo (be sure to update this):    protected static final int MID_RI_LAST                      = 13;        /*     **********************************************************************     * Public interfaces     **********************************************************************/             /**     * Creates a new RequestInfoImpl object.     */    public RequestInfoImpl( PIORB piOrb ) {         super();                this.piOrb = piOrb;        // Capture the current TSC and make it the RSC of this request.        PICurrent current = piOrb.getPICurrent();        slotTable = current.getSlotTable( );    }    /**     * Implementation for request_id() differs for client and server      * implementations.     *     * Uniquely identifies an active request/reply sequence.  Once a     * request/reply sequence is concluded this ID may be reused.  (this     * is NOT necessarily the same as the GIOP request_id).     */    abstract public int request_id ();    /**     * Implementation for operation() differs for client and server     * implementations.     *     * The name of the operation being invoked.     */    abstract public String operation ();    /**     * This method returns the list of arguments for the operation that was     * invoked. It raises NO_RESOURCES exception if the operation is not invoked     * by using DII mechanism.     */    abstract public Parameter[] arguments ();        /**     * This method returns the list of exceptios  that was raised when the     * operation was invoked. It raises NO_RESOURCES exception if the operation     * is not invoked by using DII mechanism.     */    abstract public TypeCode[] exceptions ();        /**     * This method returns the list of contexts for the DII operation.      * It raises NO_RESOURCES exception if the operation is not invoked by      * using DII mechanism.     */    abstract public String[] contexts ();        /**     * This method returns the list of operation_context for the DII operation.      * It raises NO_RESOURCES exception if the operation is not invoked by      * using DII mechanism.     */    abstract public String[] operation_context ();    /**     * This method returns the result from the invoked DII operation.     * It raises NO_RESOURCES exception if the operation is not invoked by      * using DII mechanism.     */    abstract public Any result ();        /**     * Implementation for response_expected() differs for client and server     * implementations.     *     * Indicates whether a response is expected.  On the client, a reply is     * not returned when response_expected is false, so receive_reply cannot     * be called.  receive_other is called unless an exception occurs, in     * which case receive_exception is called.  On the client, within     * send_poll, this attribute is true.     */    abstract public boolean response_expected ();        /**     * Defined in the Messaging specification.  Pertinent only when      * response_expected is false.  If response_expected is true, the value      * of sync_scope is undefined.  It defines how far the request shall      * progress before control is returned to the client.  This attribute may      * have one of the follwing values:     * <ul>     *   <li>Messaging::SYNC_NONE</li>     *   <li>Messaging::SYNC_WITH_TRANSPORT</li>     *   <li>Messaging::SYNC_WITH_SERVER</li>     *   <li>Messaging::SYNC_WITH_TARGET</li>     * </ul>     */    public short sync_scope (){        checkAccess( MID_SYNC_SCOPE );        return SYNC_WITH_TRANSPORT.value;    }        /**     * Describes the state of the result of the operation invocation.  Its      * value can be one of the following:     * <ul>     *   <li>PortableInterceptor::SUCCESSFUL</li>     *   <li>PortableInterceptor::SYSTEM_EXCEPTION</li>     *   <li>PortableInterceptor::USER_EXCEPTION</li>     *   <li>PortableInterceptor::LOCATION_FORWARD</li>     *   <li>PortableInterceptor::TRANSPORT_RETRY</li>     * </ul>     */    public short reply_status (){        checkAccess( MID_REPLY_STATUS );        return replyStatus;    }        /**     * Implementation for forward_reference() differs for client and server     * implementations.     *     * If the reply_status attribute is LOCATION_FORWARD     * then this attribute will contain the object     * to which the request will be forwarded.  It is indeterminate whether a

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?