Package edu.wisc.library.ocfl.core
Class DefaultOcflRepository
- java.lang.Object
-
- edu.wisc.library.ocfl.core.DefaultOcflRepository
-
- All Implemented Interfaces:
OcflRepository
- Direct Known Subclasses:
DefaultMutableOcflRepository
public class DefaultOcflRepository extends Object implements OcflRepository
Primary implementation of the OcflRepository API. It is storage agnostic. It is typically instantiated using OcflRepositoryBuilder.- See Also:
OcflRepositoryBuilder
-
-
Field Summary
Fields Modifier and Type Field Description protected AddFileProcessor.BuilderaddFileProcessorBuilderprotected OcflConfigconfigprotected InventoryMapperinventoryMapperprotected InventoryUpdater.BuilderinventoryUpdaterBuilderprotected ObjectLockobjectLockprotected ResponseMapperresponseMapperprotected OcflStoragestorageprotected PathworkDir
-
Constructor Summary
Constructors Constructor Description DefaultOcflRepository(OcflStorage storage, Path workDir, ObjectLock objectLock, InventoryMapper inventoryMapper, LogicalPathMapper logicalPathMapper, ContentPathConstraintProcessor contentPathConstraintProcessor, OcflConfig config)
-
Method Summary
-
-
-
Field Detail
-
storage
protected final OcflStorage storage
-
inventoryMapper
protected final InventoryMapper inventoryMapper
-
workDir
protected final Path workDir
-
objectLock
protected final ObjectLock objectLock
-
responseMapper
protected final ResponseMapper responseMapper
-
inventoryUpdaterBuilder
protected final InventoryUpdater.Builder inventoryUpdaterBuilder
-
addFileProcessorBuilder
protected final AddFileProcessor.Builder addFileProcessorBuilder
-
config
protected final OcflConfig config
-
-
Constructor Detail
-
DefaultOcflRepository
public DefaultOcflRepository(OcflStorage storage, Path workDir, ObjectLock objectLock, InventoryMapper inventoryMapper, LogicalPathMapper logicalPathMapper, ContentPathConstraintProcessor contentPathConstraintProcessor, OcflConfig config)
- 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 configuration- See Also:
OcflRepositoryBuilder
-
-
Method Detail
-
putObject
public ObjectVersionId putObject(ObjectVersionId objectVersionId, Path path, VersionInfo versionInfo, OcflOption... options)
- Specified by:
putObjectin interfaceOcflRepository
-
updateObject
public ObjectVersionId updateObject(ObjectVersionId objectVersionId, VersionInfo versionInfo, Consumer<OcflObjectUpdater> objectUpdater)
- Specified by:
updateObjectin interfaceOcflRepository
-
getObject
public void getObject(ObjectVersionId objectVersionId, Path outputPath)
- Specified by:
getObjectin interfaceOcflRepository
-
getObject
public OcflObjectVersion getObject(ObjectVersionId objectVersionId)
- Specified by:
getObjectin interfaceOcflRepository
-
describeObject
public ObjectDetails describeObject(String objectId)
- Specified by:
describeObjectin interfaceOcflRepository
-
describeVersion
public VersionDetails describeVersion(ObjectVersionId objectVersionId)
- Specified by:
describeVersionin interfaceOcflRepository
-
fileChangeHistory
public FileChangeHistory fileChangeHistory(String objectId, String logicalPath)
- Specified by:
fileChangeHistoryin interfaceOcflRepository
-
containsObject
public boolean containsObject(String objectId)
- Specified by:
containsObjectin interfaceOcflRepository
-
purgeObject
public void purgeObject(String objectId)
- Specified by:
purgeObjectin interfaceOcflRepository
-
validateObject
public ValidationResults validateObject(String objectId, boolean contentFixityCheck)
- Specified by:
validateObjectin interfaceOcflRepository
-
replicateVersionAsHead
public ObjectVersionId replicateVersionAsHead(ObjectVersionId objectVersionId, VersionInfo versionInfo)
- Specified by:
replicateVersionAsHeadin interfaceOcflRepository
-
rollbackToVersion
public void rollbackToVersion(ObjectVersionId objectVersionId)
- Specified by:
rollbackToVersionin interfaceOcflRepository
-
listObjectIds
public Stream<String> listObjectIds()
- Specified by:
listObjectIdsin interfaceOcflRepository
-
exportVersion
public void exportVersion(ObjectVersionId objectVersionId, Path outputPath, OcflOption... options)
- Specified by:
exportVersionin interfaceOcflRepository
-
exportObject
public void exportObject(String objectId, Path outputPath, OcflOption... options)
- Specified by:
exportObjectin interfaceOcflRepository
-
importVersion
public void importVersion(Path versionPath, OcflOption... options)
- Specified by:
importVersionin interfaceOcflRepository
-
importObject
public void importObject(Path objectPath, OcflOption... options)
- Specified by:
importObjectin interfaceOcflRepository
-
close
public void close()
- Specified by:
closein interfaceOcflRepository
-
config
public OcflConfig config()
- Specified by:
configin interfaceOcflRepository
-
invalidateCache
public void invalidateCache(String objectId)
- Specified by:
invalidateCachein interfaceOcflRepository
-
invalidateCache
public void invalidateCache()
- Specified by:
invalidateCachein interfaceOcflRepository
-
loadInventory
protected Inventory loadInventory(ObjectVersionId objectId)
-
createStubInventory
protected Inventory createStubInventory(ObjectVersionId objectId)
-
requireInventory
protected Inventory requireInventory(ObjectVersionId objectId)
-
buildNewInventory
protected Inventory buildNewInventory(InventoryUpdater inventoryUpdater, VersionInfo versionInfo)
-
enforceObjectVersionForUpdate
protected void enforceObjectVersionForUpdate(ObjectVersionId objectId, Inventory inventory)
-
now
protected OffsetDateTime now(VersionInfo versionInfo)
-
ensureOpen
protected void ensureOpen()
-
setClock
public void setClock(Clock clock)
This is used to manipulate the clock for testing purposes.- Parameters:
clock- clock
-
-