Package io.ocfl.core
Class DefaultOcflRepository
java.lang.Object
io.ocfl.core.DefaultOcflRepository
- All Implemented Interfaces:
OcflRepository
- Direct Known Subclasses:
DefaultMutableOcflRepository
Primary implementation of the OcflRepository API. It is storage agnostic. It is typically instantiated using
OcflRepositoryBuilder.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AddFileProcessor.Builder
protected final InventoryUpdater.Builder
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultOcflRepository
(OcflStorage storage, Path workDir, ObjectLock objectLock, InventoryMapper inventoryMapper, LogicalPathMapper logicalPathMapper, ContentPathConstraintProcessor contentPathConstraintProcessor, OcflConfig config, boolean verifyStaging, Duration fileLockTimeoutDuration) -
Method Summary
Modifier and TypeMethodDescriptionprotected Inventory
buildNewInventory
(InventoryUpdater inventoryUpdater, VersionInfo versionInfo) void
close()
config()
boolean
containsObject
(String objectId) protected Path
createStagingDir
(String objectId) protected Inventory
createStubInventory
(ObjectVersionId objectId) describeObject
(String objectId) describeVersion
(ObjectVersionId objectVersionId) protected void
enforceObjectVersionForUpdate
(ObjectVersionId objectId, Inventory inventory) protected void
void
exportObject
(String objectId, Path outputPath, OcflOption... options) void
exportVersion
(ObjectVersionId objectVersionId, Path outputPath, OcflOption... options) fileChangeHistory
(String objectId, String logicalPath) getObject
(ObjectVersionId objectVersionId) void
getObject
(ObjectVersionId objectVersionId, Path outputPath) void
importObject
(Path objectPath, OcflOption... options) void
importVersion
(Path versionPath, OcflOption... options) void
void
invalidateCache
(String objectId) protected Inventory
loadInventory
(ObjectVersionId objectId) protected OffsetDateTime
now
(VersionInfo versionInfo) void
purgeObject
(String objectId) putObject
(ObjectVersionId objectVersionId, Path path, VersionInfo versionInfo, OcflOption... options) replicateVersionAsHead
(ObjectVersionId objectVersionId, VersionInfo versionInfo) protected Inventory
requireInventory
(ObjectVersionId objectId) protected Path
resolveContentDir
(Inventory inventory, Path parent) void
rollbackToVersion
(ObjectVersionId objectVersionId) void
This is used to manipulate the clock for testing purposes.updateObject
(ObjectVersionId objectVersionId, VersionInfo versionInfo, Consumer<OcflObjectUpdater> objectUpdater) validateObject
(String objectId, boolean contentFixityCheck) protected void
validateVersionInfo
(VersionInfo versionInfo) protected Inventory
writeInventory
(Inventory inventory, Path stagingDir) protected void
writeNewVersion
(Inventory inventory, Path stagingDir, boolean upgradedOcflVersion, boolean checkForEmptyDirs)
-
Field Details
-
inventoryUpdaterBuilder
-
addFileProcessorBuilder
-
-
Constructor Details
-
DefaultOcflRepository
public DefaultOcflRepository(OcflStorage storage, Path workDir, ObjectLock objectLock, InventoryMapper inventoryMapper, LogicalPathMapper logicalPathMapper, ContentPathConstraintProcessor contentPathConstraintProcessor, OcflConfig config, boolean verifyStaging, Duration fileLockTimeoutDuration) - Parameters:
storage
- storage layerworkDir
- path to the directory to use for assembling ocfl versionsobjectLock
- locking clientinventoryMapper
- object mapper for serializing inventorieslogicalPathMapper
- logical path mappercontentPathConstraintProcessor
- content path constraint processorconfig
- ocfl defaults configurationverifyStaging
- true if the contents of a stage version should be double-checkedfileLockTimeoutDuration
- the max amount of time to wait for a file lock- See Also:
-
-
Method Details
-
putObject
public ObjectVersionId putObject(ObjectVersionId objectVersionId, Path path, VersionInfo versionInfo, OcflOption... options) - Specified by:
putObject
in interfaceOcflRepository
-
updateObject
public ObjectVersionId updateObject(ObjectVersionId objectVersionId, VersionInfo versionInfo, Consumer<OcflObjectUpdater> objectUpdater) - Specified by:
updateObject
in interfaceOcflRepository
-
getObject
- Specified by:
getObject
in interfaceOcflRepository
-
getObject
- Specified by:
getObject
in interfaceOcflRepository
-
describeObject
- Specified by:
describeObject
in interfaceOcflRepository
-
describeVersion
- Specified by:
describeVersion
in interfaceOcflRepository
-
fileChangeHistory
- Specified by:
fileChangeHistory
in interfaceOcflRepository
-
containsObject
- Specified by:
containsObject
in interfaceOcflRepository
-
purgeObject
- Specified by:
purgeObject
in interfaceOcflRepository
-
validateObject
- Specified by:
validateObject
in interfaceOcflRepository
-
replicateVersionAsHead
public ObjectVersionId replicateVersionAsHead(ObjectVersionId objectVersionId, VersionInfo versionInfo) - Specified by:
replicateVersionAsHead
in interfaceOcflRepository
-
rollbackToVersion
- Specified by:
rollbackToVersion
in interfaceOcflRepository
-
listObjectIds
- Specified by:
listObjectIds
in interfaceOcflRepository
-
exportVersion
- Specified by:
exportVersion
in interfaceOcflRepository
-
exportObject
- Specified by:
exportObject
in interfaceOcflRepository
-
importVersion
- Specified by:
importVersion
in interfaceOcflRepository
-
importObject
- Specified by:
importObject
in interfaceOcflRepository
-
close
public void close()- Specified by:
close
in interfaceOcflRepository
-
config
- Specified by:
config
in interfaceOcflRepository
-
invalidateCache
- Specified by:
invalidateCache
in interfaceOcflRepository
-
invalidateCache
public void invalidateCache()- Specified by:
invalidateCache
in interfaceOcflRepository
-
loadInventory
-
createStubInventory
-
requireInventory
-
buildNewInventory
-
writeNewVersion
-
writeInventory
-
enforceObjectVersionForUpdate
-
createStagingDir
-
resolveContentDir
-
now
-
ensureOpen
protected void ensureOpen() -
validateVersionInfo
-
setClock
This is used to manipulate the clock for testing purposes.- Parameters:
clock
- clock
-