Package org.nuxeo.ecm.blob
Class AbstractCloudBinaryManager
- java.lang.Object
- 
- org.nuxeo.ecm.core.blob.binary.AbstractBinaryManager
- 
- org.nuxeo.ecm.core.blob.binary.CachingBinaryManager
- 
- org.nuxeo.ecm.blob.AbstractCloudBinaryManager
 
 
 
- 
- All Implemented Interfaces:
- BinaryManager,- BlobProvider
 - Direct Known Subclasses:
- AzureBinaryManager,- GoogleStorageBinaryManager,- S3BinaryManager
 
 public abstract class AbstractCloudBinaryManager extends CachingBinaryManager implements BlobProvider - Since:
- 7.10
- Author:
- Arnaud Kervern
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringCACHE_COUNT_PROPERTYstatic StringCACHE_MIN_AGE_PROPERTYstatic StringCACHE_SIZE_PROPERTYstatic StringDEFAULT_CACHE_COUNTstatic StringDEFAULT_CACHE_MIN_AGEstatic StringDEFAULT_CACHE_SIZEstatic StringDEFAULT_DIRECTDOWNLOADstatic intDEFAULT_DIRECTDOWNLOAD_EXPIREstatic StringDIGEST_ALGORITHM_PROPERTYprotected booleandirectDownloadstatic StringDIRECTDOWNLOAD_EXPIRE_PROPERTYstatic StringDIRECTDOWNLOAD_PROPERTYprotected intdirectDownloadExpireprotected Stringnamespaceprotected booleantransientFlag- 
Fields inherited from class org.nuxeo.ecm.core.blob.binary.CachingBinaryManagercachedir, fileCache, fileStorage
 - 
Fields inherited from class org.nuxeo.ecm.core.blob.binary.AbstractBinaryManagerblobProviderId, DEFAULT_DEPTH, DEFAULT_DIGEST, descriptor, digestPattern, DIGESTS_BY_LENGTH, garbageCollector, MAX_BUF_SIZE, MD5_DIGEST, MD5_DIGEST_LENGTH, MIN_BUF_SIZE, properties, SHA1_DIGEST, SHA1_DIGEST_LENGTH, SHA256_DIGEST, SHA256_DIGEST_LENGTH
 - 
Fields inherited from interface org.nuxeo.ecm.core.blob.binary.BinaryManagerPROP_KEY, PROP_PATH
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractCloudBinaryManager()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BinaryManagergetBinaryManager()Gets the associated binary manager, if any.protected booleangetBooleanProperty(String key)Gets a boolean property.protected StringgetContentDispositionHeader(Blob blob, javax.servlet.http.HttpServletRequest servletRequest)protected StringgetContentTypeHeader(Blob blob)protected StringgetDefaultDigestAlgorithm()Gets the default message digest to use to hash binaries.protected abstract FileStoragegetFileStorage()protected intgetIntProperty(String key)Gets an integer property, or -1 if undefined.protected intgetIntProperty(String key, int defaultValue)Gets an integer property, ordefaultValueif undefined.Map<String,String>getProperties()Returns the properties of the blob provider.protected StringgetProperty(String propertyName)protected StringgetProperty(String propertyName, String defaultValue)protected URIgetRemoteUri(String digest, ManagedBlob blob, javax.servlet.http.HttpServletRequest servletRequest)StringgetSystemPropertyName(String propertyName)protected abstract StringgetSystemPropertyPrefix()Gets the prefix used for configuration using system properties.URIgetURI(ManagedBlob blob, BlobManager.UsageHint hint, javax.servlet.http.HttpServletRequest servletRequest)Gets anURIfor the content of a managed blob.voidinitialize(String blobProviderId, Map<String,String> properties)Initializes the binary manager.protected abstract BinaryGarbageCollectorinstantiateGarbageCollector()protected booleanisDirectDownload()booleanisTransient()Checks whether this blob provider is transient: blobs may disappear after a while, so a caller should not rely on them being available forever.booleanperformsExternalAccessControl(BlobInfo blobInfo)Checks if the blob provider performs external access control checks.BlobreadBlob(BlobInfo blobInfo)Reads aBlobfrom storage.abstract voidremoveBinaries(Collection<String> digests)Remove definitively a set of binariesprotected abstract voidsetupCloudClient()Configure Cloud client using propertiesbooleansupportsUserUpdate()Checks if user update is supported.protected booleansupportsUserUpdateDefaultTrue()StringwriteBlob(Blob blob)Writes aBlobto storage and returns information about it.- 
Methods inherited from class org.nuxeo.ecm.core.blob.binary.CachingBinaryManagerclose, getBinary, getBinary, getFile, initializeCache, initializeCache, initializeCache
 - 
Methods inherited from class org.nuxeo.ecm.core.blob.binary.AbstractBinaryManagercomputeDigestPattern, getBinary, getDescriptor, getDigestAlgorithm, getGarbageCollector, isValidDigest, setDescriptor, storeAndDigest, toHexString
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.nuxeo.ecm.core.blob.BlobProviderallowByteRange, canConvert, close, deleteBlob, getAppLinks, getAvailableConversions, getBinaryGarbageCollector, getFile, getStatus, getStream, getStream, getThumbnail, hasCreateFromKeyPermission, isRecordMode, isTransactional, isVersion, readBlob, supportsSync, updateBlob, writeBlob
 
- 
 
- 
- 
- 
Field Detail- 
directDownloadprotected boolean directDownload 
 - 
directDownloadExpireprotected int directDownloadExpire 
 - 
transientFlagprotected boolean transientFlag 
 - 
CACHE_SIZE_PROPERTYpublic static final String CACHE_SIZE_PROPERTY - See Also:
- Constant Field Values
 
 - 
CACHE_COUNT_PROPERTYpublic static final String CACHE_COUNT_PROPERTY - See Also:
- Constant Field Values
 
 - 
CACHE_MIN_AGE_PROPERTYpublic static final String CACHE_MIN_AGE_PROPERTY - See Also:
- Constant Field Values
 
 - 
DEFAULT_CACHE_SIZEpublic static final String DEFAULT_CACHE_SIZE - See Also:
- Constant Field Values
 
 - 
DEFAULT_CACHE_COUNTpublic static final String DEFAULT_CACHE_COUNT - See Also:
- Constant Field Values
 
 - 
DEFAULT_CACHE_MIN_AGEpublic static final String DEFAULT_CACHE_MIN_AGE - See Also:
- Constant Field Values
 
 - 
DIRECTDOWNLOAD_PROPERTYpublic static final String DIRECTDOWNLOAD_PROPERTY - See Also:
- Constant Field Values
 
 - 
DEFAULT_DIRECTDOWNLOADpublic static final String DEFAULT_DIRECTDOWNLOAD - See Also:
- Constant Field Values
 
 - 
DIRECTDOWNLOAD_EXPIRE_PROPERTYpublic static final String DIRECTDOWNLOAD_EXPIRE_PROPERTY - See Also:
- Constant Field Values
 
 - 
DEFAULT_DIRECTDOWNLOAD_EXPIREpublic static final int DEFAULT_DIRECTDOWNLOAD_EXPIRE - See Also:
- Constant Field Values
 
 - 
DIGEST_ALGORITHM_PROPERTYpublic static final String DIGEST_ALGORITHM_PROPERTY - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
AbstractCloudBinaryManagerpublic AbstractCloudBinaryManager() 
 
- 
 - 
Method Detail- 
getSystemPropertyPrefixprotected abstract String getSystemPropertyPrefix() Gets the prefix used for configuration using system properties.
 - 
getFileStorageprotected abstract FileStorage getFileStorage() 
 - 
instantiateGarbageCollectorprotected abstract BinaryGarbageCollector instantiateGarbageCollector() 
 - 
removeBinariespublic abstract void removeBinaries(Collection<String> digests) Description copied from interface:BinaryManagerRemove definitively a set of binaries- Specified by:
- removeBinariesin interface- BinaryManager
- Overrides:
- removeBinariesin class- AbstractBinaryManager
- Parameters:
- digests- a set of digests, must not be- null.
 
 - 
setupCloudClientprotected abstract void setupCloudClient() throws IOException Configure Cloud client using properties- Throws:
- IOException
 
 - 
initializepublic void initialize(String blobProviderId, Map<String,String> properties) throws IOException Description copied from interface:BinaryManagerInitializes the binary manager.- Specified by:
- initializein interface- BinaryManager
- Specified by:
- initializein interface- BlobProvider
- Overrides:
- initializein class- CachingBinaryManager
- Parameters:
- blobProviderId- the blob provider id for this binary manager
- properties- initialization properties
- Throws:
- IOException
 
 - 
getBinaryManagerpublic BinaryManager getBinaryManager() Description copied from interface:BlobProviderGets the associated binary manager, if any.- Specified by:
- getBinaryManagerin interface- BlobProvider
- Returns:
- the binary manager, or null
 
 - 
readBlobpublic Blob readBlob(BlobInfo blobInfo) throws IOException Description copied from interface:BlobProviderReads aBlobfrom storage.- Specified by:
- readBlobin interface- BlobProvider
- Parameters:
- blobInfo- the blob information
- Returns:
- the blob
- Throws:
- IOException
 
 - 
writeBlobpublic String writeBlob(Blob blob) throws IOException Description copied from interface:BlobProviderWrites aBlobto storage and returns information about it.Called to store a user-created blob. - Specified by:
- writeBlobin interface- BlobProvider
- Parameters:
- blob- the blob
- Returns:
- the blob key
- Throws:
- IOException
 
 - 
performsExternalAccessControlpublic boolean performsExternalAccessControl(BlobInfo blobInfo) Description copied from interface:BlobProviderChecks if the blob provider performs external access control checks.- Specified by:
- performsExternalAccessControlin interface- BlobProvider
- Parameters:
- blobInfo- the blob information to be read
- Returns:
- trueif the provider performs security checks before reading a blob,- falseotherwise
 
 - 
supportsUserUpdatepublic boolean supportsUserUpdate() Description copied from interface:BlobProviderChecks 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:
- supportsUserUpdatein interface- BlobProvider
- Returns:
- trueif user update is supported
 
 - 
supportsUserUpdateDefaultTrueprotected boolean supportsUserUpdateDefaultTrue() 
 - 
getURIpublic URI getURI(ManagedBlob blob, BlobManager.UsageHint hint, javax.servlet.http.HttpServletRequest servletRequest) throws IOException Description copied from interface:BlobProviderGets anURIfor the content of a managed blob.- Specified by:
- getURIin interface- BlobProvider
- Parameters:
- blob- the managed blob
- hint-- BlobManager.UsageHint
- servletRequest- the servlet request, or- null
- Returns:
- the URI, ornullif none available
- Throws:
- IOException
 
 - 
isDirectDownloadprotected boolean isDirectDownload() 
 - 
getRemoteUriprotected URI getRemoteUri(String digest, ManagedBlob blob, javax.servlet.http.HttpServletRequest servletRequest) throws IOException - Throws:
- IOException
 
 - 
getPropertyprotected String getProperty(String propertyName) 
 - 
getPropertyprotected String getProperty(String propertyName, String defaultValue) 
 - 
getIntPropertyprotected int getIntProperty(String key) Gets an integer property, or -1 if undefined.
 - 
getIntPropertyprotected int getIntProperty(String key, int defaultValue) Gets an integer property, ordefaultValueif undefined.- Since:
- 11.4
 
 - 
getBooleanPropertyprotected boolean getBooleanProperty(String key) Gets a boolean property.- Since:
- 10.3
 
 - 
getSystemPropertyNamepublic String getSystemPropertyName(String propertyName) 
 - 
getContentTypeHeaderprotected String getContentTypeHeader(Blob blob) 
 - 
getContentDispositionHeaderprotected String getContentDispositionHeader(Blob blob, javax.servlet.http.HttpServletRequest servletRequest) 
 - 
getDefaultDigestAlgorithmprotected String getDefaultDigestAlgorithm() Description copied from class:AbstractBinaryManagerGets the default message digest to use to hash binaries.- Overrides:
- getDefaultDigestAlgorithmin class- AbstractBinaryManager
 
 - 
isTransientpublic boolean isTransient() Description copied from interface:BlobProviderChecks 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:
- isTransientin interface- BlobProvider
 
 - 
getPropertiespublic Map<String,String> getProperties() Description copied from interface:BlobProviderReturns the properties of the blob provider.- Specified by:
- getPropertiesin interface- BlobProvider
 
 
- 
 
-