Package org.nuxeo.ecm.core.blob
Class BlobManagerComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.core.blob.BlobManagerComponent
- All Implemented Interfaces:
BlobManager,Adaptable,Component,Extensible,TimestampedService
Implementation of the service managing the storage and retrieval of
Blobs, through internally-registered
BlobProviders.- Since:
- 7.2
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.blob.BlobManager
BlobManager.UsageHint -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Durationprotected static final Stringprotected static final Stringstatic final Stringprotected static final Durationprotected Map<String, BlobProvider> static final StringBlob providers whose id starts with this prefix are automatically marked transient.protected static final StringFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidWe're about to change something about a contributed blob provider.protected voiddeleteBlob(String k) Deletes a blob.voidDeletes the blobs marked for deletion, if enough time has elapsed.getAvailableConversions(Blob blob, BlobManager.UsageHint hint) Gets a map of available MIME type conversions and correspondingURIfor a blob.protected KeyValueStoregetBlobKeyReplacement(String blobProviderId, String key) Gets the replacement (if any) for a blob key.protected KeyValueStoregetBlobProvider(String providerId) Gets the blob provider with the given id.getBlobProvider(Blob blob) Gets the blob provider for the given blob.Get the map of blob providersgetBlobProviderWithNamespace(String providerId, 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.Deprecated.Deprecated.getThumbnail(Blob blob) Gets anInputStreamfor a thumbnail of a blob.getURI(Blob blob, BlobManager.UsageHint hint, jakarta.servlet.http.HttpServletRequest servletRequest) Gets anURIfor the content of a blob.voidmarkBlobForDeletion(String blobProviderId, String key) Marks the given blob for deletion at a later time.voidvoidsetBlobKeyReplacement(String blobProviderId, String key, String newKey) Records the fact that a blob key has been replaced by another one.voidstop(ComponentContext context) Stop the component.voidMethods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, start, unregister, unregisterContribution, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.ecm.core.blob.BlobManager
getBlobProviderWithNamespaceMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
XP
- See Also:
-
TRANSIENT_ID_PREFIX
Blob providers whose id starts with this prefix are automatically marked transient.- Since:
- 10.10
- See Also:
-
BLOB_KEY_REPLACEMENT_KV
- Since:
- 11.5
- See Also:
-
BLOB_KEY_REPLACEMENT_TTL
-
BLOB_DELETION_KV
- See Also:
-
BLOB_DELETION_DELAY_PROP
- See Also:
-
BLOB_DELETION_DELAY_DEFAULT
-
blobProviders
-
-
Constructor Details
-
BlobManagerComponent
public BlobManagerComponent()
-
-
Method Details
-
stop
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent- Throws:
InterruptedException
-
registerBlobProvider
-
unregisterBlobProvider
-
closeOldBlobProvider
We're about to change something about a contributed blob provider. Close the old one. -
getBlobProvider
Description copied from interface:BlobManagerGets the blob provider with the given id.- Specified by:
getBlobProviderin interfaceBlobManager- Parameters:
providerId- the blob provider id- Returns:
- the blob provider
-
getBlobProviderWithNamespace
Description copied from interface:BlobManagerGets 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.- Specified by:
getBlobProviderWithNamespacein interfaceBlobManager- Parameters:
providerId- the blob provider id or namespacedefaultId- the blob provider to use as a fallback to create a namespaced version- Returns:
- the blob provider
-
getBlobProvider
Description copied from interface:BlobManagerGets the blob provider for the given blob.- Specified by:
getBlobProviderin interfaceBlobManager- Returns:
- the blob provider
-
getStream
Deprecated.Description copied from interface:BlobManagerGets anInputStreamfor the data of a managed blob.If the blob is managed this is equivalent to
ManagedBlob.getStream(), otherwise returnsnull.- Specified by:
getStreamin interfaceBlobManager- Parameters:
blob- the blob- Returns:
- the stream, or
nullif the blob is not managed - Throws:
IOException
-
getFile
Deprecated.Description copied from interface:BlobManagerGets aFile(if one exists) for the data of a managed blob.If the blob is managed this is equivalent to
ManagedBlob.getFile(), otherwise returnsnull.- Specified by:
getFilein interfaceBlobManager- Parameters:
blob- the blob- Returns:
- the file, or
nullif no underlying file is available or the blob is not managed
-
getThumbnail
Description copied from interface:BlobManagerGets anInputStreamfor a thumbnail of a blob.Like all
InputStream, the result must be closed when done with it to avoid resource leaks.- Specified by:
getThumbnailin interfaceBlobManager- Parameters:
blob- the blob- Returns:
- the thumbnail stream
- Throws:
IOException
-
getURI
public URI getURI(Blob blob, BlobManager.UsageHint hint, jakarta.servlet.http.HttpServletRequest servletRequest) throws IOException Description copied from interface:BlobManagerGets anURIfor the content of a blob.- Specified by:
getURIin interfaceBlobManager- Parameters:
blob- the blobhint-BlobManager.UsageHintservletRequest- the servlet request, ornull- Returns:
- the
URI, ornullif none available - Throws:
IOException
-
getAvailableConversions
public Map<String,URI> getAvailableConversions(Blob blob, BlobManager.UsageHint hint) throws IOException Description copied from interface:BlobManagerGets a map of available MIME type conversions and correspondingURIfor a blob.- Specified by:
getAvailableConversionsin interfaceBlobManager- Returns:
- a map of MIME types and
URI, which may be empty - Throws:
IOException
-
getBlobProviders
Description copied from interface:BlobManagerGet the map of blob providers- Specified by:
getBlobProvidersin interfaceBlobManager- Returns:
- the list of blob providers
-
getBlobKeyReplacementKeyValuestore
-
setBlobKeyReplacement
Description copied from interface:BlobManagerRecords the fact that a blob key has been replaced by another one.- Specified by:
setBlobKeyReplacementin interfaceBlobManager- Parameters:
blobProviderId- the blob provider idkey- the old blob keynewKey- the new blob key- See Also:
-
getBlobKeyReplacement
Description copied from interface:BlobManagerGets the replacement (if any) for a blob key.- Specified by:
getBlobKeyReplacementin interfaceBlobManager- Parameters:
blobProviderId- the blob provider idkey- the old blob key- Returns:
- the new blob key, or the old one if there was no replacement
- See Also:
-
getBlobDeletionKeyValueStore
-
markBlobForDeletion
Description copied from interface:BlobManagerMarks the given blob for deletion at a later time.- Specified by:
markBlobForDeletionin interfaceBlobManager- Parameters:
blobProviderId- the blob provider idkey- the blob key
-
deleteBlobsMarkedForDeletion
public void deleteBlobsMarkedForDeletion()Description copied from interface:BlobManagerDeletes the blobs marked for deletion, if enough time has elapsed.- Specified by:
deleteBlobsMarkedForDeletionin interfaceBlobManager
-
deleteBlob
Deletes a blob.- Parameters:
k- the blob provider id + ":" + the blob key
-