📄 requestinfoimpl.java
字号:
/* * @(#)RequestInfoImpl.java 1.47 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package com.sun.corba.se.impl.interceptors;import java.io.IOException ;import java.lang.reflect.Method ;import java.lang.reflect.InvocationTargetException ;import java.util.HashMap ;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.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.Dynamic.Parameter;import com.sun.corba.se.spi.legacy.connection.Connection;import com.sun.corba.se.spi.legacy.interceptor.RequestInfoExt;import com.sun.corba.se.spi.ior.IOR;import com.sun.corba.se.spi.ior.iiop.GIOPVersion;import com.sun.corba.se.spi.orb.ORB;import com.sun.corba.se.spi.logging.CORBALogDomains;import com.sun.corba.se.spi.servicecontext.ServiceContexts;import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;import com.sun.corba.se.impl.encoding.EncapsOutputStream;import com.sun.corba.se.impl.orbutil.ORBUtility;import com.sun.corba.se.impl.orbutil.ORBClassLoader;import com.sun.corba.se.impl.util.RepositoryId;import com.sun.corba.se.impl.logging.InterceptorsSystemException;import com.sun.corba.se.impl.logging.OMGSystemException;/** * 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 ORB myORB; protected InterceptorsSystemException wrapper ; protected OMGSystemException stdWrapper ; // 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( ORB myORB ) { super(); this.myORB = myORB; wrapper = InterceptorsSystemException.get( myORB, CORBALogDomains.RPC_PROTOCOL ) ; stdWrapper = OMGSystemException.get( myORB, CORBALogDomains.RPC_PROTOCOL ) ; // Capture the current TSC and make it the RSC of this request. PICurrent current = (PICurrent)(myORB.getPIHandler().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:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -