Class RequestInfoImpl

java.lang.Object
org.omg.CORBA.LocalObject
com.sun.corba.ee.impl.interceptors.RequestInfoImpl
All Implemented Interfaces:
RequestInfoExt, Serializable, Object, IDLEntity, RequestInfo, RequestInfoOperations
Direct Known Subclasses:
ClientRequestInfoImpl, ServerRequestInfoImpl

public abstract class RequestInfoImpl extends LocalObject implements RequestInfo, RequestInfoExt
Implementation of the RequestInfo interface as specified in orbos/99-12-02 section 5.4.1.
See Also:
  • Field Details

    • wrapper

      protected static final InterceptorsSystemException wrapper
    • stdWrapper

      static final OMGSystemException stdWrapper
    • myORB

      protected ORB myORB
      The ORB from which to get PICurrent and other info
    • flowStackIndex

      private int flowStackIndex
      The number of interceptors actually invoked for this client request. See setFlowStackIndex for a detailed description.
    • startingPointCall

      int startingPointCall
      The type of starting point call to make to the interceptors See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of appropriate constants.
    • intermediatePointCall

      int intermediatePointCall
      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.
    • endingPointCall

      int endingPointCall
      The type of ending point call to make to the interceptors See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of appropriate constants.
    • replyStatus

      protected short replyStatus
      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.
    • UNINITIALIZED

      static final short UNINITIALIZED
      Constant for an uninitialized reply status.
      See Also:
    • currentExecutionPoint

      int currentExecutionPoint
      Which points we are currently executing (so we can implement the validity table).
    • EXECUTION_POINT_STARTING

      static final int EXECUTION_POINT_STARTING
      See Also:
    • EXECUTION_POINT_INTERMEDIATE

      static final int EXECUTION_POINT_INTERMEDIATE
      See Also:
    • EXECUTION_POINT_ENDING

      static final int EXECUTION_POINT_ENDING
      See Also:
    • alreadyExecuted

      private boolean alreadyExecuted
      Set to true if all interceptors have had all their points executed.
    • connection

      protected Connection connection
      Sources of request information
    • forwardRequest

      private ForwardRequest forwardRequest
    • forwardRequestIOR

      private IOR forwardRequestIOR
    • slotTable

      SlotTable slotTable
      PICurrent's SlotTable
    • exception

      protected Exception exception
      The exception to be returned by received_exception and received_exception_id
    • interceptorsEnabledForThisRequest

      boolean interceptorsEnabledForThisRequest
    • MID_REQUEST_ID

      protected static final int MID_REQUEST_ID
      See Also:
    • MID_OPERATION

      protected static final int MID_OPERATION
      See Also:
    • MID_ARGUMENTS

      protected static final int MID_ARGUMENTS
      See Also:
    • MID_EXCEPTIONS

      protected static final int MID_EXCEPTIONS
      See Also:
    • MID_CONTEXTS

      protected static final int MID_CONTEXTS
      See Also:
    • MID_OPERATION_CONTEXT

      protected static final int MID_OPERATION_CONTEXT
      See Also:
    • MID_RESULT

      protected static final int MID_RESULT
      See Also:
    • MID_RESPONSE_EXPECTED

      protected static final int MID_RESPONSE_EXPECTED
      See Also:
    • MID_SYNC_SCOPE

      protected static final int MID_SYNC_SCOPE
      See Also:
    • MID_REPLY_STATUS

      protected static final int MID_REPLY_STATUS
      See Also:
    • MID_FORWARD_REFERENCE

      protected static final int MID_FORWARD_REFERENCE
      See Also:
    • MID_GET_SLOT

      protected static final int MID_GET_SLOT
      See Also:
    • MID_GET_REQUEST_SERVICE_CONTEXT

      protected static final int MID_GET_REQUEST_SERVICE_CONTEXT
      See Also:
    • MID_GET_REPLY_SERVICE_CONTEXT

      protected static final int MID_GET_REPLY_SERVICE_CONTEXT
      See Also:
    • MID_RI_LAST

      protected static final int MID_RI_LAST
      See Also:
  • Constructor Details

    • RequestInfoImpl

      public RequestInfoImpl(ORB myORB)
      Creates a new RequestInfoImpl object.
      Parameters:
      myORB - ORB to use
  • Method Details

    • _orb

      public ORB _orb()
      Description copied from class: LocalObject
      Throws an org.omg.CORBA.NO_IMPLEMENT exception with the message "This is a locally constrained object." This method is the default implementation of the org.omg.CORBA.Object method.

      Overrides:
      _orb in class LocalObject
      Returns:
      the ORB instance that created the Delegate contained in this ObjectImpl
      See Also:
    • reset

      void reset()
      Reset the info object so that it can be reused for a retry, for example.
    • request_id

      public abstract int request_id()
      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).
      Specified by:
      request_id in interface RequestInfoOperations
      Returns:
      unique request identifier
    • operation

      public abstract String operation()
      Implementation for operation() differs for client and server implementations.
      Specified by:
      operation in interface RequestInfoOperations
      Returns:
      The name of the operation being invoked.
    • arguments

      public abstract Parameter[] arguments()
      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.
      Specified by:
      arguments in interface RequestInfoOperations
      Returns:
      array of arguments
      See Also:
    • exceptions

      public abstract TypeCode[] exceptions()
      This method returns the list of exceptions that was raised when the operation was invoked. It raises NO_RESOURCES exception if the operation is not invoked by using DII mechanism.
      Specified by:
      exceptions in interface RequestInfoOperations
      Returns:
      array of raised exceptions
      See Also:
    • contexts

      public abstract String[] contexts()
      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.
      Specified by:
      contexts in interface RequestInfoOperations
      Returns:
      array of contexts
      See Also:
    • operation_context

      public abstract String[] operation_context()
      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.
      Specified by:
      operation_context in interface RequestInfoOperations
      Returns:
      array of operation contexts
      See Also:
    • result

      public abstract Any result()
      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.
      Specified by:
      result in interface RequestInfoOperations
      Returns:
      the result from the invoked operation
      See Also:
    • response_expected

      public abstract boolean response_expected()
      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.
      Specified by:
      response_expected in interface RequestInfoOperations
      Returns:
      if a response is expected
    • sync_scope

      public short sync_scope()
      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:
      Specified by:
      sync_scope in interface RequestInfoOperations
      Returns:
      how far the request shall progress
      See Also:
    • reply_status

      public short reply_status()
      Describes the state of the result of the operation invocation. Its value can be one of the following:
      Specified by:
      reply_status in interface RequestInfoOperations
      Returns:
      result status
      See Also:
    • forward_reference

      public abstract Object forward_reference()
      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 forwarded request will actually occur.
      Specified by:
      forward_reference in interface RequestInfoOperations
      Returns:
      object to which attribute is forwarded.
    • get_slot

      public Any get_slot(int id) throws InvalidSlot
      Returns the data from the given slot of the PortableInterceptor::Current that is in the scope of the request.

      If the given slot has not been set, then an any containing a type code with a TCKind value of tk_null is returned.

      If the ID does not define an allocated slot, InvalidSlot is raised.

      Specified by:
      get_slot in interface RequestInfoOperations
      Parameters:
      id - ID of the slot to get data from
      Returns:
      Data held in the given slot
      Throws:
      InvalidSlot - If the id is not for an allocated slot
      See Also:
    • get_request_service_context

      public abstract ServiceContext get_request_service_context(int id)
      Implementation for get_request_service_context() differs for client and server implementations. This operation returns a copy of the service context with the given ID that is associated with the request. If the request's service context does not contain an entry for that ID, BAD_PARAM with a minor code of TBD_BP is raised.
      Specified by:
      get_request_service_context in interface RequestInfoOperations
      Parameters:
      id - ID of the service context
      Returns:
      A copy of the service context
    • get_reply_service_context

      public abstract ServiceContext get_reply_service_context(int id)
      Implementation for get_reply_service_context() differs for client and server implementations. This operation returns a copy of the service context with the given ID that is associated with the reply. IF the request's service context does not contain an entry for that ID, BAD_PARAM with a minor code of TBD_BP is raised.
      Specified by:
      get_reply_service_context in interface RequestInfoOperations
      Parameters:
      id - ID of the service context
      Returns:
      A copy of the Service Context
    • connection

      public Connection connection()
      Specified by:
      connection in interface RequestInfoExt
      Returns:
      The connection on which the request is made. Note: we store the connection as an internal type but expose it here as an external type.
    • insertApplicationException

      private void insertApplicationException(ApplicationException appException, Any result) throws UNKNOWN
      Inserts the UserException inside the given ApplicationException into the given Any. Throws an UNKNOWN with minor code OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be found to insert it with.
      Parameters:
      appException - Exception to insert
      result - Any to insert Exception into
      Throws:
      UNKNOWN
    • insertUserException

      private void insertUserException(UserException userException, Any result) throws UNKNOWN
      Inserts the UserException into the given Any. Throws an UNKNOWN with minor code OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be found to insert it with.
      Parameters:
      userException - Exception to insert
      result - Any to insert the exception into
      Throws:
      UNKNOWN
    • nvListToParameterArray

      protected Parameter[] nvListToParameterArray(NVList parNVList)
      Internal utility method to convert an NVList into a PI Parameter[]
      Parameters:
      parNVList - list to concert
      Returns:
      parameter array
    • exceptionToAny

      protected Any exceptionToAny(Exception exception)
      Utility to wrap the given Exception in an Any object and return it. If the exception is a UserException which cannot be inserted into an any, then this returns an Any containing the system exception UNKNOWN.
      Parameters:
      exception - Exception to wrap
      Returns:
      Any wrapping the exception
    • getServiceContext

      protected ServiceContext getServiceContext(Map<Integer,ServiceContext> cachedServiceContexts, ServiceContexts serviceContexts, int id)
      Utility method to look up a service context with the given id and convert it to an IOP.ServiceContext. Uses the given HashMap as a cache. If not found in cache, the result is inserted in the cache.
      Parameters:
      cachedServiceContexts - cache to search first in
      serviceContexts - contexts to look up in
      id - ID to use for look up
      Returns:
      found ServiceContext
    • addServiceContext

      protected void addServiceContext(Map<Integer,ServiceContext> cachedServiceContexts, ServiceContexts serviceContexts, ServiceContext service_context, boolean replace)
      Utility method to add an IOP.ServiceContext to a core.ServiceContexts object. If replace is true, any service context with the given id is replaced.

      Raises BAD_INV_ORDER if replace is false and a service context with the given id already exists.

      Uses the given HashMap as a cache. If a service context is placed in the container, it goes in the HashMap as well.

      Parameters:
      cachedServiceContexts - map to also add the context to
      serviceContexts - ServiceContexts to add it to
      service_context - context to add
      replace - if a previous instance should be replaced
    • setFlowStackIndex

      protected void setFlowStackIndex(int num)
      Sets the number of interceptors whose starting interception points were successfully invoked on this client call. As specified in orbos/99-12-02, section 5.2.1., not all interceptors will be invoked if a ForwardRequest exception or a system exception is raised. This keeps track of how many were successfully executed so we know not to execute the corresponding ending interception points for the interceptors whose starting interception points were not completed. This simulates the "Flow Stack Visual Model" presented in section 5.1.3.
      Parameters:
      num - number of interceptors successfully invoked
    • getFlowStackIndex

      protected int getFlowStackIndex()
      Returns the number of interceptors whose starting interception points were actually invoked on this client request. See setFlowStackIndex for more details.
      Returns:
      number of interceptors
      See Also:
    • setEndingPointCall

      protected void setEndingPointCall(int call)
      Sets which ending interception point should be called for each interceptor in the virtual flow stack.
      Parameters:
      call - ending interception point
    • getEndingPointCall

      protected int getEndingPointCall()
      Retrieves the current ending point call type (see setEndingPointCall for more details).
      Returns:
      ending point call type
      See Also:
    • setIntermediatePointCall

      protected void setIntermediatePointCall(int call)
      Sets which intermediate interception point should be called for each interceptor in the virtual flow stack.
      Parameters:
      call - intermediate interception point
    • getIntermediatePointCall

      protected int getIntermediatePointCall()
      Retrieves the current intermediate point call type (see setEndingPointCall for more details).
      Returns:
      current intermediate point
      See Also:
    • setStartingPointCall

      protected void setStartingPointCall(int call)
      Sets which starting interception point should be called for each interceptor in the virtual flow stack.
      Parameters:
      call - which point should called
    • getStartingPointCall

      protected int getStartingPointCall()
      Retrieves the current starting point call type (see setStartingPointCall for more details).
      Returns:
      the current stating point
      See Also:
    • getAlreadyExecuted

      protected boolean getAlreadyExecuted()
      Returns true if all interceptors' starting and ending points have already executed to completion, or false if not yet.
      Returns:
      if all interceptors have been executed to completion
    • setAlreadyExecuted

      protected void setAlreadyExecuted(boolean alreadyExecuted)
      Sets whether all interceptors' starting and ending points have already been executed to completion.
      Parameters:
      alreadyExecuted - if all interceptors have been executed
    • setReplyStatus

      protected void setReplyStatus(short replyStatus)
      Sets the value to be returned by reply_status
      Parameters:
      replyStatus - The value of the reply status
    • getReplyStatus

      protected short getReplyStatus()
      Gets the current reply_status without doing an access check (available only to package and subclasses)
      Returns:
      Current reply status
    • setForwardRequest

      protected void setForwardRequest(ForwardRequest forwardRequest)
      Stores the given ForwardRequest object for later analysis. This version supplements setForwardRequest( IOR );
      Parameters:
      forwardRequest - ForwardRequest to store
      See Also:
    • setForwardRequest

      protected void setForwardRequest(IOR ior)
      Stores the given IOR for later forward request analysis. This version supplements setForwardRequest( ForwardRequest );
      Parameters:
      ior - IOR to store
      See Also:
    • getForwardRequestException

      protected ForwardRequest getForwardRequestException()
      Retrieves the ForwardRequest object as a ForwardRequest exception.
      Returns:
      the ForwardRequest object
    • getForwardRequestIOR

      protected IOR getForwardRequestIOR()
      Retrieves the IOR of the ForwardRequest exception.
      Returns:
      The IOR of the exception
    • setException

      protected void setException(Exception exception)
      Sets the exception to be returned by received_exception and received_exception_id.
      Parameters:
      exception - exception to be returned
    • getException

      Exception getException()
      Returns the exception to be returned by received_exception and received_exception_id.
    • setCurrentExecutionPoint

      protected void setCurrentExecutionPoint(int executionPoint)
      Sets the execution point that we are currently executing (starting points, intermediate points, or ending points). This allows us to enforce the validity table.
      Parameters:
      executionPoint - Current execution point
    • checkAccess

      protected abstract void checkAccess(int methodID) throws BAD_INV_ORDER
      Check whether the caller is allowed to access this method at this particular time. This is overridden in subclasses to implement the validity table specified in ptc/00-04-05, table 21-1 and 21-2. The currentExecutionPoint attribute is checked, and if access is forbidden at this time, BAD_INV_ORDER is raised with a minor code of TBD_BIO.
      Parameters:
      methodID - The ID of this method, one of the MID_* constants. This allows us to easily look up the method access in a table. Note that method ids may overlap between subclasses.
      Throws:
      BAD_INV_ORDER
    • setSlotTable

      void setSlotTable(SlotTable slotTable)
      The server side does an explicit set rather than taking the current PICurrent table as is done in the general RequestInfoImpl constructor.
    • iorToObject

      protected Object iorToObject(IOR ior)