diff options
Diffstat (limited to 'sonar-plugin-api/src/main/java/org')
110 files changed, 623 insertions, 251 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java index 21c785caa1e..f6585e9ce4c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java @@ -36,6 +36,9 @@ package org.sonar.api; * </pre> * * @since 2.2 + * @deprecated since 5.2 use {@link BatchSide} annotation */ +@Deprecated +@BatchSide public interface BatchComponent { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java b/sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java index 95cc1c0f8f7..e24322a2609 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java @@ -24,7 +24,9 @@ package org.sonar.api; * by plugins. * * @since 1.10 + * @deprecated since 5.2 replaced by {@link BatchSide} and {@link ExtensionPoint} annotations */ +@Deprecated public interface BatchExtension extends Extension, BatchComponent { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/BatchSide.java b/sonar-plugin-api/src/main/java/org/sonar/api/BatchSide.java new file mode 100644 index 00000000000..323e44d175c --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/BatchSide.java @@ -0,0 +1,50 @@ +/* + * 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.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marker annotation for all the components available in container of batch (code analyzer). Note that + * injection of dependencies by constructor is used : + * <pre> + * {@literal @}BatchSide + * public class Foo { + * + * } + * {@literal @}BatchSide + * public class Bar { + * private final Foo foo; + * public Bar(Foo f) { + * this.foo = f; + * } + * } + * + * </pre> + * + * @since 5.2 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface BatchSide { +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Extension.java b/sonar-plugin-api/src/main/java/org/sonar/api/Extension.java index 1c5c8a52c07..f5cbf9e4161 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/Extension.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/Extension.java @@ -23,6 +23,9 @@ package org.sonar.api; * Plugin extension point * * @since 1.10 + * @deprecated since 5.2 replaced by {@link ExtensionPoint} annotation */ +@Deprecated +@ExtensionPoint public interface Extension { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java b/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java new file mode 100644 index 00000000000..6ccf977aa86 --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java @@ -0,0 +1,36 @@ +/* + * 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.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marker annotation for all the interfaces that are extension point (ie can be implemented by plugins + * and will be called at some point of time by the platform). + * + * @since 5.2 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ExtensionPoint { +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java index 281c3058a7a..2ace0f246d5 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java @@ -23,6 +23,9 @@ package org.sonar.api; * Same than {@link org.sonar.api.BatchComponent} but for server-side components. * * @since 2.2 + * @deprecated since 5.2 use {@link ServerSide} annotation */ +@Deprecated +@ServerSide public interface ServerComponent { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java b/sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java index 52a0051230c..49fcabf3f3b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java @@ -23,6 +23,8 @@ package org.sonar.api; * Server extension point. * * @since 1.10 + * @deprecated since 5.2 replaced by {@link ServerSide} and {@link ExtensionPoint} annotations */ +@Deprecated public interface ServerExtension extends Extension, ServerComponent { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ServerSide.java b/sonar-plugin-api/src/main/java/org/sonar/api/ServerSide.java new file mode 100644 index 00000000000..6beb3b0951b --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/ServerSide.java @@ -0,0 +1,35 @@ +/* + * 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.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Same than {@link org.sonar.api.BatchSide} but for server-side components. + * + * @since 5.2 + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ServerSide { +} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java index 300215a1591..df652a6a6eb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java @@ -19,13 +19,14 @@ */ package org.sonar.api.batch; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; /** * Use this component to find the current running mode. * @since 5.1 */ -public interface AnalysisMode extends BatchComponent { +@BatchSide +public interface AnalysisMode { boolean isPreview(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java index 779f79c4630..f755e50cb6f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java @@ -19,13 +19,16 @@ */ package org.sonar.api.batch; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; /** * @since 2.6 * @deprecated since 5.2 not used anymore */ @Deprecated -public interface CoverageExtension extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface CoverageExtension { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java index 71c48c45a04..ab7d930b5b4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java @@ -20,7 +20,8 @@ package org.sonar.api.batch; import net.sourceforge.pmd.cpd.Tokenizer; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.resources.Language; import org.sonar.api.resources.Resource; @@ -31,7 +32,9 @@ import java.util.List; * Implement this extension to get Copy/Paste detection for your language. * @since 1.10 */ -public interface CpdMapping extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface CpdMapping { Tokenizer getTokenizer(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java index b3f2792b507..70d018299bb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java @@ -19,13 +19,16 @@ */ package org.sonar.api.batch; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.resources.Resource; /** * @since 1.10 */ -public interface Decorator extends BatchExtension, CheckProject { +@BatchSide +@ExtensionPoint +public interface Decorator extends CheckProject { /** * @param resource resource that is currently decorated, equivalent of <code>context.getResource()</code> diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java index a530f6cc954..0758dcd9b23 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java @@ -19,7 +19,8 @@ */ package org.sonar.api.batch; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.resources.Project; /** @@ -34,7 +35,9 @@ import org.sonar.api.resources.Project; * * @since 2.6 */ -public abstract class Initializer implements BatchExtension, CheckProject { +@BatchSide +@ExtensionPoint +public abstract class Initializer implements CheckProject { @Override public boolean shouldExecuteOnProject(Project project) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java index 5cfea413fc5..46b2e7abd26 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java @@ -25,7 +25,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Define instantiation strategy of batch extensions. If an extension is not annotated, then default value + * Define instantiation strategy of batch IoC components. If a component is not annotated, then default value * is {@link org.sonar.api.batch.InstantiationStrategy#PER_PROJECT}. * @since 4.4 */ diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java index a01a83178e0..7279bea5301 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java @@ -19,7 +19,8 @@ */ package org.sonar.api.batch; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.resources.Project; /** @@ -30,7 +31,9 @@ import org.sonar.api.resources.Project; * * @since 1.10 */ -public interface PostJob extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface PostJob { void executeOn(Project project, SensorContext context); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java index 98502636ad2..f97e5df5e31 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java @@ -21,7 +21,7 @@ package org.sonar.api.batch; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.project.MavenProject; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.utils.SonarException; import java.io.File; @@ -36,7 +36,8 @@ import java.util.List; * @deprecated since 4.5 this is some Java specific stuff that should by handled by SQ Java plugin */ @Deprecated -public class ProjectClasspath implements BatchComponent { +@BatchSide +public class ProjectClasspath { protected MavenProject pom; private List<File> elements; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java index fc055e6da5c..7bc1dd1197c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java @@ -19,7 +19,8 @@ */ package org.sonar.api.batch; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.resources.Project; /** @@ -41,7 +42,9 @@ import org.sonar.api.resources.Project; * * @since 1.10 */ -public interface Sensor extends BatchExtension, CheckProject { +@BatchSide +@ExtensionPoint +public interface Sensor extends CheckProject { /** * Sensors that depend upon Squid must declare the following method : diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java index 4322439a220..0356a3bb1a3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java @@ -25,15 +25,15 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * This annotation allows to specify in which environments {@link org.sonar.api.BatchExtension} would be active. + * This annotation allows to specify in which environments {@link org.sonar.api.BatchSide} components would be active. * For example: "maven", "ant". * Usage of this annotation is discouraged and we strictly recommend you to not overuse it. - * Most preferable is to design extensions to work in all environments. + * Most preferable is to design components to work in all environments. * * @since 2.6 */ @Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE }) +@Target({ElementType.TYPE}) public @interface SupportedEnvironment { String[] value(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java index 81ffb504294..ed61ad1faec 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.measures.Measure; import java.util.List; @@ -32,7 +32,8 @@ import java.util.List; */ @Deprecated @RequiresDB -public interface TimeMachine extends BatchComponent { +@BatchSide +public interface TimeMachine { /** * Past measures, sorted by date. Returns all fields. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java index 7ddcd960049..307c6960879 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java @@ -19,7 +19,8 @@ */ package org.sonar.api.batch.bootstrap; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.batch.InstantiationStrategy; /** @@ -34,8 +35,10 @@ import org.sonar.api.batch.InstantiationStrategy; * * @since 2.9 */ +@BatchSide @InstantiationStrategy(InstantiationStrategy.PER_BATCH) -public abstract class ProjectBuilder implements BatchExtension { +@ExtensionPoint +public abstract class ProjectBuilder { /** * Plugins can use the implementation {@link org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext} @@ -44,6 +47,7 @@ public abstract class ProjectBuilder implements BatchExtension { public interface Context { ProjectReactor projectReactor(); } + /** * Don't inject ProjectReactor as it may not be available * @deprecated since 3.7 use {@link #ProjectBuilder()} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java index a272c2f1cb9..2d58e233af1 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch.bootstrap; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import java.util.ArrayList; import java.util.List; @@ -27,7 +27,8 @@ import java.util.List; /** * @since 2.9 */ -public class ProjectReactor implements BatchComponent { +@BatchSide +public class ProjectReactor { private ProjectDefinition root; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java index 4be4aa1389c..412593db9ad 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java @@ -19,14 +19,17 @@ */ package org.sonar.api.batch.events; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; /** - * Marker interface for event handlers. + * Common interface for event handlers. * This interface is not intended to be implemented by clients. * * @since 2.8 */ -public interface EventHandler extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface EventHandler { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java index 64b80ea8b3c..0ce72b884fd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch.fs; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import javax.annotation.CheckForNull; @@ -53,7 +53,8 @@ import java.util.SortedSet; * * @since 4.2 */ -public interface FileSystem extends BatchComponent { +@BatchSide +public interface FileSystem { /** * Absolute base directory of module diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java index 91836823e43..7033aacbb75 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java @@ -19,13 +19,16 @@ */ package org.sonar.api.batch.fs; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; /** * Extension point to exclude some files from inspection * @since 4.2 */ -public interface InputFileFilter extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface InputFileFilter { boolean accept(InputFile f); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java index fa894077be4..0862cfca9e8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java @@ -19,13 +19,14 @@ */ package org.sonar.api.batch.fs.internal; +import org.sonar.api.BatchSide; + import com.google.common.base.Charsets; import com.google.common.primitives.Ints; import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.ByteOrderMark; import org.apache.commons.io.input.BOMInputStream; -import org.sonar.api.BatchComponent; import org.sonar.api.CoreProperties; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @@ -33,7 +34,12 @@ import org.sonar.api.utils.log.Loggers; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; import java.nio.charset.Charset; import java.security.MessageDigest; import java.util.ArrayList; @@ -43,7 +49,8 @@ import java.util.List; * Computes hash of files. Ends of Lines are ignored, so files with * same content but different EOL encoding have the same hash. */ -public class FileMetadata implements BatchComponent { +@BatchSide +public class FileMetadata { private static final Logger LOG = Loggers.get(FileMetadata.class); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java index 4f91ea5aae4..4bb74ed232d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch.measure; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import javax.annotation.CheckForNull; @@ -29,7 +29,8 @@ import java.util.List; /** * @since 4.5 */ -public interface MetricFinder extends BatchComponent { +@BatchSide +public interface MetricFinder { @CheckForNull Metric findByKey(String key); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java index 06ac3e3533c..2e37e179404 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java @@ -20,7 +20,8 @@ package org.sonar.api.batch.postjob; import com.google.common.annotations.Beta; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; /** * PostJobs are executed at the very end of batch analysis. A PostJob can't do any modification @@ -31,7 +32,9 @@ import org.sonar.api.BatchExtension; * @since 5.2 */ @Beta -public interface PostJob extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface PostJob { /** * Populate {@link PostJobDescriptor} of this PostJob. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java index e717c35d83a..45e069cf955 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch.rule; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.rule.RuleKey; import javax.annotation.CheckForNull; @@ -35,7 +35,8 @@ import java.util.Collection; * * @since 4.2 */ -public interface ActiveRules extends BatchComponent { +@BatchSide +public interface ActiveRules { /** * Find a {@link ActiveRule} by the associated rule key. <code>null</code> diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java index d479d24806b..93fca999844 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch.rule; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; /** * Creates {@link org.sonar.api.batch.rule.Checks}. This class is available @@ -27,7 +27,8 @@ import org.sonar.api.BatchComponent; * * @since 4.2 */ -public class CheckFactory implements BatchComponent { +@BatchSide +public class CheckFactory { private final ActiveRules activeRules; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java index 7690bd56c94..47bcec5bc45 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch.rule; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.rule.RuleKey; import javax.annotation.CheckForNull; @@ -32,7 +32,8 @@ import java.util.Collection; * * @since 4.2 */ -public interface Rules extends BatchComponent { +@BatchSide +public interface Rules { /** * Get a rule by its key. Returns <code>null</code> if rule does not exist. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java index b6e16d48bc7..063e4ac0f37 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch.scm; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.batch.InstantiationStrategy; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; @@ -31,7 +31,8 @@ import java.util.List; * @since 5.0 */ @InstantiationStrategy(InstantiationStrategy.PER_BATCH) -public abstract class BlameCommand implements BatchComponent { +@BatchSide +public abstract class BlameCommand { /** * Compute blame of the provided files. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java index c3f86878293..a00a8d54bd7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java @@ -19,8 +19,9 @@ */ package org.sonar.api.batch.scm; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; import org.sonar.api.CoreProperties; +import org.sonar.api.ExtensionPoint; import org.sonar.api.batch.InstantiationStrategy; import java.io.File; @@ -29,8 +30,10 @@ import java.io.File; * See {@link CoreProperties#LINKS_SOURCES_DEV} to get old Maven URL format. * @since 5.0 */ +@BatchSide @InstantiationStrategy(InstantiationStrategy.PER_BATCH) -public abstract class ScmProvider implements BatchExtension { +@ExtensionPoint +public abstract class ScmProvider { /** * Unique identifier of the provider. Can be passed to {@link CoreProperties#SCM_PROVIDER_KEY} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java index fe2d78b5cad..35bda609ea9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java @@ -20,7 +20,8 @@ package org.sonar.api.batch.sensor; import com.google.common.annotations.Beta; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; /** * <p> @@ -35,7 +36,9 @@ import org.sonar.api.BatchExtension; * @since 5.1 */ @Beta -public interface Sensor extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface Sensor { /** * Populate {@link SensorDescriptor} of this sensor. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java index 6f81ce61226..10beba2c5d3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java @@ -19,7 +19,7 @@ */ package org.sonar.api.batch.sensor.internal; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage; import org.sonar.api.batch.sensor.dependency.Dependency; import org.sonar.api.batch.sensor.duplication.Duplication; @@ -31,7 +31,8 @@ import org.sonar.api.batch.sensor.measure.Measure; * Interface for storing data computed by sensors. * @since 5.1 */ -public interface SensorStorage extends BatchComponent { +@BatchSide +public interface SensorStorage { void store(Measure measure); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java b/sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java index 8f16849892e..d2f86d7800b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java @@ -19,14 +19,16 @@ */ package org.sonar.api.component; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; /** * @deprecated since 5.2 unused */ @Deprecated -public interface Perspectives extends BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public interface Perspectives { <P extends Perspective> P as(Class<P> perspectiveClass, Component component); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java b/sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java index 61a669ee75c..d4afa4d5389 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java @@ -19,14 +19,15 @@ */ package org.sonar.api.component; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import javax.annotation.CheckForNull; /** * @since 3.6 */ -public interface RubyComponentService extends ServerComponent { +@ServerSide +public interface RubyComponentService { @CheckForNull Component findByKey(String key); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java index 5d955aa1ec9..5e45bcc6185 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java @@ -20,16 +20,18 @@ package org.sonar.api.config; import com.google.common.base.Objects; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.CoreProperties; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; /** * If batch extensions use this component, then batch must be executed with administrator rights (see properties sonar.login and sonar.password) * * @since 3.2 */ -public class EmailSettings implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public class EmailSettings { public static final String SMTP_HOST = "email.smtp_host.secured"; public static final String SMTP_HOST_DEFAULT = ""; public static final String SMTP_PORT = "email.smtp_port.secured"; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java index dae8b5238ad..5d1be0f877d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java @@ -19,7 +19,8 @@ */ package org.sonar.api.config; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import javax.annotation.Nullable; @@ -33,7 +34,9 @@ import javax.annotation.Nullable; * * @since 3.0 */ -public abstract class GlobalPropertyChangeHandler implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class GlobalPropertyChangeHandler { public static final class PropertyChange { private String key; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java index c8c73bde7e5..b82b340e4ba 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java @@ -25,10 +25,11 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.Property; import org.sonar.api.PropertyType; -import org.sonar.api.ServerExtension; +import org.sonar.api.ServerSide; import org.sonar.api.resources.Qualifiers; import javax.annotation.Nullable; @@ -67,7 +68,10 @@ import java.util.List; * * @since 3.6 */ -public final class PropertyDefinition implements BatchExtension, ServerExtension { +@BatchSide +@ServerSide +@ExtensionPoint +public final class PropertyDefinition { private String key; private String defaultValue; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java index b44f6696d27..4907cda4609 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java @@ -21,11 +21,11 @@ package org.sonar.api.config; import com.google.common.base.Strings; import org.apache.commons.lang.StringUtils; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.CoreProperties; import org.sonar.api.Properties; import org.sonar.api.Property; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.AnnotationUtils; import javax.annotation.Nullable; @@ -41,7 +41,9 @@ import java.util.Map; * * @since 2.12 */ -public final class PropertyDefinitions implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public final class PropertyDefinitions { private final Map<String, PropertyDefinition> definitions = new HashMap<>(); private final Map<String, Category> categories = new HashMap<>(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java index 662c661d195..8c20de9b3a5 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java @@ -26,8 +26,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import org.sonar.api.utils.DateUtils; import javax.annotation.Nullable; @@ -85,7 +85,9 @@ import java.util.Properties; * </p> * @since 2.12 */ -public class Settings implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public class Settings { protected Map<String, String> properties; protected PropertyDefinitions definitions; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java index 74bd4939f42..f6474fd8fa0 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java @@ -19,10 +19,11 @@ */ package org.sonar.api.database; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import javax.persistence.EntityManager; import javax.persistence.Query; + import java.util.List; /** @@ -30,14 +31,13 @@ import java.util.List; * * @since 1.10 */ -public abstract class DatabaseSession implements BatchComponent { - +@BatchSide +public abstract class DatabaseSession { // IMPORTANT : this value must be the same than the property // hibernate.jdbc.batch_size from /META-INF/persistence.xml (module sonar-database) public static final int BATCH_SIZE = 30; - public abstract EntityManager getEntityManager(); public abstract void start(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java index 3cc0936c099..03fd8c9913e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java @@ -19,8 +19,8 @@ */ package org.sonar.api.i18n; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import javax.annotation.Nullable; @@ -32,7 +32,9 @@ import java.util.Locale; * * @since 2.10 */ -public interface I18n extends ServerComponent, BatchComponent { +@BatchSide +@ServerSide +public interface I18n { /** * Searches the message of the <code>key</code> for the <code>locale</code> in the list of available bundles. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java index 0dbcee23cc7..ef9c68009ed 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java @@ -19,8 +19,8 @@ */ package org.sonar.api.i18n; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import org.sonar.api.rules.Rule; import javax.annotation.CheckForNull; @@ -34,7 +34,9 @@ import java.util.Locale; * @deprecated in 4.1. Rules are not localized anymore. See http://jira.codehaus.org/browse/SONAR-4885 */ @Deprecated -public interface RuleI18n extends ServerComponent, BatchComponent { +@BatchSide +@ServerSide +public interface RuleI18n { /** * Returns the localized name of the rule identified by its repository key and rule key. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java index 778b57135c7..b87f69dc7f0 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java @@ -171,7 +171,7 @@ public interface Issue extends Serializable { * Non-null list of comments, ordered by chronological order. * <p/> * IMPORTANT: existing comments are not loaded when this method is called when analyzing project - * (from {@link org.sonar.api.BatchExtension}). + * (from {@link org.sonar.api.BatchSide}). */ List<IssueComment> comments(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java index 8592f9513d6..903a5a7e692 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java @@ -19,14 +19,17 @@ */ package org.sonar.api.issue; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; /** * @since 3.6 * @deprecated since 4.0 */ @Deprecated -public interface IssueFilter extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface IssueFilter { boolean accept(Issue issue); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java index 794859794a7..205b6a02ccb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java @@ -19,7 +19,8 @@ */ package org.sonar.api.issue; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.user.User; import javax.annotation.Nullable; @@ -27,7 +28,9 @@ import javax.annotation.Nullable; /** * @since 3.6 */ -public interface IssueHandler extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface IssueHandler { interface Context { Issue issue(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java index 591aa0f539b..f39046cf2cd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java @@ -31,7 +31,7 @@ import java.util.Set; /** * Issue filter used to ignore issues created on lines commented with the tag "NOSONAR". * <p/> - * Plugins, via {@link org.sonar.api.BatchExtension}s, must feed this filter by registering the + * Plugins, via {@link org.sonar.api.BatchSide}s, must feed this filter by registering the * lines that contain "NOSONAR". Note that filters are disabled for the issues reported by * end-users from UI or web services. * diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java index 096fcd36533..e0cac630b21 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java @@ -19,7 +19,7 @@ */ package org.sonar.api.issue; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.batch.InstantiationStrategy; import static org.sonar.api.batch.InstantiationStrategy.PER_BATCH; @@ -30,7 +30,8 @@ import static org.sonar.api.batch.InstantiationStrategy.PER_BATCH; * @since 4.0 */ @InstantiationStrategy(PER_BATCH) -public interface ProjectIssues extends BatchComponent { +@BatchSide +public interface ProjectIssues { /** * All the unresolved issues of the project, including the issues reported by end-users. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java index 149a7450994..0c239a04733 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java @@ -20,7 +20,8 @@ package org.sonar.api.issue.action; import com.google.common.annotations.Beta; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import java.util.ArrayList; import java.util.List; @@ -29,7 +30,9 @@ import java.util.List; * @since 3.6 */ @Beta -public class Actions implements ServerExtension { +@ServerSide +@ExtensionPoint +public class Actions { private final List<Action> actions = new ArrayList<>(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java index 1b240687719..bb2eacf3296 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java @@ -19,7 +19,8 @@ */ package org.sonar.api.issue.batch; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.issue.Issue; /** @@ -27,7 +28,9 @@ import org.sonar.api.issue.Issue; * @since 4.0 * */ -public interface IssueFilter extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface IssueFilter { /** * The <code>accept</code> method is called for each {@link Issue} created during analysis, to check if it has to be persisted. Examples of use cases are: diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java index ad80aa5bb42..611784734a2 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java @@ -19,7 +19,7 @@ */ package org.sonar.api.measures; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.resources.Resource; @@ -28,7 +28,8 @@ import org.sonar.api.resources.Resource; * * @since 2.14 */ -public interface FileLinesContextFactory extends BatchComponent { +@BatchSide +public interface FileLinesContextFactory { /** * @deprecated since 4.4 use {@link #createFor(InputFile)} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java index 111581d2f75..e53c1471b44 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java @@ -22,13 +22,20 @@ package org.sonar.api.measures; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; -import org.sonar.api.BatchExtension; -import org.sonar.api.ServerExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import org.sonar.api.batch.InstantiationStrategy; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import javax.persistence.*; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; import java.io.Serializable; @@ -39,8 +46,10 @@ import java.io.Serializable; */ @Table(name = "metrics") @Entity(name = "Metric") +@BatchSide @InstantiationStrategy(InstantiationStrategy.PER_BATCH) -public class Metric<G extends Serializable> implements ServerExtension, BatchExtension, Serializable, org.sonar.api.batch.measure.Metric<G> { +@ServerSide +public class Metric<G extends Serializable> implements Serializable, org.sonar.api.batch.measure.Metric<G> { /** * A metric bigger value means a degradation diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java index bb89c172a07..bbb309528c7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java @@ -19,8 +19,8 @@ */ package org.sonar.api.measures; -import org.sonar.api.ServerComponent; -import org.sonar.api.task.TaskComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import javax.annotation.CheckForNull; @@ -32,7 +32,9 @@ import java.util.List; * @deprecated since 5.1 use {@link org.sonar.api.batch.measure.MetricFinder} on batch side */ @Deprecated -public interface MetricFinder extends TaskComponent, ServerComponent { +@BatchSide +@ServerSide +public interface MetricFinder { @CheckForNull Metric findById(int id); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java index badcf51c331..e8d80b58a25 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java @@ -19,8 +19,9 @@ */ package org.sonar.api.measures; -import org.sonar.api.BatchExtension; -import org.sonar.api.ServerExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import org.sonar.api.batch.InstantiationStrategy; import java.util.List; @@ -28,7 +29,10 @@ import java.util.List; /** * @since 1.10 */ +@BatchSide @InstantiationStrategy(InstantiationStrategy.PER_BATCH) -public interface Metrics extends BatchExtension, ServerExtension { +@ServerSide +@ExtensionPoint +public interface Metrics { List<Metric> getMetrics(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java index 40c6d2b71d5..49521fe55d9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java @@ -19,7 +19,8 @@ */ package org.sonar.api.notifications; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * <p> @@ -34,7 +35,9 @@ import org.sonar.api.ServerExtension; * * @since 2.10 */ -public abstract class NotificationChannel implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class NotificationChannel { /** * Returns the unique key of this channel. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java index 5ad0be8ed66..e662421d126 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java @@ -20,7 +20,8 @@ package org.sonar.api.notifications; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * <p> @@ -37,7 +38,9 @@ import org.sonar.api.ServerExtension; * * @since 2.10 */ -public abstract class NotificationDispatcher implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class NotificationDispatcher { private final String notificationType; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java index 8660f559b4f..57b602ae2fc 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java @@ -20,7 +20,8 @@ package org.sonar.api.notifications; import com.google.common.collect.Maps; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import java.util.Map; @@ -33,7 +34,9 @@ import java.util.Map; * * @since 3.5 */ -public final class NotificationDispatcherMetadata implements ServerExtension { +@ServerSide +@ExtensionPoint +public final class NotificationDispatcherMetadata { public static final String GLOBAL_NOTIFICATION = "globalNotification"; public static final String PER_PROJECT_NOTIFICATION = "perProjectNotification"; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java index 535793eddf7..c56c733b98d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java @@ -20,8 +20,9 @@ package org.sonar.api.notifications; import com.google.common.collect.Multimap; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; +import org.sonar.api.batch.InstantiationStrategy; import javax.annotation.Nullable; @@ -38,7 +39,10 @@ import java.util.List; * * @since 2.10 */ -public interface NotificationManager extends ServerComponent, BatchComponent { +@ServerSide +@BatchSide +@InstantiationStrategy(InstantiationStrategy.PER_BATCH) +public interface NotificationManager { /** * Receives a notification and stores it so that it is processed by the notification service. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java index ec2cdf5b218..829bc81dd60 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java @@ -20,14 +20,17 @@ package org.sonar.api.platform; import com.google.common.base.Preconditions; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import javax.annotation.Nullable; /** * @since 3.2 */ -public interface NewUserHandler extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface NewUserHandler { final class Context { private String login; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java index 4f4502779ab..ef33d6d9b35 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java @@ -19,8 +19,8 @@ */ package org.sonar.api.platform; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import javax.annotation.CheckForNull; @@ -30,7 +30,9 @@ import java.util.Date; /** * @since 2.2 */ -public abstract class Server implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public abstract class Server { public abstract String getId(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java index 98233374fc7..b07a1a3cae7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java @@ -19,7 +19,7 @@ */ package org.sonar.api.platform; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import java.io.File; import java.util.List; @@ -27,7 +27,8 @@ import java.util.List; /** * @since 2.3 */ -public interface ServerFileSystem extends ServerComponent { +@ServerSide +public interface ServerFileSystem { File getHomeDir(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java index 2df19eebc0b..8c1c09d0916 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java @@ -19,12 +19,15 @@ */ package org.sonar.api.platform; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * @since 2.2 */ -public interface ServerStartHandler extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface ServerStartHandler { void onServerStart(Server server); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java index 7d6517c1ec9..315d5a16cc5 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java @@ -19,12 +19,15 @@ */ package org.sonar.api.platform; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * @since 2.2 */ -public interface ServerStopHandler extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface ServerStopHandler { void onServerStop(Server server); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java index 74bb3763006..95d99239711 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java @@ -19,12 +19,13 @@ */ package org.sonar.api.platform; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; /** * @since 2.5 */ -public interface ServerUpgradeStatus extends ServerComponent { +@ServerSide +public interface ServerUpgradeStatus { /** * Has the database been upgraded during the current startup ? Return false when {@link #isFreshInstall()} is true. @@ -40,5 +41,5 @@ public interface ServerUpgradeStatus extends ServerComponent { * The database version before the server startup. Returns <=0 if db created from scratch. */ int getInitialDbVersion(); - + } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java index d3760d31a26..8b45e85f2ad 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java @@ -20,7 +20,7 @@ package org.sonar.api.profiles; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rules.Rule; import org.sonar.api.rules.RuleAnnotationUtils; import org.sonar.api.rules.RuleFinder; @@ -33,7 +33,8 @@ import java.util.Collection; /** * @since 2.3 */ -public final class AnnotationProfileParser implements ServerComponent { +@ServerSide +public final class AnnotationProfileParser { private final RuleFinder ruleFinder; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java index 41b273f1e9d..7905aa164ba 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java @@ -19,7 +19,8 @@ */ package org.sonar.api.profiles; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import org.sonar.api.utils.ValidationMessages; /** @@ -28,7 +29,9 @@ import org.sonar.api.utils.ValidationMessages; * * @since 2.3 */ -public abstract class ProfileDefinition implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class ProfileDefinition { public abstract RulesProfile createProfile(ValidationMessages validation); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java index f8ca5084ae5..69ede33467b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java @@ -22,15 +22,19 @@ package org.sonar.api.profiles; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; -import org.sonar.api.BatchExtension; -import org.sonar.api.ServerExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import java.io.Writer; /** * @since 2.3 */ -public abstract class ProfileExporter implements BatchExtension, ServerExtension { +@BatchSide +@ServerSide +@ExtensionPoint +public abstract class ProfileExporter { private String[] supportedLanguages = new String[0]; private String key; @@ -105,10 +109,10 @@ public abstract class ProfileExporter implements BatchExtension, ServerExtension @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("key", key) - .append("name", name) - .append("mimeType", mimeType) - .append("languages", supportedLanguages) - .toString(); + .append("key", key) + .append("name", name) + .append("mimeType", mimeType) + .append("languages", supportedLanguages) + .toString(); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java index a468e2a9acc..8d58254f965 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java @@ -21,7 +21,8 @@ package org.sonar.api.profiles; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import org.sonar.api.utils.ValidationMessages; import java.io.Reader; @@ -29,7 +30,9 @@ import java.io.Reader; /** * @since 2.3 */ -public abstract class ProfileImporter implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class ProfileImporter { private String[] supportedLanguages = new String[0]; private String importerKey; @@ -92,9 +95,9 @@ public abstract class ProfileImporter implements ServerExtension { @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) - .append("key", importerKey) - .append("name", importerName) - .append("languages", supportedLanguages) - .toString(); + .append("key", importerKey) + .append("name", importerName) + .append("languages", supportedLanguages) + .toString(); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java index 8519072307c..84b971dbe92 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java @@ -25,7 +25,7 @@ import org.apache.commons.lang.StringUtils; import org.codehaus.staxmate.SMInputFactory; import org.codehaus.staxmate.in.SMHierarchicCursor; import org.codehaus.staxmate.in.SMInputCursor; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rules.ActiveRule; import org.sonar.api.rules.Rule; import org.sonar.api.rules.RuleFinder; @@ -34,6 +34,7 @@ import org.sonar.api.utils.ValidationMessages; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; + import java.io.InputStreamReader; import java.io.Reader; import java.util.HashMap; @@ -42,7 +43,8 @@ import java.util.Map; /** * @since 2.3 */ -public class XMLProfileParser implements ServerComponent { +@ServerSide +public class XMLProfileParser { private final RuleFinder ruleFinder; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java index 47822090414..ec56276649d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java @@ -21,7 +21,7 @@ package org.sonar.api.profiles; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rules.ActiveRule; import org.sonar.api.rules.ActiveRuleParam; import org.sonar.api.utils.SonarException; @@ -32,7 +32,8 @@ import java.io.Writer; /** * @since 2.3 */ -public class XMLProfileSerializer implements ServerComponent { +@ServerSide +public class XMLProfileSerializer { public void write(RulesProfile profile, Writer writer) { try { @@ -47,8 +48,8 @@ public class XMLProfileSerializer implements ServerComponent { private void appendHeader(RulesProfile profile, Writer writer) throws IOException { writer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" - + "<!-- Generated by SonarQube -->" - + "<profile><name>"); + + "<!-- Generated by SonarQube -->" + + "<profile><name>"); StringEscapeUtils.escapeXml(writer, profile.getName()); writer.append("</name><language>"); StringEscapeUtils.escapeXml(writer, profile.getLanguage()); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java index a5665394c43..2634e3564a2 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java @@ -19,8 +19,9 @@ */ package org.sonar.api.resources; -import org.sonar.api.BatchExtension; -import org.sonar.api.ServerExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import org.sonar.api.batch.InstantiationStrategy; /** @@ -30,8 +31,11 @@ import org.sonar.api.batch.InstantiationStrategy; * * @since 1.10 */ +@BatchSide @InstantiationStrategy(InstantiationStrategy.PER_BATCH) -public interface Language extends BatchExtension, ServerExtension { +@ServerSide +@ExtensionPoint +public interface Language { /** * For example "java". Should not be more than 20 chars. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java index 055b3897c1d..d0ae370809f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java @@ -21,8 +21,8 @@ package org.sonar.api.resources; import com.google.common.collect.Maps; import org.apache.commons.lang.ArrayUtils; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @@ -37,7 +37,9 @@ import java.util.Map; * * @since 1.10 */ -public class Languages implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public class Languages { private static final Logger LOG = Loggers.get(Languages.class); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java index f6fa337b482..6d620e722ac 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java @@ -26,8 +26,8 @@ import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ListMultimap; -import org.sonar.api.ServerExtension; -import org.sonar.api.task.TaskExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import java.util.ArrayList; import java.util.Arrays; @@ -37,7 +37,9 @@ import java.util.List; /** * @since 2.14 */ -public class ResourceTypeTree implements TaskExtension, ServerExtension { +@BatchSide +@ServerSide +public class ResourceTypeTree { private final List<ResourceType> types; private final ListMultimap<String, String> relations; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java index 83962edd5f8..b9be315c6fe 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java @@ -30,8 +30,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import org.sonar.api.ServerComponent; -import org.sonar.api.task.TaskComponent; +import org.sonar.api.ServerSide; import javax.annotation.Nullable; @@ -44,7 +43,8 @@ import java.util.Map; * @since 2.14 */ @Beta -public class ResourceTypes implements TaskComponent, ServerComponent { +@ServerSide +public class ResourceTypes { public static final Predicate<ResourceType> AVAILABLE_FOR_FILTERS = new Predicate<ResourceType>() { @Override @@ -184,7 +184,7 @@ public class ResourceTypes implements TaskComponent, ServerComponent { return treeByQualifier.get(qualifier); } - public ResourceType getRoot(String qualifier){ + public ResourceType getRoot(String qualifier) { return getTree(qualifier).getRootType(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java index a5ecacd1df9..53a7498b039 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java @@ -19,10 +19,10 @@ */ package org.sonar.api.rules; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import org.sonar.api.batch.rule.ActiveRules; import org.sonar.api.rule.RuleKey; -import org.sonar.api.task.TaskComponent; import javax.annotation.CheckForNull; @@ -33,7 +33,9 @@ import java.util.Collection; * @deprecated since 5.1. Use {@link ActiveRules} on batch side. */ @Deprecated -public interface RuleFinder extends TaskComponent, ServerComponent { +@BatchSide +@ServerSide +public interface RuleFinder { /** * @since 2.5 diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java index b5032895f83..a9e19d4331e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java @@ -21,7 +21,7 @@ package org.sonar.api.scan.filesystem; import com.google.common.collect.ObjectArrays; import org.apache.commons.lang.StringUtils; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.CoreProperties; import org.sonar.api.config.Settings; @@ -35,7 +35,8 @@ import java.util.List; * * @since 3.5 */ -public class FileExclusions implements BatchComponent { +@BatchSide +public class FileExclusions { private final Settings settings; public FileExclusions(Settings settings) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java index 7665b406f1b..3fedb814ea4 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java @@ -19,7 +19,8 @@ */ package org.sonar.api.scan.filesystem; -import org.sonar.api.BatchExtension; +import org.sonar.api.BatchSide; +import org.sonar.api.ExtensionPoint; import org.sonar.api.batch.fs.InputFileFilter; import java.io.File; @@ -35,7 +36,9 @@ import java.io.File; * @deprecated since 4.2 use {@link InputFileFilter} */ @Deprecated -public interface FileSystemFilter extends BatchExtension { +@BatchSide +@ExtensionPoint +public interface FileSystemFilter { /** * Plugins must not implement this interface. It is provided at runtime. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java index b3c14832f88..152a1c14fb8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java @@ -19,7 +19,7 @@ */ package org.sonar.api.scan.filesystem; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; @@ -34,7 +34,8 @@ import java.util.List; * @deprecated in 4.2. Replaced by {@link org.sonar.api.batch.fs.FileSystem} */ @Deprecated -public interface ModuleFileSystem extends BatchComponent { +@BatchSide +public interface ModuleFileSystem { /** * Base directory. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java index 9bd4ac7be0c..d0468c24d97 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java @@ -21,7 +21,7 @@ package org.sonar.api.scan.filesystem; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.utils.PathUtils; import javax.annotation.CheckForNull; @@ -34,7 +34,8 @@ import java.util.List; /** * @since 3.5 */ -public class PathResolver implements BatchComponent { +@BatchSide +public class PathResolver { public File relativeFile(File dir, String path) { Preconditions.checkArgument(dir.isDirectory(), "Not a directory: " + dir.getAbsolutePath()); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java index 6d096999a17..5c2a7dadf8e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java @@ -20,7 +20,8 @@ package org.sonar.api.security; import com.google.common.base.Preconditions; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import javax.annotation.Nullable; import javax.servlet.http.HttpServletRequest; @@ -29,7 +30,9 @@ import javax.servlet.http.HttpServletRequest; * @see SecurityRealm * @since 3.1 */ -public abstract class Authenticator implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class Authenticator { /** * @return true if user was successfully authenticated with specified credentials, false otherwise diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java index 12f917efacc..f09256dc5bb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java @@ -19,7 +19,8 @@ */ package org.sonar.api.security; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * @since 1.12 @@ -27,7 +28,9 @@ import org.sonar.api.ServerExtension; * @deprecated replaced by Authenticator in version 3.1 */ @Deprecated -public interface LoginPasswordAuthenticator extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface LoginPasswordAuthenticator { /** * @throws RuntimeException if the authenticator can not be initialized at sonar server startup, eg. if the connection to LDAP server is refused diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java index ab062823987..54d8c44195e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java @@ -19,9 +19,9 @@ */ package org.sonar.api.security; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import org.sonar.api.resources.Resource; -import org.sonar.api.task.TaskComponent; /** * Grant access to newly created projects. @@ -30,7 +30,9 @@ import org.sonar.api.task.TaskComponent; * * @since 3.2 */ -public interface ResourcePermissions extends TaskComponent, ServerComponent { +@BatchSide +@ServerSide +public interface ResourcePermissions { /** * Limitation - the resource id is used instead of logical key. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java index 53a03c1ac09..ba310849d2b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java @@ -19,12 +19,15 @@ */ package org.sonar.api.security; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * @since 2.14 */ -public abstract class SecurityRealm implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class SecurityRealm { /** * @return unique name of this realm, e.g. "ldap" diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java index dc6b50293f6..c3f4a739cdd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java @@ -19,8 +19,8 @@ */ package org.sonar.api.security; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import org.sonar.api.database.model.User; /** @@ -28,7 +28,9 @@ import org.sonar.api.database.model.User; * @deprecated since 5.1 DB access will soon be removed from batch side */ @Deprecated -public interface UserFinder extends ServerComponent, BatchComponent { +@BatchSide +@ServerSide +public interface UserFinder { User findById(int id); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java index b2d668fa239..d9a9234976d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java @@ -20,14 +20,15 @@ package org.sonar.api.server.debt; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import java.util.List; /** * @since 4.3 */ -public interface DebtModel extends ServerComponent { +@ServerSide +public interface DebtModel { /** * @return all characteristics diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java index 6caa31b5217..c70a11a0de2 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java @@ -20,10 +20,17 @@ package org.sonar.api.server.rule; import com.google.common.base.Strings; -import com.google.common.collect.*; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSortedSet; +import com.google.common.collect.ListMultimap; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleStatus; import org.sonar.api.rule.Severity; import org.sonar.api.server.debt.DebtRemediationFunction; @@ -132,7 +139,9 @@ import java.util.Set; * * @since 4.3 */ -public interface RulesDefinition extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface RulesDefinition { /** * Default sub-characteristics of technical debt model. See http://www.sqale.org diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java index 70973c5a124..61d6ada2353 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java @@ -20,7 +20,7 @@ package org.sonar.api.server.rule; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.i18n.RuleI18n; /** @@ -35,7 +35,8 @@ import org.sonar.api.i18n.RuleI18n; * @see org.sonar.api.server.rule.RulesDefinition for an example * @since 4.3 */ -public class RulesDefinitionI18nLoader implements ServerComponent { +@ServerSide +public class RulesDefinitionI18nLoader { private final RuleI18n i18n; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java index 55612d860aa..910f56fe2fb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java @@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUtils; import org.codehaus.staxmate.SMInputFactory; import org.codehaus.staxmate.in.SMHierarchicCursor; import org.codehaus.staxmate.in.SMInputCursor; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleStatus; import org.sonar.api.rule.Severity; import org.sonar.check.Cardinality; @@ -81,7 +81,8 @@ import java.util.List; * @see org.sonar.api.server.rule.RulesDefinition * @since 4.3 */ -public class RulesDefinitionXmlLoader implements ServerComponent { +@ServerSide +public class RulesDefinitionXmlLoader { public void load(RulesDefinition.NewRepository repo, InputStream input, String encoding) { load(repo, input, Charset.forName(encoding)); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java index 84eb2af2e90..7b45a5ea5f3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java @@ -19,12 +19,15 @@ */ package org.sonar.api.server.ws; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * @since 4.2 */ -public interface RequestHandler extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface RequestHandler { void handle(Request request, Response response) throws Exception; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java index af429ac9b69..2535dcd72b9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java @@ -27,7 +27,8 @@ import com.google.common.collect.Sets; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -100,7 +101,9 @@ import java.util.Set; * * @since 4.2 */ -public interface WebService extends ServerExtension, Definable<WebService.Context> { +@ServerSide +@ExtensionPoint +public interface WebService extends Definable<WebService.Context> { class Context { private final Map<String, Controller> controllers = Maps.newHashMap(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java index 65d5e055093..1aff5a51796 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java @@ -19,6 +19,9 @@ */ package org.sonar.api.task; +import org.sonar.api.BatchSide; +import org.sonar.api.batch.InstantiationStrategy; + /** * All the classes implementing this interface can be injected in public constructors of {@link TaskExtension}. * @@ -26,5 +29,7 @@ package org.sonar.api.task; * @deprecated since 5.1 all tasks (devcockpit, views) will be moved to server side */ @Deprecated +@BatchSide +@InstantiationStrategy(InstantiationStrategy.PER_BATCH) public interface TaskComponent { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java index 33eb7e48a76..56000eca609 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java @@ -20,7 +20,7 @@ package org.sonar.api.technicaldebt.batch; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.rule.RuleKey; import org.sonar.api.technicaldebt.batch.internal.DefaultCharacteristic; @@ -30,11 +30,11 @@ import java.util.List; /** * @since 4.1 - * Used by Views plugin * @deprecated since 4.3 */ @Deprecated -public interface TechnicalDebtModel extends BatchComponent { +@BatchSide +public interface TechnicalDebtModel { @CheckForNull Characteristic characteristicById(Integer id); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java index 1e303d01db9..5d9a92d0c3b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java @@ -19,16 +19,18 @@ */ package org.sonar.api.user; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import javax.annotation.CheckForNull; + import java.util.List; import java.util.Map; /** * @since 3.6 */ -public interface RubyUserService extends ServerComponent { +@ServerSide +public interface RubyUserService { @CheckForNull User findByLogin(String login); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java index 7e869810b2d..1a261424b7f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java @@ -19,8 +19,8 @@ */ package org.sonar.api.user; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import javax.annotation.CheckForNull; @@ -31,7 +31,9 @@ import java.util.List; * @deprecated since 5.1 DB access will soon be removed from batch side */ @Deprecated -public interface UserFinder extends BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public interface UserFinder { @CheckForNull User findByLogin(String login); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java index 05f2ba422d5..5e3ae2a0632 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java @@ -20,9 +20,9 @@ package org.sonar.api.utils; -import org.sonar.api.BatchComponent; +import org.sonar.api.BatchSide; import org.sonar.api.CoreProperties; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.config.Settings; import org.sonar.api.i18n.I18n; @@ -35,7 +35,9 @@ import java.util.Locale; * * @since 4.3 */ -public class Durations implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public class Durations { public enum DurationFormat { /** @@ -111,7 +113,7 @@ public class Durations implements BatchComponent, ServerComponent { return format(locale, days, hours, minutes, isNegative); } - private String format(Locale locale, int days, int hours, int minutes, boolean isNegative){ + private String format(Locale locale, int days, int hours, int minutes, boolean isNegative) { StringBuilder message = new StringBuilder(); if (days > 0) { message.append(message(locale, "work_duration.x_days", isNegative ? -1 * days : days)); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java index 4965f14d3d4..fc2d9d36c1c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java @@ -19,8 +19,8 @@ */ package org.sonar.api.utils; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import java.io.File; import java.io.InputStream; @@ -30,7 +30,9 @@ import java.net.URI; * This component is available in IoC container, so it should be injected through * a constructor parameter. It is available in both batch and server. */ -public abstract class HttpDownloader extends UriReader.SchemeProcessor implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public abstract class HttpDownloader extends UriReader.SchemeProcessor { public static final int TIMEOUT_MILLISECONDS = 20 * 1000; public abstract String downloadPlainText(URI uri, String encoding); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java index 713d85265e2..a756709e092 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java @@ -19,10 +19,11 @@ */ package org.sonar.api.utils; -import org.sonar.api.ServerComponent; -import org.sonar.api.task.TaskComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import javax.annotation.Nullable; + import java.util.Date; /** @@ -31,7 +32,9 @@ import java.util.Date; * * @since 3.4 */ -public interface Semaphores extends TaskComponent, ServerComponent { +@BatchSide +@ServerSide +public interface Semaphores { /** * Try to acquire a semaphore for a given duration. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java index 2b05df0de86..03e8f5122c8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java @@ -20,8 +20,8 @@ package org.sonar.api.utils; import org.apache.commons.lang.SystemUtils; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import javax.annotation.CheckForNull; @@ -63,7 +63,9 @@ import java.util.TimeZone; * * @since 4.2 */ -public class System2 implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public class System2 { public static final System2 INSTANCE = new System2(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java index 92a695b57b1..8a15c2fcc73 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java @@ -19,8 +19,8 @@ */ package org.sonar.api.utils; -import org.sonar.api.ServerComponent; -import org.sonar.api.task.TaskComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import javax.annotation.Nullable; @@ -36,7 +36,9 @@ import java.io.File; * @since 4.0 * */ -public interface TempFolder extends TaskComponent, ServerComponent { +@BatchSide +@ServerSide +public interface TempFolder { /** * Create a directory in temp folder with a random unique name. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java index ad435de7b23..9f5ceb4e80b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java @@ -25,8 +25,8 @@ import com.google.common.base.Throwables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.io.Files; -import org.sonar.api.BatchComponent; -import org.sonar.api.ServerComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import java.io.File; import java.io.IOException; @@ -41,7 +41,9 @@ import java.util.Map; * * @since 3.2 */ -public class UriReader implements BatchComponent, ServerComponent { +@BatchSide +@ServerSide +public class UriReader { private final Map<String, SchemeProcessor> processorsByScheme = Maps.newHashMap(); @@ -96,7 +98,6 @@ public class UriReader implements BatchComponent, ServerComponent { protected abstract String description(URI uri); } - /** * This implementation is not exposed in API and is kept private. */ @@ -104,7 +105,7 @@ public class UriReader implements BatchComponent, ServerComponent { @Override public String[] getSupportedSchemes() { - return new String[]{"file"}; + return new String[] {"file"}; } @Override diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java index e0e8a87ca52..8ba70571379 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java @@ -20,11 +20,13 @@ package org.sonar.api.utils.internal; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; -import org.sonar.api.task.TaskComponent; +import org.sonar.api.BatchSide; +import org.sonar.api.ServerSide; import org.sonar.api.utils.TempFolder; -public class TempFolderCleaner implements TaskComponent, ServerComponent, Startable { +@BatchSide +@ServerSide +public class TempFolderCleaner implements Startable { private TempFolder defaultTempFolder; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java index ce40f5fe041..2060b0d7d9e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java @@ -19,14 +19,17 @@ */ package org.sonar.api.web; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * This extension point must be implemented to define a new dashboard. * * @since 2.13 */ -public abstract class DashboardTemplate implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class DashboardTemplate { /** * Returns the {@link Dashboard} object that represents the dashboard to use. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java index 5ba0cc14bf8..ec7e6fc918b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java @@ -19,14 +19,17 @@ */ package org.sonar.api.web; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * This extension point must be implemented to define a new filter. * * @since 3.1 */ -public abstract class FilterTemplate implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class FilterTemplate { /** * Returns the {@link Filter} object that represents the filter to use. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java index 4dbbdade375..3aa3d3e97fa 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java @@ -19,12 +19,15 @@ */ package org.sonar.api.web; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * @since 1.10 */ -public interface Footer extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface Footer { /** * Static HTML (no Ruby on Rails) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java index 4505a42c32c..b34a7913c02 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java @@ -19,7 +19,8 @@ */ package org.sonar.api.web; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * Adds content to HTML pages. A PageDecoration is a Rails template (html.erb file) that executes content_for blocks on predefined locations : @@ -44,6 +45,8 @@ import org.sonar.api.ServerExtension; * * @since 3.3 */ -public abstract class PageDecoration extends AbstractRubyTemplate implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class PageDecoration extends AbstractRubyTemplate { } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java index 29e9c99ab01..e50462060f8 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java @@ -21,14 +21,17 @@ package org.sonar.api.web; import com.google.common.base.Preconditions; import com.google.common.base.Strings; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import javax.servlet.Filter; /** * @since 3.1 */ -public abstract class ServletFilter implements ServerExtension, Filter { +@ServerSide +@ExtensionPoint +public abstract class ServletFilter implements Filter { /** * Override to change URL. Default is /* diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/View.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/View.java index adfac3917ba..fed5625d6b3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/View.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/View.java @@ -19,12 +19,15 @@ */ package org.sonar.api.web; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * @since 1.11 */ -public interface View extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface View { String getId(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java index 1b33222abba..28b9d0f027a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java @@ -19,7 +19,8 @@ */ package org.sonar.api.web; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; /** * Interface to create a web service extension point @@ -28,7 +29,9 @@ import org.sonar.api.ServerExtension; * @deprecated in 4.2. Replaced by {@link org.sonar.api.server.ws.WebService} */ @Deprecated -public interface Webservice extends ServerExtension { +@ServerSide +@ExtensionPoint +public interface Webservice { /** * @return The id of the web service diff --git a/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java b/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java index 09a8a5c1e40..fda958539be 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java +++ b/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java @@ -19,13 +19,16 @@ */ package org.sonar.plugins.emailnotifications.api; -import org.sonar.api.ServerExtension; +import org.sonar.api.ExtensionPoint; +import org.sonar.api.ServerSide; import org.sonar.api.notifications.Notification; /** * @since 2.10 */ -public abstract class EmailTemplate implements ServerExtension { +@ServerSide +@ExtensionPoint +public abstract class EmailTemplate { public abstract EmailMessage format(Notification notification); |