|
Sonic ESB API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XQMessage
The XQMessage is a message that has a header and can contain zero or more Parts. It provides methods to add, delete, and get the constituent parts.
Message headers support the following conversion table. The marked
cases must be supported. The unmarked cases will throw a XQMessageException.
The String to primitive conversions will throw a runtime exception if the
primitives valueOf()
method does not accept it as a valid
String representation of the primitive.
A value written as the row type can be read as the column type.
| | boolean byte short int long float double String |---------------------------------------------------------- |boolean | X X |byte | X X X X X |short | X X X X |int | X X X |long | X X |float | X X X |double | X X |String | X X X X X X X X |----------------------------------------------------------
A Message object contains a built-in facility for supporting application-defined headers. In effect, this provides a mechanism for adding application-specific header fields to a message. Headers allow an application, via message selectors, to have a JMS provider select, or filter, messages on its behalf using application-specific criteria. Header values can be boolean, byte, short, int, long, float, double, and String. Header values are set prior to sending a message.
There are two mechanisms of accessing headers. First, user defined headers
are accessible via a variety of type specific methods. These include
getByteHeader()
,getStringHeader()
,
getLongHeader()
, etc..
In addition to the above accessors, it is also possible to access a
super-set of header values utilizing the getHeaderValue()
and its variants. This superset not only includes user defined values,
but also include transport specific values (usually JMS message headers). For instance, the following
JMS predefined headers are accessible via getHeaderValue()
:
JMSDestination JMSDeliveryMode, JMSMessageID JMSTimestamp JMSCorrelationID JMSReplyTo JMSRedelivered JMSType JMSExpiration JMSPriority
For example, to access the JMSMessageID, the user can utilize
getHeaderValue( "JMSMessageID" )
XQPart
Method Summary | |
---|---|
void |
addPart(XQPart part)
Adds a part to the XQMessage. |
void |
addPartAt(XQPart part,
int index)
Adds a part to the XQMessage. |
boolean |
containsHeader(java.lang.String name)
Indicates whether a header value exists. |
XQPart |
createPart()
Creates an empty part. |
XQPart |
createPart(java.lang.Object content,
java.lang.String contentType)
Creates a part with the specified content and content-type. |
boolean |
doesPartExist(java.lang.String cid)
Returns true if a part with the given content-Id exists in the message, false otherwise. |
boolean |
getBooleanHeader(java.lang.String name)
Retrieves a user-defined Message header from the XQMessage, if the named boolean header has been set on the message by the sender or the ESB framework. |
byte |
getByteHeader(java.lang.String name)
Retrieves a user-defined Message header from the XQMessage, if the named byte header has been set on the message by the sender or the ESB framework. |
java.lang.String |
getCorrelationId()
Get the CorrelationID for this message. |
double |
getDoubleHeader(java.lang.String name)
Retrieves a user-defined Message header from the XQMessage, if the named double header has been set on the message by the sender or the ESB framework. |
float |
getFloatHeader(java.lang.String name)
Retrieves a user-defined Message header from the XQMessage, if the named float header has been set on the message by the sender or the ESB framework. |
java.util.Iterator<java.lang.String> |
getHeaderNames()
Returns an Iterator for all the header names. |
java.lang.Object |
getHeaderValue(java.lang.String name)
Get the value of the named header. |
int |
getIntHeader(java.lang.String name)
Retrieves a user-defined Message header from the XQMessage, if the named integer header has been set on the message by the sender or the ESB framework. |
long |
getLongHeader(java.lang.String name)
Retrieves a user-defined Message header from the XQMessage, if the named long header has been set on the message by the sender or the ESB framework. |
XQPart |
getPart(int index)
Gets the XQPart from the XQMessage by its index |
XQPart |
getPart(java.lang.String cid)
Gets the XQPart from the XQMessage by its Content-Id. |
org.w3c.dom.Document |
getPartAsDocument(int index,
boolean validate)
Gets the XQPart from the XQMessage by index, and returns it as a DOM document. |
org.w3c.dom.Document |
getPartAsDocument(java.lang.String cid,
boolean validate)
Gets the XQPart from the XQMessage by its Content-Id, and returns it as a DOM document. |
int |
getPartCount()
Gets the count of the number of Parts for the XQMessage. |
XQAddress |
getReplyTo()
Get the Reply To address for this message. |
short |
getShortHeader(java.lang.String name)
Retrieves a user-defined Message header from the XQMessage, if the named short header has been set on the message by the sender or the ESB framework. |
java.lang.String |
getStringHeader(java.lang.String name)
Retrieves a user-defined Message header from the XQMessage, if the named string header has been set on the message by the sender or the ESB framework. |
void |
removeAllParts()
Remove all Parts from the Message. |
java.lang.Object |
removeHeader(java.lang.String name)
Remove the named header from the message header. |
void |
removePart(int index)
Removes a Part from the Message. |
void |
removePart(java.lang.String contentID)
Removes a Part from the Message. |
void |
replacePart(XQPart part,
int index)
Replace the XQPart at the specified location with a new part. |
void |
replacePart(XQPart part,
java.lang.String cid)
Replace the XQPart with the specified Content-ID with a new part. |
void |
setBooleanHeader(java.lang.String name,
boolean value)
Sets the user-defined boolean header value with the specified name into the message header. |
void |
setByteHeader(java.lang.String name,
byte value)
Sets the user-defined byte header value with the specified name into the message header. |
void |
setCorrelationId(java.lang.String id)
Sets the CorrelationID for this message. |
void |
setDoubleHeader(java.lang.String name,
double value)
Sets the user-defined double header value with the specified name into the message header. |
void |
setFloatHeader(java.lang.String name,
float value)
Sets the user-defined float header value with the specified name into the message header. |
void |
setHeaderValue(java.lang.String name,
java.lang.Object value)
Sets a header value with the specified name into the message header. |
void |
setHeaderValues(java.util.Map<java.lang.String,java.lang.Object> headers)
Sets multiple header values into the message header. |
void |
setIntHeader(java.lang.String name,
int value)
Sets the user-defined int header value with the specified name into the message header. |
void |
setLongHeader(java.lang.String name,
long value)
Sets the user-defined long header value with the specified name into the message header. |
void |
setPartFromDocument(int index,
org.w3c.dom.Document doc)
Create a new XQPart for this message from a DOM document. |
void |
setPartFromDocument(java.lang.String cid,
org.w3c.dom.Document doc)
Create a new XQPart for this message from a DOM document. |
void |
setReplyTo(XQAddress replyTo)
Sets the Reply To address for this message. |
void |
setShortHeader(java.lang.String name,
short value)
Sets the user-defined short header value with the specified name into the message header. |
void |
setStringHeader(java.lang.String name,
java.lang.String value)
Sets the user-defined String header value with the specified name into the message header. |
Methods inherited from interface com.sonicsw.xq.XQCloneable |
---|
clone |
Method Detail |
---|
boolean containsHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorjava.util.Iterator<java.lang.String> getHeaderNames() throws XQMessageException
XQMessageException
- thrown if there is an errorjava.lang.Object getHeaderValue(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorboolean getBooleanHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorbyte getByteHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorint getIntHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorlong getLongHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorfloat getFloatHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errordouble getDoubleHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorshort getShortHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorjava.lang.String getStringHeader(java.lang.String name) throws XQMessageException
name
- The name of the header
XQMessageException
- thrown if there is an errorvoid setHeaderValue(java.lang.String name, java.lang.Object value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setBooleanHeader(java.lang.String name, boolean value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setByteHeader(java.lang.String name, byte value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setDoubleHeader(java.lang.String name, double value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setFloatHeader(java.lang.String name, float value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setIntHeader(java.lang.String name, int value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setLongHeader(java.lang.String name, long value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setStringHeader(java.lang.String name, java.lang.String value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setShortHeader(java.lang.String name, short value) throws XQMessageException
name
- The name of the headervalue
- The value of the header
XQMessageException
- thrown if there is an errorvoid setHeaderValues(java.util.Map<java.lang.String,java.lang.Object> headers) throws XQMessageException
headers
- A Map containing name value pairs to add to the message
XQMessageException
- thrown if there is an errorjava.lang.Object removeHeader(java.lang.String name) throws XQMessageException
name
- The name of the header.
XQMessageException
- thrown if there is an errorint getPartCount() throws XQMessageException
XQMessageException
- thrown if there is an errorXQPart getPart(int index) throws XQMessageException
index
- The 0-based array index of the part requested.
XQMessageException
- thrown if there is an errorXQPart getPart(java.lang.String cid) throws XQMessageException
cid
- The Content-Id of the part requested.
XQMessageException
- thrown if there is an errororg.w3c.dom.Document getPartAsDocument(java.lang.String cid, boolean validate) throws XQMessageException
cid
- Content-Id of the part to fetch.validate
- Whether to perform XML Schema validation during parsing.
XQMessageException
- on error.org.w3c.dom.Document getPartAsDocument(int index, boolean validate) throws XQMessageException
index
- Zero-based index of the part to fetch.validate
- Whether to perform XML Schema validation during parsing.
XQMessageException
- on error.void setPartFromDocument(java.lang.String cid, org.w3c.dom.Document doc) throws XQMessageException
cid
- Content-Id for the new part.doc
- DOM document to serialize into the part.
XQMessageException
- on error.void setPartFromDocument(int index, org.w3c.dom.Document doc) throws XQMessageException
index
- Zero-based index for the new part.doc
- DOM document to serialize into the part.
XQMessageException
- on error.XQPart createPart(java.lang.Object content, java.lang.String contentType) throws XQMessageException
content
- The content of the part.contentType
- The Content-Type associated with the content.
XQMessageException
- thrown if there is an errorXQPart createPart() throws XQMessageException
XQMessageException
- thrown if there is an errorvoid addPart(XQPart part) throws XQMessageException
part
- The XQPart to be added.
XQMessageException
- thrown if the message already contains a part
with the same ContentID as the part being added.void addPartAt(XQPart part, int index) throws XQMessageException
part
- The XQPart to be added.index
- The 0-based index where to add the part
XQMessageException
- thrown if the message already contains a part
with the same ContentID as the part being added.void replacePart(XQPart part, int index) throws XQMessageException
part
- the new part to be used in the messageindex
- the 0-based index of the part to replace.
XQMessageException
- thrown if there is an error or
if no parts exist at the specified indexvoid replacePart(XQPart part, java.lang.String cid) throws XQMessageException
part
- the new part to be used in the messagecid
- the Content-ID of the part to replace.
XQMessageException
- thrown if there is an error or
if no parts exist with the specified cid.void removePart(int index) throws XQMessageException
index
- the 0-based index of the part to remove.
XQMessageException
- thrown if there is an errorvoid removePart(java.lang.String contentID) throws XQMessageException
contentID
- The Content-Id of the part to remove
XQMessageException
- thrown if there is an errorvoid removeAllParts() throws XQMessageException
XQMessageException
boolean doesPartExist(java.lang.String cid)
cid
- Content-Id to check.
XQAddress getReplyTo() throws XQMessageException
XQMessageException
- thrown if there is an errorvoid setCorrelationId(java.lang.String id) throws XQMessageException
XQMessageException
- thrown if there is an errorjava.lang.String getCorrelationId() throws XQMessageException
XQMessageException
- thrown if there is an errorvoid setReplyTo(XQAddress replyTo) throws XQMessageException
XQMessageException
- thrown if there is an error
|
Sonic ESB API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |