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
public class BlobManagerComponent extends DefaultComponent implements BlobManager
Implementation of the service managing the storage and retrieval ofBlobs, through internally-registeredBlobProviders.- Since:
- 7.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBlobManagerComponent.BlobProviderDescriptorRegistry-
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.blob.BlobManager
BlobManager.UsageHint
-
-
Field Summary
Fields Modifier and Type Field Description protected BlobManagerComponent.BlobProviderDescriptorRegistryblobProviderDescriptorsRegistryprotected Map<String,BlobProvider>blobProvidersstatic StringDEFAULT_IDstatic StringTRANSIENT_ID_PREFIXBlob providers whose id starts with this prefix are automatically marked transient.protected static StringXP-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description BlobManagerComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcloseOldBlobProvider(String id)We're about to change something about a contributed blob provider.voiddeactivate(ComponentContext context)Deactivates the component.Map<String,URI>getAvailableConversions(Blob blob, BlobManager.UsageHint hint)Gets a map of available MIME type conversions and correspondingURIfor a blob.BlobProvidergetBlobProvider(String providerId)Gets the blob provider with the given id.BlobProvidergetBlobProvider(Blob blob)Gets the blob provider for the given blob.Map<String,BlobProvider>getBlobProviders()Get the map of blob providersBlobProvidergetBlobProviderWithNamespace(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.FilegetFile(Blob blob)Deprecated.InputStreamgetStream(Blob blob)Deprecated.InputStreamgetThumbnail(Blob blob)Gets anInputStreamfor a thumbnail of a blob.URIgetURI(Blob blob, BlobManager.UsageHint hint, javax.servlet.http.HttpServletRequest servletRequest)Gets anURIfor the content of a blob.voidregisterBlobProvider(BlobProviderDescriptor descr)voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)voidunregisterBlobProvider(BlobProviderDescriptor descr)voidunregisterContribution(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
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
XP
protected static final String XP
- See Also:
- Constant Field Values
-
DEFAULT_ID
public static final String DEFAULT_ID
- See Also:
- Constant Field Values
-
TRANSIENT_ID_PREFIX
public static final String TRANSIENT_ID_PREFIX
Blob providers whose id starts with this prefix are automatically marked transient.- Since:
- 10.10
- See Also:
BlobProvider.isTransient(), Constant Field Values
-
blobProviderDescriptorsRegistry
protected BlobManagerComponent.BlobProviderDescriptorRegistry blobProviderDescriptorsRegistry
-
blobProviders
protected Map<String,BlobProvider> blobProviders
-
-
Constructor Detail
-
BlobManagerComponent
public BlobManagerComponent()
-
-
Method Detail
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein classDefaultComponent- Parameters:
context- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContributionin classDefaultComponent
-
registerBlobProvider
public void registerBlobProvider(BlobProviderDescriptor descr)
-
unregisterBlobProvider
public void unregisterBlobProvider(BlobProviderDescriptor descr)
-
closeOldBlobProvider
protected void closeOldBlobProvider(String id)
We're about to change something about a contributed blob provider. Close the old one.
-
getBlobProvider
public BlobProvider getBlobProvider(String providerId)
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
public BlobProvider getBlobProviderWithNamespace(String providerId, String defaultId)
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
public BlobProvider getBlobProvider(Blob blob)
Description copied from interface:BlobManagerGets the blob provider for the given blob.- Specified by:
getBlobProviderin interfaceBlobManager- Returns:
- the blob provider
-
getStream
@Deprecated public InputStream getStream(Blob blob) throws IOException
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 public File getFile(Blob blob)
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
public InputStream getThumbnail(Blob blob) throws IOException
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, javax.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
public Map<String,BlobProvider> getBlobProviders()
Description copied from interface:BlobManagerGet the map of blob providers- Specified by:
getBlobProvidersin interfaceBlobManager- Returns:
- the list of blob providers
-
-