public abstract class AbstractCloudBinaryManager extends CachingBinaryManager implements BlobProvider
Modifier and Type | Field and Description |
---|---|
static String |
CACHE_PROPERTY |
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, LEN_DIGEST_SUFFIX
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 |
---|---|
String |
getConfigurationKey(String propertyName) |
protected String |
getContentDispositionHeader(Blob blob,
javax.servlet.http.HttpServletRequest servletRequest) |
protected String |
getContentTypeHeader(Blob blob) |
protected abstract FileStorage |
getFileStorage() |
protected static int |
getIntFrameworkProperty(String key)
Gets an integer framework property, or -1 if undefined.
|
protected String |
getProperty(String propertyName) |
protected String |
getProperty(String propertyName,
String defaultValue) |
protected abstract String |
getPropertyPrefix()
Gets the property prefix used in configurarion properties
|
protected URI |
getRemoteUri(String digest,
ManagedBlob blob,
javax.servlet.http.HttpServletRequest servletRequest) |
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() |
Blob |
readBlob(BlobManager.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,
Document doc)
Writes a
Blob to storage and returns information about it. |
close, getBinary, getBinary, getFile, getLength, getLengthFromCache, initializeCache, initializeCache, putLengthInCache
getBinary, getDefaultDigestAlgorithm, getDescriptor, getDigestAlgorithm, getGarbageCollector, storeAndDigest, toHexString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, freezeVersion, getAppLinks, getAvailableConversions, getBinaryManager, getConvertedStream, getStream, getThumbnail, isVersion
protected Map<String,String> properties
protected boolean directDownload
protected int directDownloadExpire
public static final String CACHE_PROPERTY
public static final String DEFAULT_CACHE_SIZE
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 getPropertyPrefix()
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 Blob readBlob(BlobManager.BlobInfo blobInfo) throws IOException
BlobProvider
Blob
from storage.readBlob
in interface BlobProvider
blobInfo
- the blob informationIOException
public String writeBlob(Blob blob, Document doc) throws IOException
BlobProvider
Blob
to storage and returns information about it.
Called to store a user-created blob.
writeBlob
in interface BlobProvider
blob
- the blobdoc
- the document to which this blob belongsIOException
public 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 static int getIntFrameworkProperty(String key)
public String getConfigurationKey(String propertyName)
protected String getContentTypeHeader(Blob blob)
protected String getContentDispositionHeader(Blob blob, javax.servlet.http.HttpServletRequest servletRequest)
Copyright © 2015 Nuxeo SA. All rights reserved.