Class RuleContext

  • All Implemented Interfaces:
    Serializable, Cloneable, Map, org.apache.commons.chain.Context

    public class RuleContext
    extends org.apache.commons.chain.impl.ContextBase
    Implements a type-safe context for using validation rules in commands and chains.
    See Also:
    Serialized Form
    • Field Detail

      • LOCATION_VALIDATOR_KEY

        public static final String LOCATION_VALIDATOR_KEY
        The key used to retrieve the top-level validator for getting singleton utilities.
        See Also:
        Constant Field Values
      • FORCE_LABEL_SCHEMA_VALIDATION

        public static final String FORCE_LABEL_SCHEMA_VALIDATION
        The key used to indicate that declared schema and Schematron files in a label should be validated before the label is validate.
        See Also:
        Constant Field Values
      • RECURSIVE_VALIDATION

        public static final String RECURSIVE_VALIDATION
        The key used to set whether to validate recursively.
        See Also:
        Constant Field Values
      • TARGET_KEY

        public static final String TARGET_KEY
        The key used to retrieve the current validation target from the execution context.
        See Also:
        Constant Field Values
      • ADDITIONAL_TARGET_KEY

        public static final String ADDITIONAL_TARGET_KEY
        Key used to retrieve additional targets.
        See Also:
        Constant Field Values
      • LISTENER_KEY

        public static final String LISTENER_KEY
        The key used to retrieve the definition listener from the execution context.
        See Also:
        Constant Field Values
      • REGISTRAR_KEY

        public static final String REGISTRAR_KEY
        The key used to retrieve the validation registrar from the execution context.
        See Also:
        Constant Field Values
      • RULE_MANAGER_KEY

        public static final String RULE_MANAGER_KEY
        The key used to retrieve the rule manager from the context.
        See Also:
        Constant Field Values
      • PARENT_TARGET_KEY

        public static final String PARENT_TARGET_KEY
        The key used to retrieve the parent target from the context.
        See Also:
        Constant Field Values
      • CHECKSUM_MANIFEST_KEY

        public static final String CHECKSUM_MANIFEST_KEY
        The key used to retrieve a hash map containing the checksum values from a given checksum manifest.
        See Also:
        Constant Field Values
      • CATALOG_RESOLVER

        public static final String CATALOG_RESOLVER
        The key used to retrieve the XMLCatalogResolver object.
        See Also:
        Constant Field Values
      • CHECK_DATA_KEY

        public static final String CHECK_DATA_KEY
        The key used to indicate whether to disable data content validation.
        See Also:
        Constant Field Values
      • EVERY_N_KEY

        public static final String EVERY_N_KEY
        The key used to indicate how many lines or records to skip during content validation.
        See Also:
        Constant Field Values
      • SPOT_CHECK_DATA_KEY

        public static final String SPOT_CHECK_DATA_KEY
        The key used to indicate how many lines or records to skip during content validation.
        See Also:
        Constant Field Values
      • ALLOW_UNLABELED_FILES_KEY

        public static final String ALLOW_UNLABELED_FILES_KEY
        Key used to tell the tool to allow unlabeled files in a bundle or collection.
        See Also:
        Constant Field Values
      • REGISTERED_PRODUCTS_KEY

        public static final String REGISTERED_PRODUCTS_KEY
        Key used to store a map of registered Product LIDVIDs.
        See Also:
        Constant Field Values
      • CONTEXT_VALIDATION_KEY

        public static final String CONTEXT_VALIDATION_KEY
        The key used to indicate whether to disable context validation.
        See Also:
        Constant Field Values
      • SKIP_PRODUCT_VALIDATION_KEY

        public static final String SKIP_PRODUCT_VALIDATION_KEY
        Key used to ignore(skip) product level validation.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RuleContext

        public RuleContext()
    • Method Detail

      • getContextValue

        public <T> T getContextValue​(String key,
                                     Class<T> clazz)
        Gets a value from the context in a type-safe manner.
        Parameters:
        key - the key
        clazz - the expected class
        Returns:
        the value, or null if there is no value with that key
      • putContextValue

        public <T> void putContextValue​(String key,
                                        T value)
        Puts a value into the context in a type-safe manner.
        Parameters:
        key - the key
        value - the value
      • setLogLevel

        public void setLogLevel​(ExceptionType logLevel)
      • getTarget

        public URL getTarget()
      • setProblemListener

        public void setProblemListener​(ProblemListener listener)
      • setTargetRegistrar

        public void setTargetRegistrar​(TargetRegistrar registrar)
      • getRuleManager

        public ValidationRuleManager getRuleManager()
        Gets the rule manager used to find other rules to apply.
        Returns:
        the rule manager
      • setRuleManager

        public void setRuleManager​(ValidationRuleManager ruleManager)
        Sets the rule manager to use for finding new rules.
        Parameters:
        ruleManager - the rule manager
      • getParentTarget

        public String getParentTarget()
        Gets the parent target location.
        Returns:
        the parent target location, or null if there is no parent target
      • setParentTarget

        public void setParentTarget​(String parentLocation)
        Sets the parent target location.
        Parameters:
        parent - the parent target location
      • isRootTarget

        public boolean isRootTarget()
        Tests whether this is the root target for the validation.
        Returns:
        true, if this context is for the root target
      • setRootTarget

        public void setRootTarget​(boolean flag)
        Sets whether this is the root target for the validation.
        Parameters:
        flag - true, if this context is for the root target
      • getRootValidator

        public LocationValidator getRootValidator()
        Gets the top-level validator for getting singleton utilities, such as the label validator.
        Returns:
        the top-level validator
      • setRootValidator

        public void setRootValidator​(LocationValidator validator)
        Sets the top-level validator.
        Parameters:
        validator - the top-level validator
      • isRecursive

        public boolean isRecursive()
      • setRecursive

        public void setRecursive​(boolean isRecursive)
      • setFileFilters

        public void setFileFilters​(List<String> filters)
      • isForceLabelSchemaValidation

        public boolean isForceLabelSchemaValidation()
        Tests whether to force validation of schemas and Schematrons defined in a label file.
        Returns:
        true, if declared schema and Schematron files should be validated
      • setForceLabelSchemaValidation

        public void setForceLabelSchemaValidation​(boolean force)
        Sets whether to force schema and Schematron validation defined in a label.
        Parameters:
        force - true, if declared schema and Schematron files should be validated
      • getCrawler

        public Crawler getCrawler()
      • setCrawler

        public void setCrawler​(Crawler crawler)
      • setChecksumManifest

        public void setChecksumManifest​(Map<URL,​String> manifest)
      • getChecksumManifest

        public Map<URL,​String> getChecksumManifest()
      • setCatalogs

        public void setCatalogs​(List<String> catalogs)
      • setCatalogResolver

        public void setCatalogResolver​(XMLCatalogResolver catalogResolver)
      • getCheckData

        public boolean getCheckData()
      • setCheckData

        public void setCheckData​(boolean flag)
      • getEveryN

        public int getEveryN()
      • setEveryN

        public void setEveryN​(int value)
      • getSpotCheckData

        public int getSpotCheckData()
      • setSpotCheckData

        public void setSpotCheckData​(int value)
      • getAllowUnlabeledFiles

        public boolean getAllowUnlabeledFiles()
      • setAllowUnlabeledFiles

        public void setAllowUnlabeledFiles​(boolean flag)
      • getValidateContext

        public boolean getValidateContext()
      • setValidateContext

        public void setValidateContext​(boolean flag)
      • getSkipProductValidation

        public boolean getSkipProductValidation()
      • setSkipProductValidation

        public void setSkipProductValidation​(boolean flag)
      • getCheckInbetweenFields

        public boolean getCheckInbetweenFields()
      • setCheckInbetweenFields

        public void setCheckInbetweenFields​(boolean flag)
      • getLabelExtension

        public String getLabelExtension()
      • setLabelExtension

        public void setLabelExtension​(String labelExtension)
        Set the label extension and the file name patterns to match
        Parameters:
        labelExtension -
      • getLabelPattern

        public Pattern getLabelPattern()
      • setLabelPattern

        public void setLabelPattern​(Pattern pattern)
      • setLabelPatternWithExtension

        public void setLabelPatternWithExtension​(String labelExtension)
      • getBundleLabelPattern

        public Pattern getBundleLabelPattern()
      • setBundleLabelPattern

        public void setBundleLabelPattern​(Pattern pattern)
      • setBundleLabelPatternWithExtension

        public void setBundleLabelPatternWithExtension​(String labelExtension)
      • getCollectionLabelPattern

        public Pattern getCollectionLabelPattern()
      • setCollectionLabelPattern

        public void setCollectionLabelPattern​(Pattern pattern)
      • setCollectionLabelPatternWithExtension

        public void setCollectionLabelPatternWithExtension​(String labelExtension)
      • isLastDirectory

        public boolean isLastDirectory()
      • setLastDirectoryFlag

        public void setLastDirectoryFlag​(boolean flag)