AdroitLogic UltraESB v1.7.0

org.adroitlogic.ultraesb.api.mediation
Interface XMLSupport


public interface XMLSupport

Mediation Support for DOM based mediation

Since:
1.7.0

Method Summary
 void addAttributeToElements(Message msg, java.lang.String exprn, java.lang.String[][] ns, java.lang.String qName, java.lang.String nsUri, java.lang.String value)
          Add an attribute to one or more elements selected by an XPath expression e.g.
 void addElementsAsChild(Message msg, java.lang.String expression, java.lang.String[][] ns, java.lang.String qualifiedTagName, java.lang.String namespace)
          Inserts Element as a child to the specified elements pointed by an xpath expression
 void addTextElementsAsChild(Message msg, java.lang.String expression, java.lang.String[][] ns, java.lang.String qualifiedTagName, java.lang.String namespace, java.lang.String elementContent)
          Inserts Text Element as a child to the specified elements pointed by an xpath expression
 void convertDOMToSoap11(Message m)
          Converts a DOM message to SOAP 1.1 by wrapping the message in a SOAP envelope and body
 void convertDOMToSoap12(Message m)
          Converts a DOM message to SOAP 1.2 by wrapping the message in a SOAP envelope and body
 void convertFromFI(Message m)
          Convert the payload of the current message from a FastInfoset binary to an XML message (Note the XML payload is still kept as a RawFileMessage by default and maybe converted into a DOM message if required)
 void convertSoapToDOM(Message m)
          Converts a SOAP message to DOM (POX) by stripping out the SOAP Envelope and Body and Header
 void convertToDOM(Message m)
          Convert the current message into a DOMMessage
 void convertToFI(Message m)
          Convert the XML message into a FastInfoset binary message
 java.lang.Object convertXMLToJAXBObject(Message msg, java.lang.Class clazz)
          Converts a XML payload into a JAXB Object.
 void convertXMLToJSONStream(Message m)
          Convert the current XML message payload (which maybe available as any format such as raw file or DOM etc) into a file based JSON stream
 void convertXMLToJSONStream(Message m, javax.xml.namespace.QName staringElement, boolean retainNSPrefixes)
          Convert the current XML message payload (which maybe available as any format such as raw file or DOM etc) into a file based JSON stream
 org.w3c.dom.Document createDOMDocument()
          Create a new DOM Document object and return
 void deleteAttributes(Message msg, java.lang.String exprn, java.lang.String[][] ns)
          Deletes the specified attribute/s e.g.
 void deleteElements(Message msg, java.lang.String expression, java.lang.String[][] ns)
          Delete Elements pointed by an xpath expression
 org.w3c.dom.NodeList extractAsNodeListUsingXPath(Message m, java.lang.String exprn, java.lang.String[][] ns)
          Evaluate the given XPath expression against the XML payload, and return result as a NodeList This method converts the current payload into a DOMMessage
 java.lang.String extractAsStringUsingXPath(Message m, java.lang.String exprn, java.lang.String[][] ns)
          Evaluate the given XPath expression against the XML payload, and return result as a String This method converts the current payload into a DOMMessage
 boolean filter(Message m, java.lang.String exprn, java.lang.String[][] ns)
          Evaluate the given boolean XPath expression over the XML payload
 boolean filter(Message m, java.lang.String exprn, java.lang.String[][] ns, java.lang.String regex)
          Evaluate the given XPath expression over the XML payload and compare the resulting String value with the regular expression for a match.
 java.lang.String getAttribute(Message msg, java.lang.String exprn, java.lang.String[][] ns)
          Get attribute value e.g.
 org.w3c.dom.Document getPayloadAsDOM(Message m)
          Returns payload of the message as a DOM Document
 java.lang.String getTextElement(Message msg, java.lang.String exprn, java.lang.String[][] ns)
          Get text element value for given XPath
 void insertTextElementsAfter(Message msg, java.lang.String expression, java.lang.String[][] ns, java.lang.String qualifiedTagName, java.lang.String namespace, java.lang.String elementContent)
          Inserts an element/elements after the specified element pointed by the XPATH, to the current message.
 void insertTextElementsBefore(Message msg, java.lang.String expression, java.lang.String[][] ns, java.lang.String qualifiedTagName, java.lang.String namespace, java.lang.String elementContent)
          Inserts an element/elements before the specified element pointed by the XPATH, to the current message.
 void mergeXMLAttachmentsUnderElement(Message msg, java.lang.String rootElemName)
          Replace the current XML payload with a top level element as specified, and merge the payloads from the current body, and attachments underneath that
 void mergeXMLAttachmentsUnderElement(Message msg, java.lang.String rootElemName, java.lang.String rootNS)
          Replace the current XML payload with a top level element as specified, and merge the payloads from the current body, and attachments underneath that
 boolean remove(Message m, java.lang.String exprn, java.lang.String[][] ns)
          Remove the XPath expression specified node from the XML payload.
 void replaceAttributes(Message msg, java.lang.String expression, java.lang.String[][] ns, java.lang.String value)
          Replaces the specified attribute/s value
 void replaceTextElements(Message msg, java.lang.String expression, java.lang.String[][] ns, java.lang.String elementContent)
          Replace Text Elements pointed by an xpath expression
 void retainElementAsPayload(Message m, java.lang.String exprn, java.lang.String[][] ns)
          Replace the current XML payload with the resulting element from the XPath expression result
 void serializeJAXBObjectAsXMLStream(Message msg, java.lang.Object jaxb)
          Serialize a JAXB Object as a XML Stream message
 void serializeJAXBObjectAsXMLStream(Message msg, java.lang.Object jaxb, java.lang.String rootElement, java.lang.String uri)
          Serialize a JAXB Object as a XML Stream message
 void setPayloadFromDOM(Message m, org.w3c.dom.Document doc)
          Set the payload of the message with the DOM Document
 void splitAndProcess(Message msg, java.lang.String exprn, java.lang.String[][] ns, java.lang.String sequenceName, boolean ignoreErrors)
          Split current message into multiple messages using the given XPath expression, and hand over each such message to the given sequence
 void transform(Message msg, java.lang.String xsltFilename)
          Transform the message payload by XSLT (without any parameters), assuming a non DOM result and assuming that the complete message payload will be used as the source of the transformation, and the result will replace the complete message payload
 void transform(Message msg, java.lang.String xsltFilename, java.lang.String exprn, java.lang.String[][] ns)
          Transform the message payload by XSLT (without any parameters), assuming a non DOM result
 void transform(Message msg, java.lang.String xsltFilename, java.lang.String exprn, java.lang.String[][] ns, boolean domResult, java.util.Map parameters)
          Transform the message payload by XSLT
 void validate(Message m, java.lang.String schema)
          Validate the current message against one single schema
 void validate(Message m, java.lang.String[] schemas)
          Validate the current message against one or more schemas
 void validate(Message m, java.lang.String[] schemas, java.lang.String exprn, java.lang.String[][] ns)
          Validate the current message - or an element of it selected via an XPath expression - against one or more schemas
 

Method Detail

createDOMDocument

org.w3c.dom.Document createDOMDocument()
Create a new DOM Document object and return

Returns:
a new DOM Document

setPayloadFromDOM

void setPayloadFromDOM(Message m,
                       org.w3c.dom.Document doc)
Set the payload of the message with the DOM Document

Parameters:
m - the current message whose payload will be set with the DOM message
doc - the DOM document to be inserted as the payload

getPayloadAsDOM

org.w3c.dom.Document getPayloadAsDOM(Message m)
Returns payload of the message as a DOM Document

Parameters:
m - the current message to be passed
Returns:
A DOM document consisting content of the current payload

convertToDOM

void convertToDOM(Message m)
Convert the current message into a DOMMessage

Parameters:
m - the current message to be transformed

convertFromFI

void convertFromFI(Message m)
Convert the payload of the current message from a FastInfoset binary to an XML message (Note the XML payload is still kept as a RawFileMessage by default and maybe converted into a DOM message if required)

Parameters:
m - the current message to be transformed

convertToFI

void convertToFI(Message m)
Convert the XML message into a FastInfoset binary message

Parameters:
m - the current message to be transformed

convertDOMToSoap11

void convertDOMToSoap11(Message m)
Converts a DOM message to SOAP 1.1 by wrapping the message in a SOAP envelope and body

Parameters:
m - the current message to be processed

convertDOMToSoap12

void convertDOMToSoap12(Message m)
Converts a DOM message to SOAP 1.2 by wrapping the message in a SOAP envelope and body

Parameters:
m - the current message to be processed

convertSoapToDOM

void convertSoapToDOM(Message m)
Converts a SOAP message to DOM (POX) by stripping out the SOAP Envelope and Body and Header

Parameters:
m - the current message containing a SOAP payload to convert to DOM/POX

convertXMLToJSONStream

void convertXMLToJSONStream(Message m,
                            javax.xml.namespace.QName staringElement,
                            boolean retainNSPrefixes)
Convert the current XML message payload (which maybe available as any format such as raw file or DOM etc) into a file based JSON stream

Parameters:
m - the message to be converted
staringElement - an optional starting element to begin conversion (e.g. first element of the SOAP body)
retainNSPrefixes - retain the namespace prefixes into JSON names for elements

convertXMLToJSONStream

void convertXMLToJSONStream(Message m)
Convert the current XML message payload (which maybe available as any format such as raw file or DOM etc) into a file based JSON stream

Parameters:
m - the message to be converted

retainElementAsPayload

void retainElementAsPayload(Message m,
                            java.lang.String exprn,
                            java.lang.String[][] ns)
Replace the current XML payload with the resulting element from the XPath expression result

Parameters:
m - the current message
exprn - XPath expression selecting the node to retain
ns - optional namespaces array

mergeXMLAttachmentsUnderElement

void mergeXMLAttachmentsUnderElement(Message msg,
                                     java.lang.String rootElemName)
Replace the current XML payload with a top level element as specified, and merge the payloads from the current body, and attachments underneath that

Parameters:
msg - the message to transform
rootElemName - the new root element created

mergeXMLAttachmentsUnderElement

void mergeXMLAttachmentsUnderElement(Message msg,
                                     java.lang.String rootElemName,
                                     java.lang.String rootNS)
Replace the current XML payload with a top level element as specified, and merge the payloads from the current body, and attachments underneath that

Parameters:
msg - the message to transform
rootElemName - the new root element created
rootNS - optional namespace for the root element, or null

validate

void validate(Message m,
              java.lang.String[] schemas,
              java.lang.String exprn,
              java.lang.String[][] ns)
Validate the current message - or an element of it selected via an XPath expression - against one or more schemas

Parameters:
m - the message holding the payload for validation
schemas - an array of XSD filename to validate against. Note: the validator is sensitive to the order in which the Schemas are given. Otherwise you may end up with an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration of element"
exprn - an optional XPath expression selecting the node for validation
ns - an optional array of namespace prefixes and namespaces used within the XPath expression

validate

void validate(Message m,
              java.lang.String[] schemas)
Validate the current message against one or more schemas

Parameters:
m - the message holding the payload for validation
schemas - an array of XSD filename to validate against Note: the validator is sensitive to the order in which the Schemas are given. Otherwise you may end up with an error such as "SAXParseException: cvc-elt.1: Cannot find the declaration of element"

validate

void validate(Message m,
              java.lang.String schema)
Validate the current message against one single schema

Parameters:
m - the message holding the payload for validation
schema - a XSD filename to validate against

transform

void transform(Message msg,
               java.lang.String xsltFilename,
               java.lang.String exprn,
               java.lang.String[][] ns,
               boolean domResult,
               java.util.Map parameters)
Transform the message payload by XSLT

Parameters:
msg - current message
xsltFilename - the XSLT filename
exprn - an optional XPath expression to select the source node for XSLT, and node to replace with the result
ns - an optional array of namespace prefixes and namespace urls
domResult - is the result desired as a DOM payload? (useful for further XML processing)
parameters - any XSLT parameters to be passed to the transformation

transform

void transform(Message msg,
               java.lang.String xsltFilename,
               java.lang.String exprn,
               java.lang.String[][] ns)
Transform the message payload by XSLT (without any parameters), assuming a non DOM result

Parameters:
msg - current message
xsltFilename - the XSLT filename
exprn - an optional XPath expression to select the source node for XSLT, and node to replace with the result
ns - an optional array of namespace prefixes and namespace urls

transform

void transform(Message msg,
               java.lang.String xsltFilename)
Transform the message payload by XSLT (without any parameters), assuming a non DOM result and assuming that the complete message payload will be used as the source of the transformation, and the result will replace the complete message payload

Parameters:
msg - current message
xsltFilename - the XSLT filename

filter

boolean filter(Message m,
               java.lang.String exprn,
               java.lang.String[][] ns,
               java.lang.String regex)
Evaluate the given XPath expression over the XML payload and compare the resulting String value with the regular expression for a match. This method converts the current payload into a DOMMessage

Parameters:
m - the current message
exprn - the XPath expression to evaluate against the message payload
ns - an optional array of namespace prefixes and namespace urls
regex - an optional regular expression to evaluate the XPath results' String value against
Returns:
true if the regular expression matches the String result of the XPath expression

filter

boolean filter(Message m,
               java.lang.String exprn,
               java.lang.String[][] ns)
Evaluate the given boolean XPath expression over the XML payload

Parameters:
m - the current message
exprn - the XPath expression to evaluate against the message payload
ns - an optional array of namespace prefixes and namespace urls
Returns:
true if the XPath expression evaluates to true

addAttributeToElements

void addAttributeToElements(Message msg,
                            java.lang.String exprn,
                            java.lang.String[][] ns,
                            java.lang.String qName,
                            java.lang.String nsUri,
                            java.lang.String value)
Add an attribute to one or more elements selected by an XPath expression e.g. domSupport.addAttributeToElements(msg, "//order/symbol", null, "att1", null, "value1");

Parameters:
msg - the message where the transformation is performed
exprn - the xpath expression to select the elements where the attribute should be added
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
qName - the qualified name for the new attribute. To specify a custom prefix use it here (e.g. "myns:myqname")
nsUri - the namespace URI for the new attribute, or null (to specify a custom prefix, see qName above)
value - the new value of the attribute

getAttribute

java.lang.String getAttribute(Message msg,
                              java.lang.String exprn,
                              java.lang.String[][] ns)
Get attribute value e.g. domSupport.getAttribute(msg, "//order[1]/symbol/@att1", null)

Parameters:
msg - the message to read the attribute from
exprn - the xpath expression to the element where the attribute should be added
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
Returns:
the value of the attribute

deleteAttributes

void deleteAttributes(Message msg,
                      java.lang.String exprn,
                      java.lang.String[][] ns)
Deletes the specified attribute/s e.g. domSupport.deleteAttributes(msg, "//order/symbol/@s:att2", ns);

Parameters:
msg - the current message containing the payload
exprn - the xpath expression to the attributes, which are to be deleted
ns - an optional array of namespace prefixes and namespaces used within the XPath expression

replaceAttributes

void replaceAttributes(Message msg,
                       java.lang.String expression,
                       java.lang.String[][] ns,
                       java.lang.String value)
Replaces the specified attribute/s value

Parameters:
msg - the current message containing the payload
expression - the xpath expression to the attribute, which is to be replaced
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
value - the new value of the attribute

addTextElementsAsChild

void addTextElementsAsChild(Message msg,
                            java.lang.String expression,
                            java.lang.String[][] ns,
                            java.lang.String qualifiedTagName,
                            java.lang.String namespace,
                            java.lang.String elementContent)
Inserts Text Element as a child to the specified elements pointed by an xpath expression

Parameters:
msg - the current message containing the payload
expression - the xpath expression to the node/s, which will be the parent for the new node/s
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
qualifiedTagName - the qualified name of the new element to be added
namespace - an optional String specifying the namespace url of the new element
elementContent - the text content of the new element

addElementsAsChild

void addElementsAsChild(Message msg,
                        java.lang.String expression,
                        java.lang.String[][] ns,
                        java.lang.String qualifiedTagName,
                        java.lang.String namespace)
Inserts Element as a child to the specified elements pointed by an xpath expression

Parameters:
msg - the current message containing the payload
expression - the xpath expression to the node/s, which will be the parent for the new node/s
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
qualifiedTagName - the qualified name of the new element to be added
namespace - an optional String specifying the namespace url of the new element

getTextElement

java.lang.String getTextElement(Message msg,
                                java.lang.String exprn,
                                java.lang.String[][] ns)
Get text element value for given XPath

Parameters:
msg - the message to read the attribute from
exprn - the xpath expression to the element where the text content should be read
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
Returns:
the value of the attribute

replaceTextElements

void replaceTextElements(Message msg,
                         java.lang.String expression,
                         java.lang.String[][] ns,
                         java.lang.String elementContent)
Replace Text Elements pointed by an xpath expression

Parameters:
msg - the current message containing the payload
expression - the xpath expression to the text elements to be replaced
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
elementContent - the text content of the new element/s

deleteElements

void deleteElements(Message msg,
                    java.lang.String expression,
                    java.lang.String[][] ns)
Delete Elements pointed by an xpath expression

Parameters:
msg - the current message containing the payload
expression - the xpath expression to the text elements to be replaced
ns - an optional array of namespace prefixes and namespaces used within the XPath expression

insertTextElementsBefore

void insertTextElementsBefore(Message msg,
                              java.lang.String expression,
                              java.lang.String[][] ns,
                              java.lang.String qualifiedTagName,
                              java.lang.String namespace,
                              java.lang.String elementContent)
Inserts an element/elements before the specified element pointed by the XPATH, to the current message. If the XPath expression points to multiple elements, new element will be added before all the elements pointed by the XPath. The content of the new element should be String. No complex types are allowed.

Parameters:
msg - the current message containing the payload
expression - the xpath expression to the node, where the new element should be added before
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
qualifiedTagName - the qualified tag name of the new element to be added
namespace - namespace uri for the new tag
elementContent - the content of the new element

insertTextElementsAfter

void insertTextElementsAfter(Message msg,
                             java.lang.String expression,
                             java.lang.String[][] ns,
                             java.lang.String qualifiedTagName,
                             java.lang.String namespace,
                             java.lang.String elementContent)
Inserts an element/elements after the specified element pointed by the XPATH, to the current message. If the XPath expression points to multiple elements, new element will be added after all the elements pointed by the XPath.The content of the new element should be String. No complex types are allowed.

Parameters:
msg - the current message containing the payload
expression - the xpath expression to the node, where the new element should be added after
ns - an optional array of namespace prefixes and namespaces used within the XPath expression
qualifiedTagName - the qualified tag name of the new element to be added
namespace - namespace uri for the new tag
elementContent - the content of the new element

remove

boolean remove(Message m,
               java.lang.String exprn,
               java.lang.String[][] ns)
Remove the XPath expression specified node from the XML payload. This method converts the current payload of the message into a DOMMessage

Parameters:
m - the current message
exprn - the XPath expression to evaluate against the message payload
ns - an optional array of namespace prefixes and namespace urls
Returns:
true if the node was removed, false if not

extractAsStringUsingXPath

java.lang.String extractAsStringUsingXPath(Message m,
                                           java.lang.String exprn,
                                           java.lang.String[][] ns)
Evaluate the given XPath expression against the XML payload, and return result as a String This method converts the current payload into a DOMMessage

Parameters:
m - the current message
exprn - the XPath expression to evaluate against the message payload
ns - an optional array of namespace prefixes and namespace urls
Returns:
the result of the XPath expression as a String, or null

extractAsNodeListUsingXPath

org.w3c.dom.NodeList extractAsNodeListUsingXPath(Message m,
                                                 java.lang.String exprn,
                                                 java.lang.String[][] ns)
Evaluate the given XPath expression against the XML payload, and return result as a NodeList This method converts the current payload into a DOMMessage

Parameters:
m - the current message
exprn - the XPath expression to evaluate against the message payload
ns - an optional array of namespace prefixes and namespace urls
Returns:
the result of the XPath expression as a NodeList, or null

splitAndProcess

void splitAndProcess(Message msg,
                     java.lang.String exprn,
                     java.lang.String[][] ns,
                     java.lang.String sequenceName,
                     boolean ignoreErrors)
                     throws java.lang.Exception
Split current message into multiple messages using the given XPath expression, and hand over each such message to the given sequence

Parameters:
msg - the current message to be split and processed
exprn - the XPath expression to split the message at
ns - name spaces used
sequenceName - the sequence to invoke on each resulting message
ignoreErrors - ignore any errors encountered during sequence execution
Throws:
java.lang.Exception - if the invoked sequence throws an exception

convertXMLToJAXBObject

java.lang.Object convertXMLToJAXBObject(Message msg,
                                        java.lang.Class clazz)
Converts a XML payload into a JAXB Object. This does NOT modify the current message

Parameters:
msg - the current message to read the payload from
clazz - the JAXB class to convert the payload into
Returns:
an Object of the specified class if the payload was successfully converted

serializeJAXBObjectAsXMLStream

void serializeJAXBObjectAsXMLStream(Message msg,
                                    java.lang.Object jaxb,
                                    java.lang.String rootElement,
                                    java.lang.String uri)
Serialize a JAXB Object as a XML Stream message

Parameters:
msg - the current message to write the Object into as a XML stream
jaxb - the JAXB Object to serialize
rootElement - root element local name for serialization
uri - namespace uri for the root element

serializeJAXBObjectAsXMLStream

void serializeJAXBObjectAsXMLStream(Message msg,
                                    java.lang.Object jaxb)
Serialize a JAXB Object as a XML Stream message

Parameters:
msg - the current message to write the Object into as a SOAP 1.1 stream
jaxb - the JAXB Object to serialize

Copyright (c) 2010-2012 AdroitLogic Private Ltd. All rights reserved.