Skip to content

Commit

Permalink
SONAR-7441 load ServerSide components in CE for backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sns-seb committed Mar 30, 2016
1 parent af6e021 commit a9d57ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Expand Up @@ -21,11 +21,12 @@

import org.sonar.api.SonarQubeVersion;
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(SonarQubeVersion sonarQubeVersion, PluginRepository pluginRepository) {
super(sonarQubeVersion, pluginRepository, ComputeEngineSide.class);
super(sonarQubeVersion, pluginRepository, ServerSide.class, ComputeEngineSide.class);
}
}
Expand Up @@ -41,14 +41,14 @@ public abstract class ServerExtensionInstaller {

private final SonarQubeVersion sonarQubeVersion;
private final PluginRepository pluginRepository;
private final Class<? extends Annotation> supportedAnnotationType;
private final Class<? extends Annotation>[] supportedAnnotationTypes;

protected ServerExtensionInstaller(SonarQubeVersion sonarQubeVersion, PluginRepository pluginRepository,
Class<? extends Annotation> supportedAnnotationType) {
requireNonNull(supportedAnnotationType, "At least one supported annotation type must be specified");
Class<? extends Annotation>... supportedAnnotationTypes) {
requireNonNull(supportedAnnotationTypes, "At least one supported annotation type must be specified");
this.sonarQubeVersion = sonarQubeVersion;
this.pluginRepository = pluginRepository;
this.supportedAnnotationType = supportedAnnotationType;
this.supportedAnnotationTypes = supportedAnnotationTypes;
}

public void installExtensions(ComponentContainer container) {
Expand Down Expand Up @@ -103,12 +103,14 @@ private void installProvider(ComponentContainer container, PluginInfo pluginInfo
}

Object installExtension(ComponentContainer container, PluginInfo pluginInfo, Object extension, boolean acceptProvider) {
if (AnnotationUtils.getAnnotation(extension, supportedAnnotationType) != null) {
if (!acceptProvider && isExtensionProvider(extension)) {
throw new IllegalStateException("ExtensionProvider can not include providers itself: " + extension);
for (Class<? extends Annotation> supportedAnnotationType : supportedAnnotationTypes) {
if (AnnotationUtils.getAnnotation(extension, supportedAnnotationType) != null) {
if (!acceptProvider && isExtensionProvider(extension)) {
throw new IllegalStateException("ExtensionProvider can not include providers itself: " + extension);
}
container.addExtension(pluginInfo, extension);
return extension;
}
container.addExtension(pluginInfo, extension);
return extension;
}
return null;
}
Expand Down

0 comments on commit a9d57ad

Please sign in to comment.