Search in sources :

Example 71 with ObjectMetadata

use of com.amazonaws.services.s3.model.ObjectMetadata in project jackrabbit-oak by apache.

the class S3Backend method getMetadataRecord.

public DataRecord getMetadataRecord(String name) {
    ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    try {
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        ObjectMetadata meta = s3service.getObjectMetadata(bucket, addMetaKeyPrefix(name));
        return new S3DataRecord(s3service, bucket, name, meta.getLastModified().getTime(), meta.getContentLength(), true);
    } finally {
        if (contextClassLoader != null) {
            Thread.currentThread().setContextClassLoader(contextClassLoader);
        }
    }
}
Also used : ObjectMetadata(com.amazonaws.services.s3.model.ObjectMetadata)

Example 72 with ObjectMetadata

use of com.amazonaws.services.s3.model.ObjectMetadata in project jackrabbit-oak by apache.

the class S3RequestDecorator method decorate.

/**
     * Set encryption in {@link CopyObjectRequest}
     */
public CopyObjectRequest decorate(CopyObjectRequest request) {
    switch(getDataEncryption()) {
        case SSE_S3:
            ObjectMetadata metadata = request.getNewObjectMetadata() == null ? new ObjectMetadata() : request.getNewObjectMetadata();
            metadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
            request.setNewObjectMetadata(metadata);
            break;
        case NONE:
            break;
    }
    return request;
}
Also used : ObjectMetadata(com.amazonaws.services.s3.model.ObjectMetadata)

Aggregations

ObjectMetadata (com.amazonaws.services.s3.model.ObjectMetadata)64 PutObjectRequest (com.amazonaws.services.s3.model.PutObjectRequest)20 DataStoreException (org.apache.jackrabbit.core.data.DataStoreException)18 AmazonServiceException (com.amazonaws.AmazonServiceException)17 AmazonClientException (com.amazonaws.AmazonClientException)15 IOException (java.io.IOException)13 CopyObjectRequest (com.amazonaws.services.s3.model.CopyObjectRequest)10 Copy (com.amazonaws.services.s3.transfer.Copy)8 Upload (com.amazonaws.services.s3.transfer.Upload)8 ByteArrayInputStream (java.io.ByteArrayInputStream)8 InputStream (java.io.InputStream)8 Date (java.util.Date)6 File (java.io.File)5 AmazonS3Exception (com.amazonaws.services.s3.model.AmazonS3Exception)4 PutObjectResult (com.amazonaws.services.s3.model.PutObjectResult)4 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)3 GetObjectRequest (com.amazonaws.services.s3.model.GetObjectRequest)3 S3Object (com.amazonaws.services.s3.model.S3Object)3 InterruptedIOException (java.io.InterruptedIOException)3 ProgressEvent (com.amazonaws.event.ProgressEvent)2