Package org.serviceconnector.api
Class SCMessage
java.lang.Object
org.serviceconnector.api.SCMessage
- Direct Known Subclasses:
SCManagedMessage,SCPublishMessage,SCSubscribeMessage
The Class SCMessage. A SCMessage is the basic transport unit to communicate with a Service Connector.
- Author:
- JTraber
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets the application error code.Gets the application error text.Gets the cache expiration date time.Gets the cache id.Gets the cache part nr.Gets the caching method.getData()Gets the data.intGets the data length.Gets the message info.intGets the part size.Gets the service name.Gets the session id.Gets the session info.booleanisCached()Checks if message has been cached and comes from a cache.booleanChecks if is compressed.booleanChecks if message is managed.booleanisReject()Checks if is reject.voidsetAppErrorCode(Integer appErrorCode) Sets the application error code.voidsetAppErrorText(String appErrorText) Sets the application error text.voidsetCached(boolean cached) Marks the message as a cached message.voidsetCacheExpirationDateTime(Date cacheExpirationDateTime) Sets the cache expiration date time.voidsetCacheId(String cacheId) Sets the cache id.voidsetCachePartNr(String cachePartNr) Sets the cache part nr.voidsetCachingMethod(SC_CACHING_METHOD cachingMethod) Sets the caching method.voidsetCompressed(boolean compressed) Sets the compressed.voidSets the data.voidsetDataLength(int dataLength) Sets the data length.voidsetMessageInfo(String messageInfo) Sets the message info.voidsetPartSize(int partSize) Sets the part size.voidsetReject(boolean reject) Sets the reject.voidsetServiceName(String serviceName) Sets the service name.voidsetSessionId(String sessionId) Sets the session id.voidsetSessionInfo(String sessionInfo) Sets the session info.toString()
-
Constructor Details
-
SCMessage
public SCMessage()Instantiates a new SCMessage. -
SCMessage
public SCMessage(byte[] data) Instantiates a new SC message with byte[] data.- Parameters:
data- the data
-
SCMessage
Instantiates a new SC message with String data.- Parameters:
data- the data
-
-
Method Details
-
setMessageInfo
Sets the message info.- Parameters:
messageInfo- Optional information passed together with the message body that helps to identify the message content without investigating the body.
Any printable character, length > 0 and < 256 Byte
Example: SECURITY_MARKET_QUERY
-
getSessionInfo
Gets the session info.- Returns:
- the session info
-
setSessionInfo
Sets the session info.- Parameters:
sessionInfo- Optional information passed together with the message body Any printable character, length > 0 and < 256 Byte
-
getMessageInfo
Gets the message info.- Returns:
- the message info
-
isCompressed
public boolean isCompressed()Checks if is compressed.- Returns:
- the boolean
-
setCompressed
public void setCompressed(boolean compressed) Sets the compressed. Default is true.- Parameters:
compressed- Regards the data part of the message.
-
setData
Sets the data.- Parameters:
data- the new data
-
getData
Gets the data.- Returns:
- the data
-
setDataLength
public void setDataLength(int dataLength) Sets the data length.- Parameters:
dataLength- the new data length
-
getDataLength
public int getDataLength()Gets the data length.- Returns:
- the data length
-
getSessionId
Gets the session id.- Returns:
- the session id
-
setSessionId
Sets the session id.- Parameters:
sessionId- the new session id
-
getCacheId
Gets the cache id.- Returns:
- the cache id
-
getCachePartNr
Gets the cache part nr.- Returns:
- the cache part nr
-
isCached
public boolean isCached()Checks if message has been cached and comes from a cache.- Returns:
- true, if message has been cached
-
setCached
public void setCached(boolean cached) Marks the message as a cached message.- Parameters:
cached- the new caching state
-
getServiceName
Gets the service name.- Returns:
- the service name
-
setServiceName
Sets the service name. Needs to be the same service which is used to send the message. The name will be overwritten at the time the message is sent.- Parameters:
serviceName- the new service name
-
setCacheId
Sets the cache id.- Parameters:
cacheId- the new cache id
-
setCachePartNr
Sets the cache part nr.- Parameters:
cachePartNr- the new cache part nr
-
getAppErrorCode
public int getAppErrorCode()Gets the application error code.- Returns:
- the application error code
-
setAppErrorText
Sets the application error text.- Parameters:
appErrorText- the new application error text
-
getAppErrorText
Gets the application error text.- Returns:
- the application error text
-
setAppErrorCode
Sets the application error code.- Parameters:
appErrorCode- the new application error code
-
isReject
public boolean isReject()Checks if is reject.- Returns:
- true, if is reject
-
setReject
public void setReject(boolean reject) Sets the reject.- Parameters:
reject- the new reject
-
getPartSize
public int getPartSize()Gets the part size.- Returns:
- the size of the parts in which message will be broken when it is large
-
setPartSize
public void setPartSize(int partSize) Sets the part size.- Parameters:
partSize- the size in which message will be broken when it is large
-
getCacheExpirationDateTime
Gets the cache expiration date time.- Returns:
- the cache expiration date time
-
setCacheExpirationDateTime
Sets the cache expiration date time.- Parameters:
cacheExpirationDateTime- the new cache expiration date time
-
setCachingMethod
Sets the caching method.- Parameters:
cachingMethod- the new caching method
-
getCachingMethod
Gets the caching method.- Returns:
- the caching method
-
isManaged
public boolean isManaged()Checks if message is managed.- Returns:
- true, if message is managed
-
toString
-