Package org.fcrepo.storage.ocfl
Class DefaultOcflObjectSessionFactory
java.lang.Object
org.fcrepo.storage.ocfl.DefaultOcflObjectSessionFactory
- All Implemented Interfaces:
OcflObjectSessionFactory
Default OcflObjectSessionFactory implementation
- Author:
- pwinckles
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultOcflObjectSessionFactory(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 -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying OCFL repository.newSession(String ocflObjectId) Creates a new OCFL object session for the specified OCFL object.voidsetDefaultCommitType(CommitType defaultCommitType) Allows the default CommitType to be changed at run time -- useful for testing.voidsetHeadersValidator(HeadersValidator headersValidator) Changes the headers validator implementation for TESTING purposes.voiduseUnsafeWrite(boolean useUnsafeWrite) When unsafe writes are enabled, files are added to OCFL versions by providing the OCFL client with their digest.
-
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 repostagingRoot- the path to the directory to stage changes inobjectMapper- the object mapper used to serialize resource headersheadersCache- the cache to store deserialized headers inrootIdCache- the cache that maps OCFL objects to the root resource iddefaultCommitType- specifies if commits should create new versionsdefaultVersionMessage- the text to insert in the OCFL version messagedefaultVersionUserName- the user name to insert in the OCFL versiondefaultVersionUserAddress- the user address to insert in the OCFL version
-
-
Method Details
-
newSession
Description copied from interface:OcflObjectSessionFactoryCreates a new OCFL object session for the specified OCFL object.- Specified by:
newSessionin interfaceOcflObjectSessionFactory- Parameters:
ocflObjectId- the OCFL object id to open a session for- Returns:
- new session
-
close
public void close()Description copied from interface:OcflObjectSessionFactoryCloses the underlying OCFL repository.- Specified by:
closein interfaceOcflObjectSessionFactory
-
useUnsafeWrite
public void useUnsafeWrite(boolean useUnsafeWrite) Description copied from interface:OcflObjectSessionFactoryWhen 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:
useUnsafeWritein interfaceOcflObjectSessionFactory- Parameters:
useUnsafeWrite- true to use unsafe OCFL writes
-
setDefaultCommitType
Allows the default CommitType to be changed at run time -- useful for testing.- Parameters:
defaultCommitType- commit type
-
setHeadersValidator
Changes the headers validator implementation for TESTING purposes.- Parameters:
headersValidator- the validator to use
-