Package com.mdfromhtml.core
Interface IMDfromHTMLIPCMessage
-
- All Known Implementing Classes:
MDfromHTMLIPCMessage
public interface IMDfromHTMLIPCMessageInterface for the MDfromHTML IPC Message to be sent (or received) across the MDfromHTML Interprocess Communications Infrastructure. Messages may carry JSONObject or byte[] content. Messages are identified by a topic (used for subscription), a type (used for identifying how a message should be parsed and interpreted), a create time, a sequence number where 0 implies the only message, 1 or greater implies a chunk of a larger message (whereInteger.MAX_VALUEacks as a semaphore to signal the last of a sequence), and a flag describing if the message content is a JSONObject or byte[].
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MDfromHTMLIPCApplicationsgetApplication()intgetApplicationValue()com.api.json.JSONObjectgetMessage()byte[]getMessageBytes()StringgetPublisherName()intgetSequence()MDfromHTMLIDgetSessionID()longgetTime()StringgetTopic()StringgetType()MDfromHTMLIDgetUserID()Retrieve the user identification associated with this messageMDfromHTMLIPCVerbsgetVerb()Retrieve the enumerated value associated with this messageintgetVerbValue()Retrieve the numeric identity of the verbbooleanisJSON()booleanisLastMessage()booleanisOnlyMessage()booleanisSequence()StringtoString()StringtoStringFull()StringtoStringFull(boolean formatJSON)
-
-
-
Method Detail
-
getApplication
MDfromHTMLIPCApplications getApplication()
- Returns:
- the enumerated value associated with this message
- See Also:
MDfromHTMLIPCVerbs
-
getApplicationValue
int getApplicationValue()
- Returns:
- the numeric identity of the application
-
getMessage
com.api.json.JSONObject getMessage() throws Exception- Returns:
- the message content as a JSONObject
- Throws:
Exception
-
getMessageBytes
byte[] getMessageBytes()
- Returns:
- the message content as a byte[]
-
getPublisherName
String getPublisherName()
- Returns:
- the publisher (creator) of this message
-
getSequence
int getSequence()
- Returns:
- the sequence number of this message. Note: zero implies the only message, non-zero implies a part of a chunked message, with 65768 signifying the last of the sequence of messages.
-
getSessionID
MDfromHTMLID getSessionID()
- Returns:
- the session id related to the message content. If the content is
not associated with a particular session, the ID returned is
MDfromHTMLID.UNDEFINED_IDand corresponds with the String value inMDfromHTMLConstants.UNDEFINED_ID
-
getTime
long getTime()
- Returns:
- the original message creation time (not necessarily the same as the time it was published)
-
getTopic
String getTopic()
- Returns:
- the message topic
-
getType
String getType()
- Returns:
- the message type. If the original was undefined, the type will
return the
MDfromHTMLConstants.UNDEFINED_String
-
getVerbValue
int getVerbValue()
Retrieve the numeric identity of the verb- Returns:
- the numeric identity of the verb
-
getVerb
MDfromHTMLIPCVerbs getVerb()
Retrieve the enumerated value associated with this message- Returns:
- the enumerated value associated with this message
- See Also:
MDfromHTMLIPCVerbs
-
getUserID
MDfromHTMLID getUserID()
Retrieve the user identification associated with this message- Returns:
- the user identification associated with this message
-
isLastMessage
boolean isLastMessage()
- Returns:
- true if the message sequence is
Integer.MAX_VALUEsignaling the end of a chunked sequence of messages
-
isOnlyMessage
boolean isOnlyMessage()
- Returns:
- true if the message sequence is zero signaling the message was not chunked
-
isSequence
boolean isSequence()
- Returns:
- true if the message sequence is not zero (for an "chunked" message).
-
isJSON
boolean isJSON()
- Returns:
- true if the original message was a String (as opposed to a byte[])
-
toString
String toString()
-
toStringFull
String toStringFull()
- Returns:
- formatted complete version of this message
- See Also:
that is more useful for debugging
-
toStringFull
String toStringFull(boolean formatJSON)
- Parameters:
formatJSON- true if the message is to be formatted (if the message contains JSON), false if not.- Returns:
- formatted complete version of this message
- See Also:
that is more useful for debugging
-
-