org.osesb.messagepipeline.configuration
Class XMLValidationPipelineStageConfiguration

java.lang.Object
  extended by org.osesb.configuration.XMLConfiguration
      extended by org.osesb.configuration.DataSetConfiguration
          extended by org.osesb.messagepipeline.configuration.StandardPipelineStageConfiguration
              extended by org.osesb.messagepipeline.configuration.XMLValidationPipelineStageConfiguration

public class XMLValidationPipelineStageConfiguration
extends StandardPipelineStageConfiguration

XMLValidationPipelineStageConfiguration configures a XMLValidationPipelineStage, which is a PipelineStage that uses SAX to check that XML is well-formed or valid against one or more schemas.

XMLValidationPipelineStage expects a stage configuration that is a XMLValidationPipelineStageConfiguration, which extends StandardPipelineStageConfiguration to include a <xml-validation-configuration> element that configures validation properties and an optional XMLArtifactListConfiguration, which configures schema files as File URLs or as entries in the configured instance of the XMLRepository.

Validation properties are:

The XMLValidationPipelineStageConfiguration within the <stage-configuration> element of a PipelineStageConfiguration looks like:

<stage-configuration>
          <standard-pipelinestage-configuration name="">

              <!-- validation configuration -->
              <xml-validation-configuration>
                  <!-- true/false, if true the XML is checked as being well-formed.-->
                  <checkWellFormed>true</checkWellFormed>
                  <!--
                      schema validation levels are:

                      - off, no schema validation.
                      - warn, XML is validated against schema(s). runStage() logs a warning
                        for invalid XML; runStage() does not throw a PipelineStageException.
                      - reject, XML is validated against schema(s). If the XML is invalid,
                        runStage() throws a PipelineStageException with a nested Exception
                        for the specific error.

                      Finally, if schemaDoesNotExistIsError is true and a schema does not exist,
                      and if the schema validation level is 'reject', then runStage() throws a
                      PipelineStageException.
                  -->
                  <xmlSchemaValidationLevel schemaDoesNotExistIsError="true">reject</xmlSchemaValidationLevel>
              </xml-validation-configuration>

              <!-- XMLArtifactListConfiguration of schema files -->
              <xmlArtifacts name="">
              </xmlArtifacts>
          </standard-pipelinestage-configuration>
      </stage-configuration>
 


Field Summary
static java.lang.String XML_VALIDATION_CONFIG_CONTENTMODEL
          xmlValidationConfiguration content model tag.
protected  XMLConfiguration xmlValidationConfiguration
          An XMLConfiguration for the <xml-validation-configuration>.
 
Fields inherited from class org.osesb.messagepipeline.configuration.StandardPipelineStageConfiguration
STANDARD_PIPELINE_STAGE_CONFIG_CONTENTMODEL, xmlArtifactListConfiguration, xpathExpressionListConfiguration
 
Fields inherited from class org.osesb.configuration.DataSetConfiguration
sqlStatementListConfiguration
 
Fields inherited from class org.osesb.configuration.XMLConfiguration
configFilePath, configurationProperties, constructedFromConfigFile, contentModelElement, ftpClientConfiguration, jaxrpcClientConfiguration, jdbcConfiguration, jmsClientConfiguration, log, rootConfigurationAttributes, smtpClientConfiguration, systemProperties, thisClassName
 
Constructor Summary
XMLValidationPipelineStageConfiguration(org.w3c.dom.Element contentModelElement)
          Creates a new instance of XMLValidationPipelineStageConfiguration given the content model Element.
XMLValidationPipelineStageConfiguration(java.lang.String configFile)
          Creates a new instance of XMLValidationPipelineStageConfiguration given a XML configuration file.
XMLValidationPipelineStageConfiguration(java.lang.String configFile, java.lang.String xpathExpression)
          Creates a new instance of XMLValidationPipelineStageConfiguration given a XML configuration file and a XPath expression that evaluates to the element that marks the beginning of the configuration.
 
Method Summary
 boolean getCheckWellFormed()
          Returns the checkWellFormed property, which determines whether or not XMLValidationPipelineStageConfiguration#runStage() checks if XML is well-formed.
 boolean getSchemaDoesNotExistIsError()
          Returns the schemaDoesNotExistIsError property.
 java.lang.String getXMLSchemaValidationLevel()
          Returns the xmlSchemaValidationLevel property.
 XMLConfiguration getXMLValidationConfiguration()
          Returns the XMLValidationConfiguration within this XMLValidationPipelineStageConfiguration.
protected  void loadxmlValidationConfiguration()
          Loads the xmlValidationConfiguration.
static void main(java.lang.String[] args)
          main() For testing and sandboxing.
 void setCheckWellFormed(boolean checkWellFormed)
          Sets the checkWellFormed property, which determines whether or not XMLValidationPipelineStageConfiguration#runStage() checks if XML is well-formed.
 void setConfigFilePath(java.lang.String configFile)
          Set the configuration file name.
 void setSchemaDoesNotExistIsError(boolean schemaDoesNotExistIsError)
          Sets the schemaDoesNotExistIsError property.
 void setXMLSchemaValidationLevel(java.lang.String xmlSchemaValidationLevel)
          Sets the xmlSchemaValidationLevel property.
 java.lang.String toString()
          Returns the String representation of this StandardPipelineStageConfiguration.
 
Methods inherited from class org.osesb.messagepipeline.configuration.StandardPipelineStageConfiguration
getSchema, getXMLArtifactAsFile, getXMLArtifactListConfiguration, getXPathExpression, getXPathExpressionListConfiguration, getXPathExpressionProperties, getXPathExpressionProperty, getXSLTemplate, loadEnclosedXMLConfigurations, loadXMLArtifactListConfiguration, loadXPathExpressions, setDebugFlag, setXMLArtifactListConfiguration, setXPathExpressionListConfiguration
 
Methods inherited from class org.osesb.configuration.DataSetConfiguration
getSQLStatement, getSQLStatementListConfiguration, loadSQLStatements, setSQLStatementListConfiguration
 
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

xmlValidationConfiguration

protected XMLConfiguration xmlValidationConfiguration
An XMLConfiguration for the <xml-validation-configuration>.


XML_VALIDATION_CONFIG_CONTENTMODEL

public static final java.lang.String XML_VALIDATION_CONFIG_CONTENTMODEL
xmlValidationConfiguration content model tag.

See Also:
Constant Field Values
Constructor Detail

XMLValidationPipelineStageConfiguration

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

Parameters:
configFile - The XML configuration document to parse.
Throws:
java.lang.Exception - if there is a problem reading or parsing the configuration file.

XMLValidationPipelineStageConfiguration

public XMLValidationPipelineStageConfiguration(java.lang.String configFile,
                                               java.lang.String xpathExpression)
                                        throws java.lang.Exception
Creates a new instance of XMLValidationPipelineStageConfiguration 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 XML configuration document to parse.
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.

XMLValidationPipelineStageConfiguration

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

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

loadxmlValidationConfiguration

protected final void loadxmlValidationConfiguration()
                                             throws java.lang.Exception
Loads the xmlValidationConfiguration.

Note that this method should not be overridden as it is invoked from this class's constructor.

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

getXMLValidationConfiguration

public XMLConfiguration getXMLValidationConfiguration()
Returns the XMLValidationConfiguration within this XMLValidationPipelineStageConfiguration.

Returns:
the XMLValidationConfiguration within this XMLValidationPipelineStageConfiguration.

getCheckWellFormed

public boolean getCheckWellFormed()
Returns the checkWellFormed property, which determines whether or not XMLValidationPipelineStageConfiguration#runStage() checks if XML is well-formed.

Returns:
the checkWellFormed property.

setCheckWellFormed

public void setCheckWellFormed(boolean checkWellFormed)
Sets the checkWellFormed property, which determines whether or not XMLValidationPipelineStageConfiguration#runStage() checks if XML is well-formed.

Parameters:
checkWellFormed - the checkWellFormed property.

getXMLSchemaValidationLevel

public java.lang.String getXMLSchemaValidationLevel()
Returns the xmlSchemaValidationLevel property. If xmlSchemaValidationLevel is 'off', schema validation is not performed. If xmlSchemaValidationLevel is 'warn' or 'reject', then the XML is validated against one or more schemas. If xmlSchemaValidationLevel is 'warn' and schema validation fails, then a warning is logged and XMLValidationPipelineStage#runStage() completes normally. If xmlSchemaValidationLevel is 'reject' and schema validation fails, runStage() throws a PipelineStageException of type PipelineStageException.applicationException and MessagePipeline processing terminates.

Returns:
the xmlSchemaValidationLevel property.

setXMLSchemaValidationLevel

public void setXMLSchemaValidationLevel(java.lang.String xmlSchemaValidationLevel)
Sets the xmlSchemaValidationLevel property. If xmlSchemaValidationLevel is 'off', schema validation is not performed. If xmlSchemaValidationLevel is 'warn' or 'reject', then the XML is validated against one or more schemas. If xmlSchemaValidationLevel is 'warn' and schema validation fails, then a warning is logged and XMLValidationPipelineStage#runStage() completes normally. If xmlSchemaValidationLevel is 'reject' and schema validation fails, runStage() throws a PipelineStageException of type PipelineStageException.applicationException and MessagePipeline processing terminates.

Parameters:
xmlSchemaValidationLevel - the xmlSchemaValidationLevel property.

getSchemaDoesNotExistIsError

public boolean getSchemaDoesNotExistIsError()
Returns the schemaDoesNotExistIsError property. If schema validation is on and a schema could not be found and if the 'schemaDoesNotExistIsError' attribute is true, then a PipelineStageException of type PipelineStageException.applicationException and MessagePipeline processing terminates.

Returns:
the schemaDoesNotExistIsError property.

setSchemaDoesNotExistIsError

public void setSchemaDoesNotExistIsError(boolean schemaDoesNotExistIsError)
Sets the schemaDoesNotExistIsError property. If schema validation is on and a schema could not be found and if the 'schemaDoesNotExistIsError' attribute is true, then a PipelineStageException of type PipelineStageException.applicationException and MessagePipeline processing terminates.

Parameters:
schemaDoesNotExistIsError - the schemaDoesNotExistIsError property.

setConfigFilePath

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

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

toString

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

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

main

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

Parameters:
args - commandline arguments