]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6746 Drop Plugin interface + batch cleanup 445/head
authorJulien HENRY <julien.henry@sonarsource.com>
Mon, 27 Jul 2015 15:39:34 +0000 (17:39 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 28 Jul 2015 09:54:49 +0000 (11:54 +0200)
31 files changed:
server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java
server/sonar-server/src/main/java/org/sonar/server/platform/RailsAppsDeployer.java
server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java
server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar
server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar
server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar
sonar-batch/src/main/java/org/sonar/batch/ProfileLoader.java [deleted file]
sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginInstaller.java
sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginRepository.java
sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionInstaller.java
sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java
sonar-batch/src/main/java/org/sonar/batch/bootstrap/PluginInstaller.java
sonar-batch/src/main/java/org/sonar/batch/compute/package-info.java [deleted file]
sonar-batch/src/main/java/org/sonar/batch/debt/package-info.java [deleted file]
sonar-batch/src/main/java/org/sonar/batch/deprecated/ResourceFilters.java [deleted file]
sonar-batch/src/main/java/org/sonar/batch/index/Data.java [deleted file]
sonar-batch/src/main/java/org/sonar/batch/index/ResourceNotPersistedException.java [deleted file]
sonar-batch/src/main/java/org/sonar/batch/index/StringData.java [deleted file]
sonar-batch/src/main/java/org/sonar/batch/mediumtest/FakePluginInstaller.java
sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java
sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchPluginRepositoryTest.java
sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionInstallerTest.java
sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java [deleted file]
sonar-core/src/main/java/org/sonar/core/i18n/I18nClassloader.java
sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java
sonar-core/src/main/java/org/sonar/core/platform/PluginRepository.java
sonar-core/src/test/java/org/sonar/core/platform/PluginLoaderTest.java
sonar-plugin-api/src/main/java/org/sonar/api/Plugin.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/SonarPlugin.java

index 0b04cd571f9deaa377935c93888af351f381e278..c23cbb881a9f95cbf8c5640b9768b6cf13bc513a 100644 (file)
@@ -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);
index 8f7cb251897f7fe773f10eaeb06d13fbf52659f3..392f1b8ae6a4b7c3fc43bde9396a2a13e827f185 100644 (file)
@@ -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) {
index 1bd645683830cfbcd92c459bd052f751a36edf5d..f7f35e3c8e26367d4c4e9ad3b4936771bdea965a 100644 (file)
@@ -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()) {
index ea29ff323f73237a25fb6c6a8048a870bffde538..e0da2f5fc379901c8b0a71acdd4efcf972795f26 100644 (file)
@@ -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));
     }
index cbc4aeee1a35ec83662c2e64e6e42069cbb7976d..68890ed20da9ce207031f3052ef3f67f35eaeb21 100644 (file)
@@ -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);
index 1ca2ea2d1f6e3fc75c260ccb5afef62c4dea3063..e6ba8a4cc4bee52945571c585f6a1cb792317a43 100644 (file)
Binary files a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar and b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.0.jar differ
index c814e8a5176b04ab473371305c38f01ad5cb327c..59fc4bcfc75b6e858b4f569ede47901f135a3232 100644 (file)
Binary files a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar and b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-decoy-plugin-1.1.jar differ
index 9d608e08281ceedf90a5c33c9ac67d22528daeb3..4e58b7f8b582f75c3c79d3bf9e2b88f112699667 100644 (file)
Binary files a/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar and b/server/sonar-server/src/test/resources/org/sonar/server/plugins/ws/PluginsWsMediumTest/sonar-foo-plugin-1.0.jar differ
diff --git a/sonar-batch/src/main/java/org/sonar/batch/ProfileLoader.java b/sonar-batch/src/main/java/org/sonar/batch/ProfileLoader.java
deleted file mode 100644 (file)
index bc00a1c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.batch;
-
-import org.sonar.api.config.Settings;
-import org.sonar.api.profiles.RulesProfile;
-
-/**
- * This interface is implemented by the views plugin!!
- *
- * @deprecated in 4.2
- */
-@Deprecated
-public interface ProfileLoader {
-
-  /**
-   * Loads quality profile for specified project.
-   */
-  RulesProfile load(Settings settings);
-
-}
index b6744b5ff4ad87b575ec312107d1ebcdd4798ec2..8bc7ba788ebd93ade2dea442f69447eec15b72b7 100644 (file)
  */
 package org.sonar.batch.bootstrap;
 
-import com.google.common.io.Files;
-
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Lists;
-
+import com.google.common.io.Files;
 import java.io.File;
 import java.io.IOException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import org.apache.commons.lang.CharUtils;
 import org.apache.commons.lang.StringUtils;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
 import org.sonar.api.utils.log.Logger;
 import org.sonar.api.utils.log.Loggers;
 import org.sonar.api.utils.log.Profiler;
@@ -82,7 +79,7 @@ public class BatchPluginInstaller implements PluginInstaller {
    * @see org.sonar.batch.mediumtest.BatchMediumTester
    */
   @Override
-  public Map<String, Plugin> installLocals() {
+  public Map<String, SonarPlugin> installLocals() {
     return Collections.emptyMap();
   }
 
index bf1d7d12519ec9481be467bf9384b8e369912642..bba8bea0ab20c7e9bc2045a511f82b5d3f23722c 100644 (file)
@@ -21,15 +21,14 @@ package org.sonar.batch.bootstrap;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
+import java.util.Collection;
+import java.util.Map;
 import org.picocontainer.Startable;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
 import org.sonar.core.platform.PluginInfo;
 import org.sonar.core.platform.PluginLoader;
 import org.sonar.core.platform.PluginRepository;
 
-import java.util.Collection;
-import java.util.Map;
-
 /**
  * Orchestrates the installation and loading of plugins
  */
@@ -38,7 +37,7 @@ public class BatchPluginRepository implements PluginRepository, Startable {
   private final PluginInstaller installer;
   private final PluginLoader loader;
 
-  private Map<String, Plugin> pluginInstancesByKeys;
+  private Map<String, SonarPlugin> pluginInstancesByKeys;
   private Map<String, PluginInfo> infosByKeys;
 
   public BatchPluginRepository(PluginInstaller installer, PluginLoader loader) {
@@ -52,7 +51,7 @@ public class BatchPluginRepository implements PluginRepository, Startable {
     pluginInstancesByKeys = Maps.newHashMap(loader.load(infosByKeys));
 
     // this part is only used by tests
-    for (Map.Entry<String, Plugin> entry : installer.installLocals().entrySet()) {
+    for (Map.Entry<String, SonarPlugin> entry : installer.installLocals().entrySet()) {
       String pluginKey = entry.getKey();
       infosByKeys.put(pluginKey, new PluginInfo(pluginKey));
       pluginInstancesByKeys.put(pluginKey, entry.getValue());
@@ -81,8 +80,8 @@ public class BatchPluginRepository implements PluginRepository, Startable {
   }
 
   @Override
-  public Plugin getPluginInstance(String key) {
-    Plugin instance = pluginInstancesByKeys.get(key);
+  public SonarPlugin getPluginInstance(String key) {
+    SonarPlugin instance = pluginInstancesByKeys.get(key);
     Preconditions.checkState(instance != null, String.format("Plugin [%s] does not exist", key));
     return instance;
   }
index aa4f22e4e1e2290bf1fa36e0754c211756b7186a..d08606930042ea056b9cfe5854f769a26b147de1 100644 (file)
 package org.sonar.batch.bootstrap;
 
 import java.util.List;
-
 import javax.annotation.Nullable;
-
 import org.sonar.api.ExtensionProvider;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
 import org.sonar.batch.bootstrapper.EnvironmentInformation;
 import org.sonar.core.platform.ComponentContainer;
 import org.sonar.core.platform.PluginInfo;
@@ -51,7 +49,7 @@ public class ExtensionInstaller {
 
     // plugin extensions
     for (PluginInfo pluginInfo : pluginRepository.getPluginInfos()) {
-      Plugin plugin = pluginRepository.getPluginInstance(pluginInfo.getKey());
+      SonarPlugin plugin = pluginRepository.getPluginInstance(pluginInfo.getKey());
       for (Object extension : plugin.getExtensions()) {
         doInstall(container, matcher, pluginInfo, extension);
       }
index b61fae769044eb897bd600330bc9d50f74fa5869..cea1eabf7bab66f5a6f781582958441e44a1cb01 100644 (file)
@@ -21,10 +21,8 @@ package org.sonar.batch.bootstrap;
 
 import java.util.List;
 import java.util.Map;
-
 import org.sonar.api.CoreProperties;
-import org.sonar.api.Plugin;
-import org.sonar.api.utils.Durations;
+import org.sonar.api.SonarPlugin;
 import org.sonar.api.utils.System2;
 import org.sonar.api.utils.UriReader;
 import org.sonar.batch.index.CachesManager;
@@ -41,8 +39,6 @@ import org.sonar.batch.repository.ServerIssuesLoader;
 import org.sonar.batch.repository.user.UserRepository;
 import org.sonar.batch.scan.ProjectScanContainer;
 import org.sonar.core.config.Logback;
-import org.sonar.core.i18n.DefaultI18n;
-import org.sonar.core.i18n.RuleI18nManager;
 import org.sonar.core.platform.ComponentContainer;
 import org.sonar.core.platform.PluginClassloaderFactory;
 import org.sonar.core.platform.PluginInfo;
@@ -82,7 +78,7 @@ public class GlobalContainer extends ComponentContainer {
       BatchPluginPredicate.class,
       ExtensionInstaller.class,
 
-      CachesManager.class,
+    CachesManager.class,
       GlobalMode.class,
       GlobalSettings.class,
       ServerClient.class,
@@ -95,9 +91,6 @@ public class GlobalContainer extends ComponentContainer {
       new PersistentCacheProvider(),
       new WSLoaderGlobalProvider(),
       System2.INSTANCE,
-      DefaultI18n.class,
-      Durations.class,
-      RuleI18nManager.class,
       new GlobalRepositoriesProvider(),
       UserRepository.class);
     addIfMissing(BatchPluginInstaller.class, PluginInstaller.class);
@@ -121,7 +114,7 @@ public class GlobalContainer extends ComponentContainer {
   private void installPlugins() {
     PluginRepository pluginRepository = getComponentByType(PluginRepository.class);
     for (PluginInfo pluginInfo : pluginRepository.getPluginInfos()) {
-      Plugin instance = pluginRepository.getPluginInstance(pluginInfo.getKey());
+      SonarPlugin instance = pluginRepository.getPluginInstance(pluginInfo.getKey());
       addExtension(pluginInfo, instance);
     }
   }
index e1213cfbe13662a26fc0a41bb8c5438da5bbfec1..dac66e617f0a8caf8f63c6cd989f378d07df5150 100644 (file)
  */
 package org.sonar.batch.bootstrap;
 
+import java.util.Map;
+import org.sonar.api.SonarPlugin;
 import org.sonar.api.batch.BatchSide;
-import org.sonar.api.Plugin;
 import org.sonar.core.platform.PluginInfo;
 
-import java.util.Map;
-
 @BatchSide
 public interface PluginInstaller {
 
@@ -39,5 +38,5 @@ public interface PluginInstaller {
    * Used only by tests.
    * @see org.sonar.batch.mediumtest.BatchMediumTester
    */
-  Map<String, Plugin> installLocals();
+  Map<String, SonarPlugin> installLocals();
 }
diff --git a/sonar-batch/src/main/java/org/sonar/batch/compute/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/compute/package-info.java
deleted file mode 100644 (file)
index 7fd21f3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.batch.compute;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/package-info.java b/sonar-batch/src/main/java/org/sonar/batch/debt/package-info.java
deleted file mode 100644 (file)
index 98d74a0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.batch.debt;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/ResourceFilters.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/ResourceFilters.java
deleted file mode 100644 (file)
index f607135..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.batch.deprecated;
-
-import com.google.common.base.Joiner;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.sonar.api.batch.ResourceFilter;
-
-/**
- * @since 1.12
- */
-public class ResourceFilters {
-
-  public ResourceFilters(ResourceFilter[] filters) {
-    this(LoggerFactory.getLogger(ResourceFilters.class), filters);
-  }
-
-  public ResourceFilters() {
-    // perfect
-  }
-
-  ResourceFilters(Logger logger, ResourceFilter[] filters) {
-    check(logger, filters);
-  }
-
-  private void check(Logger logger, ResourceFilter[] filters) {
-    if (filters.length > 0) {
-      logger.warn("ResourceFilters are not supported since version 4.2: " + Joiner.on(", ").join(filters));
-    }
-  }
-}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/Data.java b/sonar-batch/src/main/java/org/sonar/batch/index/Data.java
deleted file mode 100644 (file)
index aa47c04..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.batch.index;
-
-import java.io.Serializable;
-
-public interface Data extends Serializable {
-
-  String writeString();
-
-}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceNotPersistedException.java b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceNotPersistedException.java
deleted file mode 100644 (file)
index 1cf29c6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.batch.index;
-
-import org.sonar.api.resources.Resource;
-import org.sonar.api.utils.SonarException;
-
-/**
- * @since 2.6
- */
-public final class ResourceNotPersistedException extends SonarException {
-
-  public ResourceNotPersistedException(Resource resource) {
-    super(resource.toString());
-  }
-
-}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/StringData.java b/sonar-batch/src/main/java/org/sonar/batch/index/StringData.java
deleted file mode 100644 (file)
index 6a88b59..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.batch.index;
-
-public class StringData implements Data {
-  private String data = null;
-
-  public StringData() {
-  }
-
-  public StringData(String s) {
-    this.data = s;
-  }
-
-  public String data() {
-    return data;
-  }
-
-  @Override
-  public String writeString() {
-    return data;
-  }
-}
index cbd837c66c99619a7bbc9d723a64e302dd654dfc..f7544d2956b8f4142ed375cc7a16b6d6d61943c0 100644 (file)
  */
 package org.sonar.batch.mediumtest;
 
-import org.sonar.api.Plugin;
-import org.sonar.batch.bootstrap.PluginInstaller;
-import org.sonar.core.platform.PluginInfo;
-
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
+import org.sonar.api.SonarPlugin;
+import org.sonar.batch.bootstrap.PluginInstaller;
+import org.sonar.core.platform.PluginInfo;
 
 public class FakePluginInstaller implements PluginInstaller {
 
   private final Map<String, PluginInfo> infosByKeys = new HashMap<>();
-  private final Map<String, Plugin> instancesByKeys = new HashMap<>();
+  private final Map<String, SonarPlugin> instancesByKeys = new HashMap<>();
 
   public FakePluginInstaller add(String pluginKey, File jarFile) {
     infosByKeys.put(pluginKey, PluginInfo.create(jarFile));
     return this;
   }
 
-  public FakePluginInstaller add(String pluginKey, Plugin instance) {
+  public FakePluginInstaller add(String pluginKey, SonarPlugin instance) {
     instancesByKeys.put(pluginKey, instance);
     return this;
   }
@@ -48,7 +47,7 @@ public class FakePluginInstaller implements PluginInstaller {
   }
 
   @Override
-  public Map<String, Plugin> installLocals() {
+  public Map<String, SonarPlugin> installLocals() {
     return instancesByKeys;
   }
 }
index 1363134d449f820173b19de38014fab20c86ecb1..039da7d57e0e3dc4b6292a56498dab3098ef7e14 100644 (file)
@@ -35,7 +35,6 @@ import org.sonar.batch.bootstrap.ExtensionInstaller;
 import org.sonar.batch.bootstrap.ExtensionMatcher;
 import org.sonar.batch.bootstrap.ExtensionUtils;
 import org.sonar.batch.deprecated.DeprecatedSensorContext;
-import org.sonar.batch.deprecated.ResourceFilters;
 import org.sonar.batch.deprecated.perspectives.BatchPerspectives;
 import org.sonar.batch.events.EventBus;
 import org.sonar.batch.index.DefaultIndex;
@@ -147,7 +146,6 @@ public class ModuleScanContainer extends ComponentContainer {
       BatchExtensionDictionnary.class,
       IssueFilters.class,
       CoverageExclusions.class,
-      ResourceFilters.class,
 
     // rules
       ModuleQProfiles.class,
index 2adf1b314520b961fa7ddf954a4557b7cdb2d049..5f26078561521efd69510a65b302cfd356f492f7 100644 (file)
@@ -21,7 +21,7 @@ package org.sonar.batch.bootstrap;
 
 import com.google.common.collect.ImmutableMap;
 import org.junit.Test;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
 import org.sonar.core.platform.PluginInfo;
 import org.sonar.core.platform.PluginLoader;
 
@@ -42,7 +42,7 @@ public class BatchPluginRepositoryTest {
   public void install_and_load_plugins() {
     PluginInfo info = new PluginInfo("squid");
     ImmutableMap<String, PluginInfo> infos = ImmutableMap.of("squid", info);
-    Plugin instance = mock(Plugin.class);
+    SonarPlugin instance = mock(SonarPlugin.class);
     when(loader.load(infos)).thenReturn(ImmutableMap.of("squid", instance));
     when(installer.installRemotes()).thenReturn(infos);
 
@@ -53,7 +53,7 @@ public class BatchPluginRepositoryTest {
     assertThat(underTest.getPluginInstance("squid")).isSameAs(instance);
 
     underTest.stop();
-    verify(loader).unload(anyCollectionOf(Plugin.class));
+    verify(loader).unload(anyCollectionOf(SonarPlugin.class));
   }
 
   @Test
index aef314012cacb137cdabb464f48e739ce6b1125c..68fd361319e8255314560f34f730f29827a5ccfe 100644 (file)
  */
 package org.sonar.batch.bootstrap;
 
+import java.util.Arrays;
+import java.util.List;
 import org.apache.commons.lang.ClassUtils;
 import org.junit.Before;
 import org.junit.Test;
 import org.sonar.api.BatchExtension;
 import org.sonar.api.ExtensionProvider;
-import org.sonar.api.Plugin;
 import org.sonar.api.SonarPlugin;
 import org.sonar.api.batch.SupportedEnvironment;
 import org.sonar.batch.bootstrapper.EnvironmentInformation;
 import org.sonar.core.platform.ComponentContainer;
 import org.sonar.core.platform.PluginInfo;
 
-import java.util.Arrays;
-import java.util.List;
-
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -43,7 +41,7 @@ public class ExtensionInstallerTest {
   GlobalMode mode;
   BatchPluginRepository pluginRepository = mock(BatchPluginRepository.class);
 
-  private static Plugin newPluginInstance(final Object... extensions) {
+  private static SonarPlugin newPluginInstance(final Object... extensions) {
     return new SonarPlugin() {
       public List getExtensions() {
         return Arrays.asList(extensions);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java b/sonar-batch/src/test/java/org/sonar/batch/deprecated/ResourceFiltersTest.java
deleted file mode 100644 (file)
index 0a4ad89..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.batch.deprecated;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.sonar.api.batch.ResourceFilter;
-
-import static org.mockito.Matchers.startsWith;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-public class ResourceFiltersTest {
-  @Test
-  public void warn_on_resource_filters() {
-    Logger logger = mock(Logger.class);
-    ResourceFilter[] filters = {mock(ResourceFilter.class)};
-    new ResourceFilters(logger, filters);
-    verify(logger).warn(startsWith("ResourceFilters are not supported since version 4.2"));
-
-    // verify that the standard constructor does not fail
-    new ResourceFilters(filters);
-  }
-
-  @Test
-  public void ok_if_no_resource_filters() {
-    // just for verify that it does not fail. Should check that no warning is logged.
-    new ResourceFilters();
-  }
-}
index 4020f09ffafc99aac46c4c689eb8fa7d840619f6..2aebd74e24e10dae265d983f1f0ebd948a92159c 100644 (file)
@@ -24,7 +24,7 @@ import com.google.common.collect.Lists;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.List;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
 import org.sonar.core.platform.PluginInfo;
 import org.sonar.core.platform.PluginRepository;
 
@@ -71,7 +71,7 @@ class I18nClassloader extends URLClassLoader {
     // there may be duplicated classloaders in the list.
     List<ClassLoader> list = Lists.newArrayList();
     for (PluginInfo info : pluginRepository.getPluginInfos()) {
-      Plugin plugin = pluginRepository.getPluginInstance(info.getKey());
+      SonarPlugin plugin = pluginRepository.getPluginInstance(info.getKey());
       list.add(plugin.getClass().getClassLoader());
     }
     list.add(I18nClassloader.class.getClassLoader());
index c3a284281414fb07b9fc3b35240df103c9b8587c..9d2aa844adb738a2aa0b8a86b2833d954212f569 100644 (file)
@@ -26,7 +26,7 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.commons.lang.SystemUtils;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
 import org.sonar.api.utils.log.Loggers;
 import org.sonar.updatecenter.common.Version;
 
@@ -59,7 +59,7 @@ public class PluginLoader {
     this.classloaderFactory = classloaderFactory;
   }
 
-  public Map<String, Plugin> load(Map<String, PluginInfo> infoByKeys) {
+  public Map<String, SonarPlugin> load(Map<String, PluginInfo> infoByKeys) {
     Collection<PluginClassloaderDef> defs = defineClassloaders(infoByKeys);
     Map<PluginClassloaderDef, ClassLoader> classloaders = classloaderFactory.create(defs);
     return instantiatePluginClasses(classloaders);
@@ -113,9 +113,9 @@ public class PluginLoader {
    * @throws IllegalStateException if at least one plugin can't be correctly loaded
    */
   @VisibleForTesting
-  Map<String, Plugin> instantiatePluginClasses(Map<PluginClassloaderDef, ClassLoader> classloaders) {
+  Map<String, SonarPlugin> instantiatePluginClasses(Map<PluginClassloaderDef, ClassLoader> classloaders) {
     // instantiate plugins
-    Map<String, Plugin> instancesByPluginKey = new HashMap<>();
+    Map<String, SonarPlugin> instancesByPluginKey = new HashMap<>();
     for (Map.Entry<PluginClassloaderDef, ClassLoader> entry : classloaders.entrySet()) {
       PluginClassloaderDef def = entry.getKey();
       ClassLoader classLoader = entry.getValue();
@@ -125,7 +125,7 @@ public class PluginLoader {
         String pluginKey = mainClassEntry.getKey();
         String mainClass = mainClassEntry.getValue();
         try {
-          instancesByPluginKey.put(pluginKey, (Plugin) classLoader.loadClass(mainClass).newInstance());
+          instancesByPluginKey.put(pluginKey, (SonarPlugin) classLoader.loadClass(mainClass).newInstance());
         } catch (UnsupportedClassVersionError e) {
           throw new IllegalStateException(String.format("The plugin [%s] does not support Java %s",
             pluginKey, SystemUtils.JAVA_VERSION_TRIMMED), e);
@@ -138,8 +138,8 @@ public class PluginLoader {
     return instancesByPluginKey;
   }
 
-  public void unload(Collection<Plugin> plugins) {
-    for (Plugin plugin : plugins) {
+  public void unload(Collection<SonarPlugin> plugins) {
+    for (SonarPlugin plugin : plugins) {
       ClassLoader classLoader = plugin.getClass().getClassLoader();
       if (classLoader instanceof Closeable && classLoader != classloaderFactory.baseClassloader()) {
         try {
index 8457d391f9ce0d1b2a6c6122720518d6c89b6b07..836523abce84ffe8637ea737f739f94bc8620b19 100644 (file)
@@ -20,7 +20,7 @@
 package org.sonar.core.platform;
 
 import java.util.Collection;
-import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
 import org.sonar.api.batch.BatchSide;
 import org.sonar.api.server.ServerSide;
 
@@ -38,7 +38,7 @@ public interface PluginRepository {
   /**
    * @return the instance of {@link Plugin} for the given plugin key. Never return null.
    */
-  Plugin getPluginInstance(String key);
+  SonarPlugin getPluginInstance(String key);
 
   boolean hasPlugin(String key);
 }
index fbeae3a2483eaea3f6b7e785c25bf5b7e709fbe5..6242956e496c8d0f801b606d26675fb86454566a 100644 (file)
@@ -29,7 +29,6 @@ import org.assertj.core.data.MapEntry;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.sonar.api.Plugin;
 import org.sonar.api.SonarPlugin;
 import org.sonar.updatecenter.common.Version;
 
@@ -51,7 +50,7 @@ public class PluginLoaderTest {
     PluginClassloaderDef def = new PluginClassloaderDef("fake");
     def.addMainClass("fake", FakePlugin.class.getName());
 
-    Map<String, Plugin> instances = loader.instantiatePluginClasses(ImmutableMap.of(def, getClass().getClassLoader()));
+    Map<String, SonarPlugin> instances = loader.instantiatePluginClasses(ImmutableMap.of(def, getClass().getClassLoader()));
     assertThat(instances).containsOnlyKeys("fake");
     assertThat(instances.get("fake")).isInstanceOf(FakePlugin.class);
   }
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Plugin.java b/sonar-plugin-api/src/main/java/org/sonar/api/Plugin.java
deleted file mode 100644 (file)
index 23f5021..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.api;
-
-import java.util.List;
-
-/**
- * A plugin is a group of extensions. See <code>org.sonar.api.Extension</code> interface to browse
- * available extension points.
- * <p>The manifest property <code>Plugin-Class</code> must declare the name of the implementation class.
- * It is automatically set by sonar-packaging-maven-plugin when building plugins.</p>
- * <p>Implementation must declare a public constructor with no-parameters.</p>
- *
- * @see org.sonar.api.Extension
- * @since 1.10
- * @deprecated in 2.8. Use {@link SonarPlugin} instead.
- */
-@Deprecated
-public interface Plugin {
-
-  /**
-   * Unique key within sonar plugins
-   * @deprecated since 2.2. The key must be set in the manifest.
-   */
-  @Deprecated
-  String getKey();
-
-  /**
-   * Descriptive name
-   * @deprecated since 2.2. The name must be set in the manifest.
-   */
-  @Deprecated
-  String getName();
-
-  /**
-   * description of the plugin, can contains html or ruby code
-   * @deprecated since 2.2. The description must be set in the manifest.
-   */
-  @Deprecated
-  String getDescription();
-
-  /**
-   * Classes of the implemented extensions.
-   */
-  List getExtensions();
-
-}
index 31f2f349abed23a47aab3ee5193b1b3925dc4742..6253c7a4cc0f1bef3b81f7f4791fd153154ea722 100644 (file)
@@ -19,6 +19,8 @@
  */
 package org.sonar.api;
 
+import java.util.List;
+
 /**
  * Plugin entry-point used to declare its extensions (see {@link org.sonar.api.Extension}.
  * <p/>
@@ -27,22 +29,12 @@ package org.sonar.api;
  * 
  * @since 2.8
  */
-public abstract class SonarPlugin implements Plugin {
-
-  @Override
-  public final String getKey() {
-    throw new UnsupportedOperationException();
-  }
+public abstract class SonarPlugin {
 
-  @Override
-  public final String getName() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public final String getDescription() {
-    throw new UnsupportedOperationException();
-  }
+  /**
+   * Classes of the implemented extensions.
+   */
+  public abstract List getExtensions();
 
   /**
    * Returns a string representation of the plugin, suitable for debugging purposes only.