|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.msgrouting.AbstractXMLMessageTypeHelper
org.osesb.msgrouting.DefaultXMLMessageTypeHelper
public class DefaultXMLMessageTypeHelper
The default implementation of XMLMessageTypeHelper, which applies a List of XPath expressions to a XML message in order to extract the message type.
A messageType is typically represented as a QName where the namespaceURI is extracted from the XML message and where the localPart is determined by the message content either directly (see DefaultXMLMessageTypeHelper) or indirectly (see DroolsXMLMessageTypeHelper). Transport handlers and ClientGateway(s) use a MessageRouter to route messages to a org.osesb.messagepipeline.MessagePipeline for processing. The MessageRouter selects the MessagePipeline based on the message's messageType. The MessageRouter uses the<messagetype-to-messagepipeline-map> configuration
element of a MessageRouterConfiguration to map message types
to MessagePipelines.
See the org.osesb.messagepipeline package.
See org.osesb.msgrouting.ClientGateway.
See the org.osesb.transporthandlers package in the transport-handlers module.
There are two ways that the message type is determined:
<xmlmessage-messagetype-xpathexpression-list> configuration
element for a namespace-qualified XPath expression:
<xmlMessagetypeHelperConfiguration> content model element of the
MessageRouterConfiguration.
| Field Summary | |
|---|---|
protected DocumentNamespaceHelper |
documentNamespaceHelper
DocumentNamespaceHelper extracts namespaces from the target XML. |
protected static org.apache.commons.logging.Log |
log
The logging implementation for this class. |
protected SAXXPathElementHandler |
saxXPathElementHandler
SAX handler that stops processing when it finds the first target element based on a XPath expression. |
protected java.lang.String |
thisClassName
The full name of this class. |
protected XMLMessageTypeXPathExpressionListConfiguration |
xmlMessageTypeXPathExpressionListConfiguration
The configuration of XPath expressions that evaluate to a message type. |
| Fields inherited from class org.osesb.msgrouting.AbstractXMLMessageTypeHelper |
|---|
debugFlag |
| Constructor Summary | |
|---|---|
DefaultXMLMessageTypeHelper(XMLMessageTypeXPathExpressionListConfiguration xmlMessageTypeXPathExpressionListConfiguration)
Creates a new instance of DefaultXMLMessageTypeHelper. |
|
| Method Summary | |
|---|---|
javax.xml.namespace.QName |
getMessageType(java.lang.String xmlText)
Get a message type from a XML message using the following ordered lookup: Apply namespace-qualified XPath expressions until a messageType is found. Apply uqualified XPath expressions until a messageType is found. |
protected javax.xml.namespace.QName |
getNamespaceQualifiedMessageType(java.lang.String xmlText)
Extract the message type from a XML message using namespace-qualified xpathExpressions. |
protected javax.xml.namespace.QName |
getUnqualifiedMessageType(java.lang.String xmlText)
Extract the message type from a XML message using unqualified namespace message type locations. |
static void |
main(java.lang.String[] args)
Main method for testing. |
protected javax.xml.namespace.QName |
parseForMessageType(java.lang.String xmlText,
java.lang.String namespaceURI,
java.lang.String xpathExpression)
Invoked by getNamespaceQualifiedMessageType() and getUnqualifiedMessageType() to extract the message type from xmlText using a XPath expression. |
void |
setDebugFlag(boolean debugFlag)
Set the debugFlag for this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
protected java.lang.String thisClassName
protected XMLMessageTypeXPathExpressionListConfiguration xmlMessageTypeXPathExpressionListConfiguration
protected DocumentNamespaceHelper documentNamespaceHelper
protected SAXXPathElementHandler saxXPathElementHandler
| Constructor Detail |
|---|
public DefaultXMLMessageTypeHelper(XMLMessageTypeXPathExpressionListConfiguration xmlMessageTypeXPathExpressionListConfiguration)
throws java.lang.Exception
xmlMessageTypeXPathExpressionListConfiguration - that configures
message type locations in the population of XML messages as xpathExpressions.
java.lang.Exception - if constructed with a null xmlMessageTypeXPathExpressionListConfiguration.| Method Detail |
|---|
public javax.xml.namespace.QName getMessageType(java.lang.String xmlText)
throws java.lang.Exception,
MessageTypeNotFoundException
getMessageType in class AbstractXMLMessageTypeHelperxmlText - The XML text to extract the message type from.
java.lang.Exception - if there was a general error extracting the message type.
MessageTypeNotFoundException - if the message type
was not found.
protected javax.xml.namespace.QName getNamespaceQualifiedMessageType(java.lang.String xmlText)
throws java.lang.Exception
<xmlmessage-messagetype-xpathexpression-list> configuration
element for a namespace-qualified XPath expression:
xmlText - The XML text to extract the message type from.
java.lang.Exception - if an error is encountered while searching the XML for
a namespace-qualified message type.
protected javax.xml.namespace.QName getUnqualifiedMessageType(java.lang.String xmlText)
throws java.lang.Exception
xmlText - The XML text to extract the message type from.
java.lang.Exception - if an error is encountered while searching the XML for
a unqualified message type.
protected javax.xml.namespace.QName parseForMessageType(java.lang.String xmlText,
java.lang.String namespaceURI,
java.lang.String xpathExpression)
throws java.lang.Exception
xmlText - The XML text to extract the message type from.namespaceURI - The URI for the namespace that the message type
belongs to.xpathExpression - The xpathExpression that resolves to the element
or attribute that defines the message type.
java.lang.Exceptionpublic void setDebugFlag(boolean debugFlag)
setDebugFlag in class AbstractXMLMessageTypeHelperdebugFlag - If true, debug messages are logged.public static void main(java.lang.String[] args)
args - The test data directory.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||