Class MandatoryVerifier

java.lang.Object
nl.knaw.dans.bagit.verify.MandatoryVerifier

public final class MandatoryVerifier extends Object
Responsible for checking all things related to mandatory files for the bagit specification
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • messages

      private static final ResourceBundle messages
    • DOT_BAGIT_DIR_NAME

      private static final String DOT_BAGIT_DIR_NAME
      See Also:
  • Constructor Details

    • MandatoryVerifier

      private MandatoryVerifier()
  • Method Details

    • checkFetchItemsExist

      public static void checkFetchItemsExist(List<FetchItem> items, Path bagDir) throws FileNotInPayloadDirectoryException
      make sure all the fetch items exist in the data directory
      Parameters:
      items - the items that needed to be fetched for the bag to be complete
      bagDir - the root directory of the bag
      Throws:
      FileNotInPayloadDirectoryException - if one or more of the fetch items don't exist
    • checkBagitFileExists

      public static void checkBagitFileExists(Path rootDir, Version version) throws MissingBagitFileException
      make sure the bagit.txt file exists
      Parameters:
      rootDir - the root directory of the bag
      version - the version of the bag
      Throws:
      MissingBagitFileException - if the bag does not contain the bagit.txt file as required by the bagit specification
    • checkPayloadDirectoryExists

      public static void checkPayloadDirectoryExists(Bag bag) throws MissingPayloadDirectoryException
      Make sure the payload directory exists
      Parameters:
      bag - the bag to check
      Throws:
      MissingPayloadDirectoryException - if the bag does not contain the payload directory
    • checkIfAtLeastOnePayloadManifestsExist

      public static void checkIfAtLeastOnePayloadManifestsExist(Path rootDir, Version version) throws MissingPayloadManifestException, IOException
      Check to make sure the bag has at least one payload manifest (manifest-[ALGORITHM].txt)
      Parameters:
      rootDir - the root directory of the bag
      version - the version of the bag
      Throws:
      MissingPayloadManifestException - if there are no payload manifests in the bag
      IOException - if there was an error reading a file