public class MbMessage
extends java.lang.Object
+----+ |Root| +----+ | | +---------+-+--------+ | | | | | | +----------+ +----+ +---+ |Properties| |MQMD| |XML| +----------+ +----+ +---+The root parser at the top will invoke the parsers along the bottom in the order shown to parse the bit stream into a syntax element tree. This tree will then have same structure as shown in the diagram with sub-trees off each parser element representing its part of the message. For example the MQMD header is the first sibling of the first child of Root and the MQMD attributes are children of this.
The syntax element representing the root is returned by
getRootElement()
. This is an object of type
MbElement
which contains methods to navigate
and modify the tree.
Warning: caching MbMessage objects over multiple message flow invocations is unsupported because the internal state may be reset at the end of the current message invocation.
MbElement
,
"Working with Messages. Appendix A: Message Parsers - element definitions"Modifier and Type | Field and Description |
---|---|
static int |
FINALIZE_NONE
Option for
finalizeMessage() . |
static int |
FINALIZE_VALIDATE
Option for
finalizeMessage() . |
Constructor and Description |
---|
MbMessage()
Default constructor for MbMessage
|
MbMessage(MbMessage message)
Copy constructor for MbMessage.
|
Modifier and Type | Method and Description |
---|---|
void |
clearMessage()
Deletes the resources associated with the message.
|
void |
clearMessage(boolean deleteRootElement)
Deletes the resources associated with the message.
|
org.w3c.dom.Document |
createDOMDocument(java.lang.String parserName) |
java.lang.Object |
evaluateXPath(MbXPath xpath)
Evaluates the XPath 1.0 expression with the message body (last child of root)
as the context node.
|
java.lang.Object |
evaluateXPath(MbXPath xpath,
MbXPathVariables xpathVariables)
Evaluates the XPath 1.0 expression with the message body (last child of root)
as the context node.
|
java.lang.Object |
evaluateXPath(java.lang.String expression)
Evaluates the XPath 1.0 expression with the message body (last child of root)
as the context node.
|
java.lang.Object |
evaluateXPath(java.lang.String expression,
MbNamespaceBindings namespaceBindings)
Evaluates the XPath 1.0 expression with the message body (last child of root)
as the context node.
|
java.lang.Object |
evaluateXPath(java.lang.String expression,
MbNamespaceBindings namespaceBindings,
MbXPathVariables xpathVariables)
Evaluates the XPath 1.0 expression with the message body (last child of root)
as the context node.
|
java.lang.Object |
evaluateXPath(java.lang.String expression,
MbXPathVariables xpathVariables)
Evaluates the XPath 1.0 expression with the message body (last child of root)
as the context node.
|
void |
finalizeMessage(int options)
Causes the broker to request parsers that support the finalize feature
to perform their finalize processing on the message.
|
byte[] |
getBuffer()
Get a copy of the data buffer associated with (and owned by)
the message object.
|
org.w3c.dom.Document |
getDOMDocument() |
MbElement |
getRootElement()
Get the root syntax element associated with the message.
|
boolean |
isReadOnly()
Return true if the message is read only.
|
java.lang.String |
toString()
Returns a String representation of the MbMessage.
|
public static final int FINALIZE_NONE
finalizeMessage()
.public static final int FINALIZE_VALIDATE
finalizeMessage()
.public MbMessage() throws MbException
MbException
public MbMessage(MbMessage message) throws MbException
MbException
public boolean isReadOnly()
public void clearMessage() throws MbException
MbException
public void clearMessage(boolean deleteRootElement) throws MbException
deleteRootElement
- indicates if the root element for
this message is also to be deletedMbException
public void finalizeMessage(int options) throws MbException
Of the options parameter is set to FINALIZE_VALIDATE, a parser should also perform validation processing to ensure that the element tree owned by it is of the correct structure. This helps prevent messages with incorrectly formed element trees being propagated to other nodes in the message flow.
It is recommended that finalizeMessage is called prior to propagating a message.
options
- The options governing the method. Acceptable values are:
FINALIZE_NONE
FINALIZE_VALIDATEMbException
public byte[] getBuffer() throws MbException
MbException
public MbElement getRootElement() throws MbException
MbException
public java.lang.Object evaluateXPath(java.lang.String expression) throws MbException
Boolean
Double
String
java.util.List
of MbElement objects representing an XPath 1.0 nodeset
expression
- The XPath 1.0 expression.MbException
- - An exception was thrown during the compilation of
the expression.public java.lang.Object evaluateXPath(java.lang.String expression, MbNamespaceBindings namespaceBindings) throws MbException
Boolean
Double
String
java.util.List
of MbElement objects representing an XPath 1.0 nodeset
expression
- The XPath 1.0 expression.namespaceBindings
- Associated object containing the namespace prefix to URI mappings for this expression.MbException
- - An exception was thrown during the compilation of
the expression.public java.lang.Object evaluateXPath(java.lang.String expression, MbXPathVariables xpathVariables) throws MbException
Boolean
Double
String
java.util.List
of MbElement objects representing an XPath 1.0 nodeset
expression
- The XPath 1.0 expression.xpathVariables
- Associated object containing the variable bindings for this expression.MbException
- - An exception was thrown during the compilation of
the expression.public java.lang.Object evaluateXPath(java.lang.String expression, MbNamespaceBindings namespaceBindings, MbXPathVariables xpathVariables) throws MbException
Boolean
Double
String
java.util.List
of MbElement objects representing an XPath 1.0 nodeset
If the expression contains variable references, these variables must be assigned values. This is done with the xpathVariables parameter. The MbXPathVariables object must have an entry for each variable used in the XPath expression.
expression
- The XPath 1.0 expression.namespaceBindings
- Associated object containing the namespace prefix to URI mappings for this expression.xpathVariables
- Associated object containing the variable bindings for this expression.MbException
- - An exception was thrown during the compilation of
the expression.public java.lang.Object evaluateXPath(MbXPath xpath) throws MbException
Boolean
Double
String
java.util.List
of MbElement objects representing an XPath 1.0 nodeset
xpath
- The MbXPath object representing the XPath 1.0 expression.MbException
- - An exception was thrown during the compilation of
the expression.public java.lang.Object evaluateXPath(MbXPath xpath, MbXPathVariables xpathVariables) throws MbException
Boolean
Double
String
java.util.List
of MbElement objects representing an XPath 1.0 nodeset
xpath
- The MbXPath object representing the XPath 1.0 expression.xpathVariables
- Associated object containing the variable bindings for this expression.MbException
- - An exception was thrown during the compilation of
the expression.public org.w3c.dom.Document getDOMDocument() throws MbException
MbException
public org.w3c.dom.Document createDOMDocument(java.lang.String parserName) throws MbException
MbException
public java.lang.String toString()
toString
in class java.lang.Object