- 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();
+ /* create web of trust connector. */
+ webOfTrustConnector = injector.getInstance(WebOfTrustConnector.class);
+
+ /* create FCP interface. */
+ fcpInterface = injector.getInstance(FcpInterface.class);
+
+ /* create the web interface. */
+ webInterface = injector.getInstance(WebInterface.class);
+
+ /* we need to request this to install all notification handlers. */
+ injector.getInstance(NotificationHandler.class);
+
+ /* and this is required to shutdown all tickers. */
+ injector.getInstance(TickerShutdown.class);
+
+ /* start core! */
+ core.start();
+
+ /* start the web interface! */
+ webInterface.start();
+
+ /* send some events on startup */
+ eventBus = injector.getInstance(EventBus.class);
+
+ /* first start? */
+ if (injector.getInstance(Key.get(Boolean.class, Names.named("FirstStart")))) {
+ eventBus.post(new FirstStart());
+ } else {
+ /* new config? */
+ if (injector.getInstance(Key.get(Boolean.class, Names.named("NewConfig")))) {
+ eventBus.post(new ConfigNotRead());