Class AbstractOcflStorage
- java.lang.Object
-
- edu.wisc.library.ocfl.core.storage.AbstractOcflStorage
-
- All Implemented Interfaces:
OcflStorage
- Direct Known Subclasses:
CachingOcflStorage,CloudOcflStorage,FileSystemOcflStorage,ObjectDetailsDbOcflStorage
public abstract class AbstractOcflStorage extends Object implements OcflStorage
OcflStorage abstract implementation that handles managing the repository's state, initialized, open, close.
-
-
Field Summary
Fields Modifier and Type Field Description protected InventoryMapperinventoryMapperprotected OcflVersionocflVersion
-
Constructor Summary
Constructors Constructor Description AbstractOcflStorage()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Shutsdown any resources the OclfStorage may have open, such as ExecutorServices.protected abstract voiddoInitialize(OcflExtensionConfig layoutConfig)Does whatever is necessary to initialize OCFL repository storage.protected voidensureOpen()Throws an exception if the repository has not been initialized or is closedvoidinitializeStorage(OcflVersion ocflVersion, OcflExtensionConfig layoutConfig, InventoryMapper inventoryMapper)Initializes the OCFL root.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.wisc.library.ocfl.core.storage.OcflStorage
commitMutableHead, containsObject, exportObject, exportVersion, getObjectStreams, importObject, listObjectIds, loadInventory, objectRootPath, purgeMutableHead, purgeObject, reconstructObjectVersion, rollbackToVersion, storeNewVersion
-
-
-
-
Field Detail
-
inventoryMapper
protected InventoryMapper inventoryMapper
-
ocflVersion
protected OcflVersion ocflVersion
-
-
Method Detail
-
initializeStorage
public void initializeStorage(OcflVersion ocflVersion, OcflExtensionConfig layoutConfig, InventoryMapper inventoryMapper)
Initializes the OCFL root. If it is an existing OCFL repository and the root has already been initialized, then this method should do nothing. This method must be called before the object may be used.layoutConfig may be null if the OCFL repository already exists, in which case the existing configuration is used. If layoutConfig is specified for an existing repository, initialization will fail if the configurations do not match.
- Specified by:
initializeStoragein interfaceOcflStorage- Parameters:
ocflVersion- the OCFL versionlayoutConfig- the storage layout configuration, may be null to auto-detect existing configurationinventoryMapper- the mapper to use for inventory serialization
-
close
public void close()
Shutsdown any resources the OclfStorage may have open, such as ExecutorServices. Once closed, additional requests will be rejected. Calling this method is optional, and it is more efficient to just let the shutdown hooks take care of closing the resources.- Specified by:
closein interfaceOcflStorage
-
doInitialize
protected abstract void doInitialize(OcflExtensionConfig layoutConfig)
Does whatever is necessary to initialize OCFL repository storage.- Parameters:
layoutConfig- the storage layout configuration, may be null to auto-detect existing configuration
-
ensureOpen
protected void ensureOpen()
Throws an exception if the repository has not been initialized or is closed
-
-