Ejemplo n.º 1
0
 public void initContainer() throws Exception {
   if (launchConfig == null) {
     launchConfig = launchConfigLoader.call();
   }
   runtimeConfiguration =
       new StaticRuntimeConfiguration(launchConfig, configDatabaseLoader.call());
   runtimeConfiguration.setCurrentVersion(currentVersion);
   services =
       new NewConfigDesktopServiceFactory(
           runtimeConfiguration, new SqliteTransactionManager(connection));
   desktopServiceFactory = new CompositeServiceFactory();
   desktopServiceFactory.addServiceFactory(services);
   AfterburnerInjector.setConfigurationSource(key -> desktopServiceFactory.get((String) key));
   AfterburnerInjector.setInstanceSupplier(
       new RecursiveInjectionInstanceSupplier(desktopServiceFactory));
 }
Ejemplo n.º 2
0
 private void initPlugins() {
   for (Class<? extends ClientPlugin> clazz : clientPlugins) {
     try {
       ClientPlugin plugin = clazz.newInstance();
       if (plugin instanceof ServiceFactoryProvider) {
         desktopServiceFactory.addServiceFactory(
             ((ServiceFactoryProvider) plugin).getServiceFactory());
       }
       AfterburnerInjector.injectMembers(plugin);
       plugin.initialize(desktopServiceFactory, services.getEventDispatcher());
     } catch (InstantiationException | IllegalAccessException e) {
       logger.error("failed to initialized plugin " + clazz.getName() + ": " + e.getMessage(), e);
     }
   }
 }