Class DataStoreBlobStore

java.lang.Object
org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore
All Implemented Interfaces:
AutoCloseable, org.apache.jackrabbit.oak.api.blob.BlobAccessProvider, BlobTrackingStore, TypedDataStore, SharedDataStore, BlobStore, org.apache.jackrabbit.oak.spi.blob.data.DataStore, GarbageCollectableBlobStore

@Deprecated(since="2024-09-23") public class DataStoreBlobStore extends Object implements org.apache.jackrabbit.oak.spi.blob.data.DataStore, BlobStore, GarbageCollectableBlobStore, BlobTrackingStore, TypedDataStore, org.apache.jackrabbit.oak.api.blob.BlobAccessProvider
Deprecated.
The Jackrabbit Oak Blob Plugins library is designed for Oak-internal use only and thus deprecated. It will not be part of the AEM SDK after April 2025.
BlobStore wrapper for DataStore. Wraps Jackrabbit 2 DataStore and expose them as BlobStores It also handles inlining binaries if there size is smaller than DataStore.getMinRecordLength()
  • Field Details

  • Constructor Details

    • DataStoreBlobStore

      public DataStoreBlobStore(org.apache.jackrabbit.oak.spi.blob.data.DataStore delegate)
      Deprecated.
    • DataStoreBlobStore

      public DataStoreBlobStore(org.apache.jackrabbit.oak.spi.blob.data.DataStore delegate, boolean encodeLengthInId)
      Deprecated.
    • DataStoreBlobStore

      public DataStoreBlobStore(org.apache.jackrabbit.oak.spi.blob.data.DataStore delegate, boolean encodeLengthInId, int cacheSizeInMB)
      Deprecated.
  • Method Details

    • getRecordIfStored

      public org.apache.jackrabbit.oak.spi.blob.data.DataRecord getRecordIfStored(org.apache.jackrabbit.oak.spi.blob.data.DataIdentifier identifier) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Specified by:
      getRecordIfStored in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • getRecord

      public org.apache.jackrabbit.oak.spi.blob.data.DataRecord getRecord(org.apache.jackrabbit.oak.spi.blob.data.DataIdentifier identifier) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Specified by:
      getRecord in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • getRecordFromReference

      public org.apache.jackrabbit.oak.spi.blob.data.DataRecord getRecordFromReference(String reference) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Specified by:
      getRecordFromReference in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • addRecord

      public org.apache.jackrabbit.oak.spi.blob.data.DataRecord addRecord(InputStream stream) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Specified by:
      addRecord in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • updateModifiedDateOnAccess

      public void updateModifiedDateOnAccess(long before)
      Deprecated.
      Specified by:
      updateModifiedDateOnAccess in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
    • deleteAllOlderThan

      public int deleteAllOlderThan(long min) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Specified by:
      deleteAllOlderThan in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • getAllIdentifiers

      public Iterator<org.apache.jackrabbit.oak.spi.blob.data.DataIdentifier> getAllIdentifiers() throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Specified by:
      getAllIdentifiers in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • init

      public void init(String homeDir) throws RepositoryException
      Deprecated.
      Specified by:
      init in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Throws:
      RepositoryException
    • getMinRecordLength

      public int getMinRecordLength()
      Deprecated.
      Specified by:
      getMinRecordLength in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
    • close

      public void close() throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • writeBlob

      public String writeBlob(InputStream stream) throws IOException
      Deprecated.
      Description copied from interface: BlobStore
      Write a blob from an input stream. This method closes the input stream.
      Specified by:
      writeBlob in interface BlobStore
      Parameters:
      stream - the input stream
      Returns:
      the blob id
      Throws:
      IOException
    • writeBlob

      public String writeBlob(InputStream stream, BlobOptions options) throws IOException
      Deprecated.
      Description copied from interface: BlobStore
      Write a blob from an input stream with specified options. This method closes the input stream.
      Specified by:
      writeBlob in interface BlobStore
      Parameters:
      stream - the input stream to write
      options - the options to use
      Returns:
      Throws:
      IOException
    • readBlob

      public int readBlob(String encodedBlobId, long pos, byte[] buff, int off, int length) throws IOException
      Deprecated.
      Description copied from interface: BlobStore
      Read a number of bytes from a blob.
      Specified by:
      readBlob in interface BlobStore
      Parameters:
      encodedBlobId - the blob id
      pos - the position within the blob
      buff - the target byte array
      off - the offset within the target array
      length - the number of bytes to read
      Returns:
      the number of bytes read
      Throws:
      IOException
    • getBlobLength

      public long getBlobLength(String encodedBlobId) throws IOException
      Deprecated.
      Description copied from interface: BlobStore
      Get the length of the blob.
      Specified by:
      getBlobLength in interface BlobStore
      Parameters:
      encodedBlobId - the blob id
      Returns:
      the length
      Throws:
      IOException
    • getBlobId

      public String getBlobId(@NotNull @NotNull String reference)
      Deprecated.
      Description copied from interface: BlobStore
      Returns the blobId that referred by the given binary reference. Returns null if the reference is invalid, for example if it points to a blob that does not exist.
      Specified by:
      getBlobId in interface BlobStore
      Parameters:
      reference - binary reference
      Returns:
      matching blobId, or null
    • getReference

      public String getReference(@NotNull @NotNull String encodedBlobId)
      Deprecated.
      Description copied from interface: BlobStore
      Returns a secure reference to blob referred by blobid, or null if no such reference is available.
      Specified by:
      getReference in interface BlobStore
      Parameters:
      encodedBlobId - blobId referring the blob for which reference is required
      Returns:
      binary reference, or null
    • getInputStream

      public InputStream getInputStream(String encodedBlobId) throws IOException
      Deprecated.
      Description copied from interface: BlobStore
      Returns a new stream for given blobId. The streams returned from multiple calls to this method are byte wise equals. That is, subsequent calls to read return the same sequence of bytes as long as neither call throws an exception.
      Specified by:
      getInputStream in interface BlobStore
      Parameters:
      encodedBlobId - the blob id
      Returns:
      a new stream for given blobId
      Throws:
      IOException
    • setBlockSize

      public void setBlockSize(int x)
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Set the block size used by this blob store, if the blob store splits binaries into blocks. If not, this setting is ignored.
      Specified by:
      setBlockSize in interface GarbageCollectableBlobStore
      Parameters:
      x - the block size in bytes.
    • writeBlob

      public String writeBlob(String tempFileName) throws IOException
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Write a blob from a temporary file. The temporary file is removed afterwards. A file based blob stores might simply rename the file, so that no additional writes are necessary.
      Specified by:
      writeBlob in interface GarbageCollectableBlobStore
      Parameters:
      tempFileName - the temporary file name
      Returns:
      the blob id
      Throws:
      IOException
    • sweep

      public int sweep() throws IOException
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Remove all unused blocks.
      Specified by:
      sweep in interface GarbageCollectableBlobStore
      Returns:
      the number of removed blocks
      Throws:
      IOException
    • startMark

      public void startMark() throws IOException
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Start the mark phase.
      Specified by:
      startMark in interface GarbageCollectableBlobStore
      Throws:
      IOException
    • clearInUse

      public void clearInUse()
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Clear all objects marked as "transiently in use".
      Specified by:
      clearInUse in interface org.apache.jackrabbit.oak.spi.blob.data.DataStore
      Specified by:
      clearInUse in interface GarbageCollectableBlobStore
    • clearCache

      public void clearCache()
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Clear the cache.
      Specified by:
      clearCache in interface GarbageCollectableBlobStore
    • getBlockSizeMin

      public long getBlockSizeMin()
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Get the minimum block size (if there is any).
      Specified by:
      getBlockSizeMin in interface GarbageCollectableBlobStore
      Returns:
      the block size
    • getAllChunkIds

      public Iterator<String> getAllChunkIds(long maxLastModifiedTime) throws Exception
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Gets all the identifiers.
      Specified by:
      getAllChunkIds in interface GarbageCollectableBlobStore
      Parameters:
      maxLastModifiedTime - the max last modified time to consider for retrieval, with the special value '0' meaning no filtering by time
      Returns:
      the identifiers
      Throws:
      Exception - the exception
    • deleteChunks

      public boolean deleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Deletes the blobs with the given ids.
      Specified by:
      deleteChunks in interface GarbageCollectableBlobStore
      Parameters:
      chunkIds - the chunk ids
      maxLastModifiedTime - the max last modified time to consider for retrieval, with the special value '0' meaning no filtering by time
      Returns:
      true, if successful
      Throws:
      Exception - the exception
    • countDeleteChunks

      public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Deletes the blobs with the given ids.
      Specified by:
      countDeleteChunks in interface GarbageCollectableBlobStore
      Parameters:
      chunkIds - the chunk ids
      maxLastModifiedTime - the max last modified time to consider for retrieval, with the special value '0' meaning no filtering by time
      Returns:
      long the count of successful deletions
      Throws:
      Exception - the exception
    • resolveChunks

      public Iterator<String> resolveChunks(String blobId) throws IOException
      Deprecated.
      Description copied from interface: GarbageCollectableBlobStore
      Resolve chunks stored in the blob store from the given Id. This will not return any chunks stored in-line in the id.
      Specified by:
      resolveChunks in interface GarbageCollectableBlobStore
      Parameters:
      blobId - the blob id
      Returns:
      the iterator
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • addMetadataRecord

      public void addMetadataRecord(InputStream stream, String name) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Description copied from interface: SharedDataStore
      Adds the root record.
      Specified by:
      addMetadataRecord in interface SharedDataStore
      Parameters:
      stream - the stream
      name - the name of the root record
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException - the data store exception
    • addMetadataRecord

      public void addMetadataRecord(File f, String name) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Description copied from interface: SharedDataStore
      Adds the root record.
      Specified by:
      addMetadataRecord in interface SharedDataStore
      Parameters:
      f - the file
      name - the name of the root record
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException - the data store exception
    • getMetadataRecord

      public org.apache.jackrabbit.oak.spi.blob.data.DataRecord getMetadataRecord(String name)
      Deprecated.
      Description copied from interface: SharedDataStore
      Retrieves the metadata record with the given name
      Specified by:
      getMetadataRecord in interface SharedDataStore
      Parameters:
      name - the name of the record
      Returns:
    • metadataRecordExists

      public boolean metadataRecordExists(String name)
      Deprecated.
      Description copied from interface: SharedDataStore
      Checks if the metadata record with the name exists
      Specified by:
      metadataRecordExists in interface SharedDataStore
      Parameters:
      name -
      Returns:
    • getAllMetadataRecords

      public List<org.apache.jackrabbit.oak.spi.blob.data.DataRecord> getAllMetadataRecords(String prefix)
      Deprecated.
      Description copied from interface: SharedDataStore
      Gets the all root records.
      Specified by:
      getAllMetadataRecords in interface SharedDataStore
      Returns:
      the all root records
    • deleteMetadataRecord

      public boolean deleteMetadataRecord(String name)
      Deprecated.
      Description copied from interface: SharedDataStore
      Deletes the root record represented by the given parameters.
      Specified by:
      deleteMetadataRecord in interface SharedDataStore
      Parameters:
      name - the name of the root record
      Returns:
      success/failure
    • deleteAllMetadataRecords

      public void deleteAllMetadataRecords(String prefix)
      Deprecated.
      Description copied from interface: SharedDataStore
      Deletes all records matching the given prefix.
      Specified by:
      deleteAllMetadataRecords in interface SharedDataStore
      Parameters:
      prefix - metadata type identifier
    • setRepositoryId

      public void setRepositoryId(String repositoryId) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Description copied from interface: SharedDataStore
      Sets the repository id to identify repository in the DataStore
      Specified by:
      setRepositoryId in interface SharedDataStore
      Parameters:
      repositoryId -
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • getRepositoryId

      public String getRepositoryId()
      Deprecated.
      Description copied from interface: SharedDataStore
      Returns the repository id (identifier for the repository in the DataStore)
      Specified by:
      getRepositoryId in interface SharedDataStore
      Returns:
      repository id
    • getAllRecords

      public Iterator<org.apache.jackrabbit.oak.spi.blob.data.DataRecord> getAllRecords() throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Description copied from interface: SharedDataStore
      Retrieved an iterator over all DataRecords.
      Specified by:
      getAllRecords in interface SharedDataStore
      Returns:
      iterator over DataRecords
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • getRecordForId

      public org.apache.jackrabbit.oak.spi.blob.data.DataRecord getRecordForId(org.apache.jackrabbit.oak.spi.blob.data.DataIdentifier identifier) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Description copied from interface: SharedDataStore
      Retrieves the record for the given identifier
      Specified by:
      getRecordForId in interface SharedDataStore
      Parameters:
      identifier - the if of the record
      Returns:
      data record
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • getType

      public SharedDataStore.Type getType()
      Deprecated.
      Description copied from interface: SharedDataStore
      Gets the type.
      Specified by:
      getType in interface SharedDataStore
      Returns:
      the type
    • addRecord

      public org.apache.jackrabbit.oak.spi.blob.data.DataRecord addRecord(InputStream input, BlobOptions options) throws org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
      Deprecated.
      Description copied from interface: TypedDataStore
      Add a record with specified options.
      Specified by:
      addRecord in interface TypedDataStore
      Parameters:
      input -
      options -
      Returns:
      Throws:
      org.apache.jackrabbit.oak.spi.blob.data.DataStoreException
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object
    • getDataStore

      public org.apache.jackrabbit.oak.spi.blob.data.DataStore getDataStore()
      Deprecated.
    • getCacheStats

      public org.apache.jackrabbit.oak.cache.AbstractCacheStats getCacheStats()
      Deprecated.
    • setMaxCachedBinarySize

      public void setMaxCachedBinarySize(int maxCachedBinarySize)
      Deprecated.
    • setBlobStatsCollector

      public void setBlobStatsCollector(BlobStatsCollector stats)
      Deprecated.
    • addTracker

      public void addTracker(BlobTracker tracker)
      Deprecated.
      Description copied from interface: BlobTrackingStore
      Registers a tracker in the data store.
      Specified by:
      addTracker in interface BlobTrackingStore
      Parameters:
      tracker -
    • getTracker

      @Nullable public @Nullable BlobTracker getTracker()
      Deprecated.
      Description copied from interface: BlobTrackingStore
      Gets the traker registered in the data store.
      Specified by:
      getTracker in interface BlobTrackingStore
      Returns:
      tracker
    • initiateBlobUpload

      @Nullable public @Nullable org.apache.jackrabbit.oak.api.blob.BlobUpload initiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs) throws IllegalArgumentException
      Deprecated.
      Specified by:
      initiateBlobUpload in interface org.apache.jackrabbit.oak.api.blob.BlobAccessProvider
      Throws:
      IllegalArgumentException
    • initiateBlobUpload

      @Nullable public @Nullable org.apache.jackrabbit.oak.api.blob.BlobUpload initiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs, @NotNull @NotNull org.apache.jackrabbit.oak.api.blob.BlobUploadOptions options) throws IllegalArgumentException
      Deprecated.
      Specified by:
      initiateBlobUpload in interface org.apache.jackrabbit.oak.api.blob.BlobAccessProvider
      Throws:
      IllegalArgumentException
    • completeBlobUpload

      @Nullable public @Nullable Blob completeBlobUpload(@NotNull @NotNull String uploadToken) throws IllegalArgumentException
      Deprecated.
      Specified by:
      completeBlobUpload in interface org.apache.jackrabbit.oak.api.blob.BlobAccessProvider
      Throws:
      IllegalArgumentException
    • getDownloadURI

      @Nullable public @Nullable URI getDownloadURI(@NotNull @NotNull Blob blob, @NotNull @NotNull org.apache.jackrabbit.oak.api.blob.BlobDownloadOptions downloadOptions)
      Deprecated.
      Specified by:
      getDownloadURI in interface org.apache.jackrabbit.oak.api.blob.BlobAccessProvider