From 4b427e503a1a017067a94a125d5cd9e8504e3ec7 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sun, 5 Oct 2014 14:47:33 -0700 Subject: [PATCH] JCLOUDS-40 Replaced incorrect use of @ConfiguresRestClient and deleted old rest client modules. --- .../config/ElasticStackHttpApiModule.java | 4 +- .../nova/v2_0/config/NovaHttpApiModule.java | 5 +- .../aws/config/AWSRestClientModule.java | 93 ------------------- .../config/FormSigningRestClientModule.java | 64 ------------- .../WithZonesFormSigningRestClientModule.java | 45 --------- .../glesys/config/GleSYSHttpApiModule.java | 4 +- .../gogrid/config/GoGridHttpApiModule.java | 4 +- .../gogrid/features/BaseGoGridApiTest.java | 4 +- .../features/BaseGoGridHttpApiExpectTest.java | 4 +- 9 files changed, 12 insertions(+), 215 deletions(-) delete mode 100644 apis/sts/src/main/java/org/jclouds/aws/config/AWSRestClientModule.java delete mode 100644 apis/sts/src/main/java/org/jclouds/aws/config/FormSigningRestClientModule.java delete mode 100644 apis/sts/src/main/java/org/jclouds/aws/config/WithZonesFormSigningRestClientModule.java diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java index 71e68a6472..86395cb0c4 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/config/ElasticStackHttpApiModule.java @@ -40,7 +40,7 @@ import org.jclouds.http.HttpErrorHandler; import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.ServerError; -import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.config.HttpApiModule; import com.google.common.base.Function; @@ -49,7 +49,7 @@ import com.google.inject.TypeLiteral; /** * Configures the elasticstack connection. */ -@ConfiguresRestClient +@ConfiguresHttpApi public class ElasticStackHttpApiModule extends HttpApiModule { @Override diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java index d763406bdc..946b149b7c 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaHttpApiModule.java @@ -32,7 +32,7 @@ import org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces; import org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler; import org.jclouds.openstack.v2_0.domain.Extension; import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet; -import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.config.HttpApiModule; import org.jclouds.rest.functions.ImplicitOptionalConverter; @@ -47,8 +47,7 @@ import com.google.inject.Provides; * Configures the Nova connection. * */ -@ConfiguresRestClient - +@ConfiguresHttpApi public class NovaHttpApiModule extends HttpApiModule { public NovaHttpApiModule() { diff --git a/apis/sts/src/main/java/org/jclouds/aws/config/AWSRestClientModule.java b/apis/sts/src/main/java/org/jclouds/aws/config/AWSRestClientModule.java deleted file mode 100644 index 0ef34bbce2..0000000000 --- a/apis/sts/src/main/java/org/jclouds/aws/config/AWSRestClientModule.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.aws.config; - - -import java.util.Map; -import java.util.Set; - -import javax.inject.Singleton; - -import org.jclouds.aws.handlers.AWSClientErrorRetryHandler; -import org.jclouds.aws.handlers.AWSServerErrorRetryHandler; -import org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpRetryHandler; -import org.jclouds.http.annotation.ClientError; -import org.jclouds.http.annotation.Redirection; -import org.jclouds.http.annotation.ServerError; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.RestClientModule; - -import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; -import com.google.inject.Provides; - - -/** - * - * - * @deprecated will be removed in jclouds 1.7; use {@link AWSHttpApiModule} - */ -@Deprecated -@ConfiguresRestClient -public abstract class AWSRestClientModule extends RestClientModule { - - protected AWSRestClientModule(Map, Class> delegates) { - super(delegates); - } - - protected AWSRestClientModule() { - } - - protected AWSRestClientModule(TypeToken syncClientType, TypeToken asyncClientType) { - super(syncClientType, asyncClientType); - } - - protected AWSRestClientModule(TypeToken syncClientType, TypeToken asyncClientType, - Map, Class> sync2Async) { - super(syncClientType, asyncClientType, sync2Async); - } - - @Provides - @ClientError - @Singleton - protected Set provideRetryableCodes() { - return ImmutableSet.of("RequestTimeout", "OperationAborted", "SignatureDoesNotMatch"); - } - - @Provides - @ServerError - @Singleton - protected Set provideRetryableServerCodes() { - return ImmutableSet.of("RequestLimitExceeded"); - } - - @Override - protected void bindErrorHandlers() { - bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseAWSErrorFromXmlContent.class); - bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseAWSErrorFromXmlContent.class); - bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseAWSErrorFromXmlContent.class); - } - - @Override - protected void bindRetryHandlers() { - bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(AWSClientErrorRetryHandler.class); - bind(HttpRetryHandler.class).annotatedWith(ServerError.class).to(AWSServerErrorRetryHandler.class); - } - -} diff --git a/apis/sts/src/main/java/org/jclouds/aws/config/FormSigningRestClientModule.java b/apis/sts/src/main/java/org/jclouds/aws/config/FormSigningRestClientModule.java deleted file mode 100644 index 6c18d52da5..0000000000 --- a/apis/sts/src/main/java/org/jclouds/aws/config/FormSigningRestClientModule.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.aws.config; - -import java.util.Date; -import java.util.Map; - -import javax.inject.Singleton; - -import org.jclouds.aws.filters.FormSigner; -import org.jclouds.date.DateService; -import org.jclouds.date.TimeStamp; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.RequestSigner; - -import com.google.common.reflect.TypeToken; -import com.google.inject.Provides; - -@ConfiguresRestClient -public abstract class FormSigningRestClientModule extends AWSRestClientModule { - - protected FormSigningRestClientModule(Map, Class> delegates) { - super(delegates); - } - - protected FormSigningRestClientModule() { - } - - protected FormSigningRestClientModule(TypeToken syncClientType, TypeToken asyncClientType) { - super(syncClientType, asyncClientType); - } - - protected FormSigningRestClientModule(TypeToken syncClientType, TypeToken asyncClientType, - Map, Class> sync2Async) { - super(syncClientType, asyncClientType, sync2Async); - } - - @Provides - @TimeStamp - protected String provideTimeStamp(DateService dateService) { - return dateService.iso8601DateFormat(new Date(System.currentTimeMillis())); - } - - @Provides - @Singleton - RequestSigner provideRequestSigner(FormSigner in) { - return in; - } - -} diff --git a/apis/sts/src/main/java/org/jclouds/aws/config/WithZonesFormSigningRestClientModule.java b/apis/sts/src/main/java/org/jclouds/aws/config/WithZonesFormSigningRestClientModule.java deleted file mode 100644 index 5306d58a53..0000000000 --- a/apis/sts/src/main/java/org/jclouds/aws/config/WithZonesFormSigningRestClientModule.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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.aws.config; - - -import java.util.Map; - -import org.jclouds.rest.ConfiguresRestClient; - -import com.google.common.reflect.TypeToken; - - -@ConfiguresRestClient -public abstract class WithZonesFormSigningRestClientModule extends FormSigningRestClientModule { - protected WithZonesFormSigningRestClientModule(Map, Class> delegates) { - super(delegates); - } - - protected WithZonesFormSigningRestClientModule() { - } - - protected WithZonesFormSigningRestClientModule(TypeToken syncClientType, TypeToken asyncClientType) { - super(syncClientType, asyncClientType); - } - - protected WithZonesFormSigningRestClientModule(TypeToken syncClientType, TypeToken asyncClientType, - Map, Class> sync2Async) { - super(syncClientType, asyncClientType, sync2Async); - } - -} diff --git a/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java b/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java index d8d730229c..b1ac5be462 100644 --- a/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java +++ b/providers/glesys/src/main/java/org/jclouds/glesys/config/GleSYSHttpApiModule.java @@ -26,7 +26,7 @@ import org.jclouds.http.annotation.ServerError; import org.jclouds.http.handlers.BackoffLimitedRetryHandler; import org.jclouds.location.suppliers.ImplicitLocationSupplier; import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone; -import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.config.HttpApiModule; import com.google.inject.Scopes; @@ -34,7 +34,7 @@ import com.google.inject.Scopes; /** * Configures the GleSYS connection. */ -@ConfiguresRestClient +@ConfiguresHttpApi public class GleSYSHttpApiModule extends HttpApiModule { @Override diff --git a/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java b/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java index a41de28edc..3a691b491a 100644 --- a/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java +++ b/providers/gogrid/src/main/java/org/jclouds/gogrid/config/GoGridHttpApiModule.java @@ -31,7 +31,7 @@ import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.ServerError; import org.jclouds.location.suppliers.ImplicitLocationSupplier; -import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.config.HttpApiModule; import com.google.common.base.Supplier; @@ -42,7 +42,7 @@ import com.google.inject.Scopes; /** * Configures the GoGrid connection. */ -@ConfiguresRestClient +@ConfiguresHttpApi public class GoGridHttpApiModule extends HttpApiModule { @Provides diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java index b65ae53328..4a90875189 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridApiTest.java @@ -24,7 +24,7 @@ import org.jclouds.gogrid.config.GoGridHttpApiModule; import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication; import org.jclouds.http.HttpRequest; import org.jclouds.providers.ProviderMetadata; -import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.internal.BaseAsyncClientTest; import org.testng.annotations.Test; @@ -39,7 +39,7 @@ public abstract class BaseGoGridApiTest extends BaseAsyncClientTest { assertEquals(request.getFilters().get(0).getClass(), SharedKeyLiteAuthentication.class); } - @ConfiguresRestClient + @ConfiguresHttpApi protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule { @Override protected void configure() { diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java index e4a0cb12d8..4b6fd2dd58 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/features/BaseGoGridHttpApiExpectTest.java @@ -19,7 +19,7 @@ package org.jclouds.gogrid.features; import org.jclouds.date.TimeStamp; import org.jclouds.gogrid.GoGridApi; import org.jclouds.gogrid.config.GoGridHttpApiModule; -import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.ConfiguresHttpApi; import org.jclouds.rest.internal.BaseRestClientExpectTest; import com.google.common.base.Supplier; @@ -31,7 +31,7 @@ public class BaseGoGridHttpApiExpectTest extends BaseRestClientExpectTest