Interface ValidationAction

All Superinterfaces:
Action
All Known Implementing Classes:
CdfValidationAction, CelValidationAction, GtfValidationAction, SingleFileValidationAction

public interface ValidationAction
extends Action
Action for validating and metadata extraction from files in a file set. This action is used in two different contexts:

Tip! For validators that works on a single file at a time the SingleFileValidationAction can be used as a base class.

Since:
3.0
Author:
Nicklas
Last modified
$Date: 2011-10-21 13:15:41 +0200 (fr, 21 okt 2011) $
  • Method Summary

    Modifier and Type Method Description
    Accept acceptFile​(FileSetMember member)
    Check if the given file is handled by this validator implementation or not?
    void resetMetadata()
    Reset all metadata that this class normally can set.
    void validateAndExtractMetadata()
    Validate and extract metadata from the file(s) that has been added to this validator.
  • Method Details

    • acceptFile

      Accept acceptFile​(FileSetMember member)
      Check if the given file is handled by this validator implementation or not? No validation of the actual file data should take place in this method. This method is called by the core for all members of the file set that are still considered as valid. If another validator has marked a file as invalid it will not be offered to the remaining validators.

      The file can either be validated immediately or later when this method has been called for all files in the file set. If the file is accepted for immediate validation the validateAndExtractMetadata() is called before the next file is processed. When all files have been processed the validateAndExtractMetadata() method is called again if at least one was accepted for later validation.

      Parameters:
      member - A member of the current file set
      Returns:
      A value from the Accept enumeration to accept the file for validation or null to not accept the file for validatio
    • validateAndExtractMetadata

      void validateAndExtractMetadata() throws InvalidDataException, InvalidRelationException
      Validate and extract metadata from the file(s) that has been added to this validator. If the acceptFile(FileSetMember) method returns Accept.VALIDATE_IMMEDIATELY this method is called and the validator should work on the last accepted file.

      This method is also called after all files has been processed if at least one file returned Accept.VALIDATE_LATER.

      This method is recommended to throw an InvalidDataException or a subclass if the file is not a valid file. PermissionDeniedException:s are ignored by the core and will not change the validation status. An exception of type InvalidRelationException can be thrown if the file itself is valid, but a related file that it depends on is not. The core will still mark the file as invalid and store the error message, but extracted metadata will not be reset.

      Throws:
      InvalidDataException - If the validator detects an invalid file
      InvalidRelationException - If the validator detects that the file is valid but another file that it depends on is not, metadata extract will still happen
    • resetMetadata

      void resetMetadata()
      Reset all metadata that this class normally can set. This method is called if the validation of a file failed or if a file is removed from the file set. Any previous metadata that may signal that a valid file is present should be reset.