mirror of https://github.com/apache/jclouds.git
Issue 241:Add provider to the Location hierarchy and make getParent a Location object; also fixed compute services where broken and added ssh logging for runscript
This commit is contained in:
parent
ae130eff83
commit
a1c7ccfd3f
|
@ -47,15 +47,15 @@ import com.google.inject.TypeLiteral;
|
||||||
public class AtmosStorageContextBuilder extends
|
public class AtmosStorageContextBuilder extends
|
||||||
BlobStoreContextBuilder<AtmosStorageAsyncClient, AtmosStorageClient> {
|
BlobStoreContextBuilder<AtmosStorageAsyncClient, AtmosStorageClient> {
|
||||||
|
|
||||||
public AtmosStorageContextBuilder(Properties props) {
|
public AtmosStorageContextBuilder(String providerName, Properties props) {
|
||||||
super(new TypeLiteral<AtmosStorageAsyncClient>() {
|
super(providerName, new TypeLiteral<AtmosStorageAsyncClient>() {
|
||||||
}, new TypeLiteral<AtmosStorageClient>() {
|
}, new TypeLiteral<AtmosStorageClient>() {
|
||||||
}, props);
|
}, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
modules.add(new AtmosBlobStoreContextModule());
|
modules.add(new AtmosBlobStoreContextModule(providerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -41,18 +41,18 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class AtmosStorageContextFactory {
|
public class AtmosStorageContextFactory {
|
||||||
public static BlobStoreContext createContext(Properties properties, Module... modules) {
|
public static BlobStoreContext createContext(Properties properties, Module... modules) {
|
||||||
return new AtmosStorageContextBuilder(new AtmosStoragePropertiesBuilder(properties).build())
|
return new AtmosStorageContextBuilder("atmosstorage", new AtmosStoragePropertiesBuilder(
|
||||||
.withModules(modules).buildBlobStoreContext();
|
properties).build()).withModules(modules).buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlobStoreContext createContext(String uid, String key, Module... modules) {
|
public static BlobStoreContext createContext(String uid, String key, Module... modules) {
|
||||||
return new AtmosStorageContextBuilder(new AtmosStoragePropertiesBuilder(uid, key).build())
|
return new AtmosStorageContextBuilder("atmosstorage", new AtmosStoragePropertiesBuilder(uid,
|
||||||
.withModules(modules).buildBlobStoreContext();
|
key).build()).withModules(modules).buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlobStoreContext createContext(URI endpoint, String uid, String key,
|
public static BlobStoreContext createContext(URI endpoint, String uid, String key,
|
||||||
Module... modules) {
|
Module... modules) {
|
||||||
return new AtmosStorageContextBuilder(new AtmosStoragePropertiesBuilder(uid, key)
|
return new AtmosStorageContextBuilder("atmosstorage", new AtmosStoragePropertiesBuilder(uid,
|
||||||
.withEndpoint(endpoint).build()).withModules(modules).buildBlobStoreContext();
|
key).withEndpoint(endpoint).build()).withModules(modules).buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,11 @@ import com.google.inject.TypeLiteral;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class AtmosBlobStoreContextModule extends AtmosStorageContextModule {
|
public class AtmosBlobStoreContextModule extends AtmosStorageContextModule {
|
||||||
|
private final String providerName;
|
||||||
|
|
||||||
|
public AtmosBlobStoreContextModule(String providerName) {
|
||||||
|
this.providerName = providerName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
|
@ -68,7 +73,7 @@ public class AtmosBlobStoreContextModule extends AtmosStorageContextModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
Location getLocation() {
|
Location getLocation() {
|
||||||
return new LocationImpl(LocationScope.ZONE, "UNKNOWN", "TODO", null);
|
return new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.jclouds.atmosonline.saas.domain.FileType;
|
||||||
import org.jclouds.atmosonline.saas.domain.SystemMetadata;
|
import org.jclouds.atmosonline.saas.domain.SystemMetadata;
|
||||||
import org.jclouds.atmosonline.saas.options.ListOptions;
|
import org.jclouds.atmosonline.saas.options.ListOptions;
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
|
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||||
import org.jclouds.blobstore.KeyAlreadyExistsException;
|
import org.jclouds.blobstore.KeyAlreadyExistsException;
|
||||||
import org.jclouds.blobstore.KeyNotFoundException;
|
import org.jclouds.blobstore.KeyNotFoundException;
|
||||||
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
|
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
|
||||||
|
@ -49,6 +50,8 @@ import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code AtmosStorageClient}
|
* Tests behavior of {@code AtmosStorageClient}
|
||||||
|
@ -109,12 +112,12 @@ public class AtmosStorageClientLiveTest {
|
||||||
URI container2;
|
URI container2;
|
||||||
|
|
||||||
@BeforeGroups(groups = { "live" })
|
@BeforeGroups(groups = { "live" })
|
||||||
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException {
|
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException,
|
||||||
|
IOException {
|
||||||
String uid = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String uid = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
BlobStoreContext blobStoreContext = new AtmosStorageContextBuilder(
|
BlobStoreContext blobStoreContext = new BlobStoreContextFactory().createContext(
|
||||||
new AtmosStoragePropertiesBuilder(uid, key).build()).withModules(
|
"atmosstorage", uid, key, ImmutableSet.<Module> of(new Log4JLoggingModule()));
|
||||||
new Log4JLoggingModule()).buildBlobStoreContext();
|
|
||||||
RestContext<AtmosStorageAsyncClient, AtmosStorageClient> context = blobStoreContext
|
RestContext<AtmosStorageAsyncClient, AtmosStorageClient> context = blobStoreContext
|
||||||
.getProviderSpecificContext();
|
.getProviderSpecificContext();
|
||||||
connection = context.getApi();
|
connection = context.getApi();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class AtmosBlobStoreModuleTest {
|
||||||
Injector createInjector() {
|
Injector createInjector() {
|
||||||
return Guice.createInjector(new ExecutorServiceModule(sameThreadExecutor(),
|
return Guice.createInjector(new ExecutorServiceModule(sameThreadExecutor(),
|
||||||
sameThreadExecutor()), new JDKLoggingModule(), new AtmosStorageStubClientModule(),
|
sameThreadExecutor()), new JDKLoggingModule(), new AtmosStorageStubClientModule(),
|
||||||
new AtmosBlobStoreContextModule() {
|
new AtmosBlobStoreContextModule("atmos") {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.domain;
|
package org.jclouds.aws.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -45,11 +45,10 @@ import com.google.inject.TypeLiteral;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see EC2ComputeServiceContext
|
* @see EC2ComputeServiceContext
|
||||||
*/
|
*/
|
||||||
public class EC2ContextBuilder extends
|
public class EC2ContextBuilder extends ComputeServiceContextBuilder<EC2AsyncClient, EC2Client> {
|
||||||
ComputeServiceContextBuilder<EC2AsyncClient, EC2Client> {
|
|
||||||
|
|
||||||
public EC2ContextBuilder(Properties props) {
|
public EC2ContextBuilder(String providerName, Properties props) {
|
||||||
super(new TypeLiteral<EC2AsyncClient>() {
|
super(providerName, new TypeLiteral<EC2AsyncClient>() {
|
||||||
}, new TypeLiteral<EC2Client>() {
|
}, new TypeLiteral<EC2Client>() {
|
||||||
}, props);
|
}, props);
|
||||||
}
|
}
|
||||||
|
@ -60,8 +59,8 @@ public class EC2ContextBuilder extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
modules.add(new EC2ComputeServiceContextModule());
|
modules.add(new EC2ComputeServiceContextModule(providerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -42,26 +42,26 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class EC2ContextFactory {
|
public class EC2ContextFactory {
|
||||||
public static ComputeServiceContext createContext(Properties properties, Module... modules) {
|
public static ComputeServiceContext createContext(Properties properties, Module... modules) {
|
||||||
return new EC2ContextBuilder(new EC2PropertiesBuilder(properties).build())
|
return new EC2ContextBuilder("ec2", new EC2PropertiesBuilder(properties).build())
|
||||||
.withModules(modules).buildComputeServiceContext();
|
.withModules(modules).buildComputeServiceContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ComputeServiceContext createContext(String awsAccessKeyId,
|
public static ComputeServiceContext createContext(String awsAccessKeyId,
|
||||||
String awsSecretAccessKey, Module... modules) {
|
String awsSecretAccessKey, Module... modules) {
|
||||||
return new EC2ContextBuilder(new EC2PropertiesBuilder(awsAccessKeyId,
|
return new EC2ContextBuilder("ec2", new EC2PropertiesBuilder(awsAccessKeyId,
|
||||||
awsSecretAccessKey).build()).withModules(modules).buildComputeServiceContext();
|
awsSecretAccessKey).build()).withModules(modules).buildComputeServiceContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ComputeServiceContext createContext(Properties properties, String awsAccessKeyId,
|
public static ComputeServiceContext createContext(Properties properties, String awsAccessKeyId,
|
||||||
String awsSecretAccessKey, Module... modules) {
|
String awsSecretAccessKey, Module... modules) {
|
||||||
return new EC2ContextBuilder(new EC2PropertiesBuilder(properties)
|
return new EC2ContextBuilder("ec2", new EC2PropertiesBuilder(properties).withCredentials(
|
||||||
.withCredentials(awsAccessKeyId, awsSecretAccessKey).build()).withModules(modules)
|
awsAccessKeyId, awsSecretAccessKey).build()).withModules(modules)
|
||||||
.buildComputeServiceContext();
|
.buildComputeServiceContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ComputeServiceContext createContext(URI endpoint, String awsAccessKeyId,
|
public static ComputeServiceContext createContext(URI endpoint, String awsAccessKeyId,
|
||||||
String awsSecretAccessKey, Module... modules) {
|
String awsSecretAccessKey, Module... modules) {
|
||||||
return new EC2ContextBuilder(new EC2PropertiesBuilder(awsAccessKeyId,
|
return new EC2ContextBuilder("ec2", new EC2PropertiesBuilder(awsAccessKeyId,
|
||||||
awsSecretAccessKey).withEndpoint(endpoint).build()).withModules(modules)
|
awsSecretAccessKey).withEndpoint(endpoint).build()).withModules(modules)
|
||||||
.buildComputeServiceContext();
|
.buildComputeServiceContext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.Constants;
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2Client;
|
import org.jclouds.aws.ec2.EC2Client;
|
||||||
import org.jclouds.aws.ec2.compute.config.EC2ComputeServiceContextModule.GetRegionFromNodeOrDefault;
|
import org.jclouds.aws.ec2.compute.config.EC2ComputeServiceContextModule.GetRegionFromNodeOrDefault;
|
||||||
import org.jclouds.aws.ec2.compute.domain.PortsRegionTag;
|
import org.jclouds.aws.ec2.compute.domain.PortsRegionTag;
|
||||||
|
|
|
@ -99,6 +99,12 @@ import com.google.inject.TypeLiteral;
|
||||||
*/
|
*/
|
||||||
public class EC2ComputeServiceContextModule extends EC2ContextModule {
|
public class EC2ComputeServiceContextModule extends EC2ContextModule {
|
||||||
|
|
||||||
|
private final String providerName;
|
||||||
|
|
||||||
|
public EC2ComputeServiceContextModule(String providerName) {
|
||||||
|
this.providerName = providerName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
super.configure();
|
super.configure();
|
||||||
|
@ -146,8 +152,8 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
|
||||||
public static class GetRegionFromNodeOrDefault implements Function<ComputeMetadata, String> {
|
public static class GetRegionFromNodeOrDefault implements Function<ComputeMetadata, String> {
|
||||||
public String apply(ComputeMetadata node) {
|
public String apply(ComputeMetadata node) {
|
||||||
Location location = node.getLocation();
|
Location location = node.getLocation();
|
||||||
String region = location.getScope() == LocationScope.REGION ? location
|
String region = location.getScope() == LocationScope.REGION ? location.getId() : location
|
||||||
.getId() : location.getParent();
|
.getParent().getId();
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,14 +263,15 @@ public class EC2ComputeServiceContextModule extends EC2ContextModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
Map<String, ? extends Location> provideLocations(Map<String, String> availabilityZoneToRegionMap) {
|
Map<String, ? extends Location> provideLocations(Map<String, String> availabilityZoneToRegionMap) {
|
||||||
|
Location ec2 = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
|
||||||
Map<String, Location> locations = Maps.newLinkedHashMap();
|
Map<String, Location> locations = Maps.newLinkedHashMap();
|
||||||
for (String zone : availabilityZoneToRegionMap.keySet()) {
|
|
||||||
locations.put(zone, new LocationImpl(LocationScope.ZONE, zone, zone,
|
|
||||||
availabilityZoneToRegionMap.get(zone)));
|
|
||||||
}
|
|
||||||
for (String region : availabilityZoneToRegionMap.values()) {
|
for (String region : availabilityZoneToRegionMap.values()) {
|
||||||
locations.put(region, new LocationImpl(LocationScope.REGION, region,
|
locations.put(region, new LocationImpl(LocationScope.REGION, region, region, ec2));
|
||||||
region, null));
|
}
|
||||||
|
|
||||||
|
for (String zone : availabilityZoneToRegionMap.keySet()) {
|
||||||
|
locations.put(zone, new LocationImpl(LocationScope.ZONE, zone, zone, locations
|
||||||
|
.get(availabilityZoneToRegionMap.get(zone))));
|
||||||
}
|
}
|
||||||
return locations;
|
return locations;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.AWSResponseException;
|
import org.jclouds.aws.AWSResponseException;
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2Client;
|
import org.jclouds.aws.ec2.EC2Client;
|
||||||
import org.jclouds.aws.ec2.compute.domain.RegionTag;
|
import org.jclouds.aws.ec2.compute.domain.RegionTag;
|
||||||
import org.jclouds.aws.ec2.domain.KeyPair;
|
import org.jclouds.aws.ec2.domain.KeyPair;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.AWSResponseException;
|
import org.jclouds.aws.AWSResponseException;
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2Client;
|
import org.jclouds.aws.ec2.EC2Client;
|
||||||
import org.jclouds.aws.ec2.compute.domain.PortsRegionTag;
|
import org.jclouds.aws.ec2.compute.domain.PortsRegionTag;
|
||||||
import org.jclouds.aws.ec2.domain.IpProtocol;
|
import org.jclouds.aws.ec2.domain.IpProtocol;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2Client;
|
import org.jclouds.aws.ec2.EC2Client;
|
||||||
import org.jclouds.aws.ec2.compute.config.EC2ComputeServiceContextModule.GetRegionFromNodeOrDefault;
|
import org.jclouds.aws.ec2.compute.config.EC2ComputeServiceContextModule.GetRegionFromNodeOrDefault;
|
||||||
import org.jclouds.aws.ec2.domain.RunningInstance;
|
import org.jclouds.aws.ec2.domain.RunningInstance;
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class EC2RunNodesAndAddToSetStrategy implements RunNodesAndAddToSetStrate
|
||||||
|
|
||||||
// if the location has a parent, it must be an availability zone.
|
// if the location has a parent, it must be an availability zone.
|
||||||
String region = zone == null ? template.getLocation().getId() :
|
String region = zone == null ? template.getLocation().getId() :
|
||||||
template.getLocation().getParent();
|
template.getLocation().getParent().getId();
|
||||||
|
|
||||||
// get or create incidental resources
|
// get or create incidental resources
|
||||||
// TODO race condition. we were using MapMaker, but it doesn't seem to refresh properly when
|
// TODO race condition. we were using MapMaker, but it doesn't seem to refresh properly when
|
||||||
|
|
|
@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
|
|
|
@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -20,8 +20,6 @@ package org.jclouds.aws.ec2.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,8 +20,6 @@ package org.jclouds.aws.ec2.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
import com.google.inject.internal.Nullable;
|
import com.google.inject.internal.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
import com.google.inject.internal.Nullable;
|
import com.google.inject.internal.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,8 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
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.inject.internal.Nullable;
|
import com.google.inject.internal.Nullable;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.domain.Attachment.Status;
|
import org.jclouds.aws.ec2.domain.Attachment.Status;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
|
@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-SecurityGroupItemType.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-SecurityGroupItemType.html"
|
||||||
|
|
|
@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSnapshot.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSnapshot.html"
|
||||||
|
|
|
@ -25,8 +25,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
|
@ -29,7 +29,6 @@ import javax.annotation.Nullable;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.AvailabilityZoneInfo;
|
import org.jclouds.aws.ec2.domain.AvailabilityZoneInfo;
|
||||||
import org.jclouds.aws.ec2.functions.RegionToEndpoint;
|
import org.jclouds.aws.ec2.functions.RegionToEndpoint;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.domain.AvailabilityZoneInfo;
|
import org.jclouds.aws.ec2.domain.AvailabilityZoneInfo;
|
||||||
import org.jclouds.aws.ec2.options.DescribeAvailabilityZonesOptions;
|
import org.jclouds.aws.ec2.options.DescribeAvailabilityZonesOptions;
|
||||||
import org.jclouds.aws.ec2.options.DescribeRegionsOptions;
|
import org.jclouds.aws.ec2.options.DescribeRegionsOptions;
|
||||||
|
|
|
@ -29,7 +29,6 @@ import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.binders.BindInetAddressesToIndexedFormParams;
|
import org.jclouds.aws.ec2.binders.BindInetAddressesToIndexedFormParams;
|
||||||
import org.jclouds.aws.ec2.domain.PublicIpInstanceIdPair;
|
import org.jclouds.aws.ec2.domain.PublicIpInstanceIdPair;
|
||||||
import org.jclouds.aws.ec2.functions.RegionToEndpoint;
|
import org.jclouds.aws.ec2.functions.RegionToEndpoint;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.aws.AWSResponseException;
|
import org.jclouds.aws.AWSResponseException;
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.domain.PublicIpInstanceIdPair;
|
import org.jclouds.aws.ec2.domain.PublicIpInstanceIdPair;
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.binders.BindKeyNameToIndexedFormParams;
|
import org.jclouds.aws.ec2.binders.BindKeyNameToIndexedFormParams;
|
||||||
import org.jclouds.aws.ec2.domain.KeyPair;
|
import org.jclouds.aws.ec2.domain.KeyPair;
|
||||||
import org.jclouds.aws.ec2.functions.RegionToEndpoint;
|
import org.jclouds.aws.ec2.functions.RegionToEndpoint;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.domain.KeyPair;
|
import org.jclouds.aws.ec2.domain.KeyPair;
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.binders.BindInstanceIdsToIndexedFormParams;
|
import org.jclouds.aws.ec2.binders.BindInstanceIdsToIndexedFormParams;
|
||||||
import org.jclouds.aws.ec2.domain.MonitoringState;
|
import org.jclouds.aws.ec2.domain.MonitoringState;
|
||||||
import org.jclouds.aws.ec2.functions.RegionToEndpoint;
|
import org.jclouds.aws.ec2.functions.RegionToEndpoint;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.domain.MonitoringState;
|
import org.jclouds.aws.ec2.domain.MonitoringState;
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.binders.BindGroupNameToIndexedFormParams;
|
import org.jclouds.aws.ec2.binders.BindGroupNameToIndexedFormParams;
|
||||||
import org.jclouds.aws.ec2.binders.BindUserIdGroupPairToSourceSecurityGroupFormParams;
|
import org.jclouds.aws.ec2.binders.BindUserIdGroupPairToSourceSecurityGroupFormParams;
|
||||||
import org.jclouds.aws.ec2.domain.IpProtocol;
|
import org.jclouds.aws.ec2.domain.IpProtocol;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.domain.IpProtocol;
|
import org.jclouds.aws.ec2.domain.IpProtocol;
|
||||||
import org.jclouds.aws.ec2.domain.SecurityGroup;
|
import org.jclouds.aws.ec2.domain.SecurityGroup;
|
||||||
import org.jclouds.aws.ec2.domain.UserIdGroupPair;
|
import org.jclouds.aws.ec2.domain.UserIdGroupPair;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Date;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.Attachment;
|
import org.jclouds.aws.ec2.domain.Attachment;
|
||||||
import org.jclouds.aws.ec2.util.EC2Utils;
|
import org.jclouds.aws.ec2.util.EC2Utils;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Set;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.PublicIpInstanceIdPair;
|
import org.jclouds.aws.ec2.domain.PublicIpInstanceIdPair;
|
||||||
import org.jclouds.aws.ec2.util.EC2Utils;
|
import org.jclouds.aws.ec2.util.EC2Utils;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Set;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.Image;
|
import org.jclouds.aws.ec2.domain.Image;
|
||||||
import org.jclouds.aws.ec2.domain.RootDeviceType;
|
import org.jclouds.aws.ec2.domain.RootDeviceType;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.SortedSet;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.Reservation;
|
import org.jclouds.aws.ec2.domain.Reservation;
|
||||||
import org.jclouds.date.DateService;
|
import org.jclouds.date.DateService;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.KeyPair;
|
import org.jclouds.aws.ec2.domain.KeyPair;
|
||||||
import org.jclouds.aws.ec2.util.EC2Utils;
|
import org.jclouds.aws.ec2.util.EC2Utils;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.SortedSet;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.IpPermission;
|
import org.jclouds.aws.ec2.domain.IpPermission;
|
||||||
import org.jclouds.aws.ec2.domain.IpProtocol;
|
import org.jclouds.aws.ec2.domain.IpProtocol;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.SortedSet;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.InstanceState;
|
import org.jclouds.aws.ec2.domain.InstanceState;
|
||||||
import org.jclouds.aws.ec2.domain.InstanceStateChange;
|
import org.jclouds.aws.ec2.domain.InstanceStateChange;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.ec2.xml;
|
package org.jclouds.aws.ec2.xml;
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.domain.InstanceType;
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.aws.ec2.xml;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.KeyPair;
|
import org.jclouds.aws.ec2.domain.KeyPair;
|
||||||
import org.jclouds.aws.ec2.util.EC2Utils;
|
import org.jclouds.aws.ec2.util.EC2Utils;
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.aws.ec2.xml;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.Reservation;
|
import org.jclouds.aws.ec2.domain.Reservation;
|
||||||
import org.jclouds.date.DateService;
|
import org.jclouds.date.DateService;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Date;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.EC2;
|
import org.jclouds.aws.ec2.EC2;
|
||||||
import org.jclouds.aws.ec2.domain.Snapshot;
|
import org.jclouds.aws.ec2.domain.Snapshot;
|
||||||
import org.jclouds.aws.ec2.domain.Snapshot.Status;
|
import org.jclouds.aws.ec2.domain.Snapshot.Status;
|
||||||
|
|
|
@ -46,15 +46,15 @@ import com.google.inject.TypeLiteral;
|
||||||
*/
|
*/
|
||||||
public class S3ContextBuilder extends BlobStoreContextBuilder<S3AsyncClient, S3Client> {
|
public class S3ContextBuilder extends BlobStoreContextBuilder<S3AsyncClient, S3Client> {
|
||||||
|
|
||||||
public S3ContextBuilder(Properties props) {
|
public S3ContextBuilder(String providerName, Properties props) {
|
||||||
super(new TypeLiteral<S3AsyncClient>() {
|
super(providerName, new TypeLiteral<S3AsyncClient>() {
|
||||||
}, new TypeLiteral<S3Client>() {
|
}, new TypeLiteral<S3Client>() {
|
||||||
}, props);
|
}, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName,List<Module> modules) {
|
||||||
modules.add(new S3BlobStoreContextModule());
|
modules.add(new S3BlobStoreContextModule(providerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -41,27 +41,27 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class S3ContextFactory {
|
public class S3ContextFactory {
|
||||||
|
|
||||||
public static BlobStoreContext createContext(Properties properties,
|
public static BlobStoreContext createContext(Properties properties, Module... modules) {
|
||||||
Module... modules) {
|
return new S3ContextBuilder("s3", new S3PropertiesBuilder(properties).build()).withModules(
|
||||||
return new S3ContextBuilder(new S3PropertiesBuilder(properties).build()).withModules(modules)
|
modules).buildBlobStoreContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BlobStoreContext createContext(Properties properties, String awsAccessKeyId,
|
||||||
|
String awsSecretAccessKey, Module... modules) {
|
||||||
|
return new S3ContextBuilder("s3", new S3PropertiesBuilder(properties).withCredentials(
|
||||||
|
awsAccessKeyId, awsSecretAccessKey).build()).withModules(modules)
|
||||||
.buildBlobStoreContext();
|
.buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlobStoreContext createContext(Properties properties,
|
public static BlobStoreContext createContext(String awsAccessKeyId, String awsSecretAccessKey,
|
||||||
String awsAccessKeyId, String awsSecretAccessKey, Module... modules) {
|
Module... modules) {
|
||||||
return new S3ContextBuilder(new S3PropertiesBuilder(properties).withCredentials(
|
return new S3ContextBuilder("s3", new S3PropertiesBuilder(awsAccessKeyId, awsSecretAccessKey)
|
||||||
awsAccessKeyId, awsSecretAccessKey).build()).withModules(modules).buildBlobStoreContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlobStoreContext createContext(String awsAccessKeyId,
|
|
||||||
String awsSecretAccessKey, Module... modules) {
|
|
||||||
return new S3ContextBuilder(new S3PropertiesBuilder(awsAccessKeyId, awsSecretAccessKey)
|
|
||||||
.build()).withModules(modules).buildBlobStoreContext();
|
.build()).withModules(modules).buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlobStoreContext createContext(URI endpoint,
|
public static BlobStoreContext createContext(URI endpoint, String awsAccessKeyId,
|
||||||
String awsAccessKeyId, String awsSecretAccessKey, Module... modules) {
|
String awsSecretAccessKey, Module... modules) {
|
||||||
return new S3ContextBuilder(new S3PropertiesBuilder(awsAccessKeyId, awsSecretAccessKey)
|
return new S3ContextBuilder("s3", new S3PropertiesBuilder(awsAccessKeyId, awsSecretAccessKey)
|
||||||
.withEndpoint(endpoint).build()).withModules(modules).buildBlobStoreContext();
|
.withEndpoint(endpoint).build()).withModules(modules).buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.s3.S3;
|
import org.jclouds.aws.s3.S3;
|
||||||
import org.jclouds.aws.s3.S3AsyncClient;
|
import org.jclouds.aws.s3.S3AsyncClient;
|
||||||
import org.jclouds.aws.s3.S3Client;
|
import org.jclouds.aws.s3.S3Client;
|
||||||
|
@ -53,6 +52,11 @@ import com.google.inject.TypeLiteral;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class S3BlobStoreContextModule extends S3ContextModule {
|
public class S3BlobStoreContextModule extends S3ContextModule {
|
||||||
|
private final String providerName;
|
||||||
|
|
||||||
|
public S3BlobStoreContextModule(String providerName) {
|
||||||
|
this.providerName = providerName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
|
@ -76,9 +80,10 @@ public class S3BlobStoreContextModule extends S3ContextModule {
|
||||||
@Singleton
|
@Singleton
|
||||||
Map<String, ? extends Location> provideLocations(@S3 Set<String> regions) {
|
Map<String, ? extends Location> provideLocations(@S3 Set<String> regions) {
|
||||||
Set<Location> locations = Sets.newHashSet();
|
Set<Location> locations = Sets.newHashSet();
|
||||||
|
Location s3 = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
|
||||||
for (String zone : regions) {
|
for (String zone : regions) {
|
||||||
locations
|
locations
|
||||||
.add(new LocationImpl(LocationScope.ZONE, zone.toString(), zone.toString(), null));
|
.add(new LocationImpl(LocationScope.REGION, zone.toString(), zone.toString(), s3));
|
||||||
}
|
}
|
||||||
return Maps.uniqueIndex(locations, new Function<Location, String>() {
|
return Maps.uniqueIndex(locations, new Function<Location, String>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,7 +24,6 @@ import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.s3.S3Client;
|
import org.jclouds.aws.s3.S3Client;
|
||||||
import org.jclouds.aws.s3.domain.BucketMetadata;
|
import org.jclouds.aws.s3.domain.BucketMetadata;
|
||||||
import org.jclouds.blobstore.ContainerNotFoundException;
|
import org.jclouds.blobstore.ContainerNotFoundException;
|
||||||
|
|
|
@ -28,7 +28,6 @@ import javax.ws.rs.FormParam;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
import org.jclouds.aws.sqs.domain.Queue;
|
import org.jclouds.aws.sqs.domain.Queue;
|
||||||
import org.jclouds.aws.sqs.functions.QueueLocation;
|
import org.jclouds.aws.sqs.functions.QueueLocation;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.sqs.domain.Queue;
|
import org.jclouds.aws.sqs.domain.Queue;
|
||||||
import org.jclouds.aws.sqs.options.CreateQueueOptions;
|
import org.jclouds.aws.sqs.options.CreateQueueOptions;
|
||||||
import org.jclouds.aws.sqs.options.ListQueuesOptions;
|
import org.jclouds.aws.sqs.options.ListQueuesOptions;
|
||||||
|
|
|
@ -46,15 +46,15 @@ import com.google.inject.TypeLiteral;
|
||||||
*/
|
*/
|
||||||
public class SQSContextBuilder extends RestContextBuilder<SQSAsyncClient, SQSClient> {
|
public class SQSContextBuilder extends RestContextBuilder<SQSAsyncClient, SQSClient> {
|
||||||
|
|
||||||
public SQSContextBuilder(Properties props) {
|
public SQSContextBuilder(String providerName, Properties props) {
|
||||||
super(new TypeLiteral<SQSAsyncClient>() {
|
super(providerName, new TypeLiteral<SQSAsyncClient>() {
|
||||||
}, new TypeLiteral<SQSClient>() {
|
}, new TypeLiteral<SQSClient>() {
|
||||||
}, props);
|
}, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
modules.add(new SQSContextModule());
|
modules.add(new SQSContextModule(providerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,25 +43,26 @@ public class SQSContextFactory {
|
||||||
|
|
||||||
public static RestContext<SQSAsyncClient, SQSClient> createContext(Properties properties,
|
public static RestContext<SQSAsyncClient, SQSClient> createContext(Properties properties,
|
||||||
Module... modules) {
|
Module... modules) {
|
||||||
return new SQSContextBuilder(new SQSPropertiesBuilder(properties).build()).withModules(
|
return new SQSContextBuilder("sqs", new SQSPropertiesBuilder(properties).build())
|
||||||
modules).buildContext();
|
.withModules(modules).buildContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestContext<SQSAsyncClient, SQSClient> createContext(Properties properties, String awsAccessKeyId,
|
public static RestContext<SQSAsyncClient, SQSClient> createContext(Properties properties,
|
||||||
String awsSecretAccessKey, Module... modules) {
|
String awsAccessKeyId, String awsSecretAccessKey, Module... modules) {
|
||||||
return new SQSContextBuilder(new SQSPropertiesBuilder(properties).withCredentials(awsAccessKeyId, awsSecretAccessKey)
|
return new SQSContextBuilder("sqs", new SQSPropertiesBuilder(properties).withCredentials(
|
||||||
.build()).withModules(modules).buildContext();
|
awsAccessKeyId, awsSecretAccessKey).build()).withModules(modules).buildContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestContext<SQSAsyncClient, SQSClient> createContext(String awsAccessKeyId,
|
public static RestContext<SQSAsyncClient, SQSClient> createContext(String awsAccessKeyId,
|
||||||
String awsSecretAccessKey, Module... modules) {
|
String awsSecretAccessKey, Module... modules) {
|
||||||
return new SQSContextBuilder(new SQSPropertiesBuilder(awsAccessKeyId, awsSecretAccessKey)
|
return new SQSContextBuilder("sqs", new SQSPropertiesBuilder(awsAccessKeyId,
|
||||||
.build()).withModules(modules).buildContext();
|
awsSecretAccessKey).build()).withModules(modules).buildContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestContext<SQSAsyncClient, SQSClient> createContext(URI endpoint,
|
public static RestContext<SQSAsyncClient, SQSClient> createContext(URI endpoint,
|
||||||
String awsAccessKeyId, String awsSecretAccessKey, Module... modules) {
|
String awsAccessKeyId, String awsSecretAccessKey, Module... modules) {
|
||||||
return new SQSContextBuilder(new SQSPropertiesBuilder(awsAccessKeyId, awsSecretAccessKey)
|
return new SQSContextBuilder("sqs", new SQSPropertiesBuilder(awsAccessKeyId,
|
||||||
.withEndpoint(endpoint).build()).withModules(modules).buildContext();
|
awsSecretAccessKey).withEndpoint(endpoint).build()).withModules(modules)
|
||||||
|
.buildContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,9 @@ import com.google.inject.Provides;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SQSContextModule extends AbstractModule {
|
public class SQSContextModule extends AbstractModule {
|
||||||
|
public SQSContextModule(String providerName) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(DateAdapter.class).to(CDateAdapter.class);
|
bind(DateAdapter.class).to(CDateAdapter.class);
|
||||||
|
|
|
@ -22,8 +22,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Query_QueryListQueues.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Query_QueryListQueues.html"
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.sqs.SQS;
|
import org.jclouds.aws.sqs.SQS;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.ws.rs.core.UriBuilder;
|
import javax.ws.rs.core.UriBuilder;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.sqs.SQS;
|
import org.jclouds.aws.sqs.SQS;
|
||||||
import org.jclouds.aws.sqs.domain.Queue;
|
import org.jclouds.aws.sqs.domain.Queue;
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.sqs.SQS;
|
import org.jclouds.aws.sqs.SQS;
|
||||||
import org.jclouds.aws.sqs.domain.Queue;
|
import org.jclouds.aws.sqs.domain.Queue;
|
||||||
import org.jclouds.aws.sqs.xml.internal.BaseRegexQueueHandler;
|
import org.jclouds.aws.sqs.xml.internal.BaseRegexQueueHandler;
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.sqs.SQS;
|
import org.jclouds.aws.sqs.SQS;
|
||||||
import org.jclouds.aws.sqs.domain.Queue;
|
import org.jclouds.aws.sqs.domain.Queue;
|
||||||
import org.jclouds.aws.sqs.xml.internal.BaseRegexQueueHandler;
|
import org.jclouds.aws.sqs.xml.internal.BaseRegexQueueHandler;
|
||||||
|
|
|
@ -27,7 +27,6 @@ import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.sqs.domain.Queue;
|
import org.jclouds.aws.sqs.domain.Queue;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableBiMap;
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
|
|
|
@ -93,8 +93,9 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException {
|
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
String user = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String user = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String password = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String password = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new EC2ContextBuilder(new EC2PropertiesBuilder(user, password).build())
|
Injector injector = new EC2ContextBuilder("ec2", new EC2PropertiesBuilder(user, password)
|
||||||
.withModules(new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
.build()).withModules(new Log4JLoggingModule(), new JschSshClientModule())
|
||||||
|
.buildInjector();
|
||||||
client = injector.getInstance(EC2Client.class);
|
client = injector.getInstance(EC2Client.class);
|
||||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||||
runningTester = new RetryablePredicate<RunningInstance>(new InstanceStateRunning(client
|
runningTester = new RetryablePredicate<RunningInstance>(new InstanceStateRunning(client
|
||||||
|
@ -111,13 +112,12 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
securityGroupName = instancePrefix + "ingress";
|
securityGroupName = instancePrefix + "ingress";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null,
|
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null, securityGroupName);
|
||||||
securityGroupName);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
client.getSecurityGroupServices().createSecurityGroupInRegion(null,
|
client.getSecurityGroupServices().createSecurityGroupInRegion(null, securityGroupName,
|
||||||
securityGroupName, securityGroupName);
|
securityGroupName);
|
||||||
for (int port : new int[] { 80, 443, 22 }) {
|
for (int port : new int[] { 80, 443, 22 }) {
|
||||||
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null,
|
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null,
|
||||||
securityGroupName, IpProtocol.TCP, port, port, "0.0.0.0/0");
|
securityGroupName, IpProtocol.TCP, port, port, "0.0.0.0/0");
|
||||||
|
@ -154,8 +154,13 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
System.out.printf("%d: running instance%n", System.currentTimeMillis());
|
System.out.printf("%d: running instance%n", System.currentTimeMillis());
|
||||||
Reservation reservation = client.getInstanceServices().runInstancesInRegion(
|
Reservation reservation = client.getInstanceServices().runInstancesInRegion(null, null, // allow
|
||||||
null, null, // allow ec2 to chose an availability zone
|
// ec2
|
||||||
|
// to
|
||||||
|
// chose
|
||||||
|
// an
|
||||||
|
// availability
|
||||||
|
// zone
|
||||||
"ami-ccf615a5", // alestic ami allows auto-invoke of user data scripts
|
"ami-ccf615a5", // alestic ami allows auto-invoke of user data scripts
|
||||||
1, // minimum instances
|
1, // minimum instances
|
||||||
1, // maximum instances
|
1, // maximum instances
|
||||||
|
@ -185,11 +190,11 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyInstanceProperties(String script) {
|
private void verifyInstanceProperties(String script) {
|
||||||
assertEquals(script, client.getInstanceServices().getUserDataForInstanceInRegion(
|
assertEquals(script, client.getInstanceServices().getUserDataForInstanceInRegion(null,
|
||||||
null, instanceId));
|
instanceId));
|
||||||
|
|
||||||
assertEquals(null, client.getInstanceServices().getRootDeviceNameForInstanceInRegion(
|
assertEquals(null, client.getInstanceServices().getRootDeviceNameForInstanceInRegion(null,
|
||||||
null, instanceId));
|
instanceId));
|
||||||
|
|
||||||
assert client.getInstanceServices().getRamdiskForInstanceInRegion(null, instanceId)
|
assert client.getInstanceServices().getRamdiskForInstanceInRegion(null, instanceId)
|
||||||
.startsWith("ari-");
|
.startsWith("ari-");
|
||||||
|
@ -211,12 +216,12 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setApiTerminationDisabledForInstanceInRegion() {
|
private void setApiTerminationDisabledForInstanceInRegion() {
|
||||||
client.getInstanceServices().setApiTerminationDisabledForInstanceInRegion(null,
|
client.getInstanceServices().setApiTerminationDisabledForInstanceInRegion(null, instanceId,
|
||||||
instanceId, true);
|
true);
|
||||||
assertEquals(true, client.getInstanceServices().isApiTerminationDisabledForInstanceInRegion(
|
assertEquals(true, client.getInstanceServices().isApiTerminationDisabledForInstanceInRegion(
|
||||||
null, instanceId));
|
null, instanceId));
|
||||||
client.getInstanceServices().setApiTerminationDisabledForInstanceInRegion(null,
|
client.getInstanceServices().setApiTerminationDisabledForInstanceInRegion(null, instanceId,
|
||||||
instanceId, false);
|
false);
|
||||||
assertEquals(false, client.getInstanceServices().isApiTerminationDisabledForInstanceInRegion(
|
assertEquals(false, client.getInstanceServices().isApiTerminationDisabledForInstanceInRegion(
|
||||||
null, instanceId));
|
null, instanceId));
|
||||||
}
|
}
|
||||||
|
@ -243,10 +248,9 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
|
|
||||||
private void setRamdiskForInstanceInRegion() {
|
private void setRamdiskForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
String ramdisk = client.getInstanceServices().getRamdiskForInstanceInRegion(
|
String ramdisk = client.getInstanceServices().getRamdiskForInstanceInRegion(null,
|
||||||
null, instanceId);
|
instanceId);
|
||||||
client.getInstanceServices().setRamdiskForInstanceInRegion(null, instanceId,
|
client.getInstanceServices().setRamdiskForInstanceInRegion(null, instanceId, ramdisk);
|
||||||
ramdisk);
|
|
||||||
assert false : "shouldn't be allowed, as instance needs to be stopped";
|
assert false : "shouldn't be allowed, as instance needs to be stopped";
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
||||||
|
@ -255,10 +259,9 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
|
|
||||||
private void setKernelForInstanceInRegion() {
|
private void setKernelForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
String oldKernel = client.getInstanceServices().getKernelForInstanceInRegion(
|
String oldKernel = client.getInstanceServices().getKernelForInstanceInRegion(null,
|
||||||
null, instanceId);
|
instanceId);
|
||||||
client.getInstanceServices().setKernelForInstanceInRegion(null, instanceId,
|
client.getInstanceServices().setKernelForInstanceInRegion(null, instanceId, oldKernel);
|
||||||
oldKernel);
|
|
||||||
assert false : "shouldn't be allowed, as instance needs to be stopped";
|
assert false : "shouldn't be allowed, as instance needs to be stopped";
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
||||||
|
@ -267,8 +270,8 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
|
|
||||||
private void setInstanceTypeForInstanceInRegion() {
|
private void setInstanceTypeForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setInstanceTypeForInstanceInRegion(null,
|
client.getInstanceServices().setInstanceTypeForInstanceInRegion(null, instanceId,
|
||||||
instanceId, InstanceType.C1_MEDIUM);
|
InstanceType.C1_MEDIUM);
|
||||||
assert false : "shouldn't be allowed, as instance needs to be stopped";
|
assert false : "shouldn't be allowed, as instance needs to be stopped";
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
assertEquals("IncorrectInstanceState", e.getError().getCode());
|
||||||
|
@ -278,8 +281,8 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
private void setBlockDeviceMappingForInstanceInRegion() {
|
private void setBlockDeviceMappingForInstanceInRegion() {
|
||||||
BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
|
BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setBlockDeviceMappingForInstanceInRegion(null,
|
client.getInstanceServices().setBlockDeviceMappingForInstanceInRegion(null, instanceId,
|
||||||
instanceId, blockDeviceMapping);
|
blockDeviceMapping);
|
||||||
assert false : "shouldn't be allowed, as instance needs to be ebs based-ami";
|
assert false : "shouldn't be allowed, as instance needs to be ebs based-ami";
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("InvalidParameterCombination", e.getError().getCode());
|
assertEquals("InvalidParameterCombination", e.getError().getCode());
|
||||||
|
@ -288,8 +291,8 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
|
|
||||||
private void setInstanceInitiatedShutdownBehaviorForInstanceInRegion() {
|
private void setInstanceInitiatedShutdownBehaviorForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
||||||
null, instanceId, InstanceInitiatedShutdownBehavior.STOP);
|
instanceId, InstanceInitiatedShutdownBehavior.STOP);
|
||||||
assert false : "shouldn't be allowed, as instance needs to be ebs based-ami";
|
assert false : "shouldn't be allowed, as instance needs to be ebs based-ami";
|
||||||
} catch (AWSResponseException e) {
|
} catch (AWSResponseException e) {
|
||||||
assertEquals("UnsupportedInstanceAttribute", e.getError().getCode());
|
assertEquals("UnsupportedInstanceAttribute", e.getError().getCode());
|
||||||
|
@ -328,8 +331,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
assertEquals(compare.getPublicIp(), address);
|
assertEquals(compare.getPublicIp(), address);
|
||||||
assert compare.getInstanceId() == null;
|
assert compare.getInstanceId() == null;
|
||||||
|
|
||||||
client.getElasticIPAddressServices().associateAddressInRegion(null, address,
|
client.getElasticIPAddressServices().associateAddressInRegion(null, address, instanceId);
|
||||||
instanceId);
|
|
||||||
|
|
||||||
compare = Iterables.getLast(client.getElasticIPAddressServices().describeAddressesInRegion(
|
compare = Iterables.getLast(client.getElasticIPAddressServices().describeAddressesInRegion(
|
||||||
null, address));
|
null, address));
|
||||||
|
@ -390,8 +392,8 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
|
|
||||||
private RunningInstance getInstance(String instanceId) {
|
private RunningInstance getInstance(String instanceId) {
|
||||||
// search my account for the instance I just created
|
// search my account for the instance I just created
|
||||||
Set<Reservation> reservations = client.getInstanceServices().describeInstancesInRegion(
|
Set<Reservation> reservations = client.getInstanceServices().describeInstancesInRegion(null,
|
||||||
null, instanceId); // last parameter (ids) narrows the search
|
instanceId); // last parameter (ids) narrows the search
|
||||||
|
|
||||||
return Iterables.getOnlyElement(Iterables.getOnlyElement(reservations));
|
return Iterables.getOnlyElement(Iterables.getOnlyElement(reservations));
|
||||||
}
|
}
|
||||||
|
@ -439,8 +441,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
|
||||||
if (keyPair != null)
|
if (keyPair != null)
|
||||||
client.getKeyPairServices().deleteKeyPairInRegion(null, keyPair.getKeyName());
|
client.getKeyPairServices().deleteKeyPairInRegion(null, keyPair.getKeyName());
|
||||||
if (securityGroupName != null)
|
if (securityGroupName != null)
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null,
|
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null, securityGroupName);
|
||||||
securityGroupName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,8 +120,9 @@ public class EBSBootEC2ClientLiveTest {
|
||||||
public void setupClient() {
|
public void setupClient() {
|
||||||
String user = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
String user = checkNotNull(System.getProperty("jclouds.test.user"), "jclouds.test.user");
|
||||||
String password = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
String password = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");
|
||||||
Injector injector = new EC2ContextBuilder(new EC2PropertiesBuilder(user, password).build())
|
Injector injector = new EC2ContextBuilder("ec2", new EC2PropertiesBuilder(user, password)
|
||||||
.withModules(new Log4JLoggingModule(), new JschSshClientModule()).buildInjector();
|
.build()).withModules(new Log4JLoggingModule(), new JschSshClientModule())
|
||||||
|
.buildInjector();
|
||||||
client = injector.getInstance(EC2Client.class);
|
client = injector.getInstance(EC2Client.class);
|
||||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||||
|
@ -157,13 +158,12 @@ public class EBSBootEC2ClientLiveTest {
|
||||||
securityGroupName = INSTANCE_PREFIX + "ingress";
|
securityGroupName = INSTANCE_PREFIX + "ingress";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null,
|
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null, securityGroupName);
|
||||||
securityGroupName);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
client.getSecurityGroupServices().createSecurityGroupInRegion(null,
|
client.getSecurityGroupServices().createSecurityGroupInRegion(null, securityGroupName,
|
||||||
securityGroupName, securityGroupName);
|
securityGroupName);
|
||||||
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null,
|
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null,
|
||||||
securityGroupName, IpProtocol.TCP, 80, 80, "0.0.0.0/0");
|
securityGroupName, IpProtocol.TCP, 80, 80, "0.0.0.0/0");
|
||||||
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null,
|
client.getSecurityGroupServices().authorizeSecurityGroupIngressInRegion(null,
|
||||||
|
@ -199,8 +199,13 @@ public class EBSBootEC2ClientLiveTest {
|
||||||
while (instance == null) {
|
while (instance == null) {
|
||||||
try {
|
try {
|
||||||
System.out.printf("%d: running instance%n", System.currentTimeMillis());
|
System.out.printf("%d: running instance%n", System.currentTimeMillis());
|
||||||
Reservation reservation = client.getInstanceServices().runInstancesInRegion(
|
Reservation reservation = client.getInstanceServices().runInstancesInRegion(null, null, // allow
|
||||||
null, null, // allow ec2 to chose an availability zone
|
// ec2
|
||||||
|
// to
|
||||||
|
// chose
|
||||||
|
// an
|
||||||
|
// availability
|
||||||
|
// zone
|
||||||
imageId, 1, // minimum instances
|
imageId, 1, // minimum instances
|
||||||
1, // maximum instances
|
1, // maximum instances
|
||||||
withKeyName(keyPair.getKeyName())// key I created above
|
withKeyName(keyPair.getKeyName())// key I created above
|
||||||
|
@ -422,37 +427,37 @@ public class EBSBootEC2ClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUserDataForInstanceInRegion() {
|
private void setUserDataForInstanceInRegion() {
|
||||||
client.getInstanceServices().setUserDataForInstanceInRegion(null,
|
client.getInstanceServices().setUserDataForInstanceInRegion(null, ebsInstance.getId(),
|
||||||
ebsInstance.getId(), "test".getBytes());
|
"test".getBytes());
|
||||||
assertEquals("test", client.getInstanceServices().getUserDataForInstanceInRegion(
|
assertEquals("test", client.getInstanceServices().getUserDataForInstanceInRegion(null,
|
||||||
null, ebsInstance.getId()));
|
ebsInstance.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRamdiskForInstanceInRegion() {
|
private void setRamdiskForInstanceInRegion() {
|
||||||
String ramdisk = client.getInstanceServices().getRamdiskForInstanceInRegion(null,
|
String ramdisk = client.getInstanceServices().getRamdiskForInstanceInRegion(null,
|
||||||
ebsInstance.getId());
|
ebsInstance.getId());
|
||||||
client.getInstanceServices().setRamdiskForInstanceInRegion(null,
|
client.getInstanceServices()
|
||||||
ebsInstance.getId(), ramdisk);
|
.setRamdiskForInstanceInRegion(null, ebsInstance.getId(), ramdisk);
|
||||||
assertEquals(ramdisk, client.getInstanceServices().getRamdiskForInstanceInRegion(
|
assertEquals(ramdisk, client.getInstanceServices().getRamdiskForInstanceInRegion(null,
|
||||||
null, ebsInstance.getId()));
|
ebsInstance.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setKernelForInstanceInRegion() {
|
private void setKernelForInstanceInRegion() {
|
||||||
String oldKernel = client.getInstanceServices().getKernelForInstanceInRegion(null,
|
String oldKernel = client.getInstanceServices().getKernelForInstanceInRegion(null,
|
||||||
ebsInstance.getId());
|
ebsInstance.getId());
|
||||||
client.getInstanceServices().setKernelForInstanceInRegion(null,
|
client.getInstanceServices().setKernelForInstanceInRegion(null, ebsInstance.getId(),
|
||||||
ebsInstance.getId(), oldKernel);
|
oldKernel);
|
||||||
assertEquals(oldKernel, client.getInstanceServices().getKernelForInstanceInRegion(
|
assertEquals(oldKernel, client.getInstanceServices().getKernelForInstanceInRegion(null,
|
||||||
null, ebsInstance.getId()));
|
ebsInstance.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setInstanceTypeForInstanceInRegion() {
|
private void setInstanceTypeForInstanceInRegion() {
|
||||||
client.getInstanceServices().setInstanceTypeForInstanceInRegion(null,
|
client.getInstanceServices().setInstanceTypeForInstanceInRegion(null, ebsInstance.getId(),
|
||||||
ebsInstance.getId(), InstanceType.C1_MEDIUM);
|
InstanceType.C1_MEDIUM);
|
||||||
assertEquals(InstanceType.C1_MEDIUM, client.getInstanceServices()
|
assertEquals(InstanceType.C1_MEDIUM, client.getInstanceServices()
|
||||||
.getInstanceTypeForInstanceInRegion(null, ebsInstance.getId()));
|
.getInstanceTypeForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
client.getInstanceServices().setInstanceTypeForInstanceInRegion(null,
|
client.getInstanceServices().setInstanceTypeForInstanceInRegion(null, ebsInstance.getId(),
|
||||||
ebsInstance.getId(), InstanceType.M1_SMALL);
|
InstanceType.M1_SMALL);
|
||||||
assertEquals(InstanceType.M1_SMALL, client.getInstanceServices()
|
assertEquals(InstanceType.M1_SMALL, client.getInstanceServices()
|
||||||
.getInstanceTypeForInstanceInRegion(null, ebsInstance.getId()));
|
.getInstanceTypeForInstanceInRegion(null, ebsInstance.getId()));
|
||||||
}
|
}
|
||||||
|
@ -461,15 +466,14 @@ public class EBSBootEC2ClientLiveTest {
|
||||||
String volumeId = ebsInstance.getEbsBlockDevices().get("/dev/sda1").getVolumeId();
|
String volumeId = ebsInstance.getEbsBlockDevices().get("/dev/sda1").getVolumeId();
|
||||||
|
|
||||||
BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
|
BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
|
||||||
blockDeviceMapping.addEbsBlockDevice
|
blockDeviceMapping.addEbsBlockDevice("/dev/sda1", new RunningInstance.EbsBlockDevice(
|
||||||
("/dev/sda1", new RunningInstance.EbsBlockDevice(volumeId, false));
|
volumeId, false));
|
||||||
try {
|
try {
|
||||||
client.getInstanceServices().setBlockDeviceMappingForInstanceInRegion(null,
|
client.getInstanceServices().setBlockDeviceMappingForInstanceInRegion(null,
|
||||||
ebsInstance.getId(), blockDeviceMapping);
|
ebsInstance.getId(), blockDeviceMapping);
|
||||||
|
|
||||||
Map<String, RunningInstance.EbsBlockDevice> devices = client
|
Map<String, RunningInstance.EbsBlockDevice> devices = client.getInstanceServices()
|
||||||
.getInstanceServices().getBlockDeviceMappingForInstanceInRegion(null,
|
.getBlockDeviceMappingForInstanceInRegion(null, ebsInstance.getId());
|
||||||
ebsInstance.getId());
|
|
||||||
assertEquals(devices.size(), 1);
|
assertEquals(devices.size(), 1);
|
||||||
String deviceName = Iterables.getOnlyElement(devices.keySet());
|
String deviceName = Iterables.getOnlyElement(devices.keySet());
|
||||||
RunningInstance.EbsBlockDevice device = Iterables.getOnlyElement(devices.values());
|
RunningInstance.EbsBlockDevice device = Iterables.getOnlyElement(devices.values());
|
||||||
|
@ -489,14 +493,14 @@ public class EBSBootEC2ClientLiveTest {
|
||||||
private void setInstanceInitiatedShutdownBehaviorForInstanceInRegion() {
|
private void setInstanceInitiatedShutdownBehaviorForInstanceInRegion() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
||||||
null, ebsInstance.getId(), InstanceInitiatedShutdownBehavior.STOP);
|
ebsInstance.getId(), InstanceInitiatedShutdownBehavior.STOP);
|
||||||
|
|
||||||
assertEquals(InstanceInitiatedShutdownBehavior.STOP, client.getInstanceServices()
|
assertEquals(InstanceInitiatedShutdownBehavior.STOP, client.getInstanceServices()
|
||||||
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
||||||
ebsInstance.getId()));
|
ebsInstance.getId()));
|
||||||
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(
|
client.getInstanceServices().setInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
||||||
null, ebsInstance.getId(), InstanceInitiatedShutdownBehavior.TERMINATE);
|
ebsInstance.getId(), InstanceInitiatedShutdownBehavior.TERMINATE);
|
||||||
|
|
||||||
assertEquals(InstanceInitiatedShutdownBehavior.TERMINATE, client.getInstanceServices()
|
assertEquals(InstanceInitiatedShutdownBehavior.TERMINATE, client.getInstanceServices()
|
||||||
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
.getInstanceInitiatedShutdownBehaviorForInstanceInRegion(null,
|
||||||
|
@ -628,8 +632,7 @@ public class EBSBootEC2ClientLiveTest {
|
||||||
}
|
}
|
||||||
if (securityGroupName != null) {
|
if (securityGroupName != null) {
|
||||||
try {
|
try {
|
||||||
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null,
|
client.getSecurityGroupServices().deleteSecurityGroupInRegion(null, securityGroupName);
|
||||||
securityGroupName);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.io.IOException;
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.jclouds.aws.domain.Region;
|
|
||||||
import org.jclouds.aws.ec2.xml.MonitoringStateHandler;
|
import org.jclouds.aws.ec2.xml.MonitoringStateHandler;
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
|
|
|
@ -47,14 +47,14 @@ import com.google.inject.TypeLiteral;
|
||||||
public class AzureBlobContextBuilder extends
|
public class AzureBlobContextBuilder extends
|
||||||
BlobStoreContextBuilder<AzureBlobAsyncClient, AzureBlobClient> {
|
BlobStoreContextBuilder<AzureBlobAsyncClient, AzureBlobClient> {
|
||||||
|
|
||||||
public AzureBlobContextBuilder(Properties props) {
|
public AzureBlobContextBuilder(String providerName, Properties props) {
|
||||||
super(new TypeLiteral<AzureBlobAsyncClient>() {
|
super(providerName, new TypeLiteral<AzureBlobAsyncClient>() {
|
||||||
}, new TypeLiteral<AzureBlobClient>() {
|
}, new TypeLiteral<AzureBlobClient>() {
|
||||||
}, props);
|
}, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
modules.add(new AzureBlobStoreContextModule());
|
modules.add(new AzureBlobStoreContextModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,18 +41,19 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class AzureBlobContextFactory {
|
public class AzureBlobContextFactory {
|
||||||
public static BlobStoreContext createContext(Properties properties, Module... modules) {
|
public static BlobStoreContext createContext(Properties properties, Module... modules) {
|
||||||
return new AzureBlobContextBuilder(new AzureBlobPropertiesBuilder(properties).build())
|
return new AzureBlobContextBuilder("azureblob", new AzureBlobPropertiesBuilder(properties)
|
||||||
.withModules(modules).buildBlobStoreContext();
|
.build()).withModules(modules).buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlobStoreContext createContext(String user, String encodedKey, Module... modules) {
|
public static BlobStoreContext createContext(String user, String encodedKey, Module... modules) {
|
||||||
return new AzureBlobContextBuilder(new AzureBlobPropertiesBuilder(user, encodedKey)
|
return new AzureBlobContextBuilder("azureblob", new AzureBlobPropertiesBuilder(user,
|
||||||
.build()).withModules(modules).buildBlobStoreContext();
|
encodedKey).build()).withModules(modules).buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlobStoreContext createContext(URI endpoint, String user, String encodedKey,
|
public static BlobStoreContext createContext(URI endpoint, String user, String encodedKey,
|
||||||
Module... modules) {
|
Module... modules) {
|
||||||
return new AzureBlobContextBuilder(new AzureBlobPropertiesBuilder(user, encodedKey)
|
return new AzureBlobContextBuilder("azureblob", new AzureBlobPropertiesBuilder(user,
|
||||||
.withEndpoint(endpoint).build()).withModules(modules).buildBlobStoreContext();
|
encodedKey).withEndpoint(endpoint).build()).withModules(modules)
|
||||||
|
.buildBlobStoreContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class AzureBlobStoreContextModule extends AzureBlobContextModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
Location getLocation() {
|
Location getLocation() {
|
||||||
return new LocationImpl(LocationScope.ZONE, "UNKNOWN", "TODO", null);
|
return new LocationImpl(LocationScope.PROVIDER, "azureblob", "azureblob", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -47,15 +47,15 @@ import com.google.inject.TypeLiteral;
|
||||||
public class AzureQueueContextBuilder extends
|
public class AzureQueueContextBuilder extends
|
||||||
RestContextBuilder<AzureQueueAsyncClient, AzureQueueClient> {
|
RestContextBuilder<AzureQueueAsyncClient, AzureQueueClient> {
|
||||||
|
|
||||||
public AzureQueueContextBuilder(Properties properties) {
|
public AzureQueueContextBuilder(String providerName, Properties properties) {
|
||||||
super(new TypeLiteral<AzureQueueAsyncClient>() {
|
super(providerName, new TypeLiteral<AzureQueueAsyncClient>() {
|
||||||
}, new TypeLiteral<AzureQueueClient>() {
|
}, new TypeLiteral<AzureQueueClient>() {
|
||||||
}, properties);
|
}, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
modules.add(new AzureQueueContextModule());
|
modules.add(new AzureQueueContextModule(providerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -43,25 +43,25 @@ public class AzureQueueContextFactory {
|
||||||
|
|
||||||
public static RestContext<AzureQueueAsyncClient, AzureQueueClient> createContext(
|
public static RestContext<AzureQueueAsyncClient, AzureQueueClient> createContext(
|
||||||
Properties properties, Module... modules) {
|
Properties properties, Module... modules) {
|
||||||
return new AzureQueueContextBuilder(new AzureQueuePropertiesBuilder(properties).build())
|
return new AzureQueueContextBuilder("azurequeue", new AzureQueuePropertiesBuilder(properties)
|
||||||
.withModules(modules).buildContext();
|
.build()).withModules(modules).buildContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestContext<AzureQueueAsyncClient, AzureQueueClient> createContext(
|
public static RestContext<AzureQueueAsyncClient, AzureQueueClient> createContext(
|
||||||
Properties properties, String account, String encodedKey, Module... modules) {
|
Properties properties, String account, String encodedKey, Module... modules) {
|
||||||
return new AzureQueueContextBuilder(new AzureQueuePropertiesBuilder(properties)
|
return new AzureQueueContextBuilder("azurequeue", new AzureQueuePropertiesBuilder(properties)
|
||||||
.withCredentials(account, encodedKey).build()).withModules(modules).buildContext();
|
.withCredentials(account, encodedKey).build()).withModules(modules).buildContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestContext<AzureQueueAsyncClient, AzureQueueClient> createContext(String account,
|
public static RestContext<AzureQueueAsyncClient, AzureQueueClient> createContext(String account,
|
||||||
String encodedKey, Module... modules) {
|
String encodedKey, Module... modules) {
|
||||||
return new AzureQueueContextBuilder(new AzureQueuePropertiesBuilder(account, encodedKey)
|
return new AzureQueueContextBuilder("azurequeue", new AzureQueuePropertiesBuilder(account,
|
||||||
.build()).withModules(modules).buildContext();
|
encodedKey).build()).withModules(modules).buildContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestContext<AzureQueueAsyncClient, AzureQueueClient> createContext(URI endpoint,
|
public static RestContext<AzureQueueAsyncClient, AzureQueueClient> createContext(URI endpoint,
|
||||||
String account, String encodedKey, Module... modules) {
|
String account, String encodedKey, Module... modules) {
|
||||||
return new AzureQueueContextBuilder(new AzureQueuePropertiesBuilder(account, encodedKey)
|
return new AzureQueueContextBuilder("azurequeue", new AzureQueuePropertiesBuilder(account,
|
||||||
.withEndpoint(endpoint).build()).withModules(modules).buildContext();
|
encodedKey).withEndpoint(endpoint).build()).withModules(modules).buildContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,9 @@ import com.google.inject.Provides;
|
||||||
@RequiresHttp
|
@RequiresHttp
|
||||||
public class AzureQueueContextModule extends AbstractModule {
|
public class AzureQueueContextModule extends AbstractModule {
|
||||||
|
|
||||||
|
public AzureQueueContextModule(String providerName) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class AzureQueueClientLiveTest {
|
||||||
public void setupClient() {
|
public void setupClient() {
|
||||||
account = System.getProperty("jclouds.test.user");
|
account = System.getProperty("jclouds.test.user");
|
||||||
String key = System.getProperty("jclouds.test.key");
|
String key = System.getProperty("jclouds.test.key");
|
||||||
Injector injector = new AzureQueueContextBuilder(
|
Injector injector = new AzureQueueContextBuilder("azurequeue",
|
||||||
new AzureQueuePropertiesBuilder(account, key).build()).withModules(
|
new AzureQueuePropertiesBuilder(account, key).build()).withModules(
|
||||||
new Log4JLoggingModule()).buildInjector();
|
new Log4JLoggingModule()).buildInjector();
|
||||||
connection = injector.getInstance(AzureQueueClient.class);
|
connection = injector.getInstance(AzureQueueClient.class);
|
||||||
|
@ -104,13 +104,13 @@ public class AzureQueueClientLiveTest {
|
||||||
assertEquals(privateQueue, response.getPrefix());
|
assertEquals(privateQueue, response.getPrefix());
|
||||||
assertEquals(1, response.getMaxResults());
|
assertEquals(1, response.getMaxResults());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testCreateQueue" })
|
@Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testCreateQueue" })
|
||||||
public void testPutMessage() throws Exception {
|
public void testPutMessage() throws Exception {
|
||||||
connection.putMessage(privateQueue, "holycow", PutMessageOptions.Builder.withTTL(4));
|
connection.putMessage(privateQueue, "holycow", PutMessageOptions.Builder.withTTL(4));
|
||||||
// TODO loop for up to 30 seconds checking if they are really gone
|
// TODO loop for up to 30 seconds checking if they are really gone
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testPutMessage" })
|
@Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testPutMessage" })
|
||||||
public void testDeleteQueue() throws Exception {
|
public void testDeleteQueue() throws Exception {
|
||||||
connection.clearMessages(privateQueue);
|
connection.clearMessages(privateQueue);
|
||||||
|
|
|
@ -135,7 +135,7 @@ Options can also be specified for extension modules
|
||||||
"Retrieve the available container locations for the blobstore context."
|
"Retrieve the available container locations for the blobstore context."
|
||||||
([] (locations *blobstore*))
|
([] (locations *blobstore*))
|
||||||
([#^BlobStore blobstore]
|
([#^BlobStore blobstore]
|
||||||
(seq-from-immutable-set (.getLocations blobstore))))
|
(seq-from-immutable-set (.getAssignableLocations blobstore))))
|
||||||
|
|
||||||
(defn create-container
|
(defn create-container
|
||||||
"Create a container."
|
"Create a container."
|
||||||
|
|
|
@ -49,9 +49,9 @@ public interface AsyncBlobStore {
|
||||||
Blob newBlob(String name);
|
Blob newBlob(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see BlobStore#getLocations
|
* @see BlobStore#getAssignableLocations
|
||||||
*/
|
*/
|
||||||
ListenableFuture<? extends Map<String, ? extends Location>> getLocations();
|
ListenableFuture<? extends Map<String, ? extends Location>> getAssignableLocations();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see BlobStore#list
|
* @see BlobStore#list
|
||||||
|
|
|
@ -55,7 +55,7 @@ public interface BlobStore {
|
||||||
* similar to a datacenter. If a location has a parent, that implies it is within that location.
|
* similar to a datacenter. If a location has a parent, that implies it is within that location.
|
||||||
* For example a location can be a rack, whose parent is likely to be a zone.
|
* For example a location can be a rack, whose parent is likely to be a zone.
|
||||||
*/
|
*/
|
||||||
Map<String, ? extends Location> getLocations();
|
Map<String, ? extends Location> getAssignableLocations();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all root-level resources available to the account.
|
* Lists all root-level resources available to the account.
|
||||||
|
|
|
@ -35,13 +35,13 @@ public abstract class BlobStoreContextBuilder<A, S> extends RestContextBuilder<A
|
||||||
return (BlobStoreContextBuilder<A, S>) super.withModules(modules);
|
return (BlobStoreContextBuilder<A, S>) super.withModules(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlobStoreContextBuilder(TypeLiteral<A> asyncClientType, TypeLiteral<S> syncClientType) {
|
public BlobStoreContextBuilder(String providerName,TypeLiteral<A> asyncClientType, TypeLiteral<S> syncClientType) {
|
||||||
this(asyncClientType, syncClientType, new Properties());
|
this(providerName, asyncClientType, syncClientType, new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlobStoreContextBuilder(TypeLiteral<A> asyncClientType, TypeLiteral<S> syncClientType,
|
public BlobStoreContextBuilder(String providerName,TypeLiteral<A> asyncClientType, TypeLiteral<S> syncClientType,
|
||||||
Properties properties) {
|
Properties properties) {
|
||||||
super(asyncClientType, syncClientType, properties);
|
super(providerName, asyncClientType, syncClientType, properties);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,18 +37,18 @@ public class TransientBlobStoreContextBuilder extends
|
||||||
* This is only to have the same syntax.
|
* This is only to have the same syntax.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public TransientBlobStoreContextBuilder(Properties props) {
|
public TransientBlobStoreContextBuilder(String providerName, Properties props) {
|
||||||
this();
|
this();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransientBlobStoreContextBuilder() {
|
public TransientBlobStoreContextBuilder() {
|
||||||
super(new TypeLiteral<AsyncBlobStore>() {
|
super("transient", new TypeLiteral<AsyncBlobStore>() {
|
||||||
}, new TypeLiteral<BlobStore>() {
|
}, new TypeLiteral<BlobStore>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addContextModule(List<Module> modules) {
|
public void addContextModule(String providerName, List<Module> modules) {
|
||||||
modules.add(new TransientBlobStoreContextModule());
|
modules.add(new TransientBlobStoreContextModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class TransientBlobStoreContextModule extends AbstractModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
Location provideDefaultLocation() {
|
Location provideDefaultLocation() {
|
||||||
return new LocationImpl(LocationScope.ZONE, "default", "description", null);
|
return new LocationImpl(LocationScope.PROVIDER, "transient", "transient", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -271,7 +271,7 @@ public abstract class BaseAsyncBlobStore implements AsyncBlobStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<? extends Map<String, ? extends Location>> getLocations() {
|
public ListenableFuture<? extends Map<String, ? extends Location>> getAssignableLocations() {
|
||||||
return immediateFuture(locations);
|
return immediateFuture(locations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ public abstract class BaseBlobStore implements BlobStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends Location> getLocations() {
|
public Map<String, ? extends Location> getAssignableLocations() {
|
||||||
return locations;
|
return locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,16 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.blobstore.integration.internal;
|
package org.jclouds.blobstore.integration.internal;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.jclouds.blobstore.domain.PageSet;
|
import org.jclouds.blobstore.domain.PageSet;
|
||||||
import org.jclouds.blobstore.domain.StorageMetadata;
|
import org.jclouds.blobstore.domain.StorageMetadata;
|
||||||
import org.jclouds.blobstore.domain.internal.MutableStorageMetadataImpl;
|
import org.jclouds.blobstore.domain.internal.MutableStorageMetadataImpl;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -43,11 +47,13 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
|
|
||||||
@Test(groups = { "integration", "live" })
|
@Test(groups = { "integration", "live" })
|
||||||
public void testAllLocations() throws InterruptedException {
|
public void testAllLocations() throws InterruptedException {
|
||||||
for (final Location location : context.getBlobStore().getLocations().values()) {
|
for (final Location location : context.getBlobStore().getAssignableLocations().values()) {
|
||||||
final String containerName = getScratchContainerName();
|
final String containerName = getScratchContainerName();
|
||||||
try {
|
try {
|
||||||
|
System.err.printf(" >> creating container in location %s%n", location);
|
||||||
context.getBlobStore().createContainerInLocation(location, containerName);
|
context.getBlobStore().createContainerInLocation(location, containerName);
|
||||||
|
System.err.printf(" << call complete.. checking%n");
|
||||||
|
|
||||||
assertConsistencyAware(new Runnable() {
|
assertConsistencyAware(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,4 +74,44 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(groups = { "integration", "live" })
|
||||||
|
public void testGetAssignableLocations() throws Exception {
|
||||||
|
for (Entry<String, ? extends Location> location : context.getBlobStore()
|
||||||
|
.getAssignableLocations().entrySet()) {
|
||||||
|
System.err.printf("location %s%n", location.getValue());
|
||||||
|
assertEquals(location.getKey(), location.getValue().getId());
|
||||||
|
assert location.getValue().getId() != null : location;
|
||||||
|
assert location.getValue() != location.getValue().getParent() : location;
|
||||||
|
assert location.getValue().getScope() != null : location;
|
||||||
|
switch (location.getValue().getScope()) {
|
||||||
|
case PROVIDER:
|
||||||
|
assertProvider(location.getValue());
|
||||||
|
break;
|
||||||
|
case REGION:
|
||||||
|
assertProvider(location.getValue().getParent());
|
||||||
|
break;
|
||||||
|
case ZONE:
|
||||||
|
Location provider = location.getValue().getParent().getParent();
|
||||||
|
// zone can be a direct descendant of provider
|
||||||
|
if (provider == null)
|
||||||
|
provider = location.getValue().getParent();
|
||||||
|
assertProvider(provider);
|
||||||
|
break;
|
||||||
|
case HOST:
|
||||||
|
Location provider2 = location.getValue().getParent().getParent().getParent();
|
||||||
|
// zone can be a direct descendant of provider
|
||||||
|
if (provider2 == null)
|
||||||
|
provider2 = location.getValue().getParent().getParent();
|
||||||
|
assertProvider(provider2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assertProvider(Location provider) {
|
||||||
|
assertEquals(provider.getScope(), LocationScope.PROVIDER);
|
||||||
|
assertEquals(provider.getParent(), null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -117,7 +117,7 @@ See http://code.google.com/p/jclouds for details."
|
||||||
"Retrieve the available compute locations for the compute context."
|
"Retrieve the available compute locations for the compute context."
|
||||||
([] (locations *compute*))
|
([] (locations *compute*))
|
||||||
([#^ComputeService compute]
|
([#^ComputeService compute]
|
||||||
(seq-from-immutable-set (.getLocations compute))))
|
(seq-from-immutable-set (.getAssignableLocations compute))))
|
||||||
|
|
||||||
(defn nodes-with-tag
|
(defn nodes-with-tag
|
||||||
[#^String tag #^ComputeService compute]
|
[#^String tag #^ComputeService compute]
|
||||||
|
|
|
@ -90,7 +90,7 @@ public interface ComputeService {
|
||||||
* similar to a datacenter. If a location has a parent, that implies it is within that location.
|
* similar to a datacenter. If a location has a parent, that implies it is within that location.
|
||||||
* For example a location can be a rack, whose parent is likely to be a zone.
|
* For example a location can be a rack, whose parent is likely to be a zone.
|
||||||
*/
|
*/
|
||||||
Map<String, ? extends Location> getLocations();
|
Map<String, ? extends Location> getAssignableLocations();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -37,13 +37,14 @@ import com.google.inject.util.Types;
|
||||||
*/
|
*/
|
||||||
public abstract class ComputeServiceContextBuilder<A, S> extends RestContextBuilder<A, S> {
|
public abstract class ComputeServiceContextBuilder<A, S> extends RestContextBuilder<A, S> {
|
||||||
|
|
||||||
public ComputeServiceContextBuilder(TypeLiteral<A> asyncClientType, TypeLiteral<S> syncClientType) {
|
public ComputeServiceContextBuilder(String providerName, TypeLiteral<A> asyncClientType,
|
||||||
this(asyncClientType, syncClientType, new Properties());
|
TypeLiteral<S> syncClientType) {
|
||||||
|
this(providerName, asyncClientType, syncClientType, new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComputeServiceContextBuilder(TypeLiteral<A> asyncClientType,
|
public ComputeServiceContextBuilder(String providerName, TypeLiteral<A> asyncClientType,
|
||||||
TypeLiteral<S> syncClientType, Properties properties) {
|
TypeLiteral<S> syncClientType, Properties properties) {
|
||||||
super(asyncClientType, syncClientType, properties);
|
super(providerName, asyncClientType, syncClientType, properties);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,11 @@ import com.google.common.base.CaseFormat;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public enum OsFamily {
|
public enum OsFamily {
|
||||||
CENTOS, RHEL, FEDORA, DEBIAN, UBUNTU, TTYLINUX, ARCH, GENTOO, WINDOWS;
|
CENTOS,
|
||||||
|
/**
|
||||||
|
* Oracle Enterprise Linux
|
||||||
|
*/
|
||||||
|
OEL, RHEL, FEDORA, DEBIAN, UBUNTU, TTYLINUX, ARCH, GENTOO, WINDOWS;
|
||||||
public String value() {
|
public String value() {
|
||||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,7 @@ public class BaseComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends Location> getLocations() {
|
public Map<String, ? extends Location> getAssignableLocations() {
|
||||||
return locations.get();
|
return locations.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.jclouds.compute.strategy.impl;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
|
import org.jclouds.domain.Credentials;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ReturnNullCredentials implements PopulateDefaultLoginCredentialsForImageStrategy {
|
||||||
|
|
||||||
|
public static final Pattern USER_PASSWORD_PATTERN = Pattern
|
||||||
|
.compile(".*[Uu]sername: ([a-z]+) ?.*\n[Pp]assword: ([^ ]+) ?\n.*");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Credentials execute(Object resourceToAuthenticate) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -288,6 +288,15 @@ public class ComputeUtils {
|
||||||
returnVal = runScriptAsDefaultUser();
|
returnVal = runScriptAsDefaultUser();
|
||||||
runScriptNotRunning.apply(new CommandUsingClient("./" + scriptName + " status", ssh));
|
runScriptNotRunning.apply(new CommandUsingClient("./" + scriptName + " status", ssh));
|
||||||
logger.debug("<< complete(%d)", returnVal.getExitCode());
|
logger.debug("<< complete(%d)", returnVal.getExitCode());
|
||||||
|
if (logger.isDebugEnabled() || returnVal.getExitCode() != 0) {
|
||||||
|
logger.debug("<< stdout from %s as %s@%s\n%s", scriptName,
|
||||||
|
node.getCredentials().account, Iterables.get(node.getPublicAddresses(), 0)
|
||||||
|
.getHostAddress(), ssh.exec("./" + scriptName + " tail").getOutput());
|
||||||
|
logger.debug("<< stderr from %s as %s@%s\n%s", scriptName,
|
||||||
|
node.getCredentials().account, Iterables.get(node.getPublicAddresses(), 0)
|
||||||
|
.getHostAddress(), ssh.exec("./" + scriptName + " tailerr")
|
||||||
|
.getOutput());
|
||||||
|
}
|
||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ import org.jclouds.compute.options.RunScriptOptions;
|
||||||
import org.jclouds.compute.options.TemplateOptions;
|
import org.jclouds.compute.options.TemplateOptions;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
|
import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.http.HttpResponseException;
|
import org.jclouds.http.HttpResponseException;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
|
@ -200,7 +201,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
void assertLocationSameOrChild(Location test, Location expected) {
|
void assertLocationSameOrChild(Location test, Location expected) {
|
||||||
if (!test.equals(expected)) {
|
if (!test.equals(expected)) {
|
||||||
assertEquals(test.getParent(), expected.getId());
|
assertEquals(test.getParent().getId(), expected.getId());
|
||||||
} else {
|
} else {
|
||||||
assertEquals(test, expected);
|
assertEquals(test, expected);
|
||||||
}
|
}
|
||||||
|
@ -248,11 +249,19 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
private Map<String, ExecResponse> runScriptWithCreds(String tag, OsFamily osFamily,
|
private Map<String, ExecResponse> runScriptWithCreds(String tag, OsFamily osFamily,
|
||||||
Credentials creds) {
|
Credentials creds) {
|
||||||
|
try {
|
||||||
return client.runScriptOnNodesWithTag(tag, buildScript(osFamily).getBytes(),
|
return client.runScriptOnNodesWithTag(tag, buildScript(osFamily).getBytes(),
|
||||||
RunScriptOptions.Builder.overrideCredentialsWith(creds));
|
RunScriptOptions.Builder.overrideCredentialsWith(creds));
|
||||||
|
} catch (SshException e) {
|
||||||
|
if (Throwables.getRootCause(e).getMessage().contains("Auth fail")) {
|
||||||
|
System.err.printf("bad credentials: %s:%s for %s", creds.account, creds.key, client
|
||||||
|
.getNodesWithTag(tag));
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNodes(Iterable<? extends NodeMetadata> nodes, String tag) throws IOException {
|
protected void checkNodes(Iterable<? extends NodeMetadata> nodes, String tag) throws IOException {
|
||||||
for (NodeMetadata node : nodes) {
|
for (NodeMetadata node : nodes) {
|
||||||
assertNotNull(node.getId());
|
assertNotNull(node.getId());
|
||||||
assertNotNull(node.getTag());
|
assertNotNull(node.getTag());
|
||||||
|
@ -381,14 +390,43 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListLocations() throws Exception {
|
@Test(groups = { "integration", "live" })
|
||||||
for (Entry<String, ? extends Location> image : client.getLocations().entrySet()) {
|
public void testGetAssignableLocations() throws Exception {
|
||||||
assertEquals(image.getKey(), image.getValue().getId());
|
for (Entry<String, ? extends Location> location : client.getAssignableLocations().entrySet()) {
|
||||||
assert image.getValue().getId() != null : image;
|
System.err.printf("location %s%n", location.getValue());
|
||||||
assert image.getValue().getId() != image.getValue().getParent() : image;
|
assertEquals(location.getKey(), location.getValue().getId());
|
||||||
assert image.getValue().getScope() != null : image;
|
assert location.getValue().getId() != null : location;
|
||||||
|
assert location.getValue() != location.getValue().getParent() : location;
|
||||||
|
assert location.getValue().getScope() != null : location;
|
||||||
|
switch (location.getValue().getScope()) {
|
||||||
|
case PROVIDER:
|
||||||
|
assertProvider(location.getValue());
|
||||||
|
break;
|
||||||
|
case REGION:
|
||||||
|
assertProvider(location.getValue().getParent());
|
||||||
|
break;
|
||||||
|
case ZONE:
|
||||||
|
Location provider = location.getValue().getParent().getParent();
|
||||||
|
// zone can be a direct descendant of provider
|
||||||
|
if (provider == null)
|
||||||
|
provider = location.getValue().getParent();
|
||||||
|
assertProvider(provider);
|
||||||
|
break;
|
||||||
|
case HOST:
|
||||||
|
Location provider2 = location.getValue().getParent().getParent().getParent();
|
||||||
|
// zone can be a direct descendant of provider
|
||||||
|
if (provider2 == null)
|
||||||
|
provider2 = location.getValue().getParent().getParent();
|
||||||
|
assertProvider(provider2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertProvider(Location provider) {
|
||||||
|
assertEquals(provider.getScope(), LocationScope.PROVIDER);
|
||||||
|
assertEquals(provider.getParent(), null);
|
||||||
|
}
|
||||||
|
|
||||||
public void testListSizes() throws Exception {
|
public void testListSizes() throws Exception {
|
||||||
for (Entry<String, ? extends Size> size : client.getSizes().entrySet()) {
|
for (Entry<String, ? extends Size> size : client.getSizes().entrySet()) {
|
||||||
|
|
|
@ -48,8 +48,8 @@ public interface Location {
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Id of the parent, or null, if top-level
|
* The parent, or null, if top-level
|
||||||
*/
|
*/
|
||||||
String getParent();
|
Location getParent();
|
||||||
|
|
||||||
}
|
}
|
|
@ -25,6 +25,6 @@ package org.jclouds.domain;
|
||||||
*/
|
*/
|
||||||
public enum LocationScope {
|
public enum LocationScope {
|
||||||
|
|
||||||
REGION, ZONE, RACK, HOST;
|
PROVIDER, REGION, ZONE, RACK, HOST;
|
||||||
|
|
||||||
}
|
}
|
|
@ -40,9 +40,9 @@ public class LocationImpl implements Location, Serializable {
|
||||||
private final LocationScope scope;
|
private final LocationScope scope;
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String description;
|
private final String description;
|
||||||
private final String parent;
|
private final Location parent;
|
||||||
|
|
||||||
public LocationImpl(LocationScope scope, String id, String description, @Nullable String parent) {
|
public LocationImpl(LocationScope scope, String id, String description, @Nullable Location parent) {
|
||||||
this.scope = checkNotNull(scope, "scope");
|
this.scope = checkNotNull(scope, "scope");
|
||||||
this.id = checkNotNull(id, "id");
|
this.id = checkNotNull(id, "id");
|
||||||
this.description = checkNotNull(description, "description");
|
this.description = checkNotNull(description, "description");
|
||||||
|
@ -61,7 +61,7 @@ public class LocationImpl implements Location, Serializable {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParent() {
|
public Location getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public class LocationImpl implements Location, Serializable {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[id=" + id + ", scope=" + scope + ", description=" + description + ", parent="
|
return "[id=" + id + ", scope=" + scope + ", description=" + description + ", parent="
|
||||||
+ parent + "]";
|
+ ((parent == null) ? null : parent.getId()) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -64,13 +64,15 @@ import com.google.inject.util.Types;
|
||||||
*/
|
*/
|
||||||
public abstract class RestContextBuilder<A, S> {
|
public abstract class RestContextBuilder<A, S> {
|
||||||
|
|
||||||
|
protected final String providerName;
|
||||||
protected final Properties properties;
|
protected final Properties properties;
|
||||||
protected final List<Module> modules = new ArrayList<Module>(3);
|
protected final List<Module> modules = new ArrayList<Module>(3);
|
||||||
protected final TypeLiteral<A> asyncClientType;
|
protected final TypeLiteral<A> asyncClientType;
|
||||||
protected final TypeLiteral<S> syncClientType;
|
protected final TypeLiteral<S> syncClientType;
|
||||||
|
|
||||||
protected RestContextBuilder(TypeLiteral<A> asyncClientType, TypeLiteral<S> syncClientType,
|
protected RestContextBuilder(String providerName, TypeLiteral<A> asyncClientType,
|
||||||
Properties properties) {
|
TypeLiteral<S> syncClientType, Properties properties) {
|
||||||
|
this.providerName = providerName;
|
||||||
this.asyncClientType = asyncClientType;
|
this.asyncClientType = asyncClientType;
|
||||||
this.syncClientType = syncClientType;
|
this.syncClientType = syncClientType;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
|
@ -83,7 +85,7 @@ public abstract class RestContextBuilder<A, S> {
|
||||||
|
|
||||||
public Injector buildInjector() {
|
public Injector buildInjector() {
|
||||||
|
|
||||||
addContextModule(modules);
|
addContextModule(providerName, modules);
|
||||||
addClientModuleIfNotPresent(modules);
|
addClientModuleIfNotPresent(modules);
|
||||||
addLoggingModuleIfNotPresent(modules);
|
addLoggingModuleIfNotPresent(modules);
|
||||||
addHttpModuleIfNeededAndNotPresent(modules);
|
addHttpModuleIfNeededAndNotPresent(modules);
|
||||||
|
@ -124,7 +126,7 @@ public abstract class RestContextBuilder<A, S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected abstract void addContextModule(List<Module> modules);
|
protected abstract void addContextModule(String providerName, List<Module> modules);
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected void ifHttpConfigureRestOtherwiseGuiceClientFactory(final List<Module> modules) {
|
protected void ifHttpConfigureRestOtherwiseGuiceClientFactory(final List<Module> modules) {
|
||||||
|
|
|
@ -98,46 +98,46 @@ public abstract class RestContextFactory<T, B extends RestContextBuilder<?, ?>>
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T createContext(URI blobStore, Iterable<? extends Module> modules, Properties overrides) {
|
public T createContext(URI contextUri, Iterable<? extends Module> modules, Properties overrides) {
|
||||||
return createContext(blobStore, Credentials.parse(blobStore), modules, overrides);
|
return createContext(contextUri, Credentials.parse(contextUri), modules, overrides);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T createContext(URI blobStore) {
|
public T createContext(URI contextUri) {
|
||||||
return createContext(blobStore, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
return createContext(contextUri, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T createContext(URI blobStore, Credentials creds, Iterable<? extends Module> modules,
|
public T createContext(URI contextUri, Credentials creds, Iterable<? extends Module> modules,
|
||||||
Properties overrides) {
|
Properties overrides) {
|
||||||
return createContext(checkNotNull(blobStore.getHost(), "host"), checkNotNull(creds.account,
|
return createContext(checkNotNull(contextUri.getHost(), "host"), checkNotNull(creds.account,
|
||||||
"account"), checkNotNull(creds.key, "key"), checkNotNull(modules, "modules"),
|
"account"), checkNotNull(creds.key, "key"), checkNotNull(modules, "modules"),
|
||||||
checkNotNull(overrides, "overrides"));
|
checkNotNull(overrides, "overrides"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public T createContext(URI blobStore, Credentials creds) {
|
public T createContext(URI contextUri, Credentials creds) {
|
||||||
return createContext(blobStore, creds, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
return createContext(contextUri, creds, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T createContext(String hint, String account, String key) {
|
public T createContext(String provider, String account, String key) {
|
||||||
return createContext(hint, account, key, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
return createContext(provider, account, key, ImmutableSet.<Module> of(), NO_PROPERTIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T createContext(String hint, Properties overrides) {
|
public T createContext(String provider, Properties overrides) {
|
||||||
return createContext(hint, null, null, ImmutableSet.<Module> of(), overrides);
|
return createContext(provider, null, null, ImmutableSet.<Module> of(), overrides);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T createContext(String hint, Iterable<? extends Module> modules, Properties overrides) {
|
public T createContext(String provider, Iterable<? extends Module> modules, Properties overrides) {
|
||||||
return createContext(hint, null, null, modules, overrides);
|
return createContext(provider, null, null, modules, overrides);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T createContext(String hint, @Nullable String account, @Nullable String key,
|
public T createContext(String provider, @Nullable String account, @Nullable String key,
|
||||||
Iterable<? extends Module> modules) {
|
Iterable<? extends Module> modules) {
|
||||||
return createContext(hint, account, key, modules, new Properties());
|
return createContext(provider, account, key, modules, new Properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new remote context.
|
* Creates a new remote context.
|
||||||
*
|
*
|
||||||
* @param hint
|
* @param provider
|
||||||
* @param account
|
* @param account
|
||||||
* nullable, if credentials are present in the overrides
|
* nullable, if credentials are present in the overrides
|
||||||
* @param key
|
* @param key
|
||||||
|
@ -150,20 +150,20 @@ public abstract class RestContextFactory<T, B extends RestContextBuilder<?, ?>>
|
||||||
* @return initialized context ready for use
|
* @return initialized context ready for use
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public T createContext(String hint, @Nullable String account, @Nullable String key,
|
public T createContext(String provider, @Nullable String account, @Nullable String key,
|
||||||
Iterable<? extends Module> modules, Properties overrides) {
|
Iterable<? extends Module> modules, Properties overrides) {
|
||||||
checkNotNull(hint, "hint");
|
checkNotNull(provider, "provider");
|
||||||
checkNotNull(modules, "modules");
|
checkNotNull(modules, "modules");
|
||||||
checkNotNull(overrides, "overrides");
|
checkNotNull(overrides, "overrides");
|
||||||
String propertiesBuilderKey = String.format("%s.propertiesbuilder", hint);
|
String propertiesBuilderKey = String.format("%s.propertiesbuilder", provider);
|
||||||
String propertiesBuilderClassName = checkNotNull(
|
String propertiesBuilderClassName = checkNotNull(
|
||||||
properties.getProperty(propertiesBuilderKey), hint + " service not supported");
|
properties.getProperty(propertiesBuilderKey), provider + " service not supported");
|
||||||
|
|
||||||
String contextBuilderKey = String.format("%s.contextbuilder", hint);
|
String contextBuilderKey = String.format("%s.contextbuilder", provider);
|
||||||
String contextBuilderClassName = checkNotNull(properties.getProperty(contextBuilderKey),
|
String contextBuilderClassName = checkNotNull(properties.getProperty(contextBuilderKey),
|
||||||
contextBuilderKey);
|
contextBuilderKey);
|
||||||
|
|
||||||
String endpointKey = String.format("%s.endpoint", hint);
|
String endpointKey = String.format("%s.endpoint", provider);
|
||||||
String endpoint = properties.getProperty(endpointKey);
|
String endpoint = properties.getProperty(endpointKey);
|
||||||
try {
|
try {
|
||||||
Class<PropertiesBuilder> propertiesBuilderClass = (Class<PropertiesBuilder>) Class
|
Class<PropertiesBuilder> propertiesBuilderClass = (Class<PropertiesBuilder>) Class
|
||||||
|
@ -175,8 +175,9 @@ public abstract class RestContextFactory<T, B extends RestContextBuilder<?, ?>>
|
||||||
builder.withCredentials(account, key);
|
builder.withCredentials(account, key);
|
||||||
if (endpoint != null)
|
if (endpoint != null)
|
||||||
builder.withEndpoint(URI.create(endpoint));
|
builder.withEndpoint(URI.create(endpoint));
|
||||||
B contextBuilder = (B) contextBuilderClass.getConstructor(Properties.class).newInstance(
|
B contextBuilder = (B) contextBuilderClass.getConstructor(String.class, Properties.class)
|
||||||
builder.build()).withModules(Iterables.toArray(modules, Module.class));
|
.newInstance(provider, builder.build()).withModules(
|
||||||
|
Iterables.toArray(modules, Module.class));
|
||||||
return build(contextBuilder);
|
return build(contextBuilder);
|
||||||
} catch (ProvisionException e) {
|
} catch (ProvisionException e) {
|
||||||
Throwable throwable = Utils.firstRootCauseOrOriginalException(e);
|
Throwable throwable = Utils.firstRootCauseOrOriginalException(e);
|
||||||
|
|
|
@ -74,15 +74,15 @@ public abstract class BaseJettyTest {
|
||||||
RestContextBuilder<IntegrationTestAsyncClient, IntegrationTestClient> {
|
RestContextBuilder<IntegrationTestAsyncClient, IntegrationTestClient> {
|
||||||
private final int testPort;
|
private final int testPort;
|
||||||
|
|
||||||
public IntegrationContextBuilder(Properties properties, int testPort) {
|
public IntegrationContextBuilder(String providerName, Properties properties, int testPort) {
|
||||||
super(new TypeLiteral<IntegrationTestAsyncClient>() {
|
super(providerName, new TypeLiteral<IntegrationTestAsyncClient>() {
|
||||||
}, new TypeLiteral<IntegrationTestClient>() {
|
}, new TypeLiteral<IntegrationTestClient>() {
|
||||||
}, properties);
|
}, properties);
|
||||||
this.testPort = testPort;
|
this.testPort = testPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
modules.add(new JettyContextModule(testPort));
|
modules.add(new JettyContextModule(testPort));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,8 @@ public abstract class BaseJettyTest {
|
||||||
if (request.getContentLength() > 0) {
|
if (request.getContentLength() > 0) {
|
||||||
if (request.getHeader("Content-MD5") != null) {
|
if (request.getHeader("Content-MD5") != null) {
|
||||||
String expectedMd5 = request.getHeader("Content-MD5");
|
String expectedMd5 = request.getHeader("Content-MD5");
|
||||||
String realMd5FromRequest = Base64.encodeBytes(new JCEEncryptionService().md5(request.getInputStream()));
|
String realMd5FromRequest = Base64.encodeBytes(new JCEEncryptionService()
|
||||||
|
.md5(request.getInputStream()));
|
||||||
boolean matched = expectedMd5.equals(realMd5FromRequest);
|
boolean matched = expectedMd5.equals(realMd5FromRequest);
|
||||||
if (matched) {
|
if (matched) {
|
||||||
response.setContentType("text/xml");
|
response.setContentType("text/xml");
|
||||||
|
@ -214,8 +215,9 @@ public abstract class BaseJettyTest {
|
||||||
response.setStatus(HttpServletResponse.SC_OK);
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
response.getWriter().println("test");
|
response.getWriter().println("test");
|
||||||
} else if (request.getMethod().equals("HEAD")) {
|
} else if (request.getMethod().equals("HEAD")) {
|
||||||
/* NOTE: by HTML specification, HEAD response MUST NOT
|
/*
|
||||||
include a body */
|
* NOTE: by HTML specification, HEAD response MUST NOT include a body
|
||||||
|
*/
|
||||||
response.setContentType("text/xml");
|
response.setContentType("text/xml");
|
||||||
response.setStatus(HttpServletResponse.SC_OK);
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
} else {
|
} else {
|
||||||
|
@ -247,7 +249,8 @@ public abstract class BaseJettyTest {
|
||||||
if (request.getContentLength() > 0) {
|
if (request.getContentLength() > 0) {
|
||||||
if (request.getHeader("Content-MD5") != null) {
|
if (request.getHeader("Content-MD5") != null) {
|
||||||
String expectedMd5 = request.getHeader("Content-MD5");
|
String expectedMd5 = request.getHeader("Content-MD5");
|
||||||
String realMd5FromRequest = Base64.encodeBytes(new JCEEncryptionService().md5(request.getInputStream()));
|
String realMd5FromRequest = Base64.encodeBytes(new JCEEncryptionService()
|
||||||
|
.md5(request.getInputStream()));
|
||||||
boolean matched = expectedMd5.equals(realMd5FromRequest);
|
boolean matched = expectedMd5.equals(realMd5FromRequest);
|
||||||
if (matched) {
|
if (matched) {
|
||||||
response.setContentType("text/xml");
|
response.setContentType("text/xml");
|
||||||
|
@ -263,8 +266,9 @@ public abstract class BaseJettyTest {
|
||||||
handleAction(request, response);
|
handleAction(request, response);
|
||||||
}
|
}
|
||||||
} else if (request.getMethod().equals("HEAD")) {
|
} else if (request.getMethod().equals("HEAD")) {
|
||||||
/* NOTE: by HTML specification, HEAD response MUST NOT
|
/*
|
||||||
include a body */
|
* NOTE: by HTML specification, HEAD response MUST NOT include a body
|
||||||
|
*/
|
||||||
response.setContentType("text/xml");
|
response.setContentType("text/xml");
|
||||||
response.setStatus(HttpServletResponse.SC_OK);
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
} else {
|
} else {
|
||||||
|
@ -318,7 +322,8 @@ public abstract class BaseJettyTest {
|
||||||
|
|
||||||
public static RestContextBuilder<IntegrationTestAsyncClient, IntegrationTestClient> newBuilder(
|
public static RestContextBuilder<IntegrationTestAsyncClient, IntegrationTestClient> newBuilder(
|
||||||
final int testPort, final Properties properties, Module connectionModule) {
|
final int testPort, final Properties properties, Module connectionModule) {
|
||||||
return new IntegrationContextBuilder(properties, testPort).withModules(connectionModule);
|
return new IntegrationContextBuilder("integration-test", properties, testPort)
|
||||||
|
.withModules(connectionModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTest
|
@AfterTest
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class RestContextBuilderTest {
|
||||||
class TestRestContextBuilder extends RestContextBuilder<String, String> {
|
class TestRestContextBuilder extends RestContextBuilder<String, String> {
|
||||||
|
|
||||||
protected TestRestContextBuilder(Properties properties) {
|
protected TestRestContextBuilder(Properties properties) {
|
||||||
super(new TypeLiteral<String>() {
|
super("test", new TypeLiteral<String>() {
|
||||||
}, new TypeLiteral<String>() {
|
}, new TypeLiteral<String>() {
|
||||||
}, properties);
|
}, properties);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class RestContextBuilderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
// ignored as we add it directly above without use of injection
|
// ignored as we add it directly above without use of injection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,8 @@ import com.google.inject.TypeLiteral;
|
||||||
public class GoGridContextBuilder extends
|
public class GoGridContextBuilder extends
|
||||||
ComputeServiceContextBuilder<GoGridAsyncClient, GoGridClient> {
|
ComputeServiceContextBuilder<GoGridAsyncClient, GoGridClient> {
|
||||||
|
|
||||||
public GoGridContextBuilder(Properties props) {
|
public GoGridContextBuilder(String providerName, Properties props) {
|
||||||
super(new TypeLiteral<GoGridAsyncClient>() {
|
super(providerName, new TypeLiteral<GoGridAsyncClient>() {
|
||||||
}, new TypeLiteral<GoGridClient>() {
|
}, new TypeLiteral<GoGridClient>() {
|
||||||
}, props);
|
}, props);
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ public class GoGridContextBuilder extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addContextModule(List<Module> modules) {
|
protected void addContextModule(String providerName, List<Module> modules) {
|
||||||
modules.add(new GoGridComputeServiceContextModule());
|
modules.add(new GoGridComputeServiceContextModule(providerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,14 +52,15 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class GoGridContextFactory {
|
public class GoGridContextFactory {
|
||||||
|
|
||||||
public static RestContext<GoGridAsyncClient, GoGridClient> createContext(String user, String password,
|
public static RestContext<GoGridAsyncClient, GoGridClient> createContext(String user,
|
||||||
|
String password, Module... modules) {
|
||||||
|
return new GoGridContextBuilder("gogrid", new GoGridPropertiesBuilder(user, password).build())
|
||||||
|
.withModules(modules).buildContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RestContext<GoGridAsyncClient, GoGridClient> createContext(Properties properties,
|
||||||
Module... modules) {
|
Module... modules) {
|
||||||
return new GoGridContextBuilder(new GoGridPropertiesBuilder(user, password).build())
|
return new GoGridContextBuilder("gogrid", new GoGridPropertiesBuilder(properties).build())
|
||||||
.withModules(modules).buildContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static RestContext<GoGridAsyncClient, GoGridClient> createContext(Properties properties, Module... modules) {
|
|
||||||
return new GoGridContextBuilder(new GoGridPropertiesBuilder(properties).build())
|
|
||||||
.withModules(modules).buildContext();
|
.withModules(modules).buildContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,11 @@ import com.google.inject.TypeLiteral;
|
||||||
* @author Oleksiy Yarmula
|
* @author Oleksiy Yarmula
|
||||||
*/
|
*/
|
||||||
public class GoGridComputeServiceContextModule extends GoGridContextModule {
|
public class GoGridComputeServiceContextModule extends GoGridContextModule {
|
||||||
|
private final String providerName;
|
||||||
|
|
||||||
|
public GoGridComputeServiceContextModule(String providerName) {
|
||||||
|
this.providerName = providerName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
|
@ -284,8 +289,9 @@ public class GoGridComputeServiceContextModule extends GoGridContextModule {
|
||||||
Function<ComputeMetadata, String> indexer) {
|
Function<ComputeMetadata, String> indexer) {
|
||||||
final Set<Location> locations = Sets.newHashSet();
|
final Set<Location> locations = Sets.newHashSet();
|
||||||
holder.logger.debug(">> providing locations");
|
holder.logger.debug(">> providing locations");
|
||||||
locations
|
Location parent = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
|
||||||
.add(new LocationImpl(LocationScope.ZONE, "SANFRANCISCO", "San Francisco, CA", null));
|
locations.add(new LocationImpl(LocationScope.ZONE, "SANFRANCISCO", "San Francisco, CA",
|
||||||
|
parent));
|
||||||
holder.logger.debug("<< locations(%d)", locations.size());
|
holder.logger.debug("<< locations(%d)", locations.size());
|
||||||
return Maps.uniqueIndex(locations, new Function<Location, String>() {
|
return Maps.uniqueIndex(locations, new Function<Location, String>() {
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue