Package org.fcrepo.storage.ocfl
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 Summary
Constructors Constructor Description DefaultOcflObjectSessionFactory(edu.wisc.library.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying OCFL repository.OcflObjectSessionnewSession(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 Detail
-
DefaultOcflObjectSessionFactory
public DefaultOcflObjectSessionFactory(edu.wisc.library.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 Detail
-
newSession
public OcflObjectSession newSession(String ocflObjectId)
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
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
-
-