public class S3BinaryManager extends AbstractCloudBinaryManager
The BLOBs are cached locally on first access for efficiency.
Because the BLOB length can be accessed independently of the binary stream, it is also cached in a simple text file if accessed before the stream.
| Modifier and Type | Class and Description |
|---|---|
static class |
S3BinaryManager.S3BinaryGarbageCollector
Garbage collector for S3 binaries that stores the marked (in use) binaries in memory.
|
class |
S3BinaryManager.S3FileStorage |
CACHE_COUNT_PROPERTY, CACHE_MIN_AGE_PROPERTY, CACHE_SIZE_PROPERTY, DEFAULT_CACHE_COUNT, DEFAULT_CACHE_MIN_AGE, DEFAULT_CACHE_SIZE, DEFAULT_DIRECTDOWNLOAD, DEFAULT_DIRECTDOWNLOAD_EXPIRE, directDownload, DIRECTDOWNLOAD_EXPIRE_PROPERTY, DIRECTDOWNLOAD_PROPERTY, directDownloadExpire, namespace, properties, transientFlagcachedir, fileCache, fileStorageblobProviderId, 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_LENGTHPROP_KEY, PROP_PATH| Constructor and Description |
|---|
S3BinaryManager() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
abortOldUploads()
Aborts uploads that crashed and are older than 1 day.
|
boolean |
canAccessBucket()
Used in the healthCheck; the transferManager should be initialized and the bucket accessible
|
void |
close()
Closes the binary manager and releases all resources and temporary objects held by it.
|
protected String |
copyBlob(S3BinaryManager sourceBlobProvider,
String blobKey)
Copies a blob.
|
com.amazonaws.services.s3.AmazonS3 |
getAmazonS3()
Gets AmazonS3.
|
com.amazonaws.auth.AWSCredentialsProvider |
getAwsCredentialsProvider()
Gets the AWSCredentialsProvider.
|
protected String |
getDefaultDigestAlgorithm()
Gets the default message digest to use to hash binaries.
|
protected FileStorage |
getFileStorage() |
protected URI |
getRemoteUri(String digest,
ManagedBlob blob,
javax.servlet.http.HttpServletRequest servletRequest) |
protected String |
getSystemPropertyPrefix()
Gets the prefix used for configuration using system properties.
|
protected BinaryGarbageCollector |
instantiateGarbageCollector() |
static boolean |
isMD5(String digest) |
protected static boolean |
isMissingKey(com.amazonaws.AmazonClientException e) |
void |
removeBinaries(Collection<String> digests)
Remove definitively a set of binaries
|
protected void |
removeBinary(String digest) |
protected void |
setupCloudClient()
Configure Cloud client using properties
|
String |
writeBlob(Blob blob)
Writes a
Blob to storage and returns information about it. |
getBinaryManager, getBooleanProperty, getContentDispositionHeader, getContentTypeHeader, getIntProperty, getProperties, getProperty, getProperty, getSystemPropertyName, getURI, initialize, isDirectDownload, isTransient, performsExternalAccessControl, readBlob, supportsUserUpdate, supportsUserUpdateDefaultTruegetBinary, getBinary, getFile, initializeCache, initializeCache, initializeCachegetBinary, getDescriptor, getDigestAlgorithm, getGarbageCollector, storeAndDigest, toHexStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcanConvert, getAppLinks, getAvailableConversions, getStream, getThumbnail, hasCreateFromKeyPermission, isVersionpublic static final String SYSTEM_PROPERTY_PREFIX
public static final String BUCKET_NAME_PROPERTY
public static final String BUCKET_PREFIX_PROPERTY
public static final String BUCKET_REGION_PROPERTY
public static final String AWS_ID_PROPERTY
public static final String AWS_SECRET_PROPERTY
public static final String AWS_SESSION_TOKEN_PROPERTY
public static final String CONNECTION_MAX_PROPERTY
public static final String CONNECTION_RETRY_PROPERTY
public static final String CONNECTION_TIMEOUT_PROPERTY
public static final String SOCKET_TIMEOUT_PROPERTY
public static final String KEYSTORE_FILE_PROPERTY
public static final String KEYSTORE_PASS_PROPERTY
public static final String SERVERSIDE_ENCRYPTION_PROPERTY
public static final String SERVERSIDE_ENCRYPTION_KMS_KEY_PROPERTY
public static final String PRIVKEY_ALIAS_PROPERTY
public static final String PRIVKEY_PASS_PROPERTY
public static final String ENDPOINT_PROPERTY
public static final String PATHSTYLEACCESS_PROPERTY
public static final String DIRECTDOWNLOAD_PROPERTY_COMPAT
public static final String DIRECTDOWNLOAD_EXPIRE_PROPERTY_COMPAT
public static final String DELIMITER
protected String bucketName
protected String bucketNamePrefix
protected com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider
protected com.amazonaws.ClientConfiguration clientConfiguration
protected com.amazonaws.services.s3.model.EncryptionMaterials encryptionMaterials
protected boolean isEncrypted
protected com.amazonaws.services.s3.model.CryptoConfiguration cryptoConfiguration
protected boolean useServerSideEncryption
protected String serverSideKMSKeyID
protected com.amazonaws.services.s3.AmazonS3 amazonS3
protected com.amazonaws.services.s3.transfer.TransferManager transferManager
public S3BinaryManager()
protected String getDefaultDigestAlgorithm()
AbstractBinaryManagergetDefaultDigestAlgorithm in class AbstractBinaryManagerpublic void close()
BinaryManagerclose in interface BinaryManagerclose in interface BlobProviderclose in class CachingBinaryManagerprotected void abortOldUploads() throws IOException
IOExceptionprotected void setupCloudClient() throws IOException
AbstractCloudBinaryManagersetupCloudClient in class AbstractCloudBinaryManagerIOExceptionprotected void removeBinary(String digest)
protected String getSystemPropertyPrefix()
AbstractCloudBinaryManagergetSystemPropertyPrefix in class AbstractCloudBinaryManagerprotected BinaryGarbageCollector instantiateGarbageCollector()
instantiateGarbageCollector in class AbstractCloudBinaryManagerpublic void removeBinaries(Collection<String> digests)
BinaryManagerremoveBinaries in interface BinaryManagerremoveBinaries in class AbstractCloudBinaryManagerdigests - a set of digests, must not be null.protected static boolean isMissingKey(com.amazonaws.AmazonClientException e)
public boolean canAccessBucket()
protected FileStorage getFileStorage()
getFileStorage in class AbstractCloudBinaryManagerpublic com.amazonaws.auth.AWSCredentialsProvider getAwsCredentialsProvider()
public com.amazonaws.services.s3.AmazonS3 getAmazonS3()
public String writeBlob(Blob blob) throws IOException
BlobProviderBlob to storage and returns information about it.
Called to store a user-created blob.
writeBlob in interface BlobProviderwriteBlob in class AbstractCloudBinaryManagerblob - the blobIOExceptionprotected String copyBlob(S3BinaryManager sourceBlobProvider, String blobKey) throws IOException
null if the copy was not possible.sourceBlobProvider - the source blob providerblobKey - the source blob keynull if the copy was not possibleIOExceptionprotected URI getRemoteUri(String digest, ManagedBlob blob, javax.servlet.http.HttpServletRequest servletRequest) throws IOException
getRemoteUri in class AbstractCloudBinaryManagerIOExceptionCopyright © 2019 Nuxeo. All rights reserved.