diff --git a/.gitignore b/.gitignore
index e1c23c8b9a..1ce93e0405 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,4 @@ bin/
*.iws
*.DS_STORE
TAGS
+.metadata/
diff --git a/allloadbalancer/pom.xml b/allloadbalancer/pom.xml
index cf757385d0..8d1e2faef5 100644
--- a/allloadbalancer/pom.xml
+++ b/allloadbalancer/pom.xml
@@ -30,6 +30,11 @@
jclouds-allloadbalancer
allloadbalancer
+
+ org.jclouds.provider
+ cloudloadbalancers-uk
+ ${project.version}
+
org.jclouds.provider
cloudloadbalancers-us
diff --git a/apis/byon/pom.xml b/apis/byon/pom.xml
index 345daf1b40..44d0fc548f 100644
--- a/apis/byon/pom.xml
+++ b/apis/byon/pom.xml
@@ -72,7 +72,7 @@
org.yaml
snakeyaml
- 1.8
+ 1.10
diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadata.java b/apis/ec2/src/main/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadata.java
index 69876dc4b1..877ed21638 100644
--- a/apis/ec2/src/main/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadata.java
+++ b/apis/ec2/src/main/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadata.java
@@ -62,6 +62,7 @@ import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.util.concurrent.UncheckedExecutionException;
@@ -186,21 +187,28 @@ public class RunningInstanceToNodeMetadata implements Function data) {
String group = null;
try {
- group = Iterables.getOnlyElement(Iterables.filter(instance.getGroupIds(), new Predicate() {
+ group = Iterables.getOnlyElement(Iterables.filter(data, new Predicate() {
@Override
public boolean apply(String input) {
- return input.startsWith("jclouds#") && input.endsWith("#" + instance.getRegion());
+ return input.startsWith("jclouds#") && input.contains("#" + instance.getRegion());
}
-
- })).substring(8).replaceAll("#" + instance.getRegion() + "$", "");
+ })).split("#")[1];
} catch (NoSuchElementException e) {
- logger.debug("no group parsed from %s's security groups: %s", instance.getId(), instance.getGroupIds());
+ logger.debug("no group parsed from %s's data: %s", instance.getId(), data);
} catch (IllegalArgumentException e) {
- logger.debug("too many groups match %s; %s's security groups: %s", "jclouds#", instance.getId(), instance
- .getGroupIds());
+ logger.debug("too many groups match %s; %s's data: %s", "jclouds#", instance.getId(), data);
}
return group;
}
diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java
index 03987761c4..455bd8a60b 100644
--- a/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java
+++ b/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java
@@ -217,6 +217,20 @@ public class RunningInstanceToNodeMetadataTest {
.hardware(m1_small32().build()).location(provider).build());
}
+ @Test
+ public void testGroupNameIsSetWhenCustomKeyNameIsSetAndSecurityGroupIsGenerated() {
+ checkGroupName(RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small")
+ .instanceState(InstanceState.RUNNING).region("us-east-1").keyName("custom-key")
+ .groupId("jclouds#groupname#us-east-1").build());
+ }
+
+ @Test
+ public void testGroupNameIsSetWhenCustomSecurityGroupIsSetAndKeyNameIsGenerated() {
+ checkGroupName(RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small")
+ .instanceState(InstanceState.RUNNING).region("us-east-1").groupId("custom-sec")
+ .keyName("jclouds#groupname#us-east-1#23").build());
+ }
+
protected RunningInstance firstInstanceFromResource(String resource) {
RunningInstance server = Iterables.get(Iterables.get(DescribeInstancesResponseHandlerTest
.parseRunningInstances(resource), 0), 0);
@@ -239,6 +253,12 @@ public class RunningInstanceToNodeMetadataTest {
return createNodeParser(hardware, locations, credentialStore, instanceToNodeState, instanceToImage);
}
+ private void checkGroupName(RunningInstance instance) {
+ assertEquals("groupname", createNodeParser(ImmutableSet. of(), ImmutableSet
+ . of(), ImmutableSet. of(), ImmutableMap. of())
+ .apply(instance).getGroup());
+ }
+
private RunningInstanceToNodeMetadata createNodeParser(final ImmutableSet hardware,
final ImmutableSet locations, Map credentialStore,
Map instanceToNodeState, LoadingCache instanceToImage) {
diff --git a/apis/s3/pom.xml b/apis/s3/pom.xml
index 470ba6ccbf..4a29312792 100644
--- a/apis/s3/pom.xml
+++ b/apis/s3/pom.xml
@@ -46,7 +46,7 @@
com.jamesmurty.utils
java-xmlbuilder
- 0.3
+ 0.4
org.jclouds.common
diff --git a/apis/vcloud/pom.xml b/apis/vcloud/pom.xml
index 91e9385e4e..1c8c524ab2 100644
--- a/apis/vcloud/pom.xml
+++ b/apis/vcloud/pom.xml
@@ -48,7 +48,7 @@
com.jamesmurty.utils
java-xmlbuilder
- 0.3
+ 0.4
org.jclouds
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
index a6aebc28e7..5dc5f7e607 100644
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
+++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
@@ -52,6 +52,7 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
+import com.google.common.base.Supplier;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableSet;
import com.jamesmurty.utils.XMLBuilder;
@@ -67,7 +68,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
protected final String ns;
protected final String schema;
protected final BindToStringPayload stringBinder;
- protected final ReferenceType defaultNetwork;
+ protected final Supplier defaultNetwork;
protected final FenceMode defaultFenceMode;
protected final LoadingCache templateCache;
protected final Function defaultNetworkNameInTemplate;
@@ -76,7 +77,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
public BindInstantiateVAppTemplateParamsToXmlPayload(LoadingCache templateCache,
@Network Function defaultNetworkNameInTemplate, BindToStringPayload stringBinder,
@Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema,
- @Network ReferenceType network, FenceMode fenceMode) {
+ @Network Supplier network, FenceMode fenceMode) {
this.templateCache = templateCache;
this.defaultNetworkNameInTemplate = defaultNetworkNameInTemplate;
this.ns = ns;
@@ -98,7 +99,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
Set networkConfig = null;
NetworkConfigDecorator networkConfigDecorator = new NetworkConfigDecorator(templateCache.getUnchecked(template),
- defaultNetwork.getHref(), defaultFenceMode, defaultNetworkNameInTemplate);
+ defaultNetwork.get().getHref(), defaultFenceMode, defaultNetworkNameInTemplate);
InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
index 19499dd7c5..1e30db8269 100644
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
+++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
@@ -51,6 +51,8 @@ import org.jclouds.vcloud.functions.VAppTemplatesInOrg;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableMap;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
@@ -108,8 +110,16 @@ public class VCloudComputeServiceDependenciesModule extends AbstractModule {
@Provides
@Singleton
- public NetworkConfig networkConfig(@Network ReferenceType network, FenceMode defaultFenceMode) {
- return new NetworkConfig(network.getName(), network.getHref(), defaultFenceMode);
+ public Supplier networkConfig(@Network Supplier network,
+ final FenceMode defaultFenceMode) {
+ return Suppliers.compose(new Function() {
+
+ @Override
+ public NetworkConfig apply(ReferenceType input) {
+ return new NetworkConfig(input.getName(), input.getHref(), defaultFenceMode);
+ }
+
+ }, network);
}
}
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
index 823bd76aed..d40f391d31 100644
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
+++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
@@ -57,6 +57,7 @@ import org.jclouds.vcloud.domain.network.NetworkConfig;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableSet;
@@ -72,13 +73,13 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
protected final VCloudClient client;
protected final Predicate successTester;
protected final LoadingCache vAppTemplates;
- protected final NetworkConfig defaultNetworkConfig;
+ protected final Supplier defaultNetworkConfig;
protected final String buildVersion;
@Inject
protected InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn(VCloudClient client,
Predicate successTester, LoadingCache vAppTemplates,
- NetworkConfig defaultNetworkConfig, @Named(PROPERTY_BUILD_VERSION) String buildVersion) {
+ Supplier defaultNetworkConfig, @Named(PROPERTY_BUILD_VERSION) String buildVersion) {
this.client = client;
this.successTester = successTester;
this.vAppTemplates = vAppTemplates;
@@ -142,9 +143,9 @@ public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployA
// if we only have a disconnected network, let's add a new section for the upstream
// TODO: remove the disconnected entry
if (networkWithNoIpAllocation.apply(networkToConnect))
- config = defaultNetworkConfig;
+ config = defaultNetworkConfig.get();
else
- config = defaultNetworkConfig.toBuilder().networkName(networkToConnect.getName()).build();
+ config = defaultNetworkConfig.get().toBuilder().networkName(networkToConnect.getName()).build();
// note that in VCD 1.5, the network name after instantiation will be the same as the parent
InstantiateVAppTemplateOptions options = addNetworkConfig(config);
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
index f328a9545e..143e9d601d 100644
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
+++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
@@ -34,13 +34,14 @@ import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfig
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
/**
*
* @author Adrian Cole
*/
@Singleton
-public class DefaultOrgForUser implements Function {
+public class DefaultOrgForUser implements Function> {
private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
private final Supplier sessionSupplier;
@@ -55,10 +56,16 @@ public class DefaultOrgForUser implements Function {
}
@Override
- public ReferenceType apply(String user) {
- VCloudSession session = sessionSupplier.get();
- checkState(session != null, "could not retrieve Session at %s", user);
- return selector.apply(session.getOrgs().values());
+ public Supplier apply(final String user) {
+ return Suppliers.compose(new Function() {
+
+ @Override
+ public ReferenceType apply(VCloudSession session) {
+ checkState(session != null, "could not retrieve Session at %s", user);
+ return selector.apply(session.getOrgs().values());
+ }
+
+ }, sessionSupplier);
}
}
\ No newline at end of file
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
index 78f4f65074..708f119007 100644
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
+++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
@@ -57,7 +57,7 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
@Provides
@org.jclouds.vcloud.endpoints.Org
@Singleton
- protected ReferenceType provideDefaultOrg(DefaultOrgForUser defaultOrgURIForUser,
+ protected Supplier provideDefaultOrg(DefaultOrgForUser defaultOrgURIForUser,
@Named(PROPERTY_IDENTITY) String user) {
return defaultOrgURIForUser.apply(user);
}
@@ -72,17 +72,17 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
@Provides
@org.jclouds.vcloud.endpoints.TasksList
@Singleton
- protected ReferenceType provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
- @org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
- return defaultTasksListURIForOrg.apply(defaultOrg);
+ protected Supplier provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier defaultOrg) {
+ return Suppliers.compose(defaultTasksListURIForOrg, defaultOrg);
}
@Provides
@org.jclouds.vcloud.endpoints.Catalog
@Singleton
- protected ReferenceType provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
- @org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
- return defaultCatalogURIForOrg.apply(defaultOrg);
+ protected Supplier provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier defaultOrg) {
+ return Suppliers.compose(defaultCatalogURIForOrg, defaultOrg);
}
@Provides
@@ -146,9 +146,9 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
@Provides
@org.jclouds.vcloud.endpoints.VDC
@Singleton
- protected ReferenceType provideDefaultVDC(DefaultVDCForOrg defaultVDCURIForOrg,
- @org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
- return defaultVDCURIForOrg.apply(defaultOrg);
+ protected Supplier provideDefaultVDC(DefaultVDCForOrg defaultVDCURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier defaultOrg) {
+ return Suppliers.compose(defaultVDCURIForOrg, defaultOrg);
}
@Provides
@@ -161,9 +161,9 @@ public class DefaultVCloudReferencesModule extends AbstractModule {
@Provides
@org.jclouds.vcloud.endpoints.Network
@Singleton
- protected ReferenceType provideDefaultNetwork(DefaultNetworkForVDC defaultNetworkURIForVDC,
- @org.jclouds.vcloud.endpoints.VDC ReferenceType defaultVDC) {
- return defaultNetworkURIForVDC.apply(defaultVDC);
+ protected Supplier provideDefaultNetwork(DefaultNetworkForVDC defaultNetworkURIForVDC,
+ @org.jclouds.vcloud.endpoints.VDC Supplier defaultVDC) {
+ return Suppliers.compose(defaultNetworkURIForVDC, defaultVDC);
}
@Provides
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java
index 270546727f..ddc950c37d 100644
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java
+++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java
@@ -316,8 +316,15 @@ public class VCloudRestClientModule extends RestClientModule cache) {
- return checkNotNull(cache.get().getVCloudToken(), "No token present in session");
+ @Singleton
+ Supplier provideVCloudToken(Supplier cache) {
+ return Suppliers.compose(new Function() {
+
+ @Override
+ public String apply(VCloudSession input) {
+ return checkNotNull(input.getVCloudToken(), "No token present in session");
+ }
+ }, cache);
}
@Provides
@@ -419,9 +426,16 @@ public class VCloudRestClientModule extends RestClientModule> orgSupplier,
- @org.jclouds.vcloud.endpoints.Org ReferenceType defaultOrg) {
- return orgSupplier.get().get(defaultOrg.getName());
+ protected Supplier provideOrg(final Supplier