aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-10-27 00:29:44 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-10-27 00:29:44 +0200
commitf7a628ba80b14f5ae3a61853b7a04eca7178755f (patch)
treed79388c497d2cf323f42bce41e2b9e709e02a510 /sonar-plugin-api
parente123a94cb32ab7b73fdaffb15feea9356ddcf94f (diff)
downloadsonarqube-f7a628ba80b14f5ae3a61853b7a04eca7178755f.tar.gz
sonarqube-f7a628ba80b14f5ae3a61853b7a04eca7178755f.zip
SONAR-3895 remove unused code and fix quality flaws
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/Plugins.java63
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java64
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/PluginRepository.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/IocContainer.java61
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractCoverageExtensionTest.java44
8 files changed, 4 insertions, 247 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Plugins.java b/sonar-plugin-api/src/main/java/org/sonar/api/Plugins.java
deleted file mode 100644
index 6cab9b97ce8..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/Plugins.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.api;
-
-import org.sonar.api.platform.PluginRepository;
-
-import java.util.Collection;
-
-/**
- * Plugins dictionary. This class is for internal use
- *
- * @since 1.10
- * @deprecated since 2.1
- */
-@Deprecated
-public class Plugins {
-
- private PluginRepository pluginProvider;
-
- /**
- * Creates the dictionnary of plugins
- */
- public Plugins(PluginRepository pluginProvider) {
- this.pluginProvider = pluginProvider;
- }
-
- /**
- * Gives a collection of available plugins in the Sonar instance
- */
- public Collection<Plugin> getPlugins() {
- return pluginProvider.getPlugins();
- }
-
- /**
- * Returns a plugin based on its key
- */
- public Plugin getPlugin(String key) {
- return pluginProvider.getPlugin(key);
- }
- /**
- * Returns the list of properties of a plugin
- */
- public Property[] getProperties(Plugin plugin) {
- return pluginProvider.getProperties(plugin);
- }
-} \ No newline at end of file
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java
deleted file mode 100644
index a9f23561864..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AbstractCoverageExtension.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.api.batch;
-
-import org.sonar.api.Plugins;
-import org.sonar.api.resources.Project;
-
-/**
- * This class implements the management of the code coverage engine if there are several.
- * It is a pre-implementation for Sensors and Decorators
- *
- * @since 1.10
- * @deprecated since 2.6 was superseded by interface {@link CoverageExtension}
- */
-@Deprecated
-public abstract class AbstractCoverageExtension implements CoverageExtension {
-
- /**
- * The plugin key to retrieve the coverage engine to be used
- */
- public static final String PARAM_PLUGIN = "sonar.core.codeCoveragePlugin";
-
- /**
- * The default value for the code coverage plugin
- */
- public static final String DEFAULT_PLUGIN = "cobertura";
-
- /**
- * Default constructor
- *
- * @param plugins the list of plugins available
- * @deprecated since 2.3. Use the default constructor
- */
- @Deprecated
- public AbstractCoverageExtension(Plugins plugins) {
- }
-
- public AbstractCoverageExtension() {
- }
-
- /**
- * Whether to implement the extension on the project
- */
- public boolean shouldExecuteOnProject(Project project) {
- return project.getAnalysisType().isDynamic(true);
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java
index fa03621d733..9f3a7f94e3e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java
@@ -34,7 +34,7 @@ import java.util.Properties;
*
* @since 2.9
*/
-public final class ProjectDefinition {
+public class ProjectDefinition {
public static final String SOURCE_DIRS_PROPERTY = "sonar.sources";
public static final String SOURCE_FILES_PROPERTY = "sonar.sourceFiles";
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java
index 20ce3d21fbb..7a4a971deea 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java
@@ -19,13 +19,15 @@
*/
package org.sonar.api.batch.bootstrap;
+import org.sonar.api.BatchComponent;
+
import java.util.ArrayList;
import java.util.List;
/**
* @since 2.9
*/
-public class ProjectReactor {
+public class ProjectReactor implements BatchComponent {
private ProjectDefinition root;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java
index c95e320ac92..b807fb30cf6 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java
@@ -154,13 +154,4 @@ public class ComponentContainer implements BatchComponent, ServerComponent {
public ComponentContainer getChild() {
return child;
}
-
- /**
- * Warning - do not use. This method exists only for the backward-compatibility due to the suppression
- * of {@link org.sonar.api.utils.IocContainer}
- * @return
- */
- public MutablePicoContainer getPicoContainer() {
- return pico;
- }
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/PluginRepository.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/PluginRepository.java
index 0acd4c40798..f76d40def19 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/PluginRepository.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/PluginRepository.java
@@ -27,12 +27,8 @@ import org.sonar.api.ServerComponent;
import java.util.Collection;
public interface PluginRepository extends BatchComponent, ServerComponent {
- Collection<Plugin> getPlugins();
-
Plugin getPlugin(String key);
- Property[] getProperties(Plugin plugin);
-
/**
* Metadata of installed plugins. Metadata includes all the fields available in update center
* (plugin key, name, version, description, license, ...) and some technical information like
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/IocContainer.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/IocContainer.java
deleted file mode 100644
index 19ae89480fb..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/IocContainer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.api.utils;
-
-import org.picocontainer.Characteristics;
-import org.picocontainer.DefaultPicoContainer;
-import org.picocontainer.MutablePicoContainer;
-import org.picocontainer.behaviors.OptInCaching;
-import org.picocontainer.lifecycle.ReflectionLifecycleStrategy;
-import org.picocontainer.monitors.NullComponentMonitor;
-import org.sonar.api.platform.ComponentContainer;
-
-
-/**
- * Proxy to inject the container as a component$
- *
- * @since 1.10
- * @deprecated since 2.12. To be replaced by {@link org.sonar.api.platform.ComponentContainer}
- */
-@Deprecated
-public class IocContainer {
- private final MutablePicoContainer pico;
-
- public IocContainer(MutablePicoContainer pico) {
- this.pico = pico;
- }
-
- public IocContainer(ComponentContainer container) {
- this.pico = container.getPicoContainer();
- }
-
- public MutablePicoContainer getPicoContainer() {
- return pico;
- }
-
- public static MutablePicoContainer buildPicoContainer() {
- ReflectionLifecycleStrategy lifecycleStrategy = new ReflectionLifecycleStrategy(new
- NullComponentMonitor(), "start", "stop", "dispose");
-
- DefaultPicoContainer result = new DefaultPicoContainer(new OptInCaching(), lifecycleStrategy, null);
- result.as(Characteristics.CACHE).addComponent(new IocContainer(result)); // for components that directly inject other components (eg Plugins)
- return result;
- }
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractCoverageExtensionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractCoverageExtensionTest.java
deleted file mode 100644
index 35d3c1bb61a..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractCoverageExtensionTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.api.batch;
-
-import org.junit.Test;
-import org.sonar.api.resources.Project;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class AbstractCoverageExtensionTest {
-
- @Test
- public void doNotExecuteIfStaticAnalysis() {
- Project project = mock(Project.class);
- when(project.getAnalysisType()).thenReturn(Project.AnalysisType.STATIC);
- FakeCoverageSensor sensor = new FakeCoverageSensor();
-
- assertThat(sensor.shouldExecuteOnProject(project), is(false));
- }
-
- protected static class FakeCoverageSensor extends AbstractCoverageExtension {
-
- }
-}