Interface PersistentStorageSession


  • 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​(org.fcrepo.kernel.api.identifiers.FedoraId identifier, Instant version)
      Get the persisted binary content for the provided resource.
      org.fcrepo.kernel.api.models.ResourceHeaders getHeaders​(org.fcrepo.kernel.api.identifiers.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.
      org.fcrepo.kernel.api.RdfStream getTriples​(org.fcrepo.kernel.api.identifiers.FedoraId identifier, Instant version)
      Get the client managed triples for the provided resource.
      List<Instant> listVersions​(org.fcrepo.kernel.api.identifiers.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​(org.fcrepo.kernel.api.operations.ResourceOperation operation)
      Perform a persistence operation on a resource
      void 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​(org.fcrepo.kernel.api.operations.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

        org.fcrepo.kernel.api.models.ResourceHeaders getHeaders​(org.fcrepo.kernel.api.identifiers.FedoraId identifier,
                                                                Instant version)
                                                         throws PersistentStorageException
        Get the header information for the identified resource.
        Parameters:
        identifier - identifier of the resource
        version - 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

        org.fcrepo.kernel.api.RdfStream getTriples​(org.fcrepo.kernel.api.identifiers.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​(org.fcrepo.kernel.api.identifiers.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<InstantlistVersions​(org.fcrepo.kernel.api.identifiers.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