- /* 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! */
- core.start();
- webInterface.start();
+ boolean startupFailed = true;
+ try {
+ /* create freenet interface. */
+ FreenetInterface freenetInterface = new FreenetInterface(pluginRespirator.getNode());
+
+ /* 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(oldConfiguration, freenetInterface, identityManager);
+
+ /* create the web interface. */
+ webInterface = new WebInterface(this);
+ core.addCoreListener(webInterface);
+
+ /* create the identity manager. */
+ identityManager.addIdentityListener(core);
+
+ /* start core! */
+ core.start();
+ if ((newConfiguration != null) && (oldConfiguration != newConfiguration)) {
+ logger.log(Level.INFO, "Setting configuration to file-based configuration.");
+ core.setConfiguration(newConfiguration);
+ }
+ webInterface.start();
+ webInterface.setFirstStart(firstStart);
+ webInterface.setNewConfig(newConfig);
+ identityManager.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();
+ }
+ }