diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-03-05 15:52:40 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-03-05 15:52:40 +0100 |
commit | 7509fbafb262c92c3603d5b17387c232a5748327 (patch) | |
tree | d7c7359ce5a47aee35aaad1b9630c29f913d7fda /sonar-batch | |
parent | 44358a409c99771fe1a8e2bfb64b221a70303b31 (diff) | |
download | sonarqube-7509fbafb262c92c3603d5b17387c232a5748327.tar.gz sonarqube-7509fbafb262c92c3603d5b17387c232a5748327.zip |
SONAR-4069 Remove Task and TaskDefinition from API.
Feature is postponed to version 3.6.
Diffstat (limited to 'sonar-batch')
12 files changed, 125 insertions, 16 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java index 211128bde2f..a6833247022 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java @@ -31,7 +31,7 @@ import org.sonar.api.config.Settings; import org.sonar.api.platform.ComponentContainer; import org.sonar.api.platform.PluginMetadata; import org.sonar.api.resources.Project; -import org.sonar.api.task.TaskDefinition; +import org.sonar.batch.tasks.TaskDefinition; import org.sonar.batch.bootstrapper.EnvironmentInformation; import javax.annotation.Nullable; diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskBootstrapContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskBootstrapContainer.java index 39a81ebffdb..ae0b36a5020 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskBootstrapContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskBootstrapContainer.java @@ -20,7 +20,7 @@ package org.sonar.batch.bootstrap; import org.sonar.api.batch.bootstrap.ProjectReactor; -import org.sonar.api.task.TaskDefinition; +import org.sonar.batch.tasks.TaskDefinition; import org.sonar.api.utils.SonarException; import org.sonar.batch.scan.ScanTask; import org.sonar.batch.tasks.ListTasksTask; diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java index 9c4e23c0a22..6158d3b02f1 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java @@ -23,8 +23,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.config.EmailSettings; import org.sonar.api.resources.ResourceTypes; -import org.sonar.api.task.Task; -import org.sonar.api.task.TaskDefinition; +import org.sonar.batch.tasks.Task; +import org.sonar.batch.tasks.TaskDefinition; import org.sonar.api.utils.SonarException; import org.sonar.batch.DefaultFileLinesContextFactory; import org.sonar.batch.DefaultResourceCreationLock; diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java index f007e92749d..f9e03d977d9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java @@ -22,8 +22,8 @@ package org.sonar.batch.scan; import com.google.common.annotations.VisibleForTesting; import org.sonar.api.platform.ComponentContainer; import org.sonar.api.resources.Project; -import org.sonar.api.task.Task; -import org.sonar.api.task.TaskDefinition; +import org.sonar.batch.tasks.Task; +import org.sonar.batch.tasks.TaskDefinition; import org.sonar.batch.ProjectTree; import org.sonar.batch.tasks.RequiresProject; diff --git a/sonar-batch/src/main/java/org/sonar/batch/tasks/ListTasksTask.java b/sonar-batch/src/main/java/org/sonar/batch/tasks/ListTasksTask.java index dd08729b2cf..50b8dbb7090 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/tasks/ListTasksTask.java +++ b/sonar-batch/src/main/java/org/sonar/batch/tasks/ListTasksTask.java @@ -19,9 +19,6 @@ */ package org.sonar.batch.tasks; -import org.sonar.api.task.Task; -import org.sonar.api.task.TaskDefinition; - public class ListTasksTask implements Task { public static final String COMMAND = "list-tasks"; diff --git a/sonar-batch/src/main/java/org/sonar/batch/tasks/Task.java b/sonar-batch/src/main/java/org/sonar/batch/tasks/Task.java new file mode 100644 index 00000000000..26b583efb77 --- /dev/null +++ b/sonar-batch/src/main/java/org/sonar/batch/tasks/Task.java @@ -0,0 +1,33 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.batch.tasks; + + +import org.sonar.api.task.TaskExtension; + +/** + * Implement this interface to provide the behavior of a task. + * @since 3.5 + */ +public interface Task extends TaskExtension { + + void execute(); + +} diff --git a/sonar-batch/src/main/java/org/sonar/batch/tasks/TaskDefinition.java b/sonar-batch/src/main/java/org/sonar/batch/tasks/TaskDefinition.java new file mode 100644 index 00000000000..aea3ddaa56e --- /dev/null +++ b/sonar-batch/src/main/java/org/sonar/batch/tasks/TaskDefinition.java @@ -0,0 +1,84 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar 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. + * + * Sonar 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 Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.batch.tasks; + +import org.sonar.api.task.TaskComponent; + +/** + * Implement this interface to provide a new task. + * @since 3.5 + */ +public class TaskDefinition implements TaskComponent { + + private String name; + private String description; + private String command; + private Class<? extends Task> task; + + private TaskDefinition() { + + } + + public static TaskDefinition create() { + return new TaskDefinition(); + } + + public String getName() { + return name; + } + + public TaskDefinition setName(String name) { + this.name = name; + return this; + } + + public String getDescription() { + return description; + } + + public TaskDefinition setDescription(String description) { + this.description = description; + return this; + } + + public String getCommand() { + return command; + } + + public TaskDefinition setCommand(String command) { + this.command = command; + return this; + } + + public Class<? extends Task> getTask() { + return task; + } + + public TaskDefinition setTask(Class<? extends Task> task) { + this.task = task; + return this; + } + + @Override + public String toString() { + return "Definition of task " + task + " with command " + command; + } + +} diff --git a/sonar-batch/src/main/java/org/sonar/batch/tasks/Tasks.java b/sonar-batch/src/main/java/org/sonar/batch/tasks/Tasks.java index 82af633c54b..1af4cf6f143 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/tasks/Tasks.java +++ b/sonar-batch/src/main/java/org/sonar/batch/tasks/Tasks.java @@ -24,9 +24,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.CoreProperties; import org.sonar.api.config.Settings; -import org.sonar.api.task.Task; import org.sonar.api.task.TaskComponent; -import org.sonar.api.task.TaskDefinition; import org.sonar.api.utils.SonarException; import org.sonar.batch.scan.ScanTask; diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java index ce31e79b46e..51c9c8b6750 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java @@ -32,7 +32,7 @@ import org.sonar.api.config.Settings; import org.sonar.api.platform.ComponentContainer; import org.sonar.api.platform.PluginMetadata; import org.sonar.api.resources.Project; -import org.sonar.api.task.TaskDefinition; +import org.sonar.batch.tasks.TaskDefinition; import org.sonar.api.task.TaskExtension; import org.sonar.batch.bootstrapper.EnvironmentInformation; import org.sonar.batch.tasks.RequiresProject; diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java index 03944ea0d77..9fae435cb0b 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/TaskContainerTest.java @@ -21,7 +21,7 @@ package org.sonar.batch.bootstrap; import org.junit.Test; import org.sonar.api.platform.ComponentContainer; -import org.sonar.api.task.TaskDefinition; +import org.sonar.batch.tasks.TaskDefinition; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; diff --git a/sonar-batch/src/test/java/org/sonar/batch/tasks/ListTasksTaskTest.java b/sonar-batch/src/test/java/org/sonar/batch/tasks/ListTasksTaskTest.java index d66c0c688ed..d4a91ab36ca 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/tasks/ListTasksTaskTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/tasks/ListTasksTaskTest.java @@ -20,7 +20,6 @@ package org.sonar.batch.tasks; import org.junit.Test; -import org.sonar.api.task.TaskDefinition; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; diff --git a/sonar-batch/src/test/java/org/sonar/batch/tasks/TasksTest.java b/sonar-batch/src/test/java/org/sonar/batch/tasks/TasksTest.java index 102576ec196..de478c23cf3 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/tasks/TasksTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/tasks/TasksTest.java @@ -25,8 +25,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.CoreProperties; import org.sonar.api.config.Settings; -import org.sonar.api.task.Task; -import org.sonar.api.task.TaskDefinition; import org.sonar.api.utils.SonarException; import org.sonar.batch.scan.ScanTask; |