mirror of https://github.com/apache/jclouds.git
JCLOUDS-1337: revert legacy aws-s3 storage class
This functionality was deprecated in 2.1.x and we will remove it in
2.2.x. Partially reverts 89053d9a8b
.
This commit is contained in:
parent
a540daf3d6
commit
8ec3c520ce
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.s3.blobstore;
|
package org.jclouds.aws.s3.blobstore;
|
||||||
|
|
||||||
|
import static org.jclouds.s3.domain.ObjectMetadata.StorageClass.REDUCED_REDUNDANCY;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -23,11 +25,15 @@ import javax.inject.Provider;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
import org.jclouds.aws.domain.Region;
|
||||||
import org.jclouds.aws.s3.AWSS3Client;
|
import org.jclouds.aws.s3.AWSS3Client;
|
||||||
|
import org.jclouds.aws.s3.blobstore.options.AWSS3PutObjectOptions;
|
||||||
|
import org.jclouds.aws.s3.blobstore.options.AWSS3PutOptions;
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.blobstore.domain.PageSet;
|
import org.jclouds.blobstore.domain.PageSet;
|
||||||
import org.jclouds.blobstore.domain.StorageMetadata;
|
import org.jclouds.blobstore.domain.StorageMetadata;
|
||||||
import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
|
import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
|
||||||
import org.jclouds.blobstore.options.CreateContainerOptions;
|
import org.jclouds.blobstore.options.CreateContainerOptions;
|
||||||
|
import org.jclouds.blobstore.options.PutOptions;
|
||||||
import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
|
import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
|
||||||
import org.jclouds.blobstore.util.BlobUtils;
|
import org.jclouds.blobstore.util.BlobUtils;
|
||||||
import org.jclouds.collect.Memoized;
|
import org.jclouds.collect.Memoized;
|
||||||
|
@ -41,6 +47,7 @@ import org.jclouds.s3.blobstore.functions.ContainerToBucketListOptions;
|
||||||
import org.jclouds.s3.blobstore.functions.ObjectToBlob;
|
import org.jclouds.s3.blobstore.functions.ObjectToBlob;
|
||||||
import org.jclouds.s3.blobstore.functions.ObjectToBlobMetadata;
|
import org.jclouds.s3.blobstore.functions.ObjectToBlobMetadata;
|
||||||
import org.jclouds.s3.domain.BucketMetadata;
|
import org.jclouds.s3.domain.BucketMetadata;
|
||||||
|
import org.jclouds.s3.domain.ObjectMetadata;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -66,6 +73,25 @@ public class AWSS3BlobStore extends S3BlobStore {
|
||||||
this.blob2Object = blob2Object;
|
this.blob2Object = blob2Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String putBlob(String container, Blob blob, PutOptions options) {
|
||||||
|
if (options.isMultipart()) {
|
||||||
|
return putMultipartBlob(container, blob, options);
|
||||||
|
} else if ((options instanceof AWSS3PutOptions) &&
|
||||||
|
(((AWSS3PutOptions) options).getStorageClass() == REDUCED_REDUNDANCY)) {
|
||||||
|
return putBlobWithReducedRedundancy(container, blob);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return super.putBlob(container, blob, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String putBlobWithReducedRedundancy(String container, Blob blob) {
|
||||||
|
AWSS3PutObjectOptions options = new AWSS3PutObjectOptions();
|
||||||
|
options.storageClass(ObjectMetadata.StorageClass.REDUCED_REDUNDANCY);
|
||||||
|
return getContext().unwrapApi(AWSS3Client.class).putObject(container, blob2Object.apply(blob), options);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createContainerInLocation(Location location, String container,
|
public boolean createContainerInLocation(Location location, String container,
|
||||||
CreateContainerOptions options) {
|
CreateContainerOptions options) {
|
||||||
|
|
Loading…
Reference in New Issue