Class DefaultOcflObjectSessionFactory

java.lang.Object
org.fcrepo.storage.ocfl.DefaultOcflObjectSessionFactory
All Implemented Interfaces:
OcflObjectSessionFactory

public class DefaultOcflObjectSessionFactory extends Object implements OcflObjectSessionFactory
Default OcflObjectSessionFactory implementation
Author:
pwinckles
  • Constructor Details

    • DefaultOcflObjectSessionFactory

      public DefaultOcflObjectSessionFactory(io.ocfl.api.MutableOcflRepository ocflRepo, Path stagingRoot, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Cache<String,ResourceHeaders> headersCache, Cache<String,String> rootIdCache, CommitType defaultCommitType, String defaultVersionMessage, String defaultVersionUserName, String defaultVersionUserAddress)
      Creates a new DefaultOcflObjectSessionFactory
      Parameters:
      ocflRepo - the ocfl repo
      stagingRoot - the path to the directory to stage changes in
      objectMapper - the object mapper used to serialize resource headers
      headersCache - the cache to store deserialized headers in
      rootIdCache - the cache that maps OCFL objects to the root resource id
      defaultCommitType - specifies if commits should create new versions
      defaultVersionMessage - the text to insert in the OCFL version message
      defaultVersionUserName - the user name to insert in the OCFL version
      defaultVersionUserAddress - the user address to insert in the OCFL version
  • Method Details

    • newSession

      public OcflObjectSession newSession(String ocflObjectId)
      Description copied from interface: OcflObjectSessionFactory
      Creates a new OCFL object session for the specified OCFL object.
      Specified by:
      newSession in interface OcflObjectSessionFactory
      Parameters:
      ocflObjectId - the OCFL object id to open a session for
      Returns:
      new session
    • close

      public void close()
      Description copied from interface: OcflObjectSessionFactory
      Closes the underlying OCFL repository.
      Specified by:
      close in interface OcflObjectSessionFactory
    • useUnsafeWrite

      public void useUnsafeWrite(boolean useUnsafeWrite)
      Description copied from interface: OcflObjectSessionFactory
      When unsafe writes are enabled, files are added to OCFL versions by providing the OCFL client with their digest. The client trusts that the digest is accurate and does not calculate the value for itself. This should increase performance, but will corrupt the object if the digest is incorrect.
      Specified by:
      useUnsafeWrite in interface OcflObjectSessionFactory
      Parameters:
      useUnsafeWrite - true to use unsafe OCFL writes
    • setDefaultCommitType

      public void setDefaultCommitType(CommitType defaultCommitType)
      Allows the default CommitType to be changed at run time -- useful for testing.
      Parameters:
      defaultCommitType - commit type
    • setHeadersValidator

      public void setHeadersValidator(HeadersValidator headersValidator)
      Changes the headers validator implementation for TESTING purposes.
      Parameters:
      headersValidator - the validator to use