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.taskprocessor.report;
22 import java.util.Collections;
24 import javax.annotation.CheckForNull;
25 import org.sonar.core.platform.ComponentContainer;
26 import org.sonar.db.ce.CeTaskTypes;
27 import org.sonar.server.computation.container.ComputeEngineContainer;
28 import org.sonar.server.computation.container.ContainerFactory;
29 import org.sonar.server.computation.queue.CeTask;
30 import org.sonar.server.computation.step.ComputationStepExecutor;
31 import org.sonar.server.computation.taskprocessor.CeTaskProcessor;
32 import org.sonar.server.devcockpit.DevCockpitBridge;
34 public class ReportTaskProcessor implements CeTaskProcessor {
36 private static final Set<String> HANDLED_TYPES = Collections.singleton(CeTaskTypes.REPORT);
38 private final ContainerFactory containerFactory;
39 private final ComponentContainer serverContainer;
41 private final DevCockpitBridge devCockpitBridge;
44 * Used when Developer Cockpit plugin is installed
46 public ReportTaskProcessor(ContainerFactory containerFactory, ComponentContainer serverContainer, DevCockpitBridge devCockpitBridge) {
47 this.containerFactory = containerFactory;
48 this.serverContainer = serverContainer;
49 this.devCockpitBridge = devCockpitBridge;
53 * Used when Developer Cockpit plugin is not installed
55 public ReportTaskProcessor(ContainerFactory containerFactory, ComponentContainer serverContainer) {
56 this.containerFactory = containerFactory;
57 this.serverContainer = serverContainer;
58 this.devCockpitBridge = null;
62 public Set<String> getHandledCeTaskTypes() {
67 public void process(CeTask task) {
68 ComputeEngineContainer ceContainer = containerFactory.create(serverContainer, task, devCockpitBridge);
70 ceContainer.getComponentByType(ComputationStepExecutor.class).execute();
72 ceContainer.cleanup();