aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-07-27 17:39:34 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-09-04 10:50:05 +0200
commit692d67c831857cb13207ae2ecee14753b4e419c7 (patch)
treef98604346eef80ccd74a0c12950928a7ac9ef97a /server
parent874e8fdfd7cb902181914fc236c9ab46f15c8a1b (diff)
downloadsonarqube-692d67c831857cb13207ae2ecee14753b4e419c7.tar.gz
sonarqube-692d67c831857cb13207ae2ecee14753b4e419c7.zip
SONAR-6746 Drop Plugin interface + batch cleanup
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java13
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java4
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jarbin1613 -> 2079 bytes
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jarbin1613 -> 2079 bytes
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jarbin1587 -> 2050 bytes
8 files changed, 19 insertions, 22 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java
index 0b04cd571f9..c23cbb881a9 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java
@@ -22,18 +22,17 @@ package org.sonar.server.debt;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps;
-import org.picocontainer.Startable;
-import org.sonar.api.Plugin;
-import org.sonar.api.server.ServerSide;
-import org.sonar.core.platform.PluginInfo;
-import org.sonar.core.platform.PluginRepository;
-
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
+import org.picocontainer.Startable;
+import org.sonar.api.SonarPlugin;
+import org.sonar.api.server.ServerSide;
+import org.sonar.core.platform.PluginInfo;
+import org.sonar.core.platform.PluginRepository;
import static com.google.common.collect.Lists.newArrayList;
@@ -90,7 +89,7 @@ public class DebtModelPluginRepository implements Startable {
contributingPluginKeyToClassLoader.put(DEFAULT_MODEL, getClass().getClassLoader());
for (PluginInfo pluginInfo : pluginRepository.getPluginInfos()) {
String pluginKey = pluginInfo.getKey();
- Plugin plugin = pluginRepository.getPluginInstance(pluginKey);
+ SonarPlugin plugin = pluginRepository.getPluginInstance(pluginKey);
ClassLoader classLoader = plugin.getClass().getClassLoader();
if (classLoader.getResource(getXMLFilePath(pluginKey)) != null) {
contributingPluginKeyToClassLoader.put(pluginKey, classLoader);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java b/server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java
index 8f7cb251897..392f1b8ae6a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java
@@ -21,21 +21,19 @@ package org.sonar.server.platform;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
+import java.io.File;
+import java.io.IOException;
+import javax.annotation.Nullable;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.picocontainer.Startable;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
import org.sonar.api.platform.ServerFileSystem;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.core.platform.PluginInfo;
import org.sonar.core.platform.PluginRepository;
-import javax.annotation.Nullable;
-
-import java.io.File;
-import java.io.IOException;
-
/**
* Ruby on Rails requires the files to be on filesystem but not in Java classpath (JAR). This component extracts
* all the needed files from plugins and copy them to $SONAR_HOME/temp
@@ -62,7 +60,7 @@ public class RailsAppsDeployer implements Startable {
for (PluginInfo pluginInfo : pluginRepository.getPluginInfos()) {
String pluginKey = pluginInfo.getKey();
- Plugin plugin = pluginRepository.getPluginInstance(pluginKey);
+ SonarPlugin plugin = pluginRepository.getPluginInstance(pluginKey);
try {
deployRailsApp(appsDir, pluginKey, plugin.getClass().getClassLoader());
} catch (Exception e) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java
index 1bd64568383..f7f35e3c8e2 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java
@@ -24,7 +24,7 @@ import com.google.common.collect.ListMultimap;
import java.util.Map;
import org.sonar.api.Extension;
import org.sonar.api.ExtensionProvider;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
import org.sonar.api.server.ServerSide;
import org.sonar.api.utils.AnnotationUtils;
import org.sonar.core.platform.ComponentContainer;
@@ -49,7 +49,7 @@ public class ServerExtensionInstaller {
for (PluginInfo pluginInfo : pluginRepository.getPluginInfos()) {
try {
String pluginKey = pluginInfo.getKey();
- Plugin plugin = pluginRepository.getPluginInstance(pluginKey);
+ SonarPlugin plugin = pluginRepository.getPluginInstance(pluginKey);
container.addExtension(pluginInfo, plugin);
for (Object extension : plugin.getExtensions()) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
index ea29ff323f7..e0da2f5fc37 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
@@ -37,7 +37,7 @@ import java.util.Set;
import javax.annotation.Nonnull;
import org.apache.commons.io.FileUtils;
import org.picocontainer.Startable;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
import org.sonar.api.platform.Server;
import org.sonar.api.platform.ServerUpgradeStatus;
import org.sonar.api.utils.MessageException;
@@ -83,7 +83,7 @@ public class ServerPluginRepository implements PluginRepository, Startable {
// following fields are available after startup
private final Map<String, PluginInfo> pluginInfosByKeys = new HashMap<>();
- private final Map<String, Plugin> pluginInstancesByKeys = new HashMap<>();
+ private final Map<String, SonarPlugin> pluginInstancesByKeys = new HashMap<>();
public ServerPluginRepository(Server server, ServerUpgradeStatus upgradeStatus,
DefaultServerFileSystem fs, PluginLoader loader) {
@@ -348,8 +348,8 @@ public class ServerPluginRepository implements PluginRepository, Startable {
}
@Override
- public Plugin getPluginInstance(String key) {
- Plugin plugin = pluginInstancesByKeys.get(key);
+ public SonarPlugin getPluginInstance(String key) {
+ SonarPlugin plugin = pluginInstancesByKeys.get(key);
if (plugin == null) {
throw new IllegalArgumentException(format("Plugin [%s] does not exist", key));
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
index cbc4aeee1a3..68890ed20da 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
import org.sonar.api.config.License;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.config.Settings;
@@ -285,7 +285,7 @@ public final class JRubyFacade {
}
public Object getComponentByClassname(String pluginKey, String className) {
- Plugin plugin = get(PluginRepository.class).getPluginInstance(pluginKey);
+ SonarPlugin plugin = get(PluginRepository.class).getPluginInstance(pluginKey);
try {
Class componentClass = plugin.getClass().getClassLoader().loadClass(className);
return get(componentClass);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar
index 1ca2ea2d1f6..e6ba8a4cc4b 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar
+++ b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar
Binary files differ
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar
index c814e8a5176..59fc4bcfc75 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar
+++ b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar
Binary files differ
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar
index 9d608e08281..4e58b7f8b58 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar
+++ b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar
Binary files differ