mirror of https://github.com/apache/jclouds.git
Issue 144: convert to ListenableFutures
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2625 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
e69831b1a9
commit
83a2d54e3e
|
@ -45,7 +45,7 @@
|
|||
package ${package};
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ListenableFuture;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
@ -72,6 +72,6 @@ public interface ${clientName}AsyncClient {
|
|||
@GET
|
||||
@ResponseParser(ParseStatusesFromJsonResponse.class)
|
||||
@Path("/statuses/mentions.json")
|
||||
Future<SortedSet<Status>> getMyMentions();
|
||||
ListenableFuture<SortedSet<Status>> getMyMentions();
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.atmosonline.saas;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
|
@ -60,6 +59,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to EMC Atmos Online Storage resources via their REST API.
|
||||
* <p/>
|
||||
|
@ -83,7 +84,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@Path("/rest/namespace")
|
||||
@ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
Future<? extends BoundedSortedSet<? extends DirectoryEntry>> listDirectories(
|
||||
ListenableFuture<? extends BoundedSortedSet<? extends DirectoryEntry>> listDirectories(
|
||||
ListOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -94,7 +95,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
|
||||
@ExceptionParser(ThrowContainerNotFoundOn404.class)
|
||||
@Consumes(MediaType.TEXT_XML)
|
||||
Future<? extends BoundedSortedSet<? extends DirectoryEntry>> listDirectory(
|
||||
ListenableFuture<? extends BoundedSortedSet<? extends DirectoryEntry>> listDirectory(
|
||||
@PathParam("directoryName") String directoryName, ListOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -104,7 +105,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@Path("/rest/namespace/{directoryName}/")
|
||||
@ExceptionParser(ReturnEndpointIfAlreadyExists.class)
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<URI> createDirectory(@PathParam("directoryName") String directoryName);
|
||||
ListenableFuture<URI> createDirectory(@PathParam("directoryName") String directoryName);
|
||||
|
||||
/**
|
||||
* @see AtmosStorageClient#createFile
|
||||
|
@ -112,7 +113,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@POST
|
||||
@Path("/rest/namespace/{parent}/{name}")
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<URI> createFile(
|
||||
ListenableFuture<URI> createFile(
|
||||
@PathParam("parent") String parent,
|
||||
@PathParam("name") @ParamParser(AtmosObjectName.class) @BinderParam(BindAtmosObjectToPayloadAndMetadataToHeaders.class) AtmosObject object);
|
||||
|
||||
|
@ -123,7 +124,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@Path("/rest/namespace/{parent}/{name}")
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<Void> updateFile(
|
||||
ListenableFuture<Void> updateFile(
|
||||
@PathParam("parent") String parent,
|
||||
@PathParam("name") @ParamParser(AtmosObjectName.class) @BinderParam(BindAtmosObjectToPayloadAndMetadataToHeaders.class) AtmosObject object);
|
||||
|
||||
|
@ -135,7 +136,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@Path("/rest/namespace/{path}")
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<AtmosObject> readFile(@PathParam("path") String path, GetOptions... options);
|
||||
ListenableFuture<AtmosObject> readFile(@PathParam("path") String path, GetOptions... options);
|
||||
|
||||
/**
|
||||
* @see AtmosStorageClient#headFile
|
||||
|
@ -145,7 +146,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@Path("/rest/namespace/{path}")
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<AtmosObject> headFile(@PathParam("path") String path);
|
||||
ListenableFuture<AtmosObject> headFile(@PathParam("path") String path);
|
||||
|
||||
/**
|
||||
* @see AtmosStorageClient#getSystemMetadata
|
||||
|
@ -156,7 +157,7 @@ public interface AtmosStorageAsyncClient {
|
|||
// currently throws 403 errors @QueryParams(keys = "metadata/system")
|
||||
@Path("/rest/namespace/{path}")
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<SystemMetadata> getSystemMetadata(@PathParam("path") String path);
|
||||
ListenableFuture<SystemMetadata> getSystemMetadata(@PathParam("path") String path);
|
||||
|
||||
/**
|
||||
* @see AtmosStorageClient#getUserMetadata
|
||||
|
@ -167,7 +168,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@Path("/rest/namespace/{path}")
|
||||
@QueryParams(keys = "metadata/user")
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<UserMetadata> getUserMetadata(@PathParam("path") String path);
|
||||
ListenableFuture<UserMetadata> getUserMetadata(@PathParam("path") String path);
|
||||
|
||||
/**
|
||||
* @see AtmosStorageClient#deletePath
|
||||
|
@ -176,7 +177,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
@Path("/rest/namespace/{path}")
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<Void> deletePath(@PathParam("path") String path);
|
||||
ListenableFuture<Void> deletePath(@PathParam("path") String path);
|
||||
|
||||
/**
|
||||
* @see AtmosStorageClient#pathExists
|
||||
|
@ -185,7 +186,7 @@ public interface AtmosStorageAsyncClient {
|
|||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/rest/namespace/{path}")
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
Future<Boolean> pathExists(@PathParam("path") String path);
|
||||
ListenableFuture<Boolean> pathExists(@PathParam("path") String path);
|
||||
|
||||
// signature currently doesn't work
|
||||
// @POST
|
||||
|
|
|
@ -25,7 +25,6 @@ import static org.jclouds.blobstore.options.ListContainerOptions.Builder.recursi
|
|||
import java.net.URI;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -55,7 +54,11 @@ import org.jclouds.util.Utils;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class AtmosAsyncBlobStore extends BaseAtmosBlobStore implements AsyncBlobStore {
|
||||
private final EncryptionService encryptionService;
|
||||
|
||||
|
@ -77,8 +80,8 @@ public class AtmosAsyncBlobStore extends BaseAtmosBlobStore implements AsyncBlob
|
|||
/**
|
||||
* This implementation uses the AtmosStorage HEAD Object command to return the result
|
||||
*/
|
||||
public Future<BlobMetadata> blobMetadata(String container, String key) {
|
||||
return compose(makeListenable(async.headFile(container + "/" + key)),
|
||||
public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) {
|
||||
return compose(async.headFile(container + "/" + key),
|
||||
new Function<AtmosObject, BlobMetadata>() {
|
||||
@Override
|
||||
public BlobMetadata apply(AtmosObject from) {
|
||||
|
@ -87,41 +90,39 @@ public class AtmosAsyncBlobStore extends BaseAtmosBlobStore implements AsyncBlob
|
|||
}, service);
|
||||
}
|
||||
|
||||
public Future<Void> clearContainer(final String container) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> clearContainer(final String container) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
clearContainerStrategy.execute(container, recursive());
|
||||
return null;
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
public ListenableFuture<Boolean> createContainer(String container) {
|
||||
return compose(async.createDirectory(container), new Function<URI, Boolean>() {
|
||||
|
||||
public Boolean apply(URI from) {
|
||||
return true;// no etag
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public Future<Boolean> createContainer(String container) {
|
||||
return compose(makeListenable(async.createDirectory(container)),
|
||||
new Function<URI, Boolean>() {
|
||||
public ListenableFuture<Void> createDirectory(String container, String directory) {
|
||||
return compose(async.createDirectory(container + "/" + directory), new Function<URI, Void>() {
|
||||
|
||||
public Boolean apply(URI from) {
|
||||
return true;// no etag
|
||||
}
|
||||
public Void apply(URI from) {
|
||||
return null;// no etag
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public Future<Void> createDirectory(String container, String directory) {
|
||||
return compose(makeListenable(async.createDirectory(container + "/" + directory)),
|
||||
new Function<URI, Void>() {
|
||||
|
||||
public Void apply(URI from) {
|
||||
return null;// no etag
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public Future<Void> deleteContainer(final String container) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> deleteContainer(final String container) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
clearContainerStrategy.execute(container, recursive());
|
||||
|
@ -136,29 +137,29 @@ public class AtmosAsyncBlobStore extends BaseAtmosBlobStore implements AsyncBlob
|
|||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> containerExists(String container) {
|
||||
public ListenableFuture<Boolean> containerExists(String container) {
|
||||
return async.pathExists(container);
|
||||
}
|
||||
|
||||
public Future<Boolean> directoryExists(String container, String directory) {
|
||||
public ListenableFuture<Boolean> directoryExists(String container, String directory) {
|
||||
return async.pathExists(container + "/" + directory);
|
||||
}
|
||||
|
||||
public Future<Blob> getBlob(String container, String key,
|
||||
public ListenableFuture<Blob> getBlob(String container, String key,
|
||||
org.jclouds.blobstore.options.GetOptions... optionsList) {
|
||||
GetOptions httpOptions = blob2ObjectGetOptions.apply(optionsList);
|
||||
Future<AtmosObject> returnVal = async.readFile(container + "/" + key, httpOptions);
|
||||
return compose(makeListenable(returnVal), object2Blob, service);
|
||||
ListenableFuture<AtmosObject> returnVal = async.readFile(container + "/" + key, httpOptions);
|
||||
return compose(returnVal, object2Blob, service);
|
||||
}
|
||||
|
||||
public Future<? extends ListResponse<? extends ResourceMetadata>> list() {
|
||||
return compose(makeListenable(async.listDirectories()), container2ResourceList, service);
|
||||
public ListenableFuture<? extends ListResponse<? extends ResourceMetadata>> list() {
|
||||
return compose(async.listDirectories(), container2ResourceList, service);
|
||||
}
|
||||
|
||||
public Future<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
public ListenableFuture<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
String container, org.jclouds.blobstore.options.ListContainerOptions... optionsList) {
|
||||
if (optionsList.length == 1) {
|
||||
if (optionsList[0].isRecursive()) {
|
||||
|
@ -169,16 +170,15 @@ public class AtmosAsyncBlobStore extends BaseAtmosBlobStore implements AsyncBlob
|
|||
}
|
||||
}
|
||||
ListOptions nativeOptions = container2ContainerListOptions.apply(optionsList);
|
||||
return compose(makeListenable(async.listDirectory(container, nativeOptions)),
|
||||
container2ResourceList, service);
|
||||
return compose(async.listDirectory(container, nativeOptions), container2ResourceList, service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Since there is no etag support in atmos, we just return the path.
|
||||
*/
|
||||
public Future<String> putBlob(final String container, final Blob blob) {
|
||||
public ListenableFuture<String> putBlob(final String container, final Blob blob) {
|
||||
final String path = container + "/" + blob.getMetadata().getName();
|
||||
return compose(makeListenable(async.deletePath(path)), new Function<Void, String>() {
|
||||
return compose(async.deletePath(path), new Function<Void, String>() {
|
||||
|
||||
public String apply(Void from) {
|
||||
try {
|
||||
|
@ -203,7 +203,7 @@ public class AtmosAsyncBlobStore extends BaseAtmosBlobStore implements AsyncBlob
|
|||
|
||||
}
|
||||
|
||||
public Future<Void> removeBlob(String container, String key) {
|
||||
public ListenableFuture<Void> removeBlob(String container, String key) {
|
||||
return async.deletePath(container + "/" + key);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.atmosonline.saas.blobstore.strategy;
|
|||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
|
@ -45,6 +44,7 @@ import com.google.common.base.Supplier;
|
|||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
|
@ -78,15 +78,15 @@ public class RecursiveRemove implements ClearListStrategy, ClearContainerStrateg
|
|||
logger.trace("cleared container " + containerName);
|
||||
}
|
||||
|
||||
private Future<Void> rm(final String fullPath, FileType type, boolean recursive)
|
||||
private ListenableFuture<Void> rm(final String fullPath, FileType type, boolean recursive)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
Set<Future<Void>> deletes = Sets.newHashSet();
|
||||
Set<ListenableFuture<Void>> deletes = Sets.newHashSet();
|
||||
if ((type == FileType.DIRECTORY) && recursive) {
|
||||
for (DirectoryEntry child : async.listDirectory(fullPath).get(10, TimeUnit.SECONDS)) {
|
||||
deletes.add(rm(fullPath + "/" + child.getObjectName(), child.getType(), true));
|
||||
}
|
||||
}
|
||||
for (Future<Void> isdeleted : deletes) {
|
||||
for (ListenableFuture<Void> isdeleted : deletes) {
|
||||
isdeleted.get(requestTimeoutMilliseconds, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
return Futures.compose(async.deletePath(fullPath),
|
||||
|
@ -116,13 +116,13 @@ public class RecursiveRemove implements ClearListStrategy, ClearContainerStrateg
|
|||
String path = containerName;
|
||||
if (options.getDir() != null)
|
||||
path += "/" + options.getDir();
|
||||
Set<Future<Void>> deletes = Sets.newHashSet();
|
||||
Set<ListenableFuture<Void>> deletes = Sets.newHashSet();
|
||||
try {
|
||||
for (DirectoryEntry md : async.listDirectory(path).get(requestTimeoutMilliseconds,
|
||||
TimeUnit.MILLISECONDS)) {
|
||||
deletes.add(rm(path + "/" + md.getObjectName(), md.getType(), options.isRecursive()));
|
||||
}
|
||||
for (Future<Void> isdeleted : deletes) {
|
||||
for (ListenableFuture<Void> isdeleted : deletes) {
|
||||
isdeleted.get(requestTimeoutMilliseconds, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
package org.jclouds.atmosonline.saas.internal;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.util.concurrent.Futures.compose;
|
||||
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
|
||||
import static com.google.common.util.concurrent.Futures.immediateFuture;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -54,6 +54,7 @@ import com.google.common.base.Function;
|
|||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Implementation of {@link AtmosStorageAsyncClient} which keeps all data in a local Map object.
|
||||
|
@ -89,23 +90,22 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
|
|||
this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList");
|
||||
}
|
||||
|
||||
public Future<URI> createDirectory(String directoryName) {
|
||||
public ListenableFuture<URI> createDirectory(String directoryName) {
|
||||
final String container;
|
||||
if (directoryName.indexOf('/') != -1)
|
||||
container = directoryName.substring(0, directoryName.indexOf('/'));
|
||||
else
|
||||
container = directoryName;
|
||||
return Futures.compose(Futures.makeListenable(blobStore.createContainer(container)),
|
||||
new Function<Boolean, URI>() {
|
||||
return Futures.compose(blobStore.createContainer(container), new Function<Boolean, URI>() {
|
||||
|
||||
public URI apply(Boolean from) {
|
||||
return URI.create("http://stub/containers/" + container);
|
||||
}
|
||||
public URI apply(Boolean from) {
|
||||
return URI.create("http://stub/containers/" + container);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public Future<URI> createFile(String parent, AtmosObject object) {
|
||||
public ListenableFuture<URI> createFile(String parent, AtmosObject object) {
|
||||
final String uri = "http://stub/containers/" + parent + "/"
|
||||
+ object.getContentMetadata().getName();
|
||||
String file = object.getContentMetadata().getName();
|
||||
|
@ -117,26 +117,24 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
|
|||
object.getContentMetadata().setName(path + "/" + file);
|
||||
}
|
||||
Blob blob = object2Blob.apply(object);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.putBlob(container, blob)),
|
||||
new Function<String, URI>() {
|
||||
return compose(blobStore.putBlob(container, blob), new Function<String, URI>() {
|
||||
|
||||
public URI apply(String from) {
|
||||
return URI.create(uri);
|
||||
}
|
||||
public URI apply(String from) {
|
||||
return URI.create(uri);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public Future<Void> deletePath(String path) {
|
||||
public ListenableFuture<Void> deletePath(String path) {
|
||||
if (path.indexOf('/') == -1)
|
||||
return Futures.compose(Futures.makeListenable(blobStore.deleteContainerImpl(path)),
|
||||
new Function<Boolean, Void>() {
|
||||
return compose(blobStore.deleteContainerImpl(path), new Function<Boolean, Void>() {
|
||||
|
||||
public Void apply(Boolean from) {
|
||||
return null;
|
||||
}
|
||||
public Void apply(Boolean from) {
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
else {
|
||||
String container = path.substring(0, path.indexOf('/'));
|
||||
path = path.substring(path.indexOf('/') + 1);
|
||||
|
@ -144,17 +142,17 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
|
|||
}
|
||||
}
|
||||
|
||||
public Future<SystemMetadata> getSystemMetadata(String path) {
|
||||
public ListenableFuture<SystemMetadata> getSystemMetadata(String path) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<UserMetadata> getUserMetadata(String path) {
|
||||
public ListenableFuture<UserMetadata> getUserMetadata(String path) {
|
||||
if (path.indexOf('/') == -1)
|
||||
throw new UnsupportedOperationException();
|
||||
else {
|
||||
String container = path.substring(0, path.indexOf('/'));
|
||||
path = path.substring(path.indexOf('/') + 1);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.blobMetadata(container, path)),
|
||||
return compose(blobStore.blobMetadata(container, path),
|
||||
new Function<BlobMetadata, UserMetadata>() {
|
||||
public UserMetadata apply(BlobMetadata from) {
|
||||
return blob2ObjectInfo.apply(from).getUserMetadata();
|
||||
|
@ -163,25 +161,24 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
|
|||
}
|
||||
}
|
||||
|
||||
public Future<AtmosObject> headFile(String path) {
|
||||
public ListenableFuture<AtmosObject> headFile(String path) {
|
||||
String container = path.substring(0, path.indexOf('/'));
|
||||
path = path.substring(path.indexOf('/') + 1);
|
||||
try {
|
||||
return Futures.compose(Futures.makeListenable(blobStore.getBlob(container, path)),
|
||||
blob2Object);
|
||||
return Futures.compose(blobStore.getBlob(container, path), blob2Object);
|
||||
} catch (Exception e) {
|
||||
return immediateFailedFuture(Throwables.getRootCause(e));
|
||||
}
|
||||
}
|
||||
|
||||
public Future<? extends BoundedSortedSet<? extends DirectoryEntry>> listDirectories(
|
||||
public ListenableFuture<? extends BoundedSortedSet<? extends DirectoryEntry>> listDirectories(
|
||||
ListOptions... optionsList) {
|
||||
// org.jclouds.blobstore.options.ListOptions options = container2ContainerListOptions
|
||||
// .apply(optionsList);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.list()), resource2ObjectList);
|
||||
return Futures.compose(blobStore.list(), resource2ObjectList);
|
||||
}
|
||||
|
||||
public Future<? extends BoundedSortedSet<? extends DirectoryEntry>> listDirectory(
|
||||
public ListenableFuture<? extends BoundedSortedSet<? extends DirectoryEntry>> listDirectory(
|
||||
String directoryName, ListOptions... optionsList) {
|
||||
org.jclouds.blobstore.options.ListContainerOptions options = container2ContainerListOptions
|
||||
.apply(optionsList);
|
||||
|
@ -192,15 +189,14 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
|
|||
if (!path.equals(""))
|
||||
options.inDirectory(path);
|
||||
}
|
||||
return Futures.compose(Futures.makeListenable(blobStore.list(container, options)),
|
||||
resource2ObjectList);
|
||||
return compose(blobStore.list(container, options), resource2ObjectList);
|
||||
}
|
||||
|
||||
public AtmosObject newObject() {
|
||||
return this.objectProvider.create(null);
|
||||
}
|
||||
|
||||
public Future<Boolean> pathExists(final String path) {
|
||||
public ListenableFuture<Boolean> pathExists(final String path) {
|
||||
if (path.indexOf('/') == -1 || (path.endsWith("/")))
|
||||
return blobStore.containerExists(path);
|
||||
else {
|
||||
|
@ -222,15 +218,14 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
|
|||
}
|
||||
}
|
||||
|
||||
public Future<AtmosObject> readFile(String path, GetOptions... options) {
|
||||
public ListenableFuture<AtmosObject> readFile(String path, GetOptions... options) {
|
||||
String container = path.substring(0, path.indexOf('/'));
|
||||
String blobName = path.substring(path.indexOf('/') + 1);
|
||||
org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.getBlob(container, blobName,
|
||||
getOptions)), blob2Object);
|
||||
return Futures.compose(blobStore.getBlob(container, blobName, getOptions), blob2Object);
|
||||
}
|
||||
|
||||
public Future<Void> updateFile(String parent, AtmosObject object) {
|
||||
public ListenableFuture<Void> updateFile(String parent, AtmosObject object) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions;
|
|||
* import static org.jclouds.aws.ec2.options.CreateImageOptions.Builder.*
|
||||
* <p/>
|
||||
* EC2Client connection = // get connection
|
||||
* Future<SortedSet<ImageMetadata>> images = connection.getAMIServices().createImage(withDescription("123125").noReboot());
|
||||
* ListenableFuture<SortedSet<ImageMetadata>> images = connection.getAMIServices().createImage(withDescription("123125").noReboot());
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions;
|
|||
* import static org.jclouds.aws.ec2.options.DescribeAvailabilityZonesOptions.Builder.*
|
||||
* <p/>
|
||||
* EC2Client connection = // get connection
|
||||
* Future<SortedSet<ImageMetadata>> images = connection.getAvailabilityZoneAndRegionServices().describeAvailabilityZones(zones("us-east-1a", "us-east-1b"));
|
||||
* ListenableFuture<SortedSet<ImageMetadata>> images = connection.getAvailabilityZoneAndRegionServices().describeAvailabilityZones(zones("us-east-1a", "us-east-1b"));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions;
|
|||
* import static org.jclouds.aws.ec2.options.DescribeImagesOptions.Builder.*
|
||||
* <p/>
|
||||
* EC2Client connection = // get connection
|
||||
* Future<SortedSet<ImageMetadata>> images = connection.getAMIServices().describeImages(executableBy("123125").imageIds(1000, 1004));
|
||||
* ListenableFuture<SortedSet<ImageMetadata>> images = connection.getAMIServices().describeImages(executableBy("123125").imageIds(1000, 1004));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions;
|
|||
* import static org.jclouds.aws.ec2.options.DescribeRegionsOptions.Builder.*
|
||||
* <p/>
|
||||
* EC2Client connection = // get connection
|
||||
* Future<SortedSet<ImageMetadata>> images = connection.getRegionsAndRegionsServices().describeRegions(regions("us-east-1a", "us-east-1b"));
|
||||
* ListenableFuture<SortedSet<ImageMetadata>> images = connection.getRegionsAndRegionsServices().describeRegions(regions("us-east-1a", "us-east-1b"));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.jclouds.encryption.internal.Base64;
|
|||
* import static org.jclouds.aws.ec2.options.RunInstancesOptions.Builder.*
|
||||
* <p/>
|
||||
* EC2Client connection = // get connection
|
||||
* Future<ReservationInfo> instances = connection.runInstances(executableBy("123125").imageIds(1000, 1004));
|
||||
* ListenableFuture<ReservationInfo> instances = connection.runInstances(executableBy("123125").imageIds(1000, 1004));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -23,7 +23,6 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -54,6 +53,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to AMI Services.
|
||||
* <p/>
|
||||
|
@ -72,7 +73,7 @@ public interface AMIAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeImages")
|
||||
@XMLResponseParser(DescribeImagesResponseHandler.class)
|
||||
Future<? extends Set<Image>> describeImagesInRegion(
|
||||
ListenableFuture<? extends Set<Image>> describeImagesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
DescribeImagesOptions... options);
|
||||
|
||||
|
@ -83,7 +84,7 @@ public interface AMIAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "CreateImage")
|
||||
@XMLResponseParser(ImageIdHandler.class)
|
||||
Future<String> createImageInRegion(
|
||||
ListenableFuture<String> createImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("Name") String name, @FormParam("InstanceId") String instanceId,
|
||||
CreateImageOptions... options);
|
||||
|
@ -94,7 +95,7 @@ public interface AMIAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DeregisterImage")
|
||||
Future<Void> deregisterImageInRegion(
|
||||
ListenableFuture<Void> deregisterImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("ImageId") String imageId);
|
||||
|
||||
|
@ -105,7 +106,7 @@ public interface AMIAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "RegisterImage")
|
||||
@XMLResponseParser(ImageIdHandler.class)
|
||||
Future<String> registerImageFromManifestInRegion(
|
||||
ListenableFuture<String> registerImageFromManifestInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("Name") String imageName, @FormParam("ImageLocation") String pathToManifest,
|
||||
RegisterImageOptions... options);
|
||||
|
@ -118,7 +119,7 @@ public interface AMIAsyncClient {
|
|||
@FormParams(keys = { ACTION, "RootDeviceName", "BlockDeviceMapping.0.DeviceName" }, values = {
|
||||
"RegisterImage", "/dev/sda1", "/dev/sda1" })
|
||||
@XMLResponseParser(ImageIdHandler.class)
|
||||
Future<String> registerUnixImageBackedByEbsInRegion(
|
||||
ListenableFuture<String> registerUnixImageBackedByEbsInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("Name") String imageName,
|
||||
@FormParam("BlockDeviceMapping.0.Ebs.SnapshotId") String ebsSnapshotId,
|
||||
|
@ -130,7 +131,7 @@ public interface AMIAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetImageAttribute", "launchPermission" })
|
||||
Future<Void> resetLaunchPermissionsOnImageInRegion(
|
||||
ListenableFuture<Void> resetLaunchPermissionsOnImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("ImageId") String imageId);
|
||||
|
||||
|
@ -141,7 +142,7 @@ public interface AMIAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute",
|
||||
"add", "launchPermission" })
|
||||
Future<Void> addLaunchPermissionsToImageInRegion(
|
||||
ListenableFuture<Void> addLaunchPermissionsToImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
||||
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
||||
|
@ -154,7 +155,7 @@ public interface AMIAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute",
|
||||
"remove", "launchPermission" })
|
||||
Future<Void> removeLaunchPermissionsFromImageInRegion(
|
||||
ListenableFuture<Void> removeLaunchPermissionsFromImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
||||
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
||||
|
@ -168,7 +169,7 @@ public interface AMIAsyncClient {
|
|||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute",
|
||||
"launchPermission" })
|
||||
@XMLResponseParser(PermissionHandler.class)
|
||||
Future<Permission> getLaunchPermissionForImageInRegion(
|
||||
ListenableFuture<Permission> getLaunchPermissionForImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("ImageId") String imageId);
|
||||
|
||||
|
@ -179,7 +180,7 @@ public interface AMIAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "productCodes" })
|
||||
@XMLResponseParser(ProductCodesHandler.class)
|
||||
Future<? extends Set<String>> getProductCodesForImageInRegion(
|
||||
ListenableFuture<? extends Set<String>> getProductCodesForImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("ImageId") String imageId);
|
||||
|
||||
|
@ -191,7 +192,7 @@ public interface AMIAsyncClient {
|
|||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute",
|
||||
"blockDeviceMapping" })
|
||||
@XMLResponseParser(BlockDeviceMappingHandler.class)
|
||||
Future<? extends Map<String, EbsBlockDevice>> getBlockDeviceMappingsForImageInRegion(
|
||||
ListenableFuture<? extends Map<String, EbsBlockDevice>> getBlockDeviceMappingsForImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("ImageId") String imageId);
|
||||
|
||||
|
@ -202,7 +203,7 @@ public interface AMIAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute",
|
||||
"add", "productCodes" })
|
||||
Future<Void> addProductCodesToImageInRegion(
|
||||
ListenableFuture<Void> addProductCodesToImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindProductCodesToIndexedFormParams.class) Iterable<String> productCodes,
|
||||
@FormParam("ImageId") String imageId);
|
||||
|
@ -214,7 +215,7 @@ public interface AMIAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = { "ModifyImageAttribute",
|
||||
"remove", "productCodes" })
|
||||
Future<Void> removeProductCodesFromImageInRegion(
|
||||
ListenableFuture<Void> removeProductCodesFromImageInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindProductCodesToIndexedFormParams.class) Iterable<String> productCodes,
|
||||
@FormParam("ImageId") String imageId);
|
||||
|
|
|
@ -24,7 +24,6 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
|
|||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
|
@ -45,6 +44,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 Availability Zones and Regions via their REST API.
|
||||
* <p/>
|
||||
|
@ -63,7 +64,7 @@ public interface AvailabilityZoneAndRegionAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeAvailabilityZones")
|
||||
@XMLResponseParser(DescribeAvailabilityZonesResponseHandler.class)
|
||||
Future<? extends Set<AvailabilityZoneInfo>> describeAvailabilityZonesInRegion(
|
||||
ListenableFuture<? extends Set<AvailabilityZoneInfo>> describeAvailabilityZonesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
DescribeAvailabilityZonesOptions... options);
|
||||
|
||||
|
@ -75,6 +76,6 @@ public interface AvailabilityZoneAndRegionAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeRegions")
|
||||
@XMLResponseParser(DescribeRegionsResponseHandler.class)
|
||||
Future<? extends Map<Region, URI>> describeRegions(DescribeRegionsOptions... options);
|
||||
ListenableFuture<? extends Map<Region, URI>> describeRegions(DescribeRegionsOptions... options);
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.ACTION;
|
|||
import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -58,6 +57,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 Elastic Block Store services via their REST API.
|
||||
* <p/>
|
||||
|
@ -76,7 +77,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "CreateVolume")
|
||||
@XMLResponseParser(CreateVolumeResponseHandler.class)
|
||||
Future<Volume> createVolumeFromSnapshotInAvailabilityZone(
|
||||
ListenableFuture<Volume> createVolumeFromSnapshotInAvailabilityZone(
|
||||
@EndpointParam(parser = AvailabilityZoneToEndpoint.class) @FormParam("AvailabilityZone") AvailabilityZone availabilityZone,
|
||||
@FormParam("SnapshotId") String snapshotId);
|
||||
|
||||
|
@ -87,7 +88,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "CreateVolume")
|
||||
@XMLResponseParser(CreateVolumeResponseHandler.class)
|
||||
Future<Volume> createVolumeInAvailabilityZone(
|
||||
ListenableFuture<Volume> createVolumeInAvailabilityZone(
|
||||
@EndpointParam(parser = AvailabilityZoneToEndpoint.class) @FormParam("AvailabilityZone") AvailabilityZone availabilityZone,
|
||||
@FormParam("Size") int size);
|
||||
|
||||
|
@ -98,7 +99,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeVolumes")
|
||||
@XMLResponseParser(DescribeVolumesResponseHandler.class)
|
||||
Future<? extends Set<Volume>> describeVolumesInRegion(
|
||||
ListenableFuture<? extends Set<Volume>> describeVolumesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindVolumeIdsToIndexedFormParams.class) String... volumeIds);
|
||||
|
||||
|
@ -108,7 +109,8 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DeleteVolume")
|
||||
Future<Void> deleteVolumeInRegion(@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
ListenableFuture<Void> deleteVolumeInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("VolumeId") String volumeId);
|
||||
|
||||
/**
|
||||
|
@ -118,7 +120,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DetachVolume")
|
||||
@ExceptionParser(ReturnVoidOnVolumeAvailable.class)
|
||||
Future<Void> detachVolumeInRegion(
|
||||
ListenableFuture<Void> detachVolumeInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("VolumeId") String volumeId, @FormParam("Force") boolean force,
|
||||
DetachVolumeOptions... options);
|
||||
|
@ -130,7 +132,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "AttachVolume")
|
||||
@XMLResponseParser(AttachmentHandler.class)
|
||||
Future<Attachment> attachVolumeInRegion(
|
||||
ListenableFuture<Attachment> attachVolumeInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("VolumeId") String volumeId, @FormParam("InstanceId") String instanceId,
|
||||
@FormParam("Device") String device);
|
||||
|
@ -142,7 +144,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "CreateSnapshot")
|
||||
@XMLResponseParser(SnapshotHandler.class)
|
||||
Future<Snapshot> createSnapshotInRegion(
|
||||
ListenableFuture<Snapshot> createSnapshotInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("VolumeId") String volumeId, CreateSnapshotOptions... options);
|
||||
|
||||
|
@ -153,7 +155,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeSnapshots")
|
||||
@XMLResponseParser(DescribeSnapshotsResponseHandler.class)
|
||||
Future<? extends Set<Snapshot>> describeSnapshotsInRegion(
|
||||
ListenableFuture<? extends Set<Snapshot>> describeSnapshotsInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
DescribeSnapshotsOptions... options);
|
||||
|
||||
|
@ -163,7 +165,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DeleteSnapshot")
|
||||
Future<Void> deleteSnapshotInRegion(
|
||||
ListenableFuture<Void> deleteSnapshotInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("SnapshotId") String snapshotId);
|
||||
|
||||
|
@ -174,7 +176,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = {
|
||||
"ModifySnapshotAttribute", "add", "createVolumePermission" })
|
||||
Future<Void> addCreateVolumePermissionsToSnapshotInRegion(
|
||||
ListenableFuture<Void> addCreateVolumePermissionsToSnapshotInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
||||
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
||||
|
@ -187,7 +189,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "OperationType", "Attribute" }, values = {
|
||||
"ModifySnapshotAttribute", "remove", "createVolumePermission" })
|
||||
Future<Void> removeCreateVolumePermissionsFromSnapshotInRegion(
|
||||
ListenableFuture<Void> removeCreateVolumePermissionsFromSnapshotInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindUserIdsToIndexedFormParams.class) Iterable<String> userIds,
|
||||
@BinderParam(BindUserGroupsToIndexedFormParams.class) Iterable<String> userGroups,
|
||||
|
@ -201,7 +203,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeSnapshotAttribute",
|
||||
"createVolumePermission" })
|
||||
@XMLResponseParser(PermissionHandler.class)
|
||||
Future<Permission> getCreateVolumePermissionForSnapshotInRegion(
|
||||
ListenableFuture<Permission> getCreateVolumePermissionForSnapshotInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("SnapshotId") String snapshotId);
|
||||
|
||||
|
@ -212,7 +214,7 @@ public interface ElasticBlockStoreAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetSnapshotAttribute",
|
||||
"createVolumePermission" })
|
||||
Future<Void> resetCreateVolumePermissionsOnSnapshotInRegion(
|
||||
ListenableFuture<Void> resetCreateVolumePermissionsOnSnapshotInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("SnapshotId") String snapshotId);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
|
|||
|
||||
import java.net.InetAddress;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -45,6 +44,8 @@ import org.jclouds.rest.annotations.VirtualHost;
|
|||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.rest.functions.InetAddressToHostAddress;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 Elastic IP Addresses via REST API.
|
||||
* <p/>
|
||||
|
@ -63,7 +64,7 @@ public interface ElasticIPAddressAsyncClient {
|
|||
@Path("/")
|
||||
@XMLResponseParser(AllocateAddressResponseHandler.class)
|
||||
@FormParams(keys = ACTION, values = "AllocateAddress")
|
||||
Future<InetAddress> allocateAddressInRegion(
|
||||
ListenableFuture<InetAddress> allocateAddressInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region);
|
||||
|
||||
/**
|
||||
|
@ -72,7 +73,7 @@ public interface ElasticIPAddressAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "AssociateAddress")
|
||||
Future<Void> associateAddressInRegion(
|
||||
ListenableFuture<Void> associateAddressInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
@ -83,7 +84,7 @@ public interface ElasticIPAddressAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DisassociateAddress")
|
||||
Future<Void> disassociateAddressInRegion(
|
||||
ListenableFuture<Void> disassociateAddressInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp);
|
||||
|
||||
|
@ -93,7 +94,7 @@ public interface ElasticIPAddressAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "ReleaseAddress")
|
||||
Future<Void> releaseAddressInRegion(
|
||||
ListenableFuture<Void> releaseAddressInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("PublicIp") @ParamParser(InetAddressToHostAddress.class) InetAddress publicIp);
|
||||
|
||||
|
@ -104,7 +105,7 @@ public interface ElasticIPAddressAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeAddresses")
|
||||
@XMLResponseParser(DescribeAddressesResponseHandler.class)
|
||||
Future<? extends Set<PublicIpInstanceIdPair>> describeAddressesInRegion(
|
||||
ListenableFuture<? extends Set<PublicIpInstanceIdPair>> describeAddressesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindInetAddressesToIndexedFormParams.class) InetAddress... publicIps);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.ws.rs.FormParam;
|
||||
|
@ -60,6 +59,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 Instance Services via their REST API.
|
||||
* <p/>
|
||||
|
@ -78,7 +79,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeInstances")
|
||||
@XMLResponseParser(DescribeInstancesResponseHandler.class)
|
||||
Future<? extends Set<Reservation>> describeInstancesInRegion(
|
||||
ListenableFuture<? extends Set<Reservation>> describeInstancesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
||||
|
@ -89,7 +90,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "RunInstances")
|
||||
@XMLResponseParser(RunInstancesResponseHandler.class)
|
||||
Future<Reservation> runInstancesInRegion(
|
||||
ListenableFuture<Reservation> runInstancesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@Nullable @BinderParam(IfNotNullBindAvailabilityZoneToFormParam.class) AvailabilityZone nullableAvailabilityZone,
|
||||
@FormParam("ImageId") String imageId, @FormParam("MinCount") int minCount,
|
||||
|
@ -101,7 +102,7 @@ public interface InstanceAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "RebootInstances")
|
||||
Future<Void> rebootInstancesInRegion(
|
||||
ListenableFuture<Void> rebootInstancesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
||||
|
@ -112,7 +113,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "TerminateInstances")
|
||||
@XMLResponseParser(InstanceStateChangeHandler.class)
|
||||
Future<? extends Set<InstanceStateChange>> terminateInstancesInRegion(
|
||||
ListenableFuture<? extends Set<InstanceStateChange>> terminateInstancesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
||||
|
@ -123,7 +124,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "StopInstances")
|
||||
@XMLResponseParser(InstanceStateChangeHandler.class)
|
||||
Future<? extends Set<InstanceStateChange>> stopInstancesInRegion(
|
||||
ListenableFuture<? extends Set<InstanceStateChange>> stopInstancesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("Force") boolean force,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
@ -135,7 +136,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "StartInstances")
|
||||
@XMLResponseParser(InstanceStateChangeHandler.class)
|
||||
Future<? extends Set<InstanceStateChange>> startInstancesInRegion(
|
||||
ListenableFuture<? extends Set<InstanceStateChange>> startInstancesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
||||
|
@ -146,7 +147,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "userData" })
|
||||
@XMLResponseParser(UnencodeStringValueHandler.class)
|
||||
Future<String> getUserDataForInstanceInRegion(
|
||||
ListenableFuture<String> getUserDataForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -158,7 +159,7 @@ public interface InstanceAsyncClient {
|
|||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute",
|
||||
"rootDeviceName" })
|
||||
@XMLResponseParser(StringValueHandler.class)
|
||||
Future<String> getRootDeviceNameForInstanceInRegion(
|
||||
ListenableFuture<String> getRootDeviceNameForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -169,7 +170,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "ramdisk" })
|
||||
@XMLResponseParser(StringValueHandler.class)
|
||||
Future<String> getRamdiskForInstanceInRegion(
|
||||
ListenableFuture<String> getRamdiskForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -180,7 +181,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute", "kernel" })
|
||||
@XMLResponseParser(StringValueHandler.class)
|
||||
Future<String> getKernelForInstanceInRegion(
|
||||
ListenableFuture<String> getKernelForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -192,7 +193,7 @@ public interface InstanceAsyncClient {
|
|||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute",
|
||||
"disableApiTermination" })
|
||||
@XMLResponseParser(BooleanValueHandler.class)
|
||||
Future<Boolean> isApiTerminationDisabledForInstanceInRegion(
|
||||
ListenableFuture<Boolean> isApiTerminationDisabledForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -204,7 +205,7 @@ public interface InstanceAsyncClient {
|
|||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute",
|
||||
"instanceType" })
|
||||
@XMLResponseParser(InstanceTypeHandler.class)
|
||||
Future<InstanceType> getInstanceTypeForInstanceInRegion(
|
||||
ListenableFuture<InstanceType> getInstanceTypeForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -216,7 +217,7 @@ public interface InstanceAsyncClient {
|
|||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute",
|
||||
"instanceInitiatedShutdownBehavior" })
|
||||
@XMLResponseParser(InstanceInitiatedShutdownBehaviorHandler.class)
|
||||
Future<InstanceInitiatedShutdownBehavior> getInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
||||
ListenableFuture<InstanceInitiatedShutdownBehavior> getInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -228,7 +229,7 @@ public interface InstanceAsyncClient {
|
|||
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeInstanceAttribute",
|
||||
"blockDeviceMapping" })
|
||||
@XMLResponseParser(BlockDeviceMappingHandler.class)
|
||||
Future<? extends Map<String, EbsBlockDevice>> getBlockDeviceMappingForInstanceInRegion(
|
||||
ListenableFuture<? extends Map<String, EbsBlockDevice>> getBlockDeviceMappingForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -238,7 +239,7 @@ public interface InstanceAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "ramdisk" })
|
||||
Future<Void> resetRamdiskForInstanceInRegion(
|
||||
ListenableFuture<Void> resetRamdiskForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -248,7 +249,7 @@ public interface InstanceAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ResetInstanceAttribute", "kernel" })
|
||||
Future<Void> resetKernelForInstanceInRegion(
|
||||
ListenableFuture<Void> resetKernelForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId);
|
||||
|
||||
|
@ -258,7 +259,7 @@ public interface InstanceAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "userData" })
|
||||
Future<Void> setUserDataForInstanceInRegion(
|
||||
ListenableFuture<Void> setUserDataForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId,
|
||||
@FormParam("Value") @ParamParser(ConvertUnencodedBytesToBase64EncodedString.class) byte[] unencodedData);
|
||||
|
@ -269,7 +270,7 @@ public interface InstanceAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "ramdisk" })
|
||||
Future<Void> setRamdiskForInstanceInRegion(
|
||||
ListenableFuture<Void> setRamdiskForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId, @FormParam("Value") String ramdisk);
|
||||
|
||||
|
@ -279,7 +280,7 @@ public interface InstanceAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "kernel" })
|
||||
Future<Void> setKernelForInstanceInRegion(
|
||||
ListenableFuture<Void> setKernelForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId, @FormParam("Value") String kernel);
|
||||
|
||||
|
@ -290,7 +291,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute",
|
||||
"disableApiTermination" })
|
||||
Future<Void> setApiTerminationDisabledForInstanceInRegion(
|
||||
ListenableFuture<Void> setApiTerminationDisabledForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId,
|
||||
@FormParam("Value") boolean apiTerminationDisabled);
|
||||
|
@ -301,7 +302,7 @@ public interface InstanceAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute", "instanceType" })
|
||||
Future<Void> setInstanceTypeForInstanceInRegion(
|
||||
ListenableFuture<Void> setInstanceTypeForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId,
|
||||
@FormParam("Value") InstanceType instanceType);
|
||||
|
@ -313,7 +314,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute",
|
||||
"instanceInitiatedShutdownBehavior" })
|
||||
Future<Void> setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
||||
ListenableFuture<Void> setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId,
|
||||
@FormParam("Value") InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior);
|
||||
|
@ -325,7 +326,7 @@ public interface InstanceAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = { ACTION, "Attribute" }, values = { "ModifyInstanceAttribute",
|
||||
"blockDeviceMapping" })
|
||||
Future<Void> setBlockDeviceMappingForInstanceInRegion(
|
||||
ListenableFuture<Void> setBlockDeviceMappingForInstanceInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId") String instanceId,
|
||||
@FormParam("Value") String blockDeviceMapping);
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.ACTION;
|
|||
import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -42,6 +41,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 via their REST API.
|
||||
* <p/>
|
||||
|
@ -60,7 +61,7 @@ public interface KeyPairAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "CreateKeyPair")
|
||||
@XMLResponseParser(KeyPairResponseHandler.class)
|
||||
Future<KeyPair> createKeyPairInRegion(
|
||||
ListenableFuture<KeyPair> createKeyPairInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("KeyName") String keyName);
|
||||
|
||||
|
@ -71,7 +72,7 @@ public interface KeyPairAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeKeyPairs")
|
||||
@XMLResponseParser(DescribeKeyPairsResponseHandler.class)
|
||||
Future<? extends Set<KeyPair>> describeKeyPairsInRegion(
|
||||
ListenableFuture<? extends Set<KeyPair>> describeKeyPairsInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindKeyNameToIndexedFormParams.class) String... keyPairNames);
|
||||
|
||||
|
@ -81,7 +82,7 @@ public interface KeyPairAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DeleteKeyPair")
|
||||
Future<Void> deleteKeyPairInRegion(
|
||||
ListenableFuture<Void> deleteKeyPairInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("KeyName") String keyName);
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.ACTION;
|
|||
import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -41,6 +40,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 Monitoring Services via their REST API.
|
||||
* <p/>
|
||||
|
@ -59,7 +60,7 @@ public interface MonitoringAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "MonitorInstances")
|
||||
@XMLResponseParser(MonitoringStateHandler.class)
|
||||
Future<? extends Map<String, MonitoringState>> monitorInstancesInRegion(
|
||||
ListenableFuture<? extends Map<String, MonitoringState>> monitorInstancesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId.0") String instanceId,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
@ -71,7 +72,7 @@ public interface MonitoringAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "UnmonitorInstances")
|
||||
@XMLResponseParser(MonitoringStateHandler.class)
|
||||
Future<? extends Map<String, MonitoringState>> unmonitorInstancesInRegion(
|
||||
ListenableFuture<? extends Map<String, MonitoringState>> unmonitorInstancesInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("InstanceId.0") String instanceId,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.ACTION;
|
|||
import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -46,6 +45,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to EC2 via their REST API.
|
||||
* <p/>
|
||||
|
@ -63,7 +64,7 @@ public interface SecurityGroupAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "CreateSecurityGroup")
|
||||
Future<Void> createSecurityGroupInRegion(
|
||||
ListenableFuture<Void> createSecurityGroupInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("GroupName") String name, @FormParam("GroupDescription") String description);
|
||||
|
||||
|
@ -74,7 +75,7 @@ public interface SecurityGroupAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DeleteSecurityGroup")
|
||||
@ExceptionParser(ReturnVoidOnGroupNotFound.class)
|
||||
Future<Void> deleteSecurityGroupInRegion(
|
||||
ListenableFuture<Void> deleteSecurityGroupInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("GroupName") String name);
|
||||
|
||||
|
@ -85,7 +86,7 @@ public interface SecurityGroupAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DescribeSecurityGroups")
|
||||
@XMLResponseParser(DescribeSecurityGroupsResponseHandler.class)
|
||||
Future<? extends SortedSet<SecurityGroup>> describeSecurityGroupsInRegion(
|
||||
ListenableFuture<? extends SortedSet<SecurityGroup>> describeSecurityGroupsInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@BinderParam(BindGroupNameToIndexedFormParams.class) String... securityGroupNames);
|
||||
|
||||
|
@ -95,7 +96,7 @@ public interface SecurityGroupAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress")
|
||||
Future<Void> authorizeSecurityGroupIngressInRegion(
|
||||
ListenableFuture<Void> authorizeSecurityGroupIngressInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("GroupName") String groupName,
|
||||
@BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup);
|
||||
|
@ -107,7 +108,7 @@ public interface SecurityGroupAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "AuthorizeSecurityGroupIngress")
|
||||
Future<Void> authorizeSecurityGroupIngressInRegion(
|
||||
ListenableFuture<Void> authorizeSecurityGroupIngressInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("GroupName") String groupName,
|
||||
@FormParam("IpProtocol") IpProtocol ipProtocol, @FormParam("FromPort") int fromPort,
|
||||
|
@ -119,7 +120,7 @@ public interface SecurityGroupAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress")
|
||||
Future<Void> revokeSecurityGroupIngressInRegion(
|
||||
ListenableFuture<Void> revokeSecurityGroupIngressInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("GroupName") String groupName,
|
||||
@BinderParam(BindUserIdGroupPairToSourceSecurityGroupFormParams.class) UserIdGroupPair sourceSecurityGroup);
|
||||
|
@ -131,7 +132,7 @@ public interface SecurityGroupAsyncClient {
|
|||
@POST
|
||||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "RevokeSecurityGroupIngress")
|
||||
Future<Void> revokeSecurityGroupIngressInRegion(
|
||||
ListenableFuture<Void> revokeSecurityGroupIngressInRegion(
|
||||
@EndpointParam(parser = RegionToEndpoint.class) Region region,
|
||||
@FormParam("GroupName") String groupName,
|
||||
@FormParam("IpProtocol") IpProtocol ipProtocol, @FormParam("FromPort") int fromPort,
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER;
|
|||
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -83,11 +82,14 @@ import org.jclouds.rest.annotations.SkipEncoding;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to S3 via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from S3. Any exceptions incurred during processing
|
||||
* will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from S3. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @author James Murty
|
||||
|
@ -114,8 +116,8 @@ public interface S3AsyncClient {
|
|||
@Path("{key}")
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
|
||||
Future<S3Object> getObject(@HostPrefixParam String bucketName, @PathParam("key") String key,
|
||||
GetOptions... options);
|
||||
ListenableFuture<S3Object> getObject(@HostPrefixParam String bucketName,
|
||||
@PathParam("key") String key, GetOptions... options);
|
||||
|
||||
/**
|
||||
* @see S3Client#headObject
|
||||
|
@ -124,7 +126,7 @@ public interface S3AsyncClient {
|
|||
@Path("{key}")
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@ResponseParser(ParseObjectMetadataFromHeaders.class)
|
||||
Future<ObjectMetadata> headObject(@HostPrefixParam String bucketName,
|
||||
ListenableFuture<ObjectMetadata> headObject(@HostPrefixParam String bucketName,
|
||||
@PathParam("key") String key);
|
||||
|
||||
/**
|
||||
|
@ -133,7 +135,8 @@ public interface S3AsyncClient {
|
|||
@DELETE
|
||||
@Path("{key}")
|
||||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
Future<Void> deleteObject(@HostPrefixParam String bucketName, @PathParam("key") String key);
|
||||
ListenableFuture<Void> deleteObject(@HostPrefixParam String bucketName,
|
||||
@PathParam("key") String key);
|
||||
|
||||
/**
|
||||
* @see S3Client#putObject
|
||||
|
@ -141,7 +144,7 @@ public interface S3AsyncClient {
|
|||
@PUT
|
||||
@Path("{key}")
|
||||
@ResponseParser(ParseETagHeader.class)
|
||||
Future<String> putObject(
|
||||
ListenableFuture<String> putObject(
|
||||
@HostPrefixParam String bucketName,
|
||||
@PathParam("key") @ParamParser(ObjectKey.class) @BinderParam(BindS3ObjectToPayload.class) S3Object object,
|
||||
PutObjectOptions... options);
|
||||
|
@ -152,7 +155,7 @@ public interface S3AsyncClient {
|
|||
@PUT
|
||||
@Path("/")
|
||||
@ExceptionParser(ReturnTrueIfBucketAlreadyOwnedByYou.class)
|
||||
Future<Boolean> putBucketIfNotExists(@HostPrefixParam String bucketName,
|
||||
ListenableFuture<Boolean> putBucketIfNotExists(@HostPrefixParam String bucketName,
|
||||
PutBucketOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -161,7 +164,7 @@ public interface S3AsyncClient {
|
|||
@DELETE
|
||||
@Path("/")
|
||||
@ExceptionParser(ReturnTrueOn404FalseIfNotEmpty.class)
|
||||
Future<Boolean> deleteBucketIfEmpty(@HostPrefixParam String bucketName);
|
||||
ListenableFuture<Boolean> deleteBucketIfEmpty(@HostPrefixParam String bucketName);
|
||||
|
||||
/**
|
||||
* @see S3Client#bucketExists
|
||||
|
@ -170,7 +173,7 @@ public interface S3AsyncClient {
|
|||
@Path("/")
|
||||
@QueryParams(keys = "max-keys", values = "0")
|
||||
@ExceptionParser(ReturnFalseOn404OrSSLHandshakeException.class)
|
||||
Future<Boolean> bucketExists(@HostPrefixParam String bucketName);
|
||||
ListenableFuture<Boolean> bucketExists(@HostPrefixParam String bucketName);
|
||||
|
||||
/**
|
||||
* @see S3Client#getBucketLocation
|
||||
|
@ -179,7 +182,7 @@ public interface S3AsyncClient {
|
|||
@QueryParams(keys = "location")
|
||||
@Path("/")
|
||||
@XMLResponseParser(LocationConstraintHandler.class)
|
||||
Future<LocationConstraint> getBucketLocation(@HostPrefixParam String bucketName);
|
||||
ListenableFuture<LocationConstraint> getBucketLocation(@HostPrefixParam String bucketName);
|
||||
|
||||
/**
|
||||
* @see S3Client#getBucketPayer
|
||||
|
@ -188,7 +191,7 @@ public interface S3AsyncClient {
|
|||
@QueryParams(keys = "requestPayment")
|
||||
@Path("/")
|
||||
@XMLResponseParser(PayerHandler.class)
|
||||
Future<Payer> getBucketPayer(@HostPrefixParam String bucketName);
|
||||
ListenableFuture<Payer> getBucketPayer(@HostPrefixParam String bucketName);
|
||||
|
||||
/**
|
||||
* @see S3Client#setBucketPayer
|
||||
|
@ -196,7 +199,7 @@ public interface S3AsyncClient {
|
|||
@PUT
|
||||
@QueryParams(keys = "requestPayment")
|
||||
@Path("/")
|
||||
Future<Void> setBucketPayer(@HostPrefixParam String bucketName,
|
||||
ListenableFuture<Void> setBucketPayer(@HostPrefixParam String bucketName,
|
||||
@BinderParam(BindPayerToXmlPayload.class) Payer payer);
|
||||
|
||||
/**
|
||||
|
@ -205,7 +208,7 @@ public interface S3AsyncClient {
|
|||
@GET
|
||||
@Path("/")
|
||||
@XMLResponseParser(ListBucketHandler.class)
|
||||
Future<ListBucketResponse> listBucket(@HostPrefixParam String bucketName,
|
||||
ListenableFuture<ListBucketResponse> listBucket(@HostPrefixParam String bucketName,
|
||||
ListBucketOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -214,7 +217,7 @@ public interface S3AsyncClient {
|
|||
@GET
|
||||
@XMLResponseParser(ListAllMyBucketsHandler.class)
|
||||
@Path("/")
|
||||
Future<? extends SortedSet<BucketMetadata>> listOwnedBuckets();
|
||||
ListenableFuture<? extends SortedSet<BucketMetadata>> listOwnedBuckets();
|
||||
|
||||
/**
|
||||
* @see S3Client#copyObject
|
||||
|
@ -223,7 +226,7 @@ public interface S3AsyncClient {
|
|||
@Path("{destinationObject}")
|
||||
@Headers(keys = "x-amz-copy-source", values = "/{sourceBucket}/{sourceObject}")
|
||||
@XMLResponseParser(CopyObjectHandler.class)
|
||||
Future<ObjectMetadata> copyObject(@PathParam("sourceBucket") String sourceBucket,
|
||||
ListenableFuture<ObjectMetadata> copyObject(@PathParam("sourceBucket") String sourceBucket,
|
||||
@PathParam("sourceObject") String sourceObject,
|
||||
@HostPrefixParam String destinationBucket,
|
||||
@PathParam("destinationObject") String destinationObject, CopyObjectOptions... options);
|
||||
|
@ -236,7 +239,7 @@ public interface S3AsyncClient {
|
|||
@XMLResponseParser(AccessControlListHandler.class)
|
||||
@ExceptionParser(ThrowContainerNotFoundOn404.class)
|
||||
@Path("/")
|
||||
Future<AccessControlList> getBucketACL(@HostPrefixParam String bucketName);
|
||||
ListenableFuture<AccessControlList> getBucketACL(@HostPrefixParam String bucketName);
|
||||
|
||||
/**
|
||||
* @see S3Client#putBucketACL
|
||||
|
@ -244,7 +247,7 @@ public interface S3AsyncClient {
|
|||
@PUT
|
||||
@Path("/")
|
||||
@QueryParams(keys = "acl")
|
||||
Future<Boolean> putBucketACL(@HostPrefixParam String bucketName,
|
||||
ListenableFuture<Boolean> putBucketACL(@HostPrefixParam String bucketName,
|
||||
@BinderParam(BindACLToXMLPayload.class) AccessControlList acl);
|
||||
|
||||
/**
|
||||
|
@ -255,7 +258,7 @@ public interface S3AsyncClient {
|
|||
@Path("{key}")
|
||||
@XMLResponseParser(AccessControlListHandler.class)
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
Future<AccessControlList> getObjectACL(@HostPrefixParam String bucketName,
|
||||
ListenableFuture<AccessControlList> getObjectACL(@HostPrefixParam String bucketName,
|
||||
@PathParam("key") String key);
|
||||
|
||||
/**
|
||||
|
@ -264,7 +267,8 @@ public interface S3AsyncClient {
|
|||
@PUT
|
||||
@QueryParams(keys = "acl")
|
||||
@Path("{key}")
|
||||
Future<Boolean> putObjectACL(@HostPrefixParam String bucketName, @PathParam("key") String key,
|
||||
ListenableFuture<Boolean> putObjectACL(@HostPrefixParam String bucketName,
|
||||
@PathParam("key") String key,
|
||||
@BinderParam(BindACLToXMLPayload.class) AccessControlList acl);
|
||||
|
||||
/**
|
||||
|
@ -275,7 +279,7 @@ public interface S3AsyncClient {
|
|||
@XMLResponseParser(BucketLoggingHandler.class)
|
||||
@ExceptionParser(ThrowContainerNotFoundOn404.class)
|
||||
@Path("/")
|
||||
Future<BucketLogging> getBucketLogging(@HostPrefixParam String bucketName);
|
||||
ListenableFuture<BucketLogging> getBucketLogging(@HostPrefixParam String bucketName);
|
||||
|
||||
/**
|
||||
* @see S3Client#enableBucketLogging
|
||||
|
@ -283,7 +287,7 @@ public interface S3AsyncClient {
|
|||
@PUT
|
||||
@Path("/")
|
||||
@QueryParams(keys = "logging")
|
||||
Future<Void> enableBucketLogging(@HostPrefixParam String bucketName,
|
||||
ListenableFuture<Void> enableBucketLogging(@HostPrefixParam String bucketName,
|
||||
@BinderParam(BindBucketLoggingToXmlPayload.class) BucketLogging logging);
|
||||
|
||||
/**
|
||||
|
@ -292,7 +296,7 @@ public interface S3AsyncClient {
|
|||
@PUT
|
||||
@Path("/")
|
||||
@QueryParams(keys = "logging")
|
||||
Future<Void> disableBucketLogging(
|
||||
ListenableFuture<Void> disableBucketLogging(
|
||||
@BinderParam(BindNoBucketLoggingToXmlPayload.class) @HostPrefixParam String bucketName);
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.aws.s3;
|
|||
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.aws.s3.domain.AccessControlList;
|
||||
|
@ -38,11 +37,13 @@ import org.jclouds.aws.s3.options.PutObjectOptions;
|
|||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to S3 via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from S3. Any exceptions incurred during processing
|
||||
* will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from S3. Any exceptions incurred during processing
|
||||
* will be wrapped in an {@link ExecutionException} as documented in {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
* @author James Murty
|
||||
|
@ -77,7 +78,7 @@ public interface S3Client {
|
|||
* namespace of the object you are retrieving
|
||||
* @param key
|
||||
* unique key in the s3Bucket identifying the object
|
||||
* @return Future reference to a fully populated S3Object including data stored in S3 or
|
||||
* @return ListenableFuture reference to a fully populated S3Object including data stored in S3 or
|
||||
* {@link S3Object#NOT_FOUND} if not present.
|
||||
*
|
||||
* @throws org.jclouds.http.HttpResponseException
|
||||
|
@ -216,7 +217,7 @@ public interface S3Client {
|
|||
*
|
||||
* @param bucketName
|
||||
* namespace of the objects you wish to list
|
||||
* @return Future reference to a fully populated S3Bucket including metadata of the S3Objects it
|
||||
* @return ListenableFuture reference to a fully populated S3Bucket including metadata of the S3Objects it
|
||||
* contains or {@link BoundedList<ObjectMetadata>#NOT_FOUND} if not present.
|
||||
* @see ListBucketOptions
|
||||
*
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
*/
|
||||
package org.jclouds.aws.s3.blobstore;
|
||||
|
||||
import static com.google.common.util.concurrent.Futures.compose;
|
||||
import static com.google.common.util.concurrent.Futures.makeListenable;
|
||||
import static org.jclouds.blobstore.options.ListContainerOptions.Builder.recursive;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -59,8 +60,12 @@ import org.jclouds.logging.Logger.LoggerFactory;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import static com.google.common.util.concurrent.Futures.*;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class S3AsyncBlobStore extends BaseS3BlobStore implements AsyncBlobStore {
|
||||
|
||||
@Inject
|
||||
|
@ -80,7 +85,7 @@ public class S3AsyncBlobStore extends BaseS3BlobStore implements AsyncBlobStore
|
|||
/**
|
||||
* This implementation uses the S3 HEAD Object command to return the result
|
||||
*/
|
||||
public Future<BlobMetadata> blobMetadata(String container, String key) {
|
||||
public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) {
|
||||
return compose(makeListenable(async.headObject(container, key)),
|
||||
new Function<ObjectMetadata, BlobMetadata>() {
|
||||
|
||||
|
@ -92,19 +97,19 @@ public class S3AsyncBlobStore extends BaseS3BlobStore implements AsyncBlobStore
|
|||
}, service);
|
||||
}
|
||||
|
||||
public Future<Void> clearContainer(final String container) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> clearContainer(final String container) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
clearContainerStrategy.execute(container, recursive());
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Void> deleteContainer(final String container) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> deleteContainer(final String container) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
clearContainerStrategy.execute(container, recursive());
|
||||
|
@ -112,30 +117,30 @@ public class S3AsyncBlobStore extends BaseS3BlobStore implements AsyncBlobStore
|
|||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> createContainer(String container) {
|
||||
public ListenableFuture<Boolean> createContainer(String container) {
|
||||
return async.putBucketIfNotExists(container);
|
||||
}
|
||||
|
||||
public Future<Boolean> containerExists(String container) {
|
||||
public ListenableFuture<Boolean> containerExists(String container) {
|
||||
return async.bucketExists(container);
|
||||
}
|
||||
|
||||
public Future<Void> createDirectory(final String container, final String directory) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> createDirectory(final String container, final String directory) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
mkdirStrategy.execute(S3AsyncBlobStore.this, container, directory);
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> directoryExists(final String container, final String directory) {
|
||||
return service.submit(new Callable<Boolean>() {
|
||||
public ListenableFuture<Boolean> directoryExists(final String container, final String directory) {
|
||||
return makeListenable(service.submit(new Callable<Boolean>() {
|
||||
|
||||
public Boolean call() throws Exception {
|
||||
try {
|
||||
|
@ -146,19 +151,18 @@ public class S3AsyncBlobStore extends BaseS3BlobStore implements AsyncBlobStore
|
|||
}
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Blob> getBlob(String container, String key,
|
||||
public ListenableFuture<Blob> getBlob(String container, String key,
|
||||
org.jclouds.blobstore.options.GetOptions... optionsList) {
|
||||
GetOptions httpOptions = blob2ObjectGetOptions.apply(optionsList);
|
||||
return compose(makeListenable(async.getObject(container, key, httpOptions)), object2Blob,
|
||||
service);
|
||||
return compose(async.getObject(container, key, httpOptions), object2Blob, service);
|
||||
}
|
||||
|
||||
public Future<? extends ListResponse<? extends ResourceMetadata>> list() {
|
||||
public ListenableFuture<? extends ListResponse<? extends ResourceMetadata>> list() {
|
||||
return compose(
|
||||
makeListenable(async.listOwnedBuckets()),
|
||||
async.listOwnedBuckets(),
|
||||
new Function<SortedSet<BucketMetadata>, org.jclouds.blobstore.domain.ListResponse<? extends ResourceMetadata>>() {
|
||||
public org.jclouds.blobstore.domain.ListResponse<? extends ResourceMetadata> apply(
|
||||
SortedSet<BucketMetadata> from) {
|
||||
|
@ -168,18 +172,18 @@ public class S3AsyncBlobStore extends BaseS3BlobStore implements AsyncBlobStore
|
|||
}, service);
|
||||
}
|
||||
|
||||
public Future<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
public ListenableFuture<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
String container, ListContainerOptions... optionsList) {
|
||||
ListBucketOptions httpOptions = container2BucketListOptions.apply(optionsList);
|
||||
Future<ListBucketResponse> returnVal = async.listBucket(container, httpOptions);
|
||||
return compose(makeListenable(returnVal), bucket2ResourceList, service);
|
||||
ListenableFuture<ListBucketResponse> returnVal = async.listBucket(container, httpOptions);
|
||||
return compose(returnVal, bucket2ResourceList, service);
|
||||
}
|
||||
|
||||
public Future<String> putBlob(String container, Blob blob) {
|
||||
public ListenableFuture<String> putBlob(String container, Blob blob) {
|
||||
return async.putObject(container, blob2Object.apply(blob));
|
||||
}
|
||||
|
||||
public Future<Void> removeBlob(String container, String key) {
|
||||
public ListenableFuture<Void> removeBlob(String container, String key) {
|
||||
return async.deleteObject(container, key);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ import com.google.common.collect.Multimap;
|
|||
* <p/>
|
||||
* // this will copy the object, provided it wasn't modified since yesterday.
|
||||
* // it will not use metadata from the source, and instead use what we pass in.
|
||||
* Future<S3Object.Metadata> object = connection.copyObject("sourceBucket", "objectName",
|
||||
* ListenableFuture<S3Object.Metadata> object = connection.copyObject("sourceBucket", "objectName",
|
||||
* "destinationBucket", "destinationName",
|
||||
* overrideMetadataWith(meta).
|
||||
* ifSourceModifiedSince(new Date().minusDays(1))
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
|
|||
* import static org.jclouds.aws.s3.commands.options.GetBucketOptions.Builder.*
|
||||
* <p/>
|
||||
* S3Client connection = // get connection
|
||||
* Future<S3Bucket> bucket = connection.listBucket("bucketName",withPrefix("home/users").maxKeys(1000));
|
||||
* ListenableFuture<S3Bucket> bucket = connection.listBucket("bucketName",withPrefix("home/users").maxKeys(1000));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.jclouds.http.options.BaseHttpRequestOptions;
|
|||
* import org.jclouds.aws.s3.S3Client;
|
||||
* <p/>
|
||||
* S3Client connection = // get connection
|
||||
* Future<Boolean> createdInEu = connection.putBucketIfNotExists("bucketName",createIn(EU));
|
||||
* ListenableFuture<Boolean> createdInEu = connection.putBucketIfNotExists("bucketName",createIn(EU));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -37,7 +37,7 @@ import static com.google.common.base.Preconditions.*;
|
|||
* import org.jclouds.aws.s3.S3Client;
|
||||
*
|
||||
* S3Client connection = // get connection
|
||||
* Future<Boolean> publicly readable = connection.putObject("bucketName",new S3Object("key","value"), withAcl(CannedAccessPolicy.PUBLIC_READ));
|
||||
* ListenableFuture<Boolean> publicly readable = connection.putObject("bucketName",new S3Object("key","value"), withAcl(CannedAccessPolicy.PUBLIC_READ));
|
||||
* <code>
|
||||
*
|
||||
* @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTObjectPUT.html?"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.aws.s3.internal;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.util.concurrent.Futures.compose;
|
||||
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
|
||||
import static com.google.common.util.concurrent.Futures.immediateFuture;
|
||||
|
||||
|
@ -27,7 +28,6 @@ import java.util.Map;
|
|||
import java.util.SortedSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -70,6 +70,7 @@ import com.google.common.base.Function;
|
|||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Implementation of {@link S3AsyncBlobStore} which keeps all data in a local Map object.
|
||||
|
@ -122,7 +123,8 @@ public class StubS3AsyncClient implements S3AsyncClient {
|
|||
|
||||
public static final String DEFAULT_OWNER_ID = "abc123";
|
||||
|
||||
public Future<Boolean> putBucketIfNotExists(String name, PutBucketOptions... optionsList) {
|
||||
public ListenableFuture<Boolean> putBucketIfNotExists(String name,
|
||||
PutBucketOptions... optionsList) {
|
||||
final PutBucketOptions options = (optionsList.length == 0) ? new PutBucketOptions()
|
||||
: optionsList[0];
|
||||
if (options.getLocationConstraint() != null)
|
||||
|
@ -131,15 +133,15 @@ public class StubS3AsyncClient implements S3AsyncClient {
|
|||
return blobStore.createContainer(name);
|
||||
}
|
||||
|
||||
public Future<ListBucketResponse> listBucket(final String name, ListBucketOptions... optionsList) {
|
||||
public ListenableFuture<ListBucketResponse> listBucket(final String name,
|
||||
ListBucketOptions... optionsList) {
|
||||
ListContainerOptions options = bucket2ContainerListOptions.apply(optionsList);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.list(name, options)),
|
||||
resource2BucketList);
|
||||
return compose(blobStore.list(name, options), resource2BucketList);
|
||||
}
|
||||
|
||||
public Future<ObjectMetadata> copyObject(final String sourceBucket, final String sourceObject,
|
||||
final String destinationBucket, final String destinationObject,
|
||||
CopyObjectOptions... nullableOptions) {
|
||||
public ListenableFuture<ObjectMetadata> copyObject(final String sourceBucket,
|
||||
final String sourceObject, final String destinationBucket,
|
||||
final String destinationObject, CopyObjectOptions... nullableOptions) {
|
||||
final CopyObjectOptions options = (nullableOptions.length == 0) ? new CopyObjectOptions()
|
||||
: nullableOptions[0];
|
||||
ConcurrentMap<String, Blob> source = blobStore.getContainerToBlobs().get(sourceBucket);
|
||||
|
@ -179,7 +181,7 @@ public class StubS3AsyncClient implements S3AsyncClient {
|
|||
return immediateFailedFuture(new KeyNotFoundException(sourceBucket, sourceObject));
|
||||
}
|
||||
|
||||
public Future<String> putObject(final String bucketName, final S3Object object,
|
||||
public ListenableFuture<String> putObject(final String bucketName, final S3Object object,
|
||||
PutObjectOptions... nullableOptions) {
|
||||
final PutObjectOptions options = (nullableOptions.length == 0) ? new PutObjectOptions()
|
||||
: nullableOptions[0];
|
||||
|
@ -204,11 +206,12 @@ public class StubS3AsyncClient implements S3AsyncClient {
|
|||
return acl;
|
||||
}
|
||||
|
||||
public Future<AccessControlList> getBucketACL(final String bucket) {
|
||||
public ListenableFuture<AccessControlList> getBucketACL(final String bucket) {
|
||||
return immediateFuture(getACLforS3Item(bucket));
|
||||
}
|
||||
|
||||
public Future<AccessControlList> getObjectACL(final String bucket, final String objectKey) {
|
||||
public ListenableFuture<AccessControlList> getObjectACL(final String bucket,
|
||||
final String objectKey) {
|
||||
return immediateFuture(getACLforS3Item(bucket + "/" + objectKey));
|
||||
}
|
||||
|
||||
|
@ -235,38 +238,37 @@ public class StubS3AsyncClient implements S3AsyncClient {
|
|||
return acl;
|
||||
}
|
||||
|
||||
public Future<Boolean> putBucketACL(final String bucket, final AccessControlList acl) {
|
||||
public ListenableFuture<Boolean> putBucketACL(final String bucket, final AccessControlList acl) {
|
||||
keyToAcl.put(bucket, sanitizeUploadedACL(acl));
|
||||
return immediateFuture(true);
|
||||
}
|
||||
|
||||
public Future<Boolean> putObjectACL(final String bucket, final String objectKey,
|
||||
public ListenableFuture<Boolean> putObjectACL(final String bucket, final String objectKey,
|
||||
final AccessControlList acl) {
|
||||
keyToAcl.put(bucket + "/" + objectKey, sanitizeUploadedACL(acl));
|
||||
return immediateFuture(true);
|
||||
}
|
||||
|
||||
public Future<Boolean> bucketExists(final String bucketName) {
|
||||
public ListenableFuture<Boolean> bucketExists(final String bucketName) {
|
||||
return immediateFuture(blobStore.getContainerToBlobs().containsKey(bucketName));
|
||||
}
|
||||
|
||||
public Future<Boolean> deleteBucketIfEmpty(String bucketName) {
|
||||
public ListenableFuture<Boolean> deleteBucketIfEmpty(String bucketName) {
|
||||
return blobStore.deleteContainerImpl(bucketName);
|
||||
}
|
||||
|
||||
public Future<Void> deleteObject(String bucketName, String key) {
|
||||
public ListenableFuture<Void> deleteObject(String bucketName, String key) {
|
||||
return blobStore.removeBlob(bucketName, key);
|
||||
}
|
||||
|
||||
public Future<S3Object> getObject(final String bucketName, final String key,
|
||||
public ListenableFuture<S3Object> getObject(final String bucketName, final String key,
|
||||
final GetOptions... options) {
|
||||
org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options);
|
||||
return Futures.compose(
|
||||
Futures.makeListenable(blobStore.getBlob(bucketName, key, getOptions)), blob2Object);
|
||||
return compose(blobStore.getBlob(bucketName, key, getOptions), blob2Object);
|
||||
}
|
||||
|
||||
public Future<ObjectMetadata> headObject(String bucketName, String key) {
|
||||
return Futures.compose(Futures.makeListenable(blobStore.blobMetadata(bucketName, key)),
|
||||
public ListenableFuture<ObjectMetadata> headObject(String bucketName, String key) {
|
||||
return compose(Futures.makeListenable(blobStore.blobMetadata(bucketName, key)),
|
||||
new Function<BlobMetadata, ObjectMetadata>() {
|
||||
@Override
|
||||
public ObjectMetadata apply(BlobMetadata from) {
|
||||
|
@ -275,7 +277,7 @@ public class StubS3AsyncClient implements S3AsyncClient {
|
|||
});
|
||||
}
|
||||
|
||||
public Future<? extends SortedSet<BucketMetadata>> listOwnedBuckets() {
|
||||
public ListenableFuture<? extends SortedSet<BucketMetadata>> listOwnedBuckets() {
|
||||
return immediateFuture(Sets.newTreeSet(Iterables.transform(blobStore.getContainerToBlobs()
|
||||
.keySet(), new Function<String, BucketMetadata>() {
|
||||
public BucketMetadata apply(String name) {
|
||||
|
@ -290,33 +292,33 @@ public class StubS3AsyncClient implements S3AsyncClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Future<LocationConstraint> getBucketLocation(String bucketName) {
|
||||
public ListenableFuture<LocationConstraint> getBucketLocation(String bucketName) {
|
||||
return immediateFuture(LocationConstraint.US_STANDARD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Payer> getBucketPayer(String bucketName) {
|
||||
public ListenableFuture<Payer> getBucketPayer(String bucketName) {
|
||||
return immediateFuture(Payer.BUCKET_OWNER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Void> setBucketPayer(String bucketName, Payer payer) {
|
||||
public ListenableFuture<Void> setBucketPayer(String bucketName, Payer payer) {
|
||||
return immediateFuture(null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Void> disableBucketLogging(String bucketName) {
|
||||
public ListenableFuture<Void> disableBucketLogging(String bucketName) {
|
||||
return immediateFuture(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<Void> enableBucketLogging(String bucketName, BucketLogging logging) {
|
||||
public ListenableFuture<Void> enableBucketLogging(String bucketName, BucketLogging logging) {
|
||||
return immediateFuture(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<BucketLogging> getBucketLogging(String bucketName) {
|
||||
public ListenableFuture<BucketLogging> getBucketLogging(String bucketName) {
|
||||
return immediateFuture(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class JCloudsS3Service extends S3Service {
|
|||
* @param awsCredentials
|
||||
* - credentials to access S3
|
||||
* @param modules
|
||||
* - Module that configures a FutureHttpClient, if not specified, default is
|
||||
* - Module that configures a ListenableFutureHttpClient, if not specified, default is
|
||||
* URLFetchServiceClientModule
|
||||
* @throws S3ServiceException
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.azure.storage.blob;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -67,11 +66,14 @@ import org.jclouds.rest.annotations.ResponseParser;
|
|||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Azure Blob via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Azure Blob. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from Azure Blob. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see <a href="http://msdn.microsoft.com/en-us/library/dd135733.aspx" />
|
||||
* @see AzureBlobClient
|
||||
|
@ -93,7 +95,7 @@ public interface AzureBlobAsyncClient {
|
|||
@XMLResponseParser(AccountNameEnumerationResultsHandler.class)
|
||||
@Path("/")
|
||||
@QueryParams(keys = "comp", values = "list")
|
||||
Future<? extends BoundedSortedSet<ListableContainerProperties>> listContainers(
|
||||
ListenableFuture<? extends BoundedSortedSet<ListableContainerProperties>> listContainers(
|
||||
ListOptions... listOptions);
|
||||
|
||||
/**
|
||||
|
@ -103,7 +105,7 @@ public interface AzureBlobAsyncClient {
|
|||
@Path("{container}")
|
||||
@ExceptionParser(ReturnTrueIfContainerAlreadyExists.class)
|
||||
@QueryParams(keys = "restype", values = "container")
|
||||
Future<Boolean> createContainer(@PathParam("container") String container,
|
||||
ListenableFuture<Boolean> createContainer(@PathParam("container") String container,
|
||||
CreateContainerOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -113,7 +115,7 @@ public interface AzureBlobAsyncClient {
|
|||
@Path("{container}")
|
||||
@QueryParams(keys = "restype", values = "container")
|
||||
@ResponseParser(ParseContainerPropertiesFromHeaders.class)
|
||||
Future<ListableContainerProperties> getContainerProperties(
|
||||
ListenableFuture<ListableContainerProperties> getContainerProperties(
|
||||
@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
|
@ -123,7 +125,7 @@ public interface AzureBlobAsyncClient {
|
|||
@Path("{container}")
|
||||
@QueryParams(keys = "restype", values = "container")
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
Future<Boolean> containerExists(@PathParam("container") String container);
|
||||
ListenableFuture<Boolean> containerExists(@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
* @see AzureBlobClient#setResourceMetadata
|
||||
|
@ -131,7 +133,7 @@ public interface AzureBlobAsyncClient {
|
|||
@PUT
|
||||
@Path("{container}")
|
||||
@QueryParams(keys = { "restype", "comp" }, values = { "container", "metadata" })
|
||||
Future<Void> setResourceMetadata(@PathParam("container") String container,
|
||||
ListenableFuture<Void> setResourceMetadata(@PathParam("container") String container,
|
||||
@BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata);
|
||||
|
||||
/**
|
||||
|
@ -141,7 +143,7 @@ public interface AzureBlobAsyncClient {
|
|||
@Path("{container}")
|
||||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
@QueryParams(keys = "restype", values = "container")
|
||||
Future<Void> deleteContainer(@PathParam("container") String container);
|
||||
ListenableFuture<Void> deleteContainer(@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
* @see AzureBlobClient#createRootContainer
|
||||
|
@ -150,7 +152,7 @@ public interface AzureBlobAsyncClient {
|
|||
@Path("$root")
|
||||
@ExceptionParser(ReturnTrueIfContainerAlreadyExists.class)
|
||||
@QueryParams(keys = "restype", values = "container")
|
||||
Future<Boolean> createRootContainer(CreateContainerOptions... options);
|
||||
ListenableFuture<Boolean> createRootContainer(CreateContainerOptions... options);
|
||||
|
||||
/**
|
||||
* @see AzureBlobClient#deleteRootContainer
|
||||
|
@ -159,7 +161,7 @@ public interface AzureBlobAsyncClient {
|
|||
@Path("$root")
|
||||
@ExceptionParser(ReturnTrueOn404.class)
|
||||
@QueryParams(keys = "restype", values = "container")
|
||||
Future<Boolean> deleteRootContainer();
|
||||
ListenableFuture<Boolean> deleteRootContainer();
|
||||
|
||||
/**
|
||||
* @see AzureBlobClient#listBlobs(String, ListBlobsOptions)
|
||||
|
@ -168,7 +170,7 @@ public interface AzureBlobAsyncClient {
|
|||
@XMLResponseParser(ContainerNameEnumerationResultsHandler.class)
|
||||
@Path("{container}")
|
||||
@QueryParams(keys = { "restype", "comp" }, values = { "container", "list" })
|
||||
Future<ListBlobsResponse> listBlobs(@PathParam("container") String container,
|
||||
ListenableFuture<ListBlobsResponse> listBlobs(@PathParam("container") String container,
|
||||
ListBlobsOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -178,7 +180,7 @@ public interface AzureBlobAsyncClient {
|
|||
@XMLResponseParser(ContainerNameEnumerationResultsHandler.class)
|
||||
@Path("$root")
|
||||
@QueryParams(keys = { "restype", "comp" }, values = { "container", "list" })
|
||||
Future<ListBlobsResponse> listBlobs(ListBlobsOptions... options);
|
||||
ListenableFuture<ListBlobsResponse> listBlobs(ListBlobsOptions... options);
|
||||
|
||||
/**
|
||||
* @see AzureBlobClient#putBlob
|
||||
|
@ -186,7 +188,7 @@ public interface AzureBlobAsyncClient {
|
|||
@PUT
|
||||
@Path("{container}/{name}")
|
||||
@ResponseParser(ParseETagHeader.class)
|
||||
Future<String> putBlob(
|
||||
ListenableFuture<String> putBlob(
|
||||
@PathParam("container") String container,
|
||||
@PathParam("name") @ParamParser(BlobName.class) @BinderParam(BindAzureBlobToPayload.class) org.jclouds.azure.storage.blob.domain.AzureBlob object);
|
||||
|
||||
|
@ -197,7 +199,7 @@ public interface AzureBlobAsyncClient {
|
|||
@ResponseParser(ParseBlobFromHeadersAndHttpContent.class)
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@Path("{container}/{name}")
|
||||
Future<org.jclouds.azure.storage.blob.domain.AzureBlob> getBlob(
|
||||
ListenableFuture<org.jclouds.azure.storage.blob.domain.AzureBlob> getBlob(
|
||||
@PathParam("container") String container, @PathParam("name") String name,
|
||||
GetOptions... options);
|
||||
|
||||
|
@ -208,7 +210,7 @@ public interface AzureBlobAsyncClient {
|
|||
@ResponseParser(ParseBlobPropertiesFromHeaders.class)
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@Path("{container}/{name}")
|
||||
Future<BlobProperties> getBlobProperties(@PathParam("container") String container,
|
||||
ListenableFuture<BlobProperties> getBlobProperties(@PathParam("container") String container,
|
||||
@PathParam("name") String name);
|
||||
|
||||
/**
|
||||
|
@ -217,7 +219,7 @@ public interface AzureBlobAsyncClient {
|
|||
@PUT
|
||||
@Path("{container}/{name}")
|
||||
@QueryParams(keys = { "comp" }, values = { "metadata" })
|
||||
Future<Void> setBlobMetadata(@PathParam("container") String container,
|
||||
ListenableFuture<Void> setBlobMetadata(@PathParam("container") String container,
|
||||
@PathParam("name") String name,
|
||||
@BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> metadata);
|
||||
|
||||
|
@ -227,6 +229,7 @@ public interface AzureBlobAsyncClient {
|
|||
@DELETE
|
||||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
@Path("{container}/{name}")
|
||||
Future<Void> deleteBlob(@PathParam("container") String container, @PathParam("name") String name);
|
||||
ListenableFuture<Void> deleteBlob(@PathParam("container") String container,
|
||||
@PathParam("name") String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.azure.storage.blob;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.azure.storage.blob.domain.BlobProperties;
|
||||
|
@ -33,11 +32,14 @@ import org.jclouds.azure.storage.options.ListOptions;
|
|||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Azure Blob via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Azure Blob. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from Azure Blob. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see <a href="http://msdn.microsoft.com/en-us/library/dd135733.aspx" />
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -25,7 +25,6 @@ import static org.jclouds.blobstore.options.ListContainerOptions.Builder.recursi
|
|||
import java.util.SortedSet;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -61,7 +60,12 @@ import org.jclouds.logging.Logger.LoggerFactory;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class AzureAsyncBlobStore extends BaseAzureBlobStore implements AsyncBlobStore {
|
||||
|
||||
@Inject
|
||||
|
@ -82,8 +86,8 @@ public class AzureAsyncBlobStore extends BaseAzureBlobStore implements AsyncBlob
|
|||
/**
|
||||
* This implementation uses the AzureBlob HEAD Object command to return the result
|
||||
*/
|
||||
public Future<BlobMetadata> blobMetadata(String container, String key) {
|
||||
return compose(makeListenable(async.getBlobProperties(container, key)),
|
||||
public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) {
|
||||
return compose(async.getBlobProperties(container, key),
|
||||
new Function<BlobProperties, BlobMetadata>() {
|
||||
|
||||
@Override
|
||||
|
@ -94,40 +98,40 @@ public class AzureAsyncBlobStore extends BaseAzureBlobStore implements AsyncBlob
|
|||
}, service);
|
||||
}
|
||||
|
||||
public Future<Void> clearContainer(final String container) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> clearContainer(final String container) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
clearContainerStrategy.execute(container, recursive());
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> createContainer(String container) {
|
||||
public ListenableFuture<Boolean> createContainer(String container) {
|
||||
return async.createContainer(container);
|
||||
}
|
||||
|
||||
public Future<Void> deleteContainer(final String container) {
|
||||
public ListenableFuture<Void> deleteContainer(final String container) {
|
||||
return async.deleteContainer(container);
|
||||
|
||||
}
|
||||
|
||||
public Future<Boolean> containerExists(String container) {
|
||||
public ListenableFuture<Boolean> containerExists(String container) {
|
||||
return async.containerExists(container);
|
||||
}
|
||||
|
||||
public Future<Blob> getBlob(String container, String key,
|
||||
public ListenableFuture<Blob> getBlob(String container, String key,
|
||||
org.jclouds.blobstore.options.GetOptions... optionsList) {
|
||||
GetOptions httpOptions = blob2ObjectGetOptions.apply(optionsList);
|
||||
Future<AzureBlob> returnVal = async.getBlob(container, key, httpOptions);
|
||||
return compose(makeListenable(returnVal), object2Blob, service);
|
||||
ListenableFuture<AzureBlob> returnVal = async.getBlob(container, key, httpOptions);
|
||||
return compose(returnVal, object2Blob, service);
|
||||
}
|
||||
|
||||
public Future<? extends org.jclouds.blobstore.domain.ListResponse<? extends ResourceMetadata>> list() {
|
||||
public ListenableFuture<? extends org.jclouds.blobstore.domain.ListResponse<? extends ResourceMetadata>> list() {
|
||||
return compose(
|
||||
makeListenable(async.listContainers()),
|
||||
async.listContainers(),
|
||||
new Function<SortedSet<ListableContainerProperties>, org.jclouds.blobstore.domain.ListResponse<? extends ResourceMetadata>>() {
|
||||
public org.jclouds.blobstore.domain.ListResponse<? extends ResourceMetadata> apply(
|
||||
SortedSet<ListableContainerProperties> from) {
|
||||
|
@ -137,34 +141,34 @@ public class AzureAsyncBlobStore extends BaseAzureBlobStore implements AsyncBlob
|
|||
}, service);
|
||||
}
|
||||
|
||||
public Future<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
public ListenableFuture<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
String container, ListContainerOptions... optionsList) {
|
||||
ListBlobsOptions httpOptions = container2ContainerListOptions.apply(optionsList);
|
||||
Future<ListBlobsResponse> returnVal = async.listBlobs(container, httpOptions);
|
||||
return compose(makeListenable(returnVal), container2ResourceList, service);
|
||||
ListenableFuture<ListBlobsResponse> returnVal = async.listBlobs(container, httpOptions);
|
||||
return compose(returnVal, container2ResourceList, service);
|
||||
}
|
||||
|
||||
public Future<String> putBlob(String container, Blob blob) {
|
||||
public ListenableFuture<String> putBlob(String container, Blob blob) {
|
||||
return async.putBlob(container, blob2Object.apply(blob));
|
||||
}
|
||||
|
||||
public Future<Void> removeBlob(String container, String key) {
|
||||
public ListenableFuture<Void> removeBlob(String container, String key) {
|
||||
return async.deleteBlob(container, key);
|
||||
}
|
||||
|
||||
public Future<Void> createDirectory(final String container, final String directory) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> createDirectory(final String container, final String directory) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
mkdirStrategy.execute(AzureAsyncBlobStore.this, container, directory);
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> directoryExists(final String container, final String directory) {
|
||||
return service.submit(new Callable<Boolean>() {
|
||||
public ListenableFuture<Boolean> directoryExists(final String container, final String directory) {
|
||||
return makeListenable(service.submit(new Callable<Boolean>() {
|
||||
|
||||
public Boolean call() throws Exception {
|
||||
try {
|
||||
|
@ -175,7 +179,7 @@ public class AzureAsyncBlobStore extends BaseAzureBlobStore implements AsyncBlob
|
|||
}
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.azure.storage.queue;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -42,6 +41,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Azure Queue via their REST API.
|
||||
* <p/>
|
||||
|
@ -55,8 +56,9 @@ import org.jclouds.rest.annotations.XMLResponseParser;
|
|||
* If you need to store messages larger than 8 KB, you can store message data as a blob or in a
|
||||
* table, and then store a reference to the data as a message in a queue.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Azure Queue. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from Azure Queue. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see <a href="http://msdn.microsoft.com/en-us/library/dd135733.aspx" />
|
||||
* @author Adrian Cole
|
||||
|
@ -74,7 +76,8 @@ public interface AzureQueueAsyncClient {
|
|||
@XMLResponseParser(AccountNameEnumerationResultsHandler.class)
|
||||
@Path("/")
|
||||
@QueryParams(keys = "comp", values = "list")
|
||||
Future<? extends BoundedSortedSet<QueueMetadata>> listQueues(ListOptions... listOptions);
|
||||
ListenableFuture<? extends BoundedSortedSet<QueueMetadata>> listQueues(
|
||||
ListOptions... listOptions);
|
||||
|
||||
/**
|
||||
* @see AzureQueueClient#createQueue
|
||||
|
@ -82,7 +85,7 @@ public interface AzureQueueAsyncClient {
|
|||
@PUT
|
||||
@Path("{queue}")
|
||||
@QueryParams(keys = "restype", values = "queue")
|
||||
Future<Boolean> createQueue(@PathParam("queue") String queue, CreateOptions... options);
|
||||
ListenableFuture<Boolean> createQueue(@PathParam("queue") String queue, CreateOptions... options);
|
||||
|
||||
/**
|
||||
* @see AzureQueueClient#deleteQueue
|
||||
|
@ -90,6 +93,6 @@ public interface AzureQueueAsyncClient {
|
|||
@DELETE
|
||||
@Path("{queue}")
|
||||
@QueryParams(keys = "restype", values = "queue")
|
||||
Future<Boolean> deleteQueue(@PathParam("queue") String queue);
|
||||
ListenableFuture<Boolean> deleteQueue(@PathParam("queue") String queue);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.azure.storage.queue;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.PathParam;
|
||||
|
@ -30,6 +29,8 @@ import org.jclouds.azure.storage.options.ListOptions;
|
|||
import org.jclouds.azure.storage.queue.domain.QueueMetadata;
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Azure Queue via their REST API.
|
||||
* <p/>
|
||||
|
@ -43,8 +44,9 @@ import org.jclouds.concurrent.Timeout;
|
|||
* If you need to store messages larger than 8 KB, you can store message data as a blob or in a
|
||||
* table, and then store a reference to the data as a message in a queue.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Azure Queue. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from Azure Queue. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see AzureQueueAsyncClient
|
||||
* @see <a href="http://msdn.microsoft.com/en-us/library/dd135733.aspx" />
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
package org.jclouds.azure.storage.blob.internal;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.util.concurrent.Futures.compose;
|
||||
import static com.google.common.util.concurrent.Futures.immediateFuture;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -55,7 +55,7 @@ import org.jclouds.http.options.GetOptions;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Implementation of {@link AzureBlobAsyncClient} which keeps all data in a local Map object.
|
||||
|
@ -94,35 +94,36 @@ public class StubAzureBlobAsyncClient implements AzureBlobAsyncClient {
|
|||
this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList");
|
||||
}
|
||||
|
||||
public Future<Boolean> createContainer(String container, CreateContainerOptions... options) {
|
||||
public ListenableFuture<Boolean> createContainer(String container,
|
||||
CreateContainerOptions... options) {
|
||||
return blobStore.createContainer(container);
|
||||
}
|
||||
|
||||
public Future<Boolean> createRootContainer(CreateContainerOptions... options) {
|
||||
public ListenableFuture<Boolean> createRootContainer(CreateContainerOptions... options) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<Void> deleteBlob(String container, String key) {
|
||||
public ListenableFuture<Void> deleteBlob(String container, String key) {
|
||||
return blobStore.removeBlob(container, key);
|
||||
}
|
||||
|
||||
public Future<Void> deleteContainer(final String container) {
|
||||
public ListenableFuture<Void> deleteContainer(final String container) {
|
||||
StubAzureBlobAsyncClient.this.containerToBlobs.remove(container);
|
||||
return immediateFuture(null);
|
||||
}
|
||||
|
||||
public Future<Boolean> deleteRootContainer() {
|
||||
public ListenableFuture<Boolean> deleteRootContainer() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<AzureBlob> getBlob(String container, String key, GetOptions... options) {
|
||||
public ListenableFuture<AzureBlob> getBlob(String container, String key, GetOptions... options) {
|
||||
org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.getBlob(container, key, getOptions)),
|
||||
return compose(blobStore.getBlob(container, key, getOptions),
|
||||
blob2Object);
|
||||
}
|
||||
|
||||
public Future<BlobProperties> getBlobProperties(String container, String key) {
|
||||
return Futures.compose(Futures.makeListenable(blobStore.blobMetadata(container, key)),
|
||||
public ListenableFuture<BlobProperties> getBlobProperties(String container, String key) {
|
||||
return compose(blobStore.blobMetadata(container, key),
|
||||
new Function<BlobMetadata, BlobProperties>() {
|
||||
|
||||
@Override
|
||||
|
@ -134,22 +135,22 @@ public class StubAzureBlobAsyncClient implements AzureBlobAsyncClient {
|
|||
});
|
||||
}
|
||||
|
||||
public Future<ListableContainerProperties> getContainerProperties(String container) {
|
||||
public ListenableFuture<ListableContainerProperties> getContainerProperties(String container) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<ListBlobsResponse> listBlobs(String container, ListBlobsOptions... optionsList) {
|
||||
public ListenableFuture<ListBlobsResponse> listBlobs(String container,
|
||||
ListBlobsOptions... optionsList) {
|
||||
org.jclouds.blobstore.options.ListContainerOptions options = container2ContainerListOptions
|
||||
.apply(optionsList);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.list(container, options)),
|
||||
resource2ObjectList);
|
||||
return compose(blobStore.list(container, options), resource2ObjectList);
|
||||
}
|
||||
|
||||
public Future<ListBlobsResponse> listBlobs(ListBlobsOptions... options) {
|
||||
public ListenableFuture<ListBlobsResponse> listBlobs(ListBlobsOptions... options) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<? extends BoundedSortedSet<ListableContainerProperties>> listContainers(
|
||||
public ListenableFuture<? extends BoundedSortedSet<ListableContainerProperties>> listContainers(
|
||||
ListOptions... listOptions) {
|
||||
return immediateFuture(new BoundedTreeSet<ListableContainerProperties>(Iterables.transform(
|
||||
blobStore.getContainerToBlobs().keySet(),
|
||||
|
@ -166,19 +167,20 @@ public class StubAzureBlobAsyncClient implements AzureBlobAsyncClient {
|
|||
return objectProvider.create(null);
|
||||
}
|
||||
|
||||
public Future<String> putBlob(String container, AzureBlob object) {
|
||||
public ListenableFuture<String> putBlob(String container, AzureBlob object) {
|
||||
return blobStore.putBlob(container, object2Blob.apply(object));
|
||||
}
|
||||
|
||||
public Future<Void> setBlobMetadata(String container, String key, Map<String, String> metadata) {
|
||||
public ListenableFuture<Void> setBlobMetadata(String container, String key,
|
||||
Map<String, String> metadata) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<Void> setResourceMetadata(String container, Map<String, String> metadata) {
|
||||
public ListenableFuture<Void> setResourceMetadata(String container, Map<String, String> metadata) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<Boolean> containerExists(final String container) {
|
||||
public ListenableFuture<Boolean> containerExists(final String container) {
|
||||
return immediateFuture(blobStore.getContainerToBlobs().containsKey(container));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import static com.google.common.util.concurrent.Executors.sameThreadExecutor;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -44,6 +43,7 @@ import org.jclouds.util.Jsr330;
|
|||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -62,7 +62,7 @@ public class SharedKeyAuthenticationLiveTest {
|
|||
@GET
|
||||
@Path("/")
|
||||
@QueryParams(keys = "comp", values = "list")
|
||||
Future<String> authenticate();
|
||||
ListenableFuture<String> authenticate();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,16 +18,16 @@
|
|||
*/
|
||||
package org.jclouds.blobstore;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.jclouds.blobstore.domain.BlobMetadata;
|
||||
import org.jclouds.blobstore.domain.ListResponse;
|
||||
import org.jclouds.blobstore.domain.ListContainerResponse;
|
||||
import org.jclouds.blobstore.domain.ListResponse;
|
||||
import org.jclouds.blobstore.domain.ResourceMetadata;
|
||||
import org.jclouds.blobstore.options.GetOptions;
|
||||
import org.jclouds.blobstore.options.ListContainerOptions;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides hooks needed to run a blob store asynchronously
|
||||
*
|
||||
|
@ -40,7 +40,7 @@ public interface AsyncBlobStore {
|
|||
/**
|
||||
* Lists all root-level resources available to the account.
|
||||
*/
|
||||
Future<? extends ListResponse<? extends ResourceMetadata>> list();
|
||||
ListenableFuture<? extends ListResponse<? extends ResourceMetadata>> list();
|
||||
|
||||
/**
|
||||
* Lists all resources available at the specified path. Note that path may be a container, or a
|
||||
|
@ -49,37 +49,37 @@ public interface AsyncBlobStore {
|
|||
* @param parent
|
||||
* - base path to list; non-recursive
|
||||
*/
|
||||
Future<? extends ListContainerResponse<? extends ResourceMetadata>> list(String container,
|
||||
ListenableFuture<? extends ListContainerResponse<? extends ResourceMetadata>> list(String container,
|
||||
ListContainerOptions... options);
|
||||
|
||||
Future<Boolean> containerExists(String container);
|
||||
ListenableFuture<Boolean> containerExists(String container);
|
||||
|
||||
Future<Boolean> directoryExists(String container, String directory);
|
||||
ListenableFuture<Boolean> directoryExists(String container, String directory);
|
||||
|
||||
Future<Boolean> createContainer(String container);
|
||||
ListenableFuture<Boolean> createContainer(String container);
|
||||
|
||||
Future<Void> createDirectory(String container, String directory);
|
||||
ListenableFuture<Void> createDirectory(String container, String directory);
|
||||
|
||||
/**
|
||||
* This will delete a container recursively.
|
||||
*
|
||||
* @param container
|
||||
*/
|
||||
Future<Void> deleteContainer(String container);
|
||||
ListenableFuture<Void> deleteContainer(String container);
|
||||
|
||||
/**
|
||||
* This will delete the contents of a container without removing it
|
||||
*
|
||||
* @param container
|
||||
*/
|
||||
Future<Void> clearContainer(String container);
|
||||
ListenableFuture<Void> clearContainer(String container);
|
||||
|
||||
Future<String> putBlob(String container, Blob blob);
|
||||
ListenableFuture<String> putBlob(String container, Blob blob);
|
||||
|
||||
Future<? extends Blob> getBlob(String container, String key, GetOptions... options);
|
||||
ListenableFuture<? extends Blob> getBlob(String container, String key, GetOptions... options);
|
||||
|
||||
Future<BlobMetadata> blobMetadata(String container, String key);
|
||||
ListenableFuture<BlobMetadata> blobMetadata(String container, String key);
|
||||
|
||||
Future<Void> removeBlob(String container, String key);
|
||||
ListenableFuture<Void> removeBlob(String container, String key);
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -43,6 +42,7 @@ import com.google.common.base.Throwables;
|
|||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Map representation of a live connection to a Blob Service.
|
||||
|
@ -153,12 +153,12 @@ public class BlobMapImpl extends BaseBlobMap<Blob> implements BlobMap {
|
|||
*/
|
||||
public void putAll(Map<? extends String, ? extends Blob> map) {
|
||||
try {
|
||||
Set<Future<String>> puts = Sets.newHashSet();
|
||||
Set<ListenableFuture<String>> puts = Sets.newHashSet();
|
||||
for (Blob object : map.values()) {
|
||||
// TODO: basename then add prefix
|
||||
puts.add(connection.putBlob(containerName, object));
|
||||
}
|
||||
for (Future<String> put : puts)
|
||||
for (ListenableFuture<String> put : puts)
|
||||
// this will throw an exception if there was a problem
|
||||
put.get(requestTimeoutMilliseconds, TimeUnit.MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -52,6 +51,7 @@ import com.google.common.base.Throwables;
|
|||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Map representation of a live connection to S3. All put operations will result in ETag
|
||||
|
@ -225,14 +225,14 @@ public class InputStreamMapImpl extends BaseBlobMap<InputStream> implements Inpu
|
|||
@VisibleForTesting
|
||||
void putAllInternal(Map<? extends String, ? extends Object> map) {
|
||||
try {
|
||||
Set<Future<String>> puts = Sets.newHashSet();
|
||||
Set<ListenableFuture<String>> puts = Sets.newHashSet();
|
||||
for (Map.Entry<? extends String, ? extends Object> entry : map.entrySet()) {
|
||||
Blob object = connection.newBlob(prefixer.apply(entry.getKey()));
|
||||
object.setPayload(Payloads.newPayload(entry.getValue()));
|
||||
object.generateMD5();
|
||||
puts.add(connection.putBlob(containerName, object));
|
||||
}
|
||||
for (Future<String> put : puts)
|
||||
for (ListenableFuture<String> put : puts)
|
||||
// this will throw an exception if there was a problem
|
||||
put.get(requestTimeoutMilliseconds, TimeUnit.MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
*
|
||||
*
|
||||
* // this will get the first megabyte of an object, provided it wasn't modified since yesterday
|
||||
* Future<S3Object> object = client.get("objectName",range(0,1024).ifUnmodifiedSince(new Date().minusDays(1)));
|
||||
* ListenableFuture<S3Object> object = client.get("objectName",range(0,1024).ifUnmodifiedSince(new Date().minusDays(1)));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -31,7 +31,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
* import static org.jclouds.blobstore.options.ListContainerOptions.Builder.*
|
||||
* <p/>
|
||||
* BlobStore connection = // get connection
|
||||
* Future<ListResponse<ResourceMetadata>> list = connection.list("container",inDirectory("home/users").maxResults(1000));
|
||||
* ListenableFuture<ListResponse<ResourceMetadata>> list = connection.list("container",inDirectory("home/users").maxResults(1000));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -30,7 +30,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
* import static org.jclouds.blobstore.options.ListOptions.Builder.*
|
||||
* <p/>
|
||||
* BlobStore connection = // get connection
|
||||
* Future<BoundedSortedSet<ResourceMetadata>> list = connection.list(maxResults(1000));
|
||||
* ListenableFuture<BoundedSortedSet<ResourceMetadata>> list = connection.list(maxResults(1000));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.blobstore.strategy.internal;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
@ -37,6 +36,7 @@ import org.jclouds.blobstore.strategy.ListBlobMetadataStrategy;
|
|||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
|
@ -66,12 +66,12 @@ public class DeleteAllKeysInList implements ClearListStrategy, ClearContainerStr
|
|||
}
|
||||
|
||||
public void execute(final String containerName, ListContainerOptions options) {
|
||||
Set<Future<Void>> deletes = Sets.newHashSet();
|
||||
Set<ListenableFuture<Void>> deletes = Sets.newHashSet();
|
||||
for (ResourceMetadata md : getAllBlobMetadata.execute(containerName, options)) {
|
||||
if (md.getType() == ResourceType.BLOB)
|
||||
deletes.add(connection.removeBlob(containerName, md.getName()));
|
||||
}
|
||||
for (Future<Void> isdeleted : deletes) {
|
||||
for (ListenableFuture<Void> isdeleted : deletes) {
|
||||
try {
|
||||
isdeleted.get(requestTimeoutMilliseconds, TimeUnit.MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Set;
|
|||
import java.util.SortedSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
|
@ -45,6 +44,7 @@ import com.google.common.base.Throwables;
|
|||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
|
@ -80,11 +80,11 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg
|
|||
|
||||
public SortedSet<? extends Blob> execute(String container, ListContainerOptions options) {
|
||||
SortedSet<Blob> objects = Sets.newTreeSet();
|
||||
Map<String, Future<? extends Blob>> futureObjects = Maps.newHashMap();
|
||||
Map<String, ListenableFuture<? extends Blob>> futureObjects = Maps.newHashMap();
|
||||
for (BlobMetadata md : getAllBlobMetadata.execute(container, options)) {
|
||||
futureObjects.put(md.getName(), connection.getBlob(container, md.getName()));
|
||||
}
|
||||
for (Entry<String, Future<? extends Blob>> futureObjectEntry : futureObjects.entrySet()) {
|
||||
for (Entry<String, ListenableFuture<? extends Blob>> futureObjectEntry : futureObjects.entrySet()) {
|
||||
try {
|
||||
ifNotFoundRetryOtherwiseAddToSet(container, futureObjectEntry.getKey(),
|
||||
futureObjectEntry.getValue(), objects);
|
||||
|
@ -100,7 +100,7 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg
|
|||
|
||||
@VisibleForTesting
|
||||
public void ifNotFoundRetryOtherwiseAddToSet(String container, String key,
|
||||
Future<? extends Blob> value, Set<Blob> objects) throws InterruptedException,
|
||||
ListenableFuture<? extends Blob> value, Set<Blob> objects) throws InterruptedException,
|
||||
ExecutionException, TimeoutException {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
try {
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.blobstore.integration.internal;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
|
||||
import static com.google.common.util.concurrent.Futures.immediateFuture;
|
||||
import static com.google.common.util.concurrent.Futures.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -44,7 +44,6 @@ import java.util.concurrent.Callable;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
|
@ -88,6 +87,7 @@ import com.google.common.collect.Maps;
|
|||
import com.google.common.collect.Sets;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.Closeables;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.internal.Nullable;
|
||||
|
||||
/**
|
||||
|
@ -152,7 +152,7 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
|
||||
}
|
||||
|
||||
public Future<Blob> getBlob(final String bucketName, final String key) {
|
||||
public ListenableFuture<Blob> getBlob(final String bucketName, final String key) {
|
||||
if (!getContainerToBlobs().containsKey(bucketName))
|
||||
return immediateFailedFuture(new ContainerNotFoundException(bucketName));
|
||||
Map<String, Blob> realContents = getContainerToBlobs().get(bucketName);
|
||||
|
@ -164,7 +164,7 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
return immediateFuture(returnVal);
|
||||
}
|
||||
|
||||
public Future<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
public ListenableFuture<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
final String name, ListContainerOptions... optionsList) {
|
||||
final ListContainerOptions options = (optionsList.length == 0) ? new ListContainerOptions()
|
||||
: optionsList[0];
|
||||
|
@ -286,21 +286,21 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
// return copy(realContents.get(key).getMetadata());
|
||||
// }
|
||||
|
||||
public Future<Void> removeBlob(final String container, final String key) {
|
||||
public ListenableFuture<Void> removeBlob(final String container, final String key) {
|
||||
if (getContainerToBlobs().containsKey(container)) {
|
||||
getContainerToBlobs().get(container).remove(key);
|
||||
}
|
||||
return immediateFuture(null);
|
||||
}
|
||||
|
||||
public Future<Void> deleteContainer(final String container) {
|
||||
public ListenableFuture<Void> deleteContainer(final String container) {
|
||||
if (getContainerToBlobs().containsKey(container)) {
|
||||
getContainerToBlobs().remove(container);
|
||||
}
|
||||
return immediateFuture(null);
|
||||
}
|
||||
|
||||
public Future<Boolean> deleteContainerImpl(final String container) {
|
||||
public ListenableFuture<Boolean> deleteContainerImpl(final String container) {
|
||||
Boolean returnVal = true;
|
||||
if (getContainerToBlobs().containsKey(container)) {
|
||||
if (getContainerToBlobs().get(container).size() == 0)
|
||||
|
@ -311,11 +311,11 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
return immediateFuture(returnVal);
|
||||
}
|
||||
|
||||
public Future<Boolean> containerExists(final String container) {
|
||||
public ListenableFuture<Boolean> containerExists(final String container) {
|
||||
return immediateFuture(getContainerToBlobs().containsKey(container));
|
||||
}
|
||||
|
||||
public Future<? extends ListResponse<? extends ResourceMetadata>> list() {
|
||||
public ListenableFuture<? extends ListResponse<? extends ResourceMetadata>> list() {
|
||||
return immediateFuture(new ListResponseImpl<ResourceMetadata>(Iterables.transform(
|
||||
getContainerToBlobs().keySet(), new Function<String, ResourceMetadata>() {
|
||||
public ResourceMetadata apply(String name) {
|
||||
|
@ -332,7 +332,7 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
return new MutableResourceMetadataImpl();
|
||||
}
|
||||
|
||||
public Future<Boolean> createContainer(final String name) {
|
||||
public ListenableFuture<Boolean> createContainer(final String name) {
|
||||
if (!getContainerToBlobs().containsKey(name)) {
|
||||
getContainerToBlobs().put(name, new ConcurrentHashMap<String, Blob>());
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
}, response);
|
||||
}
|
||||
|
||||
public Future<String> putBlob(final String bucketName, final Blob object) {
|
||||
public ListenableFuture<String> putBlob(final String bucketName, final Blob object) {
|
||||
Map<String, Blob> container = getContainerToBlobs().get(bucketName);
|
||||
if (container == null) {
|
||||
new RuntimeException("bucketName not found: " + bucketName);
|
||||
|
@ -481,7 +481,7 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
|
||||
}
|
||||
|
||||
public Future<? extends Blob> getBlob(final String bucketName, final String key,
|
||||
public ListenableFuture<? extends Blob> getBlob(final String bucketName, final String key,
|
||||
GetOptions... optionsList) {
|
||||
final GetOptions options = (optionsList.length == 0) ? new GetOptions() : optionsList[0];
|
||||
if (!getContainerToBlobs().containsKey(bucketName))
|
||||
|
@ -558,7 +558,7 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
return immediateFuture(returnVal);
|
||||
}
|
||||
|
||||
public Future<BlobMetadata> blobMetadata(final String container, final String key) {
|
||||
public ListenableFuture<BlobMetadata> blobMetadata(final String container, final String key) {
|
||||
try {
|
||||
return immediateFuture((BlobMetadata) copy(getBlob(container, key).get().getMetadata()));
|
||||
} catch (Exception e) {
|
||||
|
@ -578,24 +578,24 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
return containerToBlobs;
|
||||
}
|
||||
|
||||
public Future<Void> clearContainer(final String container) {
|
||||
public ListenableFuture<Void> clearContainer(final String container) {
|
||||
getContainerToBlobs().get(container).clear();
|
||||
return immediateFuture(null);
|
||||
}
|
||||
|
||||
public Future<Void> createDirectory(final String container, final String directory) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> createDirectory(final String container, final String directory) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
mkdirStrategy.execute(StubAsyncBlobStore.this, container, directory);
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> directoryExists(final String container, final String directory) {
|
||||
return service.submit(new Callable<Boolean>() {
|
||||
public ListenableFuture<Boolean> directoryExists(final String container, final String directory) {
|
||||
return makeListenable(service.submit(new Callable<Boolean>() {
|
||||
|
||||
public Boolean call() throws Exception {
|
||||
try {
|
||||
|
@ -605,7 +605,7 @@ public class StubAsyncBlobStore implements AsyncBlobStore {
|
|||
}
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Blob newBlob(String name) {
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.io.InputStream;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
|
@ -42,6 +41,7 @@ import org.jclouds.util.Utils;
|
|||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class RetryOnNotFoundGetAllBlobsStrategyTest {
|
|||
.getInstance(GetAllBlobsInListAndRetryOnFailure.class);
|
||||
context.getInstance(AsyncBlobStore.class).createContainer("container").get();
|
||||
|
||||
Future<Blob> futureObject = createMock(Future.class);
|
||||
ListenableFuture<Blob> futureObject = createMock(ListenableFuture.class);
|
||||
Blob object = blobProvider.create(null);
|
||||
object.getMetadata().setName("key");
|
||||
object.setPayload("goo");
|
||||
|
@ -95,7 +95,7 @@ public class RetryOnNotFoundGetAllBlobsStrategyTest {
|
|||
.getInstance(GetAllBlobsInListAndRetryOnFailure.class);
|
||||
context.getInstance(AsyncBlobStore.class).createContainer("container").get();
|
||||
|
||||
Future<Blob> futureObject = createMock(Future.class);
|
||||
ListenableFuture<Blob> futureObject = createMock(ListenableFuture.class);
|
||||
Blob object = createMock(Blob.class);
|
||||
expect(futureObject.get(map.requestTimeoutMilliseconds, TimeUnit.MILLISECONDS)).andThrow(
|
||||
new KeyNotFoundException()).atLeastOnce();
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.concurrent.TimeUnit;
|
|||
*
|
||||
* @see SyncClient
|
||||
* @see TimeUnit
|
||||
* @see Future#get(long,TimeUnit)
|
||||
* @see ListenableFuture#get(long,TimeUnit)
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Target( { TYPE, METHOD })
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -42,6 +41,7 @@ import org.jclouds.logging.Logger;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
@Singleton
|
||||
public class SyncProxy implements InvocationHandler {
|
||||
|
@ -86,7 +86,7 @@ public class SyncProxy implements InvocationHandler {
|
|||
throw new IllegalArgumentException(String.format(
|
||||
"method %s has different typed exceptions than delegated method %s",
|
||||
method, delegatedMethod));
|
||||
if (delegatedMethod.getReturnType().isAssignableFrom(Future.class)) {
|
||||
if (delegatedMethod.getReturnType().isAssignableFrom(ListenableFuture.class)) {
|
||||
if (method.isAnnotationPresent(Timeout.class)) {
|
||||
Timeout methodTimeout = method.getAnnotation(Timeout.class);
|
||||
long methodNanos = convertToNanos(methodTimeout);
|
||||
|
@ -120,7 +120,7 @@ public class SyncProxy implements InvocationHandler {
|
|||
return syncMethodMap.get(method).invoke(delegate, args);
|
||||
} else {
|
||||
try {
|
||||
return ((Future<?>) methodMap.get(method).invoke(delegate, args)).get(timeoutMap
|
||||
return ((ListenableFuture<?>) methodMap.get(method).invoke(delegate, args)).get(timeoutMap
|
||||
.get(method), TimeUnit.NANOSECONDS);
|
||||
} catch (ExecutionException e) {
|
||||
throw e.getCause();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.http;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Capable of invoking http commands.
|
||||
|
@ -35,7 +35,7 @@ public interface HttpCommandExecutorService {
|
|||
* type of result the command extracts from the return value
|
||||
* @param command
|
||||
* that generates requests
|
||||
* @return {@link Future} containing the response from the {@code endpoint}
|
||||
* @return {@link ListenableFuture} containing the response from the {@code endpoint}
|
||||
*/
|
||||
Future<HttpResponse> submit(HttpCommand command);
|
||||
ListenableFuture<HttpResponse> submit(HttpCommand command);
|
||||
}
|
||||
|
|
|
@ -53,14 +53,14 @@ public class HttpCommandRendezvous<T> {
|
|||
}
|
||||
|
||||
public void cancel() {
|
||||
getFuture().cancel(true);
|
||||
getListenableFuture().cancel(true);
|
||||
}
|
||||
|
||||
public HttpCommand getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
||||
public ListenableFuture<T> getFuture() {
|
||||
public ListenableFuture<T> getListenableFuture() {
|
||||
return future;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.http;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -32,7 +30,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
public interface TransformingHttpCommandExecutorService {
|
||||
/**
|
||||
*
|
||||
* Submits the command and transforms the result before requested via {@link Future#get()}.
|
||||
* Submits the command and transforms the result before requested via {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @param <T>
|
||||
* type that is required from the value.
|
||||
|
|
|
@ -19,10 +19,8 @@
|
|||
package org.jclouds.http;
|
||||
|
||||
import static com.google.common.util.concurrent.Futures.compose;
|
||||
import static com.google.common.util.concurrent.Futures.makeListenable;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -50,9 +48,10 @@ public class TransformingHttpCommandExecutorServiceImpl implements
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public <T> ListenableFuture<T> submit(HttpCommand command, Function<HttpResponse, T> responseTransformer) {
|
||||
Future<HttpResponse> responseFuture = client.submit(command);
|
||||
return compose(makeListenable(responseFuture), responseTransformer, executorService);
|
||||
public <T> ListenableFuture<T> submit(HttpCommand command,
|
||||
Function<HttpResponse, T> responseTransformer) {
|
||||
ListenableFuture<HttpResponse> responseListenableFuture = client.submit(command);
|
||||
return compose(responseListenableFuture, responseTransformer, executorService);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
*/
|
||||
package org.jclouds.http.internal;
|
||||
|
||||
import static com.google.common.util.concurrent.Futures.makeListenable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Named;
|
||||
|
@ -38,6 +39,8 @@ import org.jclouds.http.handlers.DelegatingErrorHandler;
|
|||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||
import org.jclouds.logging.Logger;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandExecutorService {
|
||||
|
||||
private final DelegatingRetryHandler retryHandler;
|
||||
|
@ -60,8 +63,8 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
|
|||
this.wire = wire;
|
||||
}
|
||||
|
||||
public Future<HttpResponse> submit(HttpCommand command) {
|
||||
return executorService.submit(new HttpResponseCallable(command));
|
||||
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
|
||||
return makeListenable(executorService.submit(new HttpResponseCallable(command)));
|
||||
}
|
||||
|
||||
public class HttpResponseCallable implements Callable<HttpResponse> {
|
||||
|
|
|
@ -45,7 +45,7 @@ import com.google.common.collect.Multimap;
|
|||
*
|
||||
*
|
||||
* // this will get the first megabyte of an object, provided it wasn't modified since yesterday
|
||||
* Future<S3Object> object = client.get("objectName",range(0,1024).ifUnmodifiedSince(new Date().minusDays(1)));
|
||||
* ListenableFuture<S3Object> object = client.get("objectName",range(0,1024).ifUnmodifiedSince(new Date().minusDays(1)));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
package org.jclouds.rest;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Represents an authenticated context to the cloud.
|
||||
|
@ -36,7 +37,7 @@ public interface RestContext<A, S> {
|
|||
/**
|
||||
* low-level api to the cloud. Threadsafe implementations will return a singleton.
|
||||
*
|
||||
* @return a connection to the cloud where all methods return {@link Future}s
|
||||
* @return a connection to the cloud where all methods return {@link ListenableFuture}s
|
||||
*/
|
||||
A getAsyncApi();
|
||||
|
||||
|
|
|
@ -25,10 +25,7 @@ package org.jclouds.rest.internal;
|
|||
*/
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Named;
|
||||
|
@ -43,6 +40,7 @@ import org.jclouds.rest.InvocationContext;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ValueFuture;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
@ -83,7 +81,7 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
|||
} else if (method.getName().startsWith("new")) {
|
||||
return injector.getInstance(method.getReturnType());
|
||||
} else if (util.getDelegateOrNull(method) != null
|
||||
&& Future.class.isAssignableFrom(method.getReturnType())) {
|
||||
&& ListenableFuture.class.isAssignableFrom(method.getReturnType())) {
|
||||
method = util.getDelegateOrNull(method);
|
||||
logger.trace("Converting %s.%s", declaring.getSimpleName(), method.getName());
|
||||
Function<Exception, ?> exceptionParser = util
|
||||
|
@ -103,31 +101,10 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
|||
final Object toReturn = exceptionParser.apply(e);
|
||||
if (toReturn == null)
|
||||
throw e;
|
||||
if (method.getReturnType().isAssignableFrom(Future.class)) {
|
||||
return new Future<Object>() {
|
||||
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Object get() throws InterruptedException, ExecutionException {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public Object get(long timeout, TimeUnit unit) throws InterruptedException,
|
||||
ExecutionException, TimeoutException {
|
||||
return get();
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
if (method.getReturnType().isAssignableFrom(ListenableFuture.class)) {
|
||||
ValueFuture<Object> returnVal = ValueFuture.create();
|
||||
returnVal.set(toReturn);
|
||||
return returnVal;
|
||||
} else {
|
||||
return toReturn;
|
||||
}
|
||||
|
@ -150,7 +127,7 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
|||
result = new FutureExceptionParser(result, exceptionParser);
|
||||
}
|
||||
|
||||
if (method.getReturnType().isAssignableFrom(Future.class)) {
|
||||
if (method.getReturnType().isAssignableFrom(ListenableFuture.class)) {
|
||||
return result;
|
||||
} else {
|
||||
logger.debug("Blocking up to %dms for %s.%s to complete", requestTimeoutMilliseconds,
|
||||
|
|
|
@ -37,7 +37,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
|
@ -102,6 +101,7 @@ import com.google.common.collect.MapMaker;
|
|||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
@ -618,17 +618,17 @@ public class RestAnnotationProcessor<T> {
|
|||
return builder;
|
||||
}
|
||||
|
||||
public static final TypeLiteral<Future<Boolean>> futureBooleanLiteral = new TypeLiteral<Future<Boolean>>() {
|
||||
public static final TypeLiteral<ListenableFuture<Boolean>> futureBooleanLiteral = new TypeLiteral<ListenableFuture<Boolean>>() {
|
||||
};
|
||||
|
||||
public static final TypeLiteral<Future<String>> futureStringLiteral = new TypeLiteral<Future<String>>() {
|
||||
public static final TypeLiteral<ListenableFuture<String>> futureStringLiteral = new TypeLiteral<ListenableFuture<String>>() {
|
||||
};
|
||||
|
||||
public static final TypeLiteral<Future<Void>> futureVoidLiteral = new TypeLiteral<Future<Void>>() {
|
||||
public static final TypeLiteral<ListenableFuture<Void>> futureVoidLiteral = new TypeLiteral<ListenableFuture<Void>>() {
|
||||
};
|
||||
public static final TypeLiteral<Future<URI>> futureURILiteral = new TypeLiteral<Future<URI>>() {
|
||||
public static final TypeLiteral<ListenableFuture<URI>> futureURILiteral = new TypeLiteral<ListenableFuture<URI>>() {
|
||||
};
|
||||
public static final TypeLiteral<Future<InputStream>> futureInputStreamLiteral = new TypeLiteral<Future<InputStream>>() {
|
||||
public static final TypeLiteral<ListenableFuture<InputStream>> futureInputStreamLiteral = new TypeLiteral<ListenableFuture<InputStream>>() {
|
||||
};
|
||||
|
||||
public static Class<? extends Function<HttpResponse, ?>> getParserOrThrowException(Method method) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.concurrent.internal;
|
||||
|
||||
import static com.google.common.util.concurrent.Futures.makeListenable;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -27,19 +28,20 @@ import java.lang.reflect.UndeclaredThrowableException;
|
|||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Tests behavior of FutureExceptionParser
|
||||
* Tests behavior of ListenableFutureExceptionParser
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", sequential = true, testName = "concurrent.FutureExceptionParserTest")
|
||||
@Test(groups = "unit", sequential = true, testName = "concurrent.ListenableFutureExceptionParserTest")
|
||||
public class SyncProxyTest {
|
||||
|
||||
@Test
|
||||
|
@ -70,42 +72,42 @@ public class SyncProxyTest {
|
|||
|
||||
public static class Async {
|
||||
|
||||
public Future<String> getString() {
|
||||
return executorService.submit(new Callable<String>() {
|
||||
public ListenableFuture<String> getString() {
|
||||
return makeListenable(executorService.submit(new Callable<String>() {
|
||||
|
||||
public String call() throws Exception {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<String> getRuntimeException() {
|
||||
return executorService.submit(new Callable<String>() {
|
||||
public ListenableFuture<String> getRuntimeException() {
|
||||
return makeListenable(executorService.submit(new Callable<String>() {
|
||||
|
||||
public String call() throws Exception {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<String> getTypedException() throws FileNotFoundException {
|
||||
return executorService.submit(new Callable<String>() {
|
||||
public ListenableFuture<String> getTypedException() throws FileNotFoundException {
|
||||
return makeListenable(executorService.submit(new Callable<String>() {
|
||||
|
||||
public String call() throws FileNotFoundException {
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public String newString() {
|
||||
return "new";
|
||||
}
|
||||
|
||||
public Future<String> take20Milliseconds() {
|
||||
return executorService.submit(new Callable<String>() {
|
||||
public ListenableFuture<String> take20Milliseconds() {
|
||||
return makeListenable(executorService.submit(new Callable<String>() {
|
||||
|
||||
public String call() {
|
||||
try {
|
||||
|
@ -116,11 +118,11 @@ public class SyncProxyTest {
|
|||
return "foo";
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<String> take100MillisecondsAndTimeout() {
|
||||
return executorService.submit(new Callable<String>() {
|
||||
public ListenableFuture<String> take100MillisecondsAndTimeout() {
|
||||
return makeListenable(executorService.submit(new Callable<String>() {
|
||||
|
||||
public String call() {
|
||||
try {
|
||||
|
@ -131,10 +133,10 @@ public class SyncProxyTest {
|
|||
return "foo";
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<String> take100MillisecondsAndOverride() {
|
||||
public ListenableFuture<String> take100MillisecondsAndOverride() {
|
||||
return take100MillisecondsAndTimeout();
|
||||
}
|
||||
|
||||
|
@ -148,7 +150,7 @@ public class SyncProxyTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnwrapFuture() {
|
||||
public void testUnwrapListenableFuture() {
|
||||
assertEquals(sync.getString(), "foo");
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.http;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.HEAD;
|
||||
|
@ -45,6 +44,7 @@ import org.jclouds.rest.internal.RestAnnotationProcessorTest.Localhost;
|
|||
import org.jclouds.util.Utils;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Sample test for the behaviour of our Integration Test jetty server.
|
||||
|
@ -56,20 +56,20 @@ public interface IntegrationTestAsyncClient {
|
|||
|
||||
@HEAD
|
||||
@Path("objects/{id}")
|
||||
Future<Boolean> exists(@PathParam("id") String path);
|
||||
ListenableFuture<Boolean> exists(@PathParam("id") String path);
|
||||
|
||||
@GET
|
||||
@Path("objects/{id}")
|
||||
Future<String> download(@PathParam("id") String id);
|
||||
ListenableFuture<String> download(@PathParam("id") String id);
|
||||
|
||||
@GET
|
||||
@Path("{path}")
|
||||
Future<String> synch(@PathParam("path") String id);
|
||||
ListenableFuture<String> synch(@PathParam("path") String id);
|
||||
|
||||
@GET
|
||||
@Path("objects/{id}")
|
||||
@ExceptionParser(FooOnException.class)
|
||||
Future<String> downloadException(@PathParam("id") String id, HttpRequestOptions options);
|
||||
ListenableFuture<String> downloadException(@PathParam("id") String id, HttpRequestOptions options);
|
||||
|
||||
static class FooOnException implements Function<Exception, String> {
|
||||
|
||||
|
@ -82,21 +82,22 @@ public interface IntegrationTestAsyncClient {
|
|||
@GET
|
||||
@Path("objects/{id}")
|
||||
@ExceptionParser(FooOnException.class)
|
||||
Future<String> synchException(@PathParam("id") String id, @HeaderParam("Range") String header);
|
||||
ListenableFuture<String> synchException(@PathParam("id") String id,
|
||||
@HeaderParam("Range") String header);
|
||||
|
||||
@PUT
|
||||
@Path("objects/{id}")
|
||||
Future<String> upload(@PathParam("id") String id,
|
||||
ListenableFuture<String> upload(@PathParam("id") String id,
|
||||
@BinderParam(BindToStringPayload.class) String toPut);
|
||||
|
||||
@POST
|
||||
@Path("objects/{id}")
|
||||
Future<String> post(@PathParam("id") String id,
|
||||
ListenableFuture<String> post(@PathParam("id") String id,
|
||||
@BinderParam(BindToStringPayload.class) String toPut);
|
||||
|
||||
@POST
|
||||
@Path("objects/{id}")
|
||||
Future<String> postAsInputStream(@PathParam("id") String id,
|
||||
ListenableFuture<String> postAsInputStream(@PathParam("id") String id,
|
||||
@BinderParam(BindToInputStreamPayload.class) String toPut);
|
||||
|
||||
static class BindToInputStreamPayload extends BindToStringPayload {
|
||||
|
@ -110,17 +111,19 @@ public interface IntegrationTestAsyncClient {
|
|||
@POST
|
||||
@Path("objects/{id}")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
Future<String> postJson(@PathParam("id") String id, @MapPayloadParam("key") String toPut);
|
||||
ListenableFuture<String> postJson(@PathParam("id") String id,
|
||||
@MapPayloadParam("key") String toPut);
|
||||
|
||||
@POST
|
||||
@Path("objects/{id}/action/{action}")
|
||||
Future<String> action(@PathParam("id") String id, @PathParam("action") String action,
|
||||
ListenableFuture<String> action(@PathParam("id") String id, @PathParam("action") String action,
|
||||
@BinderParam(BindMapToMatrixParams.class) Map<String, String> options);
|
||||
|
||||
@GET
|
||||
@Path("objects/{id}")
|
||||
@RequestFilters(Filter.class)
|
||||
Future<String> downloadFilter(@PathParam("id") String id, @HeaderParam("filterme") String header);
|
||||
ListenableFuture<String> downloadFilter(@PathParam("id") String id,
|
||||
@HeaderParam("filterme") String header);
|
||||
|
||||
static class Filter implements HttpRequestFilter {
|
||||
public void filter(HttpRequest request) throws HttpException {
|
||||
|
@ -132,12 +135,12 @@ public interface IntegrationTestAsyncClient {
|
|||
|
||||
@GET
|
||||
@Path("objects/{id}")
|
||||
Future<String> download(@PathParam("id") String id, @HeaderParam("test") String header);
|
||||
ListenableFuture<String> download(@PathParam("id") String id, @HeaderParam("test") String header);
|
||||
|
||||
@GET
|
||||
@Path("objects/{id}")
|
||||
@XMLResponseParser(BarHandler.class)
|
||||
Future<String> downloadAndParse(@PathParam("id") String id);
|
||||
ListenableFuture<String> downloadAndParse(@PathParam("id") String id);
|
||||
|
||||
public static class BarHandler extends ParseSax.HandlerWithResult<String> {
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.net.URL;
|
|||
import java.net.URLConnection;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.encryption.EncryptionService;
|
||||
|
@ -39,6 +38,8 @@ import org.jclouds.logging.Logger;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -158,7 +159,8 @@ public class WireLiveTest {
|
|||
URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl"));
|
||||
URLConnection connection = url.openConnection();
|
||||
Callable<Void> callable = new ConnectionTester(connection.getInputStream());
|
||||
Future<Void> result = newCachedThreadPool().submit(callable);
|
||||
ListenableFuture<Void> result = Futures
|
||||
.makeListenable(newCachedThreadPool().submit(callable));
|
||||
result.get(30, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Named;
|
||||
|
@ -110,6 +109,7 @@ import com.google.common.collect.ImmutableMultimap;
|
|||
import com.google.common.collect.LinkedHashMultimap;
|
||||
import com.google.common.collect.LinkedListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -823,7 +823,7 @@ public class RestAnnotationProcessorTest {
|
|||
private interface TestMapMatrixParams {
|
||||
@POST
|
||||
@Path("objects/{id}/action/{action}")
|
||||
Future<String> action(@PathParam("id") String id, @PathParam("action") String action,
|
||||
ListenableFuture<String> action(@PathParam("id") String id, @PathParam("action") String action,
|
||||
@BinderParam(BindMapToMatrixParams.class) Map<String, String> options);
|
||||
}
|
||||
|
||||
|
@ -1055,13 +1055,13 @@ public class RestAnnotationProcessorTest {
|
|||
public InputStream inputStream();
|
||||
|
||||
@GET
|
||||
public Future<InputStream> futureInputStream();
|
||||
public ListenableFuture<InputStream> futureInputStream();
|
||||
|
||||
@GET
|
||||
public URI uri();
|
||||
|
||||
@GET
|
||||
public Future<URI> futureUri();
|
||||
public ListenableFuture<URI> futureUri();
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
|
@ -1073,7 +1073,7 @@ public class RestAnnotationProcessorTest {
|
|||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public void testInputStreamFuture() throws SecurityException, NoSuchMethodException {
|
||||
public void testInputStreamListenableFuture() throws SecurityException, NoSuchMethodException {
|
||||
Method method = TestTransformers.class.getMethod("futureInputStream");
|
||||
Class<? extends Function<HttpResponse, ?>> transformer = factory(TestTransformers.class)
|
||||
.getParserOrThrowException(method);
|
||||
|
@ -1089,7 +1089,7 @@ public class RestAnnotationProcessorTest {
|
|||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public void testURIFuture() throws SecurityException, NoSuchMethodException {
|
||||
public void testURIListenableFuture() throws SecurityException, NoSuchMethodException {
|
||||
Method method = TestTransformers.class.getMethod("futureUri");
|
||||
Class<? extends Function<HttpResponse, ?>> transformer = factory(TestTransformers.class)
|
||||
.getParserOrThrowException(method);
|
||||
|
@ -1136,21 +1136,21 @@ public class RestAnnotationProcessorTest {
|
|||
@GET
|
||||
@VirtualHost
|
||||
@Path("/{id}")
|
||||
public Future<String> get(@PathParam("id") String id, HttpRequestOptions options) {
|
||||
public ListenableFuture<String> get(@PathParam("id") String id, HttpRequestOptions options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@VirtualHost
|
||||
@Path("/{id}")
|
||||
public Future<String> get(@PathParam("id") String id, HttpRequestOptions... options) {
|
||||
public ListenableFuture<String> get(@PathParam("id") String id, HttpRequestOptions... options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
@ResponseParser(ReturnStringIf200.class)
|
||||
public Future<String> get(@PathParam("id") String id,
|
||||
public ListenableFuture<String> get(@PathParam("id") String id,
|
||||
@HeaderParam(HttpHeaders.HOST) String host) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1158,20 +1158,20 @@ public class RestAnnotationProcessorTest {
|
|||
@GET
|
||||
@Path("/{id}")
|
||||
@QueryParams(keys = "max-keys", values = "0")
|
||||
public Future<String> getQuery(@PathParam("id") String id) {
|
||||
public ListenableFuture<String> getQuery(@PathParam("id") String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
@QueryParams(keys = "acl")
|
||||
public Future<String> getQueryNull(@PathParam("id") String id) {
|
||||
public ListenableFuture<String> getQueryNull(@PathParam("id") String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/{id}")
|
||||
public Future<String> put(@PathParam("id") @ParamParser(FirstCharacter.class) String id,
|
||||
public ListenableFuture<String> put(@PathParam("id") @ParamParser(FirstCharacter.class) String id,
|
||||
@BinderParam(BindToStringPayload.class) String payload) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ public class RestAnnotationProcessorTest {
|
|||
@PUT
|
||||
@Path("/{id}")
|
||||
@VirtualHost
|
||||
public Future<String> putOptions(@PathParam("id") String id, HttpRequestOptions options) {
|
||||
public ListenableFuture<String> putOptions(@PathParam("id") String id, HttpRequestOptions options) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ public class RestAnnotationProcessorTest {
|
|||
@Path("/{id}")
|
||||
@Headers(keys = "foo", values = "--{id}--")
|
||||
@ResponseParser(ReturnTrueIf2xx.class)
|
||||
public Future<String> putHeader(@PathParam("id") String id,
|
||||
public ListenableFuture<String> putHeader(@PathParam("id") String id,
|
||||
@BinderParam(BindToStringPayload.class) String payload) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ public class RestAnnotationProcessorTest {
|
|||
@GET
|
||||
@Path("/{id}")
|
||||
@VirtualHost
|
||||
public Future<String> get(@PathParam("id") String id, String foo) {
|
||||
public ListenableFuture<String> get(@PathParam("id") String id, String foo) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1377,19 +1377,19 @@ public class RestAnnotationProcessorTest {
|
|||
@GET
|
||||
@Path("/{id}")
|
||||
@VirtualHost
|
||||
public Future<String> get(@PathParam("id") String id, String foo) {
|
||||
public ListenableFuture<String> get(@PathParam("id") String id, String foo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Future<String> getPrefix(@PathParam("id") String id, @HostPrefixParam("") String foo) {
|
||||
public ListenableFuture<String> getPrefix(@PathParam("id") String id, @HostPrefixParam("") String foo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Future<String> getPrefixDot(@PathParam("id") String id, @HostPrefixParam String foo) {
|
||||
public ListenableFuture<String> getPrefixDot(@PathParam("id") String id, @HostPrefixParam String foo) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1509,7 +1509,7 @@ public class RestAnnotationProcessorTest {
|
|||
|
||||
@PUT
|
||||
@Path("{foo}")
|
||||
public Future<Void> putWithPath(@PathParam("foo") String path,
|
||||
public ListenableFuture<Void> putWithPath(@PathParam("foo") String path,
|
||||
@BinderParam(BindToStringPayload.class) String content);
|
||||
|
||||
@PUT
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
@ -55,6 +54,7 @@ import com.google.appengine.api.urlfetch.URLFetchService;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.Closeables;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Google App Engine version of {@link HttpCommandExecutorService}
|
||||
|
@ -77,7 +77,7 @@ public class GaeHttpCommandExecutorService extends BaseHttpCommandExecutorServic
|
|||
}
|
||||
|
||||
@Override
|
||||
public Future<HttpResponse> submit(HttpCommand command) {
|
||||
public ListenableFuture<HttpResponse> submit(HttpCommand command) {
|
||||
convertHostHeaderToEndPoint(command);
|
||||
return super.submit(command);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.concurrent.Callable;
|
|||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
@ -136,7 +135,7 @@ public class ConnectionPoolTransformingHttpCommandExecutorService<C> extends Bas
|
|||
exceptionIfNotActive();
|
||||
final SynchronousQueue<?> channel = new SynchronousQueue<Object>();
|
||||
// should block and immediately parse the response on exit.
|
||||
Future<T> future = executorService.submit(new Callable<T>() {
|
||||
ListenableFuture<T> future = makeListenable(executorService.submit(new Callable<T>() {
|
||||
Logger transformerLogger = logFactory.getLogger(responseTransformer.getClass().getName());
|
||||
|
||||
public T call() throws Exception {
|
||||
|
@ -149,12 +148,12 @@ public class ConnectionPoolTransformingHttpCommandExecutorService<C> extends Bas
|
|||
transformerLogger.debug("Processed intermediate result for: %s", o);
|
||||
return result;
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
HttpCommandRendezvous<T> rendezvous = new HttpCommandRendezvous<T>(command, channel,
|
||||
makeListenable(future));
|
||||
commandQueue.add(rendezvous);
|
||||
return rendezvous.getFuture();
|
||||
return rendezvous.getListenableFuture();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Tests for {@link HttpNioConnectionPoolFutureCommandClient}.
|
||||
* Tests for {@link HttpNioConnectionPoolListenableFutureCommandClient}.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.jclouds.mezeo.pcs2;
|
|||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -56,6 +55,8 @@ import org.jclouds.rest.annotations.SkipEncoding;
|
|||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.rest.binders.BindToStringPayload;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Mezeo PCS v2 via their REST API.
|
||||
* <p/>
|
||||
|
@ -78,7 +79,7 @@ public interface PCSAsyncClient {
|
|||
@XMLResponseParser(ContainerHandler.class)
|
||||
@Headers(keys = "X-Cloud-Depth", values = "2")
|
||||
@Endpoint(RootContainer.class)
|
||||
Future<? extends ContainerList> list();
|
||||
ListenableFuture<? extends ContainerList> list();
|
||||
|
||||
/**
|
||||
* @see PCSAsyncClient#list(URI)
|
||||
|
@ -86,7 +87,7 @@ public interface PCSAsyncClient {
|
|||
@GET
|
||||
@XMLResponseParser(ContainerHandler.class)
|
||||
@Headers(keys = "X-Cloud-Depth", values = "2")
|
||||
Future<? extends ContainerList> list(@EndpointParam URI container);
|
||||
ListenableFuture<? extends ContainerList> list(@EndpointParam URI container);
|
||||
|
||||
/**
|
||||
* @see PCSAsyncClient#createContainer
|
||||
|
@ -94,14 +95,15 @@ public interface PCSAsyncClient {
|
|||
@POST
|
||||
@Path("/contents")
|
||||
@Endpoint(RootContainer.class)
|
||||
Future<URI> createContainer(@BinderParam(BindContainerNameToXmlPayload.class) String container);
|
||||
ListenableFuture<URI> createContainer(
|
||||
@BinderParam(BindContainerNameToXmlPayload.class) String container);
|
||||
|
||||
/**
|
||||
* @see PCSAsyncClient#createContainer
|
||||
*/
|
||||
@POST
|
||||
@Path("/contents")
|
||||
Future<URI> createContainer(@EndpointParam URI parent,
|
||||
ListenableFuture<URI> createContainer(@EndpointParam URI parent,
|
||||
@BinderParam(BindContainerNameToXmlPayload.class) String container);
|
||||
|
||||
/**
|
||||
|
@ -109,14 +111,14 @@ public interface PCSAsyncClient {
|
|||
*/
|
||||
@DELETE
|
||||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
Future<Void> deleteContainer(@EndpointParam URI container);
|
||||
ListenableFuture<Void> deleteContainer(@EndpointParam URI container);
|
||||
|
||||
/**
|
||||
* @see PCSAsyncClient#uploadFile
|
||||
*/
|
||||
@POST
|
||||
@Path("/contents")
|
||||
Future<URI> uploadFile(@EndpointParam URI container,
|
||||
ListenableFuture<URI> uploadFile(@EndpointParam URI container,
|
||||
@BinderParam(BindPCSFileToMultipartForm.class) PCSFile object);
|
||||
|
||||
/**
|
||||
|
@ -124,7 +126,7 @@ public interface PCSAsyncClient {
|
|||
*/
|
||||
@POST
|
||||
@Path("/contents")
|
||||
Future<URI> createFile(@EndpointParam URI container,
|
||||
ListenableFuture<URI> createFile(@EndpointParam URI container,
|
||||
@BinderParam(BindFileInfoToXmlPayload.class) PCSFile object);
|
||||
|
||||
/**
|
||||
|
@ -132,7 +134,7 @@ public interface PCSAsyncClient {
|
|||
*/
|
||||
@PUT
|
||||
@Path("/content")
|
||||
Future<Void> uploadBlock(@EndpointParam URI file,
|
||||
ListenableFuture<Void> uploadBlock(@EndpointParam URI file,
|
||||
@BinderParam(BindDataToPayload.class) PCSFile object, PutBlockOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -140,7 +142,7 @@ public interface PCSAsyncClient {
|
|||
*/
|
||||
@DELETE
|
||||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
Future<Void> deleteFile(@EndpointParam URI file);
|
||||
ListenableFuture<Void> deleteFile(@EndpointParam URI file);
|
||||
|
||||
/**
|
||||
* @see PCSAsyncClient#downloadFile
|
||||
|
@ -148,7 +150,7 @@ public interface PCSAsyncClient {
|
|||
@GET
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@Path("/content")
|
||||
Future<InputStream> downloadFile(@EndpointParam URI file);
|
||||
ListenableFuture<InputStream> downloadFile(@EndpointParam URI file);
|
||||
|
||||
/**
|
||||
* @see PCSAsyncClient#getFileInfo
|
||||
|
@ -157,15 +159,15 @@ public interface PCSAsyncClient {
|
|||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@XMLResponseParser(FileHandler.class)
|
||||
@Headers(keys = "X-Cloud-Depth", values = "2")
|
||||
Future<FileInfoWithMetadata> getFileInfo(@EndpointParam URI file);
|
||||
ListenableFuture<FileInfoWithMetadata> getFileInfo(@EndpointParam URI file);
|
||||
|
||||
/**
|
||||
* @see PCSAsyncClient#putMetadataItem
|
||||
*/
|
||||
@PUT
|
||||
@Path("/metadata/{key}")
|
||||
Future<Void> putMetadataItem(@EndpointParam URI resource, @PathParam("key") String key,
|
||||
@BinderParam(BindToStringPayload.class) String value);
|
||||
ListenableFuture<Void> putMetadataItem(@EndpointParam URI resource,
|
||||
@PathParam("key") String key, @BinderParam(BindToStringPayload.class) String value);
|
||||
|
||||
/**
|
||||
* @see PCSAsyncClient#addMetadataItemToMap
|
||||
|
@ -173,6 +175,6 @@ public interface PCSAsyncClient {
|
|||
@GET
|
||||
@ResponseParser(AddMetadataItemIntoMap.class)
|
||||
@Path("/metadata/{key}")
|
||||
Future<Void> addMetadataItemToMap(@EndpointParam URI resource, @PathParam("key") String key,
|
||||
Map<String, String> map);
|
||||
ListenableFuture<Void> addMetadataItemToMap(@EndpointParam URI resource,
|
||||
@PathParam("key") String key, Map<String, String> map);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.mezeo.pcs2;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
@ -37,6 +36,8 @@ import org.jclouds.rest.annotations.Endpoint;
|
|||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides URIs to PCS services via their REST API.
|
||||
* <p/>
|
||||
|
@ -73,5 +74,5 @@ public interface PCSCloud {
|
|||
@GET
|
||||
@XMLResponseParser(CloudXlinkHandler.class)
|
||||
@Path("/")
|
||||
Future<Response> authenticate();
|
||||
ListenableFuture<Response> authenticate();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.google.common.collect.Multimap;
|
|||
* import org.jclouds.mezeo.pcs2.PCSClient;
|
||||
* <p/>
|
||||
* PCSClient connection = // get connection
|
||||
* Future<Void> added = connection.appendFile("container",range(0,3));
|
||||
* ListenableFuture<Void> added = connection.appendFile("container",range(0,3));
|
||||
* <code>
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -49,7 +49,7 @@ public class AddMetadataAndReturnIdTest {
|
|||
// @SuppressWarnings("unchecked")
|
||||
// PCSUtil createPCSUtil() {
|
||||
// PCSUtil connection = createMock(PCSUtil.class);
|
||||
// final Future<Void> voidF = createMock(Future.class);
|
||||
// final ListenableFuture<Void> voidF = createMock(ListenableFuture.class);
|
||||
// expect(
|
||||
// connection.putMetadata(eq("7F143552-AAF5-11DE-BBB0-0BC388ED913B"), eq("foo"),
|
||||
// eq("bar"))).andReturn(voidF);
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.jclouds.mezeo.pcs2.internal;
|
|||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.jclouds.mezeo.pcs2.PCSAsyncClient;
|
||||
import org.jclouds.mezeo.pcs2.domain.ContainerList;
|
||||
|
@ -29,49 +28,51 @@ import org.jclouds.mezeo.pcs2.domain.FileInfoWithMetadata;
|
|||
import org.jclouds.mezeo.pcs2.domain.PCSFile;
|
||||
import org.jclouds.mezeo.pcs2.options.PutBlockOptions;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Implementation of {@link PCSBlobStore} which keeps all data in a local Map object.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class StubPCSAsyncClient implements PCSAsyncClient {
|
||||
public Future<? extends ContainerList> list() {
|
||||
public ListenableFuture<? extends ContainerList> list() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<? extends ContainerList> list(URI container) {
|
||||
public ListenableFuture<? extends ContainerList> list(URI container) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<URI> createContainer(String container) {
|
||||
public ListenableFuture<URI> createContainer(String container) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<URI> createContainer(URI parent, String container) {
|
||||
public ListenableFuture<URI> createContainer(URI parent, String container) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<Void> deleteContainer(URI container) {
|
||||
public ListenableFuture<Void> deleteContainer(URI container) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<Void> deleteFile(URI file) {
|
||||
public ListenableFuture<Void> deleteFile(URI file) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<InputStream> downloadFile(URI file) {
|
||||
public ListenableFuture<InputStream> downloadFile(URI file) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<URI> uploadFile(URI container, PCSFile object) {
|
||||
public ListenableFuture<URI> uploadFile(URI container, PCSFile object) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<URI> createFile(URI container, PCSFile object) {
|
||||
public ListenableFuture<URI> createFile(URI container, PCSFile object) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<Void> uploadBlock(URI file, PCSFile object, PutBlockOptions... options) {
|
||||
public ListenableFuture<Void> uploadBlock(URI file, PCSFile object, PutBlockOptions... options) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -79,15 +80,16 @@ public class StubPCSAsyncClient implements PCSAsyncClient {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<FileInfoWithMetadata> getFileInfo(URI file) {
|
||||
public ListenableFuture<FileInfoWithMetadata> getFileInfo(URI file) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<Void> addMetadataItemToMap(URI resource, String key, Map<String, String> map) {
|
||||
public ListenableFuture<Void> addMetadataItemToMap(URI resource, String key,
|
||||
Map<String, String> map) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<Void> putMetadataItem(URI resource, String key, String value) {
|
||||
public ListenableFuture<Void> putMetadataItem(URI resource, String key, String value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.nirvanix.sdn;
|
|||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -46,6 +45,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Nirvanix SDN resources via their REST API.
|
||||
* <p/>
|
||||
|
@ -68,7 +69,8 @@ public interface SDNAsyncClient {
|
|||
@GET
|
||||
@Path("/ws/IMFS/GetStorageNode.ashx")
|
||||
@ResponseParser(ParseUploadInfoFromJsonResponse.class)
|
||||
Future<UploadInfo> getStorageNode(@QueryParam(SDNQueryParams.DESTFOLDERPATH) String folderPath,
|
||||
ListenableFuture<UploadInfo> getStorageNode(
|
||||
@QueryParam(SDNQueryParams.DESTFOLDERPATH) String folderPath,
|
||||
@QueryParam(SDNQueryParams.SIZEBYTES) long size);
|
||||
|
||||
/**
|
||||
|
@ -76,7 +78,7 @@ public interface SDNAsyncClient {
|
|||
*/
|
||||
@POST
|
||||
@Path("/Upload.ashx")
|
||||
Future<Void> upload(@EndpointParam URI endpoint,
|
||||
ListenableFuture<Void> upload(@EndpointParam URI endpoint,
|
||||
@QueryParam(SDNQueryParams.UPLOADTOKEN) String uploadToken,
|
||||
@QueryParam(SDNQueryParams.DESTFOLDERPATH) String folderPath,
|
||||
@BinderParam(BindBlobToMultipartForm.class) Blob blob);
|
||||
|
@ -87,7 +89,7 @@ public interface SDNAsyncClient {
|
|||
@GET
|
||||
@Path("/ws/Metadata/SetMetadata.ashx")
|
||||
@QueryParams(keys = SDNQueryParams.PATH, values = "{path}")
|
||||
Future<Void> setMetadata(@PathParam("path") String path,
|
||||
ListenableFuture<Void> setMetadata(@PathParam("path") String path,
|
||||
@BinderParam(BindMetadataToQueryParams.class) Map<String, String> metadata);
|
||||
|
||||
/**
|
||||
|
@ -97,7 +99,7 @@ public interface SDNAsyncClient {
|
|||
@Path("/ws/Metadata/GetMetadata.ashx")
|
||||
@ResponseParser(ParseMetadataFromJsonResponse.class)
|
||||
@QueryParams(keys = SDNQueryParams.PATH, values = "{path}")
|
||||
Future<Map<String, String>> getMetadata(@PathParam("path") String path);
|
||||
ListenableFuture<Map<String, String>> getMetadata(@PathParam("path") String path);
|
||||
|
||||
/**
|
||||
* @see SDNClient#getFile
|
||||
|
@ -106,6 +108,6 @@ public interface SDNAsyncClient {
|
|||
@Path("/{path}")
|
||||
@OverrideRequestFilters
|
||||
@RequestFilters(InsertUserContextIntoPath.class)
|
||||
Future<String> getFile(@PathParam("path") String path);
|
||||
ListenableFuture<String> getFile(@PathParam("path") String path);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.nirvanix.sdn;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
@ -30,6 +28,8 @@ import org.jclouds.rest.annotations.Endpoint;
|
|||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Nirvanix SDN resources via their REST API.
|
||||
* <p/>
|
||||
|
@ -49,7 +49,7 @@ public interface SDNAuthentication {
|
|||
@GET
|
||||
@ResponseParser(ParseSessionTokenFromJsonResponse.class)
|
||||
@Path("/ws/Authentication/Login.ashx")
|
||||
Future<String> authenticate(@QueryParam(SDNQueryParams.APPKEY) String appKey,
|
||||
ListenableFuture<String> authenticate(@QueryParam(SDNQueryParams.APPKEY) String appKey,
|
||||
@QueryParam(SDNQueryParams.USERNAME) String user,
|
||||
@QueryParam(SDNQueryParams.PASSWORD) String password);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.rackspace;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.HeaderParam;
|
||||
|
@ -30,6 +29,8 @@ import org.jclouds.rackspace.reference.RackspaceHeaders;
|
|||
import org.jclouds.rest.annotations.Endpoint;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Rackspace resources via their REST API.
|
||||
* <p/>
|
||||
|
@ -57,7 +58,7 @@ public interface RackspaceAuthentication {
|
|||
@GET
|
||||
@ResponseParser(ParseAuthenticationResponseFromHeaders.class)
|
||||
@Path("/auth")
|
||||
Future<AuthenticationResponse> authenticate(
|
||||
ListenableFuture<AuthenticationResponse> authenticate(
|
||||
@HeaderParam(RackspaceHeaders.AUTH_USER) String user,
|
||||
@HeaderParam(RackspaceHeaders.AUTH_KEY) String key);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.net.URI;
|
|||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -76,11 +75,13 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Cloud Files via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Cloud Files. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from Cloud Files. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see CloudFilesClient
|
||||
* @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
|
||||
|
@ -100,7 +101,7 @@ public interface CloudFilesAsyncClient {
|
|||
@HEAD
|
||||
@ResponseParser(ParseAccountMetadataResponseFromHeaders.class)
|
||||
@Path("/")
|
||||
Future<AccountMetadata> getAccountStatistics();
|
||||
ListenableFuture<AccountMetadata> getAccountStatistics();
|
||||
|
||||
/**
|
||||
* @see CloudFilesClient#listContainers
|
||||
|
@ -109,14 +110,14 @@ public interface CloudFilesAsyncClient {
|
|||
@ResponseParser(ParseContainerListFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/")
|
||||
Future<? extends SortedSet<ContainerMetadata>> listContainers(ListContainerOptions... options);
|
||||
ListenableFuture<? extends SortedSet<ContainerMetadata>> listContainers(ListContainerOptions... options);
|
||||
|
||||
/**
|
||||
* @see CloudFilesClient#setObjectInfo
|
||||
*/
|
||||
@POST
|
||||
@Path("{container}/{name}")
|
||||
Future<Boolean> setObjectInfo(@PathParam("container") String container,
|
||||
ListenableFuture<Boolean> setObjectInfo(@PathParam("container") String container,
|
||||
@PathParam("name") String name,
|
||||
@BinderParam(BindMapToHeadersWithPrefix.class) Map<String, String> userMetadata);
|
||||
|
||||
|
@ -128,7 +129,7 @@ public interface CloudFilesAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/")
|
||||
@Endpoint(CloudFilesCDN.class)
|
||||
Future<? extends SortedSet<ContainerCDNMetadata>> listCDNContainers(
|
||||
ListenableFuture<? extends SortedSet<ContainerCDNMetadata>> listCDNContainers(
|
||||
ListCdnContainerOptions... options);
|
||||
|
||||
// TODO: Container name is not included in CDN HEAD response headers, so we cannot populate it
|
||||
|
@ -141,7 +142,7 @@ public interface CloudFilesAsyncClient {
|
|||
@ExceptionParser(ThrowContainerNotFoundOn404.class)
|
||||
@Path("{container}")
|
||||
@Endpoint(CloudFilesCDN.class)
|
||||
Future<ContainerCDNMetadata> getCDNMetadata(@PathParam("container") String container);
|
||||
ListenableFuture<ContainerCDNMetadata> getCDNMetadata(@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
* @see CloudFilesClient#enableCDN(String, long);
|
||||
|
@ -151,7 +152,7 @@ public interface CloudFilesAsyncClient {
|
|||
@Headers(keys = CloudFilesHeaders.CDN_ENABLED, values = "True")
|
||||
@ResponseParser(ParseCdnUriFromHeaders.class)
|
||||
@Endpoint(CloudFilesCDN.class)
|
||||
Future<URI> enableCDN(@PathParam("container") String container,
|
||||
ListenableFuture<URI> enableCDN(@PathParam("container") String container,
|
||||
@HeaderParam(CloudFilesHeaders.CDN_TTL) long ttl);
|
||||
|
||||
/**
|
||||
|
@ -162,7 +163,7 @@ public interface CloudFilesAsyncClient {
|
|||
@Headers(keys = CloudFilesHeaders.CDN_ENABLED, values = "True")
|
||||
@ResponseParser(ParseCdnUriFromHeaders.class)
|
||||
@Endpoint(CloudFilesCDN.class)
|
||||
Future<URI> enableCDN(@PathParam("container") String container);
|
||||
ListenableFuture<URI> enableCDN(@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
* @see CloudFilesClient#updateCDN
|
||||
|
@ -171,7 +172,7 @@ public interface CloudFilesAsyncClient {
|
|||
@Path("{container}")
|
||||
@ResponseParser(ParseCdnUriFromHeaders.class)
|
||||
@Endpoint(CloudFilesCDN.class)
|
||||
Future<URI> updateCDN(@PathParam("container") String container,
|
||||
ListenableFuture<URI> updateCDN(@PathParam("container") String container,
|
||||
@HeaderParam(CloudFilesHeaders.CDN_TTL) long ttl);
|
||||
|
||||
/**
|
||||
|
@ -181,14 +182,14 @@ public interface CloudFilesAsyncClient {
|
|||
@Path("{container}")
|
||||
@Headers(keys = CloudFilesHeaders.CDN_ENABLED, values = "False")
|
||||
@Endpoint(CloudFilesCDN.class)
|
||||
Future<Boolean> disableCDN(@PathParam("container") String container);
|
||||
ListenableFuture<Boolean> disableCDN(@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
* @see CloudFilesClient#createContainer
|
||||
*/
|
||||
@PUT
|
||||
@Path("{container}")
|
||||
Future<Boolean> createContainer(@PathParam("container") String container);
|
||||
ListenableFuture<Boolean> createContainer(@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
* @see CloudFilesClient#deleteContainerIfEmpty
|
||||
|
@ -196,7 +197,7 @@ public interface CloudFilesAsyncClient {
|
|||
@DELETE
|
||||
@ExceptionParser(ReturnTrueOn404FalseOn409.class)
|
||||
@Path("{container}")
|
||||
Future<Boolean> deleteContainerIfEmpty(@PathParam("container") String container);
|
||||
ListenableFuture<Boolean> deleteContainerIfEmpty(@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
* @see CloudFilesClient#listObjects
|
||||
|
@ -205,7 +206,7 @@ public interface CloudFilesAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@ResponseParser(ParseObjectInfoListFromJsonResponse.class)
|
||||
@Path("{container}")
|
||||
Future<ListContainerResponse<ObjectInfo>> listObjects(@PathParam("container") String container,
|
||||
ListenableFuture<ListContainerResponse<ObjectInfo>> listObjects(@PathParam("container") String container,
|
||||
ListContainerOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -214,7 +215,7 @@ public interface CloudFilesAsyncClient {
|
|||
@HEAD
|
||||
@Path("{container}")
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
Future<Boolean> containerExists(@PathParam("container") String container);
|
||||
ListenableFuture<Boolean> containerExists(@PathParam("container") String container);
|
||||
|
||||
/**
|
||||
* @see CloudFilesClient#putObject
|
||||
|
@ -222,7 +223,7 @@ public interface CloudFilesAsyncClient {
|
|||
@PUT
|
||||
@Path("{container}/{name}")
|
||||
@ResponseParser(ParseETagHeader.class)
|
||||
Future<String> putObject(
|
||||
ListenableFuture<String> putObject(
|
||||
@PathParam("container") String container,
|
||||
@PathParam("name") @ParamParser(ObjectName.class) @BinderParam(BindCFObjectToPayload.class) CFObject object);
|
||||
|
||||
|
@ -233,7 +234,7 @@ public interface CloudFilesAsyncClient {
|
|||
@ResponseParser(ParseObjectFromHeadersAndHttpContent.class)
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@Path("{container}/{name}")
|
||||
Future<CFObject> getObject(@PathParam("container") String container,
|
||||
ListenableFuture<CFObject> getObject(@PathParam("container") String container,
|
||||
@PathParam("name") String name, GetOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -243,7 +244,7 @@ public interface CloudFilesAsyncClient {
|
|||
@ResponseParser(ParseObjectInfoFromHeaders.class)
|
||||
@ExceptionParser(ThrowKeyNotFoundOn404.class)
|
||||
@Path("{container}/{name}")
|
||||
Future<MutableObjectInfoWithMetadata> getObjectInfo(@PathParam("container") String container,
|
||||
ListenableFuture<MutableObjectInfoWithMetadata> getObjectInfo(@PathParam("container") String container,
|
||||
@PathParam("name") String name);
|
||||
|
||||
/**
|
||||
|
@ -252,7 +253,7 @@ public interface CloudFilesAsyncClient {
|
|||
@DELETE
|
||||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
@Path("{container}/{name}")
|
||||
Future<Void> removeObject(@PathParam("container") String container,
|
||||
ListenableFuture<Void> removeObject(@PathParam("container") String container,
|
||||
@PathParam("name") String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.net.URI;
|
|||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.blobstore.domain.ListContainerResponse;
|
||||
|
@ -37,11 +36,13 @@ import org.jclouds.rackspace.cloudfiles.domain.ObjectInfo;
|
|||
import org.jclouds.rackspace.cloudfiles.options.ListCdnContainerOptions;
|
||||
import org.jclouds.rackspace.cloudfiles.options.ListContainerOptions;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Cloud Files via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Cloud Files. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from Cloud Files. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -25,7 +25,6 @@ import static org.jclouds.blobstore.options.ListContainerOptions.Builder.recursi
|
|||
import java.util.SortedSet;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -61,7 +60,12 @@ import org.jclouds.rackspace.cloudfiles.domain.ObjectInfo;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class CloudFilesAsyncBlobStore extends BaseCloudFilesBlobStore implements AsyncBlobStore {
|
||||
|
||||
@Inject
|
||||
|
@ -83,9 +87,9 @@ public class CloudFilesAsyncBlobStore extends BaseCloudFilesBlobStore implements
|
|||
/**
|
||||
* This implementation uses the CloudFiles HEAD Object command to return the result
|
||||
*/
|
||||
public Future<BlobMetadata> blobMetadata(String container, String key) {
|
||||
public ListenableFuture<BlobMetadata> blobMetadata(String container, String key) {
|
||||
|
||||
return compose(makeListenable(async.getObjectInfo(container, key)),
|
||||
return compose(async.getObjectInfo(container, key),
|
||||
new Function<MutableObjectInfoWithMetadata, BlobMetadata>() {
|
||||
|
||||
@Override
|
||||
|
@ -96,23 +100,23 @@ public class CloudFilesAsyncBlobStore extends BaseCloudFilesBlobStore implements
|
|||
}, service);
|
||||
}
|
||||
|
||||
public Future<Void> clearContainer(final String container) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> clearContainer(final String container) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
clearContainerStrategy.execute(container, recursive());
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> createContainer(String container) {
|
||||
public ListenableFuture<Boolean> createContainer(String container) {
|
||||
return async.createContainer(container);
|
||||
}
|
||||
|
||||
public Future<Void> deleteContainer(final String container) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> deleteContainer(final String container) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
clearContainerStrategy.execute(container, recursive());
|
||||
|
@ -120,23 +124,23 @@ public class CloudFilesAsyncBlobStore extends BaseCloudFilesBlobStore implements
|
|||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> containerExists(String container) {
|
||||
public ListenableFuture<Boolean> containerExists(String container) {
|
||||
return async.containerExists(container);
|
||||
}
|
||||
|
||||
public Future<Blob> getBlob(String container, String key,
|
||||
public ListenableFuture<Blob> getBlob(String container, String key,
|
||||
org.jclouds.blobstore.options.GetOptions... optionsList) {
|
||||
GetOptions httpOptions = blob2ObjectGetOptions.apply(optionsList);
|
||||
Future<CFObject> returnVal = async.getObject(container, key, httpOptions);
|
||||
return compose(makeListenable(returnVal), object2Blob, service);
|
||||
ListenableFuture<CFObject> returnVal = async.getObject(container, key, httpOptions);
|
||||
return compose(returnVal, object2Blob, service);
|
||||
}
|
||||
|
||||
public Future<? extends ListResponse<? extends ResourceMetadata>> list() {
|
||||
public ListenableFuture<? extends ListResponse<? extends ResourceMetadata>> list() {
|
||||
return compose(
|
||||
makeListenable(async.listContainers()),
|
||||
async.listContainers(),
|
||||
new Function<SortedSet<ContainerMetadata>, org.jclouds.blobstore.domain.ListResponse<? extends ResourceMetadata>>() {
|
||||
public org.jclouds.blobstore.domain.ListResponse<? extends ResourceMetadata> apply(
|
||||
SortedSet<ContainerMetadata> from) {
|
||||
|
@ -146,36 +150,36 @@ public class CloudFilesAsyncBlobStore extends BaseCloudFilesBlobStore implements
|
|||
}, service);
|
||||
}
|
||||
|
||||
public Future<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
public ListenableFuture<? extends ListContainerResponse<? extends ResourceMetadata>> list(
|
||||
String container, ListContainerOptions... optionsList) {
|
||||
org.jclouds.rackspace.cloudfiles.options.ListContainerOptions httpOptions = container2ContainerListOptions
|
||||
.apply(optionsList);
|
||||
Future<ListContainerResponse<ObjectInfo>> returnVal = async.listObjects(container,
|
||||
ListenableFuture<ListContainerResponse<ObjectInfo>> returnVal = async.listObjects(container,
|
||||
httpOptions);
|
||||
return compose(makeListenable(returnVal), container2ResourceList, service);
|
||||
return compose(returnVal, container2ResourceList, service);
|
||||
}
|
||||
|
||||
public Future<String> putBlob(String container, Blob blob) {
|
||||
public ListenableFuture<String> putBlob(String container, Blob blob) {
|
||||
return async.putObject(container, blob2Object.apply(blob));
|
||||
}
|
||||
|
||||
public Future<Void> removeBlob(String container, String key) {
|
||||
public ListenableFuture<Void> removeBlob(String container, String key) {
|
||||
return async.removeObject(container, key);
|
||||
}
|
||||
|
||||
public Future<Void> createDirectory(final String container, final String directory) {
|
||||
return service.submit(new Callable<Void>() {
|
||||
public ListenableFuture<Void> createDirectory(final String container, final String directory) {
|
||||
return makeListenable(service.submit(new Callable<Void>() {
|
||||
|
||||
public Void call() throws Exception {
|
||||
mkdirStrategy.execute(CloudFilesAsyncBlobStore.this, container, directory);
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public Future<Boolean> directoryExists(final String container, final String directory) {
|
||||
return service.submit(new Callable<Boolean>() {
|
||||
public ListenableFuture<Boolean> directoryExists(final String container, final String directory) {
|
||||
return makeListenable(service.submit(new Callable<Boolean>() {
|
||||
public Boolean call() throws Exception {
|
||||
try {
|
||||
getDirectoryStrategy.execute(CloudFilesAsyncBlobStore.this, container, directory);
|
||||
|
@ -185,7 +189,7 @@ public class CloudFilesAsyncBlobStore extends BaseCloudFilesBlobStore implements
|
|||
}
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.jclouds.rackspace.cloudservers;
|
|||
import java.net.InetAddress;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -77,11 +76,14 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Cloud Servers via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Cloud Servers. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from Cloud Servers. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see CloudServersClient
|
||||
* @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" />
|
||||
|
@ -99,7 +101,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseServerListFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers")
|
||||
Future<? extends List<Server>> listServers(ListOptions... options);
|
||||
ListenableFuture<? extends List<Server>> listServers(ListOptions... options);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#getServer
|
||||
|
@ -108,7 +110,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseServerFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}")
|
||||
Future<Server> getServer(@PathParam("id") int id);
|
||||
ListenableFuture<Server> getServer(@PathParam("id") int id);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#deleteServer
|
||||
|
@ -116,7 +118,7 @@ public interface CloudServersAsyncClient {
|
|||
@DELETE
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/servers/{id}")
|
||||
Future<Boolean> deleteServer(@PathParam("id") int id);
|
||||
ListenableFuture<Boolean> deleteServer(@PathParam("id") int id);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#rebootServer
|
||||
|
@ -125,7 +127,7 @@ public interface CloudServersAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}/action")
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
Future<Boolean> rebootServer(@PathParam("id") int id,
|
||||
ListenableFuture<Boolean> rebootServer(@PathParam("id") int id,
|
||||
@BinderParam(BindRebootTypeToJsonPayload.class) RebootType rebootType);
|
||||
|
||||
/**
|
||||
|
@ -135,7 +137,7 @@ public interface CloudServersAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}/action")
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
Future<Boolean> resizeServer(@PathParam("id") int id,
|
||||
ListenableFuture<Boolean> resizeServer(@PathParam("id") int id,
|
||||
@BinderParam(BindResizeFlavorToJsonPayload.class) int flavorId);
|
||||
|
||||
/**
|
||||
|
@ -145,7 +147,7 @@ public interface CloudServersAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}/action")
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
Future<Boolean> confirmResizeServer(
|
||||
ListenableFuture<Boolean> confirmResizeServer(
|
||||
@PathParam("id") @BinderParam(BindConfirmResizeToJsonPayload.class) int id);
|
||||
|
||||
/**
|
||||
|
@ -155,7 +157,7 @@ public interface CloudServersAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}/action")
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
Future<Boolean> revertResizeServer(
|
||||
ListenableFuture<Boolean> revertResizeServer(
|
||||
@PathParam("id") @BinderParam(BindRevertResizeToJsonPayload.class) int id);
|
||||
|
||||
/**
|
||||
|
@ -166,7 +168,7 @@ public interface CloudServersAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers")
|
||||
@MapBinder(CreateServerOptions.class)
|
||||
Future<Server> createServer(@MapPayloadParam("name") String name,
|
||||
ListenableFuture<Server> createServer(@MapPayloadParam("name") String name,
|
||||
@MapPayloadParam("imageId") int imageId, @MapPayloadParam("flavorId") int flavorId,
|
||||
CreateServerOptions... options);
|
||||
|
||||
|
@ -178,7 +180,7 @@ public interface CloudServersAsyncClient {
|
|||
@Path("/servers/{id}/action")
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@MapBinder(RebuildServerOptions.class)
|
||||
Future<Boolean> rebuildServer(@PathParam("id") int id, RebuildServerOptions... options);
|
||||
ListenableFuture<Boolean> rebuildServer(@PathParam("id") int id, RebuildServerOptions... options);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#shareIp
|
||||
|
@ -187,7 +189,7 @@ public interface CloudServersAsyncClient {
|
|||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/servers/{id}/ips/public/{address}")
|
||||
@MapBinder(BindSharedIpGroupToJsonPayload.class)
|
||||
Future<Boolean> shareIp(
|
||||
ListenableFuture<Boolean> shareIp(
|
||||
@PathParam("address") @ParamParser(IpAddress.class) InetAddress addressToShare,
|
||||
@PathParam("id") int serverToTosignBindressTo,
|
||||
@MapPayloadParam("sharedIpGroupId") int sharedIpGroup,
|
||||
|
@ -199,7 +201,7 @@ public interface CloudServersAsyncClient {
|
|||
@DELETE
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/servers/{id}/ips/public/{address}")
|
||||
Future<Boolean> unshareIp(
|
||||
ListenableFuture<Boolean> unshareIp(
|
||||
@PathParam("address") @ParamParser(IpAddress.class) InetAddress addressToShare,
|
||||
@PathParam("id") int serverToTosignBindressTo);
|
||||
|
||||
|
@ -209,7 +211,7 @@ public interface CloudServersAsyncClient {
|
|||
@PUT
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/servers/{id}")
|
||||
Future<Boolean> changeAdminPass(@PathParam("id") int id,
|
||||
ListenableFuture<Boolean> changeAdminPass(@PathParam("id") int id,
|
||||
@BinderParam(BindAdminPassToJsonPayload.class) String adminPass);
|
||||
|
||||
/**
|
||||
|
@ -218,7 +220,7 @@ public interface CloudServersAsyncClient {
|
|||
@PUT
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/servers/{id}")
|
||||
Future<Boolean> renameServer(@PathParam("id") int id,
|
||||
ListenableFuture<Boolean> renameServer(@PathParam("id") int id,
|
||||
@BinderParam(BindServerNameToJsonPayload.class) String newName);
|
||||
|
||||
/**
|
||||
|
@ -228,7 +230,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseFlavorListFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/flavors")
|
||||
Future<? extends List<Flavor>> listFlavors(ListOptions... options);
|
||||
ListenableFuture<? extends List<Flavor>> listFlavors(ListOptions... options);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#getFlavor
|
||||
|
@ -237,7 +239,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseFlavorFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/flavors/{id}")
|
||||
Future<Flavor> getFlavor(@PathParam("id") int id);
|
||||
ListenableFuture<Flavor> getFlavor(@PathParam("id") int id);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#listImages
|
||||
|
@ -246,7 +248,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseImageListFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/images")
|
||||
Future<? extends List<Image>> listImages(ListOptions... options);
|
||||
ListenableFuture<? extends List<Image>> listImages(ListOptions... options);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#getImage
|
||||
|
@ -255,7 +257,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseImageFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/images/{id}")
|
||||
Future<Image> getImage(@PathParam("id") int id);
|
||||
ListenableFuture<Image> getImage(@PathParam("id") int id);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#deleteImage
|
||||
|
@ -263,7 +265,7 @@ public interface CloudServersAsyncClient {
|
|||
@DELETE
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/images/{id}")
|
||||
Future<Boolean> deleteImage(@PathParam("id") int id);
|
||||
ListenableFuture<Boolean> deleteImage(@PathParam("id") int id);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#createImageFromServer
|
||||
|
@ -273,7 +275,7 @@ public interface CloudServersAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@MapBinder(BindCreateImageToJsonPayload.class)
|
||||
@Path("/images")
|
||||
Future<Image> createImageFromServer(@MapPayloadParam("imageName") String imageName,
|
||||
ListenableFuture<Image> createImageFromServer(@MapPayloadParam("imageName") String imageName,
|
||||
@MapPayloadParam("serverId") int serverId);
|
||||
|
||||
/**
|
||||
|
@ -283,7 +285,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseSharedIpGroupListFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/shared_ip_groups")
|
||||
Future<? extends List<SharedIpGroup>> listSharedIpGroups(ListOptions... options);
|
||||
ListenableFuture<? extends List<SharedIpGroup>> listSharedIpGroups(ListOptions... options);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#getSharedIpGroup
|
||||
|
@ -292,7 +294,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseSharedIpGroupFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/shared_ip_groups/{id}")
|
||||
Future<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id);
|
||||
ListenableFuture<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#createSharedIpGroup
|
||||
|
@ -302,7 +304,7 @@ public interface CloudServersAsyncClient {
|
|||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/shared_ip_groups")
|
||||
@MapBinder(CreateSharedIpGroupOptions.class)
|
||||
Future<SharedIpGroup> createSharedIpGroup(@MapPayloadParam("name") String name,
|
||||
ListenableFuture<SharedIpGroup> createSharedIpGroup(@MapPayloadParam("name") String name,
|
||||
CreateSharedIpGroupOptions... options);
|
||||
|
||||
/**
|
||||
|
@ -311,7 +313,7 @@ public interface CloudServersAsyncClient {
|
|||
@DELETE
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/shared_ip_groups/{id}")
|
||||
Future<Boolean> deleteSharedIpGroup(@PathParam("id") int id);
|
||||
ListenableFuture<Boolean> deleteSharedIpGroup(@PathParam("id") int id);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#listBackupSchedule
|
||||
|
@ -320,7 +322,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseBackupScheduleFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}/backup_schedule")
|
||||
Future<BackupSchedule> listBackupSchedule(@PathParam("id") int serverId);
|
||||
ListenableFuture<BackupSchedule> listBackupSchedule(@PathParam("id") int serverId);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#deleteBackupSchedule
|
||||
|
@ -328,7 +330,7 @@ public interface CloudServersAsyncClient {
|
|||
@DELETE
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/servers/{id}/backup_schedule")
|
||||
Future<Boolean> deleteBackupSchedule(@PathParam("id") int serverId);
|
||||
ListenableFuture<Boolean> deleteBackupSchedule(@PathParam("id") int serverId);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#replaceBackupSchedule
|
||||
|
@ -336,7 +338,7 @@ public interface CloudServersAsyncClient {
|
|||
@POST
|
||||
@ExceptionParser(ReturnFalseOn404.class)
|
||||
@Path("/servers/{id}/backup_schedule")
|
||||
Future<Boolean> replaceBackupSchedule(@PathParam("id") int id,
|
||||
ListenableFuture<Boolean> replaceBackupSchedule(@PathParam("id") int id,
|
||||
@BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
|
||||
|
||||
/**
|
||||
|
@ -346,7 +348,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseAddressesFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}/ips")
|
||||
Future<Addresses> listAddresses(@PathParam("id") int serverId);
|
||||
ListenableFuture<Addresses> listAddresses(@PathParam("id") int serverId);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#listPublicAddresses
|
||||
|
@ -355,7 +357,7 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseInetAddressListFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}/ips/public")
|
||||
Future<? extends List<InetAddress>> listPublicAddresses(@PathParam("id") int serverId);
|
||||
ListenableFuture<? extends List<InetAddress>> listPublicAddresses(@PathParam("id") int serverId);
|
||||
|
||||
/**
|
||||
* @see CloudServersClient#listPrivateAddresses
|
||||
|
@ -364,6 +366,6 @@ public interface CloudServersAsyncClient {
|
|||
@ResponseParser(ParseInetAddressListFromJsonResponse.class)
|
||||
@QueryParams(keys = "format", values = "json")
|
||||
@Path("/servers/{id}/ips/private")
|
||||
Future<? extends List<InetAddress>> listPrivateAddresses(@PathParam("id") int serverId);
|
||||
ListenableFuture<? extends List<InetAddress>> listPrivateAddresses(@PathParam("id") int serverId);
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.jclouds.rackspace.cloudservers;
|
|||
import java.net.InetAddress;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.PathParam;
|
||||
|
@ -38,12 +37,16 @@ import org.jclouds.rackspace.cloudservers.options.CreateServerOptions;
|
|||
import org.jclouds.rackspace.cloudservers.options.CreateSharedIpGroupOptions;
|
||||
import org.jclouds.rackspace.cloudservers.options.ListOptions;
|
||||
import org.jclouds.rackspace.cloudservers.options.RebuildServerOptions;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to Cloud Servers via their REST API.
|
||||
* <p/>
|
||||
* All commands return a Future of the result from Cloud Servers. Any exceptions incurred during
|
||||
* processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}.
|
||||
* All commands return a ListenableFuture of the result from Cloud Servers. Any exceptions incurred
|
||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
||||
* {@link ListenableFuture#get()}.
|
||||
*
|
||||
* @see CloudServersAsyncClient
|
||||
* @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" />
|
||||
|
@ -68,7 +71,8 @@ public interface CloudServersClient {
|
|||
*
|
||||
* This operation returns details of the specified server.
|
||||
*
|
||||
* @throws ResourceNotFoundException if the server is not found
|
||||
* @throws ResourceNotFoundException
|
||||
* if the server is not found
|
||||
* @see Server
|
||||
*/
|
||||
Server getServer(@PathParam("id") int id);
|
||||
|
@ -238,7 +242,8 @@ public interface CloudServersClient {
|
|||
*
|
||||
* This operation returns details of the specified flavor.
|
||||
*
|
||||
* @throws ResourceNotFoundException if the flavor is not found
|
||||
* @throws ResourceNotFoundException
|
||||
* if the flavor is not found
|
||||
* @see Flavor
|
||||
*/
|
||||
Flavor getFlavor(int id);
|
||||
|
@ -256,7 +261,8 @@ public interface CloudServersClient {
|
|||
*
|
||||
* This operation returns details of the specified image.
|
||||
*
|
||||
* @throws ResourceNotFoundException if the image is not found
|
||||
* @throws ResourceNotFoundException
|
||||
* if the image is not found
|
||||
* @see Image
|
||||
*/
|
||||
Image getImage(int id);
|
||||
|
@ -289,7 +295,8 @@ public interface CloudServersClient {
|
|||
* Note: At present, image creation is an asynchronous operation, so coordinating the creation
|
||||
* with data quiescence, etc. is currently not possible.
|
||||
*
|
||||
* @throws ResourceNotFoundException if the server is not found
|
||||
* @throws ResourceNotFoundException
|
||||
* if the server is not found
|
||||
* @see Image
|
||||
*/
|
||||
Image createImageFromServer(String imageName, int serverId);
|
||||
|
@ -307,7 +314,8 @@ public interface CloudServersClient {
|
|||
*
|
||||
* This operation returns details of the specified shared IP group.
|
||||
*
|
||||
* @throws ResourceNotFoundException if the shared IP group is not found
|
||||
* @throws ResourceNotFoundException
|
||||
* if the shared IP group is not found
|
||||
* @see SharedIpGroup
|
||||
*/
|
||||
SharedIpGroup getSharedIpGroup(int id);
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
package org.jclouds.rackspace.cloudfiles.internal;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.util.concurrent.Futures.compose;
|
||||
import static com.google.common.util.concurrent.Futures.immediateFuture;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -53,7 +53,7 @@ import org.jclouds.rackspace.cloudfiles.options.ListCdnContainerOptions;
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Implementation of {@link CloudFilesAsyncClient} which keeps all data in a local Map object.
|
||||
|
@ -89,46 +89,45 @@ public class StubCloudFilesAsyncClient implements CloudFilesAsyncClient {
|
|||
this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList");
|
||||
}
|
||||
|
||||
public Future<Boolean> containerExists(final String container) {
|
||||
public ListenableFuture<Boolean> containerExists(final String container) {
|
||||
return immediateFuture(blobStore.getContainerToBlobs().containsKey(container));
|
||||
}
|
||||
|
||||
public Future<Boolean> createContainer(String container) {
|
||||
public ListenableFuture<Boolean> createContainer(String container) {
|
||||
return blobStore.createContainer(container);
|
||||
}
|
||||
|
||||
public Future<Boolean> deleteContainerIfEmpty(String container) {
|
||||
public ListenableFuture<Boolean> deleteContainerIfEmpty(String container) {
|
||||
return blobStore.deleteContainerImpl(container);
|
||||
}
|
||||
|
||||
public Future<Boolean> disableCDN(String container) {
|
||||
public ListenableFuture<Boolean> disableCDN(String container) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<URI> enableCDN(String container, long ttl) {
|
||||
public ListenableFuture<URI> enableCDN(String container, long ttl) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<URI> enableCDN(String container) {
|
||||
public ListenableFuture<URI> enableCDN(String container) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<AccountMetadata> getAccountStatistics() {
|
||||
public ListenableFuture<AccountMetadata> getAccountStatistics() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<ContainerCDNMetadata> getCDNMetadata(String container) {
|
||||
public ListenableFuture<ContainerCDNMetadata> getCDNMetadata(String container) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<CFObject> getObject(String container, String key, GetOptions... options) {
|
||||
public ListenableFuture<CFObject> getObject(String container, String key, GetOptions... options) {
|
||||
org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.getBlob(container, key, getOptions)),
|
||||
blob2Object);
|
||||
return compose(blobStore.getBlob(container, key, getOptions), blob2Object);
|
||||
}
|
||||
|
||||
public Future<MutableObjectInfoWithMetadata> getObjectInfo(String container, String key) {
|
||||
return Futures.compose(Futures.makeListenable(blobStore.blobMetadata(container, key)),
|
||||
public ListenableFuture<MutableObjectInfoWithMetadata> getObjectInfo(String container, String key) {
|
||||
return compose(blobStore.blobMetadata(container, key),
|
||||
new Function<BlobMetadata, MutableObjectInfoWithMetadata>() {
|
||||
|
||||
@Override
|
||||
|
@ -140,12 +139,12 @@ public class StubCloudFilesAsyncClient implements CloudFilesAsyncClient {
|
|||
});
|
||||
}
|
||||
|
||||
public Future<? extends SortedSet<ContainerCDNMetadata>> listCDNContainers(
|
||||
public ListenableFuture<? extends SortedSet<ContainerCDNMetadata>> listCDNContainers(
|
||||
ListCdnContainerOptions... options) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<? extends SortedSet<ContainerMetadata>> listContainers(
|
||||
public ListenableFuture<? extends SortedSet<ContainerMetadata>> listContainers(
|
||||
org.jclouds.rackspace.cloudfiles.options.ListContainerOptions... options) {
|
||||
return immediateFuture(Sets.newTreeSet(Iterables.transform(blobStore.getContainerToBlobs()
|
||||
.keySet(), new Function<String, ContainerMetadata>() {
|
||||
|
@ -155,27 +154,26 @@ public class StubCloudFilesAsyncClient implements CloudFilesAsyncClient {
|
|||
})));
|
||||
}
|
||||
|
||||
public Future<ListContainerResponse<ObjectInfo>> listObjects(String container,
|
||||
public ListenableFuture<ListContainerResponse<ObjectInfo>> listObjects(String container,
|
||||
org.jclouds.rackspace.cloudfiles.options.ListContainerOptions... optionsList) {
|
||||
ListContainerOptions options = container2ContainerListOptions.apply(optionsList);
|
||||
return Futures.compose(Futures.makeListenable(blobStore.list(container, options)),
|
||||
resource2ObjectList);
|
||||
return compose(blobStore.list(container, options), resource2ObjectList);
|
||||
}
|
||||
|
||||
public Future<String> putObject(String container, CFObject object) {
|
||||
public ListenableFuture<String> putObject(String container, CFObject object) {
|
||||
return blobStore.putBlob(container, object2Blob.apply(object));
|
||||
}
|
||||
|
||||
public Future<Void> removeObject(String container, String key) {
|
||||
public ListenableFuture<Void> removeObject(String container, String key) {
|
||||
return blobStore.removeBlob(container, key);
|
||||
}
|
||||
|
||||
public Future<Boolean> setObjectInfo(String container, String key,
|
||||
public ListenableFuture<Boolean> setObjectInfo(String container, String key,
|
||||
Map<String, String> userMetadata) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public Future<URI> updateCDN(String container, long ttl) {
|
||||
public ListenableFuture<URI> updateCDN(String container, long ttl) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,23 +18,49 @@
|
|||
*/
|
||||
package org.jclouds.rimuhosting.miro;
|
||||
|
||||
import org.jclouds.rest.annotations.*;
|
||||
import org.jclouds.rimuhosting.miro.binder.RimuHostingRebootJsonBinder;
|
||||
import org.jclouds.rimuhosting.miro.binder.RimuHostingCreateInstanceBinder;
|
||||
import org.jclouds.rimuhosting.miro.domain.*;
|
||||
import org.jclouds.rimuhosting.miro.filters.RimuHostingAuthentication;
|
||||
import org.jclouds.rimuhosting.miro.functions.*;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.rest.annotations.Endpoint;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.MapPayloadParam;
|
||||
import org.jclouds.rest.annotations.MatrixParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rimuhosting.miro.binder.RimuHostingCreateInstanceBinder;
|
||||
import org.jclouds.rimuhosting.miro.binder.RimuHostingRebootJsonBinder;
|
||||
import org.jclouds.rimuhosting.miro.domain.Image;
|
||||
import org.jclouds.rimuhosting.miro.domain.NewServerResponse;
|
||||
import org.jclouds.rimuhosting.miro.domain.PricingPlan;
|
||||
import org.jclouds.rimuhosting.miro.domain.Server;
|
||||
import org.jclouds.rimuhosting.miro.domain.ServerInfo;
|
||||
import org.jclouds.rimuhosting.miro.filters.RimuHostingAuthentication;
|
||||
import org.jclouds.rimuhosting.miro.functions.ParseDestroyResponseFromJsonResponse;
|
||||
import org.jclouds.rimuhosting.miro.functions.ParseImagesFromJsonResponse;
|
||||
import org.jclouds.rimuhosting.miro.functions.ParseInstanceFromJsonResponse;
|
||||
import org.jclouds.rimuhosting.miro.functions.ParseInstanceInfoFromJsonResponse;
|
||||
import org.jclouds.rimuhosting.miro.functions.ParseInstancesFromJsonResponse;
|
||||
import org.jclouds.rimuhosting.miro.functions.ParseNewInstanceResponseFromJsonResponse;
|
||||
import org.jclouds.rimuhosting.miro.functions.ParsePricingPlansFromJsonResponse;
|
||||
import org.jclouds.rimuhosting.miro.functions.ParseRimuHostingException;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to RimuHosting via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* @author Ivan Meredith
|
||||
* @see RimuHostingClient
|
||||
* @see <a href="http://apidocs.rimuhosting.com" />
|
||||
|
@ -43,66 +69,78 @@ import java.util.concurrent.Future;
|
|||
@Endpoint(RimuHosting.class)
|
||||
public interface RimuHostingAsyncClient {
|
||||
|
||||
@GET @Path("/distributions")
|
||||
@GET
|
||||
@Path("/distributions")
|
||||
@ResponseParser(ParseImagesFromJsonResponse.class)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ParseRimuHostingException.class)
|
||||
Future<SortedSet<Image>> getImageList();
|
||||
ListenableFuture<SortedSet<Image>> getImageList();
|
||||
|
||||
@GET @Path("/orders")
|
||||
@GET
|
||||
@Path("/orders")
|
||||
@ResponseParser(ParseInstancesFromJsonResponse.class)
|
||||
@MatrixParams(keys = "include_inactive", values = "N")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ParseRimuHostingException.class)
|
||||
Future<SortedSet<Server>> getServerList();
|
||||
ListenableFuture<SortedSet<Server>> getServerList();
|
||||
|
||||
@GET @Path("/pricing-plans")
|
||||
@GET
|
||||
@Path("/pricing-plans")
|
||||
@MatrixParams(keys = "server-type", values = "VPS")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ParseRimuHostingException.class)
|
||||
@ResponseParser(ParsePricingPlansFromJsonResponse.class)
|
||||
Future<SortedSet<PricingPlan>> getPricingPlanList();
|
||||
ListenableFuture<SortedSet<PricingPlan>> getPricingPlanList();
|
||||
|
||||
@POST @Path("/orders/new-vps")
|
||||
@POST
|
||||
@Path("/orders/new-vps")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ParseRimuHostingException.class)
|
||||
@ResponseParser(ParseNewInstanceResponseFromJsonResponse.class)
|
||||
@MapBinder(RimuHostingCreateInstanceBinder.class)
|
||||
Future<NewServerResponse> createServer(@MapPayloadParam("name") String name, @MapPayloadParam("imageId") String imageId, @MapPayloadParam("planId") String planId);
|
||||
ListenableFuture<NewServerResponse> createServer(@MapPayloadParam("name") String name,
|
||||
@MapPayloadParam("imageId") String imageId, @MapPayloadParam("planId") String planId);
|
||||
|
||||
@POST @Path("/orders/new-vps")
|
||||
@POST
|
||||
@Path("/orders/new-vps")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ExceptionParser(ParseRimuHostingException.class)
|
||||
@ResponseParser(ParseNewInstanceResponseFromJsonResponse.class)
|
||||
@MapBinder(RimuHostingCreateInstanceBinder.class)
|
||||
Future<NewServerResponse> createServer(@MapPayloadParam("name") String name, @MapPayloadParam("imageId") String imageId, @MapPayloadParam("planId") String planId, @MapPayloadParam("password") String password);
|
||||
ListenableFuture<NewServerResponse> createServer(@MapPayloadParam("name") String name,
|
||||
@MapPayloadParam("imageId") String imageId, @MapPayloadParam("planId") String planId,
|
||||
@MapPayloadParam("password") String password);
|
||||
|
||||
@GET @Path("/orders/order-{id}-blah/vps")
|
||||
@GET
|
||||
@Path("/orders/order-{id}-blah/vps")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ResponseParser(ParseInstanceInfoFromJsonResponse.class)
|
||||
Future<ServerInfo> getServerInfo(@PathParam("id") Long id);
|
||||
ListenableFuture<ServerInfo> getServerInfo(@PathParam("id") Long id);
|
||||
|
||||
@GET @Path("/orders/order-{id}-blah")
|
||||
@GET
|
||||
@Path("/orders/order-{id}-blah")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ResponseParser(ParseInstanceFromJsonResponse.class)
|
||||
@ExceptionParser(ParseRimuHostingException.class)
|
||||
Future<Server> getServer(@PathParam("id") Long id);
|
||||
ListenableFuture<Server> getServer(@PathParam("id") Long id);
|
||||
|
||||
@PUT @Path("/orders/order-{id}-blah/vps/running-state")
|
||||
@PUT
|
||||
@Path("/orders/order-{id}-blah/vps/running-state")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ResponseParser(ParseInstanceInfoFromJsonResponse.class)
|
||||
@MapBinder(RimuHostingRebootJsonBinder.class)
|
||||
@ExceptionParser(ParseRimuHostingException.class)
|
||||
Future<ServerInfo> restartServer(@PathParam("id") Long id);
|
||||
ListenableFuture<ServerInfo> restartServer(@PathParam("id") Long id);
|
||||
|
||||
@DELETE @Path("/orders/order-{id}-blah/vps")
|
||||
@DELETE
|
||||
@Path("/orders/order-{id}-blah/vps")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ResponseParser(ParseDestroyResponseFromJsonResponse.class)
|
||||
@ExceptionParser(ParseRimuHostingException.class)
|
||||
Future<List<String>> destroyServer(@PathParam("id") Long id);
|
||||
ListenableFuture<List<String>> destroyServer(@PathParam("id") Long id);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.twitter;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
@ -31,6 +30,8 @@ import org.jclouds.rest.annotations.ResponseParser;
|
|||
import org.jclouds.twitter.domain.Status;
|
||||
import org.jclouds.twitter.functions.ParseStatusesFromJsonResponse;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Twitter via their REST API.
|
||||
* <p/>
|
||||
|
@ -49,6 +50,6 @@ public interface TwitterAsyncClient {
|
|||
@GET
|
||||
@ResponseParser(ParseStatusesFromJsonResponse.class)
|
||||
@Path("/statuses/mentions.json")
|
||||
Future<SortedSet<Status>> getMyMentions();
|
||||
ListenableFuture<SortedSet<Status>> getMyMentions();
|
||||
|
||||
}
|
||||
|
|
|
@ -18,18 +18,16 @@
|
|||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -71,6 +69,8 @@ import org.jclouds.vcloud.xml.VAppHandler;
|
|||
import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
||||
import org.jclouds.vcloud.xml.VDCHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
* <p/>
|
||||
|
@ -85,93 +85,93 @@ public interface VCloudAsyncClient {
|
|||
@Endpoint(Org.class)
|
||||
@Consumes(ORG_XML)
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
Future<? extends Organization> getDefaultOrganization();
|
||||
ListenableFuture<? extends Organization> getDefaultOrganization();
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/org/{orgId}")
|
||||
@XMLResponseParser(OrgHandler.class)
|
||||
@Consumes(ORG_XML)
|
||||
Future<? extends Organization> getOrganization(@PathParam("orgId") String orgId);
|
||||
ListenableFuture<? extends Organization> getOrganization(@PathParam("orgId") String orgId);
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.Catalog.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
Future<? extends Catalog> getDefaultCatalog();
|
||||
ListenableFuture<? extends Catalog> getDefaultCatalog();
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/catalog/{catalogId}")
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
Future<? extends Catalog> getCatalog(@PathParam("catalogId") String catalogId);
|
||||
ListenableFuture<? extends Catalog> getCatalog(@PathParam("catalogId") String catalogId);
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vAppTemplate/{vAppTemplateId}")
|
||||
@Consumes(VAPPTEMPLATE_XML)
|
||||
@XMLResponseParser(VAppTemplateHandler.class)
|
||||
Future<? extends VAppTemplate> getVAppTemplate(@PathParam("vAppTemplateId") String vAppTemplateId);
|
||||
ListenableFuture<? extends VAppTemplate> getVAppTemplate(@PathParam("vAppTemplateId") String vAppTemplateId);
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/catalogItem/{catalogItemId}")
|
||||
@Consumes(CATALOGITEM_XML)
|
||||
@XMLResponseParser(CatalogItemHandler.class)
|
||||
Future<? extends CatalogItem> getCatalogItem(@PathParam("catalogItemId") String catalogItemId);
|
||||
ListenableFuture<? extends CatalogItem> getCatalogItem(@PathParam("catalogItemId") String catalogItemId);
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/network/{networkId}")
|
||||
@Consumes(NETWORK_XML)
|
||||
@XMLResponseParser(NetworkHandler.class)
|
||||
Future<? extends Network> getNetwork(@PathParam("networkId") String networkId);
|
||||
ListenableFuture<? extends Network> getNetwork(@PathParam("networkId") String networkId);
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VDC.class)
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
Future<? extends VDC> getDefaultVDC();
|
||||
ListenableFuture<? extends VDC> getDefaultVDC();
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vdc/{vDCId}")
|
||||
@XMLResponseParser(VDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
Future<? extends VDC> getVDC(@PathParam("vDCId") String vDCId);
|
||||
ListenableFuture<? extends VDC> getVDC(@PathParam("vDCId") String vDCId);
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/tasksList/{tasksListId}")
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
Future<? extends TasksList> getTasksList(@PathParam("tasksListId") String tasksListId);
|
||||
ListenableFuture<? extends TasksList> getTasksList(@PathParam("tasksListId") String tasksListId);
|
||||
|
||||
@GET
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.TasksList.class)
|
||||
@Consumes(TASKSLIST_XML)
|
||||
@XMLResponseParser(TasksListHandler.class)
|
||||
Future<? extends TasksList> getDefaultTasksList();
|
||||
ListenableFuture<? extends TasksList> getDefaultTasksList();
|
||||
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}/action/deploy")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Future<? extends Task> deployVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<? extends Task> deployVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
@DELETE
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}")
|
||||
Future<Void> deleteVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<Void> deleteVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
@POST
|
||||
@Consumes(TASK_XML)
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}/action/undeploy")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Future<? extends Task> undeployVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<? extends Task> undeployVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
/**
|
||||
* This call powers on the vApp, as specified in the vApp's ovf:Startup element.
|
||||
|
@ -181,7 +181,7 @@ public interface VCloudAsyncClient {
|
|||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}/power/action/powerOn")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Future<? extends Task> powerOnVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<? extends Task> powerOnVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
/**
|
||||
* This call powers off the vApp, as specified in the vApp's ovf:Startup element.
|
||||
|
@ -191,7 +191,7 @@ public interface VCloudAsyncClient {
|
|||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}/power/action/powerOff")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Future<? extends Task> powerOffVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<? extends Task> powerOffVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
/**
|
||||
* This call shuts down the vApp.
|
||||
|
@ -199,7 +199,7 @@ public interface VCloudAsyncClient {
|
|||
@POST
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}/power/action/shutdown")
|
||||
Future<Void> shutdownVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<Void> shutdownVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
/**
|
||||
* This call resets the vApp.
|
||||
|
@ -209,7 +209,7 @@ public interface VCloudAsyncClient {
|
|||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}/power/action/reset")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Future<? extends Task> resetVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<? extends Task> resetVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
/**
|
||||
* This call suspends the vApp.
|
||||
|
@ -219,26 +219,26 @@ public interface VCloudAsyncClient {
|
|||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}/power/action/suspend")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Future<? extends Task> suspendVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<? extends Task> suspendVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
@GET
|
||||
@Consumes(TASK_XML)
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/task/{taskId}")
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
Future<? extends Task> getTask(@PathParam("taskId") String taskId);
|
||||
ListenableFuture<? extends Task> getTask(@PathParam("taskId") String taskId);
|
||||
|
||||
@POST
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/task/{taskId}/action/cancel")
|
||||
Future<Void> cancelTask(@PathParam("taskId") String taskId);
|
||||
ListenableFuture<Void> cancelTask(@PathParam("taskId") String taskId);
|
||||
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/vApp/{vAppId}")
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
Future<? extends VApp> getVApp(@PathParam("vAppId") String appId);
|
||||
ListenableFuture<? extends VApp> getVApp(@PathParam("vAppId") String appId);
|
||||
|
||||
@POST
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
|
@ -247,7 +247,7 @@ public interface VCloudAsyncClient {
|
|||
@Consumes(VAPP_XML)
|
||||
@XMLResponseParser(VAppHandler.class)
|
||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
||||
Future<? extends VApp> instantiateVAppTemplateInVDC(@PathParam("vDCId") String vDCId,
|
||||
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@PathParam("vDCId") String vDCId,
|
||||
@MapPayloadParam("name") String appName,
|
||||
@MapPayloadParam("template") @ParamParser(VAppTemplateIdToUri.class) String templateId,
|
||||
InstantiateVAppTemplateOptions... options);
|
||||
|
@ -259,7 +259,7 @@ public interface VCloudAsyncClient {
|
|||
@Consumes(TASK_XML)
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||
Future<? extends Task> cloneVAppInVDC(@PathParam("vDCId") String vDCId,
|
||||
ListenableFuture<? extends Task> cloneVAppInVDC(@PathParam("vDCId") String vDCId,
|
||||
@MapPayloadParam("vApp") @ParamParser(VAppIdToUri.class) String vAppIdToClone,
|
||||
@MapPayloadParam("newName") String newName, CloneVAppOptions... options);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.vcloud.internal;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -34,6 +33,8 @@ import org.jclouds.vcloud.domain.NamedResource;
|
|||
import org.jclouds.vcloud.endpoints.Org;
|
||||
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Establishes a context with a VCloud endpoint.
|
||||
* <p/>
|
||||
|
@ -60,5 +61,5 @@ public interface VCloudLoginAsyncClient {
|
|||
@POST
|
||||
@ResponseParser(ParseLoginResponseFromHeaders.class)
|
||||
@Consumes(VCloudMediaType.ORGLIST_XML)
|
||||
Future<VCloudSession> login();
|
||||
ListenableFuture<VCloudSession> login();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.vcloud.internal;
|
|||
|
||||
import java.net.URI;
|
||||
import java.util.SortedMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -32,6 +31,8 @@ import org.jclouds.vcloud.VCloudMediaType;
|
|||
import org.jclouds.vcloud.endpoints.VCloud;
|
||||
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Establishes a context with a VCloud endpoint.
|
||||
* <p/>
|
||||
|
@ -49,5 +50,5 @@ public interface VCloudVersionsAsyncClient {
|
|||
@XMLResponseParser(SupportedVersionsHandler.class)
|
||||
@Path("/versions")
|
||||
@Consumes(VCloudMediaType.VCLOUD_XML)
|
||||
Future<SortedMap<String, URI>> getSupportedVersions();
|
||||
ListenableFuture<SortedMap<String, URI>> getSupportedVersions();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import static org.testng.Assert.assertEquals;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -45,6 +45,7 @@ import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -78,8 +79,8 @@ public class VCloudRestClientModuleTest {
|
|||
|
||||
private final AtomicInteger token = new AtomicInteger();
|
||||
|
||||
public Future<VCloudSession> login() {
|
||||
return new Future<VCloudSession>() {
|
||||
public ListenableFuture<VCloudSession> login() {
|
||||
return new ListenableFuture<VCloudSession>() {
|
||||
@Override
|
||||
public VCloudSession get() throws InterruptedException, ExecutionException {
|
||||
return new VCloudSession() {
|
||||
|
@ -115,6 +116,11 @@ public class VCloudRestClientModuleTest {
|
|||
public boolean isDone() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(Runnable listener, Executor exec) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@ package org.jclouds.vcloud.hostingdotcom;
|
|||
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
|
||||
import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -46,6 +44,8 @@ import org.jclouds.vcloud.hostingdotcom.xml.HostingDotComVAppHandler;
|
|||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
* <p/>
|
||||
|
@ -63,7 +63,7 @@ public interface HostingDotComVCloudAsyncClient extends VCloudAsyncClient {
|
|||
// produces is incorrect, but required for hosting.com to operate
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Override
|
||||
Future<? extends Catalog> getDefaultCatalog();
|
||||
ListenableFuture<? extends Catalog> getDefaultCatalog();
|
||||
|
||||
@GET
|
||||
@Consumes(VAPP_XML)
|
||||
|
@ -71,7 +71,7 @@ public interface HostingDotComVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/vapp/{vAppId}")
|
||||
@XMLResponseParser(HostingDotComVAppHandler.class)
|
||||
@Override
|
||||
Future<? extends HostingDotComVApp> getVApp(@PathParam("vAppId") String appId);
|
||||
ListenableFuture<? extends HostingDotComVApp> getVApp(@PathParam("vAppId") String appId);
|
||||
|
||||
@POST
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
|
@ -82,7 +82,7 @@ public interface HostingDotComVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@XMLResponseParser(HostingDotComVAppHandler.class)
|
||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
||||
@Override
|
||||
Future<? extends HostingDotComVApp> instantiateVAppTemplateInVDC(
|
||||
ListenableFuture<? extends HostingDotComVApp> instantiateVAppTemplateInVDC(
|
||||
@PathParam("vDCId") String vDCId, @MapPayloadParam("name") String appName,
|
||||
@MapPayloadParam("template") @ParamParser(VAppTemplateIdToUri.class) String templateId,
|
||||
InstantiateVAppTemplateOptions... options);
|
||||
|
|
|
@ -25,7 +25,6 @@ import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
|||
|
||||
import java.net.InetAddress;
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
|
@ -85,6 +84,8 @@ import org.jclouds.vcloud.terremark.xml.TerremarkVAppHandler;
|
|||
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
|
||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides access to VCloud resources via their REST API.
|
||||
* <p/>
|
||||
|
@ -103,7 +104,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@XMLResponseParser(TerremarkVDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Override
|
||||
Future<? extends VDC> getDefaultVDC();
|
||||
ListenableFuture<? extends VDC> getDefaultVDC();
|
||||
|
||||
/**
|
||||
* Terremark does not have multiple catalogs, so we ignore this parameter.
|
||||
|
@ -112,7 +113,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Endpoint(org.jclouds.vcloud.endpoints.Catalog.class)
|
||||
@XMLResponseParser(CatalogHandler.class)
|
||||
@Consumes(CATALOG_XML)
|
||||
Future<? extends Catalog> getCatalog(String catalogId);
|
||||
ListenableFuture<? extends Catalog> getCatalog(String catalogId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getVDC
|
||||
|
@ -123,7 +124,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@XMLResponseParser(TerremarkVDCHandler.class)
|
||||
@Consumes(VDC_XML)
|
||||
@Override
|
||||
Future<? extends VDC> getVDC(@PathParam("vDCId") String vDCId);
|
||||
ListenableFuture<? extends VDC> getVDC(@PathParam("vDCId") String vDCId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#instantiateVAppTemplateInVDC
|
||||
|
@ -136,8 +137,8 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@XMLResponseParser(TerremarkVAppHandler.class)
|
||||
@MapBinder(TerremarkBindInstantiateVAppTemplateParamsToXmlPayload.class)
|
||||
@Override
|
||||
Future<? extends TerremarkVApp> instantiateVAppTemplateInVDC(@PathParam("vDCId") String vDCId,
|
||||
@MapPayloadParam("name") String appName,
|
||||
ListenableFuture<? extends TerremarkVApp> instantiateVAppTemplateInVDC(
|
||||
@PathParam("vDCId") String vDCId, @MapPayloadParam("name") String appName,
|
||||
@MapPayloadParam("template") @ParamParser(CatalogIdToUri.class) String templateId,
|
||||
InstantiateVAppTemplateOptions... options);
|
||||
|
||||
|
@ -151,8 +152,8 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(InternetServiceHandler.class)
|
||||
@MapBinder(AddInternetServiceOptions.class)
|
||||
Future<? extends InternetService> addInternetServiceToVDC(@PathParam("vDCId") String vDCId,
|
||||
@MapPayloadParam("name") String serviceName,
|
||||
ListenableFuture<? extends InternetService> addInternetServiceToVDC(
|
||||
@PathParam("vDCId") String vDCId, @MapPayloadParam("name") String serviceName,
|
||||
@MapPayloadParam("protocol") Protocol protocol, @MapPayloadParam("port") int port,
|
||||
AddInternetServiceOptions... options);
|
||||
|
||||
|
@ -164,7 +165,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/vdc/{vDCId}/internetServices")
|
||||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
Future<? extends SortedSet<InternetService>> getAllInternetServicesInVDC(
|
||||
ListenableFuture<? extends SortedSet<InternetService>> getAllInternetServicesInVDC(
|
||||
@PathParam("vDCId") String vDCId);
|
||||
|
||||
/**
|
||||
|
@ -177,7 +178,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(InternetServiceHandler.class)
|
||||
@MapBinder(AddInternetServiceOptions.class)
|
||||
Future<? extends InternetService> addInternetServiceToExistingIp(
|
||||
ListenableFuture<? extends InternetService> addInternetServiceToExistingIp(
|
||||
@PathParam("ipId") int existingIpId, @MapPayloadParam("name") String serviceName,
|
||||
@MapPayloadParam("protocol") Protocol protocol, @MapPayloadParam("port") int port,
|
||||
AddInternetServiceOptions... options);
|
||||
|
@ -189,7 +190,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/publicIps/{ipId}")
|
||||
@ExceptionParser(ReturnVoidOnDeleteDefaultIp.class)
|
||||
Future<Void> deletePublicIp(@PathParam("ipId") int ipId);
|
||||
ListenableFuture<Void> deletePublicIp(@PathParam("ipId") int ipId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getInternetServicesOnPublicIP
|
||||
|
@ -199,7 +200,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/publicIps/{ipId}/InternetServices")
|
||||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
Future<? extends SortedSet<InternetService>> getInternetServicesOnPublicIp(
|
||||
ListenableFuture<? extends SortedSet<InternetService>> getInternetServicesOnPublicIp(
|
||||
@PathParam("ipId") int ipId);
|
||||
|
||||
/**
|
||||
|
@ -210,7 +211,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/publicIps/{ipId}")
|
||||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(InternetServicesHandler.class)
|
||||
Future<? extends SortedSet<InternetService>> getPublicIp(@PathParam("ipId") int ipId);
|
||||
ListenableFuture<? extends SortedSet<InternetService>> getPublicIp(@PathParam("ipId") int ipId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getPublicIpsAssociatedWithVDC
|
||||
|
@ -220,7 +221,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/vdc/{vDCId}/publicIps")
|
||||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(PublicIpAddressesHandler.class)
|
||||
Future<? extends SortedSet<PublicIpAddress>> getPublicIpsAssociatedWithVDC(
|
||||
ListenableFuture<? extends SortedSet<PublicIpAddress>> getPublicIpsAssociatedWithVDC(
|
||||
@PathParam("vDCId") String vDCId);
|
||||
|
||||
/**
|
||||
|
@ -229,7 +230,8 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@DELETE
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/internetServices/{internetServiceId}")
|
||||
Future<Void> deleteInternetService(@PathParam("internetServiceId") int internetServiceId);
|
||||
ListenableFuture<Void> deleteInternetService(
|
||||
@PathParam("internetServiceId") int internetServiceId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#configureInternetService
|
||||
|
@ -240,7 +242,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Produces(APPLICATION_XML)
|
||||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(InternetServiceHandler.class)
|
||||
Future<? extends InternetService> configureInternetService(
|
||||
ListenableFuture<? extends InternetService> configureInternetService(
|
||||
@PathParam("internetServiceId") int internetServiceId,
|
||||
@BinderParam(BindInternetServiceConfigurationToXmlPayload.class) InternetServiceConfiguration nodeConfiguration);
|
||||
|
||||
|
@ -252,7 +254,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/internetServices/{internetServiceId}")
|
||||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(InternetServiceHandler.class)
|
||||
Future<? extends InternetService> getInternetService(
|
||||
ListenableFuture<? extends InternetService> getInternetService(
|
||||
@PathParam("internetServiceId") int internetServiceId);
|
||||
|
||||
/**
|
||||
|
@ -265,7 +267,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
@MapBinder(AddNodeOptions.class)
|
||||
Future<? extends Node> addNode(
|
||||
ListenableFuture<? extends Node> addNode(
|
||||
@PathParam("internetServiceId") int internetServiceId,
|
||||
@MapPayloadParam("ipAddress") @ParamParser(InetAddressToHostAddress.class) InetAddress ipAddress,
|
||||
@MapPayloadParam("name") String name, @MapPayloadParam("port") int port,
|
||||
|
@ -279,7 +281,8 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/internetServices/{internetServiceId}/nodes")
|
||||
@XMLResponseParser(NodesHandler.class)
|
||||
@Consumes(APPLICATION_XML)
|
||||
Future<? extends SortedSet<Node>> getNodes(@PathParam("internetServiceId") int internetServiceId);
|
||||
ListenableFuture<? extends SortedSet<Node>> getNodes(
|
||||
@PathParam("internetServiceId") int internetServiceId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getNode
|
||||
|
@ -289,7 +292,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/nodeServices/{nodeId}")
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
@Consumes(APPLICATION_XML)
|
||||
Future<? extends Node> getNode(@PathParam("nodeId") int nodeId);
|
||||
ListenableFuture<? extends Node> getNode(@PathParam("nodeId") int nodeId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#configureNode
|
||||
|
@ -300,7 +303,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Produces(APPLICATION_XML)
|
||||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(NodeHandler.class)
|
||||
Future<? extends Node> configureNode(
|
||||
ListenableFuture<? extends Node> configureNode(
|
||||
@PathParam("nodeId") int nodeId,
|
||||
@BinderParam(BindNodeConfigurationToXmlPayload.class) NodeConfiguration nodeConfiguration);
|
||||
|
||||
|
@ -310,7 +313,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@DELETE
|
||||
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
|
||||
@Path("/nodeServices/{nodeId}")
|
||||
Future<Void> deleteNode(@PathParam("nodeId") int nodeId);
|
||||
ListenableFuture<Void> deleteNode(@PathParam("nodeId") int nodeId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#getVApp
|
||||
|
@ -321,7 +324,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/vapp/{vAppId}")
|
||||
@XMLResponseParser(TerremarkVAppHandler.class)
|
||||
@Override
|
||||
Future<? extends TerremarkVApp> getVApp(@PathParam("vAppId") String vAppId);
|
||||
ListenableFuture<? extends TerremarkVApp> getVApp(@PathParam("vAppId") String vAppId);
|
||||
|
||||
/**
|
||||
* @see TerremarkVCloudClient#configureVApp
|
||||
|
@ -333,7 +336,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Consumes(VAPP_XML)
|
||||
@MapBinder(BindVAppConfigurationToXmlPayload.class)
|
||||
@ResponseParser(ParseTaskFromLocationHeader.class)
|
||||
Future<? extends Task> configureVApp(
|
||||
ListenableFuture<? extends Task> configureVApp(
|
||||
@PathParam("vAppId") @ParamParser(VAppId.class) TerremarkVApp vApp,
|
||||
VAppConfiguration configuration);
|
||||
|
||||
|
@ -345,7 +348,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/vapp/{vAppId}/options/compute")
|
||||
@XMLResponseParser(ComputeOptionsHandler.class)
|
||||
@Consumes(APPLICATION_XML)
|
||||
Future<? extends SortedSet<ComputeOptions>> getComputeOptionsOfVApp(
|
||||
ListenableFuture<? extends SortedSet<ComputeOptions>> getComputeOptionsOfVApp(
|
||||
@PathParam("vAppId") String vAppId);
|
||||
|
||||
/**
|
||||
|
@ -356,7 +359,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/vapp/{vAppId}/options/customization")
|
||||
@XMLResponseParser(CustomizationParametersHandler.class)
|
||||
@Consumes(APPLICATION_XML)
|
||||
Future<? extends CustomizationParameters> getCustomizationOptionsOfVApp(
|
||||
ListenableFuture<? extends CustomizationParameters> getCustomizationOptionsOfVApp(
|
||||
@PathParam("vAppId") String vAppId);
|
||||
|
||||
/**
|
||||
|
@ -367,7 +370,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/catalogItem/{catalogItemId}/options/compute")
|
||||
@XMLResponseParser(ComputeOptionsHandler.class)
|
||||
@Consumes(APPLICATION_XML)
|
||||
Future<? extends SortedSet<ComputeOptions>> getComputeOptionsOfCatalogItem(
|
||||
ListenableFuture<? extends SortedSet<ComputeOptions>> getComputeOptionsOfCatalogItem(
|
||||
@PathParam("catalogItemId") String catalogItemId);
|
||||
|
||||
/**
|
||||
|
@ -378,7 +381,7 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/catalogItem/{catalogItemId}/options/customization")
|
||||
@XMLResponseParser(CustomizationParametersHandler.class)
|
||||
@Consumes(APPLICATION_XML)
|
||||
Future<? extends CustomizationParameters> getCustomizationOptionsOfCatalogItem(
|
||||
ListenableFuture<? extends CustomizationParameters> getCustomizationOptionsOfCatalogItem(
|
||||
@PathParam("catalogItemId") String catalogItemId);
|
||||
|
||||
/**
|
||||
|
@ -389,6 +392,6 @@ public interface TerremarkVCloudAsyncClient extends VCloudAsyncClient {
|
|||
@Path("/network/{networkId}/ipAddresses")
|
||||
@Consumes(APPLICATION_XML)
|
||||
@XMLResponseParser(IpAddressesHandler.class)
|
||||
Future<? extends SortedSet<IpAddress>> getIpAddressesForNetwork(
|
||||
ListenableFuture<? extends SortedSet<IpAddress>> getIpAddressesForNetwork(
|
||||
@PathParam("networkId") String networkId);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue