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