|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.configuration.XMLConfiguration
org.osesb.msgrouting.configuration.XMLMessageTypeXPathExpressionListConfiguration
public class XMLMessageTypeXPathExpressionListConfiguration
Encapsulates a <xmlmessage-messagetype-xpathexpression-list>
configuration element, which configures XPath expressions for
extracting message types from XML messages using the default
implementation of XMLMessageTypeHelper, which is
DefaultXMLMessageTypeHelper.
<messagetype-to-messagepipeline-map> configuration
element of a MessageRouterConfiguration to map message types
to MessagePipelines.
See the org.osesb.messagepipeline package.
See the org.osesb.transporthandlers package in the transport-handlers module.
There are two ways that the message type for an incoming message
is determined:
<xmlmessage-messagetype-xpathexpression-list> configuration
element for a namespace-qualified XPath expression:
<xmlmessage-messagetype-xpathexpression-list> content model looks like:
<xmlmessage-messagetype-xpathexpression-list>
<!--
namespace-qualified XPath expressions.
the configured xpath expressions are applied to
xml messages that include a namespace declaration
that is equal to the namespaceURI attribute.
Declared namespaces are searched for in the following order:
1. Namespaces declared using a 'xmlns' attribute of the root element.
2. The 'targetNamespace' attribute of the root element.
3. The namespaceURI portion of the 'schemaLocation' attribute of the root element.
All xpathExpressions are applied until a messageType is found.
-->
<xmlmessage namespaceURI="http://osesb.test.com">
<!-- SiebelToGetBasicInfoByAcctNumResponseBroker.xml -->
<xpathExpression>SiebelMessage/@MessageId</xpathExpression>
<!-- IVRToGetBasicInfoByAcctNumRequestBroker.xml -->
<xpathExpression>IVRMessage/@messageType</xpathExpression>
<!-- WebSiteAddressChangeMessage.xml -->
<xpathExpression>WebSiteMessage/@MessageType</xpathExpression>
</xmlmessage>
<!-- ipo.xml -->
<xmlmessage namespaceURI="http://www.altova.com/IPO">
<xpathExpression>//@msgType</xpathExpression>
</xmlmessage>
<!--
unqualified XPath expressions are applied to XML
after namespace-qualified XPath expressions.
All xpathExpressions are applied until a messageType is found.
-->
<xmlmessage>
<!-- reservation.xml -->
<xpathExpression>/Reservation/MessageType</xpathExpression>
<!-- RewardsGetPoints.xml-->
<xpathExpression>/getPoints</xpathExpression>
<!-- RewardsUpdatePoints.xml -->
<xpathExpression>/updatePoints</xpathExpression>
</xmlmessage>
</xmlmessage-messagetype-xpathexpression-list>
To configure a MessageRouter with a different XMLMessageTypeHelper, create a
class that extends AbstractXMLMessageTypeHelper and use the
<xmlMessagetypeHelperConfiguration> content model element of the
MessageRouterConfiguration.
| Field Summary | |
|---|---|
protected java.util.Map |
qualifiedXPathExpressionMap
A Map of namespace-qualified XPath expressions, keyed by the value of the namespaceURI attribute of the XMLMESSAGE_TAGNAME element where each Map entry is a List of XPath expressions that are associated with the namespaceURI. |
protected java.util.ArrayList |
unqualifiedXPathExpressionList
ArrayList of the configured unqualified XPath expressions. |
static java.lang.String |
XMLMESSAGE_TAGNAME
Repeating tag name within a <xmlmessage-messagetype-xpathexpression-list>
configuration element. |
static java.lang.String |
XMLMESSAGETYPEXPATHEXPRESSIONLIST_CONTENTMODEL
The default XMLMessageTypeXPathExpressionListConfiguration content model tag name. |
static java.lang.String |
XPATHEXPRESSION_TAGNAME
Tag name of XPath expressions within a XMLMESSAGE_TAGNAME. |
| Fields inherited from class org.osesb.configuration.XMLConfiguration |
|---|
configFilePath, configurationProperties, constructedFromConfigFile, contentModelElement, ftpClientConfiguration, jaxrpcClientConfiguration, jdbcConfiguration, jmsClientConfiguration, log, rootConfigurationAttributes, smtpClientConfiguration, systemProperties, thisClassName |
| Constructor Summary | |
|---|---|
XMLMessageTypeXPathExpressionListConfiguration()
Creates a new empty instance of XMLMessageTypeXPathExpressionListConfiguration. |
|
XMLMessageTypeXPathExpressionListConfiguration(org.w3c.dom.Element contentModelElement)
Creates a new instance of XMLMessageTypeXPathExpressionListConfiguration given the content model Element that encloses the XMLMESSAGE_TAGNAME Elements. |
|
XMLMessageTypeXPathExpressionListConfiguration(java.lang.String configFile)
Creates a new instance of XMLMessageTypeXPathExpressionListConfiguration given a XML configuration file. |
|
XMLMessageTypeXPathExpressionListConfiguration(java.lang.String configFile,
java.lang.String xpathExpression)
Creates a new instance of XMLMessageTypeXPathExpressionListConfiguration given a XML configuration file and a XPath expression that evaluates to the element that marks the beginning of the configuration. |
|
| Method Summary | |
|---|---|
java.util.List |
getNamespaceQualifiedMessageTypeXPathExpressions(java.lang.String namespaceURI)
Return the List of configured namespace-qualified message type XPath expressions for a namespaceURI. |
java.util.List |
getUnqualifiedMessageTypeXPathExpressions()
Return the List of configured unqualified message type XPath expressions. |
protected void |
loadXPathExpressions()
Loads the <xmlmessage-messagetype-xpathexpression-list>
element and populates the:
unqualifiedXPathExpressionList, which is a List of XPath
expressions that are not associated with any namespace.
qualifiedXPathExpressionMap, which is a Map of
namespace-qualified XPath expressions, keyed by the value of the
namespaceURI attribute of the XMLMESSAGE_TAGNAME element where
each Map entry is a List of XPath expressions that are associated
with the namespaceURI.
Example configuration:
|
static void |
main(java.lang.String[] args)
main() For testing and sandboxing. |
java.lang.String |
toString()
Returns the String representation of this XMLMessageTypeXPathExpressionListConfiguration. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String XMLMESSAGETYPEXPATHEXPRESSIONLIST_CONTENTMODEL
public static java.lang.String XMLMESSAGE_TAGNAME
<xmlmessage-messagetype-xpathexpression-list>
configuration element. Tags can be namespace-qualified or not and
enclose one or more XPath expressions.
public static java.lang.String XPATHEXPRESSION_TAGNAME
protected java.util.ArrayList unqualifiedXPathExpressionList
protected java.util.Map qualifiedXPathExpressionMap
| Constructor Detail |
|---|
public XMLMessageTypeXPathExpressionListConfiguration()
public XMLMessageTypeXPathExpressionListConfiguration(java.lang.String configFile)
throws java.lang.Exception
configFile - The path to the XML configuration file, which
is specified as a resource path or as a file system
path that is relative to the path specified
by the ConfigurationConstants.CONFIG_PATH_SYSTEMPROPERTY
System Property.
java.lang.Exception - if there is a problem reading or parsing the
configuration file.
public XMLMessageTypeXPathExpressionListConfiguration(java.lang.String configFile,
java.lang.String xpathExpression)
throws java.lang.Exception
configFile - The path to the XML configuration file, which
is specified as a resource path or as a file system
path that is relative to the path specified
by the ConfigurationConstants.CONFIG_PATH_SYSTEMPROPERTY
System Property.xpathExpression - A XPath expression that evaluates to the
element that marks the beginning of the
configuration.
java.lang.Exception - if there is a problem reading or parsing the
configuration file.
public XMLMessageTypeXPathExpressionListConfiguration(org.w3c.dom.Element contentModelElement)
throws java.lang.Exception
contentModelElement - the content model Element that
encloses the XMLMESSAGE_TAGNAME Elements.
java.lang.Exception - if there is a fatal error transversing the
configuration content model enclosed by contentModelElement.| Method Detail |
|---|
protected final void loadXPathExpressions()
throws java.lang.Exception
<xmlmessage-messagetype-xpathexpression-list>
element and populates the:
<xmlmessage-messagetype-xpathexpression-list>
<!--
namespace-qualified XPath expressions
-->
<xmlmessage namespaceURI = "http://osesb.test.com">
<!-- SiebelToGetBasicInfoByAcctNumResponseBroker.xml -->
<xpathExpression>SiebelMessage/@MessageId</xpathExpression>
<!-- IVRToGetBasicInfoByAcctNumRequestBroker.xml -->
<xpathExpression>IVRMessage/@messageType</xpathExpression>
<!-- WebSiteAddressChangeMessage.xml -->
<xpathExpression>WebSiteMessage/@MessageType</xpathExpression>
</xmlmessage>
<!-- ipo.xml -->
<xmlmessage namespaceURI = "http://www.altova.com/IPO">
<xpathExpression>//@msgType</xpathExpression>
</xmlmessage>
<!--
unqualified XPath expressions
-->
<xmlmessage namespaceURI = "">
<!-- reservation.xml -->
<xpathExpression>/Reservation/MessageType</xpathExpression>
<!-- RewardsGetPoints.xml AND RewardsUpdatePoints.xml -->
<xpathExpression>/*</xpathExpression>
</xmlmessage>
</xmlmessage-messagetype-xpathexpression-list>
Note that this method should not be overridden as it is invoked
from this class's constructor.
java.lang.Exception - if there is a fatal error transversing the
content models.public java.util.List getNamespaceQualifiedMessageTypeXPathExpressions(java.lang.String namespaceURI)
namespaceURI - The namespaceURI to get the XPath expression for.
public java.util.List getUnqualifiedMessageTypeXPathExpressions()
public java.lang.String toString()
toString in class XMLConfigurationpublic static void main(java.lang.String[] args)
args - commandline arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||