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 Summary
Fields 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.CachingBinaryManager
cachedir, fileCache, fileStorage
-
Fields inherited from class org.nuxeo.ecm.core.blob.binary.AbstractBinaryManager
blobProviderId, 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.BinaryManager
PROP_KEY, PROP_PATH
-
-
Constructor Summary
Constructors Constructor Description AbstractCloudBinaryManager()
-
Method Summary
All 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.CachingBinaryManager
close, getBinary, getBinary, getFile, initializeCache, initializeCache, initializeCache
-
Methods inherited from class org.nuxeo.ecm.core.blob.binary.AbstractBinaryManager
computeDigestPattern, getBinary, getDescriptor, getDigestAlgorithm, getGarbageCollector, isValidDigest, setDescriptor, storeAndDigest, toHexString
-
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, canConvert, close, deleteBlob, getAppLinks, getAvailableConversions, getBinaryGarbageCollector, getFile, getStatus, getStream, getStream, getThumbnail, hasCreateFromKeyPermission, isRecordMode, isTransactional, isVersion, readBlob, supportsSync, updateBlob, writeBlob
-
-
-
-
Field Detail
-
directDownload
protected boolean directDownload
-
directDownloadExpire
protected int directDownloadExpire
-
transientFlag
protected boolean transientFlag
-
CACHE_SIZE_PROPERTY
public static final String CACHE_SIZE_PROPERTY
- See Also:
- Constant Field Values
-
CACHE_COUNT_PROPERTY
public static final String CACHE_COUNT_PROPERTY
- See Also:
- Constant Field Values
-
CACHE_MIN_AGE_PROPERTY
public static final String CACHE_MIN_AGE_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_SIZE
public static final String DEFAULT_CACHE_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_COUNT
public static final String DEFAULT_CACHE_COUNT
- See Also:
- Constant Field Values
-
DEFAULT_CACHE_MIN_AGE
public static final String DEFAULT_CACHE_MIN_AGE
- See Also:
- Constant Field Values
-
DIRECTDOWNLOAD_PROPERTY
public static final String DIRECTDOWNLOAD_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_DIRECTDOWNLOAD
public static final String DEFAULT_DIRECTDOWNLOAD
- See Also:
- Constant Field Values
-
DIRECTDOWNLOAD_EXPIRE_PROPERTY
public static final String DIRECTDOWNLOAD_EXPIRE_PROPERTY
- See Also:
- Constant Field Values
-
DEFAULT_DIRECTDOWNLOAD_EXPIRE
public static final int DEFAULT_DIRECTDOWNLOAD_EXPIRE
- See Also:
- Constant Field Values
-
DIGEST_ALGORITHM_PROPERTY
public static final String DIGEST_ALGORITHM_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractCloudBinaryManager
public AbstractCloudBinaryManager()
-
-
Method Detail
-
getSystemPropertyPrefix
protected abstract String getSystemPropertyPrefix()
Gets the prefix used for configuration using system properties.
-
getFileStorage
protected abstract FileStorage getFileStorage()
-
instantiateGarbageCollector
protected abstract BinaryGarbageCollector instantiateGarbageCollector()
-
removeBinaries
public abstract void removeBinaries(Collection<String> digests)
Description copied from interface:BinaryManagerRemove definitively a set of binaries- Specified by:
removeBinariesin interfaceBinaryManager- Overrides:
removeBinariesin classAbstractBinaryManager- Parameters:
digests- a set of digests, must not benull.
-
setupCloudClient
protected abstract void setupCloudClient() throws IOException
Configure Cloud client using properties- Throws:
IOException
-
initialize
public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
Description copied from interface:BinaryManagerInitializes the binary manager.- Specified by:
initializein interfaceBinaryManager- Specified by:
initializein interfaceBlobProvider- Overrides:
initializein classCachingBinaryManager- Parameters:
blobProviderId- the blob provider id for this binary managerproperties- initialization properties- Throws:
IOException
-
getBinaryManager
public BinaryManager getBinaryManager()
Description copied from interface:BlobProviderGets the associated binary manager, if any.- Specified by:
getBinaryManagerin interfaceBlobProvider- Returns:
- the binary manager, or
null
-
readBlob
public Blob readBlob(BlobInfo blobInfo) throws IOException
Description copied from interface:BlobProviderReads aBlobfrom storage.- Specified by:
readBlobin interfaceBlobProvider- Parameters:
blobInfo- the blob information- Returns:
- the blob
- Throws:
IOException
-
writeBlob
public 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 interfaceBlobProvider- Parameters:
blob- the blob- Returns:
- the blob key
- Throws:
IOException
-
performsExternalAccessControl
public boolean performsExternalAccessControl(BlobInfo blobInfo)
Description copied from interface:BlobProviderChecks if the blob provider performs external access control checks.- Specified by:
performsExternalAccessControlin interfaceBlobProvider- Parameters:
blobInfo- the blob information to be read- Returns:
trueif the provider performs security checks before reading a blob,falseotherwise
-
supportsUserUpdate
public 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 interfaceBlobProvider- Returns:
trueif user update is supported
-
supportsUserUpdateDefaultTrue
protected boolean supportsUserUpdateDefaultTrue()
-
getURI
public 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 interfaceBlobProvider- Parameters:
blob- the managed blobhint-BlobManager.UsageHintservletRequest- the servlet request, ornull- Returns:
- the
URI, ornullif none available - Throws:
IOException
-
isDirectDownload
protected boolean isDirectDownload()
-
getRemoteUri
protected URI getRemoteUri(String digest, ManagedBlob blob, javax.servlet.http.HttpServletRequest servletRequest) throws IOException
- Throws:
IOException
-
getProperty
protected String getProperty(String propertyName)
-
getProperty
protected String getProperty(String propertyName, String defaultValue)
-
getIntProperty
protected int getIntProperty(String key)
Gets an integer property, or -1 if undefined.
-
getIntProperty
protected int getIntProperty(String key, int defaultValue)
Gets an integer property, ordefaultValueif undefined.- Since:
- 11.4
-
getBooleanProperty
protected boolean getBooleanProperty(String key)
Gets a boolean property.- Since:
- 10.3
-
getSystemPropertyName
public String getSystemPropertyName(String propertyName)
-
getContentTypeHeader
protected String getContentTypeHeader(Blob blob)
-
getContentDispositionHeader
protected String getContentDispositionHeader(Blob blob, javax.servlet.http.HttpServletRequest servletRequest)
-
getDefaultDigestAlgorithm
protected String getDefaultDigestAlgorithm()
Description copied from class:AbstractBinaryManagerGets the default message digest to use to hash binaries.- Overrides:
getDefaultDigestAlgorithmin classAbstractBinaryManager
-
isTransient
public 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 interfaceBlobProvider
-
getProperties
public Map<String,String> getProperties()
Description copied from interface:BlobProviderReturns the properties of the blob provider.- Specified by:
getPropertiesin interfaceBlobProvider
-
-