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);
}
}
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) {
}
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;
}