Package gov.nasa.pds.tools.label
Class LocationValidator
java.lang.Object
gov.nasa.pds.tools.label.LocationValidator
public class LocationValidator extends Object
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 Constructor Description LocationValidator(ExceptionType logLevel)
Creates a new instance. -
Method Summary
Modifier and Type Method Description void
addValidator(DocumentValidator validator)
LabelValidator
getLabelValidator()
Gets a singleton label validator.void
setAllowUnlabeledFiles(boolean flag)
void
setCachedEntityResolver(CachedEntityResolver resolver)
void
setCachedLSResourceResolver(CachedLSResourceResolver resolver)
void
setCatalogs(List<String> catalogFiles)
void
setCheckData(boolean flag)
void
setChecksumManifest(Map<URL,String> checksums)
void
setExtraTargetInContext(ArrayList<URL> alternateReferentialPaths)
void
setFileFilters(List<String> regExps)
void
setForce(boolean force)
void
setLabelSchematrons(Map<String,Transformer> labelSchematrons)
void
setRecurse(boolean traverse)
void
setRegisteredProducts(Map<String,List<ContextProductReference>> products)
void
setRule(String ruleName)
Forces a validation rule to use for the target location.void
setSchema(List<URL> schemaFiles)
void
setSchemaCheck(boolean value, boolean useLabelSchema)
void
setSchematronCheck(Boolean value, Boolean useLabelSchematron)
void
setSchematrons(List<Transformer> schematrons)
void
setSkipProductValidation(boolean flag)
void
setSpotCheckData(int value)
void
setTargetRegistrar(TargetRegistrar registrar)
Sets the target registrar for the next validation.void
setTaskManager(TaskManager manager)
Sets the task manager to use for running the validation tasks.void
setValidateContext(boolean flag)
void
validate(ValidateProblemHandler problemHandler, URL url)
Validates a URL location with a given problem handler.void
validate(File f)
Validates a location specified by a file or directory.void
validate(URL target)
-
Constructor Details
-
LocationValidator
public LocationValidator(ExceptionType logLevel) throws TransformerConfigurationException, ParserConfigurationExceptionCreates a new instance.- Throws:
ParserConfigurationException
- if a label validator cannot configure its parserTransformerConfigurationException
- if a label validator cannot configure its transformer
-
-
Method Details
-
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
-
setSpotCheckData
public void setSpotCheckData(int value) -
setAllowUnlabeledFiles
public void setAllowUnlabeledFiles(boolean flag) -
setValidateContext
public void setValidateContext(boolean flag) -
setSkipProductValidation
public void setSkipProductValidation(boolean flag)
-