mirror of https://github.com/apache/jclouds.git
openstack-nova extensibility
This commit is contained in:
parent
6c9524dabc
commit
9acfa880d4
|
@ -129,12 +129,12 @@ public class NovaRestClientModule<S extends NovaApi, A extends NovaAsyncApi> ext
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
public LoadingCache<String, Set<Extension>> provideExtensionsByZone(final Provider<NovaApi> novaApi) {
|
||||
public LoadingCache<String, Set<? extends Extension>> provideExtensionsByZone(final Provider<NovaApi> novaApi) {
|
||||
return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS)
|
||||
.build(new CacheLoader<String, Set<Extension>>() {
|
||||
.build(new CacheLoader<String, Set<? extends Extension>>() {
|
||||
|
||||
@Override
|
||||
public Set<Extension> load(String key) throws Exception {
|
||||
public Set<? extends Extension> load(String key) throws Exception {
|
||||
return novaApi.get().getExtensionApiForZone(key).listExtensions();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public interface ExtensionApi {
|
|||
*
|
||||
* @return all extensions
|
||||
*/
|
||||
Set<Extension> listExtensions();
|
||||
Set<? extends Extension> listExtensions();
|
||||
|
||||
/**
|
||||
* Extensions may also be queried individually by their unique alias.
|
||||
|
|
|
@ -59,7 +59,7 @@ public interface ExtensionAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/extensions")
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<Extension>> listExtensions();
|
||||
ListenableFuture<? extends Set<? extends Extension>> listExtensions();
|
||||
|
||||
/**
|
||||
* @see ExtensionApi#getExtensionByAlias
|
||||
|
@ -69,6 +69,6 @@ public interface ExtensionAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/extensions/{alias}")
|
||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||
ListenableFuture<Extension> getExtensionByAlias(@PathParam("alias") String id);
|
||||
ListenableFuture<? extends Extension> getExtensionByAlias(@PathParam("alias") String id);
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public interface FlavorApi {
|
|||
*
|
||||
* @return all flavors (IDs, names, links)
|
||||
*/
|
||||
Set<Resource> listFlavors();
|
||||
Set<? extends Resource> listFlavors();
|
||||
|
||||
/**
|
||||
* List all flavors (all details)
|
||||
|
|
|
@ -61,7 +61,7 @@ public interface FlavorAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/flavors")
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<Resource>> listFlavors();
|
||||
ListenableFuture<? extends Set<? extends Resource>> listFlavors();
|
||||
|
||||
/**
|
||||
* @see FlavorApi#listFlavorsInDetail
|
||||
|
|
|
@ -43,7 +43,7 @@ public interface ImageApi {
|
|||
*
|
||||
* @return all images (IDs, names, links)
|
||||
*/
|
||||
Set<Resource> listImages();
|
||||
Set<? extends Resource> listImages();
|
||||
|
||||
/**
|
||||
* List all images (all details)
|
||||
|
|
|
@ -59,7 +59,7 @@ public interface ImageAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/images")
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<Resource>> listImages();
|
||||
ListenableFuture<? extends Set<? extends Resource>> listImages();
|
||||
|
||||
/**
|
||||
* @see ImageApi#listImagesInDetail
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface ServerApi {
|
|||
*
|
||||
* @return all servers (IDs, names, links)
|
||||
*/
|
||||
Set<Resource> listServers();
|
||||
Set<? extends Resource> listServers();
|
||||
|
||||
/**
|
||||
* List all servers (all details)
|
||||
|
|
|
@ -76,7 +76,7 @@ public interface ServerAsyncApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/servers")
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<Resource>> listServers();
|
||||
ListenableFuture<? extends Set<? extends Resource>> listServers();
|
||||
|
||||
/**
|
||||
* @see ServerApi#listServersInDetail
|
||||
|
|
|
@ -51,7 +51,7 @@ import com.google.common.collect.Multimap;
|
|||
@Singleton
|
||||
public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet implements
|
||||
ImplicitOptionalConverter {
|
||||
private final LoadingCache<String, Set<Extension>> extensions;
|
||||
private final LoadingCache<String, Set<? extends Extension>> extensions;
|
||||
|
||||
@com.google.inject.Inject(optional=true)
|
||||
@Named("openstack.nova.extensions")
|
||||
|
@ -88,7 +88,7 @@ public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensio
|
|||
|
||||
@Inject
|
||||
public PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet(
|
||||
LoadingCache<String, Set<Extension>> extensions) {
|
||||
LoadingCache<String, Set<? extends Extension>> extensions) {
|
||||
this.extensions = checkNotNull(extensions, "extensions");
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest {
|
|||
public void testListExtensions() throws Exception {
|
||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
||||
ExtensionApi api = novaContext.getApi().getExtensionApiForZone(zoneId);
|
||||
Set<Extension> response = api.listExtensions();
|
||||
Set<? extends Extension> response = api.listExtensions();
|
||||
assert null != response;
|
||||
assertTrue(response.size() >= 0);
|
||||
for (Extension extension : response) {
|
||||
|
|
|
@ -45,7 +45,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
|
|||
public void testListFlavors() throws Exception {
|
||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
||||
FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId);
|
||||
Set<Resource> response = api.listFlavors();
|
||||
Set<? extends Resource> response = api.listFlavors();
|
||||
assert null != response;
|
||||
assertTrue(response.size() >= 0);
|
||||
for (Resource flavor : response) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest {
|
|||
public void testListImages() throws Exception {
|
||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
||||
ImageApi api = novaContext.getApi().getImageApiForZone(zoneId);
|
||||
Set<Resource> response = api.listImages();
|
||||
Set<? extends Resource> response = api.listImages();
|
||||
assertNotNull(response);
|
||||
assertTrue(response.size() >= 0);
|
||||
for (Resource image : response) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest {
|
|||
public void testListServersInDetail() throws Exception {
|
||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
||||
ServerApi api = novaContext.getApi().getServerApiForZone(zoneId);
|
||||
Set<Resource> response = api.listServers();
|
||||
Set<? extends Resource> response = api.listServers();
|
||||
assert null != response;
|
||||
assertTrue(response.size() >= 0);
|
||||
for (Resource server : response) {
|
||||
|
|
Loading…
Reference in New Issue