Skip to content
This repository has been archived by the owner on Mar 25, 2018. It is now read-only.

Commit

Permalink
Remove duplicate Utils getters
Browse files Browse the repository at this point in the history
Rename callers as required.
  • Loading branch information
Andrew Gaul committed Apr 12, 2013
1 parent 6031400 commit 04fad88
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 185 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ public interface BlobStoreContext extends Closeable, View {
@Deprecated
ConsistencyModel getConsistencyModel();


Utils getUtils();

/**
* @see #getUtils
*/
Utils utils();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ public AsyncBlobStore getAsyncBlobStore() {
return ablobStore;
}

@Override
public Utils getUtils() {
return utils();
}

@Override
public Utils utils() {
return utils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ public interface ComputeServiceContext extends Closeable, View {

ComputeService getComputeService();

Utils getUtils();

/**
* @see #getUtils
*/
Utils utils();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ public void close() {
delegate().close();
}

@Override
public Utils getUtils() {
return utils();
}

@Override
public Utils utils() {
return utils;
Expand Down
5 changes: 0 additions & 5 deletions core/src/main/java/org/jclouds/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ public interface Context extends Location, Closeable {
*/
String getIdentity();

Utils getUtils();

/**
* @see #getUtils
*/
Utils utils();

/**
Expand Down
8 changes: 0 additions & 8 deletions core/src/main/java/org/jclouds/internal/ContextImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ public String getIdentity() {
return creds.get().identity;
}

/**
* {@inheritDoc}
*/
@Override
public Utils getUtils() {
return utils();
}

@Override
public Utils utils() {
return utils;
Expand Down
74 changes: 0 additions & 74 deletions core/src/main/java/org/jclouds/rest/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,119 +60,45 @@ public interface Utils {
* </ul>
*/
@Beta
Map<String, Credentials> getCredentialStore();

/**
* @see ComputeServiceContext#getCredentialStore
*/
@Beta
Map<String, Credentials> 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();

/**
* @deprecated will be removed in jclouds 1.7, as async interfaces are no
* 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();

/**
* @deprecated will be removed in jclouds 1.7, as async interfaces are no
* 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();

}
64 changes: 1 addition & 63 deletions core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,42 +93,11 @@ public Crypto crypto() {
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;
Expand All @@ -139,51 +108,25 @@ public ListeningExecutorService userExecutor() {
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
Expand All @@ -196,9 +139,4 @@ public Map<String, Credentials> credentialStore() {
return credentialStore;
}

@Override
public Map<String, Credentials> getCredentialStore() {
return credentialStore;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void testSocketOpenThrowsUnsupported() {
.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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ public interface LoadBalancerServiceContext extends Closeable, View {

LoadBalancerService getLoadBalancerService();


Utils getUtils();

/**
* @see #getUtils
*/
Utils utils();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ public LoadBalancerService getLoadBalancerService() {
return loadBalancerService;
}

@Override
public Utils getUtils() {
return utils();
}

@Override
public Utils utils() {
return utils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public AWSEC2ImageExtensionLiveTest() {

@Override
protected Iterable<? extends Image> 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);
Expand Down

0 comments on commit 04fad88

Please sign in to comment.