2 * SonarQube, open source software quality management tool.
3 * Copyright (C) 2008-2014 SonarSource
4 * mailto:contact AT sonarsource DOT com
6 * SonarQube is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * SonarQube is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.server.computation.container;
22 import java.util.Arrays;
23 import java.util.List;
24 import org.sonar.core.issue.tracking.Tracker;
25 import org.sonar.core.platform.ContainerPopulator;
26 import org.sonar.server.computation.queue.CeTask;
27 import org.sonar.server.computation.step.ComputationStepExecutor;
28 import org.sonar.server.computation.filesystem.ComputationTempFolderProvider;
29 import org.sonar.server.computation.analysis.ReportAnalysisMetadataHolder;
30 import org.sonar.server.computation.batch.BatchReportDirectoryHolderImpl;
31 import org.sonar.server.computation.batch.BatchReportReaderImpl;
32 import org.sonar.server.computation.component.DbIdsRepositoryImpl;
33 import org.sonar.server.computation.component.ReportTreeRootHolderImpl;
34 import org.sonar.server.computation.component.SettingsRepositoryImpl;
35 import org.sonar.server.computation.debt.DebtModelHolderImpl;
36 import org.sonar.server.computation.event.EventRepositoryImpl;
37 import org.sonar.server.computation.issue.BaseIssuesLoader;
38 import org.sonar.server.computation.issue.CloseIssuesOnRemovedComponentsVisitor;
39 import org.sonar.server.computation.issue.ComponentIssuesRepositoryImpl;
40 import org.sonar.server.computation.issue.ComponentsWithUnprocessedIssues;
41 import org.sonar.server.computation.issue.DebtAggregator;
42 import org.sonar.server.computation.issue.DebtCalculator;
43 import org.sonar.server.computation.issue.DefaultAssignee;
44 import org.sonar.server.computation.issue.IntegrateIssuesVisitor;
45 import org.sonar.server.computation.issue.IssueAssigner;
46 import org.sonar.server.computation.issue.IssueCache;
47 import org.sonar.server.computation.issue.IssueCounter;
48 import org.sonar.server.computation.issue.IssueLifecycle;
49 import org.sonar.server.computation.issue.IssueVisitors;
50 import org.sonar.server.computation.issue.LoadComponentUuidsHavingOpenIssuesVisitor;
51 import org.sonar.server.computation.issue.NewDebtAggregator;
52 import org.sonar.server.computation.issue.NewDebtCalculator;
53 import org.sonar.server.computation.issue.RuleCacheLoader;
54 import org.sonar.server.computation.issue.RuleRepositoryImpl;
55 import org.sonar.server.computation.issue.RuleTagsCopier;
56 import org.sonar.server.computation.issue.ScmAccountToUser;
57 import org.sonar.server.computation.issue.ScmAccountToUserLoader;
58 import org.sonar.server.computation.issue.TrackerBaseInputFactory;
59 import org.sonar.server.computation.issue.TrackerExecution;
60 import org.sonar.server.computation.issue.TrackerRawInputFactory;
61 import org.sonar.server.computation.issue.UpdateConflictResolver;
62 import org.sonar.server.computation.issue.commonrule.BranchCoverageRule;
63 import org.sonar.server.computation.issue.commonrule.CommentDensityRule;
64 import org.sonar.server.computation.issue.commonrule.CommonRuleEngineImpl;
65 import org.sonar.server.computation.issue.commonrule.DuplicatedBlockRule;
66 import org.sonar.server.computation.issue.commonrule.LineCoverageRule;
67 import org.sonar.server.computation.issue.commonrule.SkippedTestRule;
68 import org.sonar.server.computation.issue.commonrule.TestErrorRule;
69 import org.sonar.server.computation.language.LanguageRepositoryImpl;
70 import org.sonar.server.computation.measure.MeasureComputersHolderImpl;
71 import org.sonar.server.computation.measure.MeasureComputersVisitor;
72 import org.sonar.server.computation.measure.MeasureRepositoryImpl;
73 import org.sonar.server.computation.metric.MetricModule;
74 import org.sonar.server.computation.period.PeriodsHolderImpl;
75 import org.sonar.server.computation.qualitygate.EvaluationResultTextConverterImpl;
76 import org.sonar.server.computation.qualitygate.QualityGateHolderImpl;
77 import org.sonar.server.computation.qualitygate.QualityGateServiceImpl;
78 import org.sonar.server.computation.qualityprofile.ActiveRulesHolderImpl;
79 import org.sonar.server.computation.source.LastCommitVisitor;
80 import org.sonar.server.computation.source.SourceLinesRepositoryImpl;
81 import org.sonar.server.computation.sqale.SqaleMeasuresVisitor;
82 import org.sonar.server.computation.sqale.SqaleRatingSettings;
83 import org.sonar.server.computation.sqale.SqaleNewMeasuresVisitor;
84 import org.sonar.server.computation.step.ComputationSteps;
85 import org.sonar.server.computation.step.ReportComputationSteps;
86 import org.sonar.server.view.index.ViewIndex;
88 public final class ReportComputeEngineContainerPopulator implements ContainerPopulator<ComputeEngineContainer> {
89 private final CeTask task;
91 public ReportComputeEngineContainerPopulator(CeTask task) {
96 public void populateContainer(ComputeEngineContainer container) {
97 ComputationSteps steps = new ReportComputationSteps(container);
100 container.addSingletons(componentClasses());
101 container.addSingletons(steps.orderedStepClasses());
105 * List of all objects to be injected in the picocontainer dedicated to computation stack.
106 * Does not contain the steps declared in {@link ReportComputationSteps#orderedStepClasses()}.
108 private static List componentClasses() {
109 return Arrays.asList(
110 ComputationStepExecutor.class,
111 new ComputationTempFolderProvider(),
116 ReportAnalysisMetadataHolder.class,
117 BatchReportDirectoryHolderImpl.class,
118 ReportTreeRootHolderImpl.class,
119 PeriodsHolderImpl.class,
120 QualityGateHolderImpl.class,
121 DebtModelHolderImpl.class,
122 SqaleRatingSettings.class,
123 ActiveRulesHolderImpl.class,
124 MeasureComputersHolderImpl.class,
126 BatchReportReaderImpl.class,
129 LanguageRepositoryImpl.class,
130 MeasureRepositoryImpl.class,
131 EventRepositoryImpl.class,
132 SettingsRepositoryImpl.class,
133 DbIdsRepositoryImpl.class,
134 QualityGateServiceImpl.class,
135 EvaluationResultTextConverterImpl.class,
136 SourceLinesRepositoryImpl.class,
139 RuleCacheLoader.class,
140 RuleRepositoryImpl.class,
141 ScmAccountToUserLoader.class,
142 ScmAccountToUser.class,
144 DefaultAssignee.class,
146 IssueLifecycle.class,
147 ComponentsWithUnprocessedIssues.class,
148 ComponentIssuesRepositoryImpl.class,
151 CommonRuleEngineImpl.class,
152 BranchCoverageRule.class,
153 LineCoverageRule.class,
154 CommentDensityRule.class,
155 DuplicatedBlockRule.class,
157 SkippedTestRule.class,
159 // order is important: DebtAggregator then NewDebtAggregator (new debt requires debt)
160 DebtCalculator.class,
161 DebtAggregator.class,
162 NewDebtCalculator.class,
163 NewDebtAggregator.class,
165 RuleTagsCopier.class,
168 // visitors : order is important, measure computers must be executed at the end in order to access to every measures / issues
169 LoadComponentUuidsHavingOpenIssuesVisitor.class,
170 IntegrateIssuesVisitor.class,
171 CloseIssuesOnRemovedComponentsVisitor.class,
172 SqaleMeasuresVisitor.class,
173 SqaleNewMeasuresVisitor.class,
174 LastCommitVisitor.class,
175 MeasureComputersVisitor.class,
177 UpdateConflictResolver.class,
178 TrackerBaseInputFactory.class,
179 TrackerRawInputFactory.class,
181 TrackerExecution.class,
182 BaseIssuesLoader.class,