From cbaa38f2f223948fcd27950824a4c920a5a90ee9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 16 Jan 2013 15:28:34 +0100 Subject: [PATCH] Add event bus to Core. --- src/main/java/net/pterodactylus/sone/core/Core.java | 9 ++++++++- src/main/java/net/pterodactylus/sone/main/SonePlugin.java | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 2a2eb8f..b21a087 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -70,6 +70,7 @@ import net.pterodactylus.util.version.Version; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; +import com.google.common.eventbus.EventBus; import com.google.inject.Inject; import freenet.keys.FreenetURI; @@ -96,6 +97,9 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis /** The core listener manager. */ private final CoreListenerManager coreListenerManager = new CoreListenerManager(this); + /** The event bus. */ + private final EventBus eventBus; + /** The configuration. */ private Configuration configuration; @@ -193,9 +197,11 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis * The identity manager * @param webOfTrustUpdater * The WebOfTrust updater + * @param eventBus + * The event bus */ @Inject - public Core(Configuration configuration, FreenetInterface freenetInterface, IdentityManager identityManager, WebOfTrustUpdater webOfTrustUpdater) { + public Core(Configuration configuration, FreenetInterface freenetInterface, IdentityManager identityManager, WebOfTrustUpdater webOfTrustUpdater, EventBus eventBus) { super("Sone Core"); this.configuration = configuration; this.freenetInterface = freenetInterface; @@ -204,6 +210,7 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis this.imageInserter = new ImageInserter(this, freenetInterface); this.updateChecker = new UpdateChecker(freenetInterface); this.webOfTrustUpdater = webOfTrustUpdater; + this.eventBus = eventBus; } // diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index 6d32b50..c1599c9 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -38,6 +38,7 @@ import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.logging.LoggingListener; import net.pterodactylus.util.version.Version; +import com.google.common.eventbus.EventBus; import com.google.inject.AbstractModule; import com.google.inject.Guice; import com.google.inject.Injector; @@ -184,6 +185,7 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr } final Configuration startConfiguration = oldConfiguration; + final EventBus eventBus = new EventBus(); /* Freenet injector configuration. */ AbstractModule freenetModule = new AbstractModule() { @@ -200,6 +202,7 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr @Override protected void configure() { + bind(EventBus.class).toInstance(eventBus); bind(Configuration.class).toInstance(startConfiguration); bind(FreenetInterface.class).in(Singleton.class); bind(PluginConnector.class).in(Singleton.class); -- 2.7.4