public abstract class AbstractCloudBinaryManager extends CachingBinaryManager implements BlobProvider
Modifier and Type | Field and Description |
---|---|
static String |
CACHE_COUNT_PROPERTY |
static String |
CACHE_MIN_AGE_PROPERTY |
static String |
CACHE_SIZE_PROPERTY |
static String |
DEFAULT_CACHE_COUNT |
static String |
DEFAULT_CACHE_MIN_AGE |
static String |
DEFAULT_CACHE_SIZE |
static String |
DEFAULT_DIRECTDOWNLOAD |
static int |
DEFAULT_DIRECTDOWNLOAD_EXPIRE |
protected boolean |
directDownload |
static String |
DIRECTDOWNLOAD_EXPIRE_PROPERTY |
static String |
DIRECTDOWNLOAD_PROPERTY |
protected int |
directDownloadExpire |
protected Map<String,String> |
properties |
cachedir, fileCache, fileStorage
blobProviderId, DEFAULT_DEPTH, DEFAULT_DIGEST, descriptor, DIGESTS_BY_LENGTH, garbageCollector, MAX_BUF_SIZE, MD5_DIGEST, MD5_DIGEST_LENGTH, MIN_BUF_SIZE, SHA1_DIGEST, SHA1_DIGEST_LENGTH, SHA256_DIGEST, SHA256_DIGEST_LENGTH
PROP_KEY, PROP_PATH
Constructor and Description |
---|
AbstractCloudBinaryManager() |
Modifier and Type | Method and Description |
---|---|
BinaryManager |
getBinaryManager()
Gets the associated binary manager, if any.
|
protected String |
getContentDispositionHeader(Blob blob,
javax.servlet.http.HttpServletRequest servletRequest) |
protected String |
getContentTypeHeader(Blob blob) |
protected abstract FileStorage |
getFileStorage() |
protected int |
getIntProperty(String key)
Gets an integer property, or -1 if undefined.
|
protected String |
getProperty(String propertyName) |
protected String |
getProperty(String propertyName,
String defaultValue) |
protected URI |
getRemoteUri(String digest,
ManagedBlob blob,
javax.servlet.http.HttpServletRequest servletRequest) |
String |
getSystemPropertyName(String propertyName) |
protected abstract String |
getSystemPropertyPrefix()
Gets the prefix used for configuration using system properties.
|
URI |
getURI(ManagedBlob blob,
BlobManager.UsageHint hint,
javax.servlet.http.HttpServletRequest servletRequest)
Gets an
URI for the content of a managed blob. |
void |
initialize(String blobProviderId,
Map<String,String> properties)
Initializes the binary manager.
|
protected abstract BinaryGarbageCollector |
instantiateGarbageCollector() |
protected boolean |
isDirectDownload() |
boolean |
performsExternalAccessControl(BlobInfo blobInfo)
Checks if the blob provider performs external access control checks.
|
Blob |
readBlob(BlobInfo blobInfo)
Reads a
Blob from storage. |
abstract void |
removeBinaries(Collection<String> digests)
Remove definitively a set of binaries
|
protected abstract void |
setupCloudClient()
Configure Cloud client using properties
|
boolean |
supportsUserUpdate()
Checks if user update is supported.
|
protected boolean |
supportsUserUpdateDefaultTrue() |
String |
writeBlob(Blob blob)
Writes a
Blob to storage and returns information about it. |
close, getBinary, getBinary, getFile, initializeCache, initializeCache, initializeCache
getBinary, getDefaultDigestAlgorithm, getDescriptor, getDigestAlgorithm, getGarbageCollector, storeAndDigest, toHexString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, getAppLinks, getAvailableConversions, getStream, getThumbnail, isVersion
protected Map<String,String> properties
protected boolean directDownload
protected int directDownloadExpire
public static final String CACHE_SIZE_PROPERTY
public static final String CACHE_COUNT_PROPERTY
public static final String CACHE_MIN_AGE_PROPERTY
public static final String DEFAULT_CACHE_SIZE
public static final String DEFAULT_CACHE_COUNT
public static final String DEFAULT_CACHE_MIN_AGE
public static final String DIRECTDOWNLOAD_PROPERTY
public static final String DEFAULT_DIRECTDOWNLOAD
public static final String DIRECTDOWNLOAD_EXPIRE_PROPERTY
public static final int DEFAULT_DIRECTDOWNLOAD_EXPIRE
public AbstractCloudBinaryManager()
protected abstract String getSystemPropertyPrefix()
protected abstract FileStorage getFileStorage()
protected abstract BinaryGarbageCollector instantiateGarbageCollector()
public abstract void removeBinaries(Collection<String> digests)
BinaryManager
removeBinaries
in interface BinaryManager
removeBinaries
in class AbstractBinaryManager
digests
- a set of digests, must not be null
.protected abstract void setupCloudClient() throws IOException
IOException
public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
BinaryManager
initialize
in interface BinaryManager
initialize
in interface BlobProvider
initialize
in class CachingBinaryManager
blobProviderId
- the blob provider id for this binary managerproperties
- initialization propertiesIOException
public BinaryManager getBinaryManager()
BlobProvider
getBinaryManager
in interface BlobProvider
null
public Blob readBlob(BlobInfo blobInfo) throws IOException
BlobProvider
Blob
from storage.readBlob
in interface BlobProvider
blobInfo
- the blob informationIOException
public String writeBlob(Blob blob) throws IOException
BlobProvider
Blob
to storage and returns information about it.
Called to store a user-created blob.
writeBlob
in interface BlobProvider
blob
- the blobIOException
public boolean performsExternalAccessControl(BlobInfo blobInfo)
BlobProvider
performsExternalAccessControl
in interface BlobProvider
blobInfo
- the blob information to be readtrue
if the provider performs security checks before reading a blob, false
otherwisepublic boolean supportsUserUpdate()
BlobProvider
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).
supportsUserUpdate
in interface BlobProvider
true
if user update is supportedprotected boolean supportsUserUpdateDefaultTrue()
public URI getURI(ManagedBlob blob, BlobManager.UsageHint hint, javax.servlet.http.HttpServletRequest servletRequest) throws IOException
BlobProvider
URI
for the content of a managed blob.getURI
in interface BlobProvider
blob
- the managed blobhint
- BlobManager.UsageHint
servletRequest
- the servlet request, or null
URI
, or null
if none availableIOException
protected boolean isDirectDownload()
protected URI getRemoteUri(String digest, ManagedBlob blob, javax.servlet.http.HttpServletRequest servletRequest) throws IOException
IOException
protected String getProperty(String propertyName)
protected String getProperty(String propertyName, String defaultValue)
protected int getIntProperty(String key)
public String getSystemPropertyName(String propertyName)
protected String getContentTypeHeader(Blob blob)
protected String getContentDispositionHeader(Blob blob, javax.servlet.http.HttpServletRequest servletRequest)
Copyright © 2018 Nuxeo. All rights reserved.