tidied syntax to get eventBus

This commit is contained in:
Adrian Cole 2012-02-19 09:39:20 +02:00
parent 6913ceff8a
commit d916bb25ac
3 changed files with 31 additions and 9 deletions

View File

@ -37,6 +37,7 @@ import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshClient.Factory;
import com.google.common.base.Function;
import com.google.common.eventbus.EventBus;
import com.google.inject.Inject;
/**
@ -50,11 +51,12 @@ public class UtilsImpl extends org.jclouds.rest.internal.UtilsImpl implements Ut
private final Function<NodeMetadata, SshClient> sshForNode;
@Inject
UtilsImpl(Injector injector, Json json, HttpClient simpleClient, HttpAsyncClient simpleAsyncClient, Crypto encryption,
DateService date, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads, LoggerFactory loggerFactory,
Function<NodeMetadata, SshClient> sshForNode) {
super(injector, json, simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads, loggerFactory);
UtilsImpl(Injector injector, Json json, HttpClient simpleClient, HttpAsyncClient simpleAsyncClient,
Crypto encryption, DateService date, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads, EventBus eventBus,
LoggerFactory loggerFactory, Function<NodeMetadata, SshClient> sshForNode) {
super(injector, json, simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads, eventBus,
loggerFactory);
this.sshForNode = sshForNode;
}

View File

@ -21,6 +21,7 @@ package org.jclouds.rest;
import java.util.concurrent.ExecutorService;
import com.google.common.annotations.Beta;
import com.google.common.eventbus.EventBus;
import com.google.inject.Injector;
import org.jclouds.crypto.Crypto;
import org.jclouds.date.DateService;
@ -88,6 +89,11 @@ public interface Utils {
*/
ExecutorService ioExecutor();
@Beta
EventBus getEventBus();
EventBus eventBus();
LoggerFactory getLoggerFactory();
/**
@ -104,4 +110,5 @@ public interface Utils {
*/
@Beta
Injector injector();
}

View File

@ -24,6 +24,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import com.google.common.annotations.Beta;
import com.google.common.eventbus.EventBus;
import com.google.inject.Injector;
import org.jclouds.Constants;
import org.jclouds.crypto.Crypto;
@ -49,14 +50,15 @@ public class UtilsImpl implements Utils {
private final DateService date;
private final ExecutorService userExecutor;
private final ExecutorService ioExecutor;
private final EventBus eventBus;
private final LoggerFactory loggerFactory;
private Injector injector;
@Inject
protected UtilsImpl(Injector injector, Json json, HttpClient simpleClient, HttpAsyncClient simpleAsyncClient,
Crypto encryption, DateService date,
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads, LoggerFactory loggerFactory) {
Crypto encryption, DateService date, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads, EventBus eventBus,
LoggerFactory loggerFactory) {
this.injector = injector;
this.json = json;
this.simpleClient = simpleClient;
@ -65,6 +67,7 @@ public class UtilsImpl implements Utils {
this.date = date;
this.userExecutor = userThreads;
this.ioExecutor = ioThreads;
this.eventBus = eventBus;
this.loggerFactory = loggerFactory;
}
@ -127,7 +130,17 @@ public class UtilsImpl implements Utils {
public ExecutorService userExecutor() {
return userExecutor;
}
@Override
public EventBus getEventBus() {
return eventBus;
}
@Override
public EventBus eventBus() {
return eventBus;
}
@Override
public LoggerFactory getLoggerFactory() {
return loggerFactory;