Class InventoryValidator


  • public final class InventoryValidator
    extends Object
    Validates that an Inventory meets the minimum requirements to be serialized as valid OCFL inventory.
    • Method Detail

      • validateShallow

        public static Inventory validateShallow​(Inventory inventory)
        Validates that an Inventory meets the minimum requirements to be serialized as valid OCFL inventory. Only the HEAD version is validated.
        Parameters:
        inventory - the inventory to validate
        Returns:
        the same inventory
        Throws:
        InvalidInventoryException - when validation fails
      • validateCompatibleInventories

        public static void validateCompatibleInventories​(Inventory currentInventory,
                                                         Inventory previousInventory)
        Validates that the currentInventory is a valid next inventory state from the previousInventory. The must have the same id, type, digestAlgorithm, and contentDirectory values. Additionally, the currentInventory must be one version later than the previous, and all of the versions they have in common must be identical.
        Parameters:
        currentInventory - current inventory
        previousInventory - inventory immediately prior to the current inventory
      • validateVersionStates

        public static void validateVersionStates​(Inventory currentInventory,
                                                 Inventory previousInventory)
        Validates that the two inventories contain the same version states, excluding the version in the current that is not in the previous.
        Parameters:
        currentInventory - current inventory
        previousInventory - inventory immediately prior to the current inventory