X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fmain%2FSonePlugin.java;h=6d9e3a01303ff10a59098c5dc5c8538ebd83b552;hb=3708c0f5d855c085295b45882e4ef56d2df3abbc;hp=97c1df13d32c1e9008aa562fa2d66267c4f60523;hpb=96ccdae621391f2f980d2a5ecc26c40f3ac338d1;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 97c1df1..6d9e3a0 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -81,7 +81,7 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10 } /** The version. */ - public static final Version VERSION = new Version("RC1", 0, 2); + public static final Version VERSION = new Version(0, 3); /** The logger. */ private static final Logger logger = Logging.getLogger(SonePlugin.class); @@ -148,14 +148,20 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10 /* create a configuration. */ Configuration configuration; + Configuration xmlConfiguration = null; try { - configuration = new Configuration(new PluginStoreConfigurationBackend(pluginStore = pluginRespirator.getStore())); - } catch (DatabaseDisabledException dde1) { - logger.log(Level.WARNING, "Could not load plugin store, using XML files."); + configuration = new Configuration(new XMLConfigurationBackend(new File("sone.xml"), false)); + xmlConfiguration = configuration; + } catch (ConfigurationException ce1) { try { - configuration = new Configuration(new XMLConfigurationBackend(new File("sone.xml"), true)); - } catch (ConfigurationException ce1) { - logger.log(Level.SEVERE, "Could not load or create the “sone.xml” configuration file!"); + xmlConfiguration = new Configuration(new XMLConfigurationBackend(new File("sone.xml"), true)); + } catch (ConfigurationException ce2) { + logger.log(Level.SEVERE, "Could not create XML file, using Plugin Store!"); + } + try { + configuration = new Configuration(new PluginStoreConfigurationBackend(pluginRespirator)); + } catch (DatabaseDisabledException dde1) { + logger.log(Level.SEVERE, "Could not load any configuration, using in-memory configuration!"); configuration = new Configuration(new MapConfigurationBackend(Collections. emptyMap())); } } @@ -169,12 +175,13 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10 identityManager = new IdentityManager(webOfTrustConnector); identityManager.setContext("Sone"); - /* create the web interface. */ - webInterface = new WebInterface(this); - /* create core. */ core = new Core(configuration, freenetInterface, identityManager); + /* create the web interface. */ + webInterface = new WebInterface(this); + core.addCoreListener(webInterface); + /* create the identity manager. */ identityManager.addIdentityListener(core); @@ -182,6 +189,9 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10 boolean startupFailed = true; try { core.start(); + if ((xmlConfiguration != null) && (configuration != xmlConfiguration)) { + core.setConfiguration(xmlConfiguration); + } webInterface.start(); identityManager.start(); startupFailed = false;