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 DCPConfiguration.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
DocumentComparator . |
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
DocumentComparator using passed parameter values. |
DocumentComparator |
getDocumentComparator()
Returns the configured
DocumentComparator instance. |
static java.lang.String |
getFormattedPipelineSummaryTable(java.util.Collection<DCPConfiguration> dcpConfigs,
int width,
int indent)
Returns a table summarizing 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 DCP.
|
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
DCPConfiguration.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
DCPConfiguration.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
DCPConfiguration.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
DCPConfiguration.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() throws StaticPDFormatException, PDFilterConfigurationException, DynamicPDFormatException, PDAdvancedConfigException, java.lang.IllegalStateException
DocumentComparator
. This method must only be called once.DynamicPDFormatException
- if problem found when attempting to resolve DCP valuesPDFilterConfigurationException
- if problem found when loading an XML filterStaticPDFormatException
- if resolved DCP values are invalidPDAdvancedConfigException
- when properties or features in 'advancedConfig' element cause an errorjava.lang.IllegalStateException
- if called more than oncepublic void generate(java.util.Map<java.lang.String,java.lang.Boolean> booleanOverrides, java.util.Map<java.lang.String,java.lang.String> stringOverrides) throws StaticPDFormatException, PDFilterConfigurationException, DynamicPDFormatException, PDAdvancedConfigException, java.lang.IllegalStateException
DocumentComparator
using passed parameter values. This method must only be
called once.booleanOverrides
- set parameter values for DCP-defined boolean pipeline parametersstringOverrides
- set parameter values for DCP-defined string pipeline parametersStaticPDFormatException
- if problem occurred when preparing to resolve DCP valuesDynamicPDFormatException
- if problem found while resolving DCP valuesPDFilterConfigurationException
- if problem found when loading an XML filterPDAdvancedConfigException
- 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
DCPConfiguration.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 DCPConfiguration.generate()
method has not been called firstpublic DocumentComparator getDocumentComparator() throws java.lang.IllegalStateException
DocumentComparator
instance. Must be used after the DCPConfiguration.generate()
method is called to
initialize the DocumentComparator
DocumentComparator
java.lang.IllegalStateException
- if DCPConfiguration.generate()
method has not been called firstpublic java.lang.String getResolvedParameterValue(java.lang.String parameterName)
parameterName
- name of the parameterDCPConfiguration.generate()
method has not been called firstpublic 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<DCPConfiguration> dcpConfigs, int width, int indent)
dcpConfigs
- The dcpConfigurations to summarize.width
- the maximum width of each line for the description (not including the indent)indent
- the number of spaces to prefix each line with.