initial clients

This commit is contained in:
danikov 2012-02-09 19:12:01 +00:00
parent 1972886598
commit 4654d4c193
2 changed files with 160 additions and 0 deletions

View File

@ -0,0 +1,84 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.vcloud.director.v1_5.domain.Media;
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.Owner;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see MediaClient
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface MediaAsyncClient {
/**
* @see MediaClient#getMedia()
*/
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Media> getMedia(@EndpointParam URI mediaRef);
/**
* @see MediaClient#getMedia()
*/
@GET
@Path("/owner/")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Owner> getOwner(@EndpointParam URI mediaRef);
/**
* @see MediaClient#getMetadata()
*/
@GET
@Path("/metadata/")
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam URI mediaRef);
/**
* @see MediaClient#getMetadataEntry()
*/
@GET
@Consumes
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam URI metaDataRef);
}

View File

@ -0,0 +1,76 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.vcloud.director.v1_5.domain.Media;
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.Owner;
/**
* Provides synchronous access to Media.
* <p/>
*
* @see MediaAsyncClient
* @see <a href= "http://support.theenterprisecloud.com/kb/default.asp?id=984&Lang=1&SID=" />
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface MediaClient {
/**
* Retrieves a media.
*
* @return the media or null if not found
*/
Media getMedia(URI mediaRef);
/**
* Retrieves an owner.
*
* @return the owner or null if not found
*/
Owner getOwner(URI mediaRef);
/**
* Retrieves an list of the media's metadata
*
* @return a list of metadata
*/
Metadata getMetadata(URI mediaRef);
/**
* Retrieves a metadata entry
*
* @return the metadata entry, or null if not found
*/
MetadataEntry getMetadataEntry(URI metaDataRef);
// TODO
// PUT /media/{id} Updates the name/description of a media.
// DELETE /media/{id} Deletes a media.
// POST /media/{id}/metadata Merges the metadata for a media with the information provided.
// PUT /media/{id}/metadata/{key} Sets the metadata for the particular key for the media to the value provided.
// DELETE /media/{id}/metadata/{key} Deletes the metadata for the particular key for the media
}