Package org.nuxeo.ecm.core.blob
Interface DocumentBlobManager
-
- All Known Implementing Classes:
DocumentBlobManagerComponent
public interface DocumentBlobManager
- Since:
- 9.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
checkCanDeleteBlob(String repositoryName)
Checks that blobs can be safely deleted for the given repository.boolean
deleteBlob(String repositoryName, String key, boolean dryRun)
Deletes the blob associated to the given key.void
freezeVersion(Document doc)
Freezes the blobs' versions on a document version when it is created via a check in.BinaryManagerStatus
garbageCollectBinaries(boolean delete)
Deprecated.since 2023, this FullGC implementation does not scale on large repositories, useGarbageCollectOrphanBlobsAction
insteadInputStream
getConvertedStream(Blob blob, String mimeType, DocumentModel doc)
Gets anInputStream
for a conversion to the given MIME type.default Collection<String>
getProviderIds(String repository)
Gets the list of the provider ids that are used by the given repository.boolean
hasSharedStorage()
Compute if there are shared storage.boolean
isBinariesGarbageCollectionInProgress()
Checks if a garbage collection of the binaries in progress.default boolean
isUseRepositoryName()
Are the blobs from a repository stored in a provider with the same name.void
notifyAfterCopy(Document doc)
Notifies the blob manager that the document has been copied.void
notifyBeforeRemove(Document doc)
Notifies the blob manager that the document is about to be removed.void
notifyChanges(Document doc, Set<String> xpaths)
Notifies the blob manager that a set of xpaths have changed on a document.void
notifyMakeRecord(Document doc)
Notifies the blob manager that the document was made a record.void
notifySetLegalHold(Document doc, boolean hold)
Notifies the blob manager that the document's legal hold status was changed.void
notifySetRetainUntil(Document doc, Calendar retainUntil)
Notifies the blob manager that the document's retention date was changed.Blob
readBlob(BlobInfo blobInfo, String repositoryName)
Deprecated.since 11.1, usereadBlob(BlobInfo, Document, String)
insteadBlob
readBlob(BlobInfo blobInfo, Document doc, String xpath)
Reads aBlob
from storage.String
writeBlob(Blob blob, Document doc, String xpath)
Writes aBlob
to storage and returns its key.
-
-
-
Method Detail
-
checkCanDeleteBlob
void checkCanDeleteBlob(String repositoryName)
Checks that blobs can be safely deleted for the given repository. If the call returns without throwing an Exception, blobs can be safely deleted callingdeleteBlob(String, String, boolean)
.- Parameters:
repositoryName
- the repositoryName- Throws:
UnsupportedOperationException
- if the repository does not have theRepository.CAPABILITY_QUERY_BLOB_KEYS
capability or there is a shared storage detected (by bad blob provider configurations)- Since:
- 2023
-
deleteBlob
boolean deleteBlob(String repositoryName, String key, boolean dryRun) throws IOException
Deletes the blob associated to the given key. The method checks that the blob key is not referenced by any document of the given repository.The repositories must have the
Repository.CAPABILITY_QUERY_BLOB_KEYS
capability (i.e. ecm:blobKeys populated).- Parameters:
repositoryName
- the repository where the blob key comes fromkey
- the blob keydryRun
- if false, effectively deletes the blob, dry run otherwise- Returns:
- true if the blob has been deleted, false if the blob is referenced and cannot be deleted
- Throws:
IOException
- when reading/deleting the blob from the underlying blob providerUnsupportedOperationException
- if the repository does not have theRepository.CAPABILITY_QUERY_BLOB_KEYS
capability or there is a shared storage detected (by bad blob provider configurations)- Since:
- 2023
-
hasSharedStorage
boolean hasSharedStorage()
Compute if there are shared storage.- Returns:
- true if at least 2 providers points to the same store, false otherwise
- Since:
- 2023
-
readBlob
Blob readBlob(BlobInfo blobInfo, Document doc, String xpath) throws IOException
Reads aBlob
from storage.- Parameters:
blobInfo
- the blob informationdoc
- the document to which this blob belongsxpath
- the xpath of the blob in the document- Returns:
- a managed blob
- Throws:
IOException
- Since:
- 11.1
-
readBlob
@Deprecated Blob readBlob(BlobInfo blobInfo, String repositoryName) throws IOException
Deprecated.since 11.1, usereadBlob(BlobInfo, Document, String)
insteadReads aBlob
from storage.- Parameters:
blobInfo
- the blob informationrepositoryName
- the repository to which this blob belongs- Returns:
- a managed blob
- Throws:
IOException
- Since:
- 7.2
-
writeBlob
String writeBlob(Blob blob, Document doc, String xpath) throws IOException
Writes aBlob
to storage and returns its key.The passed blob may be
null
, in which case anull
key is returned after checking that deleting this blob is allowed.- Parameters:
blob
- the blobdoc
- the document to which this blob belongsxpath
- the xpath of blob in doc- Returns:
- the blob key
- Throws:
IOException
- Since:
- 9.1
-
getConvertedStream
InputStream getConvertedStream(Blob blob, String mimeType, DocumentModel doc) throws IOException
Gets anInputStream
for a conversion to the given MIME type.Like all
InputStream
, the result must be closed when done with it to avoid resource leaks.- Parameters:
blob
- the blobmimeType
- the MIME type to convert todoc
- the document that holds the blob- Returns:
- the stream, or
null
if no conversion is available for the given MIME type - Throws:
IOException
- Since:
- 7.2
-
freezeVersion
void freezeVersion(Document doc)
Freezes the blobs' versions on a document version when it is created via a check in.- Parameters:
doc
- the new document version- Since:
- 7.3
-
notifyChanges
void notifyChanges(Document doc, Set<String> xpaths)
Notifies the blob manager that a set of xpaths have changed on a document.- Parameters:
doc
- the documentxpaths
- the set of changed xpaths- Since:
- 7.3
-
notifyMakeRecord
void notifyMakeRecord(Document doc)
Notifies the blob manager that the document was made a record.- Parameters:
doc
- the document- Since:
- 11.1
-
notifyAfterCopy
void notifyAfterCopy(Document doc)
Notifies the blob manager that the document has been copied.- Parameters:
doc
- the new document, the result of the copy- Since:
- 11.1
-
notifyBeforeRemove
void notifyBeforeRemove(Document doc)
Notifies the blob manager that the document is about to be removed.- Parameters:
doc
- the document- Since:
- 11.1
-
notifySetRetainUntil
void notifySetRetainUntil(Document doc, Calendar retainUntil)
Notifies the blob manager that the document's retention date was changed.- Parameters:
doc
- the document- Since:
- 11.1
-
notifySetLegalHold
void notifySetLegalHold(Document doc, boolean hold)
Notifies the blob manager that the document's legal hold status was changed.- Parameters:
doc
- the document- Since:
- 11.1
-
garbageCollectBinaries
@Deprecated BinaryManagerStatus garbageCollectBinaries(boolean delete)
Deprecated.since 2023, this FullGC implementation does not scale on large repositories, useGarbageCollectOrphanBlobsAction
insteadGarbage collect the unused binaries.- Parameters:
delete
- iffalse
don't actually delete the garbage collected binaries (but still return statistics about them), iftrue
delete them- Returns:
- a status about the number of garbage collected binaries
- Since:
- 7.4
-
isBinariesGarbageCollectionInProgress
boolean isBinariesGarbageCollectionInProgress()
Checks if a garbage collection of the binaries in progress.- Returns:
true
if a garbage collection of the binaries is in progress- Since:
- 7.4
-
isUseRepositoryName
default boolean isUseRepositoryName()
Are the blobs from a repository stored in a provider with the same name.- Returns:
- true if the blobs are dispatched to the provider with the same name than the repository
- Since:
- 2023
-
getProviderIds
default Collection<String> getProviderIds(String repository)
Gets the list of the provider ids that are used by the given repository.- Parameters:
repository
- the repository name- Returns:
- the list of provider ids where blob can be dispatched for the given repository
- Since:
- 2023
-
-