Package org.fcrepo.persistence.ocfl.impl
Class OcflPersistentStorageUtils
java.lang.Object
org.fcrepo.persistence.ocfl.impl.OcflPersistentStorageUtils
A set of utility functions for supporting OCFL persistence activities.
- Since:
- 6.0.0
- Author:
- dbernstein
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.ocfl.api.MutableOcflRepositorycreateFilesystemRepository(Path ocflStorageRootDir, Path ocflWorkDir, org.fcrepo.config.DigestAlgorithm algorithm, boolean ocflUpgradeOnWrite, boolean verifyInventory) Create a new ocfl repository backed by the filesystemstatic io.ocfl.api.MutableOcflRepositorycreateS3Repository(DataSource dataSource, software.amazon.awssdk.services.s3.S3AsyncClient s3Client, software.amazon.awssdk.services.s3.S3AsyncClient s3CrtClient, String bucket, String prefix, Path ocflWorkDir, org.fcrepo.config.DigestAlgorithm algorithm, boolean withDb, boolean ocflUpgradeOnWrite, boolean verifyInventory) Create a new ocfl repository backed by s3static Stringstatic org.apache.jena.riot.RDFFormatstatic com.fasterxml.jackson.databind.ObjectMapperstatic io.ocfl.api.model.DigestAlgorithmtranslateFedoraDigestToOcfl(org.fcrepo.config.DigestAlgorithm fcrepoAlg) Translates the provided fedora digest algorithm enum into a OCFL client digest algorithm
-
Method Details
-
getRdfFormat
- Returns:
- the RDF Format. By default NTRIPLES are returned.
-
getRDFFileExtension
- Returns:
- the RDF file extension.
-
createFilesystemRepository
public static io.ocfl.api.MutableOcflRepository createFilesystemRepository(Path ocflStorageRootDir, Path ocflWorkDir, org.fcrepo.config.DigestAlgorithm algorithm, boolean ocflUpgradeOnWrite, boolean verifyInventory) throws IOException Create a new ocfl repository backed by the filesystem- Parameters:
ocflStorageRootDir- The ocfl storage root directoryocflWorkDir- The ocfl work directoryalgorithm- the algorithm for the OCFL repositoryocflUpgradeOnWrite- true if we want to write new versions on older objects.verifyInventory- true if we should verify the inventory- Returns:
- the repository
- Throws:
IOException
-
createS3Repository
public static io.ocfl.api.MutableOcflRepository createS3Repository(DataSource dataSource, software.amazon.awssdk.services.s3.S3AsyncClient s3Client, software.amazon.awssdk.services.s3.S3AsyncClient s3CrtClient, String bucket, String prefix, Path ocflWorkDir, org.fcrepo.config.DigestAlgorithm algorithm, boolean withDb, boolean ocflUpgradeOnWrite, boolean verifyInventory) throws IOException Create a new ocfl repository backed by s3- Parameters:
dataSource- the datasource to keep inventories in and use as a locks3Client- aws s3 async clients3CrtClient- aws CRT async clientbucket- the bucket to store objects inprefix- the prefix within the bucket to store objects underocflWorkDir- the local directory to stage objects inalgorithm- the algorithm for the OCFL repositorywithDb- true if the ocfl client should use a dbocflUpgradeOnWrite- true if we want to write new versions on older objects.verifyInventory- true if we should verify the ocfl inventory- Returns:
- the repository
- Throws:
IOException
-
objectMapper
- Returns:
- new object mapper with default config
-
translateFedoraDigestToOcfl
public static io.ocfl.api.model.DigestAlgorithm translateFedoraDigestToOcfl(org.fcrepo.config.DigestAlgorithm fcrepoAlg) Translates the provided fedora digest algorithm enum into a OCFL client digest algorithm- Parameters:
fcrepoAlg- fedora digest algorithm- Returns:
- OCFL client DigestAlgorithm, or null if no match could be made
-