From 9f14503cf6bd70209829cffc087df196967da2d2 Mon Sep 17 00:00:00 2001 From: Andrei Savu Date: Sun, 12 Feb 2012 09:18:08 +0200 Subject: [PATCH] Use the regular API endpoint for registerUserKeys --- .../CloudStackPropertiesBuilder.java | 1 - .../cloudstack/collections/Integration.java | 38 ------------ .../config/CloudStackRestClientModule.java | 60 ++++++------------- .../features/GlobalUserAsyncClient.java | 3 - 4 files changed, 17 insertions(+), 85 deletions(-) delete mode 100644 apis/cloudstack/src/main/java/org/jclouds/cloudstack/collections/Integration.java diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackPropertiesBuilder.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackPropertiesBuilder.java index 61dafad385..26113807e0 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackPropertiesBuilder.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackPropertiesBuilder.java @@ -38,7 +38,6 @@ public class CloudStackPropertiesBuilder extends PropertiesBuilder { properties.setProperty(PROPERTY_API_VERSION, "2.2"); properties.setProperty("jclouds.ssh.max-retries", "7"); properties.setProperty("jclouds.ssh.retry-auth", "true"); - properties.setProperty("jclouds.cloudstack.integration-api-port", "8096"); return properties; } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/collections/Integration.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/collections/Integration.java deleted file mode 100644 index 1e6551fe26..0000000000 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/collections/Integration.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.cloudstack.collections; - -import javax.inject.Qualifier; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Change the endpoint as needed for the integration API - * - * @author Andrei Savu - * - */ -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Qualifier -public @interface Integration { - -} \ No newline at end of file diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java index 2374cf0293..6cbdbbe730 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java @@ -18,16 +18,17 @@ */ package org.jclouds.cloudstack.config; -import static com.google.common.base.Throwables.propagate; -import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient; - -import java.net.URI; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.UriBuilder; - +import com.google.common.base.Function; +import com.google.common.base.Supplier; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.ImmutableMap; +import com.google.inject.Inject; +import com.google.inject.Provides; +import com.google.inject.Singleton; +import com.google.inject.TypeLiteral; +import com.google.inject.name.Named; import org.jclouds.Constants; import org.jclouds.cloudstack.CloudStackAsyncClient; import org.jclouds.cloudstack.CloudStackClient; @@ -35,7 +36,6 @@ import org.jclouds.cloudstack.CloudStackDomainAsyncClient; import org.jclouds.cloudstack.CloudStackDomainClient; import org.jclouds.cloudstack.CloudStackGlobalAsyncClient; import org.jclouds.cloudstack.CloudStackGlobalClient; -import org.jclouds.cloudstack.collections.Integration; import org.jclouds.cloudstack.domain.LoginResponse; import org.jclouds.cloudstack.features.AccountAsyncClient; import org.jclouds.cloudstack.features.AccountClient; @@ -139,18 +139,12 @@ import org.jclouds.rest.config.BinderUtils; import org.jclouds.rest.config.RestClientModule; import org.jclouds.rest.internal.RestContextImpl; -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import com.google.inject.Provides; -import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; -import com.google.inject.name.Named; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient; /** * Configures the cloudstack connection. @@ -254,26 +248,6 @@ public class CloudStackRestClientModule extends RestClientModule providesIntegrationEndpoint(@Provider final Supplier provider, - @Named("jclouds.cloudstack.integration-api-port") final int port, - final com.google.inject.Provider uriBuilder) { - return Suppliers.compose(new Function() { - - @Override - public URI apply(URI input) { - URI normal = provider.get(); - return uriBuilder.get().scheme(normal.getScheme()).host(normal.getHost()).path("/").port(port).build(); - } - - public String toString(){ - return "getIntegrationEndpoint()"; - } - }, provider); - } - @Singleton static class CredentialTypeFromPropertyOrDefault implements javax.inject.Provider { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUserAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUserAsyncClient.java index 980c8bbe32..cb0d234d85 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUserAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUserAsyncClient.java @@ -19,13 +19,11 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; -import org.jclouds.cloudstack.collections.Integration; import org.jclouds.cloudstack.domain.ApiKeyPair; import org.jclouds.cloudstack.domain.User; import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateUserOptions; import org.jclouds.cloudstack.options.UpdateUserOptions; -import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.RequestFilters; @@ -68,7 +66,6 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient { @GET @QueryParams(keys = "command", values = "registerUserKeys") @SelectJson("userkeys") - @Endpoint(Integration.class) @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) ListenableFuture registerUserKeys(@QueryParam("id") long userId);