Class MessageBase

  • All Implemented Interfaces:
    Message
    Direct Known Subclasses:
    Message_1_0, Message_1_1

    public abstract class MessageBase
    extends java.lang.Object
    implements Message
    This class acts as the base class for the various GIOP message types. This also serves as a factory to create various message types. We currently support GIOP 1.0, 1.1 and 1.2 message types.
    Version:
    1.0
    • Field Detail

      • threadPoolToUse

        private int threadPoolToUse
      • encodingVersion

        private byte encodingVersion
    • Constructor Detail

      • MessageBase

        public MessageBase()
    • Method Detail

      • typeToString

        public static java.lang.String typeToString​(byte type)
      • parseGiopHeader

        public static MessageBase parseGiopHeader​(ORB orb,
                                                  Connection connection,
                                                  java.nio.ByteBuffer buf,
                                                  int startPosition)
      • createRequest

        private static RequestMessage createRequest​(ORB orb,
                                                    GIOPVersion gv,
                                                    byte encodingVersion,
                                                    int request_id,
                                                    boolean response_expected,
                                                    byte[] object_key,
                                                    java.lang.String operation,
                                                    ServiceContexts service_contexts,
                                                    Principal requesting_principal)
      • createRequest

        public static RequestMessage createRequest​(ORB orb,
                                                   GIOPVersion gv,
                                                   byte encodingVersion,
                                                   int request_id,
                                                   boolean response_expected,
                                                   IOR ior,
                                                   short addrDisp,
                                                   java.lang.String operation,
                                                   ServiceContexts service_contexts,
                                                   Principal requesting_principal)
      • setFlag

        public static void setFlag​(java.nio.ByteBuffer byteBuffer,
                                   int flag)
        Set a flag in the given buffer (fragment bit, byte order bit, etc)
        Parameters:
        byteBuffer - buffer to set flag in
        flag - flag to set
      • AreFragmentsAllowed

        private static void AreFragmentsAllowed​(byte major,
                                                byte minor,
                                                byte flag,
                                                byte msgType)
      • extractObjectKeyCacheEntry

        static ObjectKeyCacheEntry extractObjectKeyCacheEntry​(TargetAddress target,
                                                              ORB orb)
        Extract the object key from TargetAddress.
        Returns:
        ObjectKey the object key.
      • readSize

        private static int readSize​(byte b1,
                                    byte b2,
                                    byte b3,
                                    byte b4,
                                    boolean littleEndian)
      • nullCheck

        static void nullCheck​(java.lang.Object obj)
      • callback

        public void callback​(MessageHandler handler)
                      throws java.io.IOException
        Specified by:
        callback in interface Message
        Throws:
        java.io.IOException
      • setEncodingVersion

        public void setEncodingVersion​(byte version)
        Specified by:
        setEncodingVersion in interface Message
      • getCorbaRequestId

        public RequestId getCorbaRequestId()
        Return a Message's CorbaRequestId. NOTE: This method should be overridden for messages that support a 4 byte request id following the 12 byte GIOP message header.
        Specified by:
        getCorbaRequestId in interface Message
        Returns:
        a Message's CorbaRequestId.
      • supportsFragments

        public boolean supportsFragments()
        Returns true if this message could be followed by a fragment.
        Specified by:
        supportsFragments in interface Message
        Returns:
        true if Message supports fragmenting or is a message fragment. Otherwise false it does not support message fragments.
      • getRequestIdFromMessageBytes

        public static RequestId getRequestIdFromMessageBytes​(Message message,
                                                             java.nio.ByteBuffer byteBuffer)
        Get the request id from the 4 bytes following the 12 byte GIOP request header if the request header exists. Otherwise, return 0.

        NOTE: Assumes Message already been filtered by MessageBase.messageSupportsFragments(Message)

        Parameters:
        message - message to set ID of
        byteBuffer - buffer containing the request ID
        Returns:
        CorbaRequestIdif Message supports a 12 + 4 byte GIOP header. Otherwise returns a CorbaRequestId with an undefined request id.
      • dprint

        private static void dprint​(java.lang.String msg)