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 OcflVersionocflVersionprotected ExtensionSupportEvaluatorsupportEvaluator
-
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, ExtensionSupportEvaluator supportEvaluator)Initializes the OCFL root.voidinvalidateCache()If the OcflStorage is using an inventory cache, then this method invalidates all entries in the cache.voidinvalidateCache(String objectId)If the OcflStorage is using an inventory cache, then this method invalidates the cache entry for the specified object.-
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, getInventoryBytes, getObjectStreams, importObject, listObjectIds, loadInventory, objectRootPath, purgeMutableHead, purgeObject, reconstructObjectVersion, rollbackToVersion, storeNewVersion, validateObject
-
-
-
-
Field Detail
-
inventoryMapper
protected InventoryMapper inventoryMapper
-
ocflVersion
protected OcflVersion ocflVersion
-
supportEvaluator
protected ExtensionSupportEvaluator supportEvaluator
-
-
Method Detail
-
initializeStorage
public void initializeStorage(OcflVersion ocflVersion, OcflExtensionConfig layoutConfig, InventoryMapper inventoryMapper, ExtensionSupportEvaluator supportEvaluator)
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 serializationsupportEvaluator- the evaluator that determines what to do when unsupported extensions are encountered
-
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
-
invalidateCache
public void invalidateCache(String objectId)
If the OcflStorage is using an inventory cache, then this method invalidates the cache entry for the specified object. Otherwise, nothing happens.- Specified by:
invalidateCachein interfaceOcflStorage- Parameters:
objectId- the ID of the object to invalidate in the cache
-
invalidateCache
public void invalidateCache()
If the OcflStorage is using an inventory cache, then this method invalidates all entries in the cache. Otherwise, nothing happens.- Specified by:
invalidateCachein 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
-
-