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
Blob
s, through internally-registered
BlobProvider
s.- Since:
- 7.2
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.blob.BlobManager
BlobManager.UsageHint
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final Duration
protected static final String
protected static final String
static final String
protected static final Duration
protected Map<String,
BlobProvider> static final String
static final String
Blob providers whose id starts with this prefix are automatically marked transient.protected static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
We're about to change something about a contributed blob provider.void
deactivate
(ComponentContext context) Deactivates the component.protected void
deleteBlob
(String k) Deletes a blob.void
Deletes 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 correspondingURI
for a blob.protected KeyValueStore
getBlobKeyReplacement
(String blobProviderId, String key) Gets the replacement (if any) for a blob key.protected KeyValueStore
getBlobProvider
(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 anInputStream
for a thumbnail of a blob.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
void
registerContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) void
setBlobKeyReplacement
(String blobProviderId, String key, String newKey) Records the fact that a blob key has been replaced by another one.void
void
unregisterContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
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.BlobManager
getBlobProviderWithNamespace
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
XP
- See Also:
-
DEFAULT_ID
- 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
-
blobProviderDescriptorsRegistry
-
blobProviders
-
-
Constructor Details
-
BlobManagerComponent
public BlobManagerComponent()
-
-
Method Details
-
deactivate
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContribution
in classDefaultComponent
-
registerBlobProvider
-
unregisterBlobProvider
-
closeOldBlobProvider
We're about to change something about a contributed blob provider. Close the old one. -
getBlobProvider
Description copied from interface:BlobManager
Gets the blob provider with the given id.- Specified by:
getBlobProvider
in interfaceBlobManager
- Parameters:
providerId
- the blob provider id- Returns:
- the blob provider
-
getBlobProviderWithNamespace
Description copied from interface:BlobManager
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.- Specified by:
getBlobProviderWithNamespace
in 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:BlobManager
Gets the blob provider for the given blob.- Specified by:
getBlobProvider
in interfaceBlobManager
- Returns:
- the blob provider
-
getStream
Deprecated.Description copied from interface:BlobManager
Gets anInputStream
for the data of a managed blob.If the blob is managed this is equivalent to
ManagedBlob.getStream()
, otherwise returnsnull
.- Specified by:
getStream
in interfaceBlobManager
- Parameters:
blob
- the blob- Returns:
- the stream, or
null
if the blob is not managed - Throws:
IOException
-
getFile
Deprecated.Description copied from interface:BlobManager
Gets 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:
getFile
in interfaceBlobManager
- Parameters:
blob
- the blob- Returns:
- the file, or
null
if no underlying file is available or the blob is not managed
-
getThumbnail
Description copied from interface:BlobManager
Gets anInputStream
for a thumbnail of a blob.Like all
InputStream
, the result must be closed when done with it to avoid resource leaks.- Specified by:
getThumbnail
in interfaceBlobManager
- Parameters:
blob
- the blob- Returns:
- the thumbnail stream
- Throws:
IOException
-
getURI
public URI getURI(Blob blob, BlobManager.UsageHint hint, javax.servlet.http.HttpServletRequest servletRequest) throws IOException Description copied from interface:BlobManager
Gets anURI
for the content of a blob.- Specified by:
getURI
in interfaceBlobManager
- Parameters:
blob
- the blobhint
-BlobManager.UsageHint
servletRequest
- the servlet request, ornull
- Returns:
- the
URI
, ornull
if none available - Throws:
IOException
-
getAvailableConversions
public Map<String,URI> getAvailableConversions(Blob blob, BlobManager.UsageHint hint) throws IOException Description copied from interface:BlobManager
Gets a map of available MIME type conversions and correspondingURI
for a blob.- Specified by:
getAvailableConversions
in interfaceBlobManager
- Returns:
- a map of MIME types and
URI
, which may be empty - Throws:
IOException
-
getBlobProviders
Description copied from interface:BlobManager
Get the map of blob providers- Specified by:
getBlobProviders
in interfaceBlobManager
- Returns:
- the list of blob providers
-
getBlobKeyReplacementKeyValuestore
-
setBlobKeyReplacement
Description copied from interface:BlobManager
Records the fact that a blob key has been replaced by another one.- Specified by:
setBlobKeyReplacement
in interfaceBlobManager
- Parameters:
blobProviderId
- the blob provider idkey
- the old blob keynewKey
- the new blob key- See Also:
-
getBlobKeyReplacement
Description copied from interface:BlobManager
Gets the replacement (if any) for a blob key.- Specified by:
getBlobKeyReplacement
in 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:BlobManager
Marks the given blob for deletion at a later time.- Specified by:
markBlobForDeletion
in interfaceBlobManager
- Parameters:
blobProviderId
- the blob provider idkey
- the blob key
-
deleteBlobsMarkedForDeletion
public void deleteBlobsMarkedForDeletion()Description copied from interface:BlobManager
Deletes the blobs marked for deletion, if enough time has elapsed.- Specified by:
deleteBlobsMarkedForDeletion
in interfaceBlobManager
-
deleteBlob
Deletes a blob.- Parameters:
k
- the blob provider id + ":" + the blob key
-