diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2018-06-22 16:08:21 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2018-06-29 09:10:14 +0200 |
commit | 525ed917b32bfd43f2517c03d500d7a557240ce0 (patch) | |
tree | 2ad9f85224ee8ac1563d7338f2856c28551acf23 /server/sonar-ce-task/src | |
parent | c002746f61bfb24188e505887a18f5b8214f3464 (diff) | |
download | sonarqube-525ed917b32bfd43f2517c03d500d7a557240ce0.tar.gz sonarqube-525ed917b32bfd43f2517c03d500d7a557240ce0.zip |
move some classes in preparation of creation of sonar-ce-common
Diffstat (limited to 'server/sonar-ce-task/src')
-rw-r--r-- | server/sonar-ce-task/src/main/java/org/sonar/ce/task/taskprocessor/CeTaskProcessor.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/server/sonar-ce-task/src/main/java/org/sonar/ce/task/taskprocessor/CeTaskProcessor.java b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/taskprocessor/CeTaskProcessor.java new file mode 100644 index 00000000000..88140137d37 --- /dev/null +++ b/server/sonar-ce-task/src/main/java/org/sonar/ce/task/taskprocessor/CeTaskProcessor.java @@ -0,0 +1,63 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program 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. + * + * This program 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.ce.task.taskprocessor; + +import java.util.Set; +import javax.annotation.CheckForNull; +import org.sonar.api.ce.ComputeEngineSide; +import org.sonar.api.server.ServerSide; +import org.sonar.ce.task.CeTask; +import org.sonar.ce.task.CeTaskResult; + +/** + * This interface is used to provide the processing code for {@link CeTask}s of one or more type to be called by the + * Compute Engine. + */ +@ComputeEngineSide +@ServerSide +public interface CeTaskProcessor { + + /** + * The {@link CeTask#getType()} for which this {@link CeTaskProcessor} provides the processing code. + * <p> + * The match of type is done using {@link String#equals(Object)} and if more than one {@link CeTaskProcessor} declares + * itself had handler for the same {@link CeTask#getType()}, an error will be raised at startup and startup will + * fail. + * </p> + * <p> + * If an empty {@link Set} is returned, the {@link CeTaskProcessor} will be ignored. + * </p> + */ + Set<String> getHandledCeTaskTypes(); + + /** + * Calls the processing code for a specific {@link CeTask} which will optionally return a {@link CeTaskResult} + * holding information to be persisted in the processing history of the Compute Engine (currently the {@code CE_ACTIVITY} table). + * <p> + * The specified is guaranteed to be non {@code null} and its {@link CeTask#getType()} to be one of the values + * of {@link #getHandledCeTaskTypes()}. + * </p> + * + * @throws RuntimeException when thrown, it will be caught and logged by the Compute Engine and the processing of the + * specified {@link CeTask} will be flagged as failed. + */ + @CheckForNull + CeTaskResult process(CeTask task); +} |