Package org.nuxeo.ecm.core.blob
Class DocumentBlobManagerComponent
- java.lang.Object
- 
- org.nuxeo.runtime.model.DefaultComponent
- 
- org.nuxeo.ecm.core.blob.DocumentBlobManagerComponent
 
 
- 
- All Implemented Interfaces:
- DocumentBlobManager,- Adaptable,- Component,- Extensible,- TimestampedService
 
 public class DocumentBlobManagerComponent extends DefaultComponent implements DocumentBlobManager - Since:
- 9.2
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected static intBINARY_GC_TX_TIMEOUT_SECprotected Deque<BlobDispatcherDescriptor>blobDispatcherDescriptorsRegistryprotected static BlobDispatcherDEFAULT_BLOB_DISPATCHERprotected static StringMAIN_BLOB_XPATHprotected static StringXP- 
Fields inherited from class org.nuxeo.runtime.model.DefaultComponentlastModified, name
 
- 
 - 
Constructor SummaryConstructors Constructor Description DocumentBlobManagerComponent()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddeactivate(ComponentContext context)Deactivates the component.voidfreezeVersion(Document doc)Freezes the blobs' versions on a document version when it is created via a check in.protected voidfreezeVersion(Document.BlobAccessor accessor, Document doc)BinaryManagerStatusgarbageCollectBinaries(boolean delete)Garbage collect the unused binaries.protected BlobDispatchergetBlobDispatcher()protected BlobProvidergetBlobProvider(String providerId)protected BlobProvidergetBlobProvider(String key, String repositoryName)InputStreamgetConvertedStream(Blob blob, String mimeType, DocumentModel doc)Gets anInputStreamfor a conversion to the given MIME type.protected DocumentBlobProvidergetDocumentBlobProvider(Blob blob)protected List<BinaryGarbageCollector>getGarbageCollectors()protected ManagedBlobgetMainBlob(Document doc)booleanisBinariesGarbageCollectionInProgress()Checks if a garbage collection of the binaries in progress.voidmarkReferencedBinary(String key, String repositoryName)INTERNAL.voidnotifyAfterCopy(Document doc)Notifies the blob manager that the document has been copied.voidnotifyBeforeRemove(Document doc)Notifies the blob manager that the document is about to be removed.voidnotifyChanges(Document doc, Set<String> xpaths)Notifies the blob manager that a set of xpaths have changed on a document.voidnotifyMakeRecord(Document doc)Notifies the blob manager that the document was made a record.voidnotifySetLegalHold(Document doc, boolean hold)Notifies the blob manager that the document's legal hold status was changed.voidnotifySetRetainUntil(Document doc, Calendar retainUntil)Notifies the blob manager that the document's retention date was changed.BlobreadBlob(BlobInfo blobInfo, String repositoryName)Deprecated.since 11.1, usereadBlob(BlobInfo, Document, String)insteadBlobreadBlob(BlobInfo blobInfo, Document doc, String xpath)Reads aBlobfrom storage.protected BlobreadBlob(BlobInfo blobInfo, Document doc, String xpath, String repositoryName)protected voidregisterBlobDispatcher(BlobDispatcherDescriptor descr)voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)protected <R> RrunInTransaction(Supplier<R> supplier, int timeout)Runs the givenSupplierin a transaction with the giventimeout.protected StringstripBlobKeyPrefix(String key)protected voidunregisterBlobDispatcher(BlobDispatcherDescriptor descr)voidunregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)voidupdateBlob(Document doc, Consumer<BlobUpdateContext> contextFiller)StringwriteBlob(Blob blob, Document doc, String xpath)Writes aBlobto storage and returns its key.- 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponentactivate, addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.nuxeo.runtime.model.ComponentapplicationStarted, getApplicationStartedOrder
 
- 
 
- 
- 
- 
Field Detail- 
XPprotected static final String XP - See Also:
- Constant Field Values
 
 - 
DEFAULT_BLOB_DISPATCHERprotected static final BlobDispatcher DEFAULT_BLOB_DISPATCHER 
 - 
BINARY_GC_TX_TIMEOUT_SECprotected static final int BINARY_GC_TX_TIMEOUT_SEC - See Also:
- Constant Field Values
 
 - 
MAIN_BLOB_XPATHprotected static final String MAIN_BLOB_XPATH - See Also:
- Constant Field Values
 
 - 
blobDispatcherDescriptorsRegistryprotected Deque<BlobDispatcherDescriptor> blobDispatcherDescriptorsRegistry 
 
- 
 - 
Constructor Detail- 
DocumentBlobManagerComponentpublic DocumentBlobManagerComponent() 
 
- 
 - 
Method Detail- 
deactivatepublic 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 interface- Component
- Overrides:
- deactivatein class- DefaultComponent
- Parameters:
- context- the runtime context
 
 - 
registerContributionpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
- registerContributionin class- DefaultComponent
 
 - 
unregisterContributionpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
- unregisterContributionin class- DefaultComponent
 
 - 
registerBlobDispatcherprotected void registerBlobDispatcher(BlobDispatcherDescriptor descr) 
 - 
unregisterBlobDispatcherprotected void unregisterBlobDispatcher(BlobDispatcherDescriptor descr) 
 - 
getBlobDispatcherprotected BlobDispatcher getBlobDispatcher() 
 - 
getBlobProviderprotected BlobProvider getBlobProvider(String providerId) 
 - 
getDocumentBlobProviderprotected DocumentBlobProvider getDocumentBlobProvider(Blob blob) 
 - 
readBlobpublic Blob readBlob(BlobInfo blobInfo, Document doc, String xpath) throws IOException Reads aBlobfrom storage.The BlobInfo(coming from the database) contains the blob key, which may or may not be prefixed by a blob provider id.- Specified by:
- readBlobin interface- DocumentBlobManager
- Parameters:
- blobInfo- the blob information
- doc- the document to which this blob belongs
- xpath- the xpath of the blob in the document
- Returns:
- a managed blob
- Throws:
- IOException
 
 - 
readBlobprotected Blob readBlob(BlobInfo blobInfo, Document doc, String xpath, String repositoryName) throws IOException - Throws:
- IOException
 
 - 
readBlob@Deprecated public Blob readBlob(BlobInfo blobInfo, String repositoryName) throws IOException Deprecated.since 11.1, usereadBlob(BlobInfo, Document, String)insteadReads aBlobfrom storage.The BlobInfo(coming from the database) contains the blob key, which may or may not be prefixed by a blob provider id.- Specified by:
- readBlobin interface- DocumentBlobManager
- Parameters:
- blobInfo- the blob information
- repositoryName- the repository to which this blob belongs
- Returns:
- a managed blob
- Throws:
- IOException
 
 - 
getBlobProviderprotected BlobProvider getBlobProvider(String key, String repositoryName) 
 - 
writeBlobpublic String writeBlob(Blob blob, Document doc, String xpath) throws IOException Writes aBlobto storage and returns its key.The passed blob may be null, in which case anullkey is returned after checking that deleting this blob is allowed.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. - Specified by:
- writeBlobin interface- DocumentBlobManager
- Parameters:
- blob- the blob
- doc- the document to which this blob belongs
- xpath- the xpath of blob in doc
- Returns:
- the blob key
- Throws:
- IOException
 
 - 
getConvertedStreampublic InputStream getConvertedStream(Blob blob, String mimeType, DocumentModel doc) throws IOException Description copied from interface:DocumentBlobManagerGets anInputStreamfor a conversion to the given MIME type.Like all InputStream, the result must be closed when done with it to avoid resource leaks.- Specified by:
- getConvertedStreamin interface- DocumentBlobManager
- Parameters:
- blob- the blob
- mimeType- the MIME type to convert to
- doc- the document that holds the blob
- Returns:
- the stream, or nullif no conversion is available for the given MIME type
- Throws:
- IOException
 
 - 
freezeVersionprotected void freezeVersion(Document.BlobAccessor accessor, Document doc) 
 - 
freezeVersionpublic void freezeVersion(Document doc) Description copied from interface:DocumentBlobManagerFreezes the blobs' versions on a document version when it is created via a check in.- Specified by:
- freezeVersionin interface- DocumentBlobManager
- Parameters:
- doc- the new document version
 
 - 
notifyChangespublic void notifyChanges(Document doc, Set<String> xpaths) Description copied from interface:DocumentBlobManagerNotifies the blob manager that a set of xpaths have changed on a document.- Specified by:
- notifyChangesin interface- DocumentBlobManager
- Parameters:
- doc- the document
- xpaths- the set of changed xpaths
 
 - 
notifyMakeRecordpublic void notifyMakeRecord(Document doc) Description copied from interface:DocumentBlobManagerNotifies the blob manager that the document was made a record.- Specified by:
- notifyMakeRecordin interface- DocumentBlobManager
- Parameters:
- doc- the document
 
 - 
notifyAfterCopypublic void notifyAfterCopy(Document doc) Description copied from interface:DocumentBlobManagerNotifies the blob manager that the document has been copied.- Specified by:
- notifyAfterCopyin interface- DocumentBlobManager
- Parameters:
- doc- the new document, the result of the copy
 
 - 
notifyBeforeRemovepublic void notifyBeforeRemove(Document doc) Description copied from interface:DocumentBlobManagerNotifies the blob manager that the document is about to be removed.- Specified by:
- notifyBeforeRemovein interface- DocumentBlobManager
- Parameters:
- doc- the document
 
 - 
notifySetRetainUntilpublic void notifySetRetainUntil(Document doc, Calendar retainUntil) Description copied from interface:DocumentBlobManagerNotifies the blob manager that the document's retention date was changed.- Specified by:
- notifySetRetainUntilin interface- DocumentBlobManager
- Parameters:
- doc- the document
 
 - 
notifySetLegalHoldpublic void notifySetLegalHold(Document doc, boolean hold) Description copied from interface:DocumentBlobManagerNotifies the blob manager that the document's legal hold status was changed.- Specified by:
- notifySetLegalHoldin interface- DocumentBlobManager
- Parameters:
- doc- the document
 
 - 
updateBlobpublic void updateBlob(Document doc, Consumer<BlobUpdateContext> contextFiller) 
 - 
getMainBlobprotected ManagedBlob getMainBlob(Document doc) 
 - 
stripBlobKeyPrefixprotected String stripBlobKeyPrefix(String key) 
 - 
getGarbageCollectorsprotected List<BinaryGarbageCollector> getGarbageCollectors() 
 - 
garbageCollectBinariespublic BinaryManagerStatus garbageCollectBinaries(boolean delete) Description copied from interface:DocumentBlobManagerGarbage collect the unused binaries.- Specified by:
- garbageCollectBinariesin interface- DocumentBlobManager
- Parameters:
- delete- if- falsedon't actually delete the garbage collected binaries (but still return statistics about them), if- truedelete them
- Returns:
- a status about the number of garbage collected binaries
 
 - 
runInTransactionprotected <R> R runInTransaction(Supplier<R> supplier, int timeout) Runs the givenSupplierin a transaction with the giventimeout.- Since:
- 11.1
 
 - 
markReferencedBinarypublic void markReferencedBinary(String key, String repositoryName) Description copied from interface:DocumentBlobManagerINTERNAL. Marks a binary as referenced during garbage collection. Called back by repository implementations duringDocumentBlobManager.garbageCollectBinaries(boolean).- Specified by:
- markReferencedBinaryin interface- DocumentBlobManager
- Parameters:
- key- the binary key
- repositoryName- the repository name
 
 - 
isBinariesGarbageCollectionInProgresspublic boolean isBinariesGarbageCollectionInProgress() Description copied from interface:DocumentBlobManagerChecks if a garbage collection of the binaries in progress.- Specified by:
- isBinariesGarbageCollectionInProgressin interface- DocumentBlobManager
- Returns:
- trueif a garbage collection of the binaries is in progress
 
 
- 
 
-