Class MessageBase
- java.lang.Object
-
- com.sun.corba.ee.impl.protocol.giopmsgheaders.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 Summary
Fields Modifier and Type Field Description private byte
encodingVersion
private int
threadPoolToUse
private static ORBUtilSystemException
wrapper
-
Fields inherited from interface com.sun.corba.ee.impl.protocol.giopmsgheaders.Message
defaultBufferSize, FLAG_NO_FRAG_BIG_ENDIAN, GIOPBigMagic, GIOPCancelRequest, GIOPCloseConnection, GIOPFragment, GIOPLocateReply, GIOPLocateRequest, GIOPMessageError, GIOPMessageHeaderLength, GIOPReply, GIOPRequest, LITTLE_ENDIAN_BIT, MORE_FRAGMENTS_BIT, THREAD_POOL_TO_USE_MASK, TRAILING_TWO_BIT_BYTE_MASK
-
-
Constructor Summary
Constructors Constructor Description MessageBase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
AreFragmentsAllowed(byte major, byte minor, byte flag, byte msgType)
void
callback(MessageHandler handler)
static CancelRequestMessage
createCancelRequest(GIOPVersion gv, int request_id)
static Message
createCloseConnection(GIOPVersion gv)
static LocateReplyMessage
createLocateReply(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, int locate_status, IOR ior)
static LocateRequestMessage
createLocateRequest(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, byte[] object_key)
static Message
createMessageError(GIOPVersion gv)
static ReplyMessage
createReply(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, int reply_status, ServiceContexts service_contexts, IOR ior)
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)
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)
private static void
dprint(java.lang.String msg)
(package private) static ObjectKeyCacheEntry
extractObjectKeyCacheEntry(TargetAddress target, ORB orb)
Extract the object key from TargetAddress.RequestId
getCorbaRequestId()
Return a Message's CorbaRequestId.byte
getEncodingVersion()
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.(package private) static SystemException
getSystemException(java.lang.String exClassName, int minorCode, CompletionStatus completionStatus, java.lang.String message, ORBUtilSystemException wrapper)
int
getThreadPoolToUse()
(package private) static void
nullCheck(java.lang.Object obj)
static MessageBase
parseGiopHeader(ORB orb, Connection connection, java.nio.ByteBuffer buf, int startPosition)
private static int
readSize(byte b1, byte b2, byte b3, byte b4, boolean littleEndian)
void
setEncodingVersion(byte version)
static void
setFlag(java.nio.ByteBuffer byteBuffer, int flag)
Set a flag in the given buffer (fragment bit, byte order bit, etc)boolean
supportsFragments()
Returns true if this message could be followed by a fragment.static java.lang.String
typeToString(byte type)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sun.corba.ee.impl.protocol.giopmsgheaders.Message
createFragmentMessage, getGIOPVersion, getSize, getType, isLittleEndian, moreFragmentsToFollow, read, setSize, write
-
-
-
-
Field Detail
-
threadPoolToUse
private int threadPoolToUse
-
encodingVersion
private byte encodingVersion
-
wrapper
private static final ORBUtilSystemException wrapper
-
-
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)
-
createReply
public static ReplyMessage createReply(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, int reply_status, ServiceContexts service_contexts, IOR ior)
-
createLocateRequest
public static LocateRequestMessage createLocateRequest(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, byte[] object_key)
-
createLocateReply
public static LocateReplyMessage createLocateReply(ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, int locate_status, IOR ior)
-
createCancelRequest
public static CancelRequestMessage createCancelRequest(GIOPVersion gv, int request_id)
-
createCloseConnection
public static Message createCloseConnection(GIOPVersion gv)
-
createMessageError
public static Message createMessageError(GIOPVersion gv)
-
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 inflag
- 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)
-
getSystemException
static SystemException getSystemException(java.lang.String exClassName, int minorCode, CompletionStatus completionStatus, java.lang.String message, ORBUtilSystemException wrapper)
-
callback
public void callback(MessageHandler handler) throws java.io.IOException
-
getThreadPoolToUse
public int getThreadPoolToUse()
- Specified by:
getThreadPoolToUse
in interfaceMessage
-
getEncodingVersion
public byte getEncodingVersion()
- Specified by:
getEncodingVersion
in interfaceMessage
-
setEncodingVersion
public void setEncodingVersion(byte version)
- Specified by:
setEncodingVersion
in interfaceMessage
-
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 interfaceMessage
- Returns:
- a Message's CorbaRequestId.
-
supportsFragments
public boolean supportsFragments()
Returns true if this message could be followed by a fragment.- Specified by:
supportsFragments
in interfaceMessage
- Returns:
true
if Message supports fragmenting or is a message fragment. Otherwisefalse
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 ofbyteBuffer
- buffer containing the request ID- Returns:
CorbaRequestId
ifMessage
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)
-
-