aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-cobertura-plugin/pom.xml1
-rw-r--r--plugins/sonar-jacoco-plugin/pom.xml1
-rw-r--r--plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefireSensor.java1
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java19
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java29
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java18
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchModuleTest.java50
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/BootstrapExtensionExecutorTest.java55
-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
-rw-r--r--sonar-server/src/main/java/org/sonar/server/platform/Platform.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java17
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/system_updates.html.erb4
-rw-r--r--sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java1
25 files changed, 137 insertions, 336 deletions
diff --git a/plugins/sonar-cobertura-plugin/pom.xml b/plugins/sonar-cobertura-plugin/pom.xml
index bd9c6d1e54e..8533e1158d1 100644
--- a/plugins/sonar-cobertura-plugin/pom.xml
+++ b/plugins/sonar-cobertura-plugin/pom.xml
@@ -22,7 +22,6 @@
<dependency>
<groupId>org.codehaus.sonar-plugins.java</groupId>
<artifactId>sonar-java-plugin</artifactId>
- <type>sonar-plugin</type>
<version>${sonarJava.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/plugins/sonar-jacoco-plugin/pom.xml b/plugins/sonar-jacoco-plugin/pom.xml
index 40f5e3afde6..985a5d5a0d5 100644
--- a/plugins/sonar-jacoco-plugin/pom.xml
+++ b/plugins/sonar-jacoco-plugin/pom.xml
@@ -63,7 +63,6 @@
<dependency>
<groupId>org.codehaus.sonar-plugins.java</groupId>
<artifactId>sonar-java-plugin</artifactId>
- <type>sonar-plugin</type>
<version>${sonarJava.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefireSensor.java b/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefireSensor.java
index 1456df4c259..a6978f5d6a4 100644
--- a/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefireSensor.java
+++ b/plugins/sonar-surefire-plugin/src/main/java/org/sonar/plugins/surefire/SurefireSensor.java
@@ -22,7 +22,6 @@ package org.sonar.plugins.surefire;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.batch.AbstractCoverageExtension;
import org.sonar.api.batch.CoverageExtension;
import org.sonar.api.batch.DependsUpon;
import org.sonar.api.batch.Sensor;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java
index f7db951df26..e005e4f948f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchModule.java
@@ -19,7 +19,6 @@
*/
package org.sonar.batch.bootstrap;
-import org.sonar.api.Plugins;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.resources.Project;
import org.sonar.api.resources.ResourceTypes;
@@ -69,7 +68,6 @@ public class BatchModule extends Module {
container.addSingleton(MemoryOptimizer.class);
container.addSingleton(DefaultResourcePersister.class);
container.addSingleton(SourcePersister.class);
- container.addSingleton(Plugins.class);
container.addSingleton(MeasuresDao.class);
container.addSingleton(CacheRuleFinder.class);
container.addSingleton(CacheMetricFinder.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java
index 69a74c8f91d..64fbb25f8e7 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java
@@ -99,29 +99,10 @@ public class BatchPluginRepository implements PluginRepository {
}
}
- public Collection<Plugin> getPlugins() {
- return pluginsByKey.values();
- }
-
public Plugin getPlugin(String key) {
return pluginsByKey.get(key);
}
- public Map<String, Plugin> getPluginsByKey() {
- return Collections.unmodifiableMap(pluginsByKey);
- }
-
- // TODO remove this method. Not used in batch.
- public Property[] getProperties(Plugin plugin) {
- if (plugin != null) {
- Class<? extends Plugin> classInstance = plugin.getClass();
- if (classInstance.isAnnotationPresent(Properties.class)) {
- return classInstance.getAnnotation(Properties.class).value();
- }
- }
- return new Property[0];
- }
-
public Collection<PluginMetadata> getMetadata() {
return metadataByKey.values();
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java
index 8e75b551819..d170217cc38 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcDriverHolder.java
@@ -139,7 +139,7 @@ public class JdbcDriverHolder {
Class<?> lpClass = defineClass("org.sonar.batch.bootstrap.JdbcLeakPrevention", classBytes, 0, offset, this.getClass().getProtectionDomain());
Object obj = lpClass.newInstance();
- List<String> driverNames = (List<String>) obj.getClass().getMethod("clearJdbcDriverRegistrations").invoke(obj);
+ List<String> driverNames = (List<String>) obj.getClass().getMethod("unregisterDrivers").invoke(obj);
for (String name : driverNames) {
LOG.debug("To prevent a memory leak, the JDBC Driver [{}] has been forcibly deregistered", name);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java
index f067a2c08ae..001ecc3cf57 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/JdbcLeakPrevention.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* Companion of {@link JdbcDriverHolder} and allows it to deregister JDBC drivers.
@@ -38,27 +39,33 @@ import java.util.List;
public class JdbcLeakPrevention {
/**
- * @return list of names of deregistered drivers
+ * @return names of the drivers that have been unregistered
*/
- public List<String> clearJdbcDriverRegistrations() throws SQLException {
- List<String> driverNames = new ArrayList<String>();
- HashSet<Driver> originalDrivers = new HashSet<Driver>();
+ public List<String> unregisterDrivers() throws SQLException {
+ Set<Driver> registeredDrivers = registeredDrivers();
+
+ List<String> unregisteredNames = new ArrayList<String>();
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
- originalDrivers.add(drivers.nextElement());
- }
- drivers = DriverManager.getDrivers();
- while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
if (driver.getClass().getClassLoader() != this.getClass().getClassLoader()) {
continue;
}
- if (originalDrivers.contains(driver)) {
- driverNames.add(driver.getClass().getCanonicalName());
+ if (registeredDrivers.contains(driver)) {
+ unregisteredNames.add(driver.getClass().getCanonicalName());
}
DriverManager.deregisterDriver(driver);
}
- return driverNames;
+ return unregisteredNames;
+ }
+
+ private Set<Driver> registeredDrivers() {
+ Set<Driver> registeredDrivers = new HashSet<Driver>();
+ Enumeration<Driver> drivers = DriverManager.getDrivers();
+ while (drivers.hasMoreElements()) {
+ registeredDrivers.add(drivers.nextElement());
+ }
+ return registeredDrivers;
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java
index 105a3f693b5..fcafd4856a8 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/Module.java
@@ -19,17 +19,11 @@
*/
package org.sonar.batch.bootstrap;
-import org.picocontainer.ComponentAdapter;
import org.sonar.api.platform.ComponentContainer;
-import org.sonar.api.platform.PluginMetadata;
-
-import javax.annotation.Nullable;
-
-import java.util.List;
/**
* Module describes group of components - {@link #configure()}.
- * Several modules can be grouped together - {@link #install(Module)}, {@link #installChild(Module)}.
+ * Several modules can be grouped together - {@link #installChild(Module)}.
* <p/>
*/
public abstract class Module {
@@ -53,16 +47,6 @@ public abstract class Module {
}
/**
- * Installs module into this module.
- *
- * @return this
- */
- public final Module install(Module module) {
- module.init(container);
- return this;
- }
-
- /**
* Installs module into new scope - see http://picocontainer.org/scopes.html
*
* @return installed module
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
index 13bde69f4da..8ddbf991cf5 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
@@ -27,7 +27,6 @@ import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Languages;
import org.sonar.api.resources.Project;
-import org.sonar.api.utils.IocContainer;
import org.sonar.batch.DefaultProfileLoader;
import org.sonar.batch.DefaultProjectClasspath;
import org.sonar.batch.DefaultProjectFileSystem2;
@@ -73,7 +72,6 @@ public class ProjectModule extends Module {
container.addSingleton(project.getConfiguration());
container.addSingleton(ProjectSettings.class);
container.addSingleton(UnsupportedProperties.class);
- container.addSingleton(IocContainer.class);
for (Object component : projectDefinition.getContainerExtensions()) {
container.addSingleton(component);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java b/sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java
index f90c60d3480..de4ace57ffc 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java
@@ -22,20 +22,18 @@ package org.sonar.batch.phases;
import com.google.common.collect.Lists;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.resources.Project;
-import org.sonar.batch.phases.ProjectInitializer;
import org.sonar.batch.events.EventBus;
import org.sonar.batch.index.DefaultIndex;
import org.sonar.batch.index.PersistenceManager;
import java.util.Collection;
-import java.util.List;
public final class Phases {
public static Collection<Class> getPhaseClasses() {
return Lists.<Class>newArrayList(DecoratorsExecutor.class, MavenPhaseExecutor.class, MavenPluginsConfigurator.class,
- PostJobsExecutor.class, SensorsExecutor.class,
- InitializersExecutor.class, ProjectInitializer.class, UpdateStatusJob.class);
+ PostJobsExecutor.class, SensorsExecutor.class,
+ InitializersExecutor.class, ProjectInitializer.class, UpdateStatusJob.class);
}
private EventBus eventBus;
@@ -76,7 +74,7 @@ public final class Phases {
PersistenceManager persistenceManager, SensorContext sensorContext, DefaultIndex index,
EventBus eventBus, ProjectInitializer pi) {
this(decoratorsExecutor, mavenPhaseExecutor, mavenPluginsConfigurator, initializersExecutor, postJobsExecutor,
- sensorsExecutor, persistenceManager, sensorContext, index, eventBus, null, pi);
+ sensorsExecutor, persistenceManager, sensorContext, index, eventBus, null, pi);
}
/**
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchModuleTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchModuleTest.java
new file mode 100644
index 00000000000..9f297a762a2
--- /dev/null
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchModuleTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.bootstrap;
+
+import org.junit.Test;
+import org.sonar.api.batch.InstantiationStrategy;
+import org.sonar.api.platform.ComponentContainer;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+public class BatchModuleTest {
+ @Test
+ public void should_register_batch_extensions() {
+ final ExtensionInstaller extensionInstaller = mock(ExtensionInstaller.class);
+ Module bootstrapModule = new Module() {
+ @Override
+ protected void configure() {
+ // used to install project extensions
+ container.addSingleton(extensionInstaller);
+ }
+ };
+ bootstrapModule.init();
+ BatchModule module = new BatchModule();
+ bootstrapModule.installChild(module);
+
+ verify(extensionInstaller).install(any(ComponentContainer.class), eq(InstantiationStrategy.BATCH));
+ assertThat(module.container.getComponentByType(MetricProvider.class)).isNotNull();
+ }
+}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java
index 080e48c767c..c1a56e96f06 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java
@@ -62,7 +62,6 @@ public class BatchPluginRepositoryTest {
repository.doStart(Arrays.asList(checkstyle));
- assertThat(repository.getPlugins().size(), Matchers.is(1));
assertThat(repository.getPlugin("checkstyle"), not(nullValue()));
assertThat(repository.getMetadata().size(), Matchers.is(1));
assertThat(repository.getMetadata("checkstyle").getName(), Matchers.is("Checkstyle"));
@@ -82,7 +81,6 @@ public class BatchPluginRepositoryTest {
repository.doStart(Arrays.asList(checkstyle, checkstyleExt));
- assertThat(repository.getPlugins().size(), Matchers.is(2));
assertThat(repository.getPlugin("checkstyle"), not(nullValue()));
assertThat(repository.getPlugin("checkstyleextensions"), not(nullValue()));
assertThat(repository.getMetadata().size(), Matchers.is(2));
@@ -93,7 +91,7 @@ public class BatchPluginRepositoryTest {
@Test
public void shouldLoadPluginDeprecatedExtensions() throws IOException {
RemotePlugin checkstyle = new RemotePlugin("checkstyle", true)
- .addFilename("checkstyle-ext.xml");
+ .addFilename("checkstyle-ext.xml");
PluginDownloader downloader = mock(PluginDownloader.class);
when(downloader.downloadPlugin(checkstyle)).thenReturn(copyFiles("sonar-checkstyle-plugin-2.8.jar", "checkstyle-ext.xml"));
@@ -102,12 +100,11 @@ public class BatchPluginRepositoryTest {
repository.doStart(Arrays.asList(checkstyle));
- assertThat(repository.getPlugins().size(), Matchers.is(1));
assertThat(repository.getPlugin("checkstyle"), not(nullValue()));
assertThat(repository.getMetadata().size(), Matchers.is(1));
assertThat(repository.getMetadata("checkstyle").getName(), Matchers.is("Checkstyle"));
assertThat(repository.getMetadata("checkstyle").getDeployedFiles().size(), Matchers.is(5)); // plugin + 3 dependencies + 1 deprecated
- // extension
+ // extension
}
@Test
@@ -125,7 +122,6 @@ public class BatchPluginRepositoryTest {
repository.doStart(Arrays.asList(checkstyle, checkstyleExt));
- assertThat(repository.getPlugins().size(), Matchers.is(0));
assertThat(repository.getMetadata().size(), Matchers.is(0));
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BootstrapExtensionExecutorTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BootstrapExtensionExecutorTest.java
new file mode 100644
index 00000000000..6ee1a684040
--- /dev/null
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BootstrapExtensionExecutorTest.java
@@ -0,0 +1,55 @@
+package org.sonar.batch.bootstrap;
+
+import org.junit.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.picocontainer.Startable;
+import org.sonar.api.batch.InstantiationStrategy;
+import org.sonar.api.batch.bootstrap.ProjectDefinition;
+import org.sonar.api.batch.bootstrap.ProjectReactor;
+import org.sonar.api.config.Settings;
+import org.sonar.api.platform.ComponentContainer;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+public class BootstrapExtensionExecutorTest {
+ private ProjectReactor reactor = new ProjectReactor(ProjectDefinition.create().setKey("foo"));
+
+ @Test
+ public void start() {
+ ComponentContainer container = new ComponentContainer();
+ // dependencies required for ProjectExclusions
+ container.addSingleton(reactor);
+ container.addSingleton(new Settings());
+
+ // declare a bootstrap component
+ final Startable bootstrapComponent = mock(Startable.class);
+ ExtensionInstaller installer = mock(ExtensionInstaller.class);
+ doAnswer(new Answer() {
+ public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
+ ComponentContainer childContainer = (ComponentContainer) invocationOnMock.getArguments()[0];
+ childContainer.addSingleton(bootstrapComponent);
+ return null;
+ }
+ }).when(installer).install(any(ComponentContainer.class), eq(InstantiationStrategy.BOOTSTRAP));
+
+ BootstrapExtensionExecutor executor = new BootstrapExtensionExecutor(container, installer);
+ executor.start();
+
+ // should install bootstrap components into a ephemeral container
+ verify(installer).install(any(ComponentContainer.class), eq(InstantiationStrategy.BOOTSTRAP));
+ verify(bootstrapComponent).start();
+ verify(bootstrapComponent).stop();
+
+ // the ephemeral container is destroyed
+ assertThat(container.getComponentByType(ProjectExclusions.class)).isNull();
+ assertThat(container.getChild()).isNull();
+ }
+
+
+}
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 {
-
- }
-}
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
index eb261aa6f7a..23557e76574 100644
--- a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
+++ b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
@@ -21,7 +21,6 @@ package org.sonar.server.platform;
import org.apache.commons.configuration.BaseConfiguration;
import org.slf4j.LoggerFactory;
-import org.sonar.api.Plugins;
import org.sonar.api.config.EmailSettings;
import org.sonar.api.platform.ComponentContainer;
import org.sonar.api.platform.Server;
@@ -33,7 +32,6 @@ import org.sonar.api.resources.ResourceTypes;
import org.sonar.api.rules.AnnotationRuleParser;
import org.sonar.api.rules.XMLRuleParser;
import org.sonar.api.utils.HttpDownloader;
-import org.sonar.api.utils.IocContainer;
import org.sonar.api.utils.TimeProfiler;
import org.sonar.api.utils.UriReader;
import org.sonar.api.workflow.internal.DefaultWorkflow;
@@ -157,7 +155,6 @@ public final class Platform {
private void startDatabaseConnectors(ServletContext servletContext) {
rootContainer = new ComponentContainer();
rootContainer.addSingleton(servletContext);
- rootContainer.addSingleton(IocContainer.class); // for backward compatibility
rootContainer.addSingleton(new BaseConfiguration());
rootContainer.addSingleton(ServerSettings.class);
rootContainer.addSingleton(ServerImpl.class);
@@ -219,7 +216,6 @@ public final class Platform {
servicesContainer.addSingleton(ServerIdGenerator.class);
servicesContainer.addSingleton(DefaultModelFinder.class); // depends on plugins
servicesContainer.addSingleton(DefaultModelManager.class);
- servicesContainer.addSingleton(Plugins.class);
servicesContainer.addSingleton(ChartFactory.class);
servicesContainer.addSingleton(Languages.class);
servicesContainer.addSingleton(Views.class);
diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java b/sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java
index 7ba9f79f6ed..9b678016e9e 100644
--- a/sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java
+++ b/sonar-server/src/main/java/org/sonar/server/plugins/DefaultServerPluginRepository.java
@@ -72,10 +72,6 @@ public class DefaultServerPluginRepository implements ServerPluginRepository {
return disabledPlugins.contains(pluginKey);
}
- public Collection<Plugin> getPlugins() {
- return pluginsByKey.values();
- }
-
public Plugin getPlugin(String key) {
return pluginsByKey.get(key);
}
@@ -98,18 +94,7 @@ public class DefaultServerPluginRepository implements ServerPluginRepository {
return clazz;
}
-
- public Property[] getProperties(Plugin plugin) {
- if (plugin != null) {
- Class<? extends Plugin> classInstance = plugin.getClass();
- if (classInstance.isAnnotationPresent(Properties.class)) {
- return classInstance.getAnnotation(Properties.class).value();
- }
- }
- return new Property[0];
- }
-
- public Collection<PluginMetadata> getMetadata() {
+public Collection<PluginMetadata> getMetadata() {
return deployer.getMetadata();
}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/system_updates.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/system_updates.html.erb
index a4f707b32f5..11f0b26e862 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/system_updates.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/system_updates.html.erb
@@ -27,8 +27,8 @@
</tr>
</thead>
<tbody>
- <tr>
- <td>System is up to date</td>
+ <tr class="even">
+ <td>System is up to date.</td>
</tr>
</tbody>
</table>
diff --git a/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java b/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java
index 39b991dd3e0..0793b0b8e79 100644
--- a/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java
@@ -66,7 +66,6 @@ public class DefaultServerPluginRepositoryTest {
repository = new DefaultServerPluginRepository(deployer);
repository.start();
- assertThat(repository.getPlugins().size(), Is.is(1));
assertThat(repository.getPlugin("artifactsize"), not(nullValue()));
assertThat(repository.getClassLoader("artifactsize"), not(nullValue()));
assertThat(repository.getClass("artifactsize", "org.sonar.plugins.artifactsize.ArtifactSizeMetrics"), not(nullValue()));