[infinispan-commits] Infinispan SVN: r1741 - in trunk/cachestore/cloud: src/main/java/org/infinispan/loaders/cloud and 1 other directory.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Wed May 5 13:13:24 EDT 2010


Author: manik.surtani at jboss.com
Date: 2010-05-05 13:13:23 -0400 (Wed, 05 May 2010)
New Revision: 1741

Modified:
   trunk/cachestore/cloud/pom.xml
   trunk/cachestore/cloud/src/main/java/org/infinispan/loaders/cloud/CloudCacheStore.java
Log:
[ISPN-415] (Upgrade to JClouds 1.0-beta-5)

Modified: trunk/cachestore/cloud/pom.xml
===================================================================
--- trunk/cachestore/cloud/pom.xml	2010-05-05 15:25:43 UTC (rev 1740)
+++ trunk/cachestore/cloud/pom.xml	2010-05-05 17:13:23 UTC (rev 1741)
@@ -4,7 +4,7 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
-      <groupId>org.infinispan</groupId> 
+      <groupId>org.infinispan</groupId>
       <artifactId>infinispan-cachestore-parent</artifactId>
       <version>4.1.0-SNAPSHOT</version>
       <relativePath>../pom.xml</relativePath>
@@ -15,7 +15,7 @@
 
    <properties>
       <test.src.dir>src/test/java</test.src.dir>
-      <version.jclouds>1.0-SNAPSHOT</version.jclouds>
+      <version.jclouds>1.0-beta-5</version.jclouds>
    </properties>
 
    <dependencies>
@@ -57,12 +57,24 @@
       </dependency>
 
       <!-- =========================================================== -->
-      
+
       <dependency>
-			<groupId>org.apache.commons</groupId>
-			<artifactId>commons-compress</artifactId>
-			<version>1.0</version>
-	  </dependency>
+         <groupId>org.apache.commons</groupId>
+         <artifactId>commons-compress</artifactId>
+         <version>1.0</version>
+      </dependency>
+
+      <dependency>
+         <groupId>com.google.guava</groupId>
+         <artifactId>guava-collections</artifactId>
+         <version>r03</version>
+      </dependency>
+
+      <dependency>
+         <groupId>com.google.guava</groupId>
+         <artifactId>guava-base</artifactId>
+         <version>r03</version>
+      </dependency>
       
    </dependencies>
 

Modified: trunk/cachestore/cloud/src/main/java/org/infinispan/loaders/cloud/CloudCacheStore.java
===================================================================
--- trunk/cachestore/cloud/src/main/java/org/infinispan/loaders/cloud/CloudCacheStore.java	2010-05-05 15:25:43 UTC (rev 1740)
+++ trunk/cachestore/cloud/src/main/java/org/infinispan/loaders/cloud/CloudCacheStore.java	2010-05-05 17:13:23 UTC (rev 1741)
@@ -14,6 +14,8 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 
+import com.google.common.base.Function;
+import com.google.common.collect.Maps;
 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
 import org.infinispan.Cache;
@@ -135,17 +137,21 @@
             asyncBlobStore = ctx.getAsyncBlobStore();
          }
 
-         // the "location" is not currently used.
          if (!blobStore.containerExists(containerName)) {
             Location chosenLoc = null;
             if (cfg.getCloudServiceLocation() != null && cfg.getCloudServiceLocation().trim().length() > 0) {
-               Map<String, ? extends Location> availableLocations = blobStore.getLocations();
+               Map<String, ? extends Location> idToLocation = Maps.uniqueIndex(blobStore.listAssignableLocations(), new Function<Location, String>() {
+                  @Override
+                  public String apply(Location input) {
+                     return input.getId();
+                  }
+               });
                String loc = cfg.getCloudServiceLocation().trim().toLowerCase();
-               chosenLoc = availableLocations.get(loc);
+               chosenLoc = idToLocation.get(loc);
                if (chosenLoc == null) {
                   log.warn(
                      String.format("Unable to use configured Cloud Service Location [%s].  Available locations for Cloud Service [%s] are %s",
-                     loc, cfg.getCloudService(), availableLocations.keySet()));
+                     loc, cfg.getCloudService(), idToLocation.keySet()));
                }
             }
             blobStore.createContainerInLocation(chosenLoc, containerName);



More information about the infinispan-commits mailing list