public class DCPConfiguration
extends com.deltaxml.cores9api.AbstractDPConfigurationS9
Loads a DocumentComparator
from a DCP configuration.
DCP (Document Comparator Pipeline) is a declarative file format for defining the pipeline and settings for the Document Comparator. It supports DCP file format version 1.0 as described in DCP User Guide.
This class provides methods for obtaining information from DCP files and also for loading a DocumentComparator instance and
configuring it using data from the DCP and any supplied override parameters. The constructor of this class is responsible for
ensuring basic validity of the input DCP. Full validation is performed by default when generate()
or
DCPConfiguration.setParams(Map, Map)
is called.
The constructor optionally allows a 'checkDCP' argument that can be set false to disable validation of the DCP. This may improve performance, but results in less informative exception messages. It is therefore recommended that this is only used for cases where the DCP file and any parameter overrides are already known to be valid.
DocumentComparator
Constructor and Description |
---|
DCPConfiguration(java.io.File f)
Creates a DCPConfiguration object from a DCP file.
|
DCPConfiguration(java.io.File f,
boolean checkDCP)
Creates a DCPConfiguration object from a DCP file.
|
DCPConfiguration(java.io.File f,
net.sf.saxon.s9api.Processor suppliedProcessor)
Creates a DCPConfiguration object from a DCP file.
|
DCPConfiguration(java.io.File f,
net.sf.saxon.s9api.Processor suppliedProcessor,
boolean checkDCP)
Creates a DCPConfiguration object from a DCP file.
|
DCPConfiguration(org.xml.sax.InputSource dcpSource)
Creates a DCPConfiguration object from an InputSource.
|
DCPConfiguration(org.xml.sax.InputSource dcpSource,
boolean checkDCP)
Creates a DCPConfiguration object from an InputSource.
|
DCPConfiguration(org.xml.sax.InputSource dcpSource,
net.sf.saxon.s9api.Processor suppliedProcessor)
Creates a DCPConfiguration object from an InputSource.
|
DCPConfiguration(org.xml.sax.InputSource dcpSource,
net.sf.saxon.s9api.Processor suppliedProcessor,
boolean checkDCP)
Creates a DCPConfiguration object from an InputSource.
|
DCPConfiguration(net.sf.saxon.s9api.XdmNode dcpNode)
Creates a DCPConfiguration object from a supplied XdmNode tree.
|
DCPConfiguration(net.sf.saxon.s9api.XdmNode dcpNode,
boolean checkDCP)
Creates a DCPConfiguration object from a supplied XdmNode tree.
|
Modifier and Type | Method and Description |
---|---|
void |
generate()
Initializes the internal instance of a concrete
FeatureComparator . |
void |
generate(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides,
java.util.Map<java.lang.String,java.lang.String> stringOverrides)
Initializes the internal instance of a
DocumentComparator . |
DocumentComparator |
getComparator()
Returns the configured
DocumentComparator instance. |
DocumentComparator |
getDocumentComparator()
Deprecated.
This method is deprecated and will be removed in the next major release. Use
DCPConfiguration.getComparator() instead. |
static java.lang.String |
getFormattedPipelineSummaryTable(java.util.Collection<? extends com.deltaxml.cores9api.FeatureConfiguration> featureConfigs,
int width,
int indent)
Returns a table summarising the provided pipelines as a multi-line string.
|
java.lang.String |
getProcessingInstruction(java.lang.String instructionName)
Returns the value of a processing instruction that is a child node of the root element of the configuration.
|
java.lang.String |
getResolvedParameterValue(java.lang.String parameterName)
Returns the resolved value of the specified pipelineParameter in the DCP.
|
void |
setParams(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides,
java.util.Map<java.lang.String,java.lang.String> stringOverrides)
Set new parameter values to override named default parameter settings included in the DCP file.
|
getBooleanParameterList, getBooleanParameters, getDescription, getFormattedParametersDescription, getFormattedParametersDescription, getFullDescription, getId, getParameterDescriptions, getParameterList, getStringParameterList, getStringParameters, getSystemId, getURIResolver, setURIResolver, setURIResolver, toString
public DCPConfiguration(java.io.File f, net.sf.saxon.s9api.Processor suppliedProcessor, boolean checkDCP) throws StaticPDFormatException, java.io.FileNotFoundException
generate()
.f
- A File containing a DCP configurationsuppliedProcessor
- A Saxon Processor instance. This will be used to process the DCP file but will also be supplied to
the generated DocumentComparator instance as its underlying Processor. See
DocumentComparator(Processor)
for more details.checkDCP
- Specifies whether to validate and perform other checks on input DCPStaticPDFormatException
- if the DCP file is not well-formed or validjava.io.FileNotFoundException
- if the DCP file cannot be locatedpublic DCPConfiguration(java.io.File f, boolean checkDCP) throws StaticPDFormatException, java.io.FileNotFoundException
generate()
.f
- A File containing a DCP configurationcheckDCP
- Specifies whether to validate and perform other checks on input DCPStaticPDFormatException
- if the DCP file is not well-formed or validjava.io.FileNotFoundException
- if the DCP file cannot be locatedpublic DCPConfiguration(org.xml.sax.InputSource dcpSource, net.sf.saxon.s9api.Processor suppliedProcessor, boolean checkDCP) throws StaticPDFormatException
dcpSource
- An InputSource containing a DCP configurationsuppliedProcessor
- A Saxon Processor instance. This will be used to process the DCP file but will also be supplied to
the generated DocumentComparator instance as its underlying Processor. See
DocumentComparator(Processor)
for more details.checkDCP
- Specifies whether to validate and perform other checks on input DCPStaticPDFormatException
- if the DCP source is not well-formed or validpublic DCPConfiguration(org.xml.sax.InputSource dcpSource, boolean checkDCP) throws StaticPDFormatException
dcpSource
- An InputSource containing a DCP configurationcheckDCP
- Specifies whether to validate and perform other checks on input DCPStaticPDFormatException
- if the DCP source is not well-formed or validpublic DCPConfiguration(net.sf.saxon.s9api.XdmNode dcpNode, boolean checkDCP) throws StaticPDFormatException
dcpNode
- An XdmNode tree containing a DCP configurationcheckDCP
- Specifies whether to validate and perform other checks on input DCPStaticPDFormatException
- if the DCP document is not validpublic DCPConfiguration(java.io.File f, net.sf.saxon.s9api.Processor suppliedProcessor) throws StaticPDFormatException, java.io.FileNotFoundException
generate()
.f
- A File containing a DCP configurationsuppliedProcessor
- A Saxon Processor instance. This will be used to process the DCP file but will also be supplied to
the generated DocumentComparator instance as its underlying Processor. See
DocumentComparator(Processor)
for more details.StaticPDFormatException
- if the DCP file is not well-formed or validjava.io.FileNotFoundException
- if the DCP file cannot be locatedpublic DCPConfiguration(java.io.File f) throws StaticPDFormatException, java.io.FileNotFoundException
generate()
.f
- A File containing a DCP configurationStaticPDFormatException
- if the DCP file is not well-formed or validjava.io.FileNotFoundException
- if the DCP file cannot be locatedpublic DCPConfiguration(org.xml.sax.InputSource dcpSource, net.sf.saxon.s9api.Processor suppliedProcessor) throws StaticPDFormatException
dcpSource
- An InputSource containing a DCP configurationsuppliedProcessor
- A Saxon Processor instance. This will be used to process the DCP file but will also be supplied to
the generated DocumentComparator instance as its underlying Processor. See
DocumentComparator(Processor)
for more details.StaticPDFormatException
- if the DCP source is not well-formed or validpublic DCPConfiguration(org.xml.sax.InputSource dcpSource) throws StaticPDFormatException
dcpSource
- An InputSource containing a DCP configurationStaticPDFormatException
- if the DCP source is not well-formed or validpublic DCPConfiguration(net.sf.saxon.s9api.XdmNode dcpNode) throws StaticPDFormatException
dcpNode
- An XdmNode tree containing a DCP configurationStaticPDFormatException
- if the DCP document is not validpublic void generate(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides, java.util.Map<java.lang.String,java.lang.String> stringOverrides) throws DynamicPDFormatException, PDAdvancedConfigException, StaticPDFormatException, PDFilterConfigurationException
DocumentComparator
. This method must only be called once.booleanOverrides
- A map of name, boolean value parameters with which to configure the generated
DocumentComparator
stringOverrides
- A map of name, String value parameters with which to configure the generated
DocumentComparator
DynamicPDFormatException
- if a problem is found when attempting to resolve DCP valuesPDFilterConfigurationException
- if a problem is found when loading an XML filterStaticPDFormatException
- if the resolved DCP values are invalidPDAdvancedConfigException
- when properties or features in 'advancedConfig' element cause an errorjava.lang.IllegalStateException
- if called more than oncepublic final void setParams(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides, java.util.Map<java.lang.String,java.lang.String> stringOverrides) throws PDFilterConfigurationException, DynamicPDFormatException, PDAdvancedConfigException, java.lang.IllegalStateException
generate()
method.booleanOverrides
- set parameter values for DCP-defined boolean pipeline parametersstringOverrides
- set parameter values for DCP-defined string pipeline parametersPDAdvancedConfigException
- when properties or features in 'advancedConfig' element cause an errorDynamicPDFormatException
- if problem found while resolving DCP valuesPDFilterConfigurationException
- if problem found when loading an XML filterjava.lang.IllegalStateException
- if generate()
method has not been called firstpublic DocumentComparator getComparator() throws java.lang.IllegalStateException
DocumentComparator
instance. Must be used after the generate()
method is called to
initialize the DocumentComparator
DocumentComparator
java.lang.IllegalStateException
- if generate()
method has not been called first@Deprecated public DocumentComparator getDocumentComparator() throws java.lang.IllegalStateException
DCPConfiguration.getComparator()
instead.DocumentComparator
instance.DocumentComparator
java.lang.IllegalStateException
- if generate()
method has not been called firstDCPConfiguration.getComparator()
public java.lang.String getResolvedParameterValue(java.lang.String parameterName)
parameterName
- name of the parametergenerate()
method has not been called firstpublic void generate() throws StaticPDFormatException, PDFilterConfigurationException, DynamicPDFormatException, PDAdvancedConfigException, java.lang.IllegalStateException
FeatureComparator
. This method must only be called once.DynamicPDFormatException
- if a problem is found when attempting to resolve Comparator Pipeline valuesPDFilterConfigurationException
- if a problem is found when loading an XML filterStaticPDFormatException
- if the resolved Comparator Pipeline values are invalidPDAdvancedConfigException
- when properties or features in 'advancedConfig' element cause an errorjava.lang.IllegalStateException
- if called more than oncepublic java.lang.String getProcessingInstruction(java.lang.String instructionName)
instructionName
- name of the processing-instruction (cannot be in a namespace)public static java.lang.String getFormattedPipelineSummaryTable(java.util.Collection<? extends com.deltaxml.cores9api.FeatureConfiguration> featureConfigs, int width, int indent)
featureConfigs
- The dxpConfigurations to summarise.width
- the maximum width of each line for the description (not including the indent)indent
- the number of spaces to prefix each line with.