Class Checker

java.lang.Object
com.deltaxml.deltacheck.Checker

public class Checker extends Object

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 Details

    • Checker

      public Checker()
      Creates a Checker to 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 two CheckerInput inputs to produce a CheckerResult.
      Parameters:
      a - A CheckerInput for the A file
      b - A CheckerInput for the B file
      Returns:
      CheckerResult including a boolean if the checked content is equal, and a report summarising the changes
      Throws:
      CheckCancelledException - if comparison is cancelled via a cancellation policy
      com.deltaxml.licensing.LicenseException - if there is a licensing issue that prevents operation
      FilterException - if there was a problem running any of the internal filters
      ParserException - if there is a problem creating or configuring an XML parser
      InputLoadException - if there is a problem loading an input File
      InvalidInputException - if an input file is not in the correct format
      SerializationException - if there is a problem writing the result File
      ContentEqualityCheckException
    • 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 accessed
      IOException - if there are problems reading the file
      com.deltaxml.licensing.LicenseException - if there is a problem using the license file
    • addLicenseServer

      public void addLicenseServer(String hostname) throws com.deltaxml.licensing.LicenseException
      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 address
      port - the port number on the license server for the lmgrd
      Throws:
      IllegalArgumentException - if the port number is out of range
      com.deltaxml.licensing.LicenseException - if there is a problem using the license server
    • addCheckerProgressListener

      public void addCheckerProgressListener(CheckerProgressListener listener)
      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

      public void removeCheckerProgressListener(CheckerProgressListener listener)
      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

      public EntityResolver getEntityResolver()

      Gets the explicitly set EntityResolver in use by the Checker.

      Returns:
      The current entity resolver in use.
    • getEntityResolver

      public EntityResolver getEntityResolver(boolean builtInResolver)

      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

      public void setEntityResolver(EntityResolver resolver, boolean fallbackToDefaultCatalogResolver)

      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 null resolver and setting the fallbackToDefaultCatalogResolver to false.

      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

      public URIResolver getURIResolver()

      Gets the explicitly set URIResolver in use by the Checker.

      Returns:
      the explicitly set URIResolver in use by the Checker.
    • getURIResolver

      public URIResolver getURIResolver(boolean builtInResolver)

      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

      public void setURIResolver(URIResolver resolver, boolean fallbackToDefaultCatalogResolver)

      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 null resolver and setting the fallbackToDefaultCatalogResolver to false.

      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

      public void setDebugFilesPrefix(String prefix)
      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

      public String 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

      public void setResultLocation(File dir)

      Sets the Result directory location.

      Parameters:
      dir - The directory location where the result should be written to.
    • setResultPrefix

      public void setResultPrefix(String prefix)

      Sets the Result file prefix.

      Parameters:
      prefix - The prefix if any to be added to the result name
    • getIgnoreElements

      public String 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

      public void setIgnoreElements(String ignoreElements)

      Set which elements to ignore from conversion check.

      Parameters:
      ignoreElements - a comma-separated list of XPaths which defines the elements to ignore.