From d5302c2e5cf81f2794294ae49c1996538b38e8d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Mon, 28 Sep 2015 11:16:29 +0200 Subject: [PATCH] SONAR-6831 do some sort and clean up in CE's modules --- .../sonar/server/computation/CeModule.java | 43 +++++++++++++++ .../ReportProcessingModule.java} | 20 +++---- .../computation/queue/CeQueueModule.java | 53 +++++++++++++++++++ .../platformlevel/PlatformLevel4.java | 35 +++--------- 4 files changed, 111 insertions(+), 40 deletions(-) create mode 100644 server/sonar-server/src/main/java/org/sonar/server/computation/CeModule.java rename server/sonar-server/src/main/java/org/sonar/server/computation/{ComputeEngineProcessingModule.java => container/ReportProcessingModule.java} (64%) create mode 100644 server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueModule.java diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/CeModule.java b/server/sonar-server/src/main/java/org/sonar/server/computation/CeModule.java new file mode 100644 index 00000000000..fc2eb96592b --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/CeModule.java @@ -0,0 +1,43 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.computation; + +import org.sonar.core.platform.Module; +import org.sonar.db.purge.period.DefaultPeriodCleaner; +import org.sonar.server.computation.dbcleaner.IndexPurgeListener; +import org.sonar.server.computation.dbcleaner.ProjectCleaner; +import org.sonar.server.computation.log.CeLogging; +import org.sonar.server.properties.ProjectSettingsFactory; + +/** + * Globally available components in CE + */ +public class CeModule extends Module { + @Override + protected void configureModule() { + add( + CeLogging.class, + + DefaultPeriodCleaner.class, + ProjectCleaner.class, + ProjectSettingsFactory.class, + IndexPurgeListener.class); + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputeEngineProcessingModule.java b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportProcessingModule.java similarity index 64% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ComputeEngineProcessingModule.java rename to server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportProcessingModule.java index eb30f047a16..12db121dab1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputeEngineProcessingModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportProcessingModule.java @@ -17,25 +17,21 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.computation; +package org.sonar.server.computation.container; import org.sonar.core.platform.Module; -import org.sonar.server.computation.container.ContainerFactoryImpl; -import org.sonar.server.computation.queue.CeProcessingSchedulerExecutorServiceImpl; -import org.sonar.server.computation.queue.CeProcessingSchedulerImpl; -import org.sonar.server.computation.queue.CeWorkerRunnableImpl; +import org.sonar.server.computation.queue.report.ReportSubmitter; import org.sonar.server.computation.queue.report.ReportTaskProcessor; import org.sonar.server.computation.step.ComputationStepExecutor; -public class ComputeEngineProcessingModule extends Module { +public class ReportProcessingModule extends Module { @Override protected void configureModule() { add( - ContainerFactoryImpl.class, - ComputationStepExecutor.class, - ReportTaskProcessor.class, - CeProcessingSchedulerExecutorServiceImpl.class, - CeWorkerRunnableImpl.class, - CeProcessingSchedulerImpl.class); + ContainerFactoryImpl.class, + ComputationStepExecutor.class, + ReportTaskProcessor.class, + ReportSubmitter.class + ); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueModule.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueModule.java new file mode 100644 index 00000000000..67c5bc6de63 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueModule.java @@ -0,0 +1,53 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.computation.queue; + +import org.sonar.core.platform.Module; +import org.sonar.server.computation.monitoring.CEQueueStatusImpl; +import org.sonar.server.computation.monitoring.ComputeEngineQueueMonitor; +import org.sonar.server.computation.queue.report.CleanReportQueueListener; +import org.sonar.server.computation.queue.report.ReportFiles; + +public class CeQueueModule extends Module { + @Override + protected void configureModule() { + add( + // queue state + CeQueueImpl.class, + + // queue monitoring + CEQueueStatusImpl.class, + ComputeEngineQueueMonitor.class, + + // CE queue processing + CeProcessingSchedulerExecutorServiceImpl.class, + CeWorkerRunnableImpl.class, + CeProcessingSchedulerImpl.class, + + // queue cleaning + CeQueueCleaner.class, + CleanReportQueueListener.class, + ReportFiles.class, + + // init queue state and queue processing + CeQueueInitializer.class + ); + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index fee9b478218..bc23236d6e2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -38,7 +38,6 @@ import org.sonar.core.timemachine.Periods; import org.sonar.core.user.DefaultUserFinder; import org.sonar.core.user.DeprecatedUserFinder; import org.sonar.db.permission.PermissionRepository; -import org.sonar.db.purge.period.DefaultPeriodCleaner; import org.sonar.db.qualitygate.ProjectQgateAssociationDao; import org.sonar.db.qualitygate.QualityGateConditionDao; import org.sonar.db.qualitygate.QualityGateDao; @@ -62,18 +61,9 @@ import org.sonar.server.component.DefaultRubyComponentService; import org.sonar.server.component.ws.ComponentsWs; import org.sonar.server.component.ws.EventsWs; import org.sonar.server.component.ws.ResourcesWs; -import org.sonar.server.computation.queue.CeQueueImpl; -import org.sonar.server.computation.queue.CeQueueCleaner; -import org.sonar.server.computation.queue.CeQueueInitializer; -import org.sonar.server.computation.queue.report.CleanReportQueueListener; -import org.sonar.server.computation.ComputeEngineProcessingModule; -import org.sonar.server.computation.queue.report.ReportFiles; -import org.sonar.server.computation.queue.report.ReportSubmitter; -import org.sonar.server.computation.dbcleaner.IndexPurgeListener; -import org.sonar.server.computation.dbcleaner.ProjectCleaner; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.monitoring.CEQueueStatusImpl; -import org.sonar.server.computation.monitoring.ComputeEngineQueueMonitor; +import org.sonar.server.computation.CeModule; +import org.sonar.server.computation.container.ReportProcessingModule; +import org.sonar.server.computation.queue.CeQueueModule; import org.sonar.server.computation.ws.CeWsModule; import org.sonar.server.config.ws.PropertiesWs; import org.sonar.server.dashboard.template.GlobalDefaultDashboard; @@ -209,7 +199,6 @@ import org.sonar.server.plugins.ws.PluginsWs; import org.sonar.server.plugins.ws.UninstallAction; import org.sonar.server.plugins.ws.UpdatesAction; import org.sonar.server.project.ws.ProjectsWsModule; -import org.sonar.server.properties.ProjectSettingsFactory; import org.sonar.server.qualitygate.QgateProjectFinder; import org.sonar.server.qualitygate.QualityGates; import org.sonar.server.qualitygate.ws.CreateConditionAction; @@ -712,21 +701,11 @@ public class PlatformLevel4 extends PlatformLevel { PluginsWs.class, // Compute engine - CEQueueStatusImpl.class, - ComputeEngineQueueMonitor.class, - CeQueueImpl.class, - CleanReportQueueListener.class, - ReportFiles.class, - ComputeEngineProcessingModule.class, + CeModule.class, + CeQueueModule.class, CeWsModule.class, - CeLogging.class, - DefaultPeriodCleaner.class, - ProjectCleaner.class, - ProjectSettingsFactory.class, - IndexPurgeListener.class, - ReportSubmitter.class, - CeQueueCleaner.class, - CeQueueInitializer.class, + ReportProcessingModule.class, + // Views plugin ViewsBootstrap.class, ViewsStopper.class, -- 2.39.5