Package org.nuxeo.ecm.core.storage.sql
Class S3Utils
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.S3Utils
-
public class S3Utils extends Object
AWS S3 utilities.- Since:
- 10.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
S3Utils.SliceConsumer
Represents an operation that accepts a slice number and a slice begin and end position.
-
Field Summary
Fields Modifier and Type Field Description static long
MULTIPART_COPY_PART_SIZE_DEFAULT
Deprecated.since 2021.11, useS3BlobStoreConfiguration.MULTIPART_COPY_PART_SIZE_DEFAULT
instead.static String
MULTIPART_COPY_PART_SIZE_PROPERTY
Deprecated.since 2021.11, useS3BlobStoreConfiguration.MULTIPART_COPY_PART_SIZE_PROPERTY
instead.static long
NON_MULTIPART_COPY_MAX_SIZE
The maximum size of a file that can be copied without using multipart: 5 GBstatic long
PART_SIZE
Deprecated.since 11.1, useMULTIPART_COPY_PART_SIZE_DEFAULT
instead
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static com.amazonaws.services.s3.model.ObjectMetadata
copyFile(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, boolean deleteSource)
static com.amazonaws.services.s3.model.ObjectMetadata
copyFile(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource)
Deprecated.since 11.2, useTransferManager.copy(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
insteadstatic com.amazonaws.services.s3.model.ObjectMetadata
copyFileMultipart(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, boolean deleteSource)
Deprecated.since 11.1, usecopyFileMultipart(AmazonS3, ObjectMetadata, String, String, String, String, String, boolean)
insteadstatic com.amazonaws.services.s3.model.ObjectMetadata
copyFileMultipart(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource)
Deprecated.since 11.2, useTransferManager.copy(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
insteadstatic com.amazonaws.services.s3.model.ObjectMetadata
copyFileNonMultipart(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource)
Deprecated.since 11.2, useTransferManager.copy(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
insteadstatic com.amazonaws.auth.AWSCredentialsProvider
getAWSCredentialsProvider(String accessKeyId, String secretKey, String sessionToken)
Gets the credentials providers for the given AWS key and secret.static void
processSlices(long slice, long length, S3Utils.SliceConsumer consumer)
Calls the consumer on all slices.protected static List<com.amazonaws.services.s3.model.PartETag>
responsesToETags(List<com.amazonaws.services.s3.model.CopyPartResult> responses)
-
-
-
Field Detail
-
NON_MULTIPART_COPY_MAX_SIZE
public static final long NON_MULTIPART_COPY_MAX_SIZE
The maximum size of a file that can be copied without using multipart: 5 GB- See Also:
- Constant Field Values
-
MULTIPART_COPY_PART_SIZE_DEFAULT
@Deprecated(since="2021.11") public static final long MULTIPART_COPY_PART_SIZE_DEFAULT
Deprecated.since 2021.11, useS3BlobStoreConfiguration.MULTIPART_COPY_PART_SIZE_DEFAULT
instead.The default multipart copy part size. This default is used only if the configuration service is not available or if the configuration property "nuxeo.s3.multipart.copy.part.size" is not defined.- Since:
- 11.1
- See Also:
- Constant Field Values
-
PART_SIZE
@Deprecated public static final long PART_SIZE
Deprecated.since 11.1, useMULTIPART_COPY_PART_SIZE_DEFAULT
instead- See Also:
- Constant Field Values
-
MULTIPART_COPY_PART_SIZE_PROPERTY
@Deprecated(since="2021.11") public static final String MULTIPART_COPY_PART_SIZE_PROPERTY
Deprecated.since 2021.11, useS3BlobStoreConfiguration.MULTIPART_COPY_PART_SIZE_PROPERTY
instead.The configuration property to define the multipart copy part size.- Since:
- 11.1
- See Also:
- Constant Field Values
-
-
Method Detail
-
processSlices
public static void processSlices(long slice, long length, S3Utils.SliceConsumer consumer)
Calls the consumer on all slices.- Parameters:
slice
- the slice sizelength
- the total lengthconsumer
- the slice consumer
-
copyFile
@Deprecated public static com.amazonaws.services.s3.model.ObjectMetadata copyFile(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource)
Deprecated.since 11.2, useTransferManager.copy(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
insteadCopies a file, using multipart upload if needed.- Parameters:
amazonS3
- the S3 clientobjectMetadata
- the metadata of the object being copiedsourceBucket
- the source bucketsourceKey
- the source keytargetBucket
- the target buckettargetKey
- the target keytargetSSEAlgorithm
- the target SSE Algorithm to use, ornull
deleteSource
- whether to delete the source object if the copy is successful- Since:
- 11.1
-
copyFileMultipart
@Deprecated public static com.amazonaws.services.s3.model.ObjectMetadata copyFileMultipart(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, boolean deleteSource)
Deprecated.since 11.1, usecopyFileMultipart(AmazonS3, ObjectMetadata, String, String, String, String, String, boolean)
insteadCopies a file using multipart upload.- Parameters:
amazonS3
- the S3 clientobjectMetadata
- the metadata of the object being copiedsourceBucket
- the source bucketsourceKey
- the source keytargetBucket
- the target buckettargetKey
- the target keydeleteSource
- whether to delete the source object if the copy is successful
-
copyFileMultipart
@Deprecated public static com.amazonaws.services.s3.model.ObjectMetadata copyFileMultipart(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource)
Deprecated.since 11.2, useTransferManager.copy(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
insteadCopies a file using multipart upload.- Parameters:
amazonS3
- the S3 clientobjectMetadata
- the metadata of the object being copiedsourceBucket
- the source bucketsourceKey
- the source keytargetBucket
- the target buckettargetKey
- the target keytargetSSEAlgorithm
- the target SSE Algorithm to use, ornull
deleteSource
- whether to delete the source object if the copy is successful- Since:
- 11.1
-
responsesToETags
protected static List<com.amazonaws.services.s3.model.PartETag> responsesToETags(List<com.amazonaws.services.s3.model.CopyPartResult> responses)
-
copyFile
@Deprecated public static com.amazonaws.services.s3.model.ObjectMetadata copyFile(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, boolean deleteSource)
Deprecated.Copies a file without using multipart upload.- Parameters:
amazonS3
- the S3 clientobjectMetadata
- the metadata of the object being copiedsourceBucket
- the source bucketsourceKey
- the source keytargetBucket
- the target buckettargetKey
- the target keydeleteSource
- whether to delete the source object if the copy is successful
-
copyFileNonMultipart
@Deprecated public static com.amazonaws.services.s3.model.ObjectMetadata copyFileNonMultipart(com.amazonaws.services.s3.AmazonS3 amazonS3, com.amazonaws.services.s3.model.ObjectMetadata objectMetadata, String sourceBucket, String sourceKey, String targetBucket, String targetKey, String targetSSEAlgorithm, boolean deleteSource)
Deprecated.since 11.2, useTransferManager.copy(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
insteadCopies a file without using multipart upload.- Parameters:
amazonS3
- the S3 clientobjectMetadata
- the metadata of the object being copiedsourceBucket
- the source bucketsourceKey
- the source keytargetBucket
- the target buckettargetKey
- the target keytargetSSEAlgorithm
- the target SSE Algorithm to use, ornull
deleteSource
- whether to delete the source object if the copy is successful- Since:
- 11.1
-
getAWSCredentialsProvider
public static com.amazonaws.auth.AWSCredentialsProvider getAWSCredentialsProvider(String accessKeyId, String secretKey, String sessionToken)
Gets the credentials providers for the given AWS key and secret.- Parameters:
accessKeyId
- the AWS access key idsecretKey
- the secret keysessionToken
- the session token (optional)- Since:
- 10.10
-
-