diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java index 5abf2f07a2..6436c7a92a 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosAsyncClient.java @@ -20,6 +20,7 @@ package org.jclouds.atmos; import static com.google.common.net.HttpHeaders.EXPECT; +import java.io.Closeable; import java.net.URI; import javax.inject.Named; @@ -77,7 +78,7 @@ import com.google.inject.Provides; */ @RequestFilters(SignRequest.class) @Path("/rest/namespace") -public interface AtmosAsyncClient { +public interface AtmosAsyncClient extends Closeable { /** * Creates a default implementation of AtmosObject */ diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java index 13a3ee5a26..d392c880a9 100644 --- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java +++ b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.atmos; +import java.io.Closeable; import java.net.URI; import org.jclouds.atmos.domain.AtmosObject; import org.jclouds.atmos.domain.BoundedSet; @@ -38,7 +39,7 @@ import com.google.inject.Provides; * @see * @author Adrian Cole */ -public interface AtmosClient { +public interface AtmosClient extends Closeable { /** * Creates a default implementation of AtmosObject */ diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/internal/StubAtmosAsyncClient.java b/apis/atmos/src/test/java/org/jclouds/atmos/internal/StubAtmosAsyncClient.java index 5c8bb91bda..f0dd4f22dd 100644 --- a/apis/atmos/src/test/java/org/jclouds/atmos/internal/StubAtmosAsyncClient.java +++ b/apis/atmos/src/test/java/org/jclouds/atmos/internal/StubAtmosAsyncClient.java @@ -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.immediateFuture; +import java.io.IOException; import java.net.URI; 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.functions.HttpGetOptionsListToGetOptions; import org.jclouds.http.options.GetOptions; +import org.jclouds.lifecycle.Closer; import com.google.common.base.Function; import com.google.common.base.Throwables; @@ -69,13 +71,14 @@ public class StubAtmosAsyncClient implements AtmosAsyncClient { private final ListOptionsToBlobStoreListOptions container2ContainerListOptions; private final ResourceMetadataListToDirectoryEntryList resource2ObjectList; private final ListeningExecutorService userExecutor; + private final Closer closer; @Inject private StubAtmosAsyncClient(LocalAsyncBlobStore blobStore, AtmosObject.Factory objectProvider, HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object, BlobMetadataToObject blob2ObjectInfo, ListOptionsToBlobStoreListOptions container2ContainerListOptions, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, - ResourceMetadataListToDirectoryEntryList resource2ContainerList) { + ResourceMetadataListToDirectoryEntryList resource2ContainerList, Closer closer) { this.blobStore = blobStore; this.objectProvider = objectProvider; this.httpGetOptionsConverter = httpGetOptionsConverter; @@ -86,6 +89,7 @@ public class StubAtmosAsyncClient implements AtmosAsyncClient { "container2ContainerListOptions"); this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList"); this.userExecutor = userExecutor; + this.closer = checkNotNull(closer, "closer"); } @Override @@ -245,4 +249,8 @@ public class StubAtmosAsyncClient implements AtmosAsyncClient { throw new UnsupportedOperationException(); } + @Override + public void close() throws IOException { + closer.close(); + } } diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java index aecd7d6ec7..742a9fa67d 100644 --- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java +++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.cloudservers; +import java.io.Closeable; import java.util.Set; import java.util.concurrent.ExecutionException; @@ -76,7 +77,7 @@ import com.google.common.util.concurrent.ListenableFuture; */ @RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class }) @Endpoint(Compute.class) -public interface CloudServersAsyncClient { +public interface CloudServersAsyncClient extends Closeable { /** * @see CloudServersClient#getLimits diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java index 3ccf92662c..f8c688faa5 100644 --- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java +++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.cloudservers; +import java.io.Closeable; import java.util.Set; import javax.ws.rs.PathParam; @@ -44,7 +45,7 @@ import org.jclouds.cloudservers.options.RebuildServerOptions; * @see * @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 * capacity and prevent abuse of the system. The system recognizes two kinds of limits: rate diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java index 068d9d1497..0d5b0a877f 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.cloudsigma; +import java.io.Closeable; import java.util.Set; import javax.ws.rs.Consumes; @@ -75,7 +76,7 @@ import com.google.common.util.concurrent.ListenableFuture; */ @RequestFilters(BasicAuthentication.class) @Consumes(MediaType.TEXT_PLAIN) -public interface CloudSigmaAsyncClient { +public interface CloudSigmaAsyncClient extends Closeable { /** * @see CloudSigmaClient#listStandardDrives diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaClient.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaClient.java index 5be68bcd1b..1db2bbcde9 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaClient.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.cloudsigma; +import java.io.Closeable; import java.util.Set; import org.jclouds.cloudsigma.domain.Drive; @@ -38,7 +39,7 @@ import org.jclouds.cloudsigma.options.CloneDriveOptions; * @see * @author Adrian Cole */ -public interface CloudSigmaClient { +public interface CloudSigmaClient extends Closeable { /** * Get profile info diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchApi.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchApi.java index 79a2494cec..100dbd3229 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchApi.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.cloudwatch; +import java.io.Closeable; import java.util.Set; import org.jclouds.cloudwatch.features.MetricApi; @@ -37,7 +38,7 @@ import com.google.inject.Provides; * /> * @author Adrian Cole */ -public interface CloudWatchApi { +public interface CloudWatchApi extends Closeable { /** * * @return the Region codes configured diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncApi.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncApi.java index a5d9fd98c6..b98745132b 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncApi.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/CloudWatchAsyncApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.cloudwatch; +import java.io.Closeable; import java.util.Set; import org.jclouds.cloudwatch.features.MetricAsyncApi; @@ -38,7 +39,7 @@ import com.google.inject.Provides; * /> * @author Adrian Cole */ -public interface CloudWatchAsyncApi { +public interface CloudWatchAsyncApi extends Closeable { /** * * @return the Region codes configured diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/EC2Api.java b/apis/ec2/src/main/java/org/jclouds/ec2/EC2Api.java index cb89cc3816..09e3b41bc2 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/EC2Api.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/EC2Api.java @@ -18,6 +18,7 @@ */ package org.jclouds.ec2; +import java.io.Closeable; import java.util.Set; import org.jclouds.ec2.features.SubnetApi; import org.jclouds.ec2.features.TagApi; @@ -50,7 +51,7 @@ import com.google.inject.Provides; * @author Adrian Cole * @see EC2AsyncApi */ -public interface EC2Api { +public interface EC2Api extends Closeable { /** * * @return the Region codes configured diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/EC2AsyncApi.java b/apis/ec2/src/main/java/org/jclouds/ec2/EC2AsyncApi.java index e9f77c210f..f5520a3cab 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/EC2AsyncApi.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/EC2AsyncApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.ec2; +import java.io.Closeable; import java.util.Set; import org.jclouds.ec2.features.SubnetAsyncApi; @@ -38,7 +39,7 @@ import com.google.inject.Provides; * * @author Adrian Cole */ -public interface EC2AsyncApi { +public interface EC2AsyncApi extends Closeable { /** * * @return the Region codes configured diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackAsyncClient.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackAsyncClient.java index 127e338907..cdda738e9e 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackAsyncClient.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackAsyncClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.elasticstack; +import java.io.Closeable; import java.util.Set; import javax.ws.rs.Consumes; @@ -64,7 +65,7 @@ import com.google.common.util.concurrent.ListenableFuture; */ @RequestFilters(BasicAuthentication.class) @Consumes(MediaType.TEXT_PLAIN) -public interface ElasticStackAsyncClient { +public interface ElasticStackAsyncClient extends Closeable { /** * @see ElasticStackClient#listServers() diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackClient.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackClient.java index db3119a123..fcd1f44c95 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackClient.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/ElasticStackClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.elasticstack; +import java.io.Closeable; import java.util.Set; import org.jclouds.elasticstack.domain.Drive; import org.jclouds.elasticstack.domain.DriveData; @@ -35,7 +36,7 @@ import org.jclouds.io.Payload; * @see * @author Adrian Cole */ -public interface ElasticStackClient { +public interface ElasticStackClient extends Closeable { /** * list of server uuids in your account * diff --git a/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderApi.java b/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderApi.java index 688d02e7d6..ae6ee25389 100644 --- a/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderApi.java +++ b/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.openstack.cinder.v1; +import java.io.Closeable; import java.util.Set; import org.jclouds.javax.annotation.Nullable; import org.jclouds.location.Zone; @@ -38,7 +39,7 @@ import com.google.inject.Provides; * @see API Doc * @author Everett Toews */ -public interface CinderApi { +public interface CinderApi extends Closeable { /** * @return the Zone codes configured */ diff --git a/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderAsyncApi.java b/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderAsyncApi.java index 10f951b4cc..4b1ab3bdcf 100644 --- a/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderAsyncApi.java +++ b/apis/openstack-cinder/src/main/java/org/jclouds/openstack/cinder/v1/CinderAsyncApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.openstack.cinder.v1; +import java.io.Closeable; import java.util.Set; import org.jclouds.javax.annotation.Nullable; @@ -39,7 +40,7 @@ import com.google.inject.Provides; * @see API Doc * @author Everett Toews */ -public interface CinderAsyncApi { +public interface CinderAsyncApi extends Closeable { /** * @return the Zone codes configured */ diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApi.java index 259e8bff0a..8a97f976c3 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApi.java @@ -18,6 +18,8 @@ */ 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.features.ServiceApi; import org.jclouds.openstack.keystone.v2_0.features.TenantApi; @@ -36,7 +38,7 @@ import com.google.common.base.Optional; * @see * @see KeystoneAsyncApi */ -public interface KeystoneApi { +public interface KeystoneApi extends Closeable { /** * Discover API version information, links to documentation (PDF, HTML, WADL), and supported media types diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java index 7ddb962cb3..be6573d072 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.openstack.keystone.v2_0; +import java.io.Closeable; + import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.core.MediaType; @@ -44,7 +46,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @see KeystoneApi */ -public interface KeystoneAsyncApi { +public interface KeystoneAsyncApi extends Closeable { /** * @see KeystoneApi#getApiMetadata() diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/ProviderModuleExpectTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/ProviderModuleExpectTest.java index 6d90429d27..21705c99f9 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/ProviderModuleExpectTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/config/ProviderModuleExpectTest.java @@ -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.testng.Assert.assertTrue; +import java.io.Closeable; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.net.URI; @@ -62,12 +63,12 @@ public class ProviderModuleExpectTest extends BaseRestApiExpectTest * @author Adrian Cole */ -public interface NovaApi { +public interface NovaApi extends Closeable { /** * * @return the Zone codes configured diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java index 7c956131ff..60804b0fef 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.openstack.nova.v2_0; +import java.io.Closeable; import java.util.Set; import org.jclouds.javax.annotation.Nullable; @@ -57,7 +58,7 @@ import com.google.inject.Provides; * /> * @author Adrian Cole */ -public interface NovaAsyncApi { +public interface NovaAsyncApi extends Closeable { /** * diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersApi.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersApi.java index f60fa2b306..edd433d068 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersApi.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.rackspace.cloudloadbalancers.v1; +import java.io.Closeable; import java.util.Set; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -48,7 +49,7 @@ import com.google.inject.Provides; * @see CloudLoadBalancersAsyncApi * @author Adrian Cole */ -public interface CloudLoadBalancersApi { +public interface CloudLoadBalancersApi extends Closeable { /** * @return the Zone codes configured */ diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersAsyncApi.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersAsyncApi.java index 9ff160e8bd..2dc9886661 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersAsyncApi.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/CloudLoadBalancersAsyncApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.rackspace.cloudloadbalancers.v1; +import java.io.Closeable; import java.util.Set; import javax.ws.rs.Path; @@ -49,7 +50,7 @@ import com.google.inject.Provides; * @see CloudLoadBalancersApi * @author Adrian Cole */ -public interface CloudLoadBalancersAsyncApi { +public interface CloudLoadBalancersAsyncApi extends Closeable { /** * @return the Zone codes configured */ diff --git a/apis/route53/src/main/java/org/jclouds/route53/Route53Api.java b/apis/route53/src/main/java/org/jclouds/route53/Route53Api.java index 74f290e803..4909226ea9 100644 --- a/apis/route53/src/main/java/org/jclouds/route53/Route53Api.java +++ b/apis/route53/src/main/java/org/jclouds/route53/Route53Api.java @@ -18,6 +18,8 @@ */ package org.jclouds.route53; +import java.io.Closeable; + import javax.ws.rs.PathParam; import org.jclouds.rest.annotations.Delegate; @@ -34,7 +36,7 @@ import org.jclouds.route53.features.HostedZoneApi; * /> * @author Adrian Cole */ -public interface Route53Api { +public interface Route53Api extends Closeable { /** * returns the current status of a change batch request. diff --git a/apis/route53/src/main/java/org/jclouds/route53/Route53AsyncApi.java b/apis/route53/src/main/java/org/jclouds/route53/Route53AsyncApi.java index 040bb2d236..e991bda41b 100644 --- a/apis/route53/src/main/java/org/jclouds/route53/Route53AsyncApi.java +++ b/apis/route53/src/main/java/org/jclouds/route53/Route53AsyncApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.route53; +import java.io.Closeable; + import javax.inject.Named; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -48,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture; @RequestFilters(RestAuthentication.class) @VirtualHost @Path("/{jclouds.api-version}") -public interface Route53AsyncApi { +public interface Route53AsyncApi extends Closeable { /** * @see Route53Api#getChange() diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java b/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java index bd1d321439..8a2677f252 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java +++ b/apis/s3/src/main/java/org/jclouds/s3/S3AsyncClient.java @@ -21,6 +21,7 @@ package org.jclouds.s3; import static com.google.common.net.HttpHeaders.EXPECT; import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER; +import java.io.Closeable; import java.util.Set; import java.util.concurrent.ExecutionException; @@ -108,7 +109,7 @@ import com.google.inject.Provides; */ @RequestFilters(RequestAuthorizeSignature.class) @BlobScope(CONTAINER) -public interface S3AsyncClient { +public interface S3AsyncClient extends Closeable { public static final String VERSION = "2006-03-01"; /** diff --git a/apis/s3/src/main/java/org/jclouds/s3/S3Client.java b/apis/s3/src/main/java/org/jclouds/s3/S3Client.java index 5b388c1654..cdebb155c2 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/S3Client.java +++ b/apis/s3/src/main/java/org/jclouds/s3/S3Client.java @@ -18,6 +18,7 @@ */ package org.jclouds.s3; +import java.io.Closeable; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -49,7 +50,7 @@ import com.google.inject.Provides; * @author James Murty * @see */ -public interface S3Client { +public interface S3Client extends Closeable { /** * Creates a default implementation of S3Object diff --git a/apis/s3/src/test/java/org/jclouds/s3/internal/StubS3AsyncClient.java b/apis/s3/src/test/java/org/jclouds/s3/internal/StubS3AsyncClient.java index 7c0c63fc6d..f06b299231 100644 --- a/apis/s3/src/test/java/org/jclouds/s3/internal/StubS3AsyncClient.java +++ b/apis/s3/src/test/java/org/jclouds/s3/internal/StubS3AsyncClient.java @@ -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.transform; +import java.io.IOException; import java.util.Date; import java.util.Map; import java.util.Set; @@ -50,6 +51,7 @@ import org.jclouds.domain.LocationBuilder; import org.jclouds.domain.LocationScope; import org.jclouds.http.options.GetOptions; import org.jclouds.javax.annotation.Nullable; +import org.jclouds.lifecycle.Closer; import org.jclouds.s3.S3AsyncClient; import org.jclouds.s3.blobstore.S3AsyncBlobStore; import org.jclouds.s3.blobstore.functions.BlobToObject; @@ -100,6 +102,7 @@ public class StubS3AsyncClient implements S3AsyncClient { private final ConcurrentMap> containerToBlobs; private final ConcurrentMap containerToLocation; private final ListeningExecutorService userExecutor; + private final Closer closer; @Inject private StubS3AsyncClient(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, @@ -108,7 +111,7 @@ public class StubS3AsyncClient implements S3AsyncClient { S3Object.Factory objectProvider, Blob.Factory blobProvider, HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object, BlobToObjectMetadata blob2ObjectMetadata, BucketToContainerListOptions bucket2ContainerListOptions, - ResourceToBucketList resource2BucketList) { + ResourceToBucketList resource2BucketList, Closer closer) { this.userExecutor = userExecutor; this.containerToBlobs = containerToBlobs; this.containerToLocation = containerToLocation; @@ -122,6 +125,7 @@ public class StubS3AsyncClient implements S3AsyncClient { this.blob2ObjectMetadata = checkNotNull(blob2ObjectMetadata, "blob2ObjectMetadata"); this.bucket2ContainerListOptions = checkNotNull(bucket2ContainerListOptions, "bucket2ContainerListOptions"); this.resource2BucketList = checkNotNull(resource2BucketList, "resource2BucketList"); + this.closer = checkNotNull(closer, "closer"); } public static final String TEST_ACL_ID = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c"; @@ -336,4 +340,9 @@ public class StubS3AsyncClient implements S3AsyncClient { return immediateFuture(containerToBlobs.get(bucketName).containsKey(key)); } + @Override + public void close() throws IOException { + closer.close(); + } + } diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/SQSApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/SQSApi.java index dc67d6db0b..5b63ad22a4 100644 --- a/apis/sqs/src/main/java/org/jclouds/sqs/SQSApi.java +++ b/apis/sqs/src/main/java/org/jclouds/sqs/SQSApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.sqs; +import java.io.Closeable; import java.net.URI; import java.util.Set; import org.jclouds.javax.annotation.Nullable; @@ -40,7 +41,7 @@ import com.google.inject.Provides; * @see SQSAsyncApi */ @Beta -public interface SQSApi { +public interface SQSApi extends Closeable { /** * diff --git a/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java b/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java index c9a8f0ed56..94cb518e30 100644 --- a/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java +++ b/apis/sqs/src/main/java/org/jclouds/sqs/SQSAsyncApi.java @@ -18,6 +18,7 @@ */ package org.jclouds.sqs; +import java.io.Closeable; import java.net.URI; import java.util.Set; @@ -48,7 +49,7 @@ import com.google.inject.Provides; @Beta @RequestFilters(FormSigner.class) @VirtualHost -public interface SQSAsyncApi { +public interface SQSAsyncApi extends Closeable { /** * * @return the Region codes configured diff --git a/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java b/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java index 585c3efd5b..25594ae0b6 100644 --- a/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java +++ b/apis/sqs/src/test/java/org/jclouds/sqs/features/PermissionApiLiveTest.java @@ -23,6 +23,7 @@ import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToA import static org.jclouds.sqs.reference.SQSParameters.ACTION; import static org.testng.Assert.assertEquals; +import java.io.Closeable; import java.net.URI; import javax.ws.rs.POST; @@ -62,11 +63,11 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest { recreateQueueInRegion(prefix, null); } - static interface AnonymousAttributesApi { + static interface AnonymousAttributesApi extends Closeable { String getQueueArn(); } - static interface AnonymousAttributesAsyncApi { + static interface AnonymousAttributesAsyncApi extends Closeable { @POST @Path("/") @FormParams(keys = { ACTION, "AttributeName.1" }, values = { "GetQueueAttributes", "QueueArn" }) diff --git a/apis/sts/src/main/java/org/jclouds/sts/STSApi.java b/apis/sts/src/main/java/org/jclouds/sts/STSApi.java index 65221d199c..5211af166b 100644 --- a/apis/sts/src/main/java/org/jclouds/sts/STSApi.java +++ b/apis/sts/src/main/java/org/jclouds/sts/STSApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.sts; +import java.io.Closeable; + import org.jclouds.aws.domain.SessionCredentials; import org.jclouds.sts.domain.User; import org.jclouds.sts.domain.UserAndSessionCredentials; @@ -33,7 +35,7 @@ import org.jclouds.sts.options.SessionCredentialsOptions; * @see * @author Adrian Cole */ -public interface STSApi { +public interface STSApi extends Closeable { /** * Returns a set of temporary credentials for an AWS account or IAM user, * with a default timeout diff --git a/apis/sts/src/main/java/org/jclouds/sts/STSAsyncApi.java b/apis/sts/src/main/java/org/jclouds/sts/STSAsyncApi.java index 35d1463cb7..b841100107 100644 --- a/apis/sts/src/main/java/org/jclouds/sts/STSAsyncApi.java +++ b/apis/sts/src/main/java/org/jclouds/sts/STSAsyncApi.java @@ -18,6 +18,8 @@ */ package org.jclouds.sts; +import java.io.Closeable; + import javax.inject.Named; import javax.ws.rs.FormParam; import javax.ws.rs.POST; @@ -47,7 +49,7 @@ import com.google.common.util.concurrent.ListenableFuture; */ @RequestFilters(FormSigner.class) @VirtualHost -public interface STSAsyncApi { +public interface STSAsyncApi extends Closeable { /** * @see STSApi#createTemporaryCredentials() diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java index d867afb522..e7c744ceaf 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftAsyncClient.java @@ -20,6 +20,7 @@ package org.jclouds.openstack.swift; import static com.google.common.net.HttpHeaders.EXPECT; +import java.io.Closeable; import java.util.Map; import java.util.Set; @@ -79,7 +80,7 @@ import com.google.inject.Provides; * @see * @author Adrian Cole */ -public interface CommonSwiftAsyncClient { +public interface CommonSwiftAsyncClient extends Closeable { @Provides SwiftObject newSwiftObject(); diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java index 6c632ecd33..09bdd06ea9 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/CommonSwiftClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.openstack.swift; +import java.io.Closeable; import java.util.Map; import java.util.Set; import org.jclouds.blobstore.domain.PageSet; @@ -38,7 +39,7 @@ import com.google.inject.Provides; * @see * @author Adrian Cole */ -public interface CommonSwiftClient { +public interface CommonSwiftClient extends Closeable { @Provides SwiftObject newSwiftObject(); diff --git a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java index 2e06138768..9693c4a905 100644 --- a/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java +++ b/apis/swift/src/test/java/org/jclouds/openstack/swift/internal/StubSwiftAsyncClient.java @@ -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.transform; +import java.io.IOException; import java.net.URI; import java.util.HashMap; import java.util.Map; @@ -40,6 +41,7 @@ import org.jclouds.blobstore.domain.StorageMetadata; import org.jclouds.blobstore.functions.HttpGetOptionsListToGetOptions; import org.jclouds.blobstore.options.ListContainerOptions; import org.jclouds.http.options.GetOptions; +import org.jclouds.lifecycle.Closer; import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.SwiftAsyncClient; import org.jclouds.openstack.swift.blobstore.functions.BlobToObject; @@ -77,6 +79,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient { private final ListContainerOptionsToBlobStoreListContainerOptions container2ContainerListOptions; private final ResourceToObjectList resource2ObjectList; private final ListeningExecutorService userExecutor; + private final Closer closer; @Inject private StubSwiftAsyncClient(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, @@ -84,7 +87,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient { SwiftObject.Factory objectProvider, HttpGetOptionsListToGetOptions httpGetOptionsConverter, ObjectToBlob object2Blob, BlobToObject blob2Object, ResourceToObjectInfo blob2ObjectInfo, ListContainerOptionsToBlobStoreListContainerOptions container2ContainerListOptions, - ResourceToObjectList resource2ContainerList) { + ResourceToObjectList resource2ContainerList, Closer closer) { this.userExecutor = userExecutor; this.blobStore = blobStore; this.objectProvider = objectProvider; @@ -95,6 +98,7 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient { this.container2ContainerListOptions = checkNotNull(container2ContainerListOptions, "container2ContainerListOptions"); this.resource2ObjectList = checkNotNull(resource2ContainerList, "resource2ContainerList"); + this.closer = checkNotNull(closer, "closer"); } public ListenableFuture containerExists(final String container) { @@ -217,4 +221,9 @@ public class StubSwiftAsyncClient implements CommonSwiftAsyncClient { public ListenableFuture objectExists(String bucketName, String key) { return blobStore.blobExists(bucketName, key); } + + @Override + public void close() throws IOException { + closer.close(); + } } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java index 7fb5498b7b..a9f81865ec 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudAsyncClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.vcloud; +import java.io.Closeable; + import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.vcloud.features.CatalogAsyncClient; @@ -39,7 +41,7 @@ import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest; * @author Adrian Cole */ @RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface VCloudAsyncClient { +public interface VCloudAsyncClient extends Closeable { /** * Provides asynchronous access to VApp Template features. diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudClient.java index d7e08806a7..11aa3cf5b1 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.vcloud; +import java.io.Closeable; + import org.jclouds.rest.annotations.Delegate; import org.jclouds.vcloud.features.CatalogClient; import org.jclouds.vcloud.features.NetworkClient; @@ -35,7 +37,7 @@ import org.jclouds.vcloud.features.VmClient; * @see * @author Adrian Cole */ -public interface VCloudClient { +public interface VCloudClient extends Closeable { /** * Provides asynchronous access to VApp Template features. * diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsAsyncClient.java index 2bce3b6f64..c9172b9a28 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsAsyncClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.vcloud; +import java.io.Closeable; import java.net.URI; import java.util.SortedMap; @@ -36,7 +37,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -public interface VCloudVersionsAsyncClient { +public interface VCloudVersionsAsyncClient extends Closeable { /** * Retrieve information for supported versions diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsClient.java index 617512db39..9c038e0d71 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/VCloudVersionsClient.java @@ -18,9 +18,10 @@ */ package org.jclouds.vcloud; +import java.io.Closeable; import java.net.URI; import java.util.SortedMap; -public interface VCloudVersionsClient { +public interface VCloudVersionsClient extends Closeable { SortedMap getSupportedVersions(); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClient.java index 0081e0e732..e24f241a6d 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginAsyncClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.vcloud.internal; +import java.io.Closeable; + import javax.ws.rs.Consumes; import javax.ws.rs.POST; @@ -40,7 +42,7 @@ import com.google.common.util.concurrent.ListenableFuture; */ @Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.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, diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginClient.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginClient.java index 7c383cc2f2..1bafb9b86e 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginClient.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/internal/VCloudLoginClient.java @@ -18,9 +18,11 @@ */ package org.jclouds.vcloud.internal; +import java.io.Closeable; + import org.jclouds.vcloud.domain.VCloudSession; -public interface VCloudLoginClient { +public interface VCloudLoginClient extends Closeable { VCloudSession login(); } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudAsyncClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudAsyncClient.java index b9ecf9b0cc..4323124637 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudAsyncClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudAsyncClient.java @@ -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.VDC_XML; +import java.io.Closeable; import java.net.URI; import java.util.Map; import java.util.Set; @@ -124,7 +125,7 @@ import com.google.inject.Provides; * @author Adrian Cole */ @RequestFilters(SetVCloudTokenCookie.class) -public interface TerremarkVCloudAsyncClient { +public interface TerremarkVCloudAsyncClient extends Closeable { /** * @see TerremarkVCloudClient#getCatalogItemInOrg diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudClient.java index 004fe55efb..64cc02700e 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/TerremarkVCloudClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.trmk.vcloud_0_8; +import java.io.Closeable; import java.net.URI; import java.util.Map; import java.util.Set; @@ -55,7 +56,7 @@ import com.google.inject.Provides; * /> * @author Adrian Cole */ -public interface TerremarkVCloudClient { +public interface TerremarkVCloudClient extends Closeable { Catalog getCatalog(URI catalogId); /** diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClient.java index e63b922380..e1f5a3bae6 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginAsyncClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.trmk.vcloud_0_8.internal; +import java.io.Closeable; + import javax.ws.rs.Consumes; 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) @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, diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginClient.java index 95328361f9..deee35c515 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudLoginClient.java @@ -18,9 +18,11 @@ */ package org.jclouds.trmk.vcloud_0_8.internal; +import java.io.Closeable; + import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession; -public interface TerremarkVCloudLoginClient { +public interface TerremarkVCloudLoginClient extends Closeable { VCloudSession login(); } diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClient.java index a4ecb1b37a..9e861cb51c 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsAsyncClient.java @@ -18,6 +18,7 @@ */ package org.jclouds.trmk.vcloud_0_8.internal; +import java.io.Closeable; import java.net.URI; import java.util.SortedMap; @@ -36,7 +37,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -public interface TerremarkVCloudVersionsAsyncClient { +public interface TerremarkVCloudVersionsAsyncClient extends Closeable { /** * Retrieve information for supported versions diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsClient.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsClient.java index 5e49e158a0..d9badbdb17 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsClient.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/internal/TerremarkVCloudVersionsClient.java @@ -18,9 +18,10 @@ */ package org.jclouds.trmk.vcloud_0_8.internal; +import java.io.Closeable; import java.net.URI; import java.util.SortedMap; -public interface TerremarkVCloudVersionsClient { +public interface TerremarkVCloudVersionsClient extends Closeable { SortedMap getSupportedVersions(); } diff --git a/core/src/test/java/org/jclouds/http/IntegrationTestAsyncClient.java b/core/src/test/java/org/jclouds/http/IntegrationTestAsyncClient.java index 17b9d2462f..07dbfcd3f7 100644 --- a/core/src/test/java/org/jclouds/http/IntegrationTestAsyncClient.java +++ b/core/src/test/java/org/jclouds/http/IntegrationTestAsyncClient.java @@ -20,6 +20,7 @@ package org.jclouds.http; import static com.google.common.util.concurrent.Futures.immediateFuture; +import java.io.Closeable; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -61,7 +62,7 @@ import com.google.inject.Provides; * @see IntegrationTestClient * @author Adrian Cole */ -public interface IntegrationTestAsyncClient { +public interface IntegrationTestAsyncClient extends Closeable { @Target({ ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @HttpMethod("ROWDY") diff --git a/core/src/test/java/org/jclouds/http/IntegrationTestClient.java b/core/src/test/java/org/jclouds/http/IntegrationTestClient.java index 551857977f..822abb12de 100644 --- a/core/src/test/java/org/jclouds/http/IntegrationTestClient.java +++ b/core/src/test/java/org/jclouds/http/IntegrationTestClient.java @@ -18,6 +18,8 @@ */ package org.jclouds.http; +import java.io.Closeable; + import org.jclouds.http.options.HttpRequestOptions; import org.jclouds.io.Payload; @@ -29,7 +31,7 @@ import com.google.inject.Provides; * * @author Adrian Cole */ -public interface IntegrationTestClient { +public interface IntegrationTestClient extends Closeable { String rowdy(String path); boolean exists(String path); diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java index f4a918cf12..04e83200d2 100644 --- a/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java +++ b/core/src/test/java/org/jclouds/rest/annotationparsing/JAXBResponseParserAnnotationExpectTest.java @@ -22,6 +22,8 @@ import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToA import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; +import java.io.Closeable; + import javax.ws.rs.Consumes; import javax.ws.rs.GET; 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 Object jaxbGetWithAnnotationAndCustomClass(); @@ -78,7 +80,7 @@ public class JAXBResponseParserAnnotationExpectTest extends public String jaxbGetWithTransformer(); } - public interface TestJAXBAsyncApi { + public interface TestJAXBAsyncApi extends Closeable { @GET @Path("/jaxb/annotation") @JAXBResponseParser diff --git a/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java b/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java index 88aab9d98b..d2056c598a 100644 --- a/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java +++ b/core/src/test/java/org/jclouds/rest/annotationparsing/ProvidesAnnotationExpectTest.java @@ -21,6 +21,7 @@ package org.jclouds.rest.annotationparsing; import static org.jclouds.providers.AnonymousProviderMetadata.forClientMappedToAsyncClientOnEndpoint; import static org.testng.Assert.assertEquals; +import java.io.Closeable; import java.util.NoSuchElementException; import java.util.Set; @@ -50,7 +51,7 @@ import com.google.inject.name.Names; @Test(groups = "unit", testName = "ProvidesAnnotationExpectTest") public class ProvidesAnnotationExpectTest extends BaseRestClientExpectTest { - static interface ProvidingApi { + static interface ProvidingApi extends Closeable { @Provides Set set(); @@ -67,7 +68,7 @@ public class ProvidesAnnotationExpectTest extends BaseRestClientExpectTest noSuchElementException(); } - static interface ProvidingAsyncApi { + static interface ProvidingAsyncApi extends Closeable { @Provides Set set(); diff --git a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java index 9134fc691b..4986c4c270 100644 --- a/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java +++ b/core/src/test/java/org/jclouds/rest/internal/RestAnnotationProcessorTest.java @@ -28,6 +28,7 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; import static org.testng.Assert.fail; +import java.io.Closeable; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -175,7 +176,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { } @Path("/client/{jclouds.api-version}") - public static interface AsyncCallee { + public static interface AsyncCallee extends Closeable { @GET @Path("/{path}") ListenableFuture onePath(@PathParam("path") String path); @@ -189,7 +190,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { } @Endpoint(Localhost2.class) - public static interface Caller { + public static interface Caller extends Closeable { // tests that we can pull from suppliers @Provides @@ -213,7 +214,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { public Callee getCalleeWithPath(@EndpointParam URI endpoint, @PathParam("wibble") String wibble); } - public static interface Callee { + public static interface Callee extends Closeable { void onePath(String path); } @@ -221,7 +222,7 @@ public class RestAnnotationProcessorTest extends BaseRestApiTest { void onePath(String path); } - public static interface AsyncCaller { + public static interface AsyncCaller extends Closeable { @Provides @Localhost2 URI getURI();