📝 Add comment
[Sone.git] / src / main / java / net / pterodactylus / sone / main / SonePlugin.java
index 7c32db7..a3cb385 100644 (file)
@@ -26,6 +26,7 @@ import net.pterodactylus.sone.core.*;
 import net.pterodactylus.sone.fcp.*;
 import net.pterodactylus.sone.freenet.wot.*;
 import net.pterodactylus.sone.web.*;
+import net.pterodactylus.sone.web.notification.NotificationHandler;
 
 import freenet.l10n.BaseL10n.*;
 import freenet.l10n.*;
@@ -34,8 +35,10 @@ import freenet.support.*;
 import freenet.support.api.*;
 
 import com.google.common.annotations.*;
+import com.google.common.eventbus.*;
 import com.google.common.cache.*;
 import com.google.inject.*;
+import com.google.inject.Module;
 import com.google.inject.name.*;
 import kotlin.jvm.functions.*;
 
@@ -50,6 +53,7 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr
        static {
                /* initialize logging. */
                soneLogger.setUseParentHandlers(false);
+               soneLogger.setLevel(Level.ALL);
                soneLogger.addHandler(new Handler() {
                        private final LoadingCache<String, Class<?>> classCache = CacheBuilder.newBuilder()
                                        .build(new CacheLoader<String, Class<?>>() {
@@ -193,18 +197,22 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr
 
                /* create the web interface. */
                webInterface = injector.getInstance(WebInterface.class);
+               NotificationHandler notificationHandler = injector.getInstance(NotificationHandler.class);
 
                /* start core! */
                core.start();
+
+               /* start the web interface! */
                webInterface.start();
                webInterface.setFirstStart(injector.getInstance(Key.get(Boolean.class, Names.named("FirstStart"))));
                webInterface.setNewConfig(injector.getInstance(Key.get(Boolean.class, Names.named("NewConfig"))));
+               notificationHandler.start();
        }
 
        @VisibleForTesting
        protected Injector createInjector() {
                FreenetModule freenetModule = new FreenetModule(pluginRespirator);
-               AbstractModule soneModule = new SoneModule(this);
+               AbstractModule soneModule = new SoneModule(this, new EventBus());
                Module webInterfaceModule = new WebInterfaceModule();
 
                return createInjector(freenetModule, soneModule, webInterfaceModule);