Class Checker
Provides a pre-configured pipeline for document conversion validation.
The API allows for various input types:
Each of the input types performs required and unique pre-processing of the provided input file to standardize the format, before we can run the checker.
- Since:
- 0.1
- Author:
- Michael Polowczuk, Gursheen Kaur
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a progress listener.voidaddLicenseFile(File licenseFile) Adds the license file for use with Flexera licensing.voidaddLicenseServer(String hostname) Adds a license server for use with concurrent licensing.voidaddLicenseServer(String hostname, int port) Adds a license server and port for use with concurrent licensing.check(com.deltaxml.deltacheck.CheckerInput a, com.deltaxml.deltacheck.CheckerInput b) Compares twoCheckerInputinputs to produce aCheckerResult.booleanGets whether the production of debug files is on or not.Get the current prefix used for debug result files.Gets the explicitly set EntityResolver in use by the Checker.getEntityResolver(boolean builtInResolver) Gets the EntityResolver in use by the Checker.Gets comma-separated list of XPaths which defines the elements to ignore from conversion check.Gets the explicitly set URIResolver in use by the Checker.getURIResolver(boolean builtInResolver) Returns the current URI resolver setting.voidRemove a progress listener.voidsetDebugFiles(boolean enableDebug) Determines whether intermediate pipeline result files are generated.voidsetDebugFilesPrefix(String prefix) Provide a prefix for debug result files.voidsetEntityResolver(EntityResolver resolver, boolean fallbackToDefaultCatalogResolver) Sets the EntityResolver to use during the Check.voidsetIgnoreElements(String ignoreElements) Set which elements to ignore from conversion check.voidsetResultLocation(File dir) Sets the Result directory location.voidsetResultPrefix(String prefix) Sets the Result file prefix.voidsetURIResolver(URIResolver resolver, boolean fallbackToDefaultCatalogResolver) Sets the URIResolver to use during the Check.
-
Constructor Details
-
Checker
public Checker()Creates aCheckerto validate content between input types.
-
-
Method Details
-
check
public CheckerResult check(com.deltaxml.deltacheck.CheckerInput a, com.deltaxml.deltacheck.CheckerInput b) throws CheckCancelledException, com.deltaxml.licensing.LicenseException, FilterException, ParserException, InputLoadException, InvalidInputException, SerializationException, ContentEqualityCheckException Compares twoCheckerInputinputs to produce aCheckerResult.- Parameters:
a- ACheckerInputfor the A fileb- ACheckerInputfor the B file- Returns:
CheckerResultincluding a boolean if the checked content is equal, and a report summarising the changes- Throws:
CheckCancelledException- if comparison is cancelled via a cancellation policycom.deltaxml.licensing.LicenseException- if there is a licensing issue that prevents operationFilterException- if there was a problem running any of the internal filtersParserException- if there is a problem creating or configuring an XML parserInputLoadException- if there is a problem loading an input FileInvalidInputException- if an input file is not in the correct formatSerializationException- if there is a problem writing the result FileContentEqualityCheckException
-
addLicenseFile
public void addLicenseFile(File licenseFile) throws SecurityException, IOException, com.deltaxml.licensing.LicenseException Adds the license file for use with Flexera licensing. This can be either simple server/named-user license file or a concurrent license file containing the USE_SERVER directive- Parameters:
licenseFile- the FlexLM format license file- Throws:
SecurityException- if the file cannot be accessedIOException- if there are problems reading the filecom.deltaxml.licensing.LicenseException- if there is a problem using the license file
-
addLicenseServer
Adds a license server for use with concurrent licensing.- Parameters:
hostname- of the license server host or its ip address- Throws:
com.deltaxml.licensing.LicenseException- if there is a problem using the license server
-
addLicenseServer
public void addLicenseServer(String hostname, int port) throws IllegalArgumentException, com.deltaxml.licensing.LicenseException Adds a license server and port for use with concurrent licensing.- Parameters:
hostname- of the license server host or its ip addressport- the port number on the license server for the lmgrd- Throws:
IllegalArgumentException- if the port number is out of rangecom.deltaxml.licensing.LicenseException- if there is a problem using the license server
-
addCheckerProgressListener
Add a progress listener. This adds a progress listener to the list of registered progress listeners. The same listener may be added more than once.- Parameters:
listener- the progress listener to add.
-
removeCheckerProgressListener
Remove a progress listener. This removes the first occurrence of the progress listener from the registered progress listener list.- Parameters:
listener- the progress listener to remove.
-
getEntityResolver
Gets the explicitly set EntityResolver in use by the Checker.
- Returns:
- The current entity resolver in use.
-
getEntityResolver
Gets the EntityResolver in use by the Checker.
- Parameters:
builtInResolver- Whether to get the built-in resolver (with any explicit enhancement), or just the explicitly set resolver.- Returns:
- The current entity resolver in use.
-
setEntityResolver
Sets the EntityResolver to use during the Check.
By default, the Apache Commons Resolver is used as an EntityResolver. If you wish to use a different one, set it up using this method. Note you can turn off the default catalog support by providing a
nullresolver and setting thefallbackToDefaultCatalogResolvertofalse.- Parameters:
resolver- The resolver to use. Using null removes an existing resolver.fallbackToDefaultCatalogResolver- Sets whether to use the inbuilt catalog resolver if the provided resolver fails to resolve the entity.
-
getURIResolver
Gets the explicitly set URIResolver in use by the Checker.
- Returns:
- the explicitly set URIResolver in use by the Checker.
-
getURIResolver
Returns the current URI resolver setting.
- Parameters:
builtInResolver- Whether to get the built-in resolver (with any explicit enhancement), or just the explicitly set resolver.- Returns:
- the explicitly set URIResolver in use by the Checker.
-
setURIResolver
Sets the URIResolver to use during the Check.
By default, the Apache Commons Resolver is used as an URIResolver. If you wish to use a different one, set it up using this method. Note you can turn off the default catalog support by providing a
nullresolver and setting thefallbackToDefaultCatalogResolvertofalse.- Parameters:
resolver- The resolver to use. Using null removes an existing resolver.fallbackToDefaultCatalogResolver- Sets whether to use the inbuilt catalog resolver if the provided resolver fails to resolve the URI.
-
setDebugFilesPrefix
Provide a prefix for debug result files.- Parameters:
prefix- The prefix that will be used for debug file names in subsequent Check operations.- See Also:
-
getDebugFilesPrefix
Get the current prefix used for debug result files.- Returns:
- the current prefix used for debug result files.
- See Also:
-
setDebugFiles
public void setDebugFiles(boolean enableDebug) Determines whether intermediate pipeline result files are generated. When developing a pipelined application it is sometimes useful to see the intermediate results. This debug option when set will generate a file containing the XML corresponding the intermediate result of most of the pipeline stages.
- Parameters:
enableDebug- when true intermediate result files are produced and stored in a directory using the debugFilesPrefix set.- See Also:
-
getDebugFiles
public boolean getDebugFiles()Gets whether the production of debug files is on or not.
- Returns:
- whether the production of debug files is on or not.
- See Also:
-
setResultLocation
Sets the Result directory location.
- Parameters:
dir- The directory location where the result should be written to.
-
setResultPrefix
Sets the Result file prefix.
- Parameters:
prefix- The prefix if any to be added to the result name
-
getIgnoreElements
Gets comma-separated list of XPaths which defines the elements to ignore from conversion check.
- Returns:
- the comma-separated list of xpaths which defines the elements to ignore
-
setIgnoreElements
Set which elements to ignore from conversion check.
- Parameters:
ignoreElements- a comma-separated list of XPaths which defines the elements to ignore.
-