public interface CommonComparator
Modifier and Type | Method and Description |
---|---|
void |
addLicenseFile(java.io.File licenseFile)
Sets the license file for use with Flexera licensing.
|
void |
addLicenseServer(java.lang.String hostname)
Sets a license server for use with concurrent licensing.
|
void |
addLicenseServer(java.lang.String hostname,
int port)
Sets a license server and port for use with concurrent licensing.
|
void |
compare(java.io.File f1,
java.io.File f2,
java.io.File result)
Compares File objects and uses a File to represent the result.
|
void |
compare(org.xml.sax.InputSource a,
org.xml.sax.InputSource b,
javax.xml.transform.stream.StreamResult result)
Compares the XML obtained from InputSource Objects and writes the pipeline result to a StreamResult.
|
void |
compare(java.io.InputStream a,
java.lang.String systemIdA,
java.io.InputStream b,
java.lang.String systemIdB,
java.io.OutputStream result)
Compares the XML obtained from InputStream objects and uses an OutputStream to represent the pipeline result.
|
void |
compare(java.io.Reader a,
java.lang.String systemIdA,
java.io.Reader b,
java.lang.String systemIdB,
java.io.Writer result)
Compares the XML obtained from Reader objects and uses a Writer to represent the pipeline result.
|
void |
compare(java.lang.String a,
java.lang.String systemIdA,
java.lang.String b,
java.lang.String systemIdB,
java.lang.StringBuilder result)
Compares the XML obtained from Strings and uses a StringBuilder to represent the pipeline result.
|
void |
compare(java.net.URL a,
java.net.URL b,
java.io.File result)
Compares the XML obtained from URLs and writes the pipeline result to a File.
|
void |
compare(java.net.URL a,
java.net.URL b,
java.io.OutputStream result)
Compares the XML obtained from URLs and writes the pipeline result to an OutputStream.
|
net.sf.saxon.s9api.XdmNode |
compare(net.sf.saxon.s9api.XdmNode a,
net.sf.saxon.s9api.XdmNode b)
Compares two Saxon XdmNode trees and generates an XdmNode tree result from the pipeline.
|
org.xml.sax.EntityResolver |
getEntityResolver()
Returns the current entity resolver setting.
|
LexicalPreservationConfig |
getLexicalPreservationConfig()
Returns the current lexical preservation configuration settings.
|
int |
getNumberOfProgressStages()
Get the total number of enabled Progress Reporting Stages.
|
java.lang.String |
getOutputProperty(net.sf.saxon.s9api.Serializer.Property property)
Allows the current settings of the serializer properties to be determined.
|
boolean |
getParserFeature(java.lang.String featureName)
Allows the current settings of parser features to be determined.
|
java.lang.Object |
getParserProperty(java.lang.String propertyName)
Allows the current settings of parser properties to be determined.
|
java.lang.Object |
getTransformerConfigurationOption(java.lang.String name)
Reports current attribute settings of the XSLT transformers in the pipeline.
|
javax.xml.transform.URIResolver |
getURIResolver()
Returns the current URI resolver setting.
|
FilterStepHelper |
newFilterStepHelper()
Creates a
FilterStepHelper using the Processor and URIResolver currently in use by this Core S9 API
Comparator. |
void |
setDebugFiles(boolean debug)
Determines whether intermediate pipeline result files are generated.
|
void |
setDebugFilesPrefix(java.lang.String debugPrefix)
Provides a prefix for debug result files.
|
void |
setEntityResolver(org.xml.sax.EntityResolver resolver)
Set an entity resolver for use when reading the inputs to the pipelined comparator.
|
void |
setEntityResolver(org.xml.sax.EntityResolver resolver,
boolean useFallbackEntityResolver)
Set an entity resolver for use when reading the inputs to the pipelined comparator.
|
void |
setLexicalPreservationConfig(LexicalPreservationConfig config)
Sets the
LexicalPreservationConfig to use during comparison. |
void |
setOutputProperty(net.sf.saxon.s9api.Serializer.Property property,
java.lang.String value)
Configures output formatting and control.
|
void |
setParserFeature(java.lang.String featureName,
boolean value)
Sets a feature on the parser used for reading XML inputs into a Core S9 Comparator.
|
void |
setParserProperty(java.lang.String propertyName,
java.lang.Object value)
Configures parser properties for the pipeline input parsers.
|
void |
setRedistributionLicenseContent(long[] encodedLicense)
Sets a redistribution license for use with subsequent compare operations.
|
void |
setTransformerConfigurationOption(java.lang.String name,
java.lang.Object value)
Set a configuration option on the XSLT transformers used in a Core S9 API comparator.
|
void |
setURIResolver(javax.xml.transform.URIResolver resolver)
Sets a resolver for use by all XSLT based filters in a Core S9 API comparator.
|
void |
setURIResolver(javax.xml.transform.URIResolver resolver,
boolean useFallbackURIResolver)
Sets a resolver for use by all XSLT based filters in a Core S9 API comparator.
|
FilterStepHelper newFilterStepHelper()
Creates a FilterStepHelper
using the Processor
and URIResolver
currently in use by this Core S9 API
Comparator.
Due to the way that Saxon's Processor works, all internal XdmNodes and compiled XSLT must be created by the same
Processor
. Therefore FilterChain
s and FilterStep
s that are to be associated with this Core S9 API
Comparator, should be instantiated by this Comparator's FilterStepHelper
, which is what this method provides.
FilterStepHelper
with which to create FilterChain
s and FilterStep
s for this
Core S9 API Comparator.void setRedistributionLicenseContent(long[] encodedLicense) throws LicenseException
DeltaXML Redistribtion or 'OEM' customers should use this method in conjunction with supplied code which is typically compiled and integrated into their own products. The supplied code provides examples of usage. This method is not intended to be used by other types of license/customer.
A LicenseException should always contain a nested exception or cause containing further details of the underlying issue. This will typically be either LicenseContentException or LicenseSecurityException
Note that some of the exceptions thrown here can also be thrown by a compare method.
encodedLicense
- a redistribution licenseLicenseException
- if there are any problems with the supplied license or its usevoid setURIResolver(javax.xml.transform.URIResolver resolver, boolean useFallbackURIResolver)
<xsl:import>
, <xsl:include>
and document()
constructs.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.XsltTransformer.setURIResolver(javax.xml.transform.URIResolver)
void setURIResolver(javax.xml.transform.URIResolver resolver)
<xsl:import>
,
<xml:include>
and document()
constructs. This is equivalent to calling
setURIResolver(resolver, true)
.resolver
- An implementation of the URIResolver interface, or nulljavax.xml.transform.URIResolver getURIResolver()
void setEntityResolver(org.xml.sax.EntityResolver resolver, boolean useFallbackEntityResolver)
resolver
- the user specified entity resolver.useFallbackEntityResolver
- whether to use the internal catalog support (supplied by the fallback entity resolver).void setEntityResolver(org.xml.sax.EntityResolver resolver)
setEntityResolver(resolver, true)
.resolver
- the user specified entity resolver.org.xml.sax.EntityResolver getEntityResolver()
void setTransformerConfigurationOption(java.lang.String name, java.lang.Object value) throws java.lang.IllegalArgumentException
Set a configuration option on the XSLT transformers used in a Core S9 API comparator. Some of the configuration options affect the compilation of XSLT filters and as the compilation process can be triggered by various step helper methods. This method should be used prior to these methods if appropriate. Please also note that it is possible to create XSLT based steps using a Saxon Processor argument, this method will not apply to Steps created in this way as this method configures the Saxon Processor that is created by or passed as an argument to a Core S9 API comparator constructor.
Please note: Some of the options available with Saxon assume that the Transformer is 'in control' of the
parser or XMLReader used for input processing. This is not the case for Core S9 API comparators; if an attribute seems to
have no effect look for alternative techniques such as using equivalent features and the CommonComparator.setParserFeature(java.lang.String, boolean)
method.
name
- The name of the option to setvalue
- The value to be set (an Object)java.lang.IllegalArgumentException
- if the attribute name is not recognized by the underlying TransformerCommonComparator.getTransformerConfigurationOption(String)
,
CommonComparator.setParserFeature(String, boolean)
java.lang.Object getTransformerConfigurationOption(java.lang.String name) throws java.lang.IllegalArgumentException
name
- of the option to reportjava.lang.IllegalArgumentException
- if the attribute name is not recognized by the underlying TransformerFactoryCommonComparator.setTransformerConfigurationOption(String, Object)
void setParserFeature(java.lang.String featureName, boolean value) throws FeatureSettingNotSupportedException, FeatureNotRecognizedException, java.lang.IllegalArgumentException
Sets a feature on the parser used for reading XML inputs into a Core S9 Comparator.
Feature setting modify the parsing behaviour of a pipeline. In particular features relating to input validation, schema and DTD handling can be controlled. The features which can be controlled are features of the underlying SAX parser used in the pipeline (but with some exceptions described below). If the SAX parser being used is Apache Xerces, the features which can be set are both the generic SAX features and Apache specific ones.
These features are only appropriate and will only be applied when the compare methods in this class are responsible for parsing and loading input XML data. When the compare or isEqual methods use XdmNode arguments the data has already been parsed and the code being used for creating the XdmNode objects should be configured appropriately.
The following table lists settings which should not be used, as the Saxon s9api code used internally in the
PipelinedComparatorS9 will override these settings. Alternative settings using the CommonComparator.setTransformerConfigurationOption(java.lang.String, java.lang.Object)
method must be used instead:
Parser Feature | Corresponding setTransformerConfigurationOption |
---|---|
http://xml.org/sax/features/validation | Feature.DTD_VALIDATION |
http://apache.org/xml/features/xinclude-aware | Feature.XINCLUDE |
http://apache.org/xml/features/xinclude | Feature.XINCLUDE |
The following list includes some of the features which we consider useful in conjunction with a pipelined comparator architecture:
The following table lists features that can only be set to specific values. These fixed settings are necessary for the
comparator to operate properly. This in turn is because Saxon requires particular feature settings to be used and supported
by setFeature. Any attempt to set values other than those shown below will result in a
FeatureSettingNotSupportedException
being thrown.
Feature | fixed/permissible value |
---|---|
http://xml.org/sax/features/namespaces | true |
http://xml.org/sax/features/namespace- prefixes | false |
featureName
- the name of the feature to be setvalue
- the new value for the featureFeatureSettingNotSupportedException
- if the feature cannot be set to the specific valueFeatureNotRecognizedException
- if the featureName is not recognizedjava.lang.IllegalArgumentException
- if the featureName argument is nullXMLReader.setFeature(String, boolean)
,
Processor.setConfigurationProperty(Feature, Object)
,
Feature
boolean getParserFeature(java.lang.String featureName) throws FeatureNotRecognizedException, java.lang.IllegalArgumentException
featureName
- the name of the feature whose value is being queriedFeatureNotRecognizedException
- if the featureName is not recognizedjava.lang.IllegalArgumentException
- if the argument is nullCommonComparator.setParserFeature(String, boolean)
void setParserProperty(java.lang.String propertyName, java.lang.Object value) throws PropertyNotRecognizedException, PropertySettingNotSupportedException, java.lang.IllegalArgumentException
Configures parser properties for the pipeline input parsers.
Allows properties of the underlying parser to be configured. If using Apache Xerces-J the following properties may prove useful in comparator pipelines:
propertyName
- the name of the property to set on the parservalue
- the new value for the propertyPropertySettingNotSupportedException
- if the property cannot be set to the specific valuePropertyNotRecognizedException
- if the property name is not recognizedjava.lang.IllegalArgumentException
- if an argument is nullCommonComparator.getParserProperty(String)
,
XMLReader.setProperty(java.lang.String, java.lang.Object)
java.lang.Object getParserProperty(java.lang.String propertyName) throws PropertyNotRecognizedException, java.lang.IllegalArgumentException
propertyName
- the name of the property whose value is being queriedPropertyNotRecognizedException
- if the property name is not recognizedjava.lang.IllegalArgumentException
- if the argument is nullCommonComparator.setParserProperty(String, Object)
void setOutputProperty(net.sf.saxon.s9api.Serializer.Property property, java.lang.String value) throws java.lang.IllegalArgumentException
Configures output formatting and control.
Any properties set here are then passed to the Serializer
used to write the output in most of the
compare methods. The compare method which returns an XdmNode result bypasses XML serialization and any properties will have
no effect with this method.
NOTE The Saxon s9api Serializer will throw an XPathException which in turn will be presented as an exception during compare or isEqual when "omit-xml-declaration" has the value "yes" and standalone has either of the values "yes" or "no". Saxon does however support setting the "standalone" property to "omit" as described in the XSLT2 serialization specification.
property
- the property to setvalue
- the new value for the propertyjava.lang.IllegalArgumentException
- if a parameter value is illegal in some waySerializer.setOutputProperty(net.sf.saxon.s9api.Serializer.Property, java.lang.String)
,
Serializer.Property
,
XSLT 2.0 and XQuery 1.0
Serialization, section 5.1.5java.lang.String getOutputProperty(net.sf.saxon.s9api.Serializer.Property property)
property
- the output property whose value is being queriedSerializer.Property
void setLexicalPreservationConfig(LexicalPreservationConfig config)
Sets the LexicalPreservationConfig
to use during comparison.
config
- the LexicalPreservationConfig
object to use during comparisonfor details of what the settings are used for
LexicalPreservationConfig getLexicalPreservationConfig()
Returns the current lexical preservation configuration settings.
int getNumberOfProgressStages()
PipelineProgressListener
.void setDebugFiles(boolean debug)
debug
- when true intermediate result files are producedCommonComparator.setDebugFilesPrefix(String)
void setDebugFilesPrefix(java.lang.String debugPrefix)
debugPrefix
- The prefix that will be used for debug file names in subsequent compare operationsCommonComparator.setDebugFiles(boolean)
void compare(java.io.File f1, java.io.File f2, java.io.File result) throws ComparisonException, FilterProcessingException, java.io.FileNotFoundException, java.io.IOException, PipelineLoadingException, PipelineSerializationException, LicenseException, PipelinedComparatorError, ComparisonCancelledException
Compares File objects and uses a File to represent the result.
f1
- the first comparison inputf2
- the second inputresult
- the location where the pipeline result will be writtenComparisonException
- if there is a problem during the comparison processingFilterProcessingException
- if there was a problem running any of the filtersjava.io.FileNotFoundException
- if the input or output files cannot be foundjava.io.IOException
- if there is a problem opening/closing streams associated with the File argumentsPipelineLoadingException
- if the inputs cannot be loaded or parsedPipelineSerializationException
- if the result cannot be saved or serialized to the result locationLicenseException
- if there is a licensing issue that prevents operationPipelinedComparatorError
- if a comparator execution thread is interrupted by another threadComparisonCancelledException
- if a comparison is cancelled according to the CancellationPolicy
in forcevoid compare(java.io.Reader a, java.lang.String systemIdA, java.io.Reader b, java.lang.String systemIdB, java.io.Writer result) throws ComparisonException, FilterProcessingException, PipelineLoadingException, PipelineSerializationException, LicenseException, PipelinedComparatorError, ComparisonCancelledException
Compares the XML obtained from Reader objects and uses a Writer to represent the pipeline result.
systemId parameters are provided so that relative URIs can be resolved in the inputs, they are also useful when reporting errors as the systemId may be useful when locating the error position. Using identifiers such as "string1" or "database2" may be useful when the inputs do not contain URIs to resolve as they can aid error diagnosis.
a
- The reader from which the first input is readb
- The reader for the second inputresult
- where the pipeline result will be writtensystemIdA
- the SystemId used for resolving URIs and reporting errors associated with the A inputsystemIdB
- the SystemId used for resolving URIs and reporting errors associated with the B inputComparisonException
- if there is a problem during the comparison processingFilterProcessingException
- if there was a problem running any of the filtersPipelineLoadingException
- if the inputs cannot be loaded or parsedPipelineSerializationException
- if the output cannot be saved or serialized to the result locationLicenseException
- if there is a licensing issue that prevents operationPipelinedComparatorError
- if a comparator execution thread is interrupted by another threadComparisonCancelledException
- if a comparison is cancelled according to the CancellationPolicy
in forcevoid compare(java.io.InputStream a, java.lang.String systemIdA, java.io.InputStream b, java.lang.String systemIdB, java.io.OutputStream result) throws ComparisonException, PipelineLoadingException, FilterProcessingException, PipelineSerializationException, LicenseException, PipelinedComparatorError, ComparisonCancelledException
Compares the XML obtained from InputStream objects and uses an OutputStream to represent the pipeline result.
systemId parameters are provided so that relative URIs can be resolved in the inputs, they are also useful when reporting errors as the systemId may be useful when locating the error position. Using identifiers such as "string1" or "database2" may be useful when the inputs do not contain URIs to resolve as they can aid error diagnosis.
a
- The InputStream from which the first input is readb
- The InputStream for the second inputresult
- where the pipeline result will be writtensystemIdA
- the SystemId used for resolving URIs and reporting errors associated with the A inputsystemIdB
- the SystemId used for resolving URIs and reporting errors associated with the B inputComparisonException
- if there is a problem during the comparison processingFilterProcessingException
- if there was a problem running any of the filtersPipelineLoadingException
- if the inputs cannot be loaded or parsedPipelineSerializationException
- if the output cannot be saved or serialized to the result locationLicenseException
- if there is a licensing issue that prevents operationPipelinedComparatorError
- if a comparator execution thread is interrupted by another threadComparisonCancelledException
- if a comparison is cancelled according to the CancellationPolicy
in forcevoid compare(java.lang.String a, java.lang.String systemIdA, java.lang.String b, java.lang.String systemIdB, java.lang.StringBuilder result) throws ComparisonException, PipelineLoadingException, FilterProcessingException, PipelineSerializationException, LicenseException, PipelinedComparatorError, ComparisonCancelledException
Compares the XML obtained from Strings and uses a StringBuilder to represent the pipeline result.
systemId parameters are provided so that relative URIs can be resolved in the inputs, they are also useful when reporting errors as the systemId may be useful when locating the error position. Using identifiers such as "string1" or "database2" may be useful when the inputs do not contain URIs to resolve as they can aid error diagnosis.
a
- The String from which the first input is readb
- The String for the second inputresult
- where the pipeline result will be writtensystemIdA
- the SystemId used for resolving URIs and reporting errors associated with the A inputsystemIdB
- the SystemId used for resolving URIs and reporting errors associated with the B inputComparisonException
- if there is a problem during the comparison processingFilterProcessingException
- if there was a problem running any of the filtersPipelineLoadingException
- if the inputs cannot be loaded or parsedPipelineSerializationException
- if the output cannot be saved or serialized to the result locationLicenseException
- if there is a licensing issue that prevents operationPipelinedComparatorError
- if a comparator execution thread is interrupted by another threadComparisonCancelledException
- if a comparison is cancelled according to the CancellationPolicy
in forcevoid compare(java.net.URL a, java.net.URL b, java.io.File result) throws ComparisonException, PipelineLoadingException, FilterProcessingException, PipelineSerializationException, java.io.FileNotFoundException, LicenseException, PipelinedComparatorError, ComparisonCancelledException
Compares the XML obtained from URLs and writes the pipeline result to a File.
a
- The URL from which the first input is loadedb
- The URL for the second inputresult
- where the pipeline result will be writtenComparisonException
- if there is a problem during the comparison processingFilterProcessingException
- if there was a problem running any of the filtersPipelineLoadingException
- if the inputs cannot be loaded or parsedPipelineSerializationException
- if the output cannot be saved or serialized to the result locationjava.io.FileNotFoundException
- if the output file location cannot be foundLicenseException
- if there is a licensing issue that prevents operationPipelinedComparatorError
- if a comparator execution thread is interrupted by another threadComparisonCancelledException
- if a comparison is cancelled according to the CancellationPolicy
in forcevoid compare(java.net.URL a, java.net.URL b, java.io.OutputStream result) throws ComparisonException, PipelineLoadingException, FilterProcessingException, PipelineSerializationException, LicenseException, PipelinedComparatorError, ComparisonCancelledException
Compares the XML obtained from URLs and writes the pipeline result to an OutputStream.
a
- The URL from which the first input is loadedb
- The URL for the second inputresult
- where the pipeline result will be writtenComparisonException
- if there is a problem during the comparison processingFilterProcessingException
- if there was a problem running any of the filtersPipelineLoadingException
- if the inputs cannot be loaded or parsedPipelineSerializationException
- if the input cannot be saved or serialized to the result locationLicenseException
- if there is a licensing issue that prevents operationPipelinedComparatorError
- if a comparator execution thread is interrupted by another threadComparisonCancelledException
- if a comparison is cancelled according to the CancellationPolicy
in forcevoid compare(org.xml.sax.InputSource a, org.xml.sax.InputSource b, javax.xml.transform.stream.StreamResult result) throws ComparisonException, PipelineLoadingException, FilterProcessingException, PipelineSerializationException, LicenseException, PipelinedComparatorError, ComparisonCancelledException
Compares the XML obtained from InputSource Objects and writes the pipeline result to a StreamResult.
It is recommended that systemIds be associated with the InputSource parameters so that relative URIs and external entities can be resolved.
a
- The InputSource from which the first input is loadedb
- The InputSource for the second inputresult
- where the pipeline result will be writtenComparisonException
- if their is a problem during the comparison stage of the pipelineFilterProcessingException
- if there was a problem running any of the filtersPipelineLoadingException
- if the inputs cannot be loaded or parsedPipelineSerializationException
- if the output cannot be saved or serialized to the result locationLicenseException
- if there is a licensing issue that prevents operationPipelinedComparatorError
- if a comparator execution thread is interrupted by another threadComparisonCancelledException
- if a comparison is cancelled according to the CancellationPolicy
in forcenet.sf.saxon.s9api.XdmNode compare(net.sf.saxon.s9api.XdmNode a, net.sf.saxon.s9api.XdmNode b) throws FilterProcessingException, ComparisonException, LicenseException, java.lang.IllegalArgumentException, PipelinedComparatorError, ComparisonCancelledException
Compares two Saxon XdmNode trees and generates an XdmNode tree result from the pipeline.
XdmNode trees are associated with specific s9api Processors. This method should be used in conjunction with one of the class constructors which takes a Processor argument.
a
- The first XdmNode input tree to be comparedb
- The second XdmNode inputFilterProcessingException
- if there is a problem executing the pipeline filtersLicenseException
- if there is a licensing issueComparisonException
- if there is a problem during the comparison processingPipelinedComparatorError
- if a comparator execution thread is interrupted by another threadjava.lang.IllegalArgumentException
- if the XdmNodes were produced by an unknown Saxon ProcessorComparisonCancelledException
- if a comparison is cancelled according to the CancellationPolicy
in forcevoid addLicenseFile(java.io.File licenseFile) throws java.lang.SecurityException, java.io.IOException, LicenseException
licenseFile
- the FlexLM format license filejava.lang.SecurityException
- if the file cannot be accessedjava.io.IOException
- if there are problems reading the fileLicenseException
- if there is a problem using the license filevoid addLicenseServer(java.lang.String hostname) throws LicenseException
hostname
- the license server host or its ip addressLicenseException
- if there is a problem using the license servervoid addLicenseServer(java.lang.String hostname, int port) throws java.lang.IllegalArgumentException, LicenseException
hostname
- the license server host or its ip addressport
- the port number on the license server for the lmgrdjava.lang.IllegalArgumentException
- if the port number is out of rangeLicenseException
- if there is a problem using the license server