Package org.fcrepo.persistence.ocfl.impl
Class OcflPersistentStorageSessionMetrics
- java.lang.Object
-
- org.fcrepo.persistence.ocfl.impl.OcflPersistentStorageSessionMetrics
-
- All Implemented Interfaces:
PersistentStorageSession
public class OcflPersistentStorageSessionMetrics extends Object implements PersistentStorageSession
PersistentStorageSession wrapper for collecting metrics- Author:
- pwinckles
-
-
Constructor Summary
Constructors Constructor Description OcflPersistentStorageSessionMetrics(PersistentStorageSession delegate)
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Constructor Detail
-
OcflPersistentStorageSessionMetrics
public OcflPersistentStorageSessionMetrics(PersistentStorageSession delegate)
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:PersistentStorageSession
Return the ID for this session, or null for a read-only session.- Specified by:
getId
in interfacePersistentStorageSession
- Returns:
- the session id.
-
persist
public void persist(ResourceOperation operation) throws PersistentStorageException
Description copied from interface:PersistentStorageSession
Perform a persistence operation on a resource- Specified by:
persist
in interfacePersistentStorageSession
- Parameters:
operation
- The persistence operation to perform- Throws:
PersistentStorageException
- Error persisting the resource.
-
getHeaders
public ResourceHeaders getHeaders(FedoraId identifier, Instant version) throws PersistentStorageException
Description copied from interface:PersistentStorageSession
Get the header information for the identified resource.- Specified by:
getHeaders
in interfacePersistentStorageSession
- 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
public RdfStream getTriples(FedoraId identifier, Instant version) throws PersistentStorageException
Description copied from interface:PersistentStorageSession
Get the client managed triples for the provided resource.- Specified by:
getTriples
in interfacePersistentStorageSession
- 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
public InputStream getBinaryContent(FedoraId identifier, Instant version) throws PersistentStorageException
Description copied from interface:PersistentStorageSession
Get the persisted binary content for the provided resource.- Specified by:
getBinaryContent
in interfacePersistentStorageSession
- 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
public List<Instant> listVersions(FedoraId identifier) throws PersistentStorageException
Description copied from interface:PersistentStorageSession
Returns a list of immutable versions associated with the specified fedora identifier in ascending order by creation time of the version.- Specified by:
listVersions
in interfacePersistentStorageSession
- 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
public void prepare() throws PersistentStorageException
Description copied from interface:PersistentStorageSession
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.- Specified by:
prepare
in interfacePersistentStorageSession
- Throws:
PersistentStorageException
- if an error is encountered
-
commit
public void commit() throws PersistentStorageException
Description copied from interface:PersistentStorageSession
Commits any changes in the current session to persistent storage.- Specified by:
commit
in interfacePersistentStorageSession
- Throws:
PersistentStorageException
- Error during commit.
-
rollback
public void rollback() throws PersistentStorageException
Description copied from interface:PersistentStorageSession
Rolls back any changes in the current session.- Specified by:
rollback
in interfacePersistentStorageSession
- Throws:
PersistentStorageException
- Error completing rollback.
-
-