Further OpenStack extensibility changes. Fixing constructors in RestContext classes

This commit is contained in:
Andrew Donald Kennedy 2012-08-13 16:18:43 +01:00
parent 758e01a4d2
commit f9a550529d
3 changed files with 30 additions and 15 deletions

View File

@ -26,15 +26,16 @@ import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.json.config.GsonModule.DateAdapter;
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
import org.jclouds.openstack.glance.v1_0.GlanceAsyncApi;
import org.jclouds.openstack.glance.v1_0.GlanceApi;
import org.jclouds.openstack.glance.v1_0.features.ImageAsyncApi;
import org.jclouds.openstack.glance.v1_0.GlanceAsyncApi;
import org.jclouds.openstack.glance.v1_0.features.ImageApi;
import org.jclouds.openstack.glance.v1_0.features.ImageAsyncApi;
import org.jclouds.openstack.glance.v1_0.handlers.GlanceErrorHandler;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule;
import com.google.common.collect.ImmutableMap;
import com.google.common.reflect.TypeToken;
/**
* Configures the Glance connection.
@ -42,14 +43,18 @@ import com.google.common.collect.ImmutableMap;
* @author Adrian Cole
*/
@ConfiguresRestClient
public class GlanceRestClientModule extends RestClientModule<GlanceApi, GlanceAsyncApi> {
public class GlanceRestClientModule<S extends GlanceApi, A extends GlanceAsyncApi> extends RestClientModule<S, A> {
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
.put(ImageApi.class, ImageAsyncApi.class)
.build();
public GlanceRestClientModule() {
super(DELEGATE_MAP);
super(TypeToken.class.cast(TypeToken.of(GlanceApi.class)), TypeToken.class.cast(TypeToken.of(GlanceAsyncApi.class)), DELEGATE_MAP);
}
protected GlanceRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType, Map<Class<?>, Class<?>> sync2Async) {
super(syncClientType, asyncClientType, sync2Async);
}
@Override

View File

@ -26,17 +26,18 @@ import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.json.config.GsonModule.DateAdapter;
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
import org.jclouds.openstack.quantum.v1_0.QuantumAsyncApi;
import org.jclouds.openstack.quantum.v1_0.QuantumApi;
import org.jclouds.openstack.quantum.v1_0.features.NetworkAsyncApi;
import org.jclouds.openstack.quantum.v1_0.QuantumAsyncApi;
import org.jclouds.openstack.quantum.v1_0.features.NetworkApi;
import org.jclouds.openstack.quantum.v1_0.features.PortAsyncApi;
import org.jclouds.openstack.quantum.v1_0.features.NetworkAsyncApi;
import org.jclouds.openstack.quantum.v1_0.features.PortApi;
import org.jclouds.openstack.quantum.v1_0.features.PortAsyncApi;
import org.jclouds.openstack.quantum.v1_0.handlers.QuantumErrorHandler;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule;
import com.google.common.collect.ImmutableMap;
import com.google.common.reflect.TypeToken;
/**
* Configures the Quantum connection.
@ -44,7 +45,7 @@ import com.google.common.collect.ImmutableMap;
* @author Adam Lowe
*/
@ConfiguresRestClient
public class QuantumRestClientModule extends RestClientModule<QuantumApi, QuantumAsyncApi> {
public class QuantumRestClientModule<S extends QuantumApi, A extends QuantumAsyncApi> extends RestClientModule<S, A> {
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
.put(NetworkApi.class, NetworkAsyncApi.class)
@ -52,7 +53,11 @@ public class QuantumRestClientModule extends RestClientModule<QuantumApi, Quantu
.build();
public QuantumRestClientModule() {
super(DELEGATE_MAP);
super(TypeToken.class.cast(TypeToken.of(QuantumApi.class)), TypeToken.class.cast(TypeToken.of(QuantumAsyncApi.class)), DELEGATE_MAP);
}
protected QuantumRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType, Map<Class<?>, Class<?>> sync2Async) {
super(syncClientType, asyncClientType, sync2Async);
}
@Override

View File

@ -26,19 +26,20 @@ import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.json.config.GsonModule.DateAdapter;
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
import org.jclouds.openstack.swift.v1.SwiftAsyncApi;
import org.jclouds.openstack.swift.v1.SwiftApi;
import org.jclouds.openstack.swift.v1.features.AccountAsyncApi;
import org.jclouds.openstack.swift.v1.SwiftAsyncApi;
import org.jclouds.openstack.swift.v1.features.AccountApi;
import org.jclouds.openstack.swift.v1.features.ContainerAsyncApi;
import org.jclouds.openstack.swift.v1.features.AccountAsyncApi;
import org.jclouds.openstack.swift.v1.features.ContainerApi;
import org.jclouds.openstack.swift.v1.features.ObjectAsyncApi;
import org.jclouds.openstack.swift.v1.features.ContainerAsyncApi;
import org.jclouds.openstack.swift.v1.features.ObjectApi;
import org.jclouds.openstack.swift.v1.features.ObjectAsyncApi;
import org.jclouds.openstack.swift.v1.handlers.SwiftErrorHandler;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule;
import com.google.common.collect.ImmutableMap;
import com.google.common.reflect.TypeToken;
/**
* Configures the Swift connection.
@ -46,7 +47,7 @@ import com.google.common.collect.ImmutableMap;
* @author Adrian Cole
*/
@ConfiguresRestClient
public class SwiftRestClientModule extends RestClientModule<SwiftApi, SwiftAsyncApi> {
public class SwiftRestClientModule<S extends SwiftApi, A extends SwiftAsyncApi> extends RestClientModule<S, A> {
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
.put(AccountApi.class, AccountAsyncApi.class)
@ -55,7 +56,11 @@ public class SwiftRestClientModule extends RestClientModule<SwiftApi, SwiftAsync
.build();
public SwiftRestClientModule() {
super(DELEGATE_MAP);
super(TypeToken.class.cast(TypeToken.of(SwiftApi.class)), TypeToken.class.cast(TypeToken.of(SwiftAsyncApi.class)), DELEGATE_MAP);
}
protected SwiftRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType, Map<Class<?>, Class<?>> sync2Async) {
super(syncClientType, asyncClientType, sync2Async);
}
@Override