From 7d70b5ddc3c4eeed964b47dacecebe5d8f94d5e5 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Thu, 23 Aug 2012 07:29:40 +0300 Subject: [PATCH] Updated NovaComputeService and FloatingIp cache to deal with extensibility --- .../openstack/nova/v2_0/compute/NovaComputeService.java | 2 +- .../compute/config/NovaComputeServiceContextModule.java | 6 +++--- .../compute/functions/AllocateAndAddFloatingIpToNode.java | 4 ++-- .../functions/RemoveFloatingIpFromNodeAndDeallocate.java | 4 ++-- .../v2_0/compute/loaders/LoadFloatingIpsForInstance.java | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java index f62ef07ca2..211404391e 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java @@ -155,7 +155,7 @@ public class NovaComputeService extends BaseComputeService { Optional keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId); if (keyPairApi.isPresent()) { for (String group : groups) { - for (Map view : keyPairApi.get().listKeyPairs()) { + for (Map view : keyPairApi.get().listKeyPairs()) { for (KeyPair pair : Iterables.filter(view.values(), KeyPairPredicates.nameMatches(namingConvention.create().containsGroup(group)))) { ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName()); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java index 8bee10ab79..9b401d105b 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java @@ -129,7 +129,7 @@ public class NovaComputeServiceContextModule extends bind(TemplateOptions.class).to(NovaTemplateOptions.class); - bind(new TypeLiteral>>() { + bind(new TypeLiteral>>() { }).annotatedWith(Names.named("FLOATINGIP")).to(LoadFloatingIpsForInstance.class); bind(new TypeLiteral>() { @@ -163,8 +163,8 @@ public class NovaComputeServiceContextModule extends @Provides @Singleton @Named("FLOATINGIP") - protected LoadingCache> instanceToFloatingIps( - @Named("FLOATINGIP") CacheLoader> in) { + protected LoadingCache> instanceToFloatingIps( + @Named("FLOATINGIP") CacheLoader> in) { return CacheBuilder.newBuilder().build(in); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java index 6e2a59a2ba..0e1193d05b 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java @@ -61,11 +61,11 @@ public class AllocateAndAddFloatingIpToNode implements private final Predicate> nodeRunning; private final NovaApi novaApi; - private final LoadingCache> floatingIpCache; + private final LoadingCache> floatingIpCache; @Inject public AllocateAndAddFloatingIpToNode(@Named(TIMEOUT_NODE_RUNNING) Predicate> nodeRunning, - NovaApi novaApi, @Named("FLOATINGIP") LoadingCache> floatingIpCache) { + NovaApi novaApi, @Named("FLOATINGIP") LoadingCache> floatingIpCache) { this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning"); this.novaApi = checkNotNull(novaApi, "novaApi"); this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java index df73e69c68..00f93cbc25 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java @@ -47,11 +47,11 @@ public class RemoveFloatingIpFromNodeAndDeallocate implements Function> floatingIpCache; + private final LoadingCache> floatingIpCache; @Inject public RemoveFloatingIpFromNodeAndDeallocate(NovaApi novaApi, - @Named("FLOATINGIP") LoadingCache> floatingIpCache) { + @Named("FLOATINGIP") LoadingCache> floatingIpCache) { this.novaApi = checkNotNull(novaApi, "novaApi"); this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache"); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java index 578d0b1927..d773bd5b11 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java @@ -40,7 +40,7 @@ import com.google.common.collect.Iterables; * @author Adam Lowe */ @Singleton -public class LoadFloatingIpsForInstance extends CacheLoader> { +public class LoadFloatingIpsForInstance extends CacheLoader> { private final NovaApi api; @Inject @@ -49,7 +49,7 @@ public class LoadFloatingIpsForInstance extends CacheLoader load(final ZoneAndId key) throws Exception { + public Iterable load(final ZoneAndId key) throws Exception { String zone = key.getZone(); Optional ipApiOptional = api.getFloatingIPExtensionForZone(zone); if (ipApiOptional.isPresent()) {