Package org.nuxeo.ecm.core.blob
Class BlobStoreBlobProvider
- java.lang.Object
-
- org.nuxeo.ecm.core.blob.AbstractBlobProvider
-
- org.nuxeo.ecm.core.blob.BlobStoreBlobProvider
-
- All Implemented Interfaces:
BlobProvider
- Direct Known Subclasses:
AzureBlobProvider,GoogleStorageBlobProvider,GridFSBlobProvider,InMemoryBlobProvider,LocalBlobProvider,S3BlobProvider
public abstract class BlobStoreBlobProvider extends AbstractBlobProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBlobStoreBlobProvider.AutoDeleteFileInputStreamAFileInputStreamthat deletes its underlying file when it is closed.
-
Field Summary
Fields Modifier and Type Field Description static StringDIGEST_KEY_STRATEGYstatic StringKEY_STRATEGY_PROPERTYstatic StringMANAGED_KEY_STRATEGYBlobStorestore-
Fields inherited from class org.nuxeo.ecm.core.blob.AbstractBlobProvider
blobProviderId, properties
-
-
Constructor Summary
Constructors Constructor Description BlobStoreBlobProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanallowDirectDownload()Checks whether this blob provider allows direct download.voiddeleteBlob(BlobContext blobContext)Deletes a blob from storage.protected voidfixupDigest(Blob blob, String key)Fixup of the blob's digest, if possible.BinaryGarbageCollectorgetBinaryGarbageCollector()Gets the associated garbage collector, if any.BinaryManagergetBinaryManager()Gets the associated binary manager, if any.protected abstract BlobStoregetBlobStore(String blobProviderId, Map<String,String> properties)protected abstract StringgetDigestAlgorithm()The digest algorithm to use for the default key strategy.FilegetFile(ManagedBlob blob)Gets aFile(if one exists) for the data of a managed blob.KeyStrategygetKeyStrategy()StringgetStoreScrollName()Gets the name of the scroll to scroll the blobs of the underlying blob store.InputStreamgetStream(String blobKey, ByteRange byteRange)Gets anInputStreamfor a byte range of a managed blob.InputStreamgetStream(ManagedBlob blob)Gets anInputStreamfor the data of a managed blob.voidinitialize(String blobProviderId, Map<String,String> properties)Initializes the blob provider.booleanisValidKey(String key)Does the given key have the expected pattern for the provider's key strategy.BlobreadBlob(BlobInfo blobInfo)Reads aBlobfrom storage.protected StringstripBlobKeyPrefix(String key)protected StringstripBlobKeyVersionSuffix(String key)booleansupportsSync()Checks if sync is supported.voidupdateBlob(BlobUpdateContext blobUpdateContext)Updates a blob's properties in storage.StringwriteBlob(Blob blob)Writes aBlobto storage and returns information about it.StringwriteBlob(BlobContext blobContext)Writes aBlobto storage and returns information about it.-
Methods inherited from class org.nuxeo.ecm.core.blob.AbstractBlobProvider
allowByteRange, getProperties, hasCreateFromKeyPermission, isColdStorageMode, isRecordMode, isTransactional, isTransient, supportsUserUpdate, supportsUserUpdateDefaultFalse, supportsUserUpdateDefaultTrue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.blob.BlobProvider
canConvert, close, getAppLinks, getAvailableConversions, getStatus, getThumbnail, getURI, isVersion, performsExternalAccessControl, readBlob
-
-
-
-
Field Detail
-
KEY_STRATEGY_PROPERTY
public static final String KEY_STRATEGY_PROPERTY
- Since:
- 11.2
- See Also:
- Constant Field Values
-
MANAGED_KEY_STRATEGY
public static final String MANAGED_KEY_STRATEGY
- Since:
- 11.2
- See Also:
- Constant Field Values
-
DIGEST_KEY_STRATEGY
public static final String DIGEST_KEY_STRATEGY
- Since:
- 11.2
- See Also:
- Constant Field Values
-
store
public BlobStore store
-
-
Method Detail
-
initialize
public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
Description copied from interface:BlobProviderInitializes the blob provider.- Specified by:
initializein interfaceBlobProvider- Overrides:
initializein classAbstractBlobProvider- Parameters:
blobProviderId- the blob provider id for this binary managerproperties- initialization properties- Throws:
IOException
-
getBlobStore
protected abstract BlobStore getBlobStore(String blobProviderId, Map<String,String> properties) throws IOException
- Throws:
IOException
-
allowDirectDownload
public boolean allowDirectDownload()
Description copied from interface:BlobProviderChecks whether this blob provider allows direct download.
-
getKeyStrategy
public KeyStrategy getKeyStrategy()
- Since:
- 11.2
-
getDigestAlgorithm
protected abstract String getDigestAlgorithm()
The digest algorithm to use for the default key strategy.
-
getBinaryManager
public BinaryManager getBinaryManager()
Description copied from interface:BlobProviderGets the associated binary manager, if any.- Returns:
- the binary manager, or
null
-
supportsSync
public boolean supportsSync()
Description copied from interface:BlobProviderChecks if sync is supported.Sync refers to the fact that a blob from this provider may be synced with a remote system (like Nuxeo Drive) or with a process that updates things in the blob (like Binary Metadata, or WOPI).
- Returns:
trueif sync is supported
-
getBinaryGarbageCollector
public BinaryGarbageCollector getBinaryGarbageCollector()
Description copied from interface:BlobProviderGets the associated garbage collector, if any.- Returns:
- the garbage collector, or
null
-
isValidKey
public boolean isValidKey(String key)
Does the given key have the expected pattern for the provider's key strategy.- Since:
- 2023.5
-
writeBlob
public String writeBlob(BlobContext blobContext) throws IOException
Description copied from interface:BlobProviderWrites aBlobto storage and returns information about it.Called to store a user-created blob.
- Parameters:
blobContext- the blob context- Returns:
- the blob key
- Throws:
IOException
-
writeBlob
public String writeBlob(Blob blob) throws IOException
Description copied from interface:BlobProviderWrites aBlobto storage and returns information about it.Called to store a user-created blob.
- Parameters:
blob- the blob- Returns:
- the blob key
- Throws:
IOException
-
getStream
public InputStream getStream(ManagedBlob blob) throws IOException
Description copied from interface:BlobProviderGets anInputStreamfor the data of a managed blob.Like all
InputStream, the result must be closed when done with it to avoid resource leaks.- Parameters:
blob- the managed blob- Returns:
- the stream
- Throws:
IOException
-
getStream
public InputStream getStream(String blobKey, ByteRange byteRange) throws IOException
Description copied from interface:BlobProviderGets anInputStreamfor a byte range of a managed blob.- Parameters:
blobKey- the blob keybyteRange- the byte range- Returns:
- the stream
- Throws:
IOException
-
getFile
public File getFile(ManagedBlob blob)
Description copied from interface:BlobProviderGets aFile(if one exists) for the data of a managed blob.- Parameters:
blob- the managed blob- Returns:
- the file, or
nullif no underlying file is available
-
readBlob
public Blob readBlob(BlobInfo blobInfo) throws IOException
Description copied from interface:BlobProviderReads aBlobfrom storage.- Parameters:
blobInfo- the blob information- Returns:
- the blob
- Throws:
IOException
-
fixupDigest
protected void fixupDigest(Blob blob, String key)
Fixup of the blob's digest, if possible.- Parameters:
blob- the blobkey- the key- Since:
- 11.2
-
updateBlob
public void updateBlob(BlobUpdateContext blobUpdateContext) throws IOException
Description copied from interface:BlobProviderUpdates a blob's properties in storage.- Parameters:
blobUpdateContext- the blob update context- Throws:
IOException
-
deleteBlob
public void deleteBlob(BlobContext blobContext)
Description copied from interface:BlobProviderDeletes a blob from storage. Only meaningful for a record blob provider.- Parameters:
blobContext- the blob context- See Also:
BlobProvider.isRecordMode()
-
getStoreScrollName
public String getStoreScrollName()
Gets the name of the scroll to scroll the blobs of the underlying blob store.- Since:
- 2023
-
-