public class DocumentBlobManagerComponent extends DefaultComponent implements DocumentBlobManager
| Modifier and Type | Field and Description |
|---|---|
protected Deque<BlobDispatcherDescriptor> |
blobDispatcherDescriptorsRegistry |
protected static BlobDispatcher |
DEFAULT_BLOB_DISPATCHER |
protected static String |
XP |
lastModified, name| Constructor and Description |
|---|
DocumentBlobManagerComponent() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected BlobDispatcher |
getBlobDispatcher() |
protected BlobProvider |
getBlobProvider(String providerId) |
protected BlobProvider |
getBlobProvider(String key,
String repositoryName) |
InputStream |
getConvertedStream(Blob blob,
String mimeType,
DocumentModel doc)
Gets an
InputStream for a conversion to the given MIME type. |
protected DocumentBlobProvider |
getDocumentBlobProvider(Blob blob) |
protected List<BinaryGarbageCollector> |
getGarbageCollectors() |
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(BlobInfo blobInfo,
String repositoryName)
Reads a
Blob from storage. |
protected void |
registerBlobDispatcher(BlobDispatcherDescriptor descr) |
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
protected void |
unregisterBlobDispatcher(BlobDispatcherDescriptor descr) |
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
String |
writeBlob(Blob blob,
Document doc,
String xpath)
Writes a
Blob to storage and returns its key. |
activate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStarted, getApplicationStartedOrderprotected static final String XP
protected static BlobDispatcher DEFAULT_BLOB_DISPATCHER
protected Deque<BlobDispatcherDescriptor> blobDispatcherDescriptorsRegistry
public DocumentBlobManagerComponent()
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()
protected BlobProvider getBlobProvider(String providerId)
protected DocumentBlobProvider getDocumentBlobProvider(Blob blob)
public Blob readBlob(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 DocumentBlobManagerblobInfo - the blob informationrepositoryName - the repository to which this blob belongsIOExceptionprotected BlobProvider getBlobProvider(String key, String repositoryName)
public String writeBlob(Blob blob, Document doc, String xpath) 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 DocumentBlobManagerblob - the blobdoc - the document to which this blob belongsxpath - the xpath of blob in docIOExceptionpublic InputStream getConvertedStream(Blob blob, String mimeType, DocumentModel doc) throws IOException
DocumentBlobManagerInputStream 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 DocumentBlobManagerblob - 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 void freezeVersion(Document doc)
DocumentBlobManagerfreezeVersion in interface DocumentBlobManagerdoc - the new document versionpublic void notifyChanges(Document doc, Set<String> xpaths)
DocumentBlobManagernotifyChanges in interface DocumentBlobManagerdoc - the documentxpaths - the set of changed xpathsprotected List<BinaryGarbageCollector> getGarbageCollectors()
public BinaryManagerStatus garbageCollectBinaries(boolean delete)
DocumentBlobManagergarbageCollectBinaries in interface DocumentBlobManagerdelete - 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)
DocumentBlobManagerDocumentBlobManager.garbageCollectBinaries(boolean).markReferencedBinary in interface DocumentBlobManagerkey - the binary keyrepositoryName - the repository namepublic boolean isBinariesGarbageCollectionInProgress()
DocumentBlobManagerisBinariesGarbageCollectionInProgress in interface DocumentBlobManagertrue if a garbage collection of the binaries is in progressCopyright © 2019 Nuxeo. All rights reserved.