Class ValidatorFactory

java.lang.Object
org.verapdf.pdfa.validation.validators.ValidatorFactory

public final class ValidatorFactory extends Object
Static utility class that fills in for a factory for PDFAValidators.
Author:
Carl Wilson
  • Method Details

    • createValidator

      public static PDFAValidator createValidator(PDFAFlavour flavour, boolean logPassedChecks)
      Creates a new PDFAValidator instance that uses one of the ValidationProfiles packaged as a core library resource. While these profiles are not guaranteed to be up to date, they are available when offline. A ProfileDirectory populated with the pre-loaded profiles can be obtained by calling Profiles.getVeraProfileDirectory().
      Parameters:
      flavour - the PDFAFlavour that's associated with the ValidationProfile to used to initialise the PDFAValidator.
      logPassedChecks - boolean used to configure logging of passed tests by the PDFAValidator. Pass true to log passed tests, false to only log tests that don't pass.
      Returns:
      a PDFAValidator instance initialised from the passed parameters
    • createValidator

      public static PDFAValidator createValidator(PDFAFlavour flavour, int maxNumberOfDisplayedFailedChecks, boolean logPassedChecks, boolean showErrorMessages, boolean showProgress)
    • createValidator

      public static PDFAValidator createValidator(PDFAFlavour flavour, boolean logPassedChecks, int maxFailures)
      Creates a new PDFAValidator instance that uses one of the ValidationProfiles packaged as a core library resource, see Validators#createValidator(PDFAFlavour, boolean).
      Parameters:
      flavour - the PDFAFlavour that's associated with the ValidationProfile to used to initialise the PDFAValidator.
      logPassedChecks - boolean used to configure logging of passed tests by the PDFAValidator. Pass true to log passed tests, false to only log tests that don't pass.
      maxFailures - an int value that configures the PDFAValidator to abort validation after maxFailures failed tests. If maxFailures is less than 1 then the PDFAValidator will complete the full validation process.
      Returns:
      a PDFAValidator instance initialised from the passed parameters
    • createValidator

      public static PDFAValidator createValidator(PDFAFlavour flavour, boolean logPassedChecks, int maxFailures, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages, boolean showProgress)
    • createValidator

      public static PDFAValidator createValidator(ValidationProfile profile)
      Creates a new PDFAValidator initialised with the passed profile and configured NOT to log passed checks.
      Parameters:
      profile - the ValidationProfile to be enforced by the returned PDFAValidator.
      Returns:
      a PDFAValidator instance initialised from the passed parameters
    • createValidator

      public static PDFAValidator createValidator(ValidationProfile profile, boolean logPassedChecks)
      Creates a new PDFAValidator initialised with the passed profile and chosen passed test logging.
      Parameters:
      profile - the ValidationProfile to be enforced by the returned PDFAValidator.
      logPassedChecks - boolean used to configure logging of passed tests by the PDFAValidator. Pass true to log passed tests, false to only log tests that don't pass.
      Returns:
      a PDFAValidator instance initialised from the passed parameters
    • createValidator

      public static PDFAValidator createValidator(ValidationProfile profile, int maxNumberOfDisplayedFailedChecks, boolean logPassedChecks, boolean showErrorMessages, boolean showProgress)
    • createValidator

      public static PDFAValidator createValidator(ValidationProfile profile, int maxFailures, boolean showProgress)
      Creates a new PDFAValidator initialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.
      Parameters:
      profile - the ValidationProfile to be enforced by the returned PDFAValidator.
      maxFailures - an int value that configures the PDFAValidator to abort validation after maxFailures failed tests. If maxFailures is less than 1 then the PDFAValidator will complete the full validation process.
      Returns:
      a PDFAValidator instance initialised from the passed parameters
    • createValidator

      public static PDFAValidator createValidator(PDFAFlavour flavour, int maxFailures, boolean showProgress)
      Creates a new PDFAValidator initialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.
      Parameters:
      flavour - the PDFAFlavour that's associated with the ValidationProfile to used to initialise the PDFAValidator.
      maxFailures - an int value that configures the PDFAValidator to abort validation after maxFailures failed tests. If maxFailures is less than 1 then the PDFAValidator will complete the full validation process.
      Returns:
      a PDFAValidator instance initialised from the passed parameters
    • createValidator

      public static PDFAValidator createValidator(ValidationProfile profile, boolean logPassedChecks, int maxFailures)
      Creates a new PDFAValidator initialised with the passed profile, chosen passed test logging and requested fast failing behaviour.
      Parameters:
      profile - the ValidationProfile to be enforced by the returned PDFAValidator.
      logPassedChecks - boolean used to configure logging of passed tests by the PDFAValidator. Pass true to log passed tests, false to only log tests that don't pass.
      maxFailures - an int value that configures the PDFAValidator to abort validation after maxFailures failed tests. If maxFailures is less than 1 then the PDFAValidator will complete the full validation process.
      Returns:
      a PDFAValidator instance initialised from the passed parameters
    • createValidator

      public static PDFAValidator createValidator(ValidationProfile profile, boolean logPassedChecks, int maxFailures, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages, boolean showProgress)
    • defaultConfig

      public static ValidatorConfig defaultConfig()
      Returns:
      the default ValidatorConfig instance
    • createConfig

      public static ValidatorConfig createConfig(PDFAFlavour flavour, boolean recordPasses, int maxFails, boolean debug)
      Create a ValidatorConfig instance from the passed values.
      Parameters:
      flavour - the PDFAFlavour used for validation
      recordPasses - a boolean parameter, set true to record passed checks, false to only record failed checks.
      maxFails - an int value for the number of failed checks encountered before ending validation.
      Returns:
      a new ValidatorConfig instance created from the passed values.
    • createConfig

      public static ValidatorConfig createConfig(PDFAFlavour flavour, boolean recordPasses, int maxFails, boolean debug, boolean isLogsEnabled, Level loggingLevel, String password, boolean showProgress)
    • createConfig

      public static ValidatorConfig createConfig(PDFAFlavour flavour, PDFAFlavour defaultFlavour, boolean recordPasses, int maxFails, boolean debug, boolean isLogsEnabled, Level loggingLevel, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages, String password, boolean showProgress, boolean nonPDFExtension)
    • createConfig

      public static ValidatorConfig createConfig(InputStream source) throws JAXBException
      De-serialises a ValidatorConfig instance from it's XML representation
      Parameters:
      source - an InputStream that is an XML representation of a ValidatorConfig
      Returns:
      a ValidatorConfig instance created from the passed XML stream
      Throws:
      JAXBException - when there's an error de-serialising
    • configToXml

      public static String configToXml(ValidatorConfig source) throws JAXBException
      Serialises a ValidatorConfig to XML
      Parameters:
      source - a ValidatorConfig instance to serialise
      Returns:
      a String containing the XML representation of the passed ValidatorConfig instance.
      Throws:
      JAXBException - when there's an error serialising
    • configToXml

      public static void configToXml(ValidatorConfig source, OutputStream dest) throws JAXBException
      Serialises a ValidatorConfig instance to its XML representation that's output to the passed OutputStream.
      Parameters:
      source - the ValidatorConfig instance to serialise
      dest - an OutputStream to which the serialised instance will be written
      Throws:
      JAXBException - when there's an error serialising