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 forPDFAValidator
s.- Author:
- Carl Wilson
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
configToXml(ValidatorConfig source)
Serialises aValidatorConfig
to XMLstatic void
configToXml(ValidatorConfig source, OutputStream dest)
Serialises aValidatorConfig
instance to its XML representation that's output to the passedOutputStream
.static ValidatorConfig
createConfig(InputStream source)
De-serialises aValidatorConfig
instance from it's XML representationstatic ValidatorConfig
createConfig(PDFAFlavour flavour, boolean recordPasses, int maxFails, boolean debug)
Create aValidatorConfig
instance from the passed values.static ValidatorConfig
createConfig(PDFAFlavour flavour, boolean recordPasses, int maxFails, boolean debug, boolean isLogsEnabled, Level loggingLevel)
static ValidatorConfig
createConfig(PDFAFlavour flavour, PDFAFlavour defaultFlavour, boolean recordPasses, int maxFails, boolean debug, boolean isLogsEnabled, Level loggingLevel, int maxNumberOfDisplayedFailedChecks, boolean showErrorMessages)
static PDFAValidator
createValidator(PDFAFlavour flavour, boolean logPassedChecks)
Creates a newPDFAValidator
instance that uses one of theValidationProfile
s packaged as a core library resource.static PDFAValidator
createValidator(PDFAFlavour flavour, boolean logPassedChecks, int maxFailures)
Creates a newPDFAValidator
instance that uses one of theValidationProfile
s packaged as a core library resource, seeValidators#createValidator(PDFAFlavour, boolean)
.static PDFAValidator
createValidator(PDFAFlavour flavour, boolean logPassedChecks, int maxFailures, boolean showErrorMessages)
static PDFAValidator
createValidator(PDFAFlavour flavour, int maxFailures)
Creates a newPDFAValidator
initialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.static PDFAValidator
createValidator(PDFAFlavour flavour, int maxNumberOfDisplayedFailedChecks, boolean logPassedChecks, boolean showErrorMessages)
static PDFAValidator
createValidator(ValidationProfile profile)
Creates a newPDFAValidator
initialised with the passed profile and configured NOT to log passed checks.static PDFAValidator
createValidator(ValidationProfile profile, boolean logPassedChecks)
Creates a newPDFAValidator
initialised with the passed profile and chosen passed test logging.static PDFAValidator
createValidator(ValidationProfile profile, boolean logPassedChecks, int maxFailures)
Creates a newPDFAValidator
initialised with the passed profile, chosen passed test logging and requested fast failing behaviour.static PDFAValidator
createValidator(ValidationProfile profile, boolean logPassedChecks, int maxFailures, boolean showErrorMessages)
static PDFAValidator
createValidator(ValidationProfile profile, int maxFailures)
Creates a newPDFAValidator
initialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.static PDFAValidator
createValidator(ValidationProfile profile, int maxNumberOfDisplayedFailedChecks, boolean logPassedChecks, boolean showErrorMessages)
static ValidatorConfig
defaultConfig()
-
-
-
Method Detail
-
createValidator
public static PDFAValidator createValidator(PDFAFlavour flavour, boolean logPassedChecks)
Creates a newPDFAValidator
instance that uses one of theValidationProfile
s packaged as a core library resource. While these profiles are not guaranteed to be up to date, they are available when offline. AProfileDirectory
populated with the pre-loaded profiles can be obtained by callingProfiles.getVeraProfileDirectory()
.- Parameters:
flavour
- thePDFAFlavour
that's associated with theValidationProfile
to used to initialise thePDFAValidator
.logPassedChecks
-boolean
used to configure logging of passed tests by thePDFAValidator
. Passtrue
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)
-
createValidator
public static PDFAValidator createValidator(PDFAFlavour flavour, boolean logPassedChecks, int maxFailures)
Creates a newPDFAValidator
instance that uses one of theValidationProfile
s packaged as a core library resource, seeValidators#createValidator(PDFAFlavour, boolean)
.- Parameters:
flavour
- thePDFAFlavour
that's associated with theValidationProfile
to used to initialise thePDFAValidator
.logPassedChecks
-boolean
used to configure logging of passed tests by thePDFAValidator
. Passtrue
to log passed tests,false
to only log tests that don't pass.maxFailures
- anint
value that configures thePDFAValidator
to abort validation aftermaxFailures
failed tests. IfmaxFailures
is less than 1 then thePDFAValidator
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, boolean showErrorMessages)
-
createValidator
public static PDFAValidator createValidator(ValidationProfile profile)
Creates a newPDFAValidator
initialised with the passed profile and configured NOT to log passed checks.- Parameters:
profile
- theValidationProfile
to be enforced by the returnedPDFAValidator
.- Returns:
- a
PDFAValidator
instance initialised from the passed parameters
-
createValidator
public static PDFAValidator createValidator(ValidationProfile profile, boolean logPassedChecks)
Creates a newPDFAValidator
initialised with the passed profile and chosen passed test logging.- Parameters:
profile
- theValidationProfile
to be enforced by the returnedPDFAValidator
.logPassedChecks
-boolean
used to configure logging of passed tests by thePDFAValidator
. Passtrue
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)
-
createValidator
public static PDFAValidator createValidator(ValidationProfile profile, int maxFailures)
Creates a newPDFAValidator
initialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.- Parameters:
profile
- theValidationProfile
to be enforced by the returnedPDFAValidator
.maxFailures
- anint
value that configures thePDFAValidator
to abort validation aftermaxFailures
failed tests. IfmaxFailures
is less than 1 then thePDFAValidator
will complete the full validation process.- Returns:
- a
PDFAValidator
instance initialised from the passed parameters
-
createValidator
public static PDFAValidator createValidator(PDFAFlavour flavour, int maxFailures)
Creates a newPDFAValidator
initialised with the passed profile, requested fast failing behaviour and configured NOT to log passed checks.- Parameters:
flavour
- thePDFAFlavour
that's associated with theValidationProfile
to used to initialise thePDFAValidator
.maxFailures
- anint
value that configures thePDFAValidator
to abort validation aftermaxFailures
failed tests. IfmaxFailures
is less than 1 then thePDFAValidator
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 newPDFAValidator
initialised with the passed profile, chosen passed test logging and requested fast failing behaviour.- Parameters:
profile
- theValidationProfile
to be enforced by the returnedPDFAValidator
.logPassedChecks
-boolean
used to configure logging of passed tests by thePDFAValidator
. Passtrue
to log passed tests,false
to only log tests that don't pass.maxFailures
- anint
value that configures thePDFAValidator
to abort validation aftermaxFailures
failed tests. IfmaxFailures
is less than 1 then thePDFAValidator
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, boolean showErrorMessages)
-
defaultConfig
public static ValidatorConfig defaultConfig()
- Returns:
- the default
ValidatorConfig
instance
-
createConfig
public static ValidatorConfig createConfig(PDFAFlavour flavour, boolean recordPasses, int maxFails, boolean debug)
Create aValidatorConfig
instance from the passed values.- Parameters:
flavour
- thePDFAFlavour
used for validationrecordPasses
- aboolean
parameter, settrue
to record passed checks,false
to only record failed checks.maxFails
- anint
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)
-
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 aValidatorConfig
instance from it's XML representation- Parameters:
source
- anInputStream
that is an XML representation of aValidatorConfig
- 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 aValidatorConfig
to XML- Parameters:
source
- aValidatorConfig
instance to serialise- Returns:
- a
String
containing the XML representation of the passedValidatorConfig
instance. - Throws:
JAXBException
- when there's an error serialising
-
configToXml
public static void configToXml(ValidatorConfig source, OutputStream dest) throws JAXBException
Serialises aValidatorConfig
instance to its XML representation that's output to the passedOutputStream
.- Parameters:
source
- theValidatorConfig
instance to serialisedest
- anOutputStream
to which the serialised instance will be written- Throws:
JAXBException
- when there's an error serialising
-
-