Package org.serviceconnector.scmp
Class SCMPMessage
java.lang.Object
org.serviceconnector.scmp.SCMPMessage
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SCMPCompositeReceiver,SCMPCompositeSender,SCMPKeepAlive,SCMPMessageFault,SCMPPart
Service Connector Message Protocol. Data container for one message.
- Author:
- JTraber
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSCMPMessage(SCMPMessage toCopyObject) Instantiates a new SCMP.SCMPMessage(SCMPVersion scmpVersion) Instantiates a new SCMP.SCMPMessage(SCMPVersion scmpVersion, Map<String, String> baseHeader) Instantiates a new SCMP message with given message key. -
Method Summary
Modifier and TypeMethodDescriptiongetBody()Gets the body.intGets the body length.intGets the body offset.Gets the body type.Gets the cache id.Gets the whole header.Returns the value of the header attribute.getHeader(SCMPHeaderAttributeKey headerType) Returns the value of the header attribute.getHeaderBoolean(SCMPHeaderAttributeKey headerType) Returns the boolean value of the header attribute.booleangetHeaderFlag(SCMPHeaderAttributeKey headerKey) Gets the header flag.getHeaderInt(SCMPHeaderAttributeKey headerType) Returns the integer value of the header attribute.Gets the message sequence number.Gets the message type.intGets the SCMP version.Gets the service name.Gets the session id.booleanIs true if there is an offset to use when accessing body data.booleanChecks if the body is of type byte array.booleanisCached()Checks if is cached.booleanChecks if the message is a composite.booleanChecks if is compressed.booleanisFault()Checks if the message is a fault.booleanChecks if is keep alive.booleanChecks if this is a large message.booleanisPart()Checks if the message is a part.booleanChecks if the message is a poll request in large message sequence.booleanisReply()Checks if this message is a reply.booleanChecks if is request.booleanisString()Checks if the body is of type string.voidremoveHeader(String name) Removes the attribute with the specified name from the header.voidremoveHeader(SCMPHeaderAttributeKey headerType) Removes the attribute with the specified type from the header.voidsetBody(byte[] buffer, int offset, int length) Sets the body.voidSets the body.voidSets the cached flag if messages is has been cached.voidsetCacheId(String cacheId) Sets the cache id.voidSets the header attribute by name and value.voidSets the whole header.voidsetHeader(SCMPHeaderAttributeKey headerType, boolean attributeValue) Sets the header attribute by type and value.voidsetHeader(SCMPHeaderAttributeKey headerType, int attributeValue) Sets the header by type and value.voidsetHeader(SCMPHeaderAttributeKey headerType, long attributeValue) Sets the header by type and value.voidsetHeader(SCMPHeaderAttributeKey headerType, String attributeValue) Sets the header attribute by type and value.voidsetHeader(SCMPMessage sourceMessage) Copies the header from another message.voidsetHeader(SCMPMessage sourceMessage, SCMPHeaderAttributeKey headerType) Copies a header attribute from another message.voidsetHeaderCheckNull(SCMPHeaderAttributeKey headerType, String attributeValue) Sets the header check null value.voidsetHeaderFlag(SCMPHeaderAttributeKey headerKey) Sets the header flag.voidsetHttpUrlFileQualifier(String httpUrlFileQualifier) voidsetIsReply(boolean isReply) Sets the the reply flag in the message.voidsetIsReqCompleteAfterMarshallingPart(boolean isReqCompleteAfterMarshallingPart) Sets the checks if is request complete after marshalling part.voidsetMessageType(String messageTypeValue) Sets the message type.voidsetMessageType(SCMPMsgType messageType) Sets the message type.voidsetPartSize(int partSize) voidsetServiceName(String serviceName) Sets the service name.voidsetSessionId(String sessionId) Sets the session id.toString()
-
Field Details
-
SC_VERSION
The actual SC_VERSION. -
header
The message header.
-
-
Constructor Details
-
SCMPMessage
Instantiates a new SCMP.- Parameters:
scmpVersion- the SCMP version of current message
-
SCMPMessage
Instantiates a new SCMP. Copy constructor. Make a copy of given object. Pay attention the body of type object is not properly copied here. Copying an instance of type object is not possible. SCMPVersion and SCVersion are not copied as well knowing that runtime changes are forbidden anyway.- Parameters:
toCopyObject- the object to be copied
-
SCMPMessage
Instantiates a new SCMP message with given message key.- Parameters:
scmpVersion- the SCMP version of current messagebaseHeader- the base header
-
-
Method Details
-
getSCMPVersion
Gets the SCMP version.- Returns:
- the SCMP version
-
setMessageType
Sets the message type.- Parameters:
messageType- the new message type
-
setMessageType
Sets the message type.- Parameters:
messageTypeValue- the new message type
-
getMessageType
Gets the message type.- Returns:
- the message type
-
getMessageSequenceNr
Gets the message sequence number.- Returns:
- the message sequence number
-
getCacheId
Gets the cache id.- Returns:
- the cache id
-
setCacheId
Sets the cache id.- Parameters:
cacheId- the new cache id
-
isCached
public boolean isCached()Checks if is cached.- Returns:
- true, if is cached
-
setCached
public void setCached()Sets the cached flag if messages is has been cached. -
isFault
public boolean isFault()Checks if the message is a fault.- Returns:
- true, if is fault
-
isPart
public boolean isPart()Checks if the message is a part.- Returns:
- true, if is part
-
isPollRequest
public boolean isPollRequest()Checks if the message is a poll request in large message sequence.- Returns:
- true, if is poll
-
isKeepAlive
public boolean isKeepAlive()Checks if is keep alive.- Returns:
- true, if is keep alive
-
isBodyOffset
public boolean isBodyOffset()Is true if there is an offset to use when accessing body data.- Returns:
- true, if there is body offset
-
getBodyOffset
public int getBodyOffset()Gets the body offset.- Returns:
- the body offset
-
isComposite
public boolean isComposite()Checks if the message is a composite.- Returns:
- true, if is composite
-
isByteArray
public boolean isByteArray()Checks if the body is of type byte array.- Returns:
- true, if body is of type byte array
-
isString
public boolean isString()Checks if the body is of type string.- Returns:
- true, if body is of type string
-
isLargeMessage
public boolean isLargeMessage()Checks if this is a large message.- Returns:
- true, if is a large message
-
isCompressed
public boolean isCompressed()Checks if is compressed.- Returns:
- true, if is compressed
-
removeHeader
Removes the attribute with the specified name from the header.- Parameters:
name- the name
-
removeHeader
Removes the attribute with the specified type from the header.- Parameters:
headerType- the header type
-
setHeader
Sets the header attribute by name and value.- Parameters:
attributeName- the name of the attributeattributeValue- the value of the attribute
-
setHeader
Sets the header attribute by type and value.- Parameters:
headerType- the header typeattributeValue- the value
-
setHeaderCheckNull
Sets the header check null value. If value is null header is not set!- Parameters:
headerType- the header typeattributeValue- the attribute value
-
setHeader
Sets the header attribute by type and value.- Parameters:
headerType- the header attributeattributeValue- the value
-
setHeader
Sets the header by type and value.- Parameters:
headerType- the header attributeattributeValue- the value
-
setHeader
Sets the header by type and value.- Parameters:
headerType- the header attributeattributeValue- the value
-
setHeader
Copies the header from another message.- Parameters:
sourceMessage- the message with header header to be copied
-
setHeader
Copies a header attribute from another message.- Parameters:
sourceMessage- the source message from which header header should be copiedheaderType- the key to be copied. If the key does not exist in the source message, attribute is not set.
-
getHeader
Returns the value of the header attribute.- Parameters:
attributeName- the name of the attribute- Returns:
- the attribute value
-
getHeader
Returns the value of the header attribute.- Parameters:
headerType- the header type- Returns:
- the attribute value
-
getHeaderBoolean
Returns the boolean value of the header attribute. Be careful if header field is not set - null is returned and if you unbox return value automatically into boolean than a NullPointerException will be thrown.- Parameters:
headerType- the header attribute- Returns:
- the boolean attribute value
-
getHeaderFlag
Gets the header flag. Gets a header flag if header contains header key. Value totally irrelevant in this case.- Parameters:
headerKey- the header key- Returns:
- the header flag
-
getHeaderInt
Returns the integer value of the header attribute.- Parameters:
headerType- the header attribute- Returns:
- the integer attribute value
-
getSessionId
Gets the session id.- Returns:
- the session id
-
getServiceName
Gets the service name.- Returns:
- the service name
-
setServiceName
Sets the service name.- Parameters:
serviceName- the new service name
-
setSessionId
Sets the session id.- Parameters:
sessionId- the new session id
-
getHeader
Gets the whole header.- Returns:
- the whole header
-
setHeader
Sets the whole header.- Parameters:
header- the whole header
-
setHeaderFlag
Sets the header flag. Sets a headerKey with value null.- Parameters:
headerKey- the new header flag
-
setBody
Sets the body.- Parameters:
body- the new body
-
setBody
public void setBody(byte[] buffer, int offset, int length) Sets the body.- Parameters:
buffer- the bufferoffset- the offsetlength- the length
-
getBodyType
Gets the body type.- Returns:
- the body type
-
getBody
Gets the body.- Returns:
- the body
-
getBodyLength
public int getBodyLength()Gets the body length.- Returns:
- the body length
-
isReqCompleteAfterMarshallingPart
public boolean isReqCompleteAfterMarshallingPart()Checks if is request. Marks if this SCMP is a complete or completing part of a request. Last part SCMP of a request returns true.- Returns:
- true, if is final request part
-
setIsReqCompleteAfterMarshallingPart
public void setIsReqCompleteAfterMarshallingPart(boolean isReqCompleteAfterMarshallingPart) Sets the checks if is request complete after marshalling part.- Parameters:
isReqCompleteAfterMarshallingPart- the new checks if is request complete after marshalling part
-
isReply
public boolean isReply()Checks if this message is a reply.- Returns:
- true, if is reply
-
setIsReply
public void setIsReply(boolean isReply) Sets the the reply flag in the message.- Parameters:
isReply- the reply flag value
-
getPartSize
public int getPartSize()- Returns:
- the size of the parts in which message will be broken when it is large
-
setPartSize
public void setPartSize(int partSize) - Parameters:
partSize- the size in which message will be broken when it is large check done in SCMessage
-
getHttpUrlFileQualifier
- Returns:
- the HTTP URL qualifier.
-
setHttpUrlFileQualifier
- Parameters:
httpUrlFileQualifier- the HTTP URL file qualifier which is added to the URL when communicating to a HTTP server.
-
toString
-