diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-06-06 18:14:22 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-06-26 15:23:27 +0200 |
commit | fd1da108a8fce023bad8bd5f58fb0cad5e45bc0c (patch) | |
tree | 75e195e721b60d12d32f66405d0a6d434a637ba8 /server | |
parent | 7b14a735f1e76c84649469df88e702da39af7cd2 (diff) | |
download | sonarqube-fd1da108a8fce023bad8bd5f58fb0cad5e45bc0c.tar.gz sonarqube-fd1da108a8fce023bad8bd5f58fb0cad5e45bc0c.zip |
SONAR-7618 Compute Engine does not load @ServerSide components anymore
Diffstat (limited to 'server')
2 files changed, 19 insertions, 4 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java b/server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java index 6841387e8d8..22d46c12f20 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java @@ -21,12 +21,12 @@ package org.sonar.ce.platform; import org.sonar.api.SonarRuntime; import org.sonar.api.ce.ComputeEngineSide; -import org.sonar.api.server.ServerSide; import org.sonar.core.platform.PluginRepository; import org.sonar.server.plugins.ServerExtensionInstaller; public class ComputeEngineExtensionInstaller extends ServerExtensionInstaller { public ComputeEngineExtensionInstaller(SonarRuntime sonarRuntime, PluginRepository pluginRepository) { - super(sonarRuntime, pluginRepository, ServerSide.class, ComputeEngineSide.class); + super(sonarRuntime, pluginRepository, ComputeEngineSide.class); } + } 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 f5bfffe602e..76f3e86f20c 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 @@ -20,9 +20,13 @@ package org.sonar.server.plugins; import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.ListMultimap; import java.lang.annotation.Annotation; +import java.util.Collection; import java.util.Map; +import java.util.Set; +import javax.annotation.Nullable; import org.sonar.api.ExtensionProvider; import org.sonar.api.Plugin; import org.sonar.api.SonarRuntime; @@ -31,6 +35,7 @@ import org.sonar.core.platform.ComponentContainer; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; +import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; /** @@ -40,14 +45,24 @@ public abstract class ServerExtensionInstaller { private final SonarRuntime sonarRuntime; private final PluginRepository pluginRepository; - private final Class<? extends Annotation>[] supportedAnnotationTypes; + private final Set<Class<? extends Annotation>> supportedAnnotationTypes; + + protected ServerExtensionInstaller(SonarRuntime sonarRuntime, PluginRepository pluginRepository, + @Nullable Collection<Class<? extends Annotation>> supportedAnnotationTypes) { + checkArgument(supportedAnnotationTypes != null && !supportedAnnotationTypes.isEmpty(), + "At least one supported annotation type must be specified"); + this.sonarRuntime = sonarRuntime; + this.pluginRepository = pluginRepository; + this.supportedAnnotationTypes = ImmutableSet.copyOf(supportedAnnotationTypes); + + } protected ServerExtensionInstaller(SonarRuntime sonarRuntime, PluginRepository pluginRepository, Class<? extends Annotation>... supportedAnnotationTypes) { requireNonNull(supportedAnnotationTypes, "At least one supported annotation type must be specified"); this.sonarRuntime = sonarRuntime; this.pluginRepository = pluginRepository; - this.supportedAnnotationTypes = supportedAnnotationTypes; + this.supportedAnnotationTypes = ImmutableSet.copyOf(supportedAnnotationTypes); } public void installExtensions(ComponentContainer container) { |