Class OcflPersistentStorageUtils

java.lang.Object
org.fcrepo.persistence.ocfl.impl.OcflPersistentStorageUtils

public class OcflPersistentStorageUtils extends Object
A set of utility functions for supporting OCFL persistence activities.
Since:
6.0.0
Author:
dbernstein
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.ocfl.api.MutableOcflRepository
    createFilesystemRepository(Path ocflStorageRootDir, Path ocflWorkDir, org.fcrepo.config.DigestAlgorithm algorithm, boolean ocflUpgradeOnWrite, boolean verifyInventory)
    Create a new ocfl repository backed by the filesystem
    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)
    Create a new ocfl repository backed by s3
    static String
     
    static org.apache.jena.riot.RDFFormat
     
    static com.fasterxml.jackson.databind.ObjectMapper
     
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getRdfFormat

      public static org.apache.jena.riot.RDFFormat getRdfFormat()
      Returns:
      the RDF Format. By default NTRIPLES are returned.
    • getRDFFileExtension

      public static String 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 directory
      ocflWorkDir - The ocfl work directory
      algorithm - the algorithm for the OCFL repository
      ocflUpgradeOnWrite - 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 lock
      s3Client - aws s3 async client
      s3CrtClient - aws CRT async client
      bucket - the bucket to store objects in
      prefix - the prefix within the bucket to store objects under
      ocflWorkDir - the local directory to stage objects in
      algorithm - the algorithm for the OCFL repository
      withDb - true if the ocfl client should use a db
      ocflUpgradeOnWrite - 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

      public static com.fasterxml.jackson.databind.ObjectMapper 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