Package org.nuxeo.ecm.core.blob
Interface BlobManager
-
- All Known Implementing Classes:
BlobManagerComponent
public interface BlobManager
Service managing the storage and retrieval ofBlob
s, through internally-registeredBlobProvider
s.- Since:
- 7.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
BlobManager.UsageHint
Hints for returningURI
s appropriate for the expected usage.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
deleteBlobsMarkedForDeletion()
Deletes the blobs marked for deletion, if enough time has elapsed.Map<String,URI>
getAvailableConversions(Blob blob, BlobManager.UsageHint hint)
Gets a map of available MIME type conversions and correspondingURI
for a blob.String
getBlobKeyReplacement(String blobProviderId, String key)
Gets the replacement (if any) for a blob key.BlobProvider
getBlobProvider(String id)
Gets the blob provider with the given id.BlobProvider
getBlobProvider(Blob blob)
Gets the blob provider for the given blob.Map<String,BlobProvider>
getBlobProviders()
Get the map of blob providersdefault BlobProvider
getBlobProviderWithNamespace(String id)
Deprecated.since 11.1, usegetBlobProviderWithNamespace(String, String)
insteadBlobProvider
getBlobProviderWithNamespace(String id, String defaultId)
Gets the blob provider with the given id, or, if none has been registered, a namespaced version of the blob provider with the given default id.File
getFile(Blob blob)
Deprecated.since 11.1, useBlob.getFile()
insteadInputStream
getStream(Blob blob)
Deprecated.since 11.1, useBlob.getStream()
insteadInputStream
getThumbnail(Blob blob)
Gets anInputStream
for a thumbnail of a blob.URI
getURI(Blob blob, BlobManager.UsageHint hint, javax.servlet.http.HttpServletRequest servletRequest)
Gets anURI
for the content of a blob.void
markBlobForDeletion(String blobProviderId, String key)
Marks the given blob for deletion at a later time.void
setBlobKeyReplacement(String blobProviderId, String key, String newKey)
Records the fact that a blob key has been replaced by another one.
-
-
-
Method Detail
-
getBlobProvider
BlobProvider getBlobProvider(String id)
Gets the blob provider with the given id.- Parameters:
id
- the blob provider id- Returns:
- the blob provider
-
getBlobProviderWithNamespace
@Deprecated default BlobProvider getBlobProviderWithNamespace(String id)
Deprecated.since 11.1, usegetBlobProviderWithNamespace(String, String)
insteadGets the blob provider with the given id, or, if none has been registered, a namespaced version of the default blob provider.- Parameters:
id
- the blob provider id or namespace- Returns:
- the blob provider
- Since:
- 10.10
-
getBlobProviderWithNamespace
BlobProvider getBlobProviderWithNamespace(String id, String defaultId)
Gets the blob provider with the given id, or, if none has been registered, a namespaced version of the blob provider with the given default id.- Parameters:
id
- the blob provider id or namespacedefaultId
- the blob provider to use as a fallback to create a namespaced version- Returns:
- the blob provider
- Since:
- 11.1
-
getBlobProvider
BlobProvider getBlobProvider(Blob blob)
Gets the blob provider for the given blob.- Returns:
- the blob provider
- Since:
- 7.4
-
getStream
@Deprecated InputStream getStream(Blob blob) throws IOException
Deprecated.since 11.1, useBlob.getStream()
insteadGets anInputStream
for the data of a managed blob.If the blob is managed this is equivalent to
ManagedBlob.getStream()
, otherwise returnsnull
.- Parameters:
blob
- the blob- Returns:
- the stream, or
null
if the blob is not managed - Throws:
IOException
-
getFile
@Deprecated File getFile(Blob blob)
Deprecated.since 11.1, useBlob.getFile()
insteadGets aFile
(if one exists) for the data of a managed blob.If the blob is managed this is equivalent to
ManagedBlob.getFile()
, otherwise returnsnull
.- Parameters:
blob
- the blob- Returns:
- the file, or
null
if no underlying file is available or the blob is not managed - Since:
- 11.1
-
getThumbnail
InputStream getThumbnail(Blob blob) throws IOException
Gets anInputStream
for a thumbnail of a blob.Like all
InputStream
, the result must be closed when done with it to avoid resource leaks.- Parameters:
blob
- the blob- Returns:
- the thumbnail stream
- Throws:
IOException
-
getURI
URI getURI(Blob blob, BlobManager.UsageHint hint, javax.servlet.http.HttpServletRequest servletRequest) throws IOException
Gets anURI
for the content of a blob.- Parameters:
blob
- the blobhint
-BlobManager.UsageHint
servletRequest
- the servlet request, ornull
- Returns:
- the
URI
, ornull
if none available - Throws:
IOException
-
getAvailableConversions
Map<String,URI> getAvailableConversions(Blob blob, BlobManager.UsageHint hint) throws IOException
Gets a map of available MIME type conversions and correspondingURI
for a blob.- Returns:
- a map of MIME types and
URI
, which may be empty - Throws:
IOException
-
getBlobProviders
Map<String,BlobProvider> getBlobProviders()
Get the map of blob providers- Returns:
- the list of blob providers
- Since:
- 7.3
-
setBlobKeyReplacement
void setBlobKeyReplacement(String blobProviderId, String key, String newKey)
Records the fact that a blob key has been replaced by another one.- Parameters:
blobProviderId
- the blob provider idkey
- the old blob keynewKey
- the new blob key- Since:
- 11.5
- See Also:
getBlobKeyReplacement(String, String)
-
getBlobKeyReplacement
String getBlobKeyReplacement(String blobProviderId, String key)
Gets the replacement (if any) for a blob key.- Parameters:
blobProviderId
- the blob provider idkey
- the old blob key- Returns:
- the new blob key, or the old one if there was no replacement
- Since:
- 11.5
- See Also:
setBlobKeyReplacement(String, String, String)
-
markBlobForDeletion
void markBlobForDeletion(String blobProviderId, String key)
Marks the given blob for deletion at a later time.- Parameters:
blobProviderId
- the blob provider idkey
- the blob key- Since:
- 2021.9
-
deleteBlobsMarkedForDeletion
void deleteBlobsMarkedForDeletion()
Deletes the blobs marked for deletion, if enough time has elapsed.- Since:
- 2021.9
-
-