Package org.nuxeo.ecm.core.blob.binary
Class BinaryBlobProvider
- java.lang.Object
-
- org.nuxeo.ecm.core.blob.binary.BinaryBlobProvider
-
- All Implemented Interfaces:
BlobProvider
public class BinaryBlobProvider extends Object implements BlobProvider
Adapter between theBinaryManager
and aBlobProvider
for theBlobManager
.Can be used by legacy implementations of a
BinaryManager
to provide aBlobProvider
implementation.- Since:
- 7.3
-
-
Field Summary
Fields Modifier and Type Field Description protected BinaryManager
binaryManager
protected boolean
supportsUserUpdate
protected boolean
transientFlag
-
Constructor Summary
Constructors Constructor Description BinaryBlobProvider(BinaryManager binaryManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the adaptedBinaryManager
.protected void
fixupDigest(Blob blob, String digest)
Fixup of the blob's digest, if possible.BinaryManager
getBinaryManager()
Gets the associated binary manager, if any.File
getFile(ManagedBlob blob)
Gets aFile
(if one exists) for the data of a managed blob.Map<String,String>
getProperties()
Returns the properties of the blob provider.void
initialize(String blobProviderId, Map<String,String> properties)
Initializes the blob provider.boolean
isTransient()
Checks whether this blob provider is transient: blobs may disappear after a while, so a caller should not rely on them being available forever.Blob
readBlob(BlobInfo blobInfo)
Reads aBlob
from storage.protected String
stripBlobKeyPrefix(String key)
boolean
supportsUserUpdate()
Checks if user update is supported.protected boolean
supportsUserUpdateDefaultTrue(Map<String,String> properties)
String
writeBlob(Blob blob)
Writes aBlob
to storage and returns information about it.-
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.BlobProvider
allowByteRange, allowDirectDownload, canConvert, deleteBlob, getAppLinks, getAvailableConversions, getBinaryGarbageCollector, getStatus, getStream, getStream, getThumbnail, getURI, hasCreateFromKeyPermission, isColdStorageMode, isRecordMode, isTransactional, isVersion, performsExternalAccessControl, readBlob, supportsSync, updateBlob, writeBlob
-
-
-
-
Field Detail
-
binaryManager
protected final BinaryManager binaryManager
-
supportsUserUpdate
protected boolean supportsUserUpdate
-
transientFlag
protected boolean transientFlag
-
-
Constructor Detail
-
BinaryBlobProvider
public BinaryBlobProvider(BinaryManager binaryManager)
-
-
Method Detail
-
initialize
public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
Description copied from interface:BlobProvider
Initializes the blob provider.- Specified by:
initialize
in interfaceBlobProvider
- Parameters:
blobProviderId
- the blob provider id for this binary managerproperties
- initialization properties- Throws:
IOException
-
supportsUserUpdate
public boolean supportsUserUpdate()
Description copied from interface:BlobProvider
Checks if user update is supported.A user update refers to the fact that a blob from this provider may be overwritten with another blob, wherever the original blob may occur (usually in a document property).
- Specified by:
supportsUserUpdate
in interfaceBlobProvider
- Returns:
true
if user update is supported
-
supportsUserUpdateDefaultTrue
protected boolean supportsUserUpdateDefaultTrue(Map<String,String> properties)
-
isTransient
public boolean isTransient()
Description copied from interface:BlobProvider
Checks whether this blob provider is transient: blobs may disappear after a while, so a caller should not rely on them being available forever.- Specified by:
isTransient
in interfaceBlobProvider
-
close
public void close()
Closes the adaptedBinaryManager
.- Specified by:
close
in interfaceBlobProvider
-
getBinaryManager
public BinaryManager getBinaryManager()
Description copied from interface:BlobProvider
Gets the associated binary manager, if any.- Specified by:
getBinaryManager
in interfaceBlobProvider
- Returns:
- the binary manager, or
null
-
readBlob
public Blob readBlob(BlobInfo blobInfo) throws IOException
Description copied from interface:BlobProvider
Reads aBlob
from storage.- Specified by:
readBlob
in interfaceBlobProvider
- Parameters:
blobInfo
- the blob information- Returns:
- the blob
- Throws:
IOException
-
getFile
public File getFile(ManagedBlob blob)
Description copied from interface:BlobProvider
Gets aFile
(if one exists) for the data of a managed blob.- Specified by:
getFile
in interfaceBlobProvider
- Parameters:
blob
- the managed blob- Returns:
- the file, or
null
if no underlying file is available
-
writeBlob
public String writeBlob(Blob blob) throws IOException
Description copied from interface:BlobProvider
Writes aBlob
to storage and returns information about it.Called to store a user-created blob.
- Specified by:
writeBlob
in interfaceBlobProvider
- Parameters:
blob
- the blob- Returns:
- the blob key
- Throws:
IOException
-
fixupDigest
protected void fixupDigest(Blob blob, String digest)
Fixup of the blob's digest, if possible.- Parameters:
blob
- the blobdigest
- the digest- Since:
- 11.5
-
getProperties
public Map<String,String> getProperties()
Description copied from interface:BlobProvider
Returns the properties of the blob provider.- Specified by:
getProperties
in interfaceBlobProvider
-
-