Package io.ocfl.core.db
Interface ObjectDetailsDatabase
- All Known Implementing Classes:
BaseObjectDetailsDatabase
,H2ObjectDetailsDatabase
,MariaDbObjectDetailsDatabase
,PostgresObjectDetailsDatabase
public interface ObjectDetailsDatabase
Interface for interacting with OCFL object details that are stored in a database.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addObjectDetails
(Inventory inventory, String inventoryDigest, byte[] inventoryBytes) Adds ObjectDetails to the database.void
Removes all ObjectDetails from the databasevoid
deleteObjectDetails
(String objectId) Removes ObjectDetails from the database.retrieveObjectDetails
(String objectId) Retrieves ObjectDetails from the database.void
updateObjectDetails
(Inventory inventory, String inventoryDigest, Path inventoryFile, Runnable runnable) Updates existing ObjectDetails in the database.
-
Method Details
-
retrieveObjectDetails
Retrieves ObjectDetails from the database. If no details can be found, null is returned.- Parameters:
objectId
- the OCFL object id- Returns:
- ObjectDetails or null
-
addObjectDetails
Adds ObjectDetails to the database. In the case of a concurrent update, this operation will only fail if the inventory digests are different.- Parameters:
inventory
- the object's inventoryinventoryDigest
- the digest of the inventoryinventoryBytes
- the serialized inventory bytes
-
updateObjectDetails
void updateObjectDetails(Inventory inventory, String inventoryDigest, Path inventoryFile, Runnable runnable) Updates existing ObjectDetails in the database. The update is executed within a transaction. Before the transaction is committed, the supplied runnable is executed. The transaction is only committed if the runnable completes without exception.- Parameters:
inventory
- the object's inventoryinventoryDigest
- the digest of the inventoryinventoryFile
- the path to the inventory on diskrunnable
- the code to execute within the update transaction
-
deleteObjectDetails
Removes ObjectDetails from the database.- Parameters:
objectId
- the OCFL object id
-
deleteAllDetails
void deleteAllDetails()Removes all ObjectDetails from the database
-