org.osesb.msgrouting.configuration
Class XMLMessageTypeHelperConfiguration

java.lang.Object
  extended by org.osesb.configuration.XMLConfiguration
      extended by org.osesb.msgrouting.configuration.XMLMessageTypeHelperConfiguration

public class XMLMessageTypeHelperConfiguration
extends XMLConfiguration

XMLMessageTypeHelperConfiguration is not a stand-alone configuration class; it configures a XMLMessageTypeHelper within a MessageRouterConfiguration.

XMLMessageTypeHelperConfiguration encapsulates the <xmlMessagetypeHelperConfiguration> element of the MessageRouterConfiguration, which configures the XMLMessageTypeHelper that is used by a MessageRouter to extract message types from XML messages.

Out of the box, osESB provides two XMLMessageTypeHelper classes, both descendants of org.osesb.msgrouting.AbstractXMLMessageTypeHelper:

The <xmlMessagetypeHelperConfiguration> content model element looks like:

<xmlMessagetypeHelperConfiguration>
              <!-- The MessagetypeHelper class. -->
              <helper-class>org.osesb.msgrouting.test.CustomTestXMLMessageTypeHelper_Test2</helper-class>
              <!--
                  A fully qualified helper configuration class name is optional.

                  If <helper-config> is empty, then this element is not used.
                  If <helper-config> is not empty, then the specified class is
                  constructed from the <helper-config> element. If <helper-config>
                  is not empty and this element is not specified, then a XMLConfiguration
                  is constructed from the <helper-config> element.

                  If a helper configuration is constructed, then it is passed
                  to the constructor of the <helper-class> when the helper class
                  is constructed by MessageRouter.
              -->
              <helper-config-class>org.osesb.msgrouting.configuration.XMLMessageTypeXPathExpressionListConfiguratio</helper-config-class>
              <helper-config>
                  The configuration content model for the helper class.
                  See XMLMessageTypeXPathExpressionListConfiguration and DroolsXMLMessageTypeHelperConfiguration
              </helper-config>
      </xmlMessagetypeHelperConfiguration>
 

A message entering osESB through one of the transport handlers (see the org.osesb.transporthandlers package) must have a message type. Since osESB is configured mostly to handle XML messages (possibly with attachments) the message type is a QName where the namespaceURI is the namespace of the XML message and the local part is given by an element or attribute in the message.

Transport handlers 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.

DefaultXMLMessageTypeHelper is the default XMLMessageTypeHelper class and is constructed with a XMLMessageTypeXPathExpressionListConfiguration. DefaultXMLMessageTypeHelper applies the configured XPath expressions to a XML message until a messageType is determined. DefaultXMLMessageTypeHelper#getMessagetype() returns the messageType as a QName, where the namespaceURI is the XML document namespace (if any) and the localPart is the value for the element or attribute that is given by a XPath expression.

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  XMLConfiguration helperConfiguration
          The configuration for the XMLMessageTypeHelper class given by the <helper-class> tag.
static java.lang.String XMLMESSAGETYPEHELPERCONFIG_CONTENTMODEL
          XMLMessageTypeHelperConfiguration content model tag.
 
Fields inherited from class org.osesb.configuration.XMLConfiguration
configFilePath, configurationProperties, constructedFromConfigFile, contentModelElement, ftpClientConfiguration, jaxrpcClientConfiguration, jdbcConfiguration, jmsClientConfiguration, log, rootConfigurationAttributes, smtpClientConfiguration, systemProperties, thisClassName
 
Constructor Summary
XMLMessageTypeHelperConfiguration()
          Creates a new empty instance of XMLMessageTypeHelperConfiguration.
XMLMessageTypeHelperConfiguration(org.w3c.dom.Element contentModelElement)
          Creates a new instance of XMLMessageTypeHelperConfiguration given the content model Element that encloses the configuration.
XMLMessageTypeHelperConfiguration(java.lang.String configFile)
          Creates a new instance of XMLMessageTypeHelperConfiguration given a XML configuration file.
XMLMessageTypeHelperConfiguration(java.lang.String configFile, java.lang.String xpathExpression)
          Creates a new instance of XMLMessageTypeHelperConfiguration given a XML configuration file and a XPath expression that evaluates to the element that marks the beginning of the configuration.
 
Method Summary
 java.lang.String getHelperClassNameName()
          Returns the name of the XMLMessageTypeHelper class.
 XMLConfiguration getHelperConfiguration()
          Returns the helperConfiguration, which is enclosed by the <helper-config> element, which contains the application-specific properties that are required by the XMLMessageTypeHelper.
 java.lang.String getHelperConfigurationClassNameName()
          Returns the name of the class used to configure the XMLMessageTypeHelper.
protected  void loadHelperConfiguration()
          Loads the <helper-config> element into this.helperConfiguration.
static void main(java.lang.String[] args)
          main() For testing.
 void setConfigFilePath(java.lang.String configFile)
          Set the configuration file name.
 void setDebugFlag(boolean debugFlag)
          Set the debugFlag.
 java.lang.String toString()
          Returns the String representation of this MessageRouterConfiguration.
 
Methods inherited from class org.osesb.configuration.XMLConfiguration
checkXMLConfigurationClass, clear, doEncryptionInstructions, getBooleanConfigurationProperty, getBooleanRootConfigurationAttribute, getConfigFilePath, getConfigurationAttribute, getConfigurationAttributes, getConfigurationElement, getConfigurationElements, getConfigurationProperties, getConfigurationProperty, getConfigurationProperty, getContentModelElement, getDebugFlag, getDocument, getEncryptionInstructions, getFTPClientConfiguration, getIntConfigurationProperty, getIntRootConfigurationAttribute, getJAXRPCClientConfiguration, getJDBCConfiguration, getJMSClientConfiguration, getLongConfigurationProperty, getLongRootConfigurationAttribute, getName, getRootConfigurationAttribute, getRootConfigurationAttributes, getSMTPClientConfiguration, getSystemProperties, getSystemProperty, isConfigurationElementEmpty, loadConfiguration, loadExternalConfiguration, loadFTPClientConfiguration, loadJAXRPCClientConfiguration, loadJDBCConfiguration, loadJMSClientConfiguration, loadPropertiesFromContentModel, loadSMTPClientConfiguration, loadSystemProperties, mergeConfigurationProperties, setConfigurationProperty, setFTPClientConfiguration, setJAXRPCClientConfiguration, setJDBCConfiguration, setJMSClientConfiguration, setName, setRootConfigurationAttribute, setSMTPClientConfiguration, setSystemProperties, setSystemProperty, writeConfigurationFile, writeConfigurationFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

helperConfiguration

protected XMLConfiguration helperConfiguration
The configuration for the XMLMessageTypeHelper class given by the <helper-class> tag. The helperConfiguration is enclosed by the <helper-config> tag and the specific helperConfiguration class is given by the <helper-config-class> tag. helperConfiguration must extend XMLConfiguration.

See Also:
loadHelperConfiguration()

XMLMESSAGETYPEHELPERCONFIG_CONTENTMODEL

public static final java.lang.String XMLMESSAGETYPEHELPERCONFIG_CONTENTMODEL
XMLMessageTypeHelperConfiguration content model tag.

See Also:
Constant Field Values
Constructor Detail

XMLMessageTypeHelperConfiguration

public XMLMessageTypeHelperConfiguration()
Creates a new empty instance of XMLMessageTypeHelperConfiguration.


XMLMessageTypeHelperConfiguration

public XMLMessageTypeHelperConfiguration(java.lang.String configFile)
                                  throws java.lang.Exception
Creates a new instance of XMLMessageTypeHelperConfiguration given a XML configuration file. The root element of the XML configuration file is the starting element for the configuration.

Parameters:
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.
Throws:
java.lang.Exception - if there is a problem reading or parsing the configuration file.

XMLMessageTypeHelperConfiguration

public XMLMessageTypeHelperConfiguration(java.lang.String configFile,
                                         java.lang.String xpathExpression)
                                  throws java.lang.Exception
Creates a new instance of XMLMessageTypeHelperConfiguration given a XML configuration file and a XPath expression that evaluates to the element that marks the beginning of the configuration.

An empty xpathExpression implies that the root element of the XML configuration file is the starting element for the configuration.

Parameters:
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.
Throws:
java.lang.Exception - if there is a problem reading or parsing the configuration file.

XMLMessageTypeHelperConfiguration

public XMLMessageTypeHelperConfiguration(org.w3c.dom.Element contentModelElement)
                                  throws java.lang.Exception
Creates a new instance of XMLMessageTypeHelperConfiguration given the content model Element that encloses the configuration.

Parameters:
contentModelElement - the content model Element that encloses the configuration.
Throws:
java.lang.Exception - if there is a fatal error transversing the configuration content model enclosed by contentModelElement.
Method Detail

loadHelperConfiguration

protected final void loadHelperConfiguration()
                                      throws java.lang.Exception
Loads the <helper-config> element into this.helperConfiguration.

Throws:
java.lang.Exception - if there is a fatal error transversing the content model.

getHelperClassNameName

public java.lang.String getHelperClassNameName()
Returns the name of the XMLMessageTypeHelper class.

Returns:
the name of the XMLMessageTypeHelper class.

getHelperConfigurationClassNameName

public java.lang.String getHelperConfigurationClassNameName()
Returns the name of the class used to configure the XMLMessageTypeHelper.

Returns:
the name of the class used to configure the XMLMessageTypeHelper.

getHelperConfiguration

public XMLConfiguration getHelperConfiguration()
Returns the helperConfiguration, which is enclosed by the <helper-config> element, which contains the application-specific properties that are required by the XMLMessageTypeHelper.

Returns:
the helperConfiguration as an XMLConfiguration.

setConfigFilePath

public void setConfigFilePath(java.lang.String configFile)
Set the configuration file name.

Overrides:
setConfigFilePath in class XMLConfiguration
Parameters:
configFile - the configuration file name.

setDebugFlag

public void setDebugFlag(boolean debugFlag)
Set the debugFlag.

Overrides:
setDebugFlag in class XMLConfiguration
Parameters:
debugFlag - The debugFlag.

toString

public java.lang.String toString()
Returns the String representation of this MessageRouterConfiguration.

Overrides:
toString in class XMLConfiguration
Returns:
the String representation of this MessageRouterConfiguration.

main

public static void main(java.lang.String[] args)
main() For testing.

Parameters:
args - commandline arguments