Package org.fcrepo.persistence.api
Interface PersistentStorageSession
-
- All Known Implementing Classes:
OcflPersistentStorageSession
,OcflPersistentStorageSessionMetrics
public interface PersistentStorageSession
An interface that mediates CRUD operations to and from persistence storage.- Author:
- dbernstein, whikloj
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
commit()
Commits any changes in the current session to persistent storage.InputStream
getBinaryContent(FedoraId identifier, Instant version)
Get the persisted binary content for the provided resource.ResourceHeaders
getHeaders(FedoraId identifier, Instant version)
Get the header information for the identified resource.String
getId()
Return the ID for this session, or null for a read-only session.RdfStream
getTriples(FedoraId identifier, Instant version)
Get the client managed triples for the provided resource.List<Instant>
listVersions(FedoraId identifier)
Returns a list of immutable versions associated with the specified fedora identifier in ascending order by creation time of the version.void
persist(ResourceOperation operation)
Perform a persistence operation on a resourcevoid
prepare()
Does anything that's necessary to prepare the session to be committed, for example committing database changes.void
rollback()
Rolls back any changes in the current session.
-
-
-
Method Detail
-
getId
String getId()
Return the ID for this session, or null for a read-only session.- Returns:
- the session id.
-
persist
void persist(ResourceOperation operation) throws PersistentStorageException
Perform a persistence operation on a resource- Parameters:
operation
- The persistence operation to perform- Throws:
PersistentStorageException
- Error persisting the resource.
-
getHeaders
ResourceHeaders getHeaders(FedoraId identifier, Instant version) throws PersistentStorageException
Get the header information for the identified resource.- Parameters:
identifier
- identifier of the resourceversion
- instant identifying the version of the resource to read from. If null, then the head version is used.- Returns:
- header information
- Throws:
PersistentStorageException
- Either a PersistentItemNotFoundException or PersistentSessionClosedException
-
getTriples
RdfStream getTriples(FedoraId identifier, Instant version) throws PersistentStorageException
Get the client managed triples for the provided resource.- Parameters:
identifier
- identifier for the resource.version
- instant identifying the version of the resource to read from. If null, then the head version is used.- Returns:
- the triples as an RdfStream.
- Throws:
PersistentStorageException
- Either a PersistentItemNotFoundException or PersistentSessionClosedException
-
getBinaryContent
InputStream getBinaryContent(FedoraId identifier, Instant version) throws PersistentStorageException
Get the persisted binary content for the provided resource.- Parameters:
identifier
- identifier for the resource.version
- instant identifying the version of the resource to read from. If null, then the head version is used.- Returns:
- the binary content.
- Throws:
PersistentStorageException
- Either a PersistentItemNotFoundException or PersistentSessionClosedException
-
listVersions
List<Instant> listVersions(FedoraId identifier) throws PersistentStorageException
Returns a list of immutable versions associated with the specified fedora identifier in ascending order by creation time of the version.- Parameters:
identifier
- identifier for the resource.- Returns:
- The list of instants that map to the underlying versions, ordered by time created
- Throws:
PersistentStorageException
- Either a PersistentItemNotFoundException or PersistentSessionClosedException
-
prepare
void prepare() throws PersistentStorageException
Does anything that's necessary to prepare the session to be committed, for example committing database changes. This method MUST be called before commit(). If prepare() fails, then the session should be rolled back.- Throws:
PersistentStorageException
- if an error is encountered
-
commit
void commit() throws PersistentStorageException
Commits any changes in the current session to persistent storage.- Throws:
PersistentStorageException
- Error during commit.
-
rollback
void rollback() throws PersistentStorageException
Rolls back any changes in the current session.- Throws:
PersistentStorageException
- Error completing rollback.
-
-