JCLOUDS-40 Replaced incorrect use of @ConfiguresRestClient and deleted old rest client modules.

This commit is contained in:
Adrian Cole 2014-10-05 14:47:33 -07:00
parent ddb7b46475
commit 4b427e503a
9 changed files with 12 additions and 215 deletions

View File

@ -40,7 +40,7 @@ import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError; import org.jclouds.http.annotation.ServerError;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule; import org.jclouds.rest.config.HttpApiModule;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -49,7 +49,7 @@ import com.google.inject.TypeLiteral;
/** /**
* Configures the elasticstack connection. * Configures the elasticstack connection.
*/ */
@ConfiguresRestClient @ConfiguresHttpApi
public class ElasticStackHttpApiModule extends HttpApiModule<ElasticStackApi> { public class ElasticStackHttpApiModule extends HttpApiModule<ElasticStackApi> {
@Override @Override

View File

@ -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.nova.v2_0.handlers.NovaErrorHandler;
import org.jclouds.openstack.v2_0.domain.Extension; import org.jclouds.openstack.v2_0.domain.Extension;
import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet; 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.config.HttpApiModule;
import org.jclouds.rest.functions.ImplicitOptionalConverter; import org.jclouds.rest.functions.ImplicitOptionalConverter;
@ -47,8 +47,7 @@ import com.google.inject.Provides;
* Configures the Nova connection. * Configures the Nova connection.
* *
*/ */
@ConfiguresRestClient @ConfiguresHttpApi
public class NovaHttpApiModule extends HttpApiModule<NovaApi> { public class NovaHttpApiModule extends HttpApiModule<NovaApi> {
public NovaHttpApiModule() { public NovaHttpApiModule() {

View File

@ -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<S, A> extends RestClientModule<S, A> {
protected AWSRestClientModule(Map<Class<?>, Class<?>> delegates) {
super(delegates);
}
protected AWSRestClientModule() {
}
protected AWSRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
super(syncClientType, asyncClientType);
}
protected AWSRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
Map<Class<?>, Class<?>> sync2Async) {
super(syncClientType, asyncClientType, sync2Async);
}
@Provides
@ClientError
@Singleton
protected Set<String> provideRetryableCodes() {
return ImmutableSet.of("RequestTimeout", "OperationAborted", "SignatureDoesNotMatch");
}
@Provides
@ServerError
@Singleton
protected Set<String> 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);
}
}

View File

@ -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<S, A> extends AWSRestClientModule<S, A> {
protected FormSigningRestClientModule(Map<Class<?>, Class<?>> delegates) {
super(delegates);
}
protected FormSigningRestClientModule() {
}
protected FormSigningRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
super(syncClientType, asyncClientType);
}
protected FormSigningRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
Map<Class<?>, 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;
}
}

View File

@ -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<S, A> extends FormSigningRestClientModule<S, A> {
protected WithZonesFormSigningRestClientModule(Map<Class<?>, Class<?>> delegates) {
super(delegates);
}
protected WithZonesFormSigningRestClientModule() {
}
protected WithZonesFormSigningRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
super(syncClientType, asyncClientType);
}
protected WithZonesFormSigningRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
Map<Class<?>, Class<?>> sync2Async) {
super(syncClientType, asyncClientType, sync2Async);
}
}

View File

@ -26,7 +26,7 @@ import org.jclouds.http.annotation.ServerError;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler; import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.jclouds.location.suppliers.ImplicitLocationSupplier; import org.jclouds.location.suppliers.ImplicitLocationSupplier;
import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone; import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule; import org.jclouds.rest.config.HttpApiModule;
import com.google.inject.Scopes; import com.google.inject.Scopes;
@ -34,7 +34,7 @@ import com.google.inject.Scopes;
/** /**
* Configures the GleSYS connection. * Configures the GleSYS connection.
*/ */
@ConfiguresRestClient @ConfiguresHttpApi
public class GleSYSHttpApiModule extends HttpApiModule<GleSYSApi> { public class GleSYSHttpApiModule extends HttpApiModule<GleSYSApi> {
@Override @Override

View File

@ -31,7 +31,7 @@ import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError; import org.jclouds.http.annotation.ServerError;
import org.jclouds.location.suppliers.ImplicitLocationSupplier; import org.jclouds.location.suppliers.ImplicitLocationSupplier;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule; import org.jclouds.rest.config.HttpApiModule;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
@ -42,7 +42,7 @@ import com.google.inject.Scopes;
/** /**
* Configures the GoGrid connection. * Configures the GoGrid connection.
*/ */
@ConfiguresRestClient @ConfiguresHttpApi
public class GoGridHttpApiModule extends HttpApiModule<GoGridApi> { public class GoGridHttpApiModule extends HttpApiModule<GoGridApi> {
@Provides @Provides

View File

@ -24,7 +24,7 @@ import org.jclouds.gogrid.config.GoGridHttpApiModule;
import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication; import org.jclouds.gogrid.filters.SharedKeyLiteAuthentication;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.providers.ProviderMetadata; import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseAsyncClientTest; import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -39,7 +39,7 @@ public abstract class BaseGoGridApiTest<T> extends BaseAsyncClientTest<T> {
assertEquals(request.getFilters().get(0).getClass(), SharedKeyLiteAuthentication.class); assertEquals(request.getFilters().get(0).getClass(), SharedKeyLiteAuthentication.class);
} }
@ConfiguresRestClient @ConfiguresHttpApi
protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule { protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -19,7 +19,7 @@ package org.jclouds.gogrid.features;
import org.jclouds.date.TimeStamp; import org.jclouds.date.TimeStamp;
import org.jclouds.gogrid.GoGridApi; import org.jclouds.gogrid.GoGridApi;
import org.jclouds.gogrid.config.GoGridHttpApiModule; import org.jclouds.gogrid.config.GoGridHttpApiModule;
import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.internal.BaseRestClientExpectTest; import org.jclouds.rest.internal.BaseRestClientExpectTest;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
@ -31,7 +31,7 @@ public class BaseGoGridHttpApiExpectTest extends BaseRestClientExpectTest<GoGrid
provider = "gogrid"; provider = "gogrid";
} }
@ConfiguresRestClient @ConfiguresHttpApi
protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule { protected static final class TestGoGridHttpApiModule extends GoGridHttpApiModule {
@Override @Override