From 2debb53e83be36dea1dd2121fe43df8509ca321f Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Tue, 14 Aug 2012 03:16:36 +0100 Subject: [PATCH] Merge Keystone optional admin API provider with optional extension provider --- .../v2_0/config/KeystoneRestClientModule.java | 2 - ...tWhenAdminURLExistsForIdentityService.java | 46 ------------------- ...paceEqualsAnyNamespaceInExtensionsSet.java | 10 ++-- 3 files changed, 6 insertions(+), 52 deletions(-) delete mode 100644 apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/PresentWhenAdminURLExistsForIdentityService.java diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java index 6d265cacbf..f473be2466 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java @@ -43,7 +43,6 @@ import org.jclouds.openstack.keystone.v2_0.features.TokenApi; import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncApi; import org.jclouds.openstack.keystone.v2_0.features.UserApi; import org.jclouds.openstack.keystone.v2_0.features.UserAsyncApi; -import org.jclouds.openstack.keystone.v2_0.functions.PresentWhenAdminURLExistsForIdentityService; import org.jclouds.openstack.keystone.v2_0.handlers.KeystoneErrorHandler; import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURIFromAccessForTypeAndVersion; import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier; @@ -101,7 +100,6 @@ public class KeystoneRestClientModule apply(ClassMethodArgsAndReturnVal input) { - //TODO: log and return absent when the admin url for identity service isn't available - return Optional.of(input.getReturnVal()); - } - - public String toString() { - return "presentWhenAdminURLExistsForIdentityService()"; - } - -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/functions/PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/functions/PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java index 7c06f17a43..6681f71b15 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/functions/PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/v2_0/functions/PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java @@ -19,7 +19,6 @@ package org.jclouds.openstack.v2_0.functions; import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; import java.net.URI; import java.util.Set; @@ -71,11 +70,14 @@ public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensio if (Iterables.any(extensions.getUnchecked(checkNotNull(input.getArgs()[0], "arg[0] in %s", input).toString()), ExtensionPredicates.namespaceOrAliasEquals(namespace, aliases.get(namespace)))) return Optional.of(input.getReturnVal()); + } else { + throw new RuntimeException(String.format("expecting zero or one args %s", input)); + } + return Optional.absent(); } else { - throw new RuntimeException(String.format("expecting zero or one args %s", input)); + // No extension annotation, should check whether to return absent + return Optional.of(input.getReturnVal()); } - } - return Optional.absent(); } @Override