X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fmain%2FSonePlugin.java;h=a57a71e75f9e3080094e1fc4cb1ea930e86a6176;hb=ffe2f26bb75cbd7798b0c205deb98ebc3d36928c;hp=e156967797bc5080138633a125d1325b2c1e6704;hpb=45758dd574219c139923b1a9c50d174129a0b740;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index e156967..a57a71e 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -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(0, 3); /** 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,25 @@ 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 core. */ + core = new Core(configuration, freenetInterface, identityManager); /* create the web interface. */ webInterface = new WebInterface(this); + core.addCoreListener(webInterface); - /* create core. */ - core = new Core(); - core.configuration(configuration); - core.freenetInterface(freenetInterface); - core.setWebOfTrustConnector(webOfTrustConnector); + /* 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 +210,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);