Exemple #1
0
  private void executeStartupTasks() {
    ComponentContainer startupContainer = servicesContainer.createChild();
    startupContainer.addSingleton(GwtPublisher.class);
    startupContainer.addSingleton(RegisterMetrics.class);
    startupContainer.addSingleton(RegisterRules.class);
    startupContainer.addSingleton(RegisterProvidedProfiles.class);
    startupContainer.addSingleton(EnableProfiles.class);
    startupContainer.addSingleton(ActivateDefaultProfiles.class);
    startupContainer.addSingleton(JdbcDriverDeployer.class);
    startupContainer.addSingleton(ServerMetadataPersister.class);
    startupContainer.addSingleton(RegisterQualityModels.class);
    startupContainer.addSingleton(DeleteDeprecatedMeasures.class);
    startupContainer.addSingleton(GeneratePluginIndex.class);
    startupContainer.addSingleton(RegisterNewDashboards.class);
    startupContainer.startComponents();

    startupContainer.getComponentByType(ServerLifecycleNotifier.class).notifyStart();

    // Do not put the following statements in a finally block.
    // It would hide the possible exception raised during startup
    // See SONAR-3107
    startupContainer.stopComponents();
    servicesContainer.removeChild();
    servicesContainer.getComponentByType(DatabaseSessionFactory.class).clear();
  }
Exemple #2
0
 private void startCoreComponents() {
   coreContainer = rootContainer.createChild();
   coreContainer.addSingleton(ServerDatabaseSettingsLoader.class);
   coreContainer.addSingleton(DefaultDatabaseConnector.class);
   coreContainer.addSingleton(ServerExtensionInstaller.class);
   coreContainer.addSingleton(ThreadLocalDatabaseSessionFactory.class);
   coreContainer.addPicoAdapter(new DatabaseSessionProvider());
   coreContainer.startComponents();
 }
Exemple #3
0
  /** plugin extensions + all the components that depend on plugin extensions */
  private void startServiceComponents() {
    servicesContainer = coreContainer.createChild();
    ServerExtensionInstaller extensionRegistrar =
        servicesContainer.getComponentByType(ServerExtensionInstaller.class);
    extensionRegistrar.registerExtensions(servicesContainer);

    servicesContainer.addSingleton(GlobalSettingsUpdater.class);
    servicesContainer.addSingleton(HttpDownloader.class);
    servicesContainer.addSingleton(UpdateCenterClient.class);
    servicesContainer.addSingleton(UpdateCenterMatrixFactory.class);
    servicesContainer.addSingleton(PluginDownloader.class);
    servicesContainer.addSingleton(ServerIdGenerator.class);
    servicesContainer.addComponent(FilterExecutor.class, false);
    servicesContainer.addSingleton(DefaultModelFinder.class); // depends on plugins
    servicesContainer.addSingleton(DefaultModelManager.class);
    servicesContainer.addSingleton(Plugins.class);
    servicesContainer.addSingleton(ChartFactory.class);
    servicesContainer.addSingleton(Languages.class);
    servicesContainer.addSingleton(Views.class);
    servicesContainer.addSingleton(CodeColorizers.class);
    servicesContainer.addComponent(RulesDao.class, false);
    servicesContainer.addComponent(MeasuresDao.class, false);
    servicesContainer.addComponent(org.sonar.api.database.daos.MeasuresDao.class, false);
    servicesContainer.addComponent(ProfilesDao.class, false);
    servicesContainer.addComponent(DaoFacade.class, false);
    servicesContainer.addComponent(DefaultRulesManager.class, false);
    servicesContainer.addComponent(ProfilesManager.class, false);
    servicesContainer.addComponent(Backup.class, false);
    servicesContainer.addSingleton(SecurityRealmFactory.class);
    servicesContainer.addSingleton(ServerLifecycleNotifier.class);
    servicesContainer.addSingleton(AnnotationProfileParser.class);
    servicesContainer.addSingleton(XMLProfileParser.class);
    servicesContainer.addSingleton(XMLProfileSerializer.class);
    servicesContainer.addSingleton(AnnotationRuleParser.class);
    servicesContainer.addSingleton(XMLRuleParser.class);
    servicesContainer.addSingleton(DefaultRuleFinder.class);
    servicesContainer.addSingleton(DefaultMetricFinder.class);
    servicesContainer.addSingleton(ProfilesConsole.class);
    servicesContainer.addSingleton(RulesConsole.class);
    servicesContainer.addSingleton(JRubyI18n.class);
    servicesContainer.addSingleton(DefaultUserFinder.class);
    servicesContainer.addSingleton(I18nManager.class);
    servicesContainer.addSingleton(RuleI18nManager.class);
    servicesContainer.addSingleton(GwtI18n.class);
    servicesContainer.addSingleton(ResourceTypes.class);

    // Notifications
    servicesContainer.addSingleton(NotificationService.class);
    servicesContainer.addSingleton(DefaultNotificationManager.class);
    servicesContainer.addSingleton(ReviewsNotificationManager.class);

    // Reviews
    servicesContainer.addSingleton(ReviewManager.class);

    servicesContainer.startComponents();
  }
Exemple #4
0
 private void startDatabaseConnectors(ServletContext servletContext) {
   rootContainer = new ComponentContainer();
   rootContainer.addSingleton(servletContext);
   rootContainer.addSingleton(IocContainer.class); // for backward compatibility
   rootContainer.addSingleton(new BaseConfiguration());
   rootContainer.addSingleton(ServerSettings.class);
   rootContainer.addSingleton(ServerImpl.class);
   rootContainer.addSingleton(EmbeddedDatabaseFactory.class);
   rootContainer.addSingleton(DefaultDatabase.class);
   rootContainer.addSingleton(MyBatis.class);
   rootContainer.addSingleton(DefaultServerUpgradeStatus.class);
   rootContainer.addSingleton(DatabaseServerCompatibility.class);
   rootContainer.addSingleton(DatabaseMigrator.class);
   rootContainer.addSingleton(DatabaseVersion.class);
   for (Class daoClass : DaoUtils.getDaoClasses()) {
     rootContainer.addSingleton(daoClass);
   }
   rootContainer.addSingleton(PluginDeployer.class);
   rootContainer.addSingleton(DefaultServerPluginRepository.class);
   rootContainer.addSingleton(DefaultServerFileSystem.class);
   rootContainer.addSingleton(ApplicationDeployer.class);
   rootContainer.startComponents();
 }