From 04fad88fd3d08c9b3c68731b1645f93f9426cb8d Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Fri, 12 Apr 2013 14:58:26 -0700 Subject: [PATCH] Remove duplicate Utils getters Rename callers as required. --- .../jclouds/blobstore/BlobStoreContext.java | 6 -- .../internal/BlobStoreContextImpl.java | 5 -- .../compute/ComputeServiceContext.java | 5 -- .../internal/ComputeServiceContextImpl.java | 5 -- core/src/main/java/org/jclouds/Context.java | 5 -- .../org/jclouds/internal/ContextImpl.java | 8 -- .../src/main/java/org/jclouds/rest/Utils.java | 74 ------------------- .../org/jclouds/rest/internal/UtilsImpl.java | 64 +--------------- .../org/jclouds/gae/GaeSocketOpenTest.java | 2 +- .../LoadBalancerServiceContext.java | 6 -- .../LoadBalancerServiceContextImpl.java | 5 -- .../AWSEC2ImageExtensionLiveTest.java | 4 +- 12 files changed, 4 insertions(+), 185 deletions(-) diff --git a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java index fa2cc2b539..67c45ef206 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java @@ -122,12 +122,6 @@ public interface BlobStoreContext extends Closeable, View { @Deprecated ConsistencyModel getConsistencyModel(); - - Utils getUtils(); - - /** - * @see #getUtils - */ Utils utils(); /** diff --git a/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java b/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java index ba16fcad33..d6bcb72883 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java @@ -103,11 +103,6 @@ public class BlobStoreContextImpl extends BaseView implements BlobStoreContext { return ablobStore; } - @Override - public Utils getUtils() { - return utils(); - } - @Override public Utils utils() { return utils; diff --git a/compute/src/main/java/org/jclouds/compute/ComputeServiceContext.java b/compute/src/main/java/org/jclouds/compute/ComputeServiceContext.java index 65b094a2c2..510b9b1798 100644 --- a/compute/src/main/java/org/jclouds/compute/ComputeServiceContext.java +++ b/compute/src/main/java/org/jclouds/compute/ComputeServiceContext.java @@ -37,11 +37,6 @@ public interface ComputeServiceContext extends Closeable, View { ComputeService getComputeService(); - Utils getUtils(); - - /** - * @see #getUtils - */ Utils utils(); @Override diff --git a/compute/src/main/java/org/jclouds/compute/internal/ComputeServiceContextImpl.java b/compute/src/main/java/org/jclouds/compute/internal/ComputeServiceContextImpl.java index a5aaf956b7..9d49b030e8 100644 --- a/compute/src/main/java/org/jclouds/compute/internal/ComputeServiceContextImpl.java +++ b/compute/src/main/java/org/jclouds/compute/internal/ComputeServiceContextImpl.java @@ -58,11 +58,6 @@ public class ComputeServiceContextImpl extends BaseView implements ComputeServic delegate().close(); } - @Override - public Utils getUtils() { - return utils(); - } - @Override public Utils utils() { return utils; diff --git a/core/src/main/java/org/jclouds/Context.java b/core/src/main/java/org/jclouds/Context.java index 5236a093c1..06c1a91bc5 100644 --- a/core/src/main/java/org/jclouds/Context.java +++ b/core/src/main/java/org/jclouds/Context.java @@ -61,11 +61,6 @@ public interface Context extends Location, Closeable { */ String getIdentity(); - Utils getUtils(); - - /** - * @see #getUtils - */ Utils utils(); /** diff --git a/core/src/main/java/org/jclouds/internal/ContextImpl.java b/core/src/main/java/org/jclouds/internal/ContextImpl.java index cd5eef88cc..11d7e52f57 100644 --- a/core/src/main/java/org/jclouds/internal/ContextImpl.java +++ b/core/src/main/java/org/jclouds/internal/ContextImpl.java @@ -98,14 +98,6 @@ public class ContextImpl implements Context { return creds.get().identity; } - /** - * {@inheritDoc} - */ - @Override - public Utils getUtils() { - return utils(); - } - @Override public Utils utils() { return utils; diff --git a/core/src/main/java/org/jclouds/rest/Utils.java b/core/src/main/java/org/jclouds/rest/Utils.java index 6104163d81..a927d76b20 100644 --- a/core/src/main/java/org/jclouds/rest/Utils.java +++ b/core/src/main/java/org/jclouds/rest/Utils.java @@ -60,58 +60,22 @@ public interface Utils { * */ @Beta - Map getCredentialStore(); - - /** - * @see ComputeServiceContext#getCredentialStore - */ - @Beta Map credentialStore(); - - Json getJson(); - /** - * #see #getJson - */ Json json(); /** * * @deprecated will be removed in jclouds 1.7, as async interfaces are no * longer supported. - * @see #getHttpClient() - */ - @Deprecated - HttpAsyncClient getHttpAsyncClient(); - - /** - * - * @deprecated will be removed in jclouds 1.7, as async interfaces are no - * longer supported. - * @see #http() */ @Deprecated HttpAsyncClient asyncHttp(); - HttpClient getHttpClient(); - - /** - * #see #getHttpClient - */ HttpClient http(); - Crypto getCrypto(); - - /** - * #see #getCrypto - */ Crypto crypto(); - DateService getDateService(); - - /** - * #see #getDateService - */ DateService date(); /** @@ -119,15 +83,6 @@ public interface Utils { * longer supported. */ @Deprecated - ListeningExecutorService getUserExecutor(); - - /** - * #see #getUserExecutor - * - * @deprecated will be removed in jclouds 1.7, as async interfaces are no - * longer supported. - */ - @Deprecated ListeningExecutorService userExecutor(); /** @@ -135,44 +90,15 @@ public interface Utils { * longer supported. */ @Deprecated - ListeningExecutorService getIoExecutor(); - - /** - * #see #getIoExecutor - * - * @deprecated will be removed in jclouds 1.7, as async interfaces are no - * longer supported. - */ - @Deprecated ListeningExecutorService ioExecutor(); - @Beta - EventBus getEventBus(); - EventBus eventBus(); - LoggerFactory getLoggerFactory(); - - /** - * #see #getLoggerFactory - */ LoggerFactory loggerFactory(); - - @Beta - Injector getInjector(); - - /** - * #see #getInjector - */ @Beta Injector injector(); - - XMLParser getXml(); - /** - * #see #getXml - */ XMLParser xml(); } diff --git a/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java b/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java index 5dd2bb1f39..1552085d9d 100644 --- a/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java +++ b/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java @@ -93,42 +93,11 @@ public class UtilsImpl implements Utils { return encryption; } - @Override - public DateService getDateService() { - return date; - } - - @Override - public Crypto getCrypto() { - return encryption; - } - - @Override - @Deprecated - public org.jclouds.rest.HttpAsyncClient getHttpAsyncClient() { - return simpleAsyncClient; - } - - @Override - public HttpClient getHttpClient() { - return simpleClient; - } - @Override public HttpClient http() { return simpleClient; } - @Override - public ListeningExecutorService getIoExecutor() { - return ioExecutor; - } - - @Override - public ListeningExecutorService getUserExecutor() { - return userExecutor; - } - @Override public ListeningExecutorService ioExecutor() { return ioExecutor; @@ -139,51 +108,25 @@ public class UtilsImpl implements Utils { return userExecutor; } - @Override - public EventBus getEventBus() { - return eventBus; - } - @Override public EventBus eventBus() { return eventBus; } - - @Override - public LoggerFactory getLoggerFactory() { - return loggerFactory; - } @Override public LoggerFactory loggerFactory() { return loggerFactory; } - @Override - public Json getJson() { - return json; - } - @Override public Json json() { return json; } - @Override - @Beta - public Injector getInjector() { - return injector; - } - @Override @Beta public Injector injector() { - return getInjector(); - } - - @Override - public XMLParser getXml() { - return xml; + return injector; } @Override @@ -196,9 +139,4 @@ public class UtilsImpl implements Utils { return credentialStore; } - @Override - public Map getCredentialStore() { - return credentialStore; - } - } diff --git a/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java b/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java index 64ff091161..532fba66c2 100644 --- a/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java +++ b/drivers/gae/src/test/java/org/jclouds/gae/GaeSocketOpenTest.java @@ -22,7 +22,7 @@ public class GaeSocketOpenTest { .modules(ImmutableSet.of(new GoogleAppEngineConfigurationModule())) .build(); - SocketOpen socketOpen = context.getUtils().getInjector().getInstance(SocketOpen.class); + SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class); socketOpen.apply(HostAndPort.fromParts("localhost", 22)); } } diff --git a/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContext.java b/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContext.java index 1ea0345faf..4fbda28ebc 100644 --- a/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContext.java +++ b/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContext.java @@ -38,12 +38,6 @@ public interface LoadBalancerServiceContext extends Closeable, View { LoadBalancerService getLoadBalancerService(); - - Utils getUtils(); - - /** - * @see #getUtils - */ Utils utils(); @Override diff --git a/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java b/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java index f9a8eefd16..57a20490e0 100644 --- a/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java +++ b/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java @@ -54,11 +54,6 @@ public class LoadBalancerServiceContextImpl extends BaseView implements LoadBala return loadBalancerService; } - @Override - public Utils getUtils() { - return utils(); - } - @Override public Utils utils() { return utils; diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java index 7c4163ed27..d1940cfeb8 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java @@ -48,11 +48,11 @@ public class AWSEC2ImageExtensionLiveTest extends BaseImageExtensionLiveTest { @Override protected Iterable listImages() { - AWSEC2Client client = view.utils().getInjector().getInstance(AWSEC2Client.class); + AWSEC2Client client = view.utils().injector().getInstance(AWSEC2Client.class); String[] parts = AWSUtils.parseHandle(imageId); String region = parts[0]; String imageId = parts[1]; - EC2ImageParser parser = view.utils().getInjector().getInstance(EC2ImageParser.class); + EC2ImageParser parser = view.utils().injector().getInstance(EC2ImageParser.class); return transform( client.getAMIServices().describeImagesInRegion(region, new DescribeImagesOptions().imageIds(imageId)), parser);