diff --git a/.idea/modules/plugins-cloud.iml b/.idea/modules/plugins-cloud.iml index b743ca0ec5a..d49330881c1 100644 --- a/.idea/modules/plugins-cloud.iml +++ b/.idea/modules/plugins-cloud.iml @@ -16,12 +16,6 @@ - - - - - - @@ -35,6 +29,21 @@ + + + + + + + + + + + + + + + diff --git a/plugins/cloud/build.gradle b/plugins/cloud/build.gradle index a7179657dd9..ca72e147366 100644 --- a/plugins/cloud/build.gradle +++ b/plugins/cloud/build.gradle @@ -34,7 +34,7 @@ repositories { mavenRepo urls: "http://java-xmlbuilder.googlecode.com/svn/repo" } -jcloudsVersion = "1.0-SNAPSHOT" +jcloudsVersion = "1.0-beta-5" dependencies { compile project(':elasticsearch') diff --git a/plugins/cloud/src/main/java/org/elasticsearch/discovery/cloud/CloudZenPing.java b/plugins/cloud/src/main/java/org/elasticsearch/discovery/cloud/CloudZenPing.java index 4e1f24f01be..55cda6adf32 100644 --- a/plugins/cloud/src/main/java/org/elasticsearch/discovery/cloud/CloudZenPing.java +++ b/plugins/cloud/src/main/java/org/elasticsearch/discovery/cloud/CloudZenPing.java @@ -38,7 +38,7 @@ import org.jclouds.domain.Location; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.List; -import java.util.Map; +import java.util.Set; import static org.elasticsearch.util.collect.Lists.*; @@ -68,10 +68,10 @@ public class CloudZenPing extends UnicastZenPing { @Override protected List buildDynamicNodes() { List discoNodes = newArrayList(); - Map nodes = computeService.getNodes(GetNodesOptions.Builder.withDetails()); + Set nodes = computeService.listNodes(GetNodesOptions.Builder.withDetails()); logger.trace("Processing Nodes {}", nodes); - for (Map.Entry node : nodes.entrySet()) { - NodeMetadata nodeMetadata = (NodeMetadata) node.getValue(); + for (ComputeMetadata node : nodes) { + NodeMetadata nodeMetadata = (NodeMetadata) node; if (tag != null && !nodeMetadata.getTag().equals(tag)) { logger.trace("Filtering node {} with unmatched tag {}", nodeMetadata.getName(), nodeMetadata.getTag()); continue; diff --git a/plugins/cloud/src/main/java/org/elasticsearch/gateway/cloud/CloudGateway.java b/plugins/cloud/src/main/java/org/elasticsearch/gateway/cloud/CloudGateway.java index b39b7248499..b950a67cd64 100644 --- a/plugins/cloud/src/main/java/org/elasticsearch/gateway/cloud/CloudGateway.java +++ b/plugins/cloud/src/main/java/org/elasticsearch/gateway/cloud/CloudGateway.java @@ -46,6 +46,7 @@ import org.jclouds.blobstore.domain.StorageMetadata; import org.jclouds.domain.Location; import java.io.IOException; +import java.util.Set; /** * @author kimchy (shay.banon) @@ -75,9 +76,17 @@ public class CloudGateway extends AbstractLifecycleComponent implements if (location == null) { this.location = null; } else { - this.location = blobStoreContext.getBlobStore().getAssignableLocations().get(location); + Location matchedLocation = null; + Set assignableLocations = blobStoreContext.getBlobStore().listAssignableLocations(); + for (Location oLocation : assignableLocations) { + if (oLocation.getId().equals(location)) { + matchedLocation = oLocation; + break; + } + } + this.location = matchedLocation; if (this.location == null) { - throw new ElasticSearchIllegalArgumentException("Not a valid location [" + location + "], available locations " + blobStoreContext.getBlobStore().getAssignableLocations().keySet()); + throw new ElasticSearchIllegalArgumentException("Not a valid location [" + location + "], available locations " + assignableLocations); } } diff --git a/plugins/cloud/src/main/java/org/elasticsearch/index/gateway/cloud/CloudIndexGateway.java b/plugins/cloud/src/main/java/org/elasticsearch/index/gateway/cloud/CloudIndexGateway.java index a89dac69b98..0222c46223f 100644 --- a/plugins/cloud/src/main/java/org/elasticsearch/index/gateway/cloud/CloudIndexGateway.java +++ b/plugins/cloud/src/main/java/org/elasticsearch/index/gateway/cloud/CloudIndexGateway.java @@ -37,6 +37,8 @@ import org.elasticsearch.util.settings.Settings; import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.domain.Location; +import java.util.Set; + /** * @author kimchy (shay.banon) */ @@ -52,7 +54,6 @@ public class CloudIndexGateway extends AbstractIndexComponent implements IndexGa private final BlobStoreContext blobStoreContext; - @Inject public CloudIndexGateway(Index index, @IndexSettings Settings indexSettings, CloudBlobStoreService blobStoreService, Gateway gateway) { super(index, indexSettings); this.blobStoreContext = blobStoreService.context(); @@ -84,9 +85,17 @@ public class CloudIndexGateway extends AbstractIndexComponent implements IndexGa this.location = null; } } else { - this.location = blobStoreContext.getBlobStore().getAssignableLocations().get(location); + Location matchedLocation = null; + Set assignableLocations = blobStoreContext.getBlobStore().listAssignableLocations(); + for (Location oLocation : assignableLocations) { + if (oLocation.getId().equals(location)) { + matchedLocation = oLocation; + break; + } + } + this.location = matchedLocation; if (this.location == null) { - throw new ElasticSearchIllegalArgumentException("Not a valid location [" + location + "], available locations " + blobStoreContext.getBlobStore().getAssignableLocations().keySet()); + throw new ElasticSearchIllegalArgumentException("Not a valid location [" + location + "], available locations " + assignableLocations); } } this.indexContainer = container;