Class ValidatorFactory
java.lang.Object
org.verapdf.pdfa.validation.validators.ValidatorFactory
Static utility class that fills in for a factory for
PDFAValidators.- Author:
- Carl Wilson
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringconfigToXml(ValidatorConfig source) Serialises aValidatorConfigto XMLstatic voidconfigToXml(ValidatorConfig source, OutputStream dest) Serialises aValidatorConfiginstance to its XML representation that's output to the passedOutputStream.static ValidatorConfigcreateConfig(InputStream source) De-serialises aValidatorConfiginstance from it's XML representationstatic ValidatorConfigcreateConfig(PDFAFlavour flavour, boolean recordPasses, int maxFails, boolean debug) Create aValidatorConfiginstance from the passed values.static ValidatorConfigcreateConfig(PDFAFlavour flavour, boolean recordPasses, int maxFails, boolean debug, boolean isLogsEnabled, Level loggingLevel, String password, boolean showProgress) static ValidatorConfigcreateConfig(PDFAFlavour flavour, PDFAFlavour defaultFlavour, boolean recordPasses, int maxFails, boolean debug, boolean isLogsEnabled, Level loggingLevel, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages, String password, boolean showProgress, boolean nonPDFExtension) static PDFAValidatorcreateValidator(PDFAFlavour flavour, boolean logPassedChecks) Creates a newPDFAValidatorinstance that uses one of theValidationProfiles packaged as a core library resource.static PDFAValidatorcreateValidator(PDFAFlavour flavour, boolean logPassedChecks, int maxFailures) Creates a newPDFAValidatorinstance that uses one of theValidationProfiles packaged as a core library resource, seeValidators#createValidator(PDFAFlavour, boolean).static PDFAValidatorcreateValidator(PDFAFlavour flavour, boolean logPassedChecks, int maxFailures, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages, boolean showProgress) static PDFAValidatorcreateValidator(PDFAFlavour flavour, int maxFailures, boolean showProgress) Creates a newPDFAValidatorinitialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.static PDFAValidatorcreateValidator(PDFAFlavour flavour, int maxNumberOfDisplayedFailedChecks, boolean logPassedChecks, boolean showErrorMessages, boolean showProgress) static PDFAValidatorcreateValidator(ValidationProfile profile) Creates a newPDFAValidatorinitialised with the passed profile and configured NOT to log passed checks.static PDFAValidatorcreateValidator(ValidationProfile profile, boolean logPassedChecks) Creates a newPDFAValidatorinitialised with the passed profile and chosen passed test logging.static PDFAValidatorcreateValidator(ValidationProfile profile, boolean logPassedChecks, int maxFailures) Creates a newPDFAValidatorinitialised with the passed profile, chosen passed test logging and requested fast failing behaviour.static PDFAValidatorcreateValidator(ValidationProfile profile, boolean logPassedChecks, int maxFailures, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages, boolean showProgress) static PDFAValidatorcreateValidator(ValidationProfile profile, int maxFailures, boolean showProgress) Creates a newPDFAValidatorinitialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.static PDFAValidatorcreateValidator(ValidationProfile profile, int maxNumberOfDisplayedFailedChecks, boolean logPassedChecks, boolean showErrorMessages, boolean showProgress) static ValidatorConfig
-
Method Details
-
createValidator
Creates a newPDFAValidatorinstance that uses one of theValidationProfiles packaged as a core library resource. While these profiles are not guaranteed to be up to date, they are available when offline. AProfileDirectorypopulated with the pre-loaded profiles can be obtained by callingProfiles.getVeraProfileDirectory().- Parameters:
flavour- thePDFAFlavourthat's associated with theValidationProfileto used to initialise thePDFAValidator.logPassedChecks-booleanused to configure logging of passed tests by thePDFAValidator. Passtrueto log passed tests,falseto only log tests that don't pass.- Returns:
- a
PDFAValidatorinstance 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 newPDFAValidatorinstance that uses one of theValidationProfiles packaged as a core library resource, seeValidators#createValidator(PDFAFlavour, boolean).- Parameters:
flavour- thePDFAFlavourthat's associated with theValidationProfileto used to initialise thePDFAValidator.logPassedChecks-booleanused to configure logging of passed tests by thePDFAValidator. Passtrueto log passed tests,falseto only log tests that don't pass.maxFailures- anintvalue that configures thePDFAValidatorto abort validation aftermaxFailuresfailed tests. IfmaxFailuresis less than 1 then thePDFAValidatorwill complete the full validation process.- Returns:
- a
PDFAValidatorinstance initialised from the passed parameters
-
createValidator
public static PDFAValidator createValidator(PDFAFlavour flavour, boolean logPassedChecks, int maxFailures, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages, boolean showProgress) -
createValidator
Creates a newPDFAValidatorinitialised with the passed profile and configured NOT to log passed checks.- Parameters:
profile- theValidationProfileto be enforced by the returnedPDFAValidator.- Returns:
- a
PDFAValidatorinstance initialised from the passed parameters
-
createValidator
Creates a newPDFAValidatorinitialised with the passed profile and chosen passed test logging.- Parameters:
profile- theValidationProfileto be enforced by the returnedPDFAValidator.logPassedChecks-booleanused to configure logging of passed tests by thePDFAValidator. Passtrueto log passed tests,falseto only log tests that don't pass.- Returns:
- a
PDFAValidatorinstance 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 newPDFAValidatorinitialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.- Parameters:
profile- theValidationProfileto be enforced by the returnedPDFAValidator.maxFailures- anintvalue that configures thePDFAValidatorto abort validation aftermaxFailuresfailed tests. IfmaxFailuresis less than 1 then thePDFAValidatorwill complete the full validation process.- Returns:
- a
PDFAValidatorinstance initialised from the passed parameters
-
createValidator
public static PDFAValidator createValidator(PDFAFlavour flavour, int maxFailures, boolean showProgress) Creates a newPDFAValidatorinitialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.- Parameters:
flavour- thePDFAFlavourthat's associated with theValidationProfileto used to initialise thePDFAValidator.maxFailures- anintvalue that configures thePDFAValidatorto abort validation aftermaxFailuresfailed tests. IfmaxFailuresis less than 1 then thePDFAValidatorwill complete the full validation process.- Returns:
- a
PDFAValidatorinstance initialised from the passed parameters
-
createValidator
public static PDFAValidator createValidator(ValidationProfile profile, boolean logPassedChecks, int maxFailures) Creates a newPDFAValidatorinitialised with the passed profile, chosen passed test logging and requested fast failing behaviour.- Parameters:
profile- theValidationProfileto be enforced by the returnedPDFAValidator.logPassedChecks-booleanused to configure logging of passed tests by thePDFAValidator. Passtrueto log passed tests,falseto only log tests that don't pass.maxFailures- anintvalue that configures thePDFAValidatorto abort validation aftermaxFailuresfailed tests. IfmaxFailuresis less than 1 then thePDFAValidatorwill complete the full validation process.- Returns:
- a
PDFAValidatorinstance initialised from the passed parameters
-
createValidator
public static PDFAValidator createValidator(ValidationProfile profile, boolean logPassedChecks, int maxFailures, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages, boolean showProgress) -
defaultConfig
- Returns:
- the default
ValidatorConfiginstance
-
createConfig
public static ValidatorConfig createConfig(PDFAFlavour flavour, boolean recordPasses, int maxFails, boolean debug) Create aValidatorConfiginstance from the passed values.- Parameters:
flavour- thePDFAFlavourused for validationrecordPasses- abooleanparameter, settrueto record passed checks,falseto only record failed checks.maxFails- anintvalue for the number of failed checks encountered before ending validation.- Returns:
- a new
ValidatorConfiginstance 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
De-serialises aValidatorConfiginstance from it's XML representation- Parameters:
source- anInputStreamthat is an XML representation of aValidatorConfig- Returns:
- a
ValidatorConfiginstance created from the passed XML stream - Throws:
JAXBException- when there's an error de-serialising
-
configToXml
Serialises aValidatorConfigto XML- Parameters:
source- aValidatorConfiginstance to serialise- Returns:
- a
Stringcontaining the XML representation of the passedValidatorConfiginstance. - Throws:
JAXBException- when there's an error serialising
-
configToXml
Serialises aValidatorConfiginstance to its XML representation that's output to the passedOutputStream.- Parameters:
source- theValidatorConfiginstance to serialisedest- anOutputStreamto which the serialised instance will be written- Throws:
JAXBException- when there's an error serialising
-