diff --git a/allcompute/pom.xml b/allcompute/pom.xml
index f878476495..760cb00133 100644
--- a/allcompute/pom.xml
+++ b/allcompute/pom.xml
@@ -49,6 +49,16 @@
jclouds-vcloud
${project.version}
+
+ ${project.groupId}
+ jclouds-bluelock
+ ${project.version}
+
+
+ ${project.groupId}
+ jclouds-terremark
+ ${project.version}
+
${project.groupId}
jclouds-gogrid
diff --git a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__Client.java b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__Client.java
index f739311897..58fbf97ee8 100644
--- a/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__Client.java
+++ b/archetypes/json-client-archetype/src/main/resources/archetype-resources/src/main/java/__providerName__Client.java
@@ -43,7 +43,7 @@ public interface ${providerName}Client {
/*
* Note all these delegate to methods in ${providerName}AsyncClient with a specified or inherited timeout.
* The singatures should match those of ${providerName}AsyncClient, except the returnvals should not be
- * wrapped in a ListenableFuture
+ * wrapped in a Future
*/
String list();
diff --git a/atmos/src/main/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClient.java b/atmos/src/main/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClient.java
index 181526c74f..7fcd486c12 100644
--- a/atmos/src/main/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClient.java
+++ b/atmos/src/main/java/org/jclouds/atmosonline/saas/AtmosStorageAsyncClient.java
@@ -82,7 +82,7 @@ public interface AtmosStorageAsyncClient {
@Path("/rest/namespace")
@ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
@Consumes(MediaType.TEXT_XML)
- ListenableFuture extends BoundedSet extends DirectoryEntry>> listDirectories(
+ ListenableFuture> listDirectories(
ListOptions... options);
/**
@@ -93,7 +93,7 @@ public interface AtmosStorageAsyncClient {
@ResponseParser(ParseDirectoryListFromContentAndHeaders.class)
@ExceptionParser(ThrowContainerNotFoundOn404.class)
@Consumes(MediaType.TEXT_XML)
- ListenableFuture extends BoundedSet extends DirectoryEntry>> listDirectory(
+ ListenableFuture> listDirectory(
@PathParam("directoryName") String directoryName, ListOptions... options);
/**
diff --git a/atmos/src/main/java/org/jclouds/atmosonline/saas/blobstore/AtmosAsyncBlobStore.java b/atmos/src/main/java/org/jclouds/atmosonline/saas/blobstore/AtmosAsyncBlobStore.java
index 70312be621..85096fbc03 100644
--- a/atmos/src/main/java/org/jclouds/atmosonline/saas/blobstore/AtmosAsyncBlobStore.java
+++ b/atmos/src/main/java/org/jclouds/atmosonline/saas/blobstore/AtmosAsyncBlobStore.java
@@ -19,7 +19,8 @@
package org.jclouds.atmosonline.saas.blobstore;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.compose;
+import static org.jclouds.concurrent.ConcurrentUtils.compose;
+import static org.jclouds.concurrent.ConcurrentUtils.makeListenable;
import java.net.URI;
import java.util.Set;
@@ -53,7 +54,6 @@ import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
import org.jclouds.blobstore.internal.BaseAsyncBlobStore;
import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata;
import org.jclouds.blobstore.util.BlobUtils;
-import org.jclouds.concurrent.ConcurrentUtils;
import org.jclouds.domain.Location;
import org.jclouds.encryption.EncryptionService;
import org.jclouds.http.options.GetOptions;
@@ -79,15 +79,12 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
@Inject
AtmosAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
- @Named(Constants.PROPERTY_USER_THREADS) ExecutorService service,
- Location defaultLocation, Set extends Location> locations,
-
- AtmosStorageAsyncClient async, AtmosStorageClient sync, ObjectToBlob object2Blob,
- ObjectToBlobMetadata object2BlobMd, BlobToObject blob2Object,
+ @Named(Constants.PROPERTY_USER_THREADS) ExecutorService service, Location defaultLocation,
+ Set extends Location> locations, AtmosStorageAsyncClient async, AtmosStorageClient sync,
+ ObjectToBlob object2Blob, ObjectToBlobMetadata object2BlobMd, BlobToObject blob2Object,
BlobStoreListOptionsToListOptions container2ContainerListOptions,
- DirectoryEntryListToResourceMetadataList container2ResourceList,
- EncryptionService encryptionService, BlobToHttpGetOptions blob2ObjectGetOptions,
- Provider fetchBlobMetadataProvider) {
+ DirectoryEntryListToResourceMetadataList container2ResourceList, EncryptionService encryptionService,
+ BlobToHttpGetOptions blob2ObjectGetOptions, Provider fetchBlobMetadataProvider) {
super(context, blobUtils, service, defaultLocation, locations);
this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions");
this.sync = checkNotNull(sync, "sync");
@@ -99,8 +96,7 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
this.blob2Object = checkNotNull(blob2Object, "blob2Object");
this.object2BlobMd = checkNotNull(object2BlobMd, "object2BlobMd");
this.encryptionService = checkNotNull(encryptionService, "encryptionService");
- this.fetchBlobMetadataProvider = checkNotNull(fetchBlobMetadataProvider,
- "fetchBlobMetadataProvider");
+ this.fetchBlobMetadataProvider = checkNotNull(fetchBlobMetadataProvider, "fetchBlobMetadataProvider");
}
/**
@@ -108,13 +104,12 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
*/
@Override
public ListenableFuture blobMetadata(String container, String key) {
- return compose(async.headFile(container + "/" + key),
- new Function() {
- @Override
- public BlobMetadata apply(AtmosObject from) {
- return object2BlobMd.apply(from);
- }
- }, service);
+ return compose(async.headFile(container + "/" + key), new Function() {
+ @Override
+ public BlobMetadata apply(AtmosObject from) {
+ return object2BlobMd.apply(from);
+ }
+ }, service);
}
/**
@@ -130,7 +125,7 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
return true;
}
- });
+ }, service);
}
/**
@@ -144,7 +139,7 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
return null;// no etag
}
- });
+ }, service);
}
/**
@@ -197,8 +192,7 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
* This implementation invokes {@link AtmosStorageAsyncClient#readFile}
*/
@Override
- public ListenableFuture getBlob(String container, String key,
- org.jclouds.blobstore.options.GetOptions options) {
+ public ListenableFuture getBlob(String container, String key, org.jclouds.blobstore.options.GetOptions options) {
GetOptions httpOptions = blob2ObjectGetOptions.apply(options);
ListenableFuture returnVal = async.readFile(container + "/" + key, httpOptions);
return compose(returnVal, object2Blob, service);
@@ -208,7 +202,7 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
* This implementation invokes {@link AtmosStorageAsyncClient#listDirectories}
*/
@Override
- public ListenableFuture extends PageSet extends StorageMetadata>> list() {
+ public ListenableFuture> list() {
return compose(async.listDirectories(), container2ResourceList, service);
}
@@ -216,16 +210,14 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
* This implementation invokes {@link AtmosStorageAsyncClient#listDirectory}
*/
@Override
- public ListenableFuture extends PageSet extends StorageMetadata>> list(String container,
+ public ListenableFuture> list(String container,
org.jclouds.blobstore.options.ListContainerOptions options) {
container = AtmosStorageUtils.adjustContainerIfDirOptionPresent(container, options);
ListOptions nativeOptions = container2ContainerListOptions.apply(options);
- ListenableFuture extends BoundedSet extends DirectoryEntry>> returnVal = async
- .listDirectory(container, nativeOptions);
- ListenableFuture> list = compose(returnVal,
- container2ResourceList, service);
- return options.isDetailed() ? compose(list, fetchBlobMetadataProvider.get().setContainerName(
- container), service) : list;
+ ListenableFuture> returnVal = async.listDirectory(container, nativeOptions);
+ ListenableFuture> list = compose(returnVal, container2ResourceList, service);
+ return (ListenableFuture>) (options.isDetailed() ? compose(list,
+ fetchBlobMetadataProvider.get().setContainerName(container), service) : list);
}
/**
@@ -235,7 +227,7 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
*/
@Override
public ListenableFuture putBlob(final String container, final Blob blob) {
- return ConcurrentUtils.makeListenable(service.submit(new Callable() {
+ return makeListenable(service.submit(new Callable() {
@Override
public String call() throws Exception {
diff --git a/atmos/src/main/java/org/jclouds/atmosonline/saas/blobstore/strategy/FindMD5InUserMetadata.java b/atmos/src/main/java/org/jclouds/atmosonline/saas/blobstore/strategy/FindMD5InUserMetadata.java
index 614595b7ed..d9e764ce5e 100644
--- a/atmos/src/main/java/org/jclouds/atmosonline/saas/blobstore/strategy/FindMD5InUserMetadata.java
+++ b/atmos/src/main/java/org/jclouds/atmosonline/saas/blobstore/strategy/FindMD5InUserMetadata.java
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;
@@ -42,6 +43,7 @@ import org.jclouds.blobstore.internal.BlobRuntimeException;
import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import org.jclouds.blobstore.strategy.ListBlobsInContainer;
+import static org.jclouds.concurrent.ConcurrentUtils.*;
import org.jclouds.logging.Logger;
import com.google.common.base.Throwables;
@@ -70,10 +72,8 @@ public class FindMD5InUserMetadata implements ContainsValueInListStrategy {
protected Long maxTime;
@Inject
- private FindMD5InUserMetadata(
- @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userExecutor,
- ObjectMD5 objectMD5, ListBlobsInContainer getAllBlobMetadata,
- AtmosStorageAsyncClient client) {
+ private FindMD5InUserMetadata(@Named(Constants.PROPERTY_USER_THREADS) ExecutorService userExecutor,
+ ObjectMD5 objectMD5, ListBlobsInContainer getAllBlobMetadata, AtmosStorageAsyncClient client) {
this.objectMD5 = objectMD5;
this.getAllBlobMetadata = getAllBlobMetadata;
this.client = client;
@@ -83,10 +83,10 @@ public class FindMD5InUserMetadata implements ContainsValueInListStrategy {
public boolean execute(final String containerName, Object value, ListContainerOptions options) {
final byte[] toSearch = objectMD5.apply(value);
final BlockingQueue queue = new SynchronousQueue();
- Map> responses = Maps.newHashMap();
+ Map> responses = Maps.newHashMap();
for (BlobMetadata md : getAllBlobMetadata.execute(containerName, options)) {
- final ListenableFuture future = client.headFile(containerName + "/"
- + md.getName());
+ final ListenableFuture future = makeListenable(client.headFile(containerName
+ + "/" + md.getName()), userExecutor);
future.addListener(new Runnable() {
public void run() {
try {
@@ -97,8 +97,7 @@ public class FindMD5InUserMetadata implements ContainsValueInListStrategy {
queue.put(true);
}
} else {
- logger.debug("object %s has no content md5", object.getSystemMetadata()
- .getObjectID());
+ logger.debug("object %s has no content md5", object.getSystemMetadata().getObjectID());
}
} catch (InterruptedException e) {
Throwables.propagate(e);
@@ -109,11 +108,11 @@ public class FindMD5InUserMetadata implements ContainsValueInListStrategy {
}, userExecutor);
responses.put(md.getName(), future);
}
- Map exceptions = awaitCompletion(responses, userExecutor, maxTime, logger,
- String.format("searching for md5 in container %s", containerName));
+ Map exceptions = awaitCompletion(responses, userExecutor, maxTime, logger, String.format(
+ "searching for md5 in container %s", containerName));
if (exceptions.size() > 0)
- throw new BlobRuntimeException(String.format("searching for md5 in container %s: %s",
- containerName, exceptions));
+ throw new BlobRuntimeException(String.format("searching for md5 in container %s: %s", containerName,
+ exceptions));
try {
return queue.poll(1, TimeUnit.MICROSECONDS) != null;
} catch (InterruptedException e) {
@@ -121,9 +120,8 @@ public class FindMD5InUserMetadata implements ContainsValueInListStrategy {
return false;
} catch (Exception e) {
Throwables.propagateIfPossible(e, BlobRuntimeException.class);
- throw new BlobRuntimeException(String.format(
- "Error searching for ETAG of value: [%s] in container:%s", value, containerName),
- e);
+ throw new BlobRuntimeException(String.format("Error searching for ETAG of value: [%s] in container:%s", value,
+ containerName), e);
}
}
}
diff --git a/atmos/src/test/java/org/jclouds/atmosonline/saas/internal/StubAtmosStorageAsyncClient.java b/atmos/src/test/java/org/jclouds/atmosonline/saas/internal/StubAtmosStorageAsyncClient.java
index a08f3b31c0..14dbe07d89 100644
--- a/atmos/src/test/java/org/jclouds/atmosonline/saas/internal/StubAtmosStorageAsyncClient.java
+++ b/atmos/src/test/java/org/jclouds/atmosonline/saas/internal/StubAtmosStorageAsyncClient.java
@@ -19,15 +19,18 @@
package org.jclouds.atmosonline.saas.internal;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.util.concurrent.Futures.compose;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
+import static org.jclouds.concurrent.ConcurrentUtils.compose;
import java.net.URI;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
import javax.inject.Inject;
+import javax.inject.Named;
+import org.jclouds.Constants;
import org.jclouds.atmosonline.saas.AtmosStorageAsyncClient;
import org.jclouds.atmosonline.saas.blobstore.functions.BlobMetadataToObject;
import org.jclouds.atmosonline.saas.blobstore.functions.BlobToObject;
@@ -48,7 +51,6 @@ import org.jclouds.http.options.GetOptions;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
-import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
/**
@@ -65,13 +67,13 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
private final BlobMetadataToObject blob2ObjectInfo;
private final ListOptionsToBlobStoreListOptions container2ContainerListOptions;
private final ResourceMetadataListToDirectoryEntryList resource2ObjectList;
+ private final ExecutorService service;
@Inject
- private StubAtmosStorageAsyncClient(TransientAsyncBlobStore blobStore,
- AtmosObject.Factory objectProvider,
- HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob,
- BlobToObject blob2Object, BlobMetadataToObject blob2ObjectInfo,
- ListOptionsToBlobStoreListOptions container2ContainerListOptions,
+ private StubAtmosStorageAsyncClient(TransientAsyncBlobStore blobStore, AtmosObject.Factory objectProvider,
+ HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object,
+ BlobMetadataToObject blob2ObjectInfo, ListOptionsToBlobStoreListOptions container2ContainerListOptions,
+ @Named(Constants.PROPERTY_USER_THREADS) ExecutorService service,
ResourceMetadataListToDirectoryEntryList resource2ContainerList) {
this.blobStore = blobStore;
this.objectProvider = objectProvider;
@@ -82,6 +84,7 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
this.container2ContainerListOptions = checkNotNull(container2ContainerListOptions,
"container2ContainerListOptions");
this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList");
+ this.service = service;
}
public ListenableFuture createDirectory(String directoryName) {
@@ -94,25 +97,23 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
container = directoryName;
path = null;
}
- return Futures.compose(blobStore.createContainerInLocation(null, container),
- new Function() {
+ return compose(blobStore.createContainerInLocation(null, container), new Function() {
- public URI apply(Boolean from) {
- if (path != null) {
- Blob blob = blobStore.newBlob(path + "/");
- blob.getMetadata().setContentType("application/directory");
- blob.setPayload("");
- blobStore.putBlob(container, blob);
- }
- return URI.create("http://stub/containers/" + container);
- }
+ public URI apply(Boolean from) {
+ if (path != null) {
+ Blob blob = blobStore.newBlob(path + "/");
+ blob.getMetadata().setContentType("application/directory");
+ blob.setPayload("");
+ blobStore.putBlob(container, blob);
+ }
+ return URI.create("http://stub/containers/" + container);
+ }
- });
+ }, service);
}
public ListenableFuture createFile(String parent, AtmosObject object) {
- final String uri = "http://stub/containers/" + parent + "/"
- + object.getContentMetadata().getName();
+ final String uri = "http://stub/containers/" + parent + "/" + object.getContentMetadata().getName();
String file = object.getContentMetadata().getName();
String container = parent;
if (parent.indexOf('/') != -1) {
@@ -128,7 +129,7 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
return URI.create(uri);
}
- });
+ }, service);
}
public ListenableFuture deletePath(String path) {
@@ -141,7 +142,7 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
return null;
}
- });
+ }, service);
} else {
String container = path.substring(0, path.indexOf('/'));
path = path.substring(path.indexOf('/') + 1);
@@ -159,12 +160,11 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
else {
String container = path.substring(0, path.indexOf('/'));
path = path.substring(path.indexOf('/') + 1);
- return compose(blobStore.blobMetadata(container, path),
- new Function() {
- public UserMetadata apply(BlobMetadata from) {
- return blob2ObjectInfo.apply(from).getUserMetadata();
- }
- });
+ return compose(blobStore.blobMetadata(container, path), new Function() {
+ public UserMetadata apply(BlobMetadata from) {
+ return blob2ObjectInfo.apply(from).getUserMetadata();
+ }
+ }, service);
}
}
@@ -172,23 +172,21 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
String container = path.substring(0, path.indexOf('/'));
path = path.substring(path.indexOf('/') + 1);
try {
- return Futures.compose(blobStore.getBlob(container, path), blob2Object);
+ return compose(blobStore.getBlob(container, path), blob2Object, service);
} catch (Exception e) {
return immediateFailedFuture(Throwables.getRootCause(e));
}
}
- public ListenableFuture extends BoundedSet extends DirectoryEntry>> listDirectories(
- ListOptions... optionsList) {
+ public ListenableFuture> listDirectories(ListOptions... optionsList) {
// org.jclouds.blobstore.options.ListOptions options = container2ContainerListOptions
// .apply(optionsList);
- return Futures.compose(blobStore.list(), resource2ObjectList);
+ return compose(blobStore.list(), resource2ObjectList, service);
}
- public ListenableFuture extends BoundedSet extends DirectoryEntry>> listDirectory(
- String directoryName, ListOptions... optionsList) {
- org.jclouds.blobstore.options.ListContainerOptions options = container2ContainerListOptions
- .apply(optionsList);
+ public ListenableFuture> listDirectory(String directoryName,
+ ListOptions... optionsList) {
+ org.jclouds.blobstore.options.ListContainerOptions options = container2ContainerListOptions.apply(optionsList);
String container = directoryName;
if (directoryName.indexOf('/') != -1) {
container = directoryName.substring(0, directoryName.indexOf('/'));
@@ -196,7 +194,7 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
if (!path.equals(""))
options.inDirectory(path);
}
- return compose(blobStore.list(container, options), resource2ObjectList);
+ return compose(blobStore.list(container, options), resource2ObjectList, service);
}
public AtmosObject newObject() {
@@ -224,7 +222,7 @@ public class StubAtmosStorageAsyncClient implements AtmosStorageAsyncClient {
String container = path.substring(0, path.indexOf('/'));
String blobName = path.substring(path.indexOf('/') + 1);
org.jclouds.blobstore.options.GetOptions getOptions = httpGetOptionsConverter.apply(options);
- return Futures.compose(blobStore.getBlob(container, blobName, getOptions), blob2Object);
+ return compose(blobStore.getBlob(container, blobName, getOptions), blob2Object, service);
}
public ListenableFuture updateFile(String parent, AtmosObject object) {
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java
index 14427df55e..4a6c4e209b 100755
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/config/EC2ComputeServiceContextModule.java
@@ -18,6 +18,16 @@
*/
package org.jclouds.aws.ec2.compute.config;
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.find;
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static com.google.common.collect.Iterables.toArray;
+import static com.google.common.collect.Iterables.transform;
+import static com.google.common.collect.Maps.newLinkedHashMap;
+import static com.google.common.collect.Maps.uniqueIndex;
+import static com.google.common.collect.Sets.newHashSet;
+import static com.google.common.collect.Sets.newLinkedHashSet;
import static org.jclouds.aws.ec2.options.DescribeImagesOptions.Builder.imageIds;
import static org.jclouds.aws.ec2.options.DescribeImagesOptions.Builder.ownedBy;
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
@@ -26,17 +36,18 @@ import static org.jclouds.aws.ec2.util.EC2Utils.getAllRunningInstancesInRegion;
import static org.jclouds.aws.ec2.util.EC2Utils.parseHandle;
import static org.jclouds.compute.domain.OsFamily.CENTOS;
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
-import static org.jclouds.concurrent.ConcurrentUtils.awaitCompletion;
+import static org.jclouds.concurrent.ConcurrentUtils.transformParallel;
import java.net.URI;
import java.security.SecureRandom;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.concurrent.Callable;
+import java.util.Map.Entry;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -61,6 +72,7 @@ import org.jclouds.aws.ec2.compute.functions.RegionAndIdToImage;
import org.jclouds.aws.ec2.compute.functions.RunningInstanceToNodeMetadata;
import org.jclouds.aws.ec2.compute.internal.EC2TemplateBuilderImpl;
import org.jclouds.aws.ec2.compute.options.EC2TemplateOptions;
+import org.jclouds.aws.ec2.compute.strategy.DescribeImagesParallel;
import org.jclouds.aws.ec2.compute.strategy.EC2DestroyLoadBalancerStrategy;
import org.jclouds.aws.ec2.compute.strategy.EC2DestroyNodeStrategy;
import org.jclouds.aws.ec2.compute.strategy.EC2LoadBalanceNodesStrategy;
@@ -68,8 +80,8 @@ import org.jclouds.aws.ec2.compute.strategy.EC2RunNodesAndAddToSetStrategy;
import org.jclouds.aws.ec2.domain.InstanceType;
import org.jclouds.aws.ec2.domain.KeyPair;
import org.jclouds.aws.ec2.domain.PlacementGroup;
+import org.jclouds.aws.ec2.domain.Reservation;
import org.jclouds.aws.ec2.domain.RunningInstance;
-import org.jclouds.aws.ec2.domain.Image.ImageType;
import org.jclouds.aws.ec2.functions.RunningInstanceToStorageMappingUnix;
import org.jclouds.aws.ec2.options.DescribeImagesOptions;
import org.jclouds.aws.ec2.predicates.InstancePresent;
@@ -96,7 +108,6 @@ import org.jclouds.compute.strategy.ListNodesStrategy;
import org.jclouds.compute.strategy.LoadBalanceNodesStrategy;
import org.jclouds.compute.strategy.RebootNodeStrategy;
import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy;
-import org.jclouds.concurrent.ConcurrentUtils;
import org.jclouds.domain.Location;
import org.jclouds.domain.LocationScope;
import org.jclouds.domain.internal.LocationImpl;
@@ -108,6 +119,7 @@ import org.jclouds.rest.internal.RestContextImpl;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
import com.google.common.base.Splitter;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableMap;
@@ -115,8 +127,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Scopes;
@@ -206,13 +216,13 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
- private final EC2Client client;
+ private final EC2AsyncClient client;
private final Map regionMap;
private final RunningInstanceToNodeMetadata runningInstanceToNodeMetadata;
private final ExecutorService executor;
@Inject
- protected EC2ListNodesStrategy(EC2Client client, @Region Map regionMap,
+ protected EC2ListNodesStrategy(EC2AsyncClient client, @Region Map regionMap,
RunningInstanceToNodeMetadata runningInstanceToNodeMetadata,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
this.client = client;
@@ -222,31 +232,25 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
}
@Override
- public Iterable extends ComputeMetadata> list() {
+ public Set extends ComputeMetadata> list() {
return listDetailsOnNodesMatching(NodePredicates.all());
}
@Override
- public Iterable extends NodeMetadata> listDetailsOnNodesMatching(Predicate filter) {
- final Set nodes = Sets.newHashSet();
+ public Set extends NodeMetadata> listDetailsOnNodesMatching(Predicate filter) {
+ Iterable>> reservations = transformParallel(regionMap
+ .keySet(), new Function>>>() {
- Map> parallelResponses = Maps.newHashMap();
+ @Override
+ public Future>> apply(String from) {
+ return client.getInstanceServices().describeInstancesInRegion(from);
+ }
- for (final String region : regionMap.keySet()) {
- parallelResponses.put(region, ConcurrentUtils.makeListenable(executor.submit(new Callable() {
- @Override
- public Void call() throws Exception {
- Iterables.addAll(nodes, Iterables.transform(Iterables.concat(client.getInstanceServices()
- .describeInstancesInRegion(region)), runningInstanceToNodeMetadata));
- return null;
- }
- }), executor));
- }
- Map exceptions = awaitCompletion(parallelResponses, executor, null, logger, "nodes");
+ }, executor, null, logger, "reservations");
- if (exceptions.size() > 0)
- throw new RuntimeException(String.format("error parsing nodes in regions: %s", exceptions));
- return Iterables.filter(nodes, filter);
+ Iterable extends RunningInstance> instances = concat(concat(reservations));
+ Iterable extends NodeMetadata> nodes = filter(transform(instances, runningInstanceToNodeMetadata), filter);
+ return newLinkedHashSet(nodes);
}
}
@@ -268,7 +272,7 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
String region = parts[0];
String instanceId = parts[1];
try {
- RunningInstance runningInstance = Iterables.getOnlyElement(getAllRunningInstancesInRegion(client
+ RunningInstance runningInstance = getOnlyElement(getAllRunningInstancesInRegion(client
.getInstanceServices(), region, instanceId));
return runningInstanceToNodeMetadata.apply(runningInstance);
} catch (NoSuchElementException e) {
@@ -305,7 +309,7 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
protected final Map credentialsMap(CreateUniqueKeyPair in) {
// doesn't seem to clear when someone issues remove(key)
// return new MapMaker().makeComputingMap(in);
- return Maps.newLinkedHashMap();
+ return newLinkedHashMap();
}
@Provides
@@ -314,7 +318,7 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
protected final Map securityGroupMap(CreateSecurityGroupIfNeeded in) {
// doesn't seem to clear when someone issues remove(key)
// return new MapMaker().makeComputingMap(in);
- return Maps.newLinkedHashMap();
+ return newLinkedHashMap();
}
@Provides
@@ -323,7 +327,7 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
protected final Map placementGroupMap(CreatePlacementGroupIfNeeded in) {
// doesn't seem to clear when someone issues remove(key)
// return new MapMaker().makeComputingMap(in);
- return Maps.newLinkedHashMap();
+ return newLinkedHashMap();
}
@Provides
@@ -340,10 +344,10 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
@Provides
@Singleton
Set extends Size> provideSizes(Set extends Location> locations, @Named(PROPERTY_EC2_CC_AMIs) String[] ccAmis) {
- Set sizes = Sets.newHashSet();
+ Set sizes = newHashSet();
for (String ccAmi : ccAmis) {
final String region = ccAmi.split("/")[0];
- Location location = Iterables.find(locations, new Predicate() {
+ Location location = find(locations, new Predicate() {
@Override
public boolean apply(Location input) {
@@ -362,11 +366,11 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
Set extends Location> provideLocations(Map availabilityZoneToRegionMap,
@Provider String providerName) {
Location ec2 = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
- Set locations = Sets.newLinkedHashSet();
- for (String region : Sets.newLinkedHashSet(availabilityZoneToRegionMap.values())) {
+ Set locations = newLinkedHashSet();
+ for (String region : newLinkedHashSet(availabilityZoneToRegionMap.values())) {
locations.add(new LocationImpl(LocationScope.REGION, region, region, ec2));
}
- ImmutableMap idToLocation = Maps.uniqueIndex(locations, new Function() {
+ ImmutableMap idToLocation = uniqueIndex(locations, new Function() {
@Override
public String apply(Location from) {
return from.getId();
@@ -391,7 +395,7 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
String[] amiOwners(@Named(PROPERTY_EC2_AMI_OWNERS) String amiOwners) {
if (amiOwners.trim().equals(""))
return new String[] {};
- return Iterables.toArray(Splitter.on(',').split(amiOwners), String.class);
+ return toArray(Splitter.on(',').split(amiOwners), String.class);
}
@Provides
@@ -400,7 +404,7 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
String[] ccAmis(@Named(PROPERTY_EC2_CC_AMIs) String ccAmis) {
if (ccAmis.trim().equals(""))
return new String[] {};
- return Iterables.toArray(Splitter.on(',').split(ccAmis), String.class);
+ return toArray(Splitter.on(',').split(ccAmis), String.class);
}
@Provides
@@ -416,54 +420,62 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
@Provides
@Singleton
- protected Map provideImages(final EC2Client sync,
- @Region Map regionMap, final LogHolder holder, Function indexer,
- @Named(PROPERTY_EC2_CC_AMIs) String[] ccAmis, @Named(PROPERTY_EC2_AMI_OWNERS) final String[] amiOwners,
- final ImageParser parser, final ConcurrentMap images,
- @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) throws InterruptedException,
- ExecutionException, TimeoutException {
+ protected Map provideImages(@Region Map regionMap,
+ DescribeImagesParallel describer, LogHolder holder, @Named(PROPERTY_EC2_CC_AMIs) String[] ccAmis,
+ @Named(PROPERTY_EC2_AMI_OWNERS) final String[] amiOwners, final ImageParser parser,
+ final ConcurrentMap images) throws InterruptedException, ExecutionException,
+ TimeoutException {
if (amiOwners.length == 0) {
holder.logger.debug(">> no owners specified, skipping image parsing");
} else {
holder.logger.debug(">> providing images");
- Map> parallelResponses = Maps.newHashMap();
- final DescribeImagesOptions options;
- if (amiOwners.length == 1 && amiOwners[0].equals("*"))
- options = new DescribeImagesOptions();
- else
- options = ownedBy(amiOwners);
- for (final String region : regionMap.keySet()) {
- parallelResponses.put(region, ConcurrentUtils.makeListenable(executor.submit(new Callable() {
- @Override
- public Void call() throws Exception {
- Set matchingImages = sync.getAMIServices().describeImagesInRegion(
- region, options);
- for (final org.jclouds.aws.ec2.domain.Image from : matchingImages) {
- Image image = parser.apply(from);
- if (image != null)
- images.put(new RegionAndName(region, image.getProviderId()), image);
- else if (from.getImageType() == ImageType.MACHINE)
- holder.logger.trace("<< image(%s) didn't parse", from.getId());
- }
- return null;
- }
- }), executor));
- }
- Map exceptions = awaitCompletion(parallelResponses, executor, null, holder.logger, "images");
- for (String ccAmi : ccAmis) {
- String region = ccAmi.split("/")[0];
- org.jclouds.aws.ec2.domain.Image from = Iterables.getOnlyElement(sync.getAMIServices()
- .describeImagesInRegion(region, imageIds(ccAmi.split("/")[1])));
- Image image = parser.apply(from);
- if (image != null)
- images.put(new RegionAndName(region, image.getProviderId()), image);
- }
- if (exceptions.size() > 0)
- throw new RuntimeException(String.format("error parsing images in regions: %s", exceptions));
+ Iterable> queries = concat(getDescribeQueriesForOwnersInRegions(
+ regionMap, amiOwners).entrySet(), ccAmisToDescribeQueries(ccAmis).entrySet());
+
+ Iterable extends Image> parsedImages = filter(transform(describer.apply(queries), parser), Predicates
+ .notNull());
+
+ images.putAll(Maps.uniqueIndex(parsedImages, new Function() {
+
+ @Override
+ public RegionAndName apply(Image from) {
+ return new RegionAndName(from.getLocation().getId(), from.getProviderId());
+ }
+
+ }));
holder.logger.debug("<< images(%d)", images.size());
}
return images;
}
+
+ private Map ccAmisToDescribeQueries(String[] ccAmis) {
+ Map queries = Maps.newLinkedHashMap();
+ for (String from : ccAmis) {
+ queries.put(from.split("/")[0], imageIds(from.split("/")[1]));
+ }
+ return queries;
+ }
+
+ private Map getDescribeQueriesForOwnersInRegions(Map regionMap,
+ final String[] amiOwners) {
+ final DescribeImagesOptions options = getOptionsForOwners(amiOwners);
+
+ return Maps.transformValues(regionMap, new Function() {
+ @Override
+ public DescribeImagesOptions apply(URI from) {
+ return options;
+ }
+ });
+ }
+
+ private DescribeImagesOptions getOptionsForOwners(final String[] amiOwners) {
+ final DescribeImagesOptions options;
+ if (amiOwners.length == 1 && amiOwners[0].equals("*"))
+ options = new DescribeImagesOptions();
+ else
+ options = ownedBy(amiOwners);
+ return options;
+ }
}
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/internal/EC2TemplateBuilderImpl.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/internal/EC2TemplateBuilderImpl.java
index 3129e47b92..02a3e3bf9f 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/internal/EC2TemplateBuilderImpl.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/internal/EC2TemplateBuilderImpl.java
@@ -49,9 +49,9 @@ public class EC2TemplateBuilderImpl extends TemplateBuilderImpl {
@Inject
protected EC2TemplateBuilderImpl(Provider> locations, Provider> images,
- Provider> sizes, Location defaultLocation, Provider optionsProvider,
- @Named("DEFAULT") Provider defaultTemplateProvider,
- ConcurrentMap imageMap) {
+ Provider> sizes, Location defaultLocation, Provider optionsProvider,
+ @Named("DEFAULT") Provider defaultTemplateProvider,
+ ConcurrentMap imageMap) {
super(locations, images, sizes, defaultLocation, optionsProvider, defaultTemplateProvider);
this.imageMap = imageMap;
}
@@ -80,7 +80,8 @@ public class EC2TemplateBuilderImpl extends TemplateBuilderImpl {
if (imageId != null) {
String[] regionName = imageId.split("/");
checkArgument(regionName.length == 2,
- "amazon image ids must include the region. ex. us-east-1/ami-7ea24a17");
+ "amazon image ids must include the region ( ex. us-east-1/ami-7ea24a17 ) you specified: "
+ + imageId);
RegionAndName key = new RegionAndName(regionName[0], regionName[1]);
try {
return imageMap.get(key);
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/DescribeImagesParallel.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/DescribeImagesParallel.java
new file mode 100644
index 0000000000..f963d9cd32
--- /dev/null
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/DescribeImagesParallel.java
@@ -0,0 +1,79 @@
+/**
+ *
+ * Copyright (C) 2009 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+package org.jclouds.aws.ec2.compute.strategy;
+
+import static com.google.common.collect.Iterables.concat;
+import static org.jclouds.concurrent.ConcurrentUtils.transformParallel;
+
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.aws.ec2.EC2AsyncClient;
+import org.jclouds.aws.ec2.options.DescribeImagesOptions;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+
+import com.google.common.base.Function;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class DescribeImagesParallel implements
+ Function>, Iterable extends org.jclouds.aws.ec2.domain.Image>> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected final EC2AsyncClient sync;
+ final ExecutorService executor;
+
+ @Inject
+ public DescribeImagesParallel(EC2AsyncClient sync, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
+ super();
+ this.sync = sync;
+ this.executor = executor;
+ }
+
+ @Override
+ public Iterable extends org.jclouds.aws.ec2.domain.Image> apply(
+ Iterable> queries) {
+ return concat(transformParallel(
+ queries,
+ new Function, Future>>() {
+
+ @Override
+ public Future> apply(
+ Entry from) {
+ return sync.getAMIServices().describeImagesInRegion(from.getKey(), from.getValue());
+ }
+
+ }, executor, null, logger, "amis"));
+ }
+
+}
\ No newline at end of file
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2RunNodesAndAddToSetStrategy.java b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2RunNodesAndAddToSetStrategy.java
index 4f51efa8cf..fe133fdf28 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2RunNodesAndAddToSetStrategy.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/compute/strategy/EC2RunNodesAndAddToSetStrategy.java
@@ -27,6 +27,7 @@ import static org.jclouds.aws.ec2.compute.util.EC2ComputeUtils.instanceToId;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.Future;
import javax.annotation.Resource;
import javax.inject.Inject;
@@ -48,7 +49,6 @@ import org.jclouds.logging.Logger;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
-import com.google.common.util.concurrent.ListenableFuture;
/**
* creates futures that correlate to
@@ -56,8 +56,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* @author Adrian Cole
*/
@Singleton
-public class EC2RunNodesAndAddToSetStrategy implements
- RunNodesAndAddToSetStrategy {
+public class EC2RunNodesAndAddToSetStrategy implements RunNodesAndAddToSetStrategy {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
@@ -76,11 +75,10 @@ public class EC2RunNodesAndAddToSetStrategy implements
@Inject
EC2RunNodesAndAddToSetStrategy(
- EC2Client client,
- CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions,
- @Named("PRESENT") Predicate instancePresent,
- RunningInstanceToNodeMetadata runningInstanceToNodeMetadata,
- ComputeUtils utils) {
+ EC2Client client,
+ CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions,
+ @Named("PRESENT") Predicate instancePresent,
+ RunningInstanceToNodeMetadata runningInstanceToNodeMetadata, ComputeUtils utils) {
this.client = client;
this.instancePresent = instancePresent;
this.createKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions = createKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions;
@@ -89,12 +87,11 @@ public class EC2RunNodesAndAddToSetStrategy implements
}
@Override
- public Map, ListenableFuture> execute(String tag, int count,
- Template template, Set goodNodes,
- Map badNodes) {
+ public Map, Future> execute(String tag, int count, Template template, Set goodNodes,
+ Map badNodes) {
- Reservation reservation = createKeyPairAndSecurityGroupsAsNeededThenRunInstances(
- tag, count, template);
+ Reservation extends RunningInstance> reservation = createKeyPairAndSecurityGroupsAsNeededThenRunInstances(tag,
+ count, template);
Iterable ids = transform(reservation, instanceToId);
@@ -104,28 +101,25 @@ public class EC2RunNodesAndAddToSetStrategy implements
all(reservation, instancePresent);
logger.debug("<< present instances(%s)", idsString);
- return utils.runOptionsOnNodesAndAddToGoodSetOrPutExceptionIntoBadMap(
- template.getOptions(), transform(reservation,
- runningInstanceToNodeMetadata), goodNodes, badNodes);
+ return utils.runOptionsOnNodesAndAddToGoodSetOrPutExceptionIntoBadMap(template.getOptions(), transform(
+ reservation, runningInstanceToNodeMetadata), goodNodes, badNodes);
}
@VisibleForTesting
- Reservation createKeyPairAndSecurityGroupsAsNeededThenRunInstances(
- String tag, int count, Template template) {
+ Reservation extends RunningInstance> createKeyPairAndSecurityGroupsAsNeededThenRunInstances(String tag, int count,
+ Template template) {
String region = getRegionFromLocationOrNull(template.getLocation());
String zone = getZoneFromLocationOrNull(template.getLocation());
- RunInstancesOptions instanceOptions = createKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions
- .execute(region, tag, template);
+ RunInstancesOptions instanceOptions = createKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.execute(region,
+ tag, template);
if (logger.isDebugEnabled())
- logger.debug(
- ">> running %d instance region(%s) zone(%s) ami(%s) params(%s)",
- count, region, zone, template.getImage().getProviderId(),
- instanceOptions.buildFormParameters());
+ logger.debug(">> running %d instance region(%s) zone(%s) ami(%s) params(%s)", count, region, zone, template
+ .getImage().getProviderId(), instanceOptions.buildFormParameters());
- return client.getInstanceServices().runInstancesInRegion(region, zone,
- template.getImage().getProviderId(), 1, count, instanceOptions);
+ return client.getInstanceServices().runInstancesInRegion(region, zone, template.getImage().getProviderId(), 1,
+ count, instanceOptions);
}
}
\ No newline at end of file
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Reservation.java b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Reservation.java
index 70d19361a1..a24bcd2eec 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Reservation.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/domain/Reservation.java
@@ -33,8 +33,8 @@ import com.google.inject.internal.Nullable;
* />
* @author Adrian Cole
*/
-public class Reservation extends LinkedHashSet implements Comparable,
- Set {
+public class Reservation extends LinkedHashSet implements Comparable>,
+ Set {
/** The serialVersionUID */
private static final long serialVersionUID = -9051777593518861395L;
@@ -47,9 +47,8 @@ public class Reservation extends LinkedHashSet implements Compa
private final @Nullable
String reservationId;
- public Reservation(String region, Iterable groupIds,
- Iterable instances, @Nullable String ownerId,
- @Nullable String requesterId, @Nullable String reservationId) {
+ public Reservation(String region, Iterable groupIds, Iterable instances,
+ @Nullable String ownerId, @Nullable String requesterId, @Nullable String reservationId) {
this.region = checkNotNull(region, "region");
Iterables.addAll(this.groupIds, checkNotNull(groupIds, "groupIds"));
Iterables.addAll(this, checkNotNull(instances, "instances"));
@@ -65,7 +64,7 @@ public class Reservation extends LinkedHashSet implements Compa
return region;
}
- public int compareTo(Reservation o) {
+ public int compareTo(Reservation o) {
return (this == o) ? 0 : getReservationId().compareTo(o.getReservationId());
}
@@ -117,7 +116,7 @@ public class Reservation extends LinkedHashSet implements Compa
return false;
if (getClass() != obj.getClass())
return false;
- Reservation other = (Reservation) obj;
+ Reservation> other = (Reservation>) obj;
if (groupIds == null) {
if (other.groupIds != null)
return false;
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/options/CreateImageOptions.java b/aws/core/src/main/java/org/jclouds/aws/ec2/options/CreateImageOptions.java
index 186a0b1728..b533c42f3c 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/options/CreateImageOptions.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/options/CreateImageOptions.java
@@ -32,7 +32,7 @@ import org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions;
* import static org.jclouds.aws.ec2.options.CreateImageOptions.Builder.*
*
* EC2Client connection = // get connection
- * ListenableFuture> images = connection.getAMIServices().createImage(withDescription("123125").noReboot());
+ * Future> images = connection.getAMIServices().createImage(withDescription("123125").noReboot());
*
*
* @author Adrian Cole
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeAvailabilityZonesOptions.java b/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeAvailabilityZonesOptions.java
index f121600b6f..9955839581 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeAvailabilityZonesOptions.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeAvailabilityZonesOptions.java
@@ -33,7 +33,7 @@ import org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions;
* import static org.jclouds.aws.ec2.options.DescribeAvailabilityZonesOptions.Builder.*
*
* EC2Client connection = // get connection
- * ListenableFuture> images = connection.getAvailabilityZoneAndRegionServices().describeAvailabilityZones(zones("us-east-1a", "us-east-1b"));
+ * Future> images = connection.getAvailabilityZoneAndRegionServices().describeAvailabilityZones(zones("us-east-1a", "us-east-1b"));
*
*
* @author Adrian Cole
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeImagesOptions.java b/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeImagesOptions.java
index bcd143de30..d53e004b01 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeImagesOptions.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeImagesOptions.java
@@ -34,7 +34,7 @@ import org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions;
* import static org.jclouds.aws.ec2.options.DescribeImagesOptions.Builder.*
*
* EC2Client connection = // get connection
- * ListenableFuture> images = connection.getAMIServices().describeImages(executableBy("123125").imageIds(1000, 1004));
+ * Future> images = connection.getAMIServices().describeImages(executableBy("123125").imageIds(1000, 1004));
*
*
* @author Adrian Cole
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeRegionsOptions.java b/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeRegionsOptions.java
index 9107d8f201..9626a61240 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeRegionsOptions.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/options/DescribeRegionsOptions.java
@@ -34,7 +34,7 @@ import org.jclouds.aws.ec2.options.internal.BaseEC2RequestOptions;
* import static org.jclouds.aws.ec2.options.DescribeRegionsOptions.Builder.*
*
* EC2Client connection = // get connection
- * ListenableFuture> images = connection.getRegionsAndRegionsServices().describeRegions(regions("us-east-1a", "us-east-1b"));
+ * Future> images = connection.getRegionsAndRegionsServices().describeRegions(regions("us-east-1a", "us-east-1b"));
*
*
* @author Adrian Cole
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/options/RunInstancesOptions.java b/aws/core/src/main/java/org/jclouds/aws/ec2/options/RunInstancesOptions.java
index a388ce36dc..5d03c59bb8 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/options/RunInstancesOptions.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/options/RunInstancesOptions.java
@@ -35,7 +35,7 @@ import org.jclouds.encryption.internal.Base64;
* import static org.jclouds.aws.ec2.options.RunInstancesOptions.Builder.*
*
* EC2Client connection = // get connection
- * ListenableFuture instances = connection.runInstances(executableBy("123125").imageIds(1000, 1004));
+ * Future instances = connection.runInstances(executableBy("123125").imageIds(1000, 1004));
*
*
* @author Adrian Cole
diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIAsyncClient.java b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIAsyncClient.java
index b0c2e0c03f..9f2e51fc06 100644
--- a/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIAsyncClient.java
+++ b/aws/core/src/main/java/org/jclouds/aws/ec2/services/AMIAsyncClient.java
@@ -23,6 +23,7 @@ import static org.jclouds.aws.ec2.reference.EC2Parameters.VERSION;
import java.util.Map;
import java.util.Set;
+import com.google.common.util.concurrent.ListenableFuture;
import javax.annotation.Nullable;
import javax.ws.rs.FormParam;
@@ -56,8 +57,6 @@ import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
-import com.google.common.util.concurrent.ListenableFuture;
-
/**
* Provides access to AMI Services.
*
@@ -77,7 +76,7 @@ public interface AMIAsyncClient {
@FormParams(keys = ACTION, values = "DescribeImages")
@XMLResponseParser(DescribeImagesResponseHandler.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
- ListenableFuture extends Set> describeImagesInRegion(
+ ListenableFuture> describeImagesInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, DescribeImagesOptions... options);
/**
@@ -87,9 +86,8 @@ public interface AMIAsyncClient {
@Path("/")
@FormParams(keys = ACTION, values = "CreateImage")
@XMLResponseParser(ImageIdHandler.class)
- ListenableFuture createImageInRegion(
- @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region, @FormParam("Name") String name,
- @FormParam("InstanceId") String instanceId, CreateImageOptions... options);
+ ListenableFuture createImageInRegion(@EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
+ @FormParam("Name") String name, @FormParam("InstanceId") String instanceId, CreateImageOptions... options);
/**
* @see AMIClient#deregisterImageInRegion
@@ -97,8 +95,7 @@ public interface AMIAsyncClient {
@POST
@Path("/")
@FormParams(keys = ACTION, values = "DeregisterImage")
- ListenableFuture deregisterImageInRegion(
- @EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
+ ListenableFuture deregisterImageInRegion(@EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("ImageId") String imageId);
/**
@@ -181,7 +178,7 @@ public interface AMIAsyncClient {
@Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "productCodes" })
@XMLResponseParser(ProductCodesHandler.class)
- ListenableFuture extends Set> getProductCodesForImageInRegion(
+ ListenableFuture> getProductCodesForImageInRegion(
@EndpointParam(parser = RegionToEndpoint.class) @Nullable String region,
@FormParam("ImageId") String imageId);
@@ -192,7 +189,7 @@ public interface AMIAsyncClient {
@Path("/")
@FormParams(keys = { ACTION, "Attribute" }, values = { "DescribeImageAttribute", "blockDeviceMapping" })
@XMLResponseParser(BlockDeviceMappingHandler.class)
- ListenableFuture extends Map> getBlockDeviceMappingsForImageInRegion(
+ ListenableFuture