Package gov.nasa.pds.tools.label
Class LocationValidator
java.lang.Object
gov.nasa.pds.tools.label.LocationValidator
Implements a validator that validates a location (file or directory) against a validation rule
set. If no rule set is specified, an appropriate default is chosen.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValidator(DocumentValidator validator) booleanGets a singleton label validator.voidsetAllowUnlabeledFiles(boolean flag) voidsetCachedEntityResolver(CachedEntityResolver resolver) voidvoidsetCatalogs(List<String> catalogFiles) voidsetCheckData(boolean flag) voidsetCheckInbetweenFields(boolean flag) voidsetChecksumManifest(Map<URL, String> checksums) voidsetCompleteDescriptions(boolean b) voidsetContextMismatchAsWarn(boolean value) voidsetEveryN(int value) voidsetExtraTargetInContext(ArrayList<URL> alternateReferentialPaths) voidsetFileFilters(List<String> regExps) voidsetForce(boolean force) voidsetLabelExtension(String extension) voidsetLabelSchematrons(Map<String, String> labelSchematrons) voidsetLastDirectoryFlag(boolean flag) voidsetPDFErrorDir(String dir) voidsetRecurse(boolean traverse) voidsetRegisteredProducts(Map<String, List<ContextProductReference>> products) voidvoidForces a validation rule to use for the target location.voidvoidsetSchemaCheck(boolean value, boolean useLabelSchema) voidsetSchematronCheck(Boolean value, Boolean useLabelSchematron) voidsetSchematrons(List<String> schematrons) voidsetSkipProductValidation(boolean flag) voidsetSpotCheckData(int value) voidsetTargetRegistrar(TargetRegistrar registrar) Sets the target registrar for the next validation.voidsetTaskManager(TaskManager manager) Sets the task manager to use for running the validation tasks.voidsetValidateContext(boolean flag) voidvalidate(ValidateProblemHandler problemHandler, URL url) Validates a URL location with a given problem handler.voidValidates a location specified by a file or directory.void
-
Constructor Details
-
LocationValidator
public LocationValidator(ExceptionType logLevel) throws TransformerConfigurationException, ParserConfigurationException Creates a new instance.- Throws:
ParserConfigurationException- if a label validator cannot configure its parserTransformerConfigurationException- if a label validator cannot configure its transformer
-
-
Method Details
-
setReport
-
getCheckInbetweenFields
public boolean getCheckInbetweenFields() -
setCheckInbetweenFields
public void setCheckInbetweenFields(boolean flag) -
validate
Validates a location specified by a file or directory.- Parameters:
f- the file or directory to validate
-
validate
-
validate
Validates a URL location with a given problem handler. This must be a URL that can be resolved to a file location.- Parameters:
problemHandler- the problem handlerurl- the URL to validate- Throws:
URISyntaxException
-
setExtraTargetInContext
-
setTargetRegistrar
Sets the target registrar for the next validation.- Parameters:
registrar- the new target registrar
-
setTaskManager
Sets the task manager to use for running the validation tasks.- Parameters:
manager- the new task manager
-
setSchema
-
setSchematrons
-
setCachedEntityResolver
-
setCachedLSResourceResolver
-
setCatalogs
-
setSchemaCheck
public void setSchemaCheck(boolean value, boolean useLabelSchema) -
setSchematronCheck
-
addValidator
-
setLabelSchematrons
-
setForce
public void setForce(boolean force) -
setFileFilters
-
setRecurse
public void setRecurse(boolean traverse) -
setChecksumManifest
-
setCheckData
public void setCheckData(boolean flag) -
setRegisteredProducts
-
getLabelValidator
Gets a singleton label validator.- Returns:
- the label validator
-
setRule
Forces a validation rule to use for the target location.- Parameters:
ruleName- the name of the rule
-
setEveryN
public void setEveryN(int value) -
setContextMismatchAsWarn
public void setContextMismatchAsWarn(boolean value) -
setCompleteDescriptions
public void setCompleteDescriptions(boolean b) -
setSpotCheckData
public void setSpotCheckData(int value) -
setPDFErrorDir
-
setAllowUnlabeledFiles
public void setAllowUnlabeledFiles(boolean flag) -
setValidateContext
public void setValidateContext(boolean flag) -
setSkipProductValidation
public void setSkipProductValidation(boolean flag) -
setLabelExtension
-
setLastDirectoryFlag
public void setLastDirectoryFlag(boolean flag)
-