diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-05-07 15:59:40 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-05-11 17:04:46 +0200 |
commit | 3c18d94e800d30e71b2ca578b2a4d606f824e844 (patch) | |
tree | aca651a8adb71920ea839beb8975c425b94a587f /server | |
parent | 079a8179040931d2589b7d9b233ca9ed949437e2 (diff) | |
download | sonarqube-3c18d94e800d30e71b2ca578b2a4d606f824e844.tar.gz sonarqube-3c18d94e800d30e71b2ca578b2a4d606f824e844.zip |
SONAR-6535 API cleanup: deprecate BatchComponent and ServerComponent
Diffstat (limited to 'server')
126 files changed, 531 insertions, 326 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/IndexPurgeListener.java b/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/IndexPurgeListener.java index 8be40ab93b1..7bf30446b5a 100644 --- a/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/IndexPurgeListener.java +++ b/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/IndexPurgeListener.java @@ -20,12 +20,13 @@ package org.sonar.core.computation.dbcleaner; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.purge.PurgeListener; import org.sonar.server.source.index.SourceLineIndexer; import org.sonar.server.test.index.TestIndexer; -public class IndexPurgeListener implements PurgeListener, ServerComponent { +@ServerSide +public class IndexPurgeListener implements PurgeListener { private final SourceLineIndexer sourceLineIndexer; private final TestIndexer testIndexer; diff --git a/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java b/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java index db97f41b182..dba317bce9d 100644 --- a/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java +++ b/server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java @@ -21,14 +21,18 @@ package org.sonar.core.computation.dbcleaner; 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.utils.TimeUtils; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner; import org.sonar.core.persistence.DbSession; -import org.sonar.core.purge.*; +import org.sonar.core.purge.IdUuidPair; +import org.sonar.core.purge.PurgeConfiguration; +import org.sonar.core.purge.PurgeDao; +import org.sonar.core.purge.PurgeListener; +import org.sonar.core.purge.PurgeProfiler; import org.sonar.server.issue.index.IssueIndex; import javax.annotation.Nullable; @@ -37,7 +41,8 @@ import java.util.Date; import static org.sonar.core.purge.PurgeConfiguration.newDefaultPurgeConfiguration; -public class ProjectCleaner implements ServerComponent { +@ServerSide +public class ProjectCleaner { private static final Logger LOG = Loggers.get(ProjectCleaner.class); private final PurgeProfiler profiler; diff --git a/server/sonar-server/src/main/java/org/sonar/server/activity/ActivityService.java b/server/sonar-server/src/main/java/org/sonar/server/activity/ActivityService.java index a108c0db063..6d5c5626bd8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/activity/ActivityService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/activity/ActivityService.java @@ -19,7 +19,7 @@ */ package org.sonar.server.activity; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.KeyValueFormat; import org.sonar.api.utils.internal.Uuids; import org.sonar.core.activity.db.ActivityDto; @@ -27,7 +27,8 @@ import org.sonar.server.activity.index.ActivityIndexer; import org.sonar.server.db.DbClient; import org.sonar.server.user.UserSession; -public class ActivityService implements ServerComponent { +@ServerSide +public class ActivityService { private final DbClient dbClient; private final ActivityIndexer indexer; diff --git a/server/sonar-server/src/main/java/org/sonar/server/activity/RubyQProfileActivityService.java b/server/sonar-server/src/main/java/org/sonar/server/activity/RubyQProfileActivityService.java index d0e3c7a0794..8ed00b89165 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/activity/RubyQProfileActivityService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/activity/RubyQProfileActivityService.java @@ -21,7 +21,7 @@ package org.sonar.server.activity; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.Paging; import org.sonar.server.es.SearchOptions; import org.sonar.server.qualityprofile.QProfileActivity; @@ -38,7 +38,8 @@ import java.util.Map; * @deprecated in 4.4 because Ruby on Rails is deprecated too ! */ @Deprecated -public class RubyQProfileActivityService implements ServerComponent, Startable { +@ServerSide +public class RubyQProfileActivityService implements Startable { private final QProfileService service; @@ -52,7 +53,7 @@ public class RubyQProfileActivityService implements ServerComponent, Startable { public QProfileActivityResult search(Map<String, Object> params) { QProfileActivityQuery query = new QProfileActivityQuery(); - query.setQprofileKey((String)params.get("profileKey")); + query.setQprofileKey((String) params.get("profileKey")); Date since = RubyUtils.toDate(params.get("since")); if (since != null) { query.setSince(since); diff --git a/server/sonar-server/src/main/java/org/sonar/server/activity/db/ActivityDao.java b/server/sonar-server/src/main/java/org/sonar/server/activity/db/ActivityDao.java index c6a9a271632..8be7c8b558f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/activity/db/ActivityDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/activity/db/ActivityDao.java @@ -19,7 +19,7 @@ */ package org.sonar.server.activity.db; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.System2; import org.sonar.core.activity.db.ActivityDto; import org.sonar.core.activity.db.ActivityMapper; @@ -29,7 +29,8 @@ import org.sonar.core.persistence.MyBatis; import java.util.Date; -public class ActivityDao implements DaoComponent, ServerComponent { +@ServerSide +public class ActivityDao implements DaoComponent { private final MyBatis mybatis; private final System2 system; diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/BatchIndex.java b/server/sonar-server/src/main/java/org/sonar/server/batch/BatchIndex.java index d5138252c4c..373d097dac7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/batch/BatchIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/batch/BatchIndex.java @@ -26,7 +26,7 @@ import org.apache.commons.io.filefilter.HiddenFileFilter; import org.apache.commons.lang.CharUtils; import org.apache.commons.lang.StringUtils; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.platform.Server; import org.sonar.home.cache.FileHashes; @@ -37,7 +37,8 @@ import java.util.Collection; /** * JAR files to be downloaded by sonar-runner. */ -public class BatchIndex implements ServerComponent, Startable { +@ServerSide +public class BatchIndex implements Startable { private final Server server; private String index; diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java index 1f463b5a253..7a912db9bae 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java @@ -24,7 +24,7 @@ import com.google.common.base.Function; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.resources.Language; import org.sonar.api.resources.Languages; import org.sonar.api.rule.RuleKey; @@ -65,7 +65,8 @@ import java.util.Map; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Maps.newHashMap; -public class ProjectRepositoryLoader implements ServerComponent { +@ServerSide +public class ProjectRepositoryLoader { private static final Logger LOG = Loggers.get(ProjectRepositoryLoader.class); diff --git a/server/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java b/server/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java index 0c80acb0ef3..dd1dcd8f516 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java @@ -20,7 +20,7 @@ package org.sonar.server.charts; import com.google.common.collect.Maps; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.charts.Chart; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @@ -29,11 +29,11 @@ import javax.annotation.CheckForNull; import java.util.Map; -public final class ChartFactory implements ServerComponent { +@ServerSide +public final class ChartFactory { private static final Logger LOG = Loggers.get(ChartFactory.class); private final Map<String, Chart> chartsByKey = Maps.newHashMap(); - public ChartFactory(Chart[] charts) { for (Chart chart : charts) { if (chartsByKey.containsKey(chart.getKey())) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentCleanerService.java b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentCleanerService.java index 696b31b8864..cc24b47c128 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentCleanerService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentCleanerService.java @@ -20,7 +20,7 @@ package org.sonar.server.component; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.resources.Scopes; import org.sonar.core.component.ComponentDto; import org.sonar.core.persistence.DbSession; @@ -33,7 +33,8 @@ import org.sonar.server.issue.index.IssueIndexer; import org.sonar.server.source.index.SourceLineIndexer; import org.sonar.server.test.index.TestIndexer; -public class ComponentCleanerService implements ServerComponent { +@ServerSide +public class ComponentCleanerService { private final DbClient dbClient; private final PurgeDao purgeDao; diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java index a08faf89771..c4263a25b16 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java @@ -24,7 +24,7 @@ import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.collect.Collections2; import com.google.common.collect.Sets; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.i18n.I18n; import org.sonar.api.resources.Scopes; import org.sonar.api.utils.internal.Uuids; @@ -53,7 +53,8 @@ import java.util.Set; import static com.google.common.collect.Lists.newArrayList; -public class ComponentService implements ServerComponent { +@ServerSide +public class ComponentService { private final DbClient dbClient; diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java index c6cdff23f41..bd85204aaa6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java @@ -21,7 +21,7 @@ package org.sonar.server.component.db; import com.google.common.base.Function; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.Scopes; import org.sonar.api.utils.System2; @@ -44,7 +44,8 @@ import java.util.List; /** * @since 4.3 */ -public class ComponentDao extends BaseDao<ComponentMapper, ComponentDto, String> implements ServerComponent, DaoComponent { +@ServerSide +public class ComponentDao extends BaseDao<ComponentMapper, ComponentDto, String> implements DaoComponent { public ComponentDao() { this(System2.INSTANCE); diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentIndexDao.java b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentIndexDao.java index 7243b6125e2..6ed1e6601a7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentIndexDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentIndexDao.java @@ -20,14 +20,15 @@ package org.sonar.server.component.db; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.component.db.ComponentIndexMapper; import org.sonar.core.persistence.DaoComponent; import org.sonar.core.persistence.DbSession; import java.util.List; -public class ComponentIndexDao implements ServerComponent, DaoComponent { +@ServerSide +public class ComponentIndexDao implements DaoComponent { public List<Long> selectProjectIdsFromQueryAndViewOrSubViewUuid(DbSession session, String query, String viewOrSubViewUuid) { return session.getMapper(ComponentIndexMapper.class).selectProjectIdsFromQueryAndViewOrSubViewUuid(query + "%", "%." + viewOrSubViewUuid + ".%"); diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentLinkDao.java b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentLinkDao.java index eec3060f567..00e8a1c1c93 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentLinkDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentLinkDao.java @@ -20,7 +20,7 @@ package org.sonar.server.component.db; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.component.ComponentLinkDto; import org.sonar.core.component.db.ComponentLinkMapper; import org.sonar.core.persistence.DaoComponent; @@ -28,7 +28,8 @@ import org.sonar.core.persistence.DbSession; import java.util.List; -public class ComponentLinkDao implements ServerComponent, DaoComponent { +@ServerSide +public class ComponentLinkDao implements DaoComponent { public List<ComponentLinkDto> selectByComponentUuid(DbSession session, String componentUuid) { return session.getMapper(ComponentLinkMapper.class).selectByComponentUuid(componentUuid); diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java index 07108244f5c..9154599fe20 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java @@ -23,7 +23,7 @@ package org.sonar.server.computation; import com.google.common.base.Throwables; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.ArrayUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.System2; import org.sonar.api.utils.TempFolder; import org.sonar.api.utils.ZipUtils; @@ -44,14 +44,18 @@ import org.sonar.server.db.DbClient; import org.sonar.server.properties.ProjectSettingsFactory; import javax.annotation.Nullable; + import java.io.File; import java.io.IOException; import static org.sonar.api.utils.DateUtils.formatDateTimeNullSafe; import static org.sonar.api.utils.DateUtils.longToDate; -import static org.sonar.core.computation.db.AnalysisReportDto.Status.*; +import static org.sonar.core.computation.db.AnalysisReportDto.Status.CANCELLED; +import static org.sonar.core.computation.db.AnalysisReportDto.Status.FAILED; +import static org.sonar.core.computation.db.AnalysisReportDto.Status.SUCCESS; -public class ComputationService implements ServerComponent { +@ServerSide +public class ComputationService { private static final Logger LOG = Loggers.get(ComputationService.class); @@ -62,8 +66,8 @@ public class ComputationService implements ServerComponent { private final TempFolder tempFolder; private final System2 system; - public ComputationService(DbClient dbClient, ComputationSteps steps, ActivityService activityService, - ProjectSettingsFactory projectSettingsFactory, TempFolder tempFolder, System2 system) { + public ComputationService(DbClient dbClient, ComputationSteps steps, ActivityService activityService, + ProjectSettingsFactory projectSettingsFactory, TempFolder tempFolder, System2 system) { this.dbClient = dbClient; this.steps = steps; this.activityService = activityService; @@ -139,7 +143,7 @@ public class ComputationService implements ServerComponent { LOG.info("Processing of report #{} is canceled because it was submitted while another report of the same project was already being processed.", item.dto.getId()); LOG.debug("The snapshot ID #{} provided by the report #{} does not exist anymore.", snapshotId, item.dto.getId()); } - return snapshot==null; + return snapshot == null; } finally { MyBatis.closeQuietly(session); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java index 51a84f5f356..2c6a488a56f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java @@ -21,7 +21,7 @@ package org.sonar.server.computation; import org.apache.commons.io.FileUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.config.Settings; import org.sonar.api.utils.internal.Uuids; import org.sonar.api.utils.log.Loggers; @@ -41,7 +41,8 @@ import java.util.List; import static org.sonar.core.computation.db.AnalysisReportDto.Status.PENDING; -public class ReportQueue implements ServerComponent { +@ServerSide +public class ReportQueue { private final DbClient dbClient; private final Settings settings; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueueCleaner.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueueCleaner.java index 7abc9f1953e..275be19dd72 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueueCleaner.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueueCleaner.java @@ -21,7 +21,7 @@ package org.sonar.server.computation; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.platform.ServerUpgradeStatus; /** @@ -32,7 +32,8 @@ import org.sonar.api.platform.ServerUpgradeStatus; * <li>reset reports that were in status WORKING while server stopped</li> * </ul> */ -public class ReportQueueCleaner implements Startable, ServerComponent { +@ServerSide +public class ReportQueueCleaner implements Startable { private final ServerUpgradeStatus serverUpgradeStatus; private final ReportQueue queue; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/Dao.java b/server/sonar-server/src/main/java/org/sonar/server/db/Dao.java index 688637b5cfc..9ba3569fadd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/Dao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/Dao.java @@ -19,7 +19,7 @@ */ package org.sonar.server.db; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.Dto; @@ -31,7 +31,8 @@ import java.util.Collection; import java.util.Date; import java.util.Map; -public interface Dao<DTO extends Dto<KEY>, KEY extends Serializable> extends ServerComponent { +@ServerSide +public interface Dao<DTO extends Dto<KEY>, KEY extends Serializable> { /** * Get a DTO by its key. Return <code>null</code> if the key does not exist. diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/DatabaseChecker.java b/server/sonar-server/src/main/java/org/sonar/server/db/DatabaseChecker.java index 9909c0b7061..3055c9c2663 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/DatabaseChecker.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/DatabaseChecker.java @@ -23,9 +23,9 @@ import com.google.common.base.Throwables; import org.apache.commons.dbutils.DbUtils; import org.apache.commons.lang.StringUtils; import org.picocontainer.Startable; +import org.sonar.api.ServerSide; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.log.Loggers; -import org.sonar.api.ServerComponent; import org.sonar.core.persistence.Database; import org.sonar.core.persistence.dialect.H2; import org.sonar.core.persistence.dialect.Oracle; @@ -33,7 +33,8 @@ import org.sonar.core.persistence.dialect.Oracle; import java.sql.Connection; import java.sql.SQLException; -public class DatabaseChecker implements ServerComponent, Startable { +@ServerSide +public class DatabaseChecker implements Startable { public static final int ORACLE_MIN_MAJOR_VERSION = 11; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java b/server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java index 78fc76fde3f..9c2f690cc7c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java @@ -19,7 +19,7 @@ */ package org.sonar.server.db; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.issue.db.ActionPlanDao; import org.sonar.core.issue.db.IssueChangeDao; import org.sonar.core.issue.db.IssueFilterDao; @@ -66,7 +66,8 @@ import java.util.Map; /** * Facade for all db components, mainly DAOs */ -public class DbClient implements ServerComponent { +@ServerSide +public class DbClient { private final Database db; private final MyBatis myBatis; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/DatabaseMigrator.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/DatabaseMigrator.java index bf47c6455ba..91c7cafe6d7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/DatabaseMigrator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/DatabaseMigrator.java @@ -19,27 +19,27 @@ */ package org.sonar.server.db.migrations; -import java.sql.Connection; - +import com.google.common.annotations.VisibleForTesting; import org.apache.commons.dbutils.DbUtils; import org.apache.ibatis.session.SqlSession; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.platform.ServerUpgradeStatus; import org.sonar.api.utils.log.Loggers; import org.sonar.core.persistence.DdlUtils; import org.sonar.server.db.DbClient; - -import com.google.common.annotations.VisibleForTesting; import org.sonar.server.plugins.ServerPluginRepository; +import java.sql.Connection; + /** * Restore schema by executing DDL scripts. Only H2 database is supported. * Other databases are created by Ruby on Rails migrations. * * @since 2.12 */ -public class DatabaseMigrator implements ServerComponent, Startable { +@ServerSide +public class DatabaseMigrator implements Startable { private final DbClient dbClient; private final MigrationStep[] migrations; @@ -49,7 +49,7 @@ public class DatabaseMigrator implements ServerComponent, Startable { * ServerPluginRepository is used to ensure H2 schema creation is done only after copy of bundle plugins have been done */ public DatabaseMigrator(DbClient dbClient, MigrationStep[] migrations, ServerUpgradeStatus serverUpgradeStatus, - ServerPluginRepository unused) { + ServerPluginRepository unused) { this.dbClient = dbClient; this.migrations = migrations; this.serverUpgradeStatus = serverUpgradeStatus; diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtCharacteristicsXMLImporter.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtCharacteristicsXMLImporter.java index 0bb070730f7..2baebc2b464 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtCharacteristicsXMLImporter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtCharacteristicsXMLImporter.java @@ -25,9 +25,10 @@ import org.codehaus.stax2.XMLInputFactory2; 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.server.debt.internal.DefaultDebtCharacteristic; import org.sonar.api.server.rule.RulesDefinition; +import org.sonar.server.debt.DebtModelXMLExporter.DebtModel; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -37,12 +38,15 @@ import javax.xml.stream.XMLStreamException; import java.io.Reader; import java.io.StringReader; -import static org.sonar.server.debt.DebtModelXMLExporter.*; +import static org.sonar.server.debt.DebtModelXMLExporter.CHARACTERISTIC; +import static org.sonar.server.debt.DebtModelXMLExporter.CHARACTERISTIC_KEY; +import static org.sonar.server.debt.DebtModelXMLExporter.CHARACTERISTIC_NAME; /** * Import characteristics from an xml */ -public class DebtCharacteristicsXMLImporter implements ServerComponent { +@ServerSide +public class DebtCharacteristicsXMLImporter { public DebtModel importXML(String xml) { return importXML(new StringReader(xml)); @@ -104,7 +108,7 @@ public class DebtCharacteristicsXMLImporter implements ServerComponent { } } - static String convertKey(String key){ + static String convertKey(String key) { if ("NETWORK_USE_EFFICIENCY".equals(key)) { return RulesDefinition.SubCharacteristics.NETWORK_USE; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java index e7092c1f07a..69021c46766 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java @@ -19,6 +19,8 @@ */ package org.sonar.server.debt; +import org.sonar.api.ServerSide; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; @@ -56,7 +58,8 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class DebtModelBackup implements ServerComponent { +@ServerSide +public class DebtModelBackup { private static final Logger LOG = Loggers.get(DebtModelBackup.class); diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelLookup.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelLookup.java index fbfeb0855a6..8b8ca5d4276 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelLookup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelLookup.java @@ -22,7 +22,7 @@ package org.sonar.server.debt; import com.google.common.base.Function; import com.google.common.collect.Iterables; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.server.debt.DebtCharacteristic; import org.sonar.api.server.debt.internal.DefaultDebtCharacteristic; import org.sonar.core.technicaldebt.db.CharacteristicDao; @@ -36,7 +36,8 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class DebtModelLookup implements ServerComponent { +@ServerSide +public class DebtModelLookup { private final CharacteristicDao dao; diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java index e4014d29559..2b15c2160be 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java @@ -24,7 +24,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import org.apache.ibatis.session.SqlSession; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.server.debt.DebtCharacteristic; import org.sonar.api.server.debt.internal.DefaultDebtCharacteristic; import org.sonar.api.utils.System2; @@ -45,7 +45,8 @@ import javax.annotation.Nullable; import java.util.Date; import java.util.List; -public class DebtModelOperations implements ServerComponent { +@ServerSide +public class DebtModelOperations { private final DbClient dbClient; private final System2 system2; diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java index da45c47bf68..8ca78f7c3f6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java @@ -25,7 +25,7 @@ import com.google.common.collect.Maps; import org.apache.commons.io.Charsets; import org.picocontainer.Startable; import org.sonar.api.Plugin; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; @@ -45,7 +45,8 @@ import static com.google.common.collect.Lists.newArrayList; * they must be named "<pluginKey>-model.xml". * </p> */ -public class DebtModelPluginRepository implements ServerComponent, Startable { +@ServerSide +public class DebtModelPluginRepository implements Startable { public static final String DEFAULT_MODEL = "technical-debt"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java index 929648174e1..8dfae1f9e4d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java @@ -27,7 +27,7 @@ import com.google.common.collect.Ordering; import org.apache.commons.io.Charsets; 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.rule.RuleKey; import org.sonar.api.server.debt.DebtCharacteristic; import org.sonar.api.server.debt.internal.DefaultDebtCharacteristic; @@ -35,7 +35,10 @@ import org.xml.sax.InputSource; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import javax.xml.transform.*; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.stream.StreamResult; @@ -52,7 +55,8 @@ import static com.google.common.collect.Lists.newArrayList; /** * Export characteristics and rule debt definitions to XML */ -public class DebtModelXMLExporter implements ServerComponent { +@ServerSide +public class DebtModelXMLExporter { private static final String ROOT = "sqale"; private static final String DEFAULT_INDENT = "2"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java index f78ab4adbed..90905e7ad3e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java @@ -29,11 +29,12 @@ import org.codehaus.stax2.XMLInputFactory2; 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.RuleKey; import org.sonar.api.server.debt.DebtRemediationFunction; import org.sonar.api.utils.Duration; import org.sonar.api.utils.ValidationMessages; +import org.sonar.server.debt.DebtModelXMLExporter.RuleDebt; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -45,12 +46,23 @@ import java.io.StringReader; import java.util.List; import static com.google.common.collect.Lists.newArrayList; -import static org.sonar.server.debt.DebtModelXMLExporter.*; +import static org.sonar.server.debt.DebtModelXMLExporter.CHARACTERISTIC; +import static org.sonar.server.debt.DebtModelXMLExporter.CHARACTERISTIC_KEY; +import static org.sonar.server.debt.DebtModelXMLExporter.PROPERTY; +import static org.sonar.server.debt.DebtModelXMLExporter.PROPERTY_COEFFICIENT; +import static org.sonar.server.debt.DebtModelXMLExporter.PROPERTY_FUNCTION; +import static org.sonar.server.debt.DebtModelXMLExporter.PROPERTY_KEY; +import static org.sonar.server.debt.DebtModelXMLExporter.PROPERTY_OFFSET; +import static org.sonar.server.debt.DebtModelXMLExporter.PROPERTY_TEXT_VALUE; +import static org.sonar.server.debt.DebtModelXMLExporter.PROPERTY_VALUE; +import static org.sonar.server.debt.DebtModelXMLExporter.REPOSITORY_KEY; +import static org.sonar.server.debt.DebtModelXMLExporter.RULE_KEY; /** * Import rules debt definitions from an XML */ -public class DebtRulesXMLImporter implements ServerComponent { +@ServerSide +public class DebtRulesXMLImporter { public List<RuleDebt> importXML(String xml, ValidationMessages validationMessages) { return importXML(new StringReader(xml), validationMessages); @@ -86,7 +98,7 @@ public class DebtRulesXMLImporter implements ServerComponent { } private void process(List<RuleDebt> ruleDebts, @Nullable String rootKey, @Nullable String parentKey, - ValidationMessages validationMessages, SMInputCursor chcCursor) throws XMLStreamException { + ValidationMessages validationMessages, SMInputCursor chcCursor) throws XMLStreamException { String currentCharacteristicKey = null; SMInputCursor cursor = chcCursor.childElementCursor(); while (cursor.getNext() != null) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/design/db/FileDependencyDao.java b/server/sonar-server/src/main/java/org/sonar/server/design/db/FileDependencyDao.java index 9cae760f3a8..3f97c33aae5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/design/db/FileDependencyDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/design/db/FileDependencyDao.java @@ -20,7 +20,7 @@ package org.sonar.server.design.db; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.design.FileDependencyDto; import org.sonar.core.design.FileDependencyMapper; import org.sonar.core.persistence.DaoComponent; @@ -28,7 +28,8 @@ import org.sonar.core.persistence.DbSession; import java.util.List; -public class FileDependencyDao implements ServerComponent, DaoComponent { +@ServerSide +public class FileDependencyDao implements DaoComponent { public List<FileDependencyDto> selectFromParents(DbSession session, String fromParentUuid, String toParentUuid, Long projectId) { return session.getMapper(FileDependencyMapper.class).selectFromParents(fromParentUuid, toParentUuid, projectId); @@ -38,7 +39,6 @@ public class FileDependencyDao implements ServerComponent, DaoComponent { return session.getMapper(FileDependencyMapper.class).selectAll(); } - public void insert(DbSession session, FileDependencyDto dto) { session.getMapper(FileDependencyMapper.class).insert(dto); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsJsonWriter.java b/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsJsonWriter.java index 4d50a8a254e..1db9158bbf3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsJsonWriter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsJsonWriter.java @@ -21,7 +21,7 @@ package org.sonar.server.duplication.ws; import com.google.common.annotations.VisibleForTesting; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.text.JsonWriter; import org.sonar.core.component.ComponentDto; import org.sonar.core.persistence.DbSession; @@ -34,7 +34,8 @@ import java.util.Map; import static com.google.common.collect.Maps.newHashMap; -public class DuplicationsJsonWriter implements ServerComponent { +@ServerSide +public class DuplicationsJsonWriter { private final ComponentDao componentDao; diff --git a/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java b/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java index 2aa037092bf..ea6e5914aac 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java +++ b/server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.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.core.component.ComponentDto; import org.sonar.core.persistence.DbSession; import org.sonar.server.component.db.ComponentDao; @@ -45,7 +45,8 @@ import java.util.Map; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Maps.newHashMap; -public class DuplicationsParser implements ServerComponent { +@ServerSide +public class DuplicationsParser { private final ComponentDao componentDao; diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java b/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java index 0945ee21990..af1ad4801df 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java @@ -19,9 +19,10 @@ */ package org.sonar.server.es; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; -public abstract class BaseIndex implements ServerComponent { +@ServerSide +public abstract class BaseIndex { private final EsClient client; public BaseIndex(EsClient client) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndexer.java index 548437c11ee..75d314002b5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndexer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/BaseIndexer.java @@ -22,7 +22,7 @@ package org.sonar.server.es; import com.google.common.base.Throwables; import com.google.common.util.concurrent.Uninterruptibles; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -30,7 +30,8 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -public abstract class BaseIndexer implements ServerComponent, Startable { +@ServerSide +public abstract class BaseIndexer implements Startable { private final ThreadPoolExecutor executor; private final String indexName, typeName, dateFieldName; diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java b/server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java index 1ef1d9ce3b8..2cfe7794a51 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java @@ -25,7 +25,7 @@ import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.common.settings.ImmutableSettings; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; @@ -34,7 +34,8 @@ import java.util.Map; /** * Creates/deletes all indices in Elasticsearch during server startup. */ -public class IndexCreator implements ServerComponent, Startable { +@ServerSide +public class IndexCreator implements Startable { private static final Logger LOGGER = Loggers.get(IndexCreator.class); diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinition.java b/server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinition.java index edf29d61b10..12cb6676d00 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinition.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinition.java @@ -21,11 +21,12 @@ package org.sonar.server.es; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import java.util.Map; -public interface IndexDefinition extends ServerComponent { +@ServerSide +public interface IndexDefinition { public static class IndexDefinitionContext { private final Map<String, NewIndex> byKey = Maps.newHashMap(); @@ -42,7 +43,6 @@ public interface IndexDefinition extends ServerComponent { } } - void define(IndexDefinitionContext context); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinitions.java b/server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinitions.java index 771f9b8ed31..b3ee7b78dba 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinitions.java +++ b/server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinitions.java @@ -23,14 +23,15 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import org.elasticsearch.common.settings.Settings; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import java.util.Map; /** * This class collects definitions of all Elasticsearch indices during server startup */ -public class IndexDefinitions implements ServerComponent, Startable { +@ServerSide +public class IndexDefinitions implements Startable { /** * Immutable copy of {@link org.sonar.server.es.NewIndex} diff --git a/server/sonar-server/src/main/java/org/sonar/server/event/db/EventDao.java b/server/sonar-server/src/main/java/org/sonar/server/event/db/EventDao.java index ef03a50cf68..015a758a676 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/event/db/EventDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/event/db/EventDao.java @@ -20,7 +20,7 @@ package org.sonar.server.event.db; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.event.EventDto; import org.sonar.core.event.db.EventMapper; import org.sonar.core.persistence.DaoComponent; @@ -28,7 +28,8 @@ import org.sonar.core.persistence.DbSession; import java.util.List; -public class EventDao implements ServerComponent, DaoComponent { +@ServerSide +public class EventDao implements DaoComponent { public List<EventDto> selectByComponentUuid(DbSession session, String componentUuid) { return session.getMapper(EventMapper.class).selectByComponentUuid(componentUuid); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/AbstractChangeTagsAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/AbstractChangeTagsAction.java index 7aa68b28e11..bdccc311955 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/AbstractChangeTagsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/AbstractChangeTagsAction.java @@ -23,7 +23,7 @@ package org.sonar.server.issue; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.collect.Sets; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.Issue; import org.sonar.api.issue.condition.IsUnResolved; import org.sonar.api.issue.internal.DefaultIssue; @@ -35,7 +35,8 @@ import java.util.Collection; import java.util.Map; import java.util.Set; -public abstract class AbstractChangeTagsAction extends Action implements ServerComponent { +@ServerSide +public abstract class AbstractChangeTagsAction extends Action { private static final Splitter TAGS_SPLITTER = Splitter.on(',').trimResults().omitEmptyStrings(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/Action.java b/server/sonar-server/src/main/java/org/sonar/server/issue/Action.java index 715e725df6e..99e9cf1e804 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/Action.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/Action.java @@ -23,7 +23,7 @@ package org.sonar.server.issue; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.Issue; import org.sonar.api.issue.condition.Condition; import org.sonar.api.issue.internal.IssueChangeContext; @@ -38,7 +38,8 @@ import static com.google.common.collect.Lists.newArrayList; /** * @since 3.7 */ -public abstract class Action implements ServerComponent { +@ServerSide +public abstract class Action { private final String key; private final List<Condition> conditions; @@ -82,4 +83,3 @@ public abstract class Action implements ServerComponent { } } - diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ActionService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ActionService.java index 493b7cd3bd6..d6f46b7dd0c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ActionService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ActionService.java @@ -24,7 +24,7 @@ import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Strings; import com.google.common.collect.Iterables; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.component.Component; import org.sonar.api.config.Settings; import org.sonar.api.issue.Issue; @@ -52,7 +52,8 @@ import static com.google.common.collect.Lists.newArrayList; /** * @since 3.6 */ -public class ActionService implements ServerComponent { +@ServerSide +public class ActionService { private final DbClient dbClient; private final IssueService issueService; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/AddTagsAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/AddTagsAction.java index 1214af8df69..d0cf6691bbd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/AddTagsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/AddTagsAction.java @@ -21,14 +21,14 @@ package org.sonar.server.issue; import com.google.common.collect.Sets; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.issue.IssueUpdater; import java.util.Collection; import java.util.Set; - -public class AddTagsAction extends AbstractChangeTagsAction implements ServerComponent { +@ServerSide +public class AddTagsAction extends AbstractChangeTagsAction { public static final String KEY = "add_tags"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/AssignAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/AssignAction.java index 8beab29d430..8c05a9de673 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/AssignAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/AssignAction.java @@ -21,7 +21,7 @@ package org.sonar.server.issue; import com.google.common.base.Strings; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.Issue; import org.sonar.api.issue.condition.IsUnResolved; import org.sonar.api.issue.internal.DefaultIssue; @@ -33,8 +33,8 @@ import org.sonar.server.user.UserSession; import java.util.Collection; import java.util.Map; - -public class AssignAction extends Action implements ServerComponent { +@ServerSide +public class AssignAction extends Action { public static final String KEY = "assign"; public static final String VERIFIED_ASSIGNEE = "verifiedAssignee"; @@ -50,9 +50,9 @@ public class AssignAction extends Action implements ServerComponent { } @Override - public boolean verify(Map<String, Object> properties, Collection<Issue> issues, UserSession userSession){ + public boolean verify(Map<String, Object> properties, Collection<Issue> issues, UserSession userSession) { String assignee = assigneeValue(properties); - if(!Strings.isNullOrEmpty(assignee)) { + if (!Strings.isNullOrEmpty(assignee)) { User user = selectUser(assignee); if (user == null) { throw new IllegalArgumentException("Unknown user: " + assignee); @@ -66,7 +66,7 @@ public class AssignAction extends Action implements ServerComponent { @Override public boolean execute(Map<String, Object> properties, Context context) { - if(!properties.containsKey(VERIFIED_ASSIGNEE)) { + if (!properties.containsKey(VERIFIED_ASSIGNEE)) { throw new IllegalArgumentException("Assignee is missing from the execution parameters"); } User assignee = (User) properties.get(VERIFIED_ASSIGNEE); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/CommentAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/CommentAction.java index d8700f55600..5f384327c34 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/CommentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/CommentAction.java @@ -21,7 +21,7 @@ package org.sonar.server.issue; import com.google.common.base.Strings; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.Issue; import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.core.issue.IssueUpdater; @@ -30,7 +30,8 @@ import org.sonar.server.user.UserSession; import java.util.Collection; import java.util.Map; -public class CommentAction extends Action implements ServerComponent { +@ServerSide +public class CommentAction extends Action { public static final String KEY = "comment"; public static final String COMMENT_PROPERTY = "comment"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java index 8a09a82bf68..db59c14e026 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java @@ -27,7 +27,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.ActionPlan; import org.sonar.api.issue.Issue; import org.sonar.api.issue.IssueComment; @@ -71,7 +71,8 @@ import static com.google.common.collect.Lists.newArrayList; * * @since 3.6 */ -public class InternalRubyIssueService implements ServerComponent { +@ServerSide +public class InternalRubyIssueService { private static final String ID_PARAM = "id"; private static final String NAME_PARAM = "name"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogFormatter.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogFormatter.java index 427a240ea1b..7639efb98d5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogFormatter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogFormatter.java @@ -19,7 +19,7 @@ */ package org.sonar.server.issue; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.i18n.I18n; import org.sonar.api.issue.internal.FieldDiffs; import org.sonar.api.utils.Duration; @@ -34,7 +34,8 @@ import java.util.Map; import static com.google.common.collect.Lists.newArrayList; -public class IssueChangelogFormatter implements ServerComponent { +@ServerSide +public class IssueChangelogFormatter { private static final String ISSUE_CHANGELOG_FIELD = "issue.changelog.field."; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogService.java index c70f7cf67ca..2533c27ef38 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogService.java @@ -19,7 +19,7 @@ */ package org.sonar.server.issue; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.Issue; import org.sonar.api.issue.internal.FieldDiffs; import org.sonar.api.user.User; @@ -35,7 +35,8 @@ import static com.google.common.collect.Lists.newArrayList; /** * @since 3.6 */ -public class IssueChangelogService implements ServerComponent { +@ServerSide +public class IssueChangelogService { private final IssueChangeDao changeDao; private final UserFinder userFinder; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java index d889d8f600e..8e1af0d3916 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java @@ -22,7 +22,7 @@ package org.sonar.server.issue; import com.google.common.base.Objects; import com.google.common.base.Strings; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.IssueComment; import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.api.issue.internal.DefaultIssueComment; @@ -48,7 +48,8 @@ import static com.google.common.collect.Lists.newArrayList; /** * @since 3.6 */ -public class IssueCommentService implements ServerComponent { +@ServerSide +public class IssueCommentService { private final DbClient dbClient; private final IssueService issueService; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java index 576cc5a587f..2bfb5b4142d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java @@ -21,7 +21,11 @@ package org.sonar.server.issue; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.*; +import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.base.Preconditions; +import com.google.common.base.Splitter; +import com.google.common.base.Strings; import com.google.common.collect.Collections2; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @@ -30,7 +34,7 @@ import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.ObjectUtils; import org.joda.time.DateTime; import org.joda.time.format.ISOPeriodFormat; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.resources.Qualifiers; import org.sonar.api.rule.RuleKey; import org.sonar.api.server.ws.Request; @@ -48,14 +52,19 @@ import org.sonar.server.util.RubyUtils; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import java.util.*; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; import static com.google.common.collect.Lists.newArrayList; /** * This component is used to create an IssueQuery, in order to transform the component and component roots keys into uuid. */ -public class IssueQueryService implements ServerComponent { +@ServerSide +public class IssueQueryService { public static final String LOGIN_MYSELF = "__me__"; @@ -294,7 +303,7 @@ public class IssueQueryService implements ServerComponent { } String uniqueQualifier = qualifiers.iterator().next(); - switch(uniqueQualifier) { + switch (uniqueQualifier) { case Qualifiers.VIEW: case Qualifiers.SUBVIEW: addViewsOrSubViews(builder, componentUuids, uniqueQualifier); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java index f9950cad550..5e4db0a7bdc 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java @@ -22,7 +22,7 @@ package org.sonar.server.issue; import com.google.common.base.Objects; import com.google.common.base.Strings; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.ActionPlan; import org.sonar.api.issue.Issue; import org.sonar.api.issue.internal.DefaultIssue; @@ -60,9 +60,15 @@ import org.sonar.server.user.index.UserIndex; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; -public class IssueService implements ServerComponent { +@ServerSide +public class IssueService { private final DbClient dbClient; private final IssueIndex issueIndex; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java index 1bf7d3ee49b..0289237bb1b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java @@ -21,7 +21,7 @@ package org.sonar.server.issue; import com.google.common.base.Strings; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.ActionPlan; import org.sonar.api.issue.Issue; import org.sonar.api.issue.condition.IsUnResolved; @@ -33,7 +33,8 @@ import org.sonar.server.user.UserSession; import java.util.Collection; import java.util.Map; -public class PlanAction extends Action implements ServerComponent { +@ServerSide +public class PlanAction extends Action { public static final String KEY = "plan"; public static final String VERIFIED_ACTION_PLAN = "verifiedActionPlan"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/RemoveTagsAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/RemoveTagsAction.java index 2ab7d109861..5b3cbf52fd7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/RemoveTagsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/RemoveTagsAction.java @@ -21,14 +21,14 @@ package org.sonar.server.issue; import com.google.common.collect.Sets; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.issue.IssueUpdater; import java.util.Collection; import java.util.Set; - -public class RemoveTagsAction extends AbstractChangeTagsAction implements ServerComponent { +@ServerSide +public class RemoveTagsAction extends AbstractChangeTagsAction { public static final String KEY = "remove_tags"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java index ca7b48f31a2..04b899cc912 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java @@ -19,7 +19,7 @@ */ package org.sonar.server.issue; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.api.rules.RuleFinder; import org.sonar.core.component.ComponentDto; @@ -33,7 +33,8 @@ import org.sonar.server.issue.index.IssueIndexer; /** * @since 3.6 */ -public class ServerIssueStorage extends IssueStorage implements ServerComponent { +@ServerSide +public class ServerIssueStorage extends IssueStorage { private final DbClient dbClient; private final IssueIndexer indexer; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/SetSeverityAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/SetSeverityAction.java index 7a8efdc62b4..d56514a552e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/SetSeverityAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/SetSeverityAction.java @@ -21,7 +21,7 @@ package org.sonar.server.issue; import com.google.common.base.Strings; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.Issue; import org.sonar.api.issue.condition.Condition; import org.sonar.api.issue.condition.IsUnResolved; @@ -33,7 +33,8 @@ import org.sonar.server.user.UserSession; import java.util.Collection; import java.util.Map; -public class SetSeverityAction extends Action implements ServerComponent { +@ServerSide +public class SetSeverityAction extends Action { public static final String KEY = "set_severity"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/TransitionAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/TransitionAction.java index bb18afbfdda..6e9707ddda2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/TransitionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/TransitionAction.java @@ -24,7 +24,7 @@ import com.google.common.base.Predicate; import com.google.common.base.Strings; import com.google.common.collect.Iterables; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.Issue; import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.core.issue.workflow.IssueWorkflow; @@ -34,7 +34,8 @@ import org.sonar.server.user.UserSession; import java.util.Collection; import java.util.Map; -public class TransitionAction extends Action implements ServerComponent { +@ServerSide +public class TransitionAction extends Action { public static final String KEY = "do_transition"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java index 3b4e2d72ccc..d71d9c3d5cf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java @@ -22,7 +22,7 @@ package org.sonar.server.issue.actionplan; import com.google.common.base.Function; import com.google.common.collect.Iterables; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.ActionPlan; import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.api.issue.internal.IssueChangeContext; @@ -31,7 +31,12 @@ import org.sonar.core.issue.ActionPlanDeadlineComparator; import org.sonar.core.issue.ActionPlanStats; import org.sonar.core.issue.DefaultActionPlan; import org.sonar.core.issue.IssueUpdater; -import org.sonar.core.issue.db.*; +import org.sonar.core.issue.db.ActionPlanDao; +import org.sonar.core.issue.db.ActionPlanDto; +import org.sonar.core.issue.db.ActionPlanStatsDao; +import org.sonar.core.issue.db.ActionPlanStatsDto; +import org.sonar.core.issue.db.IssueDto; +import org.sonar.core.issue.db.IssueStorage; import org.sonar.core.persistence.DbSession; import org.sonar.core.resource.ResourceDao; import org.sonar.core.resource.ResourceDto; @@ -52,7 +57,8 @@ import static com.google.common.collect.Lists.newArrayList; /** * @since 3.6 */ -public class ActionPlanService implements ServerComponent { +@ServerSide +public class ActionPlanService { private final DbClient dbClient; @@ -63,7 +69,7 @@ public class ActionPlanService implements ServerComponent { private final IssueStorage issueStorage; public ActionPlanService(DbClient dbClient, ActionPlanDao actionPlanDao, ActionPlanStatsDao actionPlanStatsDao, ResourceDao resourceDao, - IssueUpdater issueUpdater, IssueStorage issueStorage) { + IssueUpdater issueUpdater, IssueStorage issueStorage) { this.dbClient = dbClient; this.actionPlanDao = actionPlanDao; this.actionPlanStatsDao = actionPlanStatsDao; @@ -111,7 +117,7 @@ public class ActionPlanService implements ServerComponent { issueStorage.save(issues); } - private List<IssueDto> findIssuesByActionPlan(String actionPlanKey){ + private List<IssueDto> findIssuesByActionPlan(String actionPlanKey) { DbSession session = dbClient.openSession(false); try { return dbClient.issueDao().findByActionPlan(session, actionPlanKey); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterService.java index c462c08e80f..8b8909c4edc 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterService.java @@ -23,7 +23,7 @@ package org.sonar.server.issue.filter; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.Paging; import org.sonar.core.issue.IssueFilterSerializer; import org.sonar.core.issue.db.IssueFilterDao; @@ -51,7 +51,8 @@ import java.util.Map; import static com.google.common.collect.Lists.newArrayList; -public class IssueFilterService implements ServerComponent { +@ServerSide +public class IssueFilterService { private final IssueFilterDao filterDao; private final IssueFilterFavouriteDao favouriteDao; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterWriter.java b/server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterWriter.java index 3283749361f..8308be1b662 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterWriter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterWriter.java @@ -21,13 +21,14 @@ package org.sonar.server.issue.filter; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.text.JsonWriter; import org.sonar.core.issue.db.IssueFilterDto; import org.sonar.core.permission.GlobalPermissions; import org.sonar.server.user.UserSession; -public class IssueFilterWriter implements ServerComponent { +@ServerSide +public class IssueFilterWriter { void write(UserSession session, IssueFilterDto filter, JsonWriter json) { json.name("filter").beginObject() diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/NewIssuesNotificationFactory.java b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/NewIssuesNotificationFactory.java index 6fa32e95b07..a3cfa9a3f8b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/NewIssuesNotificationFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/NewIssuesNotificationFactory.java @@ -20,13 +20,14 @@ package org.sonar.server.issue.notification; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.Durations; import org.sonar.server.db.DbClient; import org.sonar.server.rule.index.RuleIndex; import org.sonar.server.user.index.UserIndex; -public class NewIssuesNotificationFactory implements ServerComponent { +@ServerSide +public class NewIssuesNotificationFactory { private final UserIndex userIndex; private final RuleIndex ruleIndex; private final DbClient dbClient; diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueActionsWriter.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueActionsWriter.java index 04e72aadddb..c2f6eb79ce4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueActionsWriter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueActionsWriter.java @@ -20,7 +20,7 @@ package org.sonar.server.issue.ws; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.issue.Issue; import org.sonar.api.issue.action.Action; import org.sonar.api.utils.text.JsonWriter; @@ -34,7 +34,8 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class IssueActionsWriter implements ServerComponent { +@ServerSide +public class IssueActionsWriter { private final IssueService issueService; private final ActionService actionService; diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterEngine.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterEngine.java index 332c7081f14..0365b66368c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterEngine.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterEngine.java @@ -20,16 +20,18 @@ package org.sonar.server.measure; import com.google.common.base.Joiner; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.api.utils.log.Profiler; import javax.annotation.Nullable; + import java.util.List; import java.util.Map; -public class MeasureFilterEngine implements ServerComponent { +@ServerSide +public class MeasureFilterEngine { private static final Logger LOG = Loggers.get("MeasureFilter"); diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterExecutor.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterExecutor.java index 015d304c4fa..5d4dffc3af6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterExecutor.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterExecutor.java @@ -22,7 +22,7 @@ package org.sonar.server.measure; import com.google.common.base.Strings; import org.apache.commons.dbutils.DbUtils; import org.apache.ibatis.session.SqlSession; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.persistence.Database; import org.sonar.core.persistence.MyBatis; import org.sonar.core.resource.ResourceDao; @@ -32,7 +32,8 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; -public class MeasureFilterExecutor implements ServerComponent { +@ServerSide +public class MeasureFilterExecutor { private MyBatis mybatis; private Database database; @@ -80,7 +81,7 @@ public class MeasureFilterExecutor implements ServerComponent { } static boolean isValid(MeasureFilter filter, MeasureFilterContext context) { - boolean valid = Strings.isNullOrEmpty(filter.getBaseResourceKey()) || context.getBaseSnapshot()!=null; + boolean valid = Strings.isNullOrEmpty(filter.getBaseResourceKey()) || context.getBaseSnapshot() != null; valid &= !(filter.isOnBaseResourceChildren() && context.getBaseSnapshot() == null); valid &= !(filter.isOnFavourites() && context.getUserId() == null); valid &= validateMeasureConditions(filter); diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java index f9f3df84086..e2767f63340 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java @@ -25,7 +25,7 @@ import com.google.common.base.Strings; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric; import org.sonar.api.measures.MetricFinder; @@ -35,11 +35,16 @@ import org.sonar.api.utils.System2; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import java.util.*; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; import static com.google.common.collect.Lists.newArrayList; -public class MeasureFilterFactory implements ServerComponent { +@ServerSide +public class MeasureFilterFactory { private final MetricFinder metricFinder; private final System2 system; diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MeasureDao.java b/server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MeasureDao.java index c1b2bc5516d..b77872aec3a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MeasureDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MeasureDao.java @@ -21,7 +21,7 @@ package org.sonar.server.measure.persistence; import com.google.common.base.Function; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.measure.db.MeasureDto; import org.sonar.core.measure.db.MeasureMapper; import org.sonar.core.persistence.DaoComponent; @@ -32,7 +32,8 @@ import javax.annotation.CheckForNull; import java.util.List; -public class MeasureDao implements ServerComponent, DaoComponent { +@ServerSide +public class MeasureDao implements DaoComponent { public boolean existsByKey(DbSession session, String componentKey, String metricKey) { return mapper(session).countByComponentAndMetric(componentKey, metricKey) > 0; diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MetricDao.java b/server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MetricDao.java index ed345eec80d..e2dd1d6042c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MetricDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MetricDao.java @@ -20,7 +20,7 @@ package org.sonar.server.measure.persistence; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.measure.db.MetricDto; import org.sonar.core.measure.db.MetricMapper; import org.sonar.core.persistence.DaoComponent; @@ -30,7 +30,8 @@ import javax.annotation.CheckForNull; import java.util.List; -public class MetricDao implements ServerComponent, DaoComponent { +@ServerSide +public class MetricDao implements DaoComponent { @CheckForNull public MetricDto selectByKey(DbSession session, String key) { @@ -41,7 +42,7 @@ public class MetricDao implements ServerComponent, DaoComponent { return session.getMapper(MetricMapper.class).selectAllEnabled(); } - public void insert(DbSession session, MetricDto dto){ + public void insert(DbSession session, MetricDto dto) { session.getMapper(MetricMapper.class).insert(dto); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationCenter.java b/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationCenter.java index 4f68514f3e5..df16532b620 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationCenter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationCenter.java @@ -20,7 +20,7 @@ package org.sonar.server.notifications; import com.google.common.collect.Lists; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.notifications.NotificationChannel; import org.sonar.api.notifications.NotificationDispatcherMetadata; import org.sonar.api.utils.log.Logger; @@ -34,7 +34,8 @@ import java.util.List; /** * @since 3.5 */ -public class NotificationCenter implements ServerComponent { +@ServerSide +public class NotificationCenter { private static final Logger LOG = Loggers.get(NotificationCenter.class); diff --git a/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java b/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java index 58d52639dc0..137aee22153 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java @@ -26,7 +26,7 @@ import com.google.common.collect.SetMultimap; import org.picocontainer.Startable; import org.sonar.api.Properties; import org.sonar.api.Property; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.config.Settings; import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.NotificationChannel; @@ -62,7 +62,8 @@ import java.util.concurrent.TimeUnit; project = false, global = false) }) -public class NotificationService implements ServerComponent, Startable { +@ServerSide +public class NotificationService implements Startable { private static final Logger LOG = Loggers.get(NotificationService.class); diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionService.java b/server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionService.java index 98511305b2c..2792a4fd033 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionService.java @@ -20,7 +20,7 @@ package org.sonar.server.permission; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.security.DefaultGroups; import org.sonar.api.web.UserRole; import org.sonar.core.component.ComponentDto; @@ -31,9 +31,9 @@ import org.sonar.core.resource.ResourceDto; import org.sonar.core.user.GroupDto; import org.sonar.core.user.UserDto; import org.sonar.server.db.DbClient; -import org.sonar.server.issue.index.IssueAuthorizationIndexer; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.ForbiddenException; +import org.sonar.server.issue.index.IssueAuthorizationIndexer; import org.sonar.server.user.UserSession; import javax.annotation.CheckForNull; @@ -45,7 +45,8 @@ import java.util.Map; /** * Used by ruby code <pre>Internal.permissions</pre> */ -public class InternalPermissionService implements ServerComponent { +@ServerSide +public class InternalPermissionService { private enum Operation { ADD, REMOVE diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java b/server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java index 97b1798ada7..e0326853950 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java @@ -22,7 +22,7 @@ package org.sonar.server.permission; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.permission.GlobalPermissions; import org.sonar.core.permission.PermissionTemplateDao; import org.sonar.core.permission.PermissionTemplateDto; @@ -45,7 +45,8 @@ import java.util.regex.PatternSyntaxException; /** * Used by ruby code <pre>Internal.permission_templates</pre> */ -public class InternalPermissionTemplateService implements ServerComponent { +@ServerSide +public class InternalPermissionTemplateService { private final MyBatis myBatis; private final PermissionTemplateDao permissionTemplateDao; diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java b/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java index 765e49e91d5..6ef8b4620e0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java @@ -22,22 +22,31 @@ package org.sonar.server.permission; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.security.DefaultGroups; import org.sonar.api.utils.Paging; -import org.sonar.core.permission.*; +import org.sonar.core.permission.GroupWithPermission; +import org.sonar.core.permission.GroupWithPermissionDto; +import org.sonar.core.permission.PermissionDao; +import org.sonar.core.permission.PermissionQuery; +import org.sonar.core.permission.PermissionTemplateDao; +import org.sonar.core.permission.PermissionTemplateDto; +import org.sonar.core.permission.UserWithPermission; +import org.sonar.core.permission.UserWithPermissionDto; import org.sonar.core.resource.ResourceDao; import org.sonar.core.resource.ResourceDto; import org.sonar.core.resource.ResourceQuery; import org.sonar.server.exceptions.NotFoundException; import javax.annotation.Nullable; + import java.util.Collection; import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class PermissionFinder implements ServerComponent { +@ServerSide +public class PermissionFinder { private final PermissionDao permissionDao; private final ResourceDao resourceDao; diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java b/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java index b8f87770142..3a4d87a78c0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java @@ -21,8 +21,8 @@ package org.sonar.server.platform; import org.apache.commons.dbutils.DbUtils; import org.elasticsearch.index.query.QueryBuilders; +import org.sonar.api.ServerSide; import org.sonar.api.utils.log.Loggers; -import org.sonar.api.ServerComponent; import org.sonar.core.persistence.DatabaseVersion; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.MyBatis; @@ -35,7 +35,8 @@ import org.sonar.server.view.index.ViewIndexDefinition; import java.sql.Connection; import java.sql.SQLException; -public class BackendCleanup implements ServerComponent { +@ServerSide +public class BackendCleanup { private static final String[] INSPECTION_TABLES = { "action_plans", "authors", "dependencies", "duplications_index", "events", "graphs", "issues", "issue_changes", "manual_measures", diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/Monitor.java b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/Monitor.java index 5eb7dd989f7..d451ca17306 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/Monitor.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/Monitor.java @@ -19,14 +19,15 @@ */ package org.sonar.server.platform.monitoring; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import java.util.LinkedHashMap; /** * Any component that is involved in the informations returned by the web service api/system/info */ -public interface Monitor extends ServerComponent { +@ServerSide +public interface Monitor { /** * Name of section in System Info page */ @@ -36,5 +37,5 @@ public interface Monitor extends ServerComponent { * Type of attribute values must be supported by {@link org.sonar.api.utils.text.JsonWriter#valueObject(Object)} * because of JSON export by {@link org.sonar.server.platform.ws.SystemInfoWsAction} */ - LinkedHashMap<String,Object> attributes(); + LinkedHashMap<String, Object> attributes(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java index e9297de4353..6dbc75db6af 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java +++ b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java @@ -24,8 +24,8 @@ import com.google.common.collect.ListMultimap; import org.sonar.api.Extension; import org.sonar.api.ExtensionProvider; import org.sonar.api.Plugin; -import org.sonar.api.ServerComponent; -import org.sonar.api.ServerExtension; +import org.sonar.api.ServerSide; +import org.sonar.api.utils.AnnotationUtils; import org.sonar.core.platform.ComponentContainer; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; @@ -35,7 +35,8 @@ import java.util.Map; /** * Loads the plugins server extensions and injects them to DI container */ -public class ServerExtensionInstaller implements ServerComponent { +@ServerSide +public class ServerExtensionInstaller { private final PluginRepository pluginRepository; @@ -83,7 +84,7 @@ public class ServerExtensionInstaller implements ServerComponent { } Object installExtension(ComponentContainer container, PluginInfo pluginInfo, Object extension, boolean acceptProvider) { - if (isType(extension, ServerExtension.class)) { + if (AnnotationUtils.getAnnotation(extension, ServerSide.class) != null) { if (!acceptProvider && isExtensionProvider(extension)) { throw new IllegalStateException("ExtensionProvider can not include providers itself: " + extension); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/properties/ProjectSettingsFactory.java b/server/sonar-server/src/main/java/org/sonar/server/properties/ProjectSettingsFactory.java index e3b84813f30..139df70d8f6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/properties/ProjectSettingsFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/properties/ProjectSettingsFactory.java @@ -22,7 +22,7 @@ package org.sonar.server.properties; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.config.Settings; import org.sonar.core.properties.PropertiesDao; import org.sonar.core.properties.PropertyDto; @@ -30,7 +30,8 @@ import org.sonar.core.properties.PropertyDto; import java.util.List; import java.util.Map; -public class ProjectSettingsFactory implements ServerComponent { +@ServerSide +public class ProjectSettingsFactory { private final PropertiesDao dao; private final Settings settings; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QgateProjectFinder.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QgateProjectFinder.java index 17358cbfa9b..80da0318a85 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QgateProjectFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QgateProjectFinder.java @@ -20,15 +20,21 @@ package org.sonar.server.qualitygate; -import org.sonar.api.ServerComponent; -import org.sonar.core.qualitygate.db.*; +import org.sonar.api.ServerSide; +import org.sonar.core.qualitygate.db.ProjectQgateAssociation; +import org.sonar.core.qualitygate.db.ProjectQgateAssociationDao; +import org.sonar.core.qualitygate.db.ProjectQgateAssociationDto; +import org.sonar.core.qualitygate.db.ProjectQgateAssociationQuery; +import org.sonar.core.qualitygate.db.QualityGateDao; +import org.sonar.core.qualitygate.db.QualityGateDto; import org.sonar.server.exceptions.NotFoundException; import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class QgateProjectFinder implements ServerComponent { +@ServerSide +public class QgateProjectFinder { public static class Association { private List<ProjectQgateAssociation> projects; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInProfiles.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInProfiles.java index 76c5a00c7fe..df6ad518980 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInProfiles.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInProfiles.java @@ -22,7 +22,7 @@ package org.sonar.server.qualityprofile; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import java.util.Collection; @@ -32,7 +32,8 @@ import java.util.Collection; * It should be removed as soon as a new API to define quality profiles is created. Currently loading all definitions * just to get the profile names is too slow (see {@link org.sonar.api.profiles.ProfileDefinition}). */ -public class BuiltInProfiles implements ServerComponent { +@ServerSide +public class BuiltInProfiles { // built-in profile names grouped by language private final Multimap<String, String> namesByLang; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileBackuper.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileBackuper.java index 536bb965cd8..520d669bfa3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileBackuper.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileBackuper.java @@ -29,7 +29,7 @@ import org.apache.commons.lang.builder.CompareToBuilder; 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.RuleKey; import org.sonar.api.utils.text.XmlWriter; import org.sonar.core.persistence.DbSession; @@ -51,7 +51,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -public class QProfileBackuper implements ServerComponent { +@ServerSide +public class QProfileBackuper { private final QProfileReset reset; private final DbClient db; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java index fc9a2c33a63..32939e2eac5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java @@ -23,7 +23,7 @@ import com.google.common.base.Preconditions; import com.google.common.collect.MapDifference; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.core.persistence.DbSession; import org.sonar.core.qualityprofile.db.QualityProfileDto; @@ -34,7 +34,8 @@ import java.util.Collection; import java.util.Map; import java.util.Set; -public class QProfileComparison implements ServerComponent { +@ServerSide +public class QProfileComparison { private final DbClient dbClient; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileCopier.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileCopier.java index ed6c893aac8..1c8b14cfdce 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileCopier.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileCopier.java @@ -23,15 +23,21 @@ import org.apache.commons.io.Charsets; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.TempFolder; import org.sonar.core.persistence.DbSession; import org.sonar.core.qualityprofile.db.QualityProfileDto; import org.sonar.server.db.DbClient; -import java.io.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; -public class QProfileCopier implements ServerComponent { +@ServerSide +public class QProfileCopier { private final DbClient db; private final QProfileFactory factory; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java index dc9a0f2d74f..e7710b9019b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java @@ -22,7 +22,7 @@ package org.sonar.server.qualityprofile; import com.google.common.base.Charsets; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.profiles.ProfileExporter; import org.sonar.api.profiles.ProfileImporter; import org.sonar.api.profiles.RulesProfile; @@ -36,13 +36,19 @@ import org.sonar.core.qualityprofile.db.QualityProfileDto; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.NotFoundException; -import java.io.*; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; -public class QProfileExporters implements ServerComponent { +@ServerSide +public class QProfileExporters { private final QProfileLoader loader; private final RuleFinder ruleFinder; @@ -148,7 +154,6 @@ public class QProfileExporters implements ServerComponent { return result; } - private void importProfile(QualityProfileDto profileDto, RulesProfile rulesProfile, DbSession dbSession) { for (org.sonar.api.rules.ActiveRule activeRule : rulesProfile.getActiveRules()) { ruleActivator.activate(dbSession, toRuleActivation(activeRule), profileDto); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java index 411b1b8d4cc..0daa31a485d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java @@ -22,7 +22,7 @@ package org.sonar.server.qualityprofile; import com.google.common.collect.Lists; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.persistence.DbSession; import org.sonar.core.qualityprofile.db.QualityProfileDto; import org.sonar.server.db.DbClient; @@ -38,7 +38,8 @@ import java.util.List; /** * Create, delete, rename and set as default profile. */ -public class QProfileFactory implements ServerComponent { +@ServerSide +public class QProfileFactory { private final DbClient db; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java index 2e0ad3010e6..63cf0b7d5b0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java @@ -21,7 +21,7 @@ package org.sonar.server.qualityprofile; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.RuleStatus; import org.sonar.core.persistence.DbSession; @@ -42,7 +42,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -public class QProfileLoader implements ServerComponent { +@ServerSide +public class QProfileLoader { private final DbClient db; private final IndexClient index; @@ -131,5 +132,4 @@ public class QProfileLoader implements ServerComponent { new QueryContext().setLimit(0)).getTotal(); } - } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLookup.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLookup.java index bd6c88cda30..ed403ee4024 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLookup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLookup.java @@ -22,7 +22,7 @@ package org.sonar.server.qualityprofile; import com.google.common.base.Function; import com.google.common.collect.Iterables; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.persistence.DbSession; import org.sonar.core.qualityprofile.db.QualityProfileDto; import org.sonar.server.db.DbClient; @@ -33,7 +33,8 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class QProfileLookup implements ServerComponent { +@ServerSide +public class QProfileLookup { private final DbClient db; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectLookup.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectLookup.java index 712d94f4e49..f3dabcd25eb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectLookup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectLookup.java @@ -22,7 +22,7 @@ package org.sonar.server.qualityprofile; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.component.Component; import org.sonar.api.web.UserRole; import org.sonar.core.persistence.DbSession; @@ -37,7 +37,8 @@ import java.util.Collection; import java.util.List; import java.util.Map; -public class QProfileProjectLookup implements ServerComponent { +@ServerSide +public class QProfileProjectLookup { private final DbClient db; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java index be66271e521..4f6041cd55e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java @@ -20,7 +20,7 @@ package org.sonar.server.qualityprofile; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.web.UserRole; import org.sonar.core.component.ComponentDto; import org.sonar.core.permission.GlobalPermissions; @@ -35,7 +35,8 @@ import org.sonar.server.user.UserSession; * Should be refactored in order to use project key. Mabye should it be move to {@link QProfileFactory} * Permission checks should also be done in the upper service. */ -public class QProfileProjectOperations implements ServerComponent { +@ServerSide +public class QProfileProjectOperations { private final DbClient db; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileReset.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileReset.java index 83ae4917bd1..46771b0fdaa 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileReset.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileReset.java @@ -24,7 +24,7 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.rule.RuleKey; @@ -44,7 +44,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -public class QProfileReset implements ServerComponent { +@ServerSide +public class QProfileReset { private final DbClient db; private final QProfileFactory factory; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java index 32eec19eb53..383b07a32f8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java @@ -21,7 +21,7 @@ package org.sonar.server.qualityprofile; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.search.SearchHit; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.permission.GlobalPermissions; import org.sonar.core.persistence.DbSession; import org.sonar.core.qualityprofile.db.ActiveRuleKey; @@ -37,6 +37,7 @@ import org.sonar.server.user.UserSession; import javax.annotation.CheckForNull; import javax.annotation.Nullable; + import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; @@ -45,7 +46,8 @@ import java.util.Collection; import java.util.List; import java.util.Map; -public class QProfileService implements ServerComponent { +@ServerSide +public class QProfileService { private final DbClient db; private final ActivityIndex activityIndex; @@ -57,7 +59,7 @@ public class QProfileService implements ServerComponent { private final QProfileExporters exporters; public QProfileService(DbClient db, ActivityIndex activityIndex, RuleActivator ruleActivator, QProfileFactory factory, - QProfileBackuper backuper, QProfileCopier copier, QProfileReset reset, QProfileExporters exporters) { + QProfileBackuper backuper, QProfileCopier copier, QProfileReset reset, QProfileExporters exporters) { this.db = db; this.activityIndex = activityIndex; this.ruleActivator = ruleActivator; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java index 084b3bef83a..e716783bbaa 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java @@ -21,7 +21,7 @@ package org.sonar.server.qualityprofile; import com.google.common.base.Strings; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.component.Component; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.user.UserSession; @@ -35,7 +35,8 @@ import java.util.List; * Use {@link org.sonar.server.qualityprofile.QProfileService} instead */ @Deprecated -public class QProfiles implements ServerComponent { +@ServerSide +public class QProfiles { private static final String LANGUAGE_PARAM = "language"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java index 6c43acef289..d196687623a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java @@ -25,7 +25,7 @@ import com.google.common.collect.ListMultimap; import com.google.common.collect.Multimaps; import com.google.common.collect.Sets; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.resources.Languages; @@ -43,12 +43,17 @@ import org.sonar.server.platform.PersistentSettings; import javax.annotation.Nullable; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * Synchronize Quality profiles during server startup */ -public class RegisterQualityProfiles implements ServerComponent { +@ServerSide +public class RegisterQualityProfiles { private static final Logger LOGGER = Loggers.get(RegisterQualityProfiles.class); private static final String DEFAULT_PROFILE_NAME = "Sonar way"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java index e8c72779dd1..76587e1d9dd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java @@ -21,7 +21,7 @@ package org.sonar.server.qualityprofile; import com.google.common.base.Splitter; import com.google.common.collect.Lists; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.server.rule.RuleParamType; import org.sonar.core.persistence.DbSession; import org.sonar.core.qualityprofile.db.ActiveRuleDto; @@ -56,7 +56,8 @@ import static com.google.common.collect.Lists.newArrayList; /** * Activation and deactivation of rules in Quality profiles */ -public class RuleActivator implements ServerComponent { +@ServerSide +public class RuleActivator { private final DbClient db; private final TypeValidations typeValidations; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java index 184d3fdf187..7a9c6934ba6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java @@ -19,7 +19,7 @@ */ package org.sonar.server.qualityprofile; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.core.persistence.DbSession; import org.sonar.core.qualityprofile.db.ActiveRuleDto; @@ -32,7 +32,8 @@ import org.sonar.server.exceptions.BadRequestException; import java.util.Collection; -public class RuleActivatorContextFactory implements ServerComponent { +@ServerSide +public class RuleActivatorContextFactory { private final DbClient db; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java index 89a5959e648..9c57e617189 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java @@ -19,7 +19,7 @@ */ package org.sonar.server.qualityprofile.ws; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.i18n.I18n; import org.sonar.api.rule.Severity; import org.sonar.api.server.ws.Request; @@ -33,7 +33,8 @@ import org.sonar.server.rule.RuleService; import org.sonar.server.rule.ws.SearchAction; import org.sonar.server.user.UserSession; -public class BulkRuleActivationActions implements ServerComponent { +@ServerSide +public class BulkRuleActivationActions { public static final String PROFILE_KEY = "profile_key"; public static final String SEVERITY = "activation_severity"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java index 84994ea18cb..13e7bb88f0b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java @@ -20,9 +20,12 @@ package org.sonar.server.qualityprofile.ws; import com.google.common.base.Preconditions; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.resources.Languages; -import org.sonar.api.server.ws.*; +import org.sonar.api.server.ws.Request; +import org.sonar.api.server.ws.RequestHandler; +import org.sonar.api.server.ws.Response; +import org.sonar.api.server.ws.WebService; import org.sonar.api.server.ws.WebService.NewAction; import org.sonar.server.component.ComponentService; import org.sonar.server.exceptions.NotFoundException; @@ -33,7 +36,8 @@ import org.sonar.server.user.UserSession; import static org.apache.commons.lang.StringUtils.isEmpty; -public class ProjectAssociationActions implements ServerComponent { +@ServerSide +public class ProjectAssociationActions { private static final String PARAM_LANGUAGE = "language"; private static final String PARAM_PROFILE_NAME = "profileName"; @@ -121,7 +125,7 @@ public class ProjectAssociationActions implements ServerComponent { (!isEmpty(language) && !isEmpty(profileName)) ^ !isEmpty(profileKey), "Either profileKey or profileName + language must be set"); Preconditions.checkArgument(!isEmpty(projectKey) ^ !isEmpty(projectUuid), "Either projectKey or projectUuid must be set"); - if(profileKey == null) { + if (profileKey == null) { profileKey = getProfileKeyFromLanguageAndName(language, profileName); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java index a2c7758cdb1..a9cedb73d4a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java @@ -19,7 +19,7 @@ */ package org.sonar.server.qualityprofile.ws; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.Severity; import org.sonar.api.server.ws.Request; @@ -31,7 +31,8 @@ import org.sonar.core.qualityprofile.db.ActiveRuleKey; import org.sonar.server.qualityprofile.QProfileService; import org.sonar.server.qualityprofile.RuleActivation; -public class RuleActivationActions implements ServerComponent { +@ServerSide +public class RuleActivationActions { public static final String PROFILE_KEY = "profile_key"; public static final String RULE_KEY = "rule_key"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java b/server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java index 563bcb1ae18..c9db18ddcbe 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java @@ -23,7 +23,7 @@ import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.RuleStatus; import org.sonar.api.rules.RuleParam; @@ -37,6 +37,7 @@ import org.sonar.api.utils.log.Loggers; import org.sonar.core.i18n.RuleI18nManager; import org.sonar.server.debt.DebtModelPluginRepository; import org.sonar.server.debt.DebtModelXMLExporter; +import org.sonar.server.debt.DebtModelXMLExporter.RuleDebt; import org.sonar.server.debt.DebtRulesXMLImporter; import javax.annotation.CheckForNull; @@ -47,12 +48,12 @@ import java.util.Collection; import java.util.List; import static com.google.common.collect.Lists.newArrayList; -import static org.sonar.server.debt.DebtModelXMLExporter.RuleDebt; /** * Inject deprecated RuleRepository into {@link org.sonar.api.server.rule.RulesDefinition} for backward-compatibility. */ -public class DeprecatedRulesDefinitionLoader implements ServerComponent { +@ServerSide +public class DeprecatedRulesDefinitionLoader { private static final Logger LOG = Loggers.get(DeprecatedRulesDefinitionLoader.class); diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RubyRuleService.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RubyRuleService.java index 12227d24e26..a73d018a16d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RubyRuleService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RubyRuleService.java @@ -21,7 +21,7 @@ package org.sonar.server.rule; import com.google.common.base.Strings; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.RuleStatus; import org.sonar.api.server.debt.DebtRemediationFunction; @@ -49,7 +49,8 @@ import static com.google.common.collect.Lists.newArrayList; * @deprecated in 4.4 because Ruby on Rails is deprecated too ! */ @Deprecated -public class RubyRuleService implements ServerComponent, Startable { +@ServerSide +public class RubyRuleService implements Startable { private final RuleService service; private final RuleUpdater updater; diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java index 5d9e01e7666..f0e9d69fd94 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java @@ -22,7 +22,7 @@ package org.sonar.server.rule; import com.google.common.base.Splitter; import com.google.common.base.Strings; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.RuleStatus; import org.sonar.api.rule.Severity; @@ -45,7 +45,8 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class RuleCreator implements ServerComponent { +@ServerSide +public class RuleCreator { private final DbClient dbClient; @@ -74,7 +75,7 @@ public class RuleCreator implements ServerComponent { } } - private RuleKey createCustomRule(NewRule newRule, DbSession dbSession){ + private RuleKey createCustomRule(NewRule newRule, DbSession dbSession) { RuleKey templateKey = newRule.templateKey(); if (templateKey == null) { throw new IllegalArgumentException("Rule template key should not be null"); @@ -98,7 +99,7 @@ public class RuleCreator implements ServerComponent { return customRuleKey; } - private RuleKey createManualRule(NewRule newRule, DbSession dbSession){ + private RuleKey createManualRule(NewRule newRule, DbSession dbSession) { validateManualRule(newRule); RuleKey customRuleKey = RuleKey.of(RuleDoc.MANUAL_REPOSITORY, newRule.ruleKey()); @@ -190,11 +191,11 @@ public class RuleCreator implements ServerComponent { } @CheckForNull - private RuleDto loadRule(RuleKey ruleKey, DbSession dbSession){ + private RuleDto loadRule(RuleKey ruleKey, DbSession dbSession) { return dbClient.ruleDao().getNullableByKey(dbSession, ruleKey); } - private RuleKey createCustomRule(RuleKey ruleKey, NewRule newRule, RuleDto templateRuleDto, DbSession dbSession){ + private RuleKey createCustomRule(RuleKey ruleKey, NewRule newRule, RuleDto templateRuleDto, DbSession dbSession) { RuleDto ruleDto = RuleDto.createFor(ruleKey) .setTemplateId(templateRuleDto.getId()) .setConfigKey(templateRuleDto.getConfigKey()) @@ -220,7 +221,7 @@ public class RuleCreator implements ServerComponent { return ruleKey; } - private void createCustomRuleParams(@Nullable String paramValue, RuleDto ruleDto, RuleParamDto templateRuleParam, DbSession dbSession){ + private void createCustomRuleParams(@Nullable String paramValue, RuleDto ruleDto, RuleParamDto templateRuleParam, DbSession dbSession) { RuleParamDto ruleParamDto = RuleParamDto.createFor(ruleDto) .setName(templateRuleParam.getName()) .setType(templateRuleParam.getType()) @@ -229,7 +230,7 @@ public class RuleCreator implements ServerComponent { dbClient.ruleDao().addRuleParam(dbSession, ruleDto, ruleParamDto); } - private RuleKey createManualRule(RuleKey ruleKey, NewRule newRule, DbSession dbSession){ + private RuleKey createManualRule(RuleKey ruleKey, NewRule newRule, DbSession dbSession) { RuleDto ruleDto = RuleDto.createFor(ruleKey) .setName(newRule.name()) .setDescription(newRule.markdownDescription()) @@ -240,7 +241,7 @@ public class RuleCreator implements ServerComponent { return ruleKey; } - private void updateExistingRule(RuleDto ruleDto, NewRule newRule, DbSession dbSession){ + private void updateExistingRule(RuleDto ruleDto, NewRule newRule, DbSession dbSession) { if (ruleDto.getStatus().equals(RuleStatus.REMOVED)) { if (newRule.isPreventReactivation()) { throw new ReactivationException(String.format("A removed rule with the key '%s' already exists", ruleDto.getKey().rule()), ruleDto.getKey()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java index f64ba522009..e3b5e9d3012 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java @@ -19,14 +19,15 @@ */ package org.sonar.server.rule; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.server.rule.RulesDefinition; /** * Loads all instances of {@link org.sonar.api.server.rule.RulesDefinition} * and initializes {@link org.sonar.server.rule.RuleRepositories}. Used at server startup. */ -public class RuleDefinitionsLoader implements ServerComponent { +@ServerSide +public class RuleDefinitionsLoader { private final DeprecatedRulesDefinitionLoader deprecatedDefinitionConverter; private final RulesDefinition[] definitions; diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleDeleter.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleDeleter.java index 29ff1f22a28..b560f357f1d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleDeleter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleDeleter.java @@ -20,7 +20,7 @@ package org.sonar.server.rule; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.RuleStatus; import org.sonar.core.persistence.DbSession; @@ -29,7 +29,8 @@ import org.sonar.server.db.DbClient; import org.sonar.server.qualityprofile.RuleActivator; import org.sonar.server.rule.index.RuleDoc; -public class RuleDeleter implements ServerComponent { +@ServerSide +public class RuleDeleter { private final DbClient dbClient; private final RuleActivator ruleActivator; diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleOperations.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleOperations.java index b4741613aee..651b6d1560d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleOperations.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleOperations.java @@ -22,7 +22,7 @@ package org.sonar.server.rule; import com.google.common.base.Strings; import org.apache.commons.lang.builder.EqualsBuilder; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.api.server.debt.DebtRemediationFunction; import org.sonar.api.server.debt.internal.DefaultDebtRemediationFunction; @@ -43,7 +43,8 @@ import javax.annotation.Nullable; * @deprecated to be dropped in 4.4 */ @Deprecated -public class RuleOperations implements ServerComponent { +@ServerSide +public class RuleOperations { private final DbClient dbClient; diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleRepositories.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleRepositories.java index 1afb001b16b..3e2411f5385 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleRepositories.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleRepositories.java @@ -24,10 +24,11 @@ import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.ImmutableSortedSet; import com.google.common.collect.SetMultimap; import org.apache.commons.lang.builder.CompareToBuilder; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.server.rule.RulesDefinition; import javax.annotation.CheckForNull; + import java.util.Collection; import java.util.Map; import java.util.SortedSet; @@ -40,7 +41,8 @@ import java.util.SortedSet; * * @since 4.2 */ -public class RuleRepositories implements ServerComponent { +@ServerSide +public class RuleRepositories { public static class Repository implements Comparable<Repository> { private final String key, name, language; diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleService.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleService.java index cfb15e65982..3b0ab6be424 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleService.java @@ -19,7 +19,7 @@ */ package org.sonar.server.rule; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleKey; import org.sonar.core.permission.GlobalPermissions; import org.sonar.server.exceptions.NotFoundException; @@ -40,7 +40,8 @@ import java.util.Set; /** * @since 4.4 */ -public class RuleService implements ServerComponent { +@ServerSide +public class RuleService { private final RuleIndex index; private final RuleUpdater ruleUpdater; diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java index 98476084a21..4e715408d05 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java @@ -25,7 +25,7 @@ import com.google.common.collect.Multimap; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.EqualsBuilder; -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.api.server.debt.DebtRemediationFunction; @@ -46,7 +46,8 @@ import java.util.Set; import static com.google.common.collect.Lists.newArrayList; -public class RuleUpdater implements ServerComponent { +@ServerSide +public class RuleUpdater { private final DbClient dbClient; private final System2 system; @@ -289,7 +290,7 @@ public class RuleUpdater implements ServerComponent { } private void deleteOrUpdateParameters(DbSession dbSession, RuleUpdate update, RuleDto customRule, List<String> paramKeys, - Multimap<RuleDto, ActiveRuleDto> activeRules, Multimap<ActiveRuleDto, ActiveRuleParamDto> activeRuleParams) { + Multimap<RuleDto, ActiveRuleDto> activeRules, Multimap<ActiveRuleDto, ActiveRuleParamDto> activeRuleParams) { for (RuleParamDto ruleParamDto : dbClient.ruleDao().findRuleParamsByRuleKey(dbSession, update.getRuleKey())) { String key = ruleParamDto.getName(); String value = Strings.emptyToNull(update.parameter(key)); diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java index 6ad59c20601..2e693b19117 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java @@ -21,7 +21,7 @@ package org.sonar.server.rule.ws; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.resources.Language; import org.sonar.api.resources.Languages; import org.sonar.api.rule.RuleKey; @@ -45,7 +45,8 @@ import java.util.Map; * Add details about active rules to api/rules/search and api/rules/show * web services. */ -public class ActiveRuleCompleter implements ServerComponent { +@ServerSide +public class ActiveRuleCompleter { private static final Logger LOG = Loggers.get(ActiveRuleCompleter.class); diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/Index.java b/server/sonar-server/src/main/java/org/sonar/server/search/Index.java index 8ae1b962217..d71755315b0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/Index.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/Index.java @@ -20,7 +20,7 @@ package org.sonar.server.search; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.persistence.Dto; import javax.annotation.CheckForNull; @@ -30,7 +30,8 @@ import java.util.Date; import java.util.Iterator; import java.util.Map; -public interface Index<DOMAIN, DTO extends Dto<KEY>, KEY extends Serializable> extends Startable, ServerComponent { +@ServerSide +public interface Index<DOMAIN, DTO extends Dto<KEY>, KEY extends Serializable> extends Startable { @CheckForNull DOMAIN getNullableByKey(KEY key); diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/IndexClient.java b/server/sonar-server/src/main/java/org/sonar/server/search/IndexClient.java index 911fc2771e3..89a2b3d40d2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/IndexClient.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/IndexClient.java @@ -19,7 +19,7 @@ */ package org.sonar.server.search; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import java.util.Collection; import java.util.HashMap; @@ -28,20 +28,21 @@ import java.util.Map; /** * Facade for all Elasticsearch indices */ -public class IndexClient implements ServerComponent { +@ServerSide +public class IndexClient { - private final Map<Class<?>, Index<?,?,?>> indexComponents; + private final Map<Class<?>, Index<?, ?, ?>> indexComponents; - public IndexClient(Index<?,?,?>... indexComponents) { + public IndexClient(Index<?, ?, ?>... indexComponents) { - this.indexComponents = new HashMap<Class<?>, Index<?,?,?>>(); + this.indexComponents = new HashMap<Class<?>, Index<?, ?, ?>>(); - for(Index<?,?,?> indexComponent : indexComponents){ + for (Index<?, ?, ?> indexComponent : indexComponents) { this.indexComponents.put(indexComponent.getClass(), indexComponent); } } - public <K extends Index> K get(Class<K> clazz){ + public <K extends Index> K get(Class<K> clazz) { return (K) this.indexComponents.get(clazz); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java b/server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java index d20d2c4e825..9d244062923 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java @@ -28,11 +28,11 @@ import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.update.UpdateRequest; -import org.sonar.api.ServerComponent; -import org.sonar.core.platform.ComponentContainer; +import org.sonar.api.ServerSide; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.core.cluster.WorkQueue; +import org.sonar.core.platform.ComponentContainer; import org.sonar.server.search.action.IndexAction; import java.util.HashMap; @@ -45,7 +45,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -public class IndexQueue implements ServerComponent, WorkQueue<IndexAction<?>> { +@ServerSide +public class IndexQueue implements WorkQueue<IndexAction<?>> { private final SearchClient searchClient; private final ComponentContainer container; diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java b/server/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java index 68eb0ec5d8c..6f195dfe623 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java @@ -21,7 +21,7 @@ package org.sonar.server.search.ws; import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.utils.text.JsonWriter; import org.sonar.server.search.BaseDoc; import org.sonar.server.search.IndexUtils; @@ -36,7 +36,8 @@ import java.util.Set; /** * Mapping of search documents (see {@link org.sonar.server.search.BaseDoc}) to WS JSON responses */ -public abstract class BaseMapping<DOC extends BaseDoc, CTX> implements ServerComponent { +@ServerSide +public abstract class BaseMapping<DOC extends BaseDoc, CTX> { private final Multimap<String, String> indexFieldsByWsFields = LinkedHashMultimap.create(); private final Multimap<String, Mapper> mappers = LinkedHashMultimap.create(); @@ -132,7 +133,7 @@ public abstract class BaseMapping<DOC extends BaseDoc, CTX> implements ServerCom /** * String field */ - public static class IndexStringMapper<DOC extends BaseDoc, CTX> extends IndexMapper<DOC,CTX> { + public static class IndexStringMapper<DOC extends BaseDoc, CTX> extends IndexMapper<DOC, CTX> { protected final String key; public IndexStringMapper(String key, String indexKey, String defaultIndexKey) { @@ -156,7 +157,7 @@ public abstract class BaseMapping<DOC extends BaseDoc, CTX> implements ServerCom } } - public static class IndexBooleanMapper<DOC extends BaseDoc, CTX> extends IndexMapper<DOC,CTX> { + public static class IndexBooleanMapper<DOC extends BaseDoc, CTX> extends IndexMapper<DOC, CTX> { private final String key; public IndexBooleanMapper(String key, String indexKey) { @@ -171,7 +172,7 @@ public abstract class BaseMapping<DOC extends BaseDoc, CTX> implements ServerCom } } - public static class IndexArrayMapper<DOC extends BaseDoc, CTX> extends IndexMapper<DOC,CTX> { + public static class IndexArrayMapper<DOC extends BaseDoc, CTX> extends IndexMapper<DOC, CTX> { private final String key; public IndexArrayMapper(String key, String indexKey) { @@ -188,7 +189,7 @@ public abstract class BaseMapping<DOC extends BaseDoc, CTX> implements ServerCom } } - public static class IndexDatetimeMapper<DOC extends BaseDoc, CTX> extends IndexMapper<DOC,CTX> { + public static class IndexDatetimeMapper<DOC extends BaseDoc, CTX> extends IndexMapper<DOC, CTX> { private final String key; public IndexDatetimeMapper(String key, String indexKey) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/source/HtmlSourceDecorator.java b/server/sonar-server/src/main/java/org/sonar/server/source/HtmlSourceDecorator.java index 52caca4d161..ae74bd38912 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/source/HtmlSourceDecorator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/source/HtmlSourceDecorator.java @@ -20,14 +20,15 @@ package org.sonar.server.source; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import java.util.List; -public class HtmlSourceDecorator implements ServerComponent { +@ServerSide +public class HtmlSourceDecorator { @CheckForNull public String getDecoratedSourceAsHtml(@Nullable String sourceLine, @Nullable String highlighting, @Nullable String symbols) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java b/server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java index b9877861a35..5361258c25b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java @@ -22,7 +22,7 @@ package org.sonar.server.source; import org.apache.commons.lang.ObjectUtils; import org.elasticsearch.common.collect.Lists; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.server.source.index.SourceLineDoc; import org.sonar.server.source.index.SourceLineIndex; @@ -30,7 +30,8 @@ import javax.annotation.Nullable; import java.util.List; -public class SourceService implements ServerComponent { +@ServerSide +public class SourceService { private final HtmlSourceDecorator sourceDecorator; private final SourceLineIndex sourceLineIndex; diff --git a/server/sonar-server/src/main/java/org/sonar/server/source/db/FileSourceDao.java b/server/sonar-server/src/main/java/org/sonar/server/source/db/FileSourceDao.java index 8f7f06868a7..29031950c0b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/source/db/FileSourceDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/source/db/FileSourceDao.java @@ -23,7 +23,7 @@ package org.sonar.server.source.db; import com.google.common.base.Function; import org.apache.commons.dbutils.DbUtils; import org.apache.commons.io.IOUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.persistence.DaoComponent; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.MyBatis; @@ -40,7 +40,8 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -public class FileSourceDao implements ServerComponent, DaoComponent { +@ServerSide +public class FileSourceDao implements DaoComponent { private final MyBatis mybatis; diff --git a/server/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java b/server/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java index cdefebfdd23..b43f7d0d9f6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java +++ b/server/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java @@ -26,7 +26,7 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; import org.apache.commons.lang.builder.EqualsBuilder; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.rule.RuleStatus; import org.sonar.api.server.debt.DebtRemediationFunction; import org.sonar.api.utils.Duration; @@ -57,7 +57,8 @@ import java.util.List; * * @since 4.3 this component could be removed after 4 or 5 releases. */ -public class CopyRequirementsFromCharacteristicsToRules implements ServerComponent { +@ServerSide +public class CopyRequirementsFromCharacteristicsToRules { private static final Logger LOGGER = Loggers.get(CopyRequirementsFromCharacteristicsToRules.class); @@ -129,7 +130,8 @@ public class CopyRequirementsFromCharacteristicsToRules implements ServerCompone convertDisableRequirement(rule, session); } else if (enabledRequirement != null) { - // If one requirement is enable, it means either that this requirement has been set from SQALE, or that it come from a XML model definition + // If one requirement is enable, it means either that this requirement has been set from SQALE, or that it come from a XML model + // definition convertEnabledRequirement(rule, enabledRequirement, session); // When default values on debt are the same that ones set by SQALE, nothing to do diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java b/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java index 3f34be942f3..a6e579e1192 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java @@ -21,7 +21,7 @@ package org.sonar.server.test; import com.google.common.collect.Maps; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.test.MutableTestable; import org.sonar.api.test.Testable; @@ -38,7 +38,8 @@ import javax.annotation.CheckForNull; import java.util.Map; -public class CoverageService implements ServerComponent { +@ServerSide +public class CoverageService { public enum TYPE { UT, IT, OVERALL diff --git a/server/sonar-server/src/main/java/org/sonar/server/text/MacroInterpreter.java b/server/sonar-server/src/main/java/org/sonar/server/text/MacroInterpreter.java index 0971feae8a0..94b09239110 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/text/MacroInterpreter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/text/MacroInterpreter.java @@ -21,19 +21,20 @@ package org.sonar.server.text; import com.google.common.collect.ImmutableList; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.platform.Server; import java.util.List; -public class MacroInterpreter implements ServerComponent { +@ServerSide +public class MacroInterpreter { private final List<Macro> macros; public MacroInterpreter(Server server) { this.macros = ImmutableList.<Macro>of( new RuleMacro(server.getContextPath()) - ); + ); } public String interpret(String text) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/text/RubyTextService.java b/server/sonar-server/src/main/java/org/sonar/server/text/RubyTextService.java index 18d2db48069..9136c36e60e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/text/RubyTextService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/text/RubyTextService.java @@ -19,13 +19,14 @@ */ package org.sonar.server.text; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.markdown.Markdown; /** * @since 3.6 */ -public class RubyTextService implements ServerComponent { +@ServerSide +public class RubyTextService { private final MacroInterpreter macroInterpreter; diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java index 8354c31b419..17175bf7807 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java @@ -21,7 +21,7 @@ package org.sonar.server.ui; import com.google.common.collect.Maps; import org.apache.commons.lang.StringUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.i18n.I18n; import org.sonar.api.utils.Duration; import org.sonar.api.utils.Durations; @@ -38,7 +38,8 @@ import java.util.Map; * * Bridge between JRuby webapp and Java I18n component */ -public class JRubyI18n implements ServerComponent { +@ServerSide +public class JRubyI18n { private I18n i18n; private Durations durations; diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/PageDecorations.java b/server/sonar-server/src/main/java/org/sonar/server/ui/PageDecorations.java index 3be0d52c877..9960d44f560 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ui/PageDecorations.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ui/PageDecorations.java @@ -19,7 +19,7 @@ */ package org.sonar.server.ui; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.web.PageDecoration; import java.util.Collections; @@ -28,7 +28,8 @@ import java.util.List; /** * @since 3.3 */ -public final class PageDecorations implements ServerComponent { +@ServerSide +public final class PageDecorations { private final PageDecoration[] decorations; @@ -41,6 +42,6 @@ public final class PageDecorations implements ServerComponent { } public PageDecoration[] get() { - return decorations;//NOSONAR expose internal representation + return decorations;// NOSONAR expose internal representation } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/Views.java b/server/sonar-server/src/main/java/org/sonar/server/ui/Views.java index a66890c29ce..059269e079c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ui/Views.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ui/Views.java @@ -23,7 +23,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import org.apache.commons.lang.ArrayUtils; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.web.Page; import org.sonar.api.web.View; import org.sonar.api.web.Widget; @@ -34,7 +34,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -public class Views implements ServerComponent { +@ServerSide +public class Views { private Map<String, ViewProxy<Page>> pagesPerId = Maps.newHashMap(); private Set<ViewProxy<Page>> pages = Sets.newTreeSet(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java b/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java index 3bc44bca3ac..1693f6d5bcb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java @@ -20,15 +20,21 @@ package org.sonar.server.user; -import org.sonar.api.ServerComponent; -import org.sonar.core.user.*; +import org.sonar.api.ServerSide; +import org.sonar.core.user.GroupMembership; +import org.sonar.core.user.GroupMembershipDao; +import org.sonar.core.user.GroupMembershipDto; +import org.sonar.core.user.GroupMembershipQuery; +import org.sonar.core.user.UserDao; +import org.sonar.core.user.UserDto; import org.sonar.server.exceptions.NotFoundException; import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class GroupMembershipFinder implements ServerComponent { +@ServerSide +public class GroupMembershipFinder { public static class Membership { private List<GroupMembership> groups; diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipService.java b/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipService.java index 4fe558de05f..517c8a161f0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipService.java @@ -20,7 +20,7 @@ package org.sonar.server.user; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.user.GroupMembershipQuery; import org.sonar.server.util.RubyUtils; @@ -29,7 +29,8 @@ import java.util.Map; /** * Used by ruby code <pre>Internal.group_membership</pre> */ -public class GroupMembershipService implements ServerComponent { +@ServerSide +public class GroupMembershipService { private static final String SELECTED_MEMBERSHIP = "selected"; private static final String DESELECTED_MEMBERSHIP = "deselected"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/NewUserNotifier.java b/server/sonar-server/src/main/java/org/sonar/server/user/NewUserNotifier.java index a3b8da575d8..33152f84a3a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/NewUserNotifier.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/NewUserNotifier.java @@ -19,14 +19,15 @@ */ package org.sonar.server.user; -import org.sonar.api.utils.log.Loggers; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.platform.NewUserHandler; +import org.sonar.api.utils.log.Loggers; /** * @since 3.2 */ -public class NewUserNotifier implements ServerComponent { +@ServerSide +public class NewUserNotifier { private NewUserHandler[] handlers; diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/SecurityRealmFactory.java b/server/sonar-server/src/main/java/org/sonar/server/user/SecurityRealmFactory.java index c6f9cd806d9..f1e4f33553c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/SecurityRealmFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/SecurityRealmFactory.java @@ -22,7 +22,7 @@ package org.sonar.server.user; import org.apache.commons.lang.StringUtils; import org.picocontainer.Startable; 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.security.LoginPasswordAuthenticator; import org.sonar.api.security.SecurityRealm; @@ -33,7 +33,8 @@ import org.sonar.api.utils.log.Loggers; /** * @since 2.14 */ -public class SecurityRealmFactory implements ServerComponent, Startable { +@ServerSide +public class SecurityRealmFactory implements Startable { private final boolean ignoreStartupFailure; private final SecurityRealm realm; diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java index 5c5ebddfece..b5cfb5f617f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java @@ -27,7 +27,7 @@ import com.google.common.collect.Iterables; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang.StringUtils; 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.platform.NewUserHandler; import org.sonar.api.utils.System2; @@ -51,7 +51,8 @@ import java.util.Random; import static com.google.common.collect.Lists.newArrayList; -public class UserUpdater implements ServerComponent { +@ServerSide +public class UserUpdater { private static final String LOGIN_PARAM = "Login"; private static final String PASSWORD_CONFIRMATION_PARAM = "Password confirmation"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndex.java b/server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndex.java index 1ea3a2ff7f4..0a611cb44bd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndex.java @@ -36,7 +36,7 @@ import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.sort.SortBuilders; import org.elasticsearch.search.sort.SortOrder; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.core.util.NonNullInputFunction; import org.sonar.server.es.EsClient; import org.sonar.server.es.EsUtils; @@ -52,7 +52,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -public class UserIndex implements ServerComponent { +@ServerSide +public class UserIndex { /** * Convert an Elasticsearch result (a map) to an {@link UserDoc}. It's diff --git a/server/sonar-server/src/main/java/org/sonar/server/util/TypeValidation.java b/server/sonar-server/src/main/java/org/sonar/server/util/TypeValidation.java index e754199be38..47989089fe4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/util/TypeValidation.java +++ b/server/sonar-server/src/main/java/org/sonar/server/util/TypeValidation.java @@ -20,12 +20,14 @@ package org.sonar.server.util; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import javax.annotation.Nullable; + import java.util.List; -public interface TypeValidation extends ServerComponent { +@ServerSide +public interface TypeValidation { String key(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/util/TypeValidations.java b/server/sonar-server/src/main/java/org/sonar/server/util/TypeValidations.java index 5f160211aeb..bed5ee0b6f2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/util/TypeValidations.java +++ b/server/sonar-server/src/main/java/org/sonar/server/util/TypeValidations.java @@ -22,13 +22,15 @@ package org.sonar.server.util; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.server.exceptions.BadRequestException; import javax.annotation.Nullable; + import java.util.List; -public class TypeValidations implements ServerComponent { +@ServerSide +public class TypeValidations { private final List<TypeValidation> typeValidationList; diff --git a/server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndex.java b/server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndex.java index 54ffd0161a0..7345ba7b7cd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndex.java +++ b/server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndex.java @@ -27,7 +27,7 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.FilterBuilders; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.SearchHit; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.server.es.EsClient; import java.util.Collection; @@ -35,7 +35,8 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class ViewIndex implements ServerComponent { +@ServerSide +public class ViewIndex { private static final int SCROLL_TIME_IN_MINUTES = 3; @@ -78,7 +79,7 @@ public class ViewIndex implements ServerComponent { .setTypes(ViewIndexDefinition.TYPE_VIEW) .setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.termsFilter(ViewIndexDefinition.FIELD_UUID, viewUuids) - )) + )) .get(); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/ws/WebServiceEngine.java b/server/sonar-server/src/main/java/org/sonar/server/ws/WebServiceEngine.java index dd386b375c0..3f23aad0dbc 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ws/WebServiceEngine.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ws/WebServiceEngine.java @@ -21,7 +21,7 @@ package org.sonar.server.ws; import com.google.common.base.Charsets; import org.picocontainer.Startable; -import org.sonar.api.ServerComponent; +import org.sonar.api.ServerSide; import org.sonar.api.i18n.I18n; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.WebService; @@ -43,7 +43,8 @@ import java.util.List; /** * @since 4.2 */ -public class WebServiceEngine implements ServerComponent, Startable { +@ServerSide +public class WebServiceEngine implements Startable { private final WebService.Context context; |