update clients to use Reference

This commit is contained in:
danikov 2012-02-15 02:52:06 +00:00
parent a90f92490c
commit 057850438b
2 changed files with 33 additions and 30 deletions

View File

@ -39,7 +39,7 @@ 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.Owner;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
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.functions.ReferenceToEndpoint;
@ -55,77 +55,79 @@ import com.google.common.util.concurrent.ListenableFuture;
public interface MediaAsyncClient {
/**
* @see MediaClient#getMedia(ReferenceType)
* @see MediaClient#getMedia(Reference)
*/
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Media> getMedia(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> mediaRef);
ListenableFuture<Media> getMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef);
/**
* @see MediaClient#updateMedia(ReferenceType, Media))
* @see MediaClient#updateMedia(Reference, Media))
*/
@PUT
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.MEDIA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> updateMedia(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> mediaRef,
ListenableFuture<Task> updateMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef,
@BinderParam(BindToXMLPayload.class) Media media);
/**
* @see MediaClient#deleteMedia(ReferenceType))
* @see MediaClient#deleteMedia(Reference))
*/
@DELETE
@Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteMedia(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> mediaRef);
ListenableFuture<Task> deleteMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef);
/**
* @see MediaClient#getOwner(ReferenceType)
* @see MediaClient#getOwner(Reference)
*/
@GET
@Path("/owner")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Owner> getOwner(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> mediaRef);
ListenableFuture<Owner> getOwner(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef);
/**
* @see MediaClient#getMetadata(ReferenceType))
* @see MediaClient#getMetadata(Reference))
*/
@GET
@Path("/metadata")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> mediaRef);
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef);
/**
* @see MediaClient#mergeMetadata(ReferenceType, Metadata))
* @see MediaClient#mergeMetadata(Reference, Metadata))
*/
@POST
@Path("/metadata")
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> mergeMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> mediaRef,
ListenableFuture<Task> mergeMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef,
@BinderParam(BindToXMLPayload.class) Metadata metadata);
/**
* @see MediaClient#getMetadataEntry(ReferenceType, String))
* @see MediaClient#getMetadataEntry(Reference, String))
*/
@GET
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> mediaRef,
@BinderParam(BindToXMLPayload.class) String key);
ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef,
@PathParam("key") String key);
/**
* @see MediaClient#setMetadata(ReferenceType, String, MetadataEntry))
* @see MediaClient#setMetadata(Reference, String, MetadataEntry))
*/
@PUT
@Path("/metadata/{key}")
@ -133,18 +135,19 @@ public interface MediaAsyncClient {
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> setMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> metaDataRef,
ListenableFuture<Task> setMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference metaDataRef,
@PathParam("key") String key,
@BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
/**
* @see MediaClient#deleteMetadataEntry(ReferenceType, String))
* @see MediaClient#deleteMetadataEntry(Reference, String))
*/
@DELETE
@Path("/metadata/{key}")
@Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> metaDataRef,
ListenableFuture<Task> deleteMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) Reference metaDataRef,
@PathParam("key") String key);
}

View File

@ -26,7 +26,7 @@ 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.Owner;
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task;
/**
@ -45,7 +45,7 @@ public interface MediaClient {
*
* @return the media or null if not found
*/
Media getMedia(ReferenceType<?> mediaRef);
Media getMedia(Reference mediaRef);
/**
* Updates the name/description of a media.
@ -53,40 +53,40 @@ public interface MediaClient {
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task updateMedia(ReferenceType<?> mediaRef, Media media);
Task updateMedia(Reference mediaRef, Media media);
/**
* Deletes a media.
*/
Task deleteMedia(ReferenceType<?> mediaRef);
Task deleteMedia(Reference mediaRef);
/**
* Retrieves an owner.
*
* @return the owner or null if not found
*/
Owner getOwner(ReferenceType<?> mediaRef);
Owner getOwner(Reference mediaRef);
/**
* Retrieves an list of the media's metadata
*
* @return a list of metadata
*/
Metadata getMetadata(ReferenceType<?> mediaRef);
Metadata getMetadata(Reference mediaRef);
/**
* Merges the metadata for a media with the information provided.
*
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task mergeMetadata(ReferenceType<?> mediaRef, Metadata metadata);
Task mergeMetadata(Reference mediaRef, Metadata metadata);
/**
* Retrieves a metadata entry
*
* @return the metadata entry, or null if not found
*/
MetadataEntry getMetadataEntry(ReferenceType<?> mediaRef, String key);
MetadataEntry getMetadataEntry(Reference mediaRef, String key);
/**
* Sets the metadata for the particular key for the media to the value provided.
@ -95,7 +95,7 @@ public interface MediaClient {
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task setMetadata(ReferenceType<?> mediaRef, String key, MetadataValue metadataEntry);
Task setMetadata(Reference mediaRef, String key, MetadataValue metadataEntry);
/**
* Deletes a metadata entry.
@ -103,7 +103,7 @@ public interface MediaClient {
* @return a task. This operation is asynchronous and the user should monitor the returned
* task status in order to check when it is completed.
*/
Task deleteMetadataEntry(ReferenceType<?> mediaRef, String key);
Task deleteMetadataEntry(Reference mediaRef, String key);
}