public class DTCPConfiguration
extends com.deltaxml.cores9api.AbstractDPConfigurationS9
Loads a DataComparator
from a DTCP configuration.
DTCP (Data Comparator Pipeline) is a declarative file format for defining the pipeline and settings for the Data Comparator. It supports DTCP file format version 1.0 as described in DTCP TODO make user guide User Guide.
This class provides methods for obtaining information from DTCP files and also for loading a DataComparator instance and
configuring it using data from the DTCP and any supplied override parameters. The constructor of this class is responsible for
ensuring basic validity of the input DTCP. Full validation is performed by default when generate()
or
DTCPConfiguration.setParams(Map, Map)
is called.
The constructor optionally allows a 'checkDTCP' argument that can be set false to disable validation of the DTCP. This may improve performance, but results in less informative exception messages. It is therefore recommended that this is only used for cases where the DTCP file and any parameter overrides are already known to be valid.
DataComparator
Constructor and Description |
---|
DTCPConfiguration(java.io.File f)
Creates a DTCPConfiguration object from a DTCP file.
|
DTCPConfiguration(java.io.File f,
boolean checkDTCP)
Creates a DTCPConfiguration object from a DTCP file.
|
DTCPConfiguration(java.io.File f,
net.sf.saxon.s9api.Processor suppliedProcessor)
Creates a DTCPConfiguration object from a DTCP file.
|
DTCPConfiguration(java.io.File f,
net.sf.saxon.s9api.Processor suppliedProcessor,
boolean checkDTCP)
Creates a DTCPConfiguration object from a DTCP file.
|
DTCPConfiguration(org.xml.sax.InputSource dtcpSource)
Creates a DTCPConfiguration object from an InputSource.
|
DTCPConfiguration(org.xml.sax.InputSource dtcpSource,
boolean checkDTCP)
Creates a DTCPConfiguration object from an InputSource.
|
DTCPConfiguration(org.xml.sax.InputSource dtcpSource,
net.sf.saxon.s9api.Processor suppliedProcessor)
Creates a DTCPConfiguration object from an InputSource.
|
DTCPConfiguration(org.xml.sax.InputSource dtcpSource,
net.sf.saxon.s9api.Processor suppliedProcessor,
boolean checkDTCP)
Creates a DTCPConfiguration object from an InputSource.
|
DTCPConfiguration(net.sf.saxon.s9api.XdmNode dtcpNode)
Creates a DTCPConfiguration object from a supplied XdmNode tree.
|
DTCPConfiguration(net.sf.saxon.s9api.XdmNode dtcpNode,
boolean checkDTCP)
Creates a DTCPConfiguration 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
DataComparator . |
DataComparator |
getComparator()
Returns the configured
DataComparator instance. |
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.
|
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 DTCP file.
|
getBooleanParameterList, getBooleanParameters, getDescription, getFormattedParametersDescription, getFormattedParametersDescription, getFullDescription, getId, getParameterDescriptions, getParameterList, getStringParameterList, getStringParameters, getSystemId, getURIResolver, setURIResolver, setURIResolver, toString
public DTCPConfiguration(java.io.File f, net.sf.saxon.s9api.Processor suppliedProcessor, boolean checkDTCP) throws StaticPDFormatException, java.io.FileNotFoundException
generate()
.f
- A File containing a DTCP configurationsuppliedProcessor
- A Saxon Processor instance. This will be used to process the DTCP file but will also be supplied to
the generated DataComparator instance as its underlying Processor. See
DataComparator(Processor)
for more details.checkDTCP
- Specifies whether to validate and perform other checks on input DTCPStaticPDFormatException
- if the DTCP file is not well-formed or validjava.io.FileNotFoundException
- if the DTCP file cannot be locatedpublic DTCPConfiguration(java.io.File f, boolean checkDTCP) throws StaticPDFormatException, java.io.FileNotFoundException
generate()
.f
- A File containing a DTCP configurationcheckDTCP
- Specifies whether to validate and perform other checks on input DTCPStaticPDFormatException
- if the DTCP file is not well-formed or validjava.io.FileNotFoundException
- if the DTCP file cannot be locatedpublic DTCPConfiguration(org.xml.sax.InputSource dtcpSource, net.sf.saxon.s9api.Processor suppliedProcessor, boolean checkDTCP) throws StaticPDFormatException
dtcpSource
- An InputSource containing a DTCP configurationsuppliedProcessor
- A Saxon Processor instance. This will be used to process the DTCP file but will also be supplied to
the generated DataComparator instance as its underlying Processor. See
DataComparator(Processor)
for more details.checkDTCP
- Specifies whether to validate and perform other checks on input DTCPStaticPDFormatException
- if the DTCP source is not well-formed or validpublic DTCPConfiguration(org.xml.sax.InputSource dtcpSource, boolean checkDTCP) throws StaticPDFormatException
dtcpSource
- An InputSource containing a DTCP configurationcheckDTCP
- Specifies whether to validate and perform other checks on input DTCPStaticPDFormatException
- if the DTCP source is not well-formed or validpublic DTCPConfiguration(net.sf.saxon.s9api.XdmNode dtcpNode, boolean checkDTCP) throws StaticPDFormatException
dtcpNode
- An XdmNode tree containing a DTCP configurationcheckDTCP
- Specifies whether to validate and perform other checks on input DTCPStaticPDFormatException
- if the DTCP document is not validpublic DTCPConfiguration(java.io.File f, net.sf.saxon.s9api.Processor suppliedProcessor) throws StaticPDFormatException, java.io.FileNotFoundException
generate()
.f
- A File containing a DTCP configurationsuppliedProcessor
- A Saxon Processor instance. This will be used to process the DTCP file but will also be supplied to
the generated DataComparator instance as its underlying Processor. See
DataComparator(Processor)
for more details.StaticPDFormatException
- if the DTCP file is not well-formed or validjava.io.FileNotFoundException
- if the DTCP file cannot be locatedpublic DTCPConfiguration(java.io.File f) throws StaticPDFormatException, java.io.FileNotFoundException
generate()
.f
- A File containing a DTCP configurationStaticPDFormatException
- if the DTCP file is not well-formed or validjava.io.FileNotFoundException
- if the DTCP file cannot be locatedpublic DTCPConfiguration(org.xml.sax.InputSource dtcpSource, net.sf.saxon.s9api.Processor suppliedProcessor) throws StaticPDFormatException
dtcpSource
- An InputSource containing a DTCP configurationsuppliedProcessor
- A Saxon Processor instance. This will be used to process the DTCP file but will also be supplied to
the generated DataComparator instance as its underlying Processor. See
DataComparator(Processor)
for more details.StaticPDFormatException
- if the DTCP source is not well-formed or validpublic DTCPConfiguration(org.xml.sax.InputSource dtcpSource) throws StaticPDFormatException
dtcpSource
- An InputSource containing a DTCP configurationStaticPDFormatException
- if the DTCP source is not well-formed or validpublic DTCPConfiguration(net.sf.saxon.s9api.XdmNode dtcpNode) throws StaticPDFormatException
dtcpNode
- An XdmNode tree containing a DTCP configurationStaticPDFormatException
- if the DTCP 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
DataComparator
. This method must only be called once.booleanOverrides
- A map of name, boolean value parameters with which to configure the generated DataComparator
stringOverrides
- A map of name, String value parameters with which to configure the generated DataComparator
DynamicPDFormatException
- if a problem is found when attempting to resolve DTCP valuesPDFilterConfigurationException
- if a problem is found when loading an XML filterStaticPDFormatException
- if the resolved DTCP 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 DynamicPDFormatException, PDAdvancedConfigException, PDFilterConfigurationException
generate()
method.booleanOverrides
- set parameter values for DTCP-defined boolean pipeline parametersstringOverrides
- set parameter values for DTCP-defined string pipeline parametersPDFilterConfigurationException
- if problem found while resolving DTCP valuesjava.lang.IllegalStateException
- if generate()
method has not been called firstDynamicPDFormatException
PDAdvancedConfigException
public DataComparator getComparator() throws java.lang.IllegalStateException
DataComparator
instance. Must be used after the generate()
method is called to
initialize the DataComparator
DataComparator
java.lang.IllegalStateException
- if generate()
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.