Set version to 0.2-RC4.
[Sone.git] / src / main / java / net / pterodactylus / sone / main / SonePlugin.java
index e156967..480529f 100644 (file)
@@ -26,6 +26,7 @@ import java.util.logging.Logger;
 import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.core.FreenetInterface;
 import net.pterodactylus.sone.freenet.PluginStoreConfigurationBackend;
+import net.pterodactylus.sone.freenet.wot.IdentityManager;
 import net.pterodactylus.sone.freenet.wot.PluginConnector;
 import net.pterodactylus.sone.freenet.wot.WebOfTrustConnector;
 import net.pterodactylus.sone.web.WebInterface;
@@ -76,12 +77,11 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
                                        freenet.support.Logger.error(loggerClass, String.format(logRecord.getMessage(), logRecord.getParameters()), logRecord.getThrown());
                                }
                        }
-
                });
        }
 
        /** The version. */
-       public static final Version VERSION = new Version("RC3", 0, 1);
+       public static final Version VERSION = new Version("RC4", 0, 2);
 
        /** The logger. */
        private static final Logger logger = Logging.getLogger(SonePlugin.class);
@@ -101,6 +101,9 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
        /** The plugin store. */
        private PluginStore pluginStore;
 
+       /** The identity manager. */
+       private IdentityManager identityManager;
+
        //
        // ACCESSORS
        //
@@ -146,7 +149,7 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
                /* create a configuration. */
                Configuration configuration;
                try {
-                       configuration = new Configuration(new PluginStoreConfigurationBackend(pluginStore = pluginRespirator.getStore()));
+                       configuration = new Configuration(new PluginStoreConfigurationBackend(pluginRespirator));
                } catch (DatabaseDisabledException dde1) {
                        logger.log(Level.WARNING, "Could not load plugin store, using XML files.");
                        try {
@@ -163,21 +166,24 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
                /* create web of trust connector. */
                PluginConnector pluginConnector = new PluginConnector(pluginRespirator);
                WebOfTrustConnector webOfTrustConnector = new WebOfTrustConnector(pluginConnector);
+               identityManager = new IdentityManager(webOfTrustConnector);
+               identityManager.setContext("Sone");
 
                /* create the web interface. */
                webInterface = new WebInterface(this);
 
                /* create core. */
-               core = new Core();
-               core.configuration(configuration);
-               core.freenetInterface(freenetInterface);
-               core.setWebOfTrustConnector(webOfTrustConnector);
+               core = new Core(configuration, freenetInterface, identityManager);
+
+               /* create the identity manager. */
+               identityManager.addIdentityListener(core);
 
                /* start core! */
                boolean startupFailed = true;
                try {
                        core.start();
                        webInterface.start();
+                       identityManager.start();
                        startupFailed = false;
                } finally {
                        if (startupFailed) {
@@ -203,6 +209,9 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
                        /* stop the core. */
                        core.stop();
 
+                       /* stop the identity manager. */
+                       identityManager.stop();
+
                        /* TODO wait for core to stop? */
                        try {
                                pluginRespirator.putStore(pluginStore);