public class DXPConfiguration
extends java.lang.Object
Loads a PipelinedComparator from a DXP configuration.
DXP (DeltaXML Pipelines) is a declarative file format for describing comparator pipelines and could also be considered a form of customization language for comparator based tools. It supports DXP file format versions 1.0-1.1 as discussed in DXP User Guide.
This class provides methods for obtaining information from DXP files and also for loading a PipelinedComparator instance from
DXP. The constructor of this class is generally responsible for ensuring validity of the input DXP. However, other semantic
validity checks may be made during the various generate
methods.
PipelinedComparator
Constructor and Description |
---|
DXPConfiguration(java.io.File f)
Creates a DXPConfiguration object from a DXP file.
|
DXPConfiguration(java.io.File f,
boolean bypassJAXPDBFactory)
Creates a DXPConfiguration object from a DXP file.
|
DXPConfiguration(org.xml.sax.InputSource dxpSource)
Creates a DXPConfiguration object from a DXP InputSource.
|
DXPConfiguration(org.xml.sax.InputSource dxpSource,
boolean bypassJAXPDBFactory)
Creates a DXPConfiguration object from a DXP InputSource.
|
DXPConfiguration(org.xml.sax.InputSource dxpSource,
org.xml.sax.EntityResolver er,
boolean validate)
Creates a DXPConfiguration object from a DXP InputSource.
|
DXPConfiguration(org.xml.sax.InputSource dxpSource,
org.xml.sax.EntityResolver er,
boolean validate,
boolean bypassJAXPDBFactory)
Creates a DXPConfiguration object from a DXP InputSource.
|
Modifier and Type | Method and Description |
---|---|
PipelinedComparator |
generate()
Generates a PipelinedComparator from the DXP configuration loaded into this instance of a DXPConfiguration.
|
PipelinedComparator |
generate(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides,
java.util.Map<java.lang.String,java.lang.String> stringOverrides)
Generates a PipelinedComparator from this instance of a DXPConfiguration.
|
PipelinedComparator |
generate(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides,
java.util.Map<java.lang.String,java.lang.String> stringOverrides,
boolean bypassJAXPFactories)
Generates a PipelinedComparator from this instance of a DXPConfiguration.
|
java.util.List<DXPParameterDefinition<java.lang.Boolean>> |
getBooleanParameterList()
Returns the boolean parameters declared in a DXP pipeline configuration.
|
java.util.Map<java.lang.String,java.lang.Boolean> |
getBooleanParameters()
Returns the boolean parameters declared in a DXP pipeline configuration.
|
java.lang.String |
getDescription()
Returns the contents of the description attribute of a DXP File.
|
java.lang.String |
getFileExtension()
Returns the contents of the DXP
outputFileExtension/@extension attribute. |
java.lang.String |
getFormattedParametersDescription()
Returns the contents of the parameter elements as a formatted table.
|
java.lang.String |
getFormattedParametersDescription(int width,
int indent)
Returns the contents of the parameter elements as a formatted table.
|
java.lang.String |
getFullDescription()
Returns the contents of the fullDescription element.
|
java.lang.String |
getId()
Returns the id attribute from a DXP InputSource.
|
java.util.Map<java.lang.String,java.lang.String> |
getParameterDescriptions()
Returns the descriptions of each of the parameters in a DXP pipeline configuration.
|
java.util.List<DXPParameterDefinition<?>> |
getParameterList()
Returns the parameters declared in a DXP pipeline configuration.
|
java.util.List<DXPParameterDefinition<java.lang.String>> |
getStringParameterList()
Returns the string parameters declared in a DXP pipeline configuration.
|
java.util.Map<java.lang.String,java.lang.String> |
getStringParameters()
Returns the String parameters declared in a DXP pipeline configuration This method can be used in UIs and other applications
which may wish to display parameter options prior to creating a pipeline instance.
|
java.lang.String |
getSystemId()
Returns the SystemId of the loaded DXP file.
|
javax.xml.transform.URIResolver |
getURIResolver()
Get the user specified URIResolver.
|
boolean |
isCorePipeline()
States whether this represents a core (XML Compare) pipeline or not.
|
void |
setURIResolver(javax.xml.transform.URIResolver resolver)
Specifies the URIResolver to be used with the generated PipelinedComparator and also when converting DXP resources into
Template objects.
|
void |
setURIResolver(javax.xml.transform.URIResolver resolver,
boolean useFallbackURIResolver)
Specifies the URIResolver to be used with the generated PipelinedComparator and also when converting DXP resources into
Template objects.
|
java.lang.String |
toString()
Provides a string representation of the configuration based on the systemId of the DXP file.
|
public DXPConfiguration(org.xml.sax.InputSource dxpSource, boolean bypassJAXPDBFactory) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException, MissingSystemIdException
This constructor allows you to bypass the JAXP factory mechanism when creating a DocumentBuilder (by passing
true
as the second parameter. If this mechanism is bypassed, the class
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
must be available on the classpath as it will be used
explicitly.
dxpSource
- An InputSource describing a DXP configurationbypassJAXPDBFactory
- whether to bypass the JAXP factory mechanism for creating a DocumentBuilderjavax.xml.parsers.ParserConfigurationException
- if there are problems creating the parserjava.io.IOException
- if there are any IO problems when reading the DXPorg.xml.sax.SAXException
- if there are well-formedness or validity issues with the inputMissingSystemIdException
- if the dxpSource argument does not have an associated SystemIdDXPConfiguration.generate(Map, Map)
,
DXPConfiguration.generate(Map, Map, boolean)
,
DXPConfiguration.generate()
public DXPConfiguration(org.xml.sax.InputSource dxpSource) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException, MissingSystemIdException
dxpSource
- An InputSource describing a DXP configurationjavax.xml.parsers.ParserConfigurationException
- if there are problems creating the parserjava.io.IOException
- if there are any IO problems when reading the DXPorg.xml.sax.SAXException
- if there are well-formedness or validity issues with the inputMissingSystemIdException
- if the dxpSource argument does not have an associated SystemIdDXPConfiguration.generate(Map, Map)
,
DXPConfiguration.generate(Map, Map, boolean)
,
DXPConfiguration.generate()
public DXPConfiguration(java.io.File f, boolean bypassJAXPDBFactory) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
This constructor allows you to bypass the JAXP factory mechanism when creating a DocumentBuilder (by passing
true
as the second parameter. If this mechanism is bypassed, the class
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
must be available on the classpath as it will be used
explicitly.
f
- A File
representing a DXP configurationbypassJAXPDBFactory
- whether to bypass the JAXP factory mechanism for creating a DocumentBuilderjavax.xml.parsers.ParserConfigurationException
- if there are problems creating the parserjava.io.IOException
- if there are any IO problems when reading the DXPorg.xml.sax.SAXException
- if there are well-formedness or validity issues with the inputDXPConfiguration.generate(Map, Map)
,
DXPConfiguration.generate(Map, Map, boolean)
,
DXPConfiguration.generate()
public DXPConfiguration(java.io.File f) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
f
- a File
representing a DXP configurationjavax.xml.parsers.ParserConfigurationException
- if there are problems creating a parserjava.io.IOException
- if there are are any problems reading the Fileorg.xml.sax.SAXException
- if there are well-formedness or validity issues with the inputDXPConfiguration.generate(Map, Map)
,
DXPConfiguration.generate(Map, Map, boolean)
,
DXPConfiguration.generate()
public DXPConfiguration(org.xml.sax.InputSource dxpSource, org.xml.sax.EntityResolver er, boolean validate, boolean bypassJAXPDBFactory) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
This constructor allows you to bypass the JAXP factory mechanism when creating a DocumentBuilder (by passing
true
as the final parameter. If this mechanism is bypassed, the class
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
must be available on the classpath as it will be used
explicitly.
dxpSource
- An InputSource describing a DXP configurationer
- An EntityResolver for dealing with DTD and other external URL referencesvalidate
- controls parser validation (requires uses of a DTD)bypassJAXPDBFactory
- whether to bypass the JAXP factory mechanism for creating a DocumentBuilderjavax.xml.parsers.ParserConfigurationException
- if there are problems creating the parserjava.io.IOException
- if there are any IO problems when reading the DXPorg.xml.sax.SAXException
- if there are well-formedness or validity issues with the inputDXPConfiguration.generate(Map, Map)
,
DXPConfiguration.generate(Map, Map, boolean)
,
DXPConfiguration.generate()
public DXPConfiguration(org.xml.sax.InputSource dxpSource, org.xml.sax.EntityResolver er, boolean validate) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
dxpSource
- An InputSource describing a DXP configurationer
- An EntityResolver for dealing with DTD and other external URL referencesvalidate
- controls parser validation (requires uses of a DTD)javax.xml.parsers.ParserConfigurationException
- if there are problems creating the parserjava.io.IOException
- if there are any IO problems when reading the DXPorg.xml.sax.SAXException
- if there are well-formedness or validity issues with the inputDXPConfiguration.generate(Map, Map)
,
DXPConfiguration.generate(Map, Map, boolean)
,
DXPConfiguration.generate()
public boolean isCorePipeline()
public java.lang.String getId()
public java.lang.String getSystemId()
InputSource.getSystemId()
If the DXP file was loaded as a File, this returns the result of calling
File.toURI().toURL().toExternalForm()public java.lang.String getDescription()
public java.util.List<DXPParameterDefinition<java.lang.Boolean>> getBooleanParameterList()
public java.util.List<DXPParameterDefinition<java.lang.String>> getStringParameterList()
public java.util.List<DXPParameterDefinition<?>> getParameterList()
public java.util.Map<java.lang.String,java.lang.Boolean> getBooleanParameters()
DXPConfiguration.generate(Map, Map)
method.DXPConfiguration.generate(Map, Map)
,
DXPConfiguration.getStringParameters()
public java.util.Map<java.lang.String,java.lang.String> getParameterDescriptions()
public java.util.Map<java.lang.String,java.lang.String> getStringParameters()
DXPConfiguration.generate(Map, Map)
method.DXPConfiguration.generate(Map, Map)
,
DXPConfiguration.getBooleanParameters()
public java.lang.String getFullDescription()
public java.lang.String getFormattedParametersDescription()
public java.lang.String getFormattedParametersDescription(int width, int indent)
width
- the maximum width of each line for the description (not including the indent)indent
- the number of spaces to prefix each line with.public java.lang.String getFileExtension()
outputFileExtension/@extension
attribute. This can be used by applications to
alter the behaviour of an application based on the type of data generated. For example a pipeline producing HTML, using an
extension of "html
", may be processed differently (shown in a browser), to a pipeline with an "xml
" extension.xml
"public void setURIResolver(javax.xml.transform.URIResolver resolver, boolean useFallbackURIResolver)
<xsl:import>
, <xsl:include>
and document()
resolver
- An implementation of the URIResolver interface, or nulluseFallbackURIResolver
- Whether to use the fallback URI Resolver, if the user supplied URI Resolver fails to resolve.TransformerFactory.setURIResolver(URIResolver)
,
Transformer.setURIResolver(URIResolver)
public void setURIResolver(javax.xml.transform.URIResolver resolver)
<xsl:import>
, <xsl:include>
and document()
This is equivalent to calling
setURIResolver(resolver, true)
.resolver
- An implementation of the URIResolver interface, or nullTransformerFactory.setURIResolver(URIResolver)
,
Transformer.setURIResolver(URIResolver)
public javax.xml.transform.URIResolver getURIResolver()
public PipelinedComparator generate(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides, java.util.Map<java.lang.String,java.lang.String> stringOverrides) throws java.lang.ClassNotFoundException, java.net.MalformedURLException, ParserInstantiationException, FilterClassInstantiationException, FilterClassIncompatibilityException, TransformerInstantiationException, FilterConfigurationException, FilterParameterizationException, FeatureNotRecognizedException, FeatureSettingNotSupportedException, PropertyNotRecognizedException, FilterParameterizationNotSupportedException, ParameterValueConflict, NonUniqueParameterNameException, UnknownParameterException, InvalidPipelineException, UnsupportedDXPVersionException
This generate method will create a PipelinedComparator which then instantiates its XSLT Transformers and SAX Parsers using standard JAXP Factory mechanisms.
This method allows parameters to be overridden when the pipeline is constructed. The Map arguments should correspond to the
declared 'pipelineParameters' in the associated DXP. An easy way to achieve this is to use and modify the Maps returned with
DXPConfiguration.getBooleanParameters()
and DXPConfiguration.getStringParameters()
.
This method throws a large number of exceptions. Further details of the circumstances in which they are thrown are documented
in the javadoc descriptions of the Exception classes themselves. Should fine-grain exception handling not be required, it is
possible to catch the PipelinedComparatorException
, DXPConfigurationException
or
DeltaXMLException
supertypes for all but two ( ClassNotFoundException
and
MalformedURLException
) of the exceptions thrown by this method.
booleanOverrides
- parameter settings to override the boolean pipeline parametersstringOverrides
- parameter settings to override the string pipeline parametersPipelinedComparator
java.lang.ClassNotFoundException
- if a class specified in a DXP class element cannot be locatedjava.net.MalformedURLException
- if a DXP URL elements contents are malformedParserInstantiationException
- if the PipelinedComparator constructor throws this exceptionFilterClassInstantiationException
- if there are problems instantiating a Java class based filterFilterClassIncompatibilityException
- if a class is not of the correct typeTransformerInstantiationException
- if the pipelinedComparator constructor throws this exceptionFilterConfigurationException
- if there is a problem instantiating or configuring an XSLT based filterFilterParameterizationException
- if there are problems setting the parameters on a Java filterFeatureNotRecognizedException
- if the feature, in a parserFeature element, is not recognizedFeatureSettingNotSupportedException
- if the setting of the specified parser feature is not supportedPropertyNotRecognizedException
- if the specified outputProperty is not recognizedFilterParameterizationNotSupportedException
- if filter parameterization is not supported by the XSLT processorParameterValueConflict
- if the attributes used to specify a filter or other parameter are in conflictNonUniqueParameterNameException
- if the PipelineParameter names are not uniqueUnknownParameterException
- if the referenced parameter name is not known/declaredInvalidPipelineException
- if the DXP file does not specify a comparator pipelineUnsupportedDXPVersionException
- if the DXP file makes use of features not supported by this classpublic PipelinedComparator generate(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides, java.util.Map<java.lang.String,java.lang.String> stringOverrides, boolean bypassJAXPFactories) throws java.lang.ClassNotFoundException, java.net.MalformedURLException, ParserInstantiationException, FilterClassInstantiationException, FilterClassIncompatibilityException, TransformerInstantiationException, FilterConfigurationException, FilterParameterizationException, FeatureNotRecognizedException, FeatureSettingNotSupportedException, PropertyNotRecognizedException, FilterParameterizationNotSupportedException, ParameterValueConflict, NonUniqueParameterNameException, UnknownParameterException, InvalidPipelineException, UnsupportedDXPVersionException
This method allows parameters to be overridden when the pipeline is constructed. The Map arguments should correspond to the
declared 'pipelineParameters' in the associated DXP. An easy way to achieve this is to use and modify the Maps returned with
DXPConfiguration.getBooleanParameters()
and DXPConfiguration.getStringParameters()
.
This method throws a large number of exceptions. Further details of the circumstances in which they are thrown are documented
in the javadoc descriptions of the Exception classes themselves. Should fine-grain exception handling not be required, it is
possible to catch the PipelinedComparatorException
, DXPConfigurationException
or
DeltaXMLException
supertypes for all but two ( ClassNotFoundException
and
MalformedURLException
) of the exceptions thrown by this method.
Use of the bypassJAXPFactories parameter, corresponds to creating a PipelinedComparator with the same parameter. See the
documentation for PipelinedComparator.PipelinedComparator(boolean)
for further details.
booleanOverrides
- parameter settings to override the boolean pipeline parametersstringOverrides
- parameter settings to override the string pipeline parametersbypassJAXPFactories
- instantiates Saxon and Xerces directly rather than using JAXP Factory mechanismsPipelinedComparator
java.lang.ClassNotFoundException
- if a class specified in a DXP class element cannot be locatedjava.net.MalformedURLException
- if a DXP URL elements contents are malformedParserInstantiationException
- if the PipelinedComparator constructor throws this exceptionFilterClassInstantiationException
- if there are problems instantiating a Java class based filterFilterClassIncompatibilityException
- if a class is not of the correct typeTransformerInstantiationException
- if the pipelinedComparator constructor throws this exceptionFilterConfigurationException
- if there is a problem instantiating or configuring an XSLT based filterFilterParameterizationException
- if there are problems setting the parameters on a Java filterFeatureNotRecognizedException
- if the feature, in a parserFeature element, is not recognizedFeatureSettingNotSupportedException
- if the setting of the specified parser feature is not supportedPropertyNotRecognizedException
- if the specified outputProperty is not recognizedFilterParameterizationNotSupportedException
- if filter parameterization is not supported by the XSLT processorParameterValueConflict
- if the attributes used to specify a filter or other parameter are in conflictNonUniqueParameterNameException
- if the PipelineParameter names are not uniqueUnknownParameterException
- if the referenced parameter name is not known/declaredInvalidPipelineException
- if the DXP file does not specify a comparator pipelineUnsupportedDXPVersionException
- if the DXP file makes use of features not supported by this classPipelinedComparator.PipelinedComparator(boolean)
public PipelinedComparator generate() throws java.lang.ClassNotFoundException, java.net.MalformedURLException, ParserInstantiationException, FilterClassInstantiationException, FilterClassIncompatibilityException, TransformerInstantiationException, FilterConfigurationException, FilterParameterizationException, FeatureNotRecognizedException, FeatureSettingNotSupportedException, PropertyNotRecognizedException, FilterParameterizationNotSupportedException, ParameterValueConflict, NonUniqueParameterNameException, UnknownParameterException, InvalidPipelineException, UnsupportedDXPVersionException
This method throws a large number of exceptions. Further details of the circumstances in which they are thrown are documented
in the javadoc descriptions of the Exception classes themselves. Should fine-grain exception handling not be required, it is
possible to catch the PipelinedComparatorException
, DXPConfigurationException
or
DeltaXMLException
supertypes for all but two ( ClassNotFoundException
and
MalformedURLException
) of the exceptions thrown by this method.
PipelinedComparator
java.lang.ClassNotFoundException
- if a class specified in a DXP class element cannot be locatedjava.net.MalformedURLException
- if a DXP URL elements contents are malformedParserInstantiationException
- if the PipelinedComparator constructor throws this exceptionFilterClassInstantiationException
- if there are problems instantiating a Java class based filterFilterClassIncompatibilityException
- if a class is not of the correct typeTransformerInstantiationException
- if the pipelinedComparator contructor throws this exceptionFilterConfigurationException
- if there is a problem instantiating or configuring an XSLT based filterFilterParameterizationException
- if there are problems setting the parameters on a Java filterFeatureNotRecognizedException
- if the feature, in a parserFeature element, is not recognizedFeatureSettingNotSupportedException
- if the setting of the specified parser feature is not supportedPropertyNotRecognizedException
- if the specified outputProperty is not recognizedFilterParameterizationNotSupportedException
- if filter parameterization is not supported by the XSLT processorParameterValueConflict
- if the attributes used to specify a filter or other parameter are in conflictNonUniqueParameterNameException
- if the PipelineParameter names are not uniqueUnknownParameterException
- if the referenced parameter name is not known/declaredInvalidPipelineException
- if the DXP file does not specify a comparator pipelineUnsupportedDXPVersionException
- if the DXP file makes use of features not supported by this classpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2001-2018 DeltaXML Ltd. All Rights Reserved.