Interface ValidationHandler

  • All Superinterfaces:
    org.fcrepo.migration.FedoraObjectVersionHandler
    All Known Implementing Classes:
    HeadOnlyValidationHandler, ValidatingObjectHandler

    public interface ValidationHandler
    extends org.fcrepo.migration.FedoraObjectVersionHandler
    Migration validator which performs a few basic types of validations built in: - F3 object property against ocfl headers or stored model - F3 datastream size against ocfl headers - F3 datastream size against ocfl object on disk - F3 datastream created date against ocfl headers - F3 datastream last modified date against ocfl headers - F3 checksum against ocfl object on disk
    Author:
    mikejritter
    • Method Detail

      • parseRdf

        default org.apache.jena.rdf.model.Model parseRdf​(org.fcrepo.migration.DatastreamVersion dv)
        Read an RDF from a DatastreamVersion
        Parameters:
        dv - the datastream version
        Returns:
        the RDF model
      • splitRelsInt

        default Map<String,​org.apache.jena.rdf.model.Model> splitRelsInt​(org.apache.jena.rdf.model.Model relsIntModel)
        Read a RELS-INT entry in order to extract the RDF models it has
        Parameters:
        relsIntModel - the RELS-INT model
        Returns:
        a Map of each RDF Model the RELS-INT contains
      • validateObjectProperty

        default Optional<ValidationResult> validateObjectProperty​(String ocflId,
                                                                  org.fcrepo.migration.ObjectInfo objectInfo,
                                                                  org.fcrepo.migration.ObjectProperty op,
                                                                  org.fcrepo.storage.ocfl.ResourceHeaders headers,
                                                                  org.apache.jena.rdf.model.Model model,
                                                                  ValidationHandler.ValidationResultBuilder builder)
        Validate an ObjectProperty from Fedora 3 to what exists in Fedora 6
        Parameters:
        ocflId - the id of the ocfl object
        objectInfo - the Fedora3 ObjectInto
        op - the Fedora3 ObjectProperty
        headers - the OCFL ResourceHeaders
        model - the model read from ocfl (if it exists)
        builder - the ValidationResultBuilder
        Returns:
        the ValidationResults
      • validateSizeMeta

        default Optional<ValidationResult> validateSizeMeta​(org.fcrepo.migration.DatastreamVersion dsVersion,
                                                            org.fcrepo.storage.ocfl.ResourceHeaders headers,
                                                            String version,
                                                            ValidationHandler.ValidationResultBuilder builder)
        Validate the binary size of a DatastreamVersion from Fedora 3 to what is in the Fedora 6 headers
        Parameters:
        dsVersion - the DatastreamVersion
        headers - the Fedora 6 ResourceHeaders
        version - a string representation of the object version
        builder - the ValidationResultBuilder
        Returns:
        the ValidationResults
      • validateSizeOnDisk

        default Optional<ValidationResult> validateSizeOnDisk​(org.fcrepo.migration.DatastreamVersion dsVersion,
                                                              Path ocflRoot,
                                                              org.fcrepo.storage.ocfl.ResourceHeaders headers,
                                                              io.ocfl.api.model.OcflObjectVersion ocflObjectVersion,
                                                              String version,
                                                              ValidationHandler.ValidationResultBuilder builder)
        Validate the size of a DatastreamVersion to the size of the object on disk in the Fedora 6 OCFL repository
        Parameters:
        dsVersion - the DatastreamVersion
        ocflRoot - the ocfl-root directory
        headers - the Fedora 6 ResourceHeaders
        ocflObjectVersion - the OcflObjectVersion of the object
        version - a string representation of the object version
        builder - the ValidationResultBuilder
        Returns:
        the ValidationResults
      • validateCreatedDate

        default Optional<ValidationResult> validateCreatedDate​(String sourceCreated,
                                                               org.fcrepo.storage.ocfl.ResourceHeaders headers,
                                                               String version,
                                                               ValidationHandler.ValidationResultBuilder builder)
        Validate the created date of a DatastreamVersion from Fedora 3 to what is in the Fedora 6 headers
        Parameters:
        sourceCreated - the string representation of the Fedora 3 object creation date
        headers - the Fedora 6 ResourceHeaders
        version - a string representation of the object version
        builder - the ValidationResultBuilder
        Returns:
        the result of validation
      • validateLastModified

        default Optional<ValidationResult> validateLastModified​(org.fcrepo.migration.DatastreamVersion dsVersion,
                                                                org.fcrepo.storage.ocfl.ResourceHeaders headers,
                                                                String version,
                                                                ValidationHandler.ValidationResultBuilder builder)
        Validate the last modified date of a DatastreamVersion from Fedora 3 to what is in the Fedora 6 headers
        Parameters:
        dsVersion - the DatastreamVersion of the Fedora 3 object
        headers - the ResourceHeaders of the Fedora 6 object
        version - a string representation of the object version
        builder - the ValidationResultBuilder
        Returns:
        the ValidationResults
      • validateChecksum

        default Optional<ValidationResult> validateChecksum​(org.fcrepo.migration.DatastreamVersion dsVersion,
                                                            org.fcrepo.storage.ocfl.ResourceHeaders headers,
                                                            F6DigestAlgorithm digestAlgorithm,
                                                            String version,
                                                            ValidationHandler.ValidationResultBuilder builder)
        Validate the checksum of a datastream. If the Fedora 3 object is not managed, no validation is run and an empty Optional is returned. This can fail in multiple ways: 1 - The F3 datastream can not be read 2 - The F6 headers do not contain a checksum (only checking sha512 atm) 3 - The two calculated checksums do not match
        Parameters:
        dsVersion - the DatastreamVersion of the Fedora 3 object
        headers - the ResourceHeaders of the Fedora 6 object
        digestAlgorithm - the digest algorithm to use
        version - a string representation of the object version
        builder - the ValidationResultBuilder
        Returns:
        the ValidationResult
      • getValidationResults

        List<ValidationResult> getValidationResults()
        Returns:
        the ValidationResults for an object