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 org.jclouds.ssh.SshClient.Factory;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.eventbus.EventBus;
import com.google.inject.Inject; 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; private final Function<NodeMetadata, SshClient> sshForNode;
@Inject @Inject
UtilsImpl(Injector injector, Json json, HttpClient simpleClient, HttpAsyncClient simpleAsyncClient, Crypto encryption, UtilsImpl(Injector injector, Json json, HttpClient simpleClient, HttpAsyncClient simpleAsyncClient,
DateService date, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads, Crypto encryption, DateService date, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads, LoggerFactory loggerFactory, @Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads, EventBus eventBus,
Function<NodeMetadata, SshClient> sshForNode) { LoggerFactory loggerFactory, Function<NodeMetadata, SshClient> sshForNode) {
super(injector, json, simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads, loggerFactory); super(injector, json, simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads, eventBus,
loggerFactory);
this.sshForNode = sshForNode; this.sshForNode = sshForNode;
} }

View File

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

View File

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