Class GridFSBinaryManager

java.lang.Object
org.nuxeo.ecm.core.blob.binary.AbstractBinaryManager
org.nuxeo.ecm.core.storage.mongodb.GridFSBinaryManager
All Implemented Interfaces:
BinaryManager, BlobProvider

@Deprecated(since="2023.9") public class GridFSBinaryManager extends AbstractBinaryManager implements BlobProvider
Deprecated.
since 2023.9, use GridFSBlobProvider instead
Implements the BinaryManager and BlobProvider interface using MongoDB GridFS.

This implementation does not use local caching.

This implementation may not always be ideal regarding streaming because of the usage of Binary interface that exposes a File.

Since:
7.10
  • Field Details

    • BLOB_PROVIDER_CONNECTION_PREFIX

      public static final String BLOB_PROVIDER_CONNECTION_PREFIX
      Deprecated.
      Prefix used to retrieve a MongoDB connection from MongoDBConnectionService.

      The connection id will be blobProvider/[BLOB_PROVIDER_ID].

      See Also:
    • BUCKET_PROPERTY

      public static final String BUCKET_PROPERTY
      Deprecated.
      See Also:
    • gridFSBucket

      protected com.mongodb.client.gridfs.GridFSBucket gridFSBucket
      Deprecated.
    • filesColl

      protected com.mongodb.client.MongoCollection<org.bson.Document> filesColl
      Deprecated.
    • bucket

      protected String bucket
      Deprecated.
  • Constructor Details

    • GridFSBinaryManager

      public GridFSBinaryManager()
      Deprecated.
  • Method Details

    • initialize

      public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
      Deprecated.
      Description copied from interface: BinaryManager
      Initializes the binary manager.
      Specified by:
      initialize in interface BinaryManager
      Specified by:
      initialize in interface BlobProvider
      Overrides:
      initialize in class AbstractBinaryManager
      Parameters:
      blobProviderId - the blob provider id for this binary manager
      properties - initialization properties
      Throws:
      IOException
    • close

      public void close()
      Deprecated.
      Description copied from interface: BlobProvider
      Closes this blob provider and releases resources that may be held by it.
      Specified by:
      close in interface BinaryManager
      Specified by:
      close in interface BlobProvider
    • getBinaryManager

      public BinaryManager getBinaryManager()
      Deprecated.
      Description copied from interface: BlobProvider
      Gets the associated binary manager, if any.
      Specified by:
      getBinaryManager in interface BlobProvider
      Returns:
      the binary manager, or null
    • getGridFSBucket

      protected com.mongodb.client.gridfs.GridFSBucket getGridFSBucket()
      Deprecated.
    • getFilesColl

      protected com.mongodb.client.MongoCollection<org.bson.Document> getFilesColl()
      Deprecated.
    • getBinary

      public Binary getBinary(Blob blob) throws IOException
      Deprecated.
      Description copied from interface: BinaryManager
      Saves the given blob into a Binary.

      Returns a Binary representing the stream. The Binary includes a digest that is a sufficient representation to persist it.

      If the blob is a temporary FileBlob, then the temporary file may be reused as the final storage location after being moved.

      Specified by:
      getBinary in interface BinaryManager
      Overrides:
      getBinary in class AbstractBinaryManager
      Parameters:
      blob - the blob
      Returns:
      the corresponding binary
      Throws:
      IOException
    • getBinary

      protected Binary getBinary(InputStream in) throws IOException
      Deprecated.
      Description copied from class: AbstractBinaryManager
      Creates a binary value from the given input stream.
      Specified by:
      getBinary in class AbstractBinaryManager
      Throws:
      IOException
    • getBinary

      public Binary getBinary(String digest)
      Deprecated.
      Description copied from interface: BinaryManager
      Returns a Binary corresponding to the given digest.

      A null is returned if the digest could not be found.

      Specified by:
      getBinary in interface BinaryManager
      Specified by:
      getBinary in class AbstractBinaryManager
      Parameters:
      digest - the digest, or null
      Returns:
      the corresponding binary
    • readBlob

      public Blob readBlob(BlobInfo blobInfo) throws IOException
      Deprecated.
      Description copied from interface: BlobProvider
      Reads a Blob from storage.
      Specified by:
      readBlob in interface BlobProvider
      Parameters:
      blobInfo - the blob information
      Returns:
      the blob
      Throws:
      IOException
    • writeBlob

      public String writeBlob(Blob blob) throws IOException
      Deprecated.
      Description copied from interface: BlobProvider
      Writes a Blob to storage and returns information about it.

      Called to store a user-created blob.

      Specified by:
      writeBlob in interface BlobProvider
      Parameters:
      blob - the blob
      Returns:
      the blob key
      Throws:
      IOException
    • supportsUserUpdate

      public boolean supportsUserUpdate()
      Deprecated.
      Description copied from interface: BlobProvider
      Checks if user update is supported.

      A user update refers to the fact that a blob from this provider may be overwritten with another blob, wherever the original blob may occur (usually in a document property).

      Specified by:
      supportsUserUpdate in interface BlobProvider
      Returns:
      true if user update is supported
    • isTransient

      public boolean isTransient()
      Deprecated.
      Description copied from interface: BlobProvider
      Checks whether this blob provider is transient: blobs may disappear after a while, so a caller should not rely on them being available forever.
      Specified by:
      isTransient in interface BlobProvider
    • getProperties

      public Map<String,String> getProperties()
      Deprecated.
      Description copied from interface: BlobProvider
      Returns the properties of the blob provider.
      Specified by:
      getProperties in interface BlobProvider