Example usage for com.amazonaws.services.s3.model S3ObjectId getVersionId

List of usage examples for com.amazonaws.services.s3.model S3ObjectId getVersionId

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model S3ObjectId getVersionId.

Prototype

public String getVersionId() 

Source Link

Document

Returns the version id which is optionally applicable for S3 get (but not put) operations.

Usage

From source file:org.mule.module.s3.simpleapi.SimpleAmazonS3AmazonDevKitImpl.java

License:Open Source License

public void deleteObject(@NotNull S3ObjectId objectId) {
    Validate.notNull(objectId);//from   w  w w .  j  a va  2s . c o m
    if (objectId.isVersioned()) {
        s3.deleteVersion(objectId.getBucketName(), objectId.getKey(), objectId.getVersionId());
    } else {
        s3.deleteObject(objectId.getBucketName(), objectId.getKey());
    }
}

From source file:org.mule.module.s3.simpleapi.SimpleAmazonS3AmazonDevKitImpl.java

License:Open Source License

public String copyObject(@NotNull S3ObjectId source, @NotNull S3ObjectId destination,
        @NotNull ConditionalConstraints conditionalConstraints, CannedAccessControlList acl,
        StorageClass storageClass, Map<String, String> userMetadata, String encryption) {
    Validate.notNull(source);/*from   w  w  w .  j  av  a  2s  .  co  m*/
    Validate.notNull(destination);
    Validate.notNull(conditionalConstraints);
    CopyObjectRequest request = new CopyObjectRequest(source.getBucketName(), source.getKey(),
            source.getVersionId(), destination.getBucketName(), destination.getKey());
    request.setCannedAccessControlList(acl);
    if (storageClass != null) {
        request.setStorageClass(storageClass);
    }

    if (encryption != null) {
        request.setNewObjectMetadata(new ObjectMetadata());
        request.getNewObjectMetadata().setServerSideEncryption(encryption);
        if (userMetadata != null) {
            request.getNewObjectMetadata().setUserMetadata(userMetadata);
        }
    } else if (userMetadata != null) {
        request.setNewObjectMetadata(new ObjectMetadata());
        request.getNewObjectMetadata().setUserMetadata(userMetadata);
    }

    conditionalConstraints.populate(request);
    return s3.copyObject(request).getVersionId();
}

From source file:org.mule.module.s3.simpleapi.SimpleAmazonS3AmazonDevKitImpl.java

License:Open Source License

@NotNull
public ObjectMetadata getObjectMetadata(@NotNull S3ObjectId objectId) {
    Validate.notNull(objectId);/*from www .j  av a  2  s .  co m*/
    return s3.getObjectMetadata(
            new GetObjectMetadataRequest(objectId.getBucketName(), objectId.getKey(), objectId.getVersionId()));
}

From source file:org.mule.module.s3.simpleapi.SimpleAmazonS3AmazonDevKitImpl.java

License:Open Source License

public S3Object getObject(@NotNull S3ObjectId objectId,
        @NotNull ConditionalConstraints conditionalConstraints) {
    Validate.notNull(objectId);/*from w  w  w . j  a v a  2 s .  c o m*/
    GetObjectRequest request = new GetObjectRequest(objectId.getBucketName(), objectId.getKey(),
            objectId.getVersionId());
    conditionalConstraints.populate(request);
    return s3.getObject(request);
}