/** * This implementation invokes {@link S3AsyncClient#bucketExists} * * @param container * bucket name */ @Override public ListenableFuture<Boolean> containerExists(String container) { return async.bucketExists(container); }
/** * This implementation invokes {@link S3AsyncClient#deleteObject} * * @param container * bucket name * @param key * object key */ @Override public ListenableFuture<Void> removeBlob(String container, String key) { return async.deleteObject(container, key); }
/** * This implementation invokes {@link S3AsyncClient#objectExists} * * @param container * bucket name * @param key * object key */ @Override public ListenableFuture<Boolean> blobExists(String container, String key) { return async.objectExists(container, key); }
/** * This implementation invokes {@link S3AsyncClient#listOwnedBuckets} */ @Override public ListenableFuture<PageSet<? extends StorageMetadata>> list() { return Futures.compose(async.listOwnedBuckets(), new Function<Set<BucketMetadata>, org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata>>() { public org.jclouds.blobstore.domain.PageSet<? extends StorageMetadata> apply(Set<BucketMetadata> from) { return new PageSetImpl<StorageMetadata>(Iterables.transform(from, bucket2ResourceMd), null); } }, service); }
/** * This implementation invokes {@link S3AsyncClient#putObject} * * @param container * bucket name * @param blob * object */ @Override public ListenableFuture<String> putBlob(String container, Blob blob) { return async.putObject(container, blob2Object.apply(blob)); }
/** * This implementation invokes {@link S3AsyncClient#putBucketInRegion} * * @param location * corresponds to {@link Region} * @param container * bucket name */ @Override public ListenableFuture<Boolean> createContainerInLocation(Location location, String container) { location = location != null ? location : defaultLocation.get(); return async.putBucketInRegion(location.getId(), container); }
/** * This implementation invokes {@link S3AsyncClient#getObject} * * @param container * bucket name * @param key * object key */ @Override public ListenableFuture<Blob> getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) { GetOptions httpOptions = blob2ObjectGetOptions.apply(options); return Futures.compose(async.getObject(container, key, httpOptions), object2Blob, service); }
/** * This implementation invokes {@link S3AsyncClient#headObject} * * @param container * bucket name * @param key * object key */ @Override public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) { return Futures.compose(async.headObject(container, key), new Function<ObjectMetadata, BlobMetadata>() { @Override public BlobMetadata apply(ObjectMetadata from) { return object2BlobMd.apply(from); } }, service); }
/** * This implementation invokes {@link S3AsyncClient#listBucket} * * @param container * bucket name */ @Override // TODO get rid of compose, as it serializes async results when the executor is single-threaded. public ListenableFuture<PageSet<? extends StorageMetadata>> list(String container, ListContainerOptions options) { ListBucketOptions httpOptions = container2BucketListOptions.apply(options); ListenableFuture<ListBucketResponse> returnVal = async.listBucket(container, httpOptions); ListenableFuture<PageSet<? extends StorageMetadata>> list = Futures.compose(returnVal, bucket2ResourceList, service); return (options.isDetailed()) ? Futures.compose(list, fetchBlobMetadataProvider.get().setContainerName(container), service) : list; }