issue #1501: add Closeable annotation to all top-level apis

This commit is contained in:
adriancole 2013-04-08 15:57:34 -07:00
parent 4ced43566b
commit 88871c9fe9
52 changed files with 148 additions and 59 deletions

View File

@ -20,6 +20,7 @@ package org.jclouds.atmos;
import static com.google.common.net.HttpHeaders.EXPECT; import static com.google.common.net.HttpHeaders.EXPECT;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import javax.inject.Named; import javax.inject.Named;
@ -77,7 +78,7 @@ import com.google.inject.Provides;
*/ */
@RequestFilters(SignRequest.class) @RequestFilters(SignRequest.class)
@Path("/rest/namespace") @Path("/rest/namespace")
public interface AtmosAsyncClient { public interface AtmosAsyncClient extends Closeable {
/** /**
* Creates a default implementation of AtmosObject * Creates a default implementation of AtmosObject
*/ */

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.atmos; package org.jclouds.atmos;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import org.jclouds.atmos.domain.AtmosObject; import org.jclouds.atmos.domain.AtmosObject;
import org.jclouds.atmos.domain.BoundedSet; import org.jclouds.atmos.domain.BoundedSet;
@ -38,7 +39,7 @@ import com.google.inject.Provides;
* @see <a href="https://community.emc.com/community/labs/atmos_online" /> * @see <a href="https://community.emc.com/community/labs/atmos_online" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface AtmosClient { public interface AtmosClient extends Closeable {
/** /**
* Creates a default implementation of AtmosObject * Creates a default implementation of AtmosObject
*/ */

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture; import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture; import static com.google.common.util.concurrent.Futures.immediateFuture;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -47,6 +48,7 @@ import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.domain.BlobMetadata;
import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions; import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions;
import org.jclouds.http.options.GetOptions; import org.jclouds.http.options.GetOptions;
import org.jclouds.lifecycle.Closer;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
@ -69,13 +71,14 @@ public class StubAtmosAsyncClient implements AtmosAsyncClient {
private final ListOptionsToBlobStoreListOptions container2ContainerListOptions; private final ListOptionsToBlobStoreListOptions container2ContainerListOptions;
private final ResourceMetadataListToDirectoryEntryList resource2ObjectList; private final ResourceMetadataListToDirectoryEntryList resource2ObjectList;
private final ListeningExecutorService userExecutor; private final ListeningExecutorService userExecutor;
private final Closer closer;
@Inject @Inject
private StubAtmosAsyncClient(LocalAsyncBlobStore blobStore, AtmosObject.Factory objectProvider, private StubAtmosAsyncClient(LocalAsyncBlobStore blobStore, AtmosObject.Factory objectProvider,
HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object, HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object,
BlobMetadataToObject blob2ObjectInfo, ListOptionsToBlobStoreListOptions container2ContainerListOptions, BlobMetadataToObject blob2ObjectInfo, ListOptionsToBlobStoreListOptions container2ContainerListOptions,
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
ResourceMetadataListToDirectoryEntryList resource2ContainerList) { ResourceMetadataListToDirectoryEntryList resource2ContainerList, Closer closer) {
this.blobStore = blobStore; this.blobStore = blobStore;
this.objectProvider = objectProvider; this.objectProvider = objectProvider;
this.httpGetOptionsConverter = httpGetOptionsConverter; this.httpGetOptionsConverter = httpGetOptionsConverter;
@ -86,6 +89,7 @@ public class StubAtmosAsyncClient implements AtmosAsyncClient {
"container2ContainerListOptions"); "container2ContainerListOptions");
this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList"); this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList");
this.userExecutor = userExecutor; this.userExecutor = userExecutor;
this.closer = checkNotNull(closer, "closer");
} }
@Override @Override
@ -245,4 +249,8 @@ public class StubAtmosAsyncClient implements AtmosAsyncClient {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void close() throws IOException {
closer.close();
}
} }

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.cloudservers; package org.jclouds.cloudservers;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -76,7 +77,7 @@ import com.google.common.util.concurrent.ListenableFuture;
*/ */
@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class }) @RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
@Endpoint(Compute.class) @Endpoint(Compute.class)
public interface CloudServersAsyncClient { public interface CloudServersAsyncClient extends Closeable {
/** /**
* @see CloudServersClient#getLimits * @see CloudServersClient#getLimits

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.cloudservers; package org.jclouds.cloudservers;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
@ -44,7 +45,7 @@ import org.jclouds.cloudservers.options.RebuildServerOptions;
* @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" /> * @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface CloudServersClient { public interface CloudServersClient extends Closeable {
/** /**
* All accounts, by default, have a preconfigured set of thresholds (or limits) to manage * All accounts, by default, have a preconfigured set of thresholds (or limits) to manage
* capacity and prevent abuse of the system. The system recognizes two kinds of limits: rate * capacity and prevent abuse of the system. The system recognizes two kinds of limits: rate

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.cloudsigma; package org.jclouds.cloudsigma;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@ -75,7 +76,7 @@ import com.google.common.util.concurrent.ListenableFuture;
*/ */
@RequestFilters(BasicAuthentication.class) @RequestFilters(BasicAuthentication.class)
@Consumes(MediaType.TEXT_PLAIN) @Consumes(MediaType.TEXT_PLAIN)
public interface CloudSigmaAsyncClient { public interface CloudSigmaAsyncClient extends Closeable {
/** /**
* @see CloudSigmaClient#listStandardDrives * @see CloudSigmaClient#listStandardDrives

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.cloudsigma; package org.jclouds.cloudsigma;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudsigma.domain.Drive; import org.jclouds.cloudsigma.domain.Drive;
@ -38,7 +39,7 @@ import org.jclouds.cloudsigma.options.CloneDriveOptions;
* @see <a href="TODO: insert URL of cloudsigma documentation" /> * @see <a href="TODO: insert URL of cloudsigma documentation" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface CloudSigmaClient { public interface CloudSigmaClient extends Closeable {
/** /**
* Get profile info * Get profile info

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.cloudwatch; package org.jclouds.cloudwatch;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudwatch.features.MetricApi; import org.jclouds.cloudwatch.features.MetricApi;
@ -37,7 +38,7 @@ import com.google.inject.Provides;
* /> * />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface CloudWatchApi { public interface CloudWatchApi extends Closeable {
/** /**
* *
* @return the Region codes configured * @return the Region codes configured

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.cloudwatch; package org.jclouds.cloudwatch;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudwatch.features.MetricAsyncApi; import org.jclouds.cloudwatch.features.MetricAsyncApi;
@ -38,7 +39,7 @@ import com.google.inject.Provides;
* /> * />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface CloudWatchAsyncApi { public interface CloudWatchAsyncApi extends Closeable {
/** /**
* *
* @return the Region codes configured * @return the Region codes configured

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.ec2; package org.jclouds.ec2;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.ec2.features.SubnetApi; import org.jclouds.ec2.features.SubnetApi;
import org.jclouds.ec2.features.TagApi; import org.jclouds.ec2.features.TagApi;
@ -50,7 +51,7 @@ import com.google.inject.Provides;
* @author Adrian Cole * @author Adrian Cole
* @see EC2AsyncApi * @see EC2AsyncApi
*/ */
public interface EC2Api { public interface EC2Api extends Closeable {
/** /**
* *
* @return the Region codes configured * @return the Region codes configured

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.ec2; package org.jclouds.ec2;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.ec2.features.SubnetAsyncApi; import org.jclouds.ec2.features.SubnetAsyncApi;
@ -38,7 +39,7 @@ import com.google.inject.Provides;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface EC2AsyncApi { public interface EC2AsyncApi extends Closeable {
/** /**
* *
* @return the Region codes configured * @return the Region codes configured

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.elasticstack; package org.jclouds.elasticstack;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@ -64,7 +65,7 @@ import com.google.common.util.concurrent.ListenableFuture;
*/ */
@RequestFilters(BasicAuthentication.class) @RequestFilters(BasicAuthentication.class)
@Consumes(MediaType.TEXT_PLAIN) @Consumes(MediaType.TEXT_PLAIN)
public interface ElasticStackAsyncClient { public interface ElasticStackAsyncClient extends Closeable {
/** /**
* @see ElasticStackClient#listServers() * @see ElasticStackClient#listServers()

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.elasticstack; package org.jclouds.elasticstack;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.elasticstack.domain.Drive; import org.jclouds.elasticstack.domain.Drive;
import org.jclouds.elasticstack.domain.DriveData; import org.jclouds.elasticstack.domain.DriveData;
@ -35,7 +36,7 @@ import org.jclouds.io.Payload;
* @see <a href="TODO: insert URL of elasticstack documentation" /> * @see <a href="TODO: insert URL of elasticstack documentation" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface ElasticStackClient { public interface ElasticStackClient extends Closeable {
/** /**
* list of server uuids in your account * list of server uuids in your account
* *

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.openstack.cinder.v1; package org.jclouds.openstack.cinder.v1;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.Zone; import org.jclouds.location.Zone;
@ -38,7 +39,7 @@ import com.google.inject.Provides;
* @see <a href="http://api.openstack.org/">API Doc</a> * @see <a href="http://api.openstack.org/">API Doc</a>
* @author Everett Toews * @author Everett Toews
*/ */
public interface CinderApi { public interface CinderApi extends Closeable {
/** /**
* @return the Zone codes configured * @return the Zone codes configured
*/ */

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.openstack.cinder.v1; package org.jclouds.openstack.cinder.v1;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
@ -39,7 +40,7 @@ import com.google.inject.Provides;
* @see <a href="http://api.openstack.org/">API Doc</a> * @see <a href="http://api.openstack.org/">API Doc</a>
* @author Everett Toews * @author Everett Toews
*/ */
public interface CinderAsyncApi { public interface CinderAsyncApi extends Closeable {
/** /**
* @return the Zone codes configured * @return the Zone codes configured
*/ */

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.openstack.keystone.v2_0; package org.jclouds.openstack.keystone.v2_0;
import java.io.Closeable;
import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata; import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata;
import org.jclouds.openstack.keystone.v2_0.features.ServiceApi; import org.jclouds.openstack.keystone.v2_0.features.ServiceApi;
import org.jclouds.openstack.keystone.v2_0.features.TenantApi; import org.jclouds.openstack.keystone.v2_0.features.TenantApi;
@ -36,7 +38,7 @@ import com.google.common.base.Optional;
* @see <a href="http://keystone.openstack.org/" /> * @see <a href="http://keystone.openstack.org/" />
* @see KeystoneAsyncApi * @see KeystoneAsyncApi
*/ */
public interface KeystoneApi { public interface KeystoneApi extends Closeable {
/** /**
* Discover API version information, links to documentation (PDF, HTML, WADL), and supported media types * Discover API version information, links to documentation (PDF, HTML, WADL), and supported media types

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.openstack.keystone.v2_0; package org.jclouds.openstack.keystone.v2_0;
import java.io.Closeable;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
@ -44,7 +46,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* @see <a href="http://keystone.openstack.org/" /> * @see <a href="http://keystone.openstack.org/" />
* @see KeystoneApi * @see KeystoneApi
*/ */
public interface KeystoneAsyncApi { public interface KeystoneAsyncApi extends Closeable {
/** /**
* @see KeystoneApi#getApiMetadata() * @see KeystoneApi#getApiMetadata()

View File

@ -6,6 +6,7 @@ import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CRED
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE; import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.io.Closeable;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.net.URI; import java.net.URI;
@ -62,12 +63,12 @@ public class ProviderModuleExpectTest extends BaseRestApiExpectTest<ProviderModu
} }
} }
static interface DNSApi { static interface DNSApi extends Closeable {
boolean zoneExists(@PathParam("zoneName") String zoneName); boolean zoneExists(@PathParam("zoneName") String zoneName);
} }
@org.jclouds.rest.annotations.Endpoint(DNS.class) @org.jclouds.rest.annotations.Endpoint(DNS.class)
static interface DNSAsyncApi { static interface DNSAsyncApi extends Closeable {
@HEAD @HEAD
@Path("/zones/{zoneName}") @Path("/zones/{zoneName}")
@Fallback(FalseOnNotFoundOr404.class) @Fallback(FalseOnNotFoundOr404.class)

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.openstack.nova.v2_0; package org.jclouds.openstack.nova.v2_0;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.Zone; import org.jclouds.location.Zone;
@ -56,7 +57,7 @@ import com.google.inject.Provides;
* /> * />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface NovaApi { public interface NovaApi extends Closeable {
/** /**
* *
* @return the Zone codes configured * @return the Zone codes configured

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.openstack.nova.v2_0; package org.jclouds.openstack.nova.v2_0;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
@ -57,7 +58,7 @@ import com.google.inject.Provides;
* /> * />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface NovaAsyncApi { public interface NovaAsyncApi extends Closeable {
/** /**
* *

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.rackspace.cloudloadbalancers.v1; package org.jclouds.rackspace.cloudloadbalancers.v1;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
@ -48,7 +49,7 @@ import com.google.inject.Provides;
* @see CloudLoadBalancersAsyncApi * @see CloudLoadBalancersAsyncApi
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface CloudLoadBalancersApi { public interface CloudLoadBalancersApi extends Closeable {
/** /**
* @return the Zone codes configured * @return the Zone codes configured
*/ */

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.rackspace.cloudloadbalancers.v1; package org.jclouds.rackspace.cloudloadbalancers.v1;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -49,7 +50,7 @@ import com.google.inject.Provides;
* @see CloudLoadBalancersApi * @see CloudLoadBalancersApi
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface CloudLoadBalancersAsyncApi { public interface CloudLoadBalancersAsyncApi extends Closeable {
/** /**
* @return the Zone codes configured * @return the Zone codes configured
*/ */

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.route53; package org.jclouds.route53;
import java.io.Closeable;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
@ -34,7 +36,7 @@ import org.jclouds.route53.features.HostedZoneApi;
* /> * />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface Route53Api { public interface Route53Api extends Closeable {
/** /**
* returns the current status of a change batch request. * returns the current status of a change batch request.

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.route53; package org.jclouds.route53;
import java.io.Closeable;
import javax.inject.Named; import javax.inject.Named;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -48,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture;
@RequestFilters(RestAuthentication.class) @RequestFilters(RestAuthentication.class)
@VirtualHost @VirtualHost
@Path("/{jclouds.api-version}") @Path("/{jclouds.api-version}")
public interface Route53AsyncApi { public interface Route53AsyncApi extends Closeable {
/** /**
* @see Route53Api#getChange() * @see Route53Api#getChange()

View File

@ -21,6 +21,7 @@ package org.jclouds.s3;
import static com.google.common.net.HttpHeaders.EXPECT; import static com.google.common.net.HttpHeaders.EXPECT;
import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER; import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -108,7 +109,7 @@ import com.google.inject.Provides;
*/ */
@RequestFilters(RequestAuthorizeSignature.class) @RequestFilters(RequestAuthorizeSignature.class)
@BlobScope(CONTAINER) @BlobScope(CONTAINER)
public interface S3AsyncClient { public interface S3AsyncClient extends Closeable {
public static final String VERSION = "2006-03-01"; public static final String VERSION = "2006-03-01";
/** /**

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.s3; package org.jclouds.s3;
import java.io.Closeable;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
@ -49,7 +50,7 @@ import com.google.inject.Provides;
* @author James Murty * @author James Murty
* @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAPI.html" /> * @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAPI.html" />
*/ */
public interface S3Client { public interface S3Client extends Closeable {
/** /**
* Creates a default implementation of S3Object * Creates a default implementation of S3Object

View File

@ -23,6 +23,7 @@ import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture; import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.google.common.util.concurrent.Futures.transform; import static com.google.common.util.concurrent.Futures.transform;
import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -50,6 +51,7 @@ import org.jclouds.domain.LocationBuilder;
import org.jclouds.domain.LocationScope; import org.jclouds.domain.LocationScope;
import org.jclouds.http.options.GetOptions; import org.jclouds.http.options.GetOptions;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.lifecycle.Closer;
import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.S3AsyncClient;
import org.jclouds.s3.blobstore.S3AsyncBlobStore; import org.jclouds.s3.blobstore.S3AsyncBlobStore;
import org.jclouds.s3.blobstore.functions.BlobToObject; import org.jclouds.s3.blobstore.functions.BlobToObject;
@ -100,6 +102,7 @@ public class StubS3AsyncClient implements S3AsyncClient {
private final ConcurrentMap<String, ConcurrentMap<String, Blob>> containerToBlobs; private final ConcurrentMap<String, ConcurrentMap<String, Blob>> containerToBlobs;
private final ConcurrentMap<String, Location> containerToLocation; private final ConcurrentMap<String, Location> containerToLocation;
private final ListeningExecutorService userExecutor; private final ListeningExecutorService userExecutor;
private final Closer closer;
@Inject @Inject
private StubS3AsyncClient(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, private StubS3AsyncClient(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
@ -108,7 +111,7 @@ public class StubS3AsyncClient implements S3AsyncClient {
S3Object.Factory objectProvider, Blob.Factory blobProvider, S3Object.Factory objectProvider, Blob.Factory blobProvider,
HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object, HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object,
BlobToObjectMetadata blob2ObjectMetadata, BucketToContainerListOptions bucket2ContainerListOptions, BlobToObjectMetadata blob2ObjectMetadata, BucketToContainerListOptions bucket2ContainerListOptions,
ResourceToBucketList resource2BucketList) { ResourceToBucketList resource2BucketList, Closer closer) {
this.userExecutor = userExecutor; this.userExecutor = userExecutor;
this.containerToBlobs = containerToBlobs; this.containerToBlobs = containerToBlobs;
this.containerToLocation = containerToLocation; this.containerToLocation = containerToLocation;
@ -122,6 +125,7 @@ public class StubS3AsyncClient implements S3AsyncClient {
this.blob2ObjectMetadata = checkNotNull(blob2ObjectMetadata, "blob2ObjectMetadata"); this.blob2ObjectMetadata = checkNotNull(blob2ObjectMetadata, "blob2ObjectMetadata");
this.bucket2ContainerListOptions = checkNotNull(bucket2ContainerListOptions, "bucket2ContainerListOptions"); this.bucket2ContainerListOptions = checkNotNull(bucket2ContainerListOptions, "bucket2ContainerListOptions");
this.resource2BucketList = checkNotNull(resource2BucketList, "resource2BucketList"); this.resource2BucketList = checkNotNull(resource2BucketList, "resource2BucketList");
this.closer = checkNotNull(closer, "closer");
} }
public static final String TEST_ACL_ID = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c"; public static final String TEST_ACL_ID = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c";
@ -336,4 +340,9 @@ public class StubS3AsyncClient implements S3AsyncClient {
return immediateFuture(containerToBlobs.get(bucketName).containsKey(key)); return immediateFuture(containerToBlobs.get(bucketName).containsKey(key));
} }
@Override
public void close() throws IOException {
closer.close();
}
} }

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.sqs; package org.jclouds.sqs;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
@ -40,7 +41,7 @@ import com.google.inject.Provides;
* @see SQSAsyncApi * @see SQSAsyncApi
*/ */
@Beta @Beta
public interface SQSApi { public interface SQSApi extends Closeable {
/** /**
* *

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.sqs; package org.jclouds.sqs;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
@ -48,7 +49,7 @@ import com.google.inject.Provides;
@Beta @Beta
@RequestFilters(FormSigner.class) @RequestFilters(FormSigner.class)
@VirtualHost @VirtualHost
public interface SQSAsyncApi { public interface SQSAsyncApi extends Closeable {
/** /**
* *
* @return the Region codes configured * @return the Region codes configured

View File

@ -23,6 +23,7 @@ import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToA
import static org.jclouds.sqs.reference.SQSParameters.ACTION; import static org.jclouds.sqs.reference.SQSParameters.ACTION;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import javax.ws.rs.POST; import javax.ws.rs.POST;
@ -62,11 +63,11 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest {
recreateQueueInRegion(prefix, null); recreateQueueInRegion(prefix, null);
} }
static interface AnonymousAttributesApi { static interface AnonymousAttributesApi extends Closeable {
String getQueueArn(); String getQueueArn();
} }
static interface AnonymousAttributesAsyncApi { static interface AnonymousAttributesAsyncApi extends Closeable {
@POST @POST
@Path("/") @Path("/")
@FormParams(keys = { ACTION, "AttributeName.1" }, values = { "GetQueueAttributes", "QueueArn" }) @FormParams(keys = { ACTION, "AttributeName.1" }, values = { "GetQueueAttributes", "QueueArn" })

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.sts; package org.jclouds.sts;
import java.io.Closeable;
import org.jclouds.aws.domain.SessionCredentials; import org.jclouds.aws.domain.SessionCredentials;
import org.jclouds.sts.domain.User; import org.jclouds.sts.domain.User;
import org.jclouds.sts.domain.UserAndSessionCredentials; import org.jclouds.sts.domain.UserAndSessionCredentials;
@ -33,7 +35,7 @@ import org.jclouds.sts.options.SessionCredentialsOptions;
* @see <a href="http://docs.amazonwebservices.com/STS/latest/APIReference" /> * @see <a href="http://docs.amazonwebservices.com/STS/latest/APIReference" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface STSApi { public interface STSApi extends Closeable {
/** /**
* Returns a set of temporary credentials for an AWS account or IAM user, * Returns a set of temporary credentials for an AWS account or IAM user,
* with a default timeout * with a default timeout

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.sts; package org.jclouds.sts;
import java.io.Closeable;
import javax.inject.Named; import javax.inject.Named;
import javax.ws.rs.FormParam; import javax.ws.rs.FormParam;
import javax.ws.rs.POST; import javax.ws.rs.POST;
@ -47,7 +49,7 @@ import com.google.common.util.concurrent.ListenableFuture;
*/ */
@RequestFilters(FormSigner.class) @RequestFilters(FormSigner.class)
@VirtualHost @VirtualHost
public interface STSAsyncApi { public interface STSAsyncApi extends Closeable {
/** /**
* @see STSApi#createTemporaryCredentials() * @see STSApi#createTemporaryCredentials()

View File

@ -20,6 +20,7 @@ package org.jclouds.openstack.swift;
import static com.google.common.net.HttpHeaders.EXPECT; import static com.google.common.net.HttpHeaders.EXPECT;
import java.io.Closeable;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -79,7 +80,7 @@ import com.google.inject.Provides;
* @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" /> * @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface CommonSwiftAsyncClient { public interface CommonSwiftAsyncClient extends Closeable {
@Provides @Provides
SwiftObject newSwiftObject(); SwiftObject newSwiftObject();

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.openstack.swift; package org.jclouds.openstack.swift;
import java.io.Closeable;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.jclouds.blobstore.domain.PageSet; import org.jclouds.blobstore.domain.PageSet;
@ -38,7 +39,7 @@ import com.google.inject.Provides;
* @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" /> * @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface CommonSwiftClient { public interface CommonSwiftClient extends Closeable {
@Provides @Provides
SwiftObject newSwiftObject(); SwiftObject newSwiftObject();

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.Futures.immediateFuture; import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.google.common.util.concurrent.Futures.transform; import static com.google.common.util.concurrent.Futures.transform;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -40,6 +41,7 @@ import org.jclouds.blobstore.domain.StorageMetadata;
import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions; import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions;
import org.jclouds.blobstore.options.ListContainerOptions; import org.jclouds.blobstore.options.ListContainerOptions;
import org.jclouds.http.options.GetOptions; import org.jclouds.http.options.GetOptions;
import org.jclouds.lifecycle.Closer;
import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
import org.jclouds.openstack.swift.SwiftAsyncClient; import org.jclouds.openstack.swift.SwiftAsyncClient;
import org.jclouds.openstack.swift.blobstore.functions.BlobToObject; import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
@ -77,6 +79,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient {
private final ListContainerOptionsToBlobStoreListContainerOptions container2ContainerListOptions; private final ListContainerOptionsToBlobStoreListContainerOptions container2ContainerListOptions;
private final ResourceToObjectList resource2ObjectList; private final ResourceToObjectList resource2ObjectList;
private final ListeningExecutorService userExecutor; private final ListeningExecutorService userExecutor;
private final Closer closer;
@Inject @Inject
private StubSwiftAsyncClient(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, private StubSwiftAsyncClient(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
@ -84,7 +87,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient {
SwiftObject.Factory objectProvider, HttpGetOptionsListToGetOptions httpGetOptionsConverter, SwiftObject.Factory objectProvider, HttpGetOptionsListToGetOptions httpGetOptionsConverter,
ObjectToBlob object2Blob, BlobToObject blob2Object, ResourceToObjectInfo blob2ObjectInfo, ObjectToBlob object2Blob, BlobToObject blob2Object, ResourceToObjectInfo blob2ObjectInfo,
ListContainerOptionsToBlobStoreListContainerOptions container2ContainerListOptions, ListContainerOptionsToBlobStoreListContainerOptions container2ContainerListOptions,
ResourceToObjectList resource2ContainerList) { ResourceToObjectList resource2ContainerList, Closer closer) {
this.userExecutor = userExecutor; this.userExecutor = userExecutor;
this.blobStore = blobStore; this.blobStore = blobStore;
this.objectProvider = objectProvider; this.objectProvider = objectProvider;
@ -95,6 +98,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient {
this.container2ContainerListOptions = checkNotNull(container2ContainerListOptions, this.container2ContainerListOptions = checkNotNull(container2ContainerListOptions,
"container2ContainerListOptions"); "container2ContainerListOptions");
this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList"); this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList");
this.closer = checkNotNull(closer, "closer");
} }
public ListenableFuture<Boolean> containerExists(final String container) { public ListenableFuture<Boolean> containerExists(final String container) {
@ -217,4 +221,9 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient {
public ListenableFuture<Boolean> objectExists(String bucketName, String key) { public ListenableFuture<Boolean> objectExists(String bucketName, String key) {
return blobStore.blobExists(bucketName, key); return blobStore.blobExists(bucketName, key);
} }
@Override
public void close() throws IOException {
closer.close();
}
} }

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.vcloud; package org.jclouds.vcloud;
import java.io.Closeable;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.features.CatalogAsyncClient; import org.jclouds.vcloud.features.CatalogAsyncClient;
@ -39,7 +41,7 @@ import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
public interface VCloudAsyncClient { public interface VCloudAsyncClient extends Closeable {
/** /**
* Provides asynchronous access to VApp Template features. * Provides asynchronous access to VApp Template features.

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.vcloud; package org.jclouds.vcloud;
import java.io.Closeable;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.features.CatalogClient; import org.jclouds.vcloud.features.CatalogClient;
import org.jclouds.vcloud.features.NetworkClient; import org.jclouds.vcloud.features.NetworkClient;
@ -35,7 +37,7 @@ import org.jclouds.vcloud.features.VmClient;
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" /> * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface VCloudClient { public interface VCloudClient extends Closeable {
/** /**
* Provides asynchronous access to VApp Template features. * Provides asynchronous access to VApp Template features.
* *

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.vcloud; package org.jclouds.vcloud;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import java.util.SortedMap; import java.util.SortedMap;
@ -36,7 +37,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" /> * @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface VCloudVersionsAsyncClient { public interface VCloudVersionsAsyncClient extends Closeable {
/** /**
* Retrieve information for supported versions * Retrieve information for supported versions

View File

@ -18,9 +18,10 @@
*/ */
package org.jclouds.vcloud; package org.jclouds.vcloud;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import java.util.SortedMap; import java.util.SortedMap;
public interface VCloudVersionsClient { public interface VCloudVersionsClient extends Closeable {
SortedMap<String, URI> getSupportedVersions(); SortedMap<String, URI> getSupportedVersions();
} }

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.vcloud.internal; package org.jclouds.vcloud.internal;
import java.io.Closeable;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.POST; import javax.ws.rs.POST;
@ -40,7 +42,7 @@ import com.google.common.util.concurrent.ListenableFuture;
*/ */
@Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.class) @Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.class)
@RequestFilters(BasicAuthentication.class) @RequestFilters(BasicAuthentication.class)
public interface VCloudLoginAsyncClient { public interface VCloudLoginAsyncClient extends Closeable {
/** /**
* This request returns a token to use in subsequent requests. After 30 minutes of inactivity, * This request returns a token to use in subsequent requests. After 30 minutes of inactivity,

View File

@ -18,9 +18,11 @@
*/ */
package org.jclouds.vcloud.internal; package org.jclouds.vcloud.internal;
import java.io.Closeable;
import org.jclouds.vcloud.domain.VCloudSession; import org.jclouds.vcloud.domain.VCloudSession;
public interface VCloudLoginClient { public interface VCloudLoginClient extends Closeable {
VCloudSession login(); VCloudSession login();
} }

View File

@ -34,6 +34,7 @@ import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPPTEMPLATE_
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPP_XML; import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VAPP_XML;
import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VDC_XML; import static org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType.VDC_XML;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -124,7 +125,7 @@ import com.google.inject.Provides;
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(SetVCloudTokenCookie.class) @RequestFilters(SetVCloudTokenCookie.class)
public interface TerremarkVCloudAsyncClient { public interface TerremarkVCloudAsyncClient extends Closeable {
/** /**
* @see TerremarkVCloudClient#getCatalogItemInOrg * @see TerremarkVCloudClient#getCatalogItemInOrg

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.trmk.vcloud_0_8; package org.jclouds.trmk.vcloud_0_8;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -55,7 +56,7 @@ import com.google.inject.Provides;
* /> * />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface TerremarkVCloudClient { public interface TerremarkVCloudClient extends Closeable {
Catalog getCatalog(URI catalogId); Catalog getCatalog(URI catalogId);
/** /**

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.trmk.vcloud_0_8.internal; package org.jclouds.trmk.vcloud_0_8.internal;
import java.io.Closeable;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.POST; import javax.ws.rs.POST;
@ -40,7 +42,7 @@ import com.google.common.util.concurrent.ListenableFuture;
*/ */
@Endpoint(org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin.class) @Endpoint(org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin.class)
@RequestFilters(BasicAuthentication.class) @RequestFilters(BasicAuthentication.class)
public interface TerremarkVCloudLoginAsyncClient { public interface TerremarkVCloudLoginAsyncClient extends Closeable {
/** /**
* This request returns a token to use in subsequent requests. After ten minutes of inactivity, * This request returns a token to use in subsequent requests. After ten minutes of inactivity,

View File

@ -18,9 +18,11 @@
*/ */
package org.jclouds.trmk.vcloud_0_8.internal; package org.jclouds.trmk.vcloud_0_8.internal;
import java.io.Closeable;
import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession; import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession;
public interface TerremarkVCloudLoginClient { public interface TerremarkVCloudLoginClient extends Closeable {
VCloudSession login(); VCloudSession login();
} }

View File

@ -18,6 +18,7 @@
*/ */
package org.jclouds.trmk.vcloud_0_8.internal; package org.jclouds.trmk.vcloud_0_8.internal;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import java.util.SortedMap; import java.util.SortedMap;
@ -36,7 +37,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" /> * @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface TerremarkVCloudVersionsAsyncClient { public interface TerremarkVCloudVersionsAsyncClient extends Closeable {
/** /**
* Retrieve information for supported versions * Retrieve information for supported versions

View File

@ -18,9 +18,10 @@
*/ */
package org.jclouds.trmk.vcloud_0_8.internal; package org.jclouds.trmk.vcloud_0_8.internal;
import java.io.Closeable;
import java.net.URI; import java.net.URI;
import java.util.SortedMap; import java.util.SortedMap;
public interface TerremarkVCloudVersionsClient { public interface TerremarkVCloudVersionsClient extends Closeable {
SortedMap<String, URI> getSupportedVersions(); SortedMap<String, URI> getSupportedVersions();
} }

View File

@ -20,6 +20,7 @@ package org.jclouds.http;
import static com.google.common.util.concurrent.Futures.immediateFuture; import static com.google.common.util.concurrent.Futures.immediateFuture;
import java.io.Closeable;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
@ -61,7 +62,7 @@ import com.google.inject.Provides;
* @see IntegrationTestClient * @see IntegrationTestClient
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface IntegrationTestAsyncClient { public interface IntegrationTestAsyncClient extends Closeable {
@Target({ ElementType.METHOD }) @Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@HttpMethod("ROWDY") @HttpMethod("ROWDY")

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.http; package org.jclouds.http;
import java.io.Closeable;
import org.jclouds.http.options.HttpRequestOptions; import org.jclouds.http.options.HttpRequestOptions;
import org.jclouds.io.Payload; import org.jclouds.io.Payload;
@ -29,7 +31,7 @@ import com.google.inject.Provides;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface IntegrationTestClient { public interface IntegrationTestClient extends Closeable {
String rowdy(String path); String rowdy(String path);
boolean exists(String path); boolean exists(String path);

View File

@ -22,6 +22,8 @@ import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToA
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.io.Closeable;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -68,7 +70,7 @@ public class JAXBResponseParserAnnotationExpectTest extends
} }
public interface TestJAXBApi { public interface TestJAXBApi extends Closeable {
public TestJAXBDomain jaxbGetWithAnnotation(); public TestJAXBDomain jaxbGetWithAnnotation();
public Object jaxbGetWithAnnotationAndCustomClass(); public Object jaxbGetWithAnnotationAndCustomClass();
@ -78,7 +80,7 @@ public class JAXBResponseParserAnnotationExpectTest extends
public String jaxbGetWithTransformer(); public String jaxbGetWithTransformer();
} }
public interface TestJAXBAsyncApi { public interface TestJAXBAsyncApi extends Closeable {
@GET @GET
@Path("/jaxb/annotation") @Path("/jaxb/annotation")
@JAXBResponseParser @JAXBResponseParser

View File

@ -21,6 +21,7 @@ package org.jclouds.rest.annotationparsing;
import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint; import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.Closeable;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Set; import java.util.Set;
@ -50,7 +51,7 @@ import com.google.inject.name.Names;
@Test(groups = "unit", testName = "ProvidesAnnotationExpectTest") @Test(groups = "unit", testName = "ProvidesAnnotationExpectTest")
public class ProvidesAnnotationExpectTest extends BaseRestClientExpectTest<ProvidesAnnotationExpectTest.ProvidingApi> { public class ProvidesAnnotationExpectTest extends BaseRestClientExpectTest<ProvidesAnnotationExpectTest.ProvidingApi> {
static interface ProvidingApi { static interface ProvidingApi extends Closeable {
@Provides @Provides
Set<String> set(); Set<String> set();
@ -67,7 +68,7 @@ public class ProvidesAnnotationExpectTest extends BaseRestClientExpectTest<Provi
Set<String> noSuchElementException(); Set<String> noSuchElementException();
} }
static interface ProvidingAsyncApi { static interface ProvidingAsyncApi extends Closeable {
@Provides @Provides
Set<String> set(); Set<String> set();

View File

@ -28,6 +28,7 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail; import static org.testng.Assert.fail;
import java.io.Closeable;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -175,7 +176,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
} }
@Path("/client/{jclouds.api-version}") @Path("/client/{jclouds.api-version}")
public static interface AsyncCallee { public static interface AsyncCallee extends Closeable {
@GET @GET
@Path("/{path}") @Path("/{path}")
ListenableFuture<Void> onePath(@PathParam("path") String path); ListenableFuture<Void> onePath(@PathParam("path") String path);
@ -189,7 +190,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
} }
@Endpoint(Localhost2.class) @Endpoint(Localhost2.class)
public static interface Caller { public static interface Caller extends Closeable {
// tests that we can pull from suppliers // tests that we can pull from suppliers
@Provides @Provides
@ -213,7 +214,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
public Callee getCalleeWithPath(@EndpointParam URI endpoint, @PathParam("wibble") String wibble); public Callee getCalleeWithPath(@EndpointParam URI endpoint, @PathParam("wibble") String wibble);
} }
public static interface Callee { public static interface Callee extends Closeable {
void onePath(String path); void onePath(String path);
} }
@ -221,7 +222,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest {
void onePath(String path); void onePath(String path);
} }
public static interface AsyncCaller { public static interface AsyncCaller extends Closeable {
@Provides @Provides
@Localhost2 @Localhost2
URI getURI(); URI getURI();