+ this.pluginRespirator = pluginRespirator;
+
+ /* create a configuration. */
+ Configuration configuration;
+ try {
+ configuration = new Configuration(new PluginStoreConfigurationBackend(pluginStore = pluginRespirator.getStore()));
+ } catch (DatabaseDisabledException dde1) {
+ logger.log(Level.WARNING, "Could not load plugin store, using XML files.");
+ 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!");
+ configuration = new Configuration(new MapConfigurationBackend(Collections.<String, String> emptyMap()));
+ }
+ }
+
+ /* create freenet interface. */
+ FreenetInterface freenetInterface = new FreenetInterface(pluginRespirator.getNode(), pluginRespirator.getHLSimpleClient());
+
+ /* create the web interface. */
+ webInterface = new WebInterface(this);
+
+ /* create core. */
+ core = new Core();
+ core.configuration(configuration);
+ core.freenetInterface(freenetInterface);
+
+ /* start core! */
+ boolean startupFailed = true;
+ try {
+ core.start();
+ webInterface.start();
+ startupFailed = false;
+ } finally {
+ if (startupFailed) {
+ /*
+ * we let the exception bubble up but shut the logging down so
+ * that the logfile is not swamped by the installed logging
+ * handlers of the failed instances.
+ */
+ Logging.shutdown();
+ }
+ }