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 forPDFAValidators.- Author:
- Carl Wilson
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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)static ValidatorConfigcreateConfig(PDFAFlavour flavour, PDFAFlavour defaultFlavour, boolean recordPasses, int maxFails, boolean debug, boolean isLogsEnabled, Level loggingLevel, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages)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, boolean showErrorMessages)static PDFAValidatorcreateValidator(PDFAFlavour flavour, int maxFailures)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)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, boolean showErrorMessages)static PDFAValidatorcreateValidator(ValidationProfile profile, int maxFailures)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)static ValidatorConfigdefaultConfig()
-
-
-
Method Detail
-
createValidator
public static PDFAValidator createValidator(PDFAFlavour flavour, boolean logPassedChecks)
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)
-
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, boolean showErrorMessages)
-
createValidator
public static PDFAValidator createValidator(ValidationProfile profile)
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
public static PDFAValidator createValidator(ValidationProfile profile, boolean logPassedChecks)
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)
-
createValidator
public static PDFAValidator createValidator(ValidationProfile profile, int maxFailures)
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)
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, boolean showErrorMessages)
-
defaultConfig
public static ValidatorConfig 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)
-
createConfig
public static ValidatorConfig createConfig(PDFAFlavour flavour, PDFAFlavour defaultFlavour, boolean recordPasses, int maxFails, boolean debug, boolean isLogsEnabled, Level loggingLevel, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages)
-
createConfig
public static ValidatorConfig createConfig(InputStream source) throws JAXBException
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
public static String configToXml(ValidatorConfig source) throws JAXBException
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
public static void configToXml(ValidatorConfig source, OutputStream dest) throws JAXBException
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
-
-