public class BlobManagerComponent extends DefaultComponent implements BlobManager
Blobs, through internally-registered
 BlobProviders.| Modifier and Type | Class and Description | 
|---|---|
| protected static class  | BlobManagerComponent.BlobProviderDescriptorRegistry | 
BlobManager.BlobInfo, BlobManager.UsageHint| Modifier and Type | Field and Description | 
|---|---|
| protected Deque<BlobDispatcherDescriptor> | blobDispatcherDescriptorsRegistry | 
| protected BlobManagerComponent.BlobProviderDescriptorRegistry | blobProviderDescriptorsRegistry | 
| protected Map<String,BlobProvider> | blobProviders | 
| protected static BlobDispatcher | DEFAULT_BLOB_DISPATCHER | 
| protected static String | XP | 
lastModified| Constructor and Description | 
|---|
| BlobManagerComponent() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | closeOldBlobProvider(String id)We're about to change something about a contributed blob provider. | 
| void | deactivate(ComponentContext context)Deactivates the component. | 
| protected void | freezeVersion(Document.BlobAccessor accessor,
             Document doc) | 
| void | freezeVersion(Document doc)Freezes the blobs' versions on a document version when it is created via a check in. | 
| BinaryManagerStatus | garbageCollectBinaries(boolean delete)Garbage collect the unused binaries. | 
| Map<String,URI> | getAvailableConversions(Blob blob,
                       BlobManager.UsageHint hint)Gets a map of available MIME type conversions and corresponding  URIfor a blob. | 
| protected BlobDispatcher | getBlobDispatcher() | 
| BlobProvider | getBlobProvider(Blob blob)Gets the blob provider for the given blob. | 
| BlobProvider | getBlobProvider(String providerId)Gets the blob provider with the given id. | 
| protected BlobProvider | getBlobProvider(String key,
               String repositoryName) | 
| Map<String,BlobProvider> | getBlobProviders()Get the map of blob providers | 
| InputStream | getConvertedStream(Blob blob,
                  String mimeType,
                  DocumentModel doc)Gets an  InputStreamfor a conversion to the given MIME type. | 
| protected List<BinaryGarbageCollector> | getGarbageCollectors() | 
| InputStream | getStream(Blob blob)INTERNAL - Gets an  InputStreamfor the data of a managed blob. | 
| InputStream | getThumbnail(Blob blob)Gets an  InputStreamfor a thumbnail of a blob. | 
| URI | getURI(Blob blob,
      BlobManager.UsageHint hint,
      javax.servlet.http.HttpServletRequest servletRequest)Gets an  URIfor the content of a blob. | 
| boolean | isBinariesGarbageCollectionInProgress()Checks if a garbage collection of the binaries in progress. | 
| void | markReferencedBinary(String key,
                    String repositoryName)INTERNAL. | 
| void | notifyChanges(Document doc,
             Set<String> xpaths)Notifies the blob manager that a set of xpaths have changed on a document. | 
| Blob | readBlob(BlobManager.BlobInfo blobInfo,
        String repositoryName)Reads a  Blobfrom storage. | 
| protected void | registerBlobDispatcher(BlobDispatcherDescriptor descr) | 
| void | registerBlobProvider(BlobProviderDescriptor descr) | 
| void | registerContribution(Object contribution,
                    String extensionPoint,
                    ComponentInstance contributor) | 
| protected void | unregisterBlobDispatcher(BlobDispatcherDescriptor descr) | 
| void | unregisterBlobProvider(BlobProviderDescriptor descr) | 
| void | unregisterContribution(Object contribution,
                      String extensionPoint,
                      ComponentInstance contributor) | 
| String | writeBlob(Blob blob,
         Document doc)Writes a  Blobto storage and returns its key. | 
activate, applicationStarted, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtensionprotected static final String XP
protected static BlobDispatcher DEFAULT_BLOB_DISPATCHER
protected Deque<BlobDispatcherDescriptor> blobDispatcherDescriptorsRegistry
protected BlobManagerComponent.BlobProviderDescriptorRegistry blobProviderDescriptorsRegistry
protected Map<String,BlobProvider> blobProviders
public BlobManagerComponent()
public void deactivate(ComponentContext context)
ComponentThis method is called by the runtime when a component is deactivated.
deactivate in interface Componentdeactivate in class DefaultComponentcontext - the runtime contextpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution in class DefaultComponentpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution in class DefaultComponentprotected void registerBlobDispatcher(BlobDispatcherDescriptor descr)
protected void unregisterBlobDispatcher(BlobDispatcherDescriptor descr)
protected BlobDispatcher getBlobDispatcher()
public void registerBlobProvider(BlobProviderDescriptor descr)
public void unregisterBlobProvider(BlobProviderDescriptor descr)
protected void closeOldBlobProvider(String id)
public BlobProvider getBlobProvider(String providerId)
BlobManagergetBlobProvider in interface BlobManagerproviderId - the blob provider idpublic Blob readBlob(BlobManager.BlobInfo blobInfo, String repositoryName) throws IOException
Blob from storage.
 
 The BlobInfo (coming from the database) contains the blob key, which may or may not be prefixed by a blob
 provider id.
readBlob in interface BlobManagerblobInfo - the blob informationrepositoryName - the repository to which this blob belongsIOExceptionprotected BlobProvider getBlobProvider(String key, String repositoryName)
public String writeBlob(Blob blob, Document doc) throws IOException
Blob to storage and returns its key.
 If the blob is managed and already uses the provider that's expected for this blob and document, there is no need to recompute a key. Otherwise, go through the blob provider.
writeBlob in interface BlobManagerblob - the blobdoc - the document to which this blob belongsIOExceptionpublic BlobProvider getBlobProvider(Blob blob)
BlobManagergetBlobProvider in interface BlobManagerpublic InputStream getStream(Blob blob) throws IOException
BlobManagerInputStream for the data of a managed blob. Used by internal implementations, regular
 callers should call Blob.getStream().getStream in interface BlobManagerblob - the blobIOExceptionpublic InputStream getThumbnail(Blob blob) throws IOException
BlobManagerInputStream for a thumbnail of a blob.
 
 Like all InputStream, the result must be closed when done with it to avoid resource leaks.
getThumbnail in interface BlobManagerblob - the blobIOExceptionpublic URI getURI(Blob blob, BlobManager.UsageHint hint, javax.servlet.http.HttpServletRequest servletRequest) throws IOException
BlobManagerURI for the content of a blob.getURI in interface BlobManagerblob - the blobhint - BlobManager.UsageHintservletRequest - the servlet request, or nullURI, or null if none availableIOExceptionpublic Map<String,URI> getAvailableConversions(Blob blob, BlobManager.UsageHint hint) throws IOException
BlobManagerURI for a blob.getAvailableConversions in interface BlobManagerURI, which may be emptyIOExceptionpublic InputStream getConvertedStream(Blob blob, String mimeType, DocumentModel doc) throws IOException
BlobManagerInputStream for a conversion to the given MIME type.
 
 Like all InputStream, the result must be closed when done with it to avoid resource leaks.
getConvertedStream in interface BlobManagerblob - the blobmimeType - the MIME type to convert todoc - the document that holds the blobnull if no conversion is available for the given MIME typeIOExceptionprotected void freezeVersion(Document.BlobAccessor accessor, Document doc)
public Map<String,BlobProvider> getBlobProviders()
BlobManagergetBlobProviders in interface BlobManagerpublic void freezeVersion(Document doc)
BlobManagerfreezeVersion in interface BlobManagerdoc - the new document versionpublic void notifyChanges(Document doc, Set<String> xpaths)
BlobManagernotifyChanges in interface BlobManagerdoc - the documentxpaths - the set of changed xpathsprotected List<BinaryGarbageCollector> getGarbageCollectors()
public BinaryManagerStatus garbageCollectBinaries(boolean delete)
BlobManagergarbageCollectBinaries in interface BlobManagerdelete - if false don't actually delete the garbage collected binaries (but still return statistics
            about them), if true delete thempublic void markReferencedBinary(String key, String repositoryName)
BlobManagerBlobManager.garbageCollectBinaries(boolean).markReferencedBinary in interface BlobManagerkey - the binary keyrepositoryName - the repository namepublic boolean isBinariesGarbageCollectionInProgress()
BlobManagerisBinariesGarbageCollectionInProgress in interface BlobManagertrue if a garbage collection of the binaries is in progressCopyright © 2016 Nuxeo SA. All rights reserved.