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
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.domain.Session;
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.NetworkClient;
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 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(OrgClient.class, OrgAsyncClient.class)
.put(TaskClient.class, TaskAsyncClient.class)
.build();

View File

@ -27,17 +27,18 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
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.binders.BindToXMLPayload;
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.CatalogItem;
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.MetadataValue;
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.filters.AddVCloudAuthorizationToRequest;
@ -58,7 +59,6 @@ public interface CatalogAsyncClient {
*/
@GET
@Consumes
@Produces(VCloudDirectorMediaType.CATALOG)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Catalog> getCatalog(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef);
@ -73,7 +73,7 @@ public interface CatalogAsyncClient {
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
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.
@ -81,7 +81,6 @@ public interface CatalogAsyncClient {
@GET
@Path("/metadata")
@Consumes
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getCatalogMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef);
@ -92,7 +91,6 @@ public interface CatalogAsyncClient {
@GET
@Path("/metadata/{key}")
@Consumes
@Produces(VCloudDirectorMediaType.METADATA_ENTRY)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataEntry> getCatalogMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogRef,
@ -103,7 +101,6 @@ public interface CatalogAsyncClient {
*/
@GET
@Consumes
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef);
@ -117,7 +114,7 @@ public interface CatalogAsyncClient {
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<CatalogItem> updateCatalogItem(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
@PayloadParam("catalogItem") CatalogItem catalogItem);
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/**
* Deletes a catalog item.
@ -134,7 +131,6 @@ public interface CatalogAsyncClient {
@GET
@Path("/metadata")
@Consumes
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getCatalogItemMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef);
@ -149,7 +145,7 @@ public interface CatalogAsyncClient {
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
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.
@ -157,7 +153,6 @@ public interface CatalogAsyncClient {
@GET
@Path("/metadata/{key}")
@Consumes
@Produces(VCloudDirectorMediaType.METADATA_ENTRY)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataEntry> getCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
@ -168,12 +163,12 @@ public interface CatalogAsyncClient {
*/
@PUT
@Path("/metadata/{key}")
@Consumes /* (VCloudDirectorMediaType.METADATA_VALUE) */
@Consumes(VCloudDirectorMediaType.METADATA_VALUE)
@Produces(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
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.
@ -181,7 +176,6 @@ public interface CatalogAsyncClient {
@DELETE
@Path("/metadata/{key}")
@Consumes
@Produces(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
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.Metadata;
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.Task;
@ -173,7 +174,7 @@ public interface CatalogClient {
* @param value the metadata value
* @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.