From 6e4249c6b46e55a5752b0929be7ee06e627c094a Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sun, 19 Feb 2012 09:39:20 +0200 Subject: [PATCH] tidied syntax to get eventBus --- .../jclouds/compute/internal/UtilsImpl.java | 12 ++++++----- .../src/main/java/org/jclouds/rest/Utils.java | 7 +++++++ .../org/jclouds/rest/internal/UtilsImpl.java | 21 +++++++++++++++---- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java b/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java index bc8b259581..bcaab810b8 100644 --- a/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java +++ b/compute/src/main/java/org/jclouds/compute/internal/UtilsImpl.java @@ -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 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 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 sshForNode) { + super(injector, json, simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads, eventBus, + loggerFactory); this.sshForNode = sshForNode; } diff --git a/core/src/main/java/org/jclouds/rest/Utils.java b/core/src/main/java/org/jclouds/rest/Utils.java index e721277178..353363321d 100644 --- a/core/src/main/java/org/jclouds/rest/Utils.java +++ b/core/src/main/java/org/jclouds/rest/Utils.java @@ -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(); + } 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 b7dfee9801..b7b948e2a3 100644 --- a/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java +++ b/core/src/main/java/org/jclouds/rest/internal/UtilsImpl.java @@ -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;