Updates to CatalogClient

This commit is contained in:
Andrew Donald Kennedy 2012-02-10 13:35:48 +00:00
parent 33cd3c5716
commit ca54098661
4 changed files with 21 additions and 17 deletions

View File

@ -59,4 +59,10 @@ public interface VCloudDirectorAsyncClient {
*/ */
@Delegate @Delegate
NetworkAsyncClient getNetworkClient(); NetworkAsyncClient getNetworkClient();
/**
* @return asynchronous access to Catalog features
*/
@Delegate
CatalogAsyncClient getCatalogClient();
} }

View File

@ -42,6 +42,8 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
import org.jclouds.vcloud.director.v1_5.annotations.Login; import org.jclouds.vcloud.director.v1_5.annotations.Login;
import org.jclouds.vcloud.director.v1_5.domain.Session; import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken; import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkClient; import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
@ -75,8 +77,9 @@ import com.google.inject.name.Named;
public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirectorClient, VCloudDirectorAsyncClient> { public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirectorClient, VCloudDirectorAsyncClient> {
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()// public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
.put(OrgClient.class, OrgAsyncClient.class) .put(CatalogClient.class, CatalogAsyncClient.class)
.put(NetworkClient.class, NetworkAsyncClient.class) .put(NetworkClient.class, NetworkAsyncClient.class)
.put(OrgClient.class, OrgAsyncClient.class)
.put(TaskClient.class, TaskAsyncClient.class) .put(TaskClient.class, TaskAsyncClient.class)
.build(); .build();

View File

@ -27,17 +27,18 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Catalog; import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem; import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType; import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
@ -58,7 +59,6 @@ public interface CatalogAsyncClient {
*/ */
@GET @GET
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.CATALOG)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Catalog> getCatalog(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef); ListenableFuture<Catalog> getCatalog(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef);
@ -73,15 +73,14 @@ public interface CatalogAsyncClient {
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> addCatalogItem(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef, ListenableFuture<CatalogItem> addCatalogItem(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef,
@PayloadParam("catalogItem") CatalogItem catalogItem); @BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/** /**
* Returns the metadata associated with the catalog. * Returns the metadata associated with the catalog.
*/ */
@GET @GET
@Path("/metadata") @Path("/metadata")
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getCatalogMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef); ListenableFuture<Metadata> getCatalogMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef);
@ -92,7 +91,6 @@ public interface CatalogAsyncClient {
@GET @GET
@Path("/metadata/{key}") @Path("/metadata/{key}")
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.METADATA_ENTRY)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataEntry> getCatalogMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef, ListenableFuture<MetadataEntry> getCatalogMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef,
@ -103,7 +101,6 @@ public interface CatalogAsyncClient {
*/ */
@GET @GET
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef); ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef);
@ -117,7 +114,7 @@ public interface CatalogAsyncClient {
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> updateCatalogItem(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef, ListenableFuture<CatalogItem> updateCatalogItem(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
@PayloadParam("catalogItem") CatalogItem catalogItem); @BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/** /**
* Deletes a catalog item. * Deletes a catalog item.
@ -134,7 +131,6 @@ public interface CatalogAsyncClient {
@GET @GET
@Path("/metadata") @Path("/metadata")
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getCatalogItemMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef); ListenableFuture<Metadata> getCatalogItemMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef);
@ -149,7 +145,7 @@ public interface CatalogAsyncClient {
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> mergeCatalogItemMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef, ListenableFuture<Task> mergeCatalogItemMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
@PayloadParam("catalogItemMetadata") Metadata catalogItemMetadata); @BinderParam(BindToXMLPayload.class) Metadata catalogItemMetadata);
/** /**
* Returns the metadata associated with the catalog item for the specified key. * Returns the metadata associated with the catalog item for the specified key.
@ -157,7 +153,6 @@ public interface CatalogAsyncClient {
@GET @GET
@Path("/metadata/{key}") @Path("/metadata/{key}")
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.METADATA_ENTRY)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataEntry> getCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef, ListenableFuture<MetadataEntry> getCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
@ -168,12 +163,12 @@ public interface CatalogAsyncClient {
*/ */
@PUT @PUT
@Path("/metadata/{key}") @Path("/metadata/{key}")
@Consumes /* (VCloudDirectorMediaType.METADATA_VALUE) */ @Consumes(VCloudDirectorMediaType.METADATA_VALUE)
@Produces(VCloudDirectorMediaType.TASK) @Produces(VCloudDirectorMediaType.TASK)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> setCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef, ListenableFuture<Task> setCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
@PathParam("key") String key, @PayloadParam("metadataValue") /* MetadataValue */ Object metadataValue); @PathParam("key") String key, @BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
/** /**
* Deletes the metadata for the particular key for the catalog item. * Deletes the metadata for the particular key for the catalog item.
@ -181,7 +176,6 @@ public interface CatalogAsyncClient {
@DELETE @DELETE
@Path("/metadata/{key}") @Path("/metadata/{key}")
@Consumes @Consumes
@Produces(VCloudDirectorMediaType.TASK)
@JAXBResponseParser @JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class) @ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef, ListenableFuture<Task> deleteCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,

View File

@ -25,6 +25,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem; import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType; import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.Task;
@ -173,7 +174,7 @@ public interface CatalogClient {
* @param value the metadata value * @param value the metadata value
* @return a task for the set operation * @return a task for the set operation
*/ */
Task setCatalogItemMetadataEntry(ReferenceType<?> catalogItemRef, String key, /* MetadataValue */ Object value); Task setCatalogItemMetadataEntry(ReferenceType<?> catalogItemRef, String key, MetadataValue value);
/** /**
* Deletes the metadata for the particular key for the catalog item. * Deletes the metadata for the particular key for the catalog item.