Interface ValidationHandler
-
- All Superinterfaces:
org.fcrepo.migration.FedoraObjectVersionHandler
- All Known Implementing Classes:
HeadOnlyValidationHandler,ValidatingObjectHandler
public interface ValidationHandler extends org.fcrepo.migration.FedoraObjectVersionHandlerMigration 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceValidationHandler.DateTimeResolverDateTime resolver for mapping times to an Instant in order to account for differences in string formattingstatic interfaceValidationHandler.PropertyResolverInterface to resolve a Fedora 3 ObjectProperty in Fedora 6static classValidationHandler.ValidationResultBuilderBuilder for creating ValidationResults in various places
-
Field Summary
Fields Modifier and Type Field Description static StringDOWNLOAD_NAME_PROPstatic StringF3_CREATED_DATEstatic StringF3_LABELstatic StringF3_LAST_MODIFIED_DATEstatic StringF3_OWNER_IDstatic StringF3_STATEstatic DateTimeFormatterISO_8601static org.slf4j.LoggerLOGGERstatic Map<String,ValidationHandler.PropertyResolver>OCFL_PROPERTY_RESOLVERSFedora 3 ObjectProperties which migrated to OCFLstatic StringRELS_DELETED_ENTRYstatic StringRELS_INT
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<ValidationResult>getValidationResults()default org.apache.jena.rdf.model.ModelparseRdf(org.fcrepo.migration.DatastreamVersion dv)Read an RDF from a DatastreamVersiondefault 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 hasdefault 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.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 headersdefault 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 headersdefault 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 6default 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 headersdefault 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
-
-
-
Field Detail
-
LOGGER
static final org.slf4j.Logger LOGGER
-
ISO_8601
static final DateTimeFormatter ISO_8601
-
F3_LABEL
static final String F3_LABEL
- See Also:
- Constant Field Values
-
F3_STATE
static final String F3_STATE
- See Also:
- Constant Field Values
-
F3_CREATED_DATE
static final String F3_CREATED_DATE
- See Also:
- Constant Field Values
-
F3_LAST_MODIFIED_DATE
static final String F3_LAST_MODIFIED_DATE
- See Also:
- Constant Field Values
-
F3_OWNER_ID
static final String F3_OWNER_ID
- See Also:
- Constant Field Values
-
RELS_INT
static final String RELS_INT
- See Also:
- Constant Field Values
-
DOWNLOAD_NAME_PROP
static final String DOWNLOAD_NAME_PROP
- See Also:
- Constant Field Values
-
RELS_DELETED_ENTRY
static final String RELS_DELETED_ENTRY
- See Also:
- Constant Field Values
-
OCFL_PROPERTY_RESOLVERS
static final Map<String,ValidationHandler.PropertyResolver> OCFL_PROPERTY_RESOLVERS
Fedora 3 ObjectProperties which migrated to OCFL
-
-
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 objectobjectInfo- the Fedora3 ObjectIntoop- the Fedora3 ObjectPropertyheaders- the OCFL ResourceHeadersmodel- 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 DatastreamVersionheaders- the Fedora 6 ResourceHeadersversion- a string representation of the object versionbuilder- 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 DatastreamVersionocflRoot- the ocfl-root directoryheaders- the Fedora 6 ResourceHeadersocflObjectVersion- the OcflObjectVersion of the objectversion- a string representation of the object versionbuilder- 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 dateheaders- the Fedora 6 ResourceHeadersversion- a string representation of the object versionbuilder- 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 objectheaders- the ResourceHeaders of the Fedora 6 objectversion- a string representation of the object versionbuilder- 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 objectheaders- the ResourceHeaders of the Fedora 6 objectdigestAlgorithm- the digest algorithm to useversion- a string representation of the object versionbuilder- the ValidationResultBuilder- Returns:
- the ValidationResult
-
getValidationResults
List<ValidationResult> getValidationResults()
- Returns:
- the ValidationResults for an object
-
-