aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-05-07 15:59:40 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-05-11 17:04:46 +0200
commit3c18d94e800d30e71b2ca578b2a4d606f824e844 (patch)
treeaca651a8adb71920ea839beb8975c425b94a587f
parent079a8179040931d2589b7d9b233ca9ed949437e2 (diff)
downloadsonarqube-3c18d94e800d30e71b2ca578b2a4d606f824e844.tar.gz
sonarqube-3c18d94e800d30e71b2ca578b2a4d606f824e844.zip
SONAR-6535 API cleanup: deprecate BatchComponent and ServerComponent
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java2
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/IndexPurgeListener.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/core/computation/dbcleaner/ProjectCleaner.java11
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/activity/ActivityService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/activity/RubyQProfileActivityService.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/activity/db/ActivityDao.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/batch/BatchIndex.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/component/ComponentCleanerService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentDao.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentIndexDao.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/component/db/ComponentLinkDao.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java16
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueue.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ReportQueueCleaner.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/db/Dao.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/db/DatabaseChecker.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/db/migrations/DatabaseMigrator.java14
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtCharacteristicsXMLImporter.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelLookup.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelPluginRepository.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelXMLExporter.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/debt/DebtRulesXMLImporter.java20
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/design/db/FileDependencyDao.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsJsonWriter.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/duplication/ws/DuplicationsParser.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/BaseIndex.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/BaseIndexer.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/IndexCreator.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinition.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/IndexDefinitions.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/event/db/EventDao.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/AbstractChangeTagsAction.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/Action.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ActionService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/AddTagsAction.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/AssignAction.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/CommentAction.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogFormatter.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueChangelogService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueQueryService.java19
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/PlanAction.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/RemoveTagsAction.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ServerIssueStorage.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/SetSeverityAction.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/TransitionAction.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanService.java16
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/filter/IssueFilterWriter.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/notification/NewIssuesNotificationFactory.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/ws/IssueActionsWriter.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterEngine.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterExecutor.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java11
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MeasureDao.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/persistence/MetricDao.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationCenter.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/notifications/NotificationService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionService.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/PermissionFinder.java15
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/Monitor.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java9
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/properties/ProjectSettingsFactory.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualitygate/QgateProjectFinder.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInProfiles.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileBackuper.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileComparison.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileCopier.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java13
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLoader.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileLookup.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectLookup.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileReset.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java11
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RuleActivationActions.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRulesDefinitionLoader.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/RubyRuleService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java19
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/RuleDeleter.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/RuleOperations.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/RuleRepositories.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/RuleService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/Index.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/IndexClient.java15
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/IndexQueue.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/search/ws/BaseMapping.java13
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/source/HtmlSourceDecorator.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/source/db/FileSourceDao.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java8
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/test/CoverageService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/text/MacroInterpreter.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/text/RubyTextService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ui/PageDecorations.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ui/Views.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipFinder.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/user/GroupMembershipService.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/user/NewUserNotifier.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/user/SecurityRealmFactory.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/user/UserUpdater.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/user/index/UserIndex.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/util/TypeValidation.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/util/TypeValidations.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/view/index/ViewIndex.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ws/WebServiceEngine.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java56
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java7
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionMatcher.java3
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java6
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java4
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/MetricProvider.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java9
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java19
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/cpd/CpdEngine.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/cpd/CpdMappings.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/cpd/index/IndexFactory.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java15
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java7
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingSettings.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDate.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDays.java6
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousAnalysis.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersion.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByVersion.java8
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PeriodsDefinition.java6
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/duplication/DuplicationCache.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/Caches.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/ResourceCache.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/ScanPersister.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/AbstractPatternInitializer.java9
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java16
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStack.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueHandlers.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTracking.java11
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerLineHashesLoader.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/mediumtest/ScanTaskObserver.java7
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/PersistersExecutor.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/PostJobsExecutor.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java11
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/platform/DefaultServer.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/postjob/PostJobOptimizer.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java8
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/qualitygate/QualityGate.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/report/EventCache.java11
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/repository/language/LanguagesRepository.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/ModuleQProfiles.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java14
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java78
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java38
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java3
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFilters.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java18
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileSystemLogger.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java8
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java12
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactory.java8
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleFileSystemInitializer.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleInputFileCache.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/StatusDetectionFactory.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureCache.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReportBuilder.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReports.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/report/Reporter.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/report/RuleNameProvider.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java9
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/sensor/SensorOptimizer.java5
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java11
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java41
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java4
-rw-r--r--sonar-core/src/main/java/org/sonar/core/component/PerspectiveBuilder.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/component/ScanGraph.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/component/SnapshotPerspectives.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/period/DefaultPeriodCleaner.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/config/Logback.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/dashboard/ActiveDashboardDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/dashboard/DashboardDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java6
-rw-r--r--sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java10
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/IssueFilterSerializer.java7
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java10
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDao.java10
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanStatsDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/db/IssueChangeDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterFavouriteDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/workflow/FunctionExecutor.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java32
-rw-r--r--sonar-core/src/main/java/org/sonar/core/measure/db/MeasureFilterDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/notification/db/NotificationQueueDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/permission/PermissionDao.java6
-rw-r--r--sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java14
-rw-r--r--sonar-core/src/main/java/org/sonar/core/permission/PermissionTemplateDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/platform/ComponentContainer.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/platform/PluginRepository.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/rule/RuleDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java9
-rw-r--r--sonar-core/src/main/java/org/sonar/core/template/LoadedTemplateDao.java9
-rw-r--r--sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java9
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/AuthorDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/AuthorizationDao.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/RoleDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/UserDao.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java8
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceCreationLock.java7
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceFilter.java9
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/charts/Chart.java5
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java23
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/RuleRepository.java7
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/XMLRuleParser.java11
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/BatchSide.java (renamed from sonar-batch/src/main/java/org/sonar/batch/phases/SensorMatcher.java)45
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/Extension.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java36
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/ServerSide.java (renamed from sonar-batch/src/main/java/org/sonar/batch/scan/DefaultSensorMatcher.java)22
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java13
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java17
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java20
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java15
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java15
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java10
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java11
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/web/View.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java7
371 files changed, 1817 insertions, 1046 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index 4afed1eb7ef..7a6fdb979a2 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -25,7 +25,6 @@ import org.sonar.api.Properties;
import org.sonar.api.Property;
import org.sonar.api.PropertyType;
import org.sonar.api.SonarPlugin;
-import org.sonar.core.timemachine.Periods;
import org.sonar.plugins.core.charts.DistributionAreaChart;
import org.sonar.plugins.core.charts.DistributionBarChart;
import org.sonar.plugins.core.dashboards.GlobalDefaultDashboard;
@@ -258,7 +257,6 @@ public final class CorePlugin extends SonarPlugin {
extensions.add(
DefaultResourceTypes.class,
UserManagedMetrics.class,
- Periods.class,
// measure filters
ProjectFilter.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java
index 6526240c9d1..4dda3ddbc95 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/DefaultResourceTypes.java
@@ -19,16 +19,18 @@
*/
package org.sonar.plugins.core;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.ExtensionProvider;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ServerSide;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.resources.Qualifiers;
import org.sonar.api.resources.ResourceType;
import org.sonar.api.resources.ResourceTypeTree;
+@BatchSide
+@ServerSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public final class DefaultResourceTypes extends ExtensionProvider implements BatchExtension, ServerExtension {
+public final class DefaultResourceTypes extends ExtensionProvider {
private static final String SUPPORTS_MEASURE_FILTERS = "supportsMeasureFilters";
private static final String CONFIGURABLE = "configurable";
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;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java b/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
index fb55fdde0a4..c3bb030facc 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
@@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.maven.project.MavenProject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.config.Settings;
@@ -44,7 +44,8 @@ import static org.sonar.api.utils.DateUtils.formatDateTime;
* Used by views !!
*
*/
-public class ProjectConfigurator implements BatchComponent {
+@BatchSide
+public class ProjectConfigurator {
private static final Logger LOG = LoggerFactory.getLogger(ProjectConfigurator.class);
private final System2 system2;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java
index 6a19dc49ab7..cc9037a6ada 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java
@@ -20,13 +20,36 @@
package org.sonar.batch.bootstrap;
import com.google.common.collect.Lists;
+import org.sonar.batch.components.TimeMachineConfiguration;
import org.sonar.batch.cpd.CpdComponents;
-import org.sonar.batch.design.*;
+import org.sonar.batch.debt.DebtDecorator;
+import org.sonar.batch.debt.IssueChangelogDebtCalculator;
+import org.sonar.batch.debt.NewDebtDecorator;
+import org.sonar.batch.debt.SqaleRatingDecorator;
+import org.sonar.batch.debt.SqaleRatingSettings;
+import org.sonar.batch.design.DirectoryDsmDecorator;
+import org.sonar.batch.design.DirectoryTangleIndexDecorator;
+import org.sonar.batch.design.FileTangleIndexDecorator;
+import org.sonar.batch.design.MavenDependenciesSensor;
+import org.sonar.batch.design.ProjectDsmDecorator;
+import org.sonar.batch.design.SubProjectDsmDecorator;
+import org.sonar.batch.issue.tracking.InitialOpenIssuesSensor;
+import org.sonar.batch.issue.tracking.IssueHandlers;
import org.sonar.batch.issue.tracking.IssueTracking;
+import org.sonar.batch.issue.tracking.IssueTrackingDecorator;
+import org.sonar.batch.language.LanguageDistributionDecorator;
import org.sonar.batch.maven.MavenProjectBootstrapper;
import org.sonar.batch.maven.MavenProjectBuilder;
import org.sonar.batch.maven.MavenProjectConverter;
-import org.sonar.batch.scan.report.*;
+import org.sonar.batch.qualitygate.GenerateQualityGateEvents;
+import org.sonar.batch.qualitygate.QualityGateVerifier;
+import org.sonar.batch.rule.QProfileEventsDecorator;
+import org.sonar.batch.scan.report.ConsoleReport;
+import org.sonar.batch.scan.report.HtmlReport;
+import org.sonar.batch.scan.report.IssuesReportBuilder;
+import org.sonar.batch.scan.report.JSONReport;
+import org.sonar.batch.scan.report.RuleNameProvider;
+import org.sonar.batch.scan.report.SourceProvider;
import org.sonar.batch.scm.ScmConfiguration;
import org.sonar.batch.scm.ScmSensor;
import org.sonar.batch.source.CodeColorizerSensor;
@@ -34,6 +57,7 @@ import org.sonar.batch.source.LinesSensor;
import org.sonar.core.computation.dbcleaner.DefaultPurgeTask;
import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner;
import org.sonar.core.config.CorePropertyDefinitions;
+import org.sonar.core.notification.DefaultNotificationManager;
import java.util.Collection;
import java.util.List;
@@ -75,7 +99,33 @@ public class BatchComponents {
// dbcleaner
DefaultPeriodCleaner.class,
- DefaultPurgeTask.class
+ DefaultPurgeTask.class,
+
+ QualityGateVerifier.class,
+
+ // language
+ LanguageDistributionDecorator.class,
+
+ // Debt
+ IssueChangelogDebtCalculator.class,
+ DebtDecorator.class,
+ NewDebtDecorator.class,
+ SqaleRatingDecorator.class,
+ SqaleRatingSettings.class,
+
+ DefaultNotificationManager.class,
+
+ // Quality Gate
+ GenerateQualityGateEvents.class,
+
+ // Issue tracking
+ IssueTrackingDecorator.class,
+ IssueHandlers.class,
+ InitialOpenIssuesSensor.class,
+
+ QProfileEventsDecorator.class,
+
+ TimeMachineConfiguration.class
);
components.addAll(CorePropertyDefinitions.all());
// CPD
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java
index 1575f757006..5a66504364e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchExtensionDictionnary.java
@@ -23,7 +23,6 @@ import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import org.apache.commons.lang.ClassUtils;
-import org.sonar.api.BatchExtension;
import org.sonar.api.batch.CheckProject;
import org.sonar.api.batch.DependedUpon;
import org.sonar.api.batch.DependsUpon;
@@ -126,15 +125,15 @@ public class BatchExtensionDictionnary {
return result;
}
- protected List<Object> getExtensions(@Nullable Class type) {
+ protected List<Object> getExtensions(Class type) {
List<Object> extensions = Lists.newArrayList();
completeBatchExtensions(componentContainer, extensions, type);
return extensions;
}
- private static void completeBatchExtensions(ComponentContainer container, List<Object> extensions, @Nullable Class type) {
+ private static void completeBatchExtensions(ComponentContainer container, List<Object> extensions, Class type) {
if (container != null) {
- extensions.addAll(container.getComponentsByType(type != null ? type : BatchExtension.class));
+ extensions.addAll(container.getComponentsByType(type));
completeBatchExtensions(container.getParent(), extensions, type);
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java
index 856cf505642..59bf1498365 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java
@@ -21,7 +21,7 @@ package org.sonar.batch.bootstrap;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.database.DatabaseProperties;
@@ -32,7 +32,8 @@ import org.sonar.core.properties.PropertiesDao;
/**
* Detects if database is not up-to-date with the version required by the batch.
*/
-public class DatabaseCompatibility implements BatchComponent {
+@BatchSide
+public class DatabaseCompatibility {
private DatabaseVersion version;
private Settings settings;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionMatcher.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionMatcher.java
index 5a477d63bc1..530429fb986 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionMatcher.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionMatcher.java
@@ -19,9 +19,12 @@
*/
package org.sonar.batch.bootstrap;
+import org.sonar.api.BatchSide;
+
/**
* @since 3.6
*/
+@BatchSide
public interface ExtensionMatcher {
boolean accept(Object extension);
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java
index 61bc80e6538..37519fdfb53 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java
@@ -20,7 +20,7 @@
package org.sonar.batch.bootstrap;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.batch.RequiresDB;
import org.sonar.api.batch.SupportedEnvironment;
@@ -41,8 +41,8 @@ public class ExtensionUtils {
return InstantiationStrategy.PER_PROJECT.equals(strategy);
}
- public static boolean isBatchExtension(Object extension) {
- return isType(extension, BatchExtension.class);
+ public static boolean isBatchSide(Object extension) {
+ return AnnotationUtils.getAnnotation(extension, BatchSide.class) != null;
}
public static boolean supportsEnvironment(Object extension, EnvironmentInformation environment) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java
index 18be773ae8c..c5d2a431b8b 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java
@@ -113,6 +113,7 @@ public class GlobalContainer extends ComponentContainer {
new FileCacheProvider(),
System2.INSTANCE,
DefaultI18n.class,
+ Durations.class,
new GlobalRepositoriesProvider(),
UserRepository.class);
addIfMissing(BatchPluginInstaller.class, PluginInstaller.class);
@@ -153,8 +154,7 @@ public class GlobalContainer extends ComponentContainer {
PastSnapshotFinderByPreviousAnalysis.class,
PastSnapshotFinderByVersion.class,
PastSnapshotFinderByPreviousVersion.class,
- PastSnapshotFinder.class,
- Durations.class);
+ PastSnapshotFinder.class);
}
@Override
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/MetricProvider.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/MetricProvider.java
index 35f9fb308f5..fd564925ef7 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/MetricProvider.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/MetricProvider.java
@@ -20,7 +20,7 @@
package org.sonar.batch.bootstrap;
import com.google.common.collect.Lists;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.ExtensionProvider;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.measures.CoreMetrics;
@@ -29,8 +29,9 @@ import org.sonar.api.measures.Metrics;
import java.util.List;
+@BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public class MetricProvider extends ExtensionProvider implements BatchComponent {
+public class MetricProvider extends ExtensionProvider {
private Metrics[] factories;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java
index 91eac2e7ebe..4cb02122d92 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ServerClient.java
@@ -31,11 +31,11 @@ import com.google.gson.JsonParser;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
-import org.sonar.core.util.DefaultHttpDownloader;
-import org.sonar.batch.bootstrapper.EnvironmentInformation;
import org.sonar.api.utils.HttpDownloader;
+import org.sonar.batch.bootstrapper.EnvironmentInformation;
+import org.sonar.core.util.DefaultHttpDownloader;
import javax.annotation.Nullable;
@@ -54,7 +54,8 @@ import java.util.List;
*
* @since 3.4
*/
-public class ServerClient implements BatchComponent {
+@BatchSide
+public class ServerClient {
private static final String GET = "GET";
private BootstrapProperties props;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java
index fce09a6cd1c..e372178e2ba 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskContainer.java
@@ -19,8 +19,6 @@
*/
package org.sonar.batch.bootstrap;
-import org.sonar.batch.components.PastMeasuresLoader;
-
import org.apache.commons.lang.StringUtils;
import org.sonar.api.CoreProperties;
import org.sonar.core.platform.ComponentContainer;
@@ -35,8 +33,6 @@ import org.sonar.batch.deprecated.tasks.Tasks;
import org.sonar.batch.scan.DeprecatedProjectReactorBuilder;
import org.sonar.batch.scan.ProjectReactorBuilder;
import org.sonar.batch.scan.ScanTask;
-import org.sonar.batch.scan.measure.DefaultMetricFinder;
-import org.sonar.batch.scan.measure.DeprecatedMetricFinder;
import org.sonar.core.permission.PermissionFacade;
import org.sonar.core.resource.DefaultResourcePermissions;
@@ -49,13 +45,11 @@ public class TaskContainer extends ComponentContainer {
private final Map<String, String> taskProperties;
private final Object[] components;
- private final DefaultAnalysisMode analysisMode;
public TaskContainer(ComponentContainer parent, Map<String, String> taskProperties, Object... components) {
super(parent);
this.taskProperties = taskProperties;
this.components = components;
- analysisMode = parent.getComponentByType(DefaultAnalysisMode.class);
}
@Override
@@ -63,24 +57,11 @@ public class TaskContainer extends ComponentContainer {
installCoreTasks();
installTaskExtensions();
installComponentsUsingTaskExtensions();
- addCoreComponents();
- if (analysisMode.isDb()) {
- addDataBaseComponents();
- }
for (Object component : components) {
add(component);
}
}
- private void addDataBaseComponents() {
- add(PastMeasuresLoader.class);
- }
-
- private void addCoreComponents() {
- add(DefaultMetricFinder.class,
- DeprecatedMetricFinder.class);
- }
-
void installCoreTasks() {
add(new TaskProperties(taskProperties, getParent().getComponentByType(BootstrapProperties.class).property(CoreProperties.ENCRYPTION_SECRET_KEY_PATH)));
add(
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java
index 7ce7c1f7cf1..c57d55a7c28 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/EnvironmentInformation.java
@@ -19,14 +19,15 @@
*/
package org.sonar.batch.bootstrapper;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
/**
* Describes execution environment.
*
* @since 2.6
*/
-public class EnvironmentInformation implements BatchComponent {
+@BatchSide
+public class EnvironmentInformation {
private String key;
private String version;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java b/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java
index d969e172338..672676edd36 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/components/PastMeasuresLoader.java
@@ -22,7 +22,7 @@ package org.sonar.batch.components;
import com.google.common.collect.Maps;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.Snapshot;
import org.sonar.api.measures.Metric;
@@ -41,7 +41,8 @@ import java.util.Map;
/**
* Can't be moved. Used by devcockpit.
*/
-public class PastMeasuresLoader implements BatchComponent {
+@BatchSide
+public class PastMeasuresLoader {
private Map<Integer, Metric> metricByIds;
private DatabaseSession session;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java b/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java
index 745dcbf817b..f7d9f0bab2b 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinder.java
@@ -23,7 +23,7 @@ import com.google.common.base.Strings;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.database.model.Snapshot;
@@ -42,7 +42,8 @@ import java.util.Date;
/**
* Can't be moved since it is used by devcockpit.
*/
-public class PastSnapshotFinder implements BatchExtension {
+@BatchSide
+public class PastSnapshotFinder {
private static final Logger LOG = LoggerFactory.getLogger(PastSnapshotFinder.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java
index fa97f80d2eb..766bbab044e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java
@@ -21,7 +21,7 @@ package org.sonar.batch.components;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.RequiresDB;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.Snapshot;
@@ -35,7 +35,8 @@ import static com.google.common.collect.Lists.newLinkedList;
import static org.sonar.api.utils.DateUtils.longToDate;
@RequiresDB
-public class TimeMachineConfiguration implements BatchComponent {
+@BatchSide
+public class TimeMachineConfiguration {
private static final Logger LOG = LoggerFactory.getLogger(TimeMachineConfiguration.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/cpd/CpdEngine.java b/sonar-batch/src/main/java/org/sonar/batch/cpd/CpdEngine.java
index 45964262241..1fc4464c39c 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/cpd/CpdEngine.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/cpd/CpdEngine.java
@@ -20,10 +20,11 @@
package org.sonar.batch.cpd;
import org.slf4j.Logger;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.sensor.SensorContext;
-public abstract class CpdEngine implements BatchExtension {
+@BatchSide
+public abstract class CpdEngine {
abstract boolean isLanguageSupported(String language);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/cpd/CpdMappings.java b/sonar-batch/src/main/java/org/sonar/batch/cpd/CpdMappings.java
index ff4b7a81beb..a4eae0c052d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/cpd/CpdMappings.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/cpd/CpdMappings.java
@@ -19,12 +19,13 @@
*/
package org.sonar.batch.cpd;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.CpdMapping;
import javax.annotation.CheckForNull;
-public class CpdMappings implements BatchComponent {
+@BatchSide
+public class CpdMappings {
private final CpdMapping[] mappings;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/cpd/index/IndexFactory.java b/sonar-batch/src/main/java/org/sonar/batch/cpd/index/IndexFactory.java
index a11f94a0fde..77809c7f785 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/cpd/index/IndexFactory.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/cpd/index/IndexFactory.java
@@ -23,7 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.database.DatabaseSession;
@@ -34,7 +34,8 @@ import org.sonar.core.duplication.DuplicationDao;
import javax.annotation.Nullable;
-public class IndexFactory implements BatchComponent {
+@BatchSide
+public class IndexFactory {
private static final Logger LOG = LoggerFactory.getLogger(IndexFactory.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java
index f4521d664a6..3af2092c66e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/debt/DebtDecorator.java
@@ -26,6 +26,7 @@ import org.sonar.api.batch.DecoratorBarriers;
import org.sonar.api.batch.DecoratorContext;
import org.sonar.api.batch.DependedUpon;
import org.sonar.api.batch.DependsUpon;
+import org.sonar.api.batch.RequiresDB;
import org.sonar.api.batch.rule.Rule;
import org.sonar.api.batch.rule.Rules;
import org.sonar.api.component.ResourcePerspectives;
@@ -61,6 +62,7 @@ import static com.google.common.collect.Maps.newHashMap;
* Decorator that computes the technical debt metric
*/
@DependsUpon(DecoratorBarriers.ISSUES_TRACKED)
+@RequiresDB
public final class DebtDecorator implements Decorator {
private final ResourcePerspectives perspectives;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java
index 7b925117ca1..dec9b442b55 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/debt/IssueChangelogDebtCalculator.java
@@ -23,7 +23,7 @@ package org.sonar.batch.debt;
import com.google.common.base.Function;
import com.google.common.collect.Ordering;
import org.apache.commons.lang.time.DateUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.internal.DefaultIssue;
import org.sonar.api.issue.internal.FieldDiffs;
@@ -32,14 +32,21 @@ import org.sonar.core.issue.IssueUpdater;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import static com.google.common.collect.Lists.newArrayList;
/**
* Warning, before modifying this class, please do not forget that it's used by the Dev Cockpit plugin
*/
-public class IssueChangelogDebtCalculator implements BatchComponent {
+@BatchSide
+public class IssueChangelogDebtCalculator {
@CheckForNull
public Long calculateNewTechnicalDebt(Issue issue, @Nullable Date periodDate) {
@@ -55,7 +62,7 @@ public class IssueChangelogDebtCalculator implements BatchComponent {
@CheckForNull
private Long calculateNewTechnicalDebtValueFromChangelog(@Nullable Long currentTechnicalDebtValue, Issue issue, Date periodDate) {
List<FieldDiffs> changelog = technicalDebtHistory(issue);
- for (Iterator<FieldDiffs> iterator = changelog.iterator(); iterator.hasNext(); ) {
+ for (Iterator<FieldDiffs> iterator = changelog.iterator(); iterator.hasNext();) {
FieldDiffs diff = iterator.next();
Date date = diff.creationDate();
if (isLesserOrEqual(date, periodDate)) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java
index f437ffa3744..9909fc47476 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/debt/NewDebtDecorator.java
@@ -20,15 +20,13 @@
package org.sonar.batch.debt;
-import org.sonar.batch.components.Period;
-
-import org.sonar.batch.components.TimeMachineConfiguration;
import com.google.common.collect.ImmutableList;
import org.sonar.api.batch.Decorator;
import org.sonar.api.batch.DecoratorBarriers;
import org.sonar.api.batch.DecoratorContext;
import org.sonar.api.batch.DependedUpon;
import org.sonar.api.batch.DependsUpon;
+import org.sonar.api.batch.RequiresDB;
import org.sonar.api.component.ResourcePerspectives;
import org.sonar.api.issue.Issuable;
import org.sonar.api.issue.Issue;
@@ -38,6 +36,8 @@ import org.sonar.api.measures.MeasureUtils;
import org.sonar.api.measures.Metric;
import org.sonar.api.resources.Project;
import org.sonar.api.resources.Resource;
+import org.sonar.batch.components.Period;
+import org.sonar.batch.components.TimeMachineConfiguration;
import javax.annotation.Nullable;
@@ -50,6 +50,7 @@ import static com.google.common.collect.Lists.newArrayList;
/**
* Decorator that computes the technical debt metric
*/
+@RequiresDB
@DependsUpon(DecoratorBarriers.ISSUES_TRACKED)
public final class NewDebtDecorator implements Decorator {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingSettings.java b/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingSettings.java
index f6cc8e660a6..23c5bbdd98e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingSettings.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/debt/SqaleRatingSettings.java
@@ -20,14 +20,15 @@
package org.sonar.batch.debt;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.measures.Metric;
import javax.annotation.Nullable;
-public class SqaleRatingSettings implements BatchComponent {
+@BatchSide
+public class SqaleRatingSettings {
private final Settings settings;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDate.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDate.java
index 5a5fff138a1..c4830c0d6ea 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDate.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDate.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.deprecated.components;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.Snapshot;
@@ -35,7 +35,8 @@ import java.util.List;
import static org.sonar.api.utils.DateUtils.dateToLong;
-public class PastSnapshotFinderByDate implements BatchExtension {
+@BatchSide
+public class PastSnapshotFinderByDate {
private DatabaseSession session;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDays.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDays.java
index 21ab5d15e13..7e54893d41d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDays.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByDays.java
@@ -20,7 +20,7 @@
package org.sonar.batch.deprecated.components;
import org.apache.commons.lang.time.DateUtils;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.Snapshot;
@@ -28,10 +28,12 @@ import org.sonar.api.resources.Qualifiers;
import org.sonar.batch.components.PastSnapshot;
import javax.annotation.CheckForNull;
+
import java.util.Date;
import java.util.List;
-public class PastSnapshotFinderByDays implements BatchExtension {
+@BatchSide
+public class PastSnapshotFinderByDays {
private DatabaseSession session;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousAnalysis.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousAnalysis.java
index e770975d461..9f4a964b77f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousAnalysis.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousAnalysis.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.deprecated.components;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.Snapshot;
@@ -33,7 +33,8 @@ import java.util.List;
import static org.sonar.api.utils.DateUtils.longToDate;
-public class PastSnapshotFinderByPreviousAnalysis implements BatchExtension {
+@BatchSide
+public class PastSnapshotFinderByPreviousAnalysis {
private DatabaseSession session;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersion.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersion.java
index 2de291f3e04..b0a25385e62 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersion.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByPreviousVersion.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.deprecated.components;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.Snapshot;
@@ -30,7 +30,8 @@ import org.sonar.core.persistence.MyBatis;
import static org.sonar.api.utils.DateUtils.longToDate;
-public class PastSnapshotFinderByPreviousVersion implements BatchExtension {
+@BatchSide
+public class PastSnapshotFinderByPreviousVersion {
private final DatabaseSession session;
private final MyBatis mybatis;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByVersion.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByVersion.java
index c6f5423ffab..c7ae4158cba 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByVersion.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PastSnapshotFinderByVersion.java
@@ -19,20 +19,20 @@
*/
package org.sonar.batch.deprecated.components;
-import org.sonar.batch.components.PastSnapshot;
-
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.Snapshot;
import org.sonar.api.resources.Qualifiers;
+import org.sonar.batch.components.PastSnapshot;
import java.util.Date;
import java.util.List;
import static org.sonar.api.utils.DateUtils.longToDate;
-public class PastSnapshotFinderByVersion implements BatchExtension {
+@BatchSide
+public class PastSnapshotFinderByVersion {
private final DatabaseSession session;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PeriodsDefinition.java b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PeriodsDefinition.java
index 3cab5d098c8..55f9b810434 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PeriodsDefinition.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/deprecated/components/PeriodsDefinition.java
@@ -20,7 +20,7 @@
package org.sonar.batch.deprecated.components;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.config.Settings;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.model.Snapshot;
@@ -30,12 +30,14 @@ import org.sonar.batch.components.PastSnapshot;
import org.sonar.batch.components.PastSnapshotFinder;
import javax.persistence.Query;
+
import java.util.List;
import static com.google.common.collect.Lists.newLinkedList;
import static org.sonar.api.utils.DateUtils.dateToLong;
-public class PeriodsDefinition implements BatchComponent {
+@BatchSide
+public class PeriodsDefinition {
private static final int NUMBER_OF_VARIATION_SNAPSHOTS = 5;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/duplication/DuplicationCache.java b/sonar-batch/src/main/java/org/sonar/batch/duplication/DuplicationCache.java
index e11322f8d10..78c07947429 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/duplication/DuplicationCache.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/duplication/DuplicationCache.java
@@ -21,7 +21,7 @@ package org.sonar.batch.duplication;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.sensor.duplication.internal.DefaultDuplication;
import org.sonar.batch.index.Cache;
import org.sonar.batch.index.Caches;
@@ -29,7 +29,8 @@ import org.sonar.batch.index.Caches;
/**
* Cache of duplication blocks. This cache is shared amongst all project modules.
*/
-public class DuplicationCache implements BatchComponent {
+@BatchSide
+public class DuplicationCache {
private final Cache<DefaultDuplication> cache;
private int sequence = 1;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/Caches.java b/sonar-batch/src/main/java/org/sonar/batch/index/Caches.java
index ca2a33a5014..ac0f509ec9d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/Caches.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/Caches.java
@@ -32,7 +32,7 @@ import com.persistit.logging.Slf4jAdapter;
import org.apache.commons.io.FileUtils;
import org.picocontainer.Startable;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.utils.TempFolder;
import java.io.File;
@@ -44,7 +44,8 @@ import java.util.Set;
*
* @since 3.6
*/
-public class Caches implements BatchComponent, Startable {
+@BatchSide
+public class Caches implements Startable {
private final Set<String> cacheNames = Sets.newHashSet();
private File tempDir;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceCache.java b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceCache.java
index 12ca8d6be65..19de9fb7791 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceCache.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceCache.java
@@ -23,7 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.resources.Library;
@@ -37,7 +37,8 @@ import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
-public class ResourceCache implements BatchComponent {
+@BatchSide
+public class ResourceCache {
// resource by component key
private final Map<String, BatchResource> resources = Maps.newLinkedHashMap();
// dedicated cache for libraries
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java
index 69b7dd98d85..33c2a98cc69 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/ResourceKeyMigration.java
@@ -23,7 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DeprecatedDefaultInputFile;
import org.sonar.api.database.DatabaseSession;
@@ -43,7 +43,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-public class ResourceKeyMigration implements BatchComponent {
+@BatchSide
+public class ResourceKeyMigration {
private static final String UNABLE_TO_UPDATE_COMPONENT_NO_MATCH_WAS_FOUND = "Unable to update component {}. No match was found.";
private static final String COMPONENT_CHANGED_TO = "Component {} changed to {}";
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/ScanPersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/ScanPersister.java
index 2bd6532dd77..0dfd07a3061 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/ScanPersister.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/ScanPersister.java
@@ -19,9 +19,10 @@
*/
package org.sonar.batch.index;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
-public interface ScanPersister extends BatchComponent {
+@BatchSide
+public interface ScanPersister {
void persist();
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java b/sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java
index f0c1cfb1fbd..1023ab35c68 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.issue;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.issue.internal.DefaultIssue;
import org.sonar.batch.index.Cache;
import org.sonar.batch.index.Caches;
@@ -29,7 +29,8 @@ import java.util.Collection;
/**
* Shared issues among all project modules
*/
-public class IssueCache implements BatchComponent {
+@BatchSide
+public class IssueCache {
// component key -> issue key -> issue
private final Cache<DefaultIssue> cache;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java b/sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java
index 469a65cb909..16b23a0f216 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/IssueFilters.java
@@ -19,11 +19,12 @@
*/
package org.sonar.batch.issue;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.issue.batch.IssueFilter;
import org.sonar.api.issue.internal.DefaultIssue;
-public class IssueFilters implements BatchComponent {
+@BatchSide
+public class IssueFilters {
private final org.sonar.api.issue.IssueFilter[] exclusionFilters;
private final IssueFilter[] filters;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/AbstractPatternInitializer.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/AbstractPatternInitializer.java
index e29fc5aaa30..e57ffe7d411 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/AbstractPatternInitializer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/pattern/AbstractPatternInitializer.java
@@ -22,14 +22,15 @@ package org.sonar.batch.issue.ignore.pattern;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.config.Settings;
import java.util.List;
import static com.google.common.base.Objects.firstNonNull;
-public abstract class AbstractPatternInitializer implements BatchExtension {
+@BatchSide
+public abstract class AbstractPatternInitializer {
private Settings settings;
@@ -53,7 +54,7 @@ public abstract class AbstractPatternInitializer implements BatchExtension {
}
public boolean hasMulticriteriaPatterns() {
- return ! multicriteriaPatterns.isEmpty();
+ return !multicriteriaPatterns.isEmpty();
}
public abstract void initializePatternsForPath(String relativePath, String componentKey);
@@ -68,7 +69,7 @@ public abstract class AbstractPatternInitializer implements BatchExtension {
String resourceKeyPattern = settings.getString(propPrefix + "resourceKey");
String ruleKeyPattern = settings.getString(propPrefix + "ruleKey");
String lineRange = "*";
- String[] fields = new String[] { resourceKeyPattern, ruleKeyPattern, lineRange };
+ String[] fields = new String[] {resourceKeyPattern, ruleKeyPattern, lineRange};
PatternDecoder.checkRegularLineConstraints(StringUtils.join(fields, ","), fields);
IssuePattern pattern = new IssuePattern(firstNonNull(resourceKeyPattern, "*"), firstNonNull(ruleKeyPattern, "*"));
PatternDecoder.decodeRangeOfLines(pattern, firstNonNull(lineRange, "*"));
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java
index a86a5382cf7..792c4ba94cc 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/ignore/scanner/IssueExclusionsRegexpScanner.java
@@ -20,17 +20,16 @@
package org.sonar.batch.issue.ignore.scanner;
-import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer;
-import org.sonar.batch.issue.ignore.pattern.IssuePattern;
-import org.sonar.batch.issue.ignore.pattern.LineRange;
-
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer;
+import org.sonar.batch.issue.ignore.pattern.IssuePattern;
+import org.sonar.batch.issue.ignore.pattern.LineRange;
import java.io.File;
import java.io.IOException;
@@ -38,7 +37,8 @@ import java.nio.charset.Charset;
import java.util.List;
import java.util.Set;
-public class IssueExclusionsRegexpScanner implements BatchExtension {
+@BatchSide
+public class IssueExclusionsRegexpScanner {
private static final Logger LOG = LoggerFactory.getLogger(IssueExclusionsRegexpScanner.class);
@@ -64,8 +64,8 @@ public class IssueExclusionsRegexpScanner implements BatchExtension {
}
for (IssuePattern pattern : patternsInitializer.getBlockPatterns()) {
blockMatchers.add(new DoubleRegexpMatcher(
- java.util.regex.Pattern.compile(pattern.getBeginBlockRegexp()),
- java.util.regex.Pattern.compile(pattern.getEndBlockRegexp())));
+ java.util.regex.Pattern.compile(pattern.getBeginBlockRegexp()),
+ java.util.regex.Pattern.compile(pattern.getEndBlockRegexp())));
}
init();
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStack.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStack.java
index 6d246b74606..8e73fb0a237 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStack.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/InitialOpenIssuesStack.java
@@ -20,7 +20,7 @@
package org.sonar.batch.issue.tracking;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.batch.index.Cache;
import org.sonar.batch.index.Caches;
@@ -33,8 +33,9 @@ import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
+@BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public class InitialOpenIssuesStack implements BatchExtension {
+public class InitialOpenIssuesStack {
private final Cache<IssueDto> issuesCache;
private final Cache<ArrayList<IssueChangeDto>> issuesChangelogCache;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueHandlers.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueHandlers.java
index b501e18ad66..f941bbcdcf8 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueHandlers.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueHandlers.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.issue.tracking;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.IssueHandler;
import org.sonar.api.issue.internal.DefaultIssue;
@@ -30,7 +30,8 @@ import org.sonar.core.user.DefaultUser;
import javax.annotation.Nullable;
-public class IssueHandlers implements BatchComponent {
+@BatchSide
+public class IssueHandlers {
private final IssueHandler[] handlers;
private final DefaultContext context;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTracking.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTracking.java
index adbdbc97525..6d72febbb77 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTracking.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/IssueTracking.java
@@ -27,16 +27,21 @@ import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.issue.internal.DefaultIssue;
import javax.annotation.Nullable;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public class IssueTracking implements BatchComponent {
+@BatchSide
+public class IssueTracking {
/**
* @param sourceHashHolder Null when working on resource that is not a file (directory/project)
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
index 0086ab704fa..ec1acefd4e1 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
@@ -23,7 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.rule.ActiveRule;
@@ -49,7 +49,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
-public class LocalIssueTracking implements BatchComponent {
+@BatchSide
+public class LocalIssueTracking {
private static final Logger LOG = LoggerFactory.getLogger(LocalIssueTracking.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
index 98719ce179b..7bfabac4a6e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
@@ -20,7 +20,7 @@
package org.sonar.batch.issue.tracking;
import com.google.common.base.Function;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.batch.bootstrap.ProjectReactor;
@@ -45,7 +45,8 @@ import java.util.Collections;
import java.util.List;
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public class ServerIssueRepository implements BatchComponent {
+@BatchSide
+public class ServerIssueRepository {
private static final Logger LOG = Loggers.get(ServerIssueRepository.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerLineHashesLoader.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerLineHashesLoader.java
index 857bdb2fdaf..8f3be703e35 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerLineHashesLoader.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerLineHashesLoader.java
@@ -19,9 +19,10 @@
*/
package org.sonar.batch.issue.tracking;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
-public interface ServerLineHashesLoader extends BatchComponent {
+@BatchSide
+public interface ServerLineHashesLoader {
String[] getLineHashes(String fileKey);
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/ScanTaskObserver.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/ScanTaskObserver.java
index 196ac9a9250..78b886b51b9 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/ScanTaskObserver.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/ScanTaskObserver.java
@@ -19,10 +19,13 @@
*/
package org.sonar.batch.mediumtest;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.batch.scan.ProjectScanContainer;
-public interface ScanTaskObserver extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface ScanTaskObserver {
void scanTaskCompleted(ProjectScanContainer container);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java
index 69bc2daad89..bf7dcb4731a 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java
@@ -20,7 +20,7 @@
package org.sonar.batch.phases;
import com.google.common.collect.Lists;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.Decorator;
import org.sonar.api.batch.DecoratorContext;
@@ -41,7 +41,8 @@ import org.sonar.batch.sensor.coverage.CoverageExclusions;
import java.util.Collection;
import java.util.List;
-public class DecoratorsExecutor implements BatchComponent {
+@BatchSide
+public class DecoratorsExecutor {
private final DecoratorsSelector decoratorsSelector;
private final SonarIndex index;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PersistersExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PersistersExecutor.java
index 3618d96cedc..8483f14b71c 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/PersistersExecutor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PersistersExecutor.java
@@ -21,14 +21,15 @@ package org.sonar.batch.phases;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.batch.bootstrap.DefaultAnalysisMode;
import org.sonar.batch.events.EventBus;
import org.sonar.batch.index.ScanPersister;
import java.util.Arrays;
-public class PersistersExecutor implements BatchComponent {
+@BatchSide
+public class PersistersExecutor {
private static final Logger LOG = LoggerFactory.getLogger(PersistersExecutor.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/PostJobsExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/PostJobsExecutor.java
index 9ef8f5d06f2..48297539fd1 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/PostJobsExecutor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/PostJobsExecutor.java
@@ -23,7 +23,7 @@ import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.PostJob;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.resources.Project;
@@ -32,7 +32,8 @@ import org.sonar.batch.events.EventBus;
import java.util.Collection;
-public class PostJobsExecutor implements BatchComponent {
+@BatchSide
+public class PostJobsExecutor {
private static final Logger LOG = LoggerFactory.getLogger(PostJobsExecutor.class);
private final BatchExtensionDictionnary selector;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java b/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java
index 7194f548f02..43fec23ea3f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/ProjectInitializer.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.phases;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.resources.Language;
@@ -30,7 +30,8 @@ import org.sonar.api.utils.SonarException;
/**
* Should be dropped when org.sonar.api.resources.Project is fully refactored.
*/
-public class ProjectInitializer implements BatchComponent {
+@BatchSide
+public class ProjectInitializer {
private Languages languages;
private Settings settings;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java
index 0c4b08160e3..a21b111c182 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/SensorsExecutor.java
@@ -20,7 +20,7 @@
package org.sonar.batch.phases;
import com.google.common.collect.Lists;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.resources.Project;
@@ -29,22 +29,21 @@ import org.sonar.batch.events.EventBus;
import java.util.Collection;
-public class SensorsExecutor implements BatchComponent {
+@BatchSide
+public class SensorsExecutor {
private EventBus eventBus;
private Project module;
private BatchExtensionDictionnary selector;
- private final SensorMatcher sensorMatcher;
- public SensorsExecutor(BatchExtensionDictionnary selector, Project project, EventBus eventBus, SensorMatcher sensorMatcher) {
+ public SensorsExecutor(BatchExtensionDictionnary selector, Project project, EventBus eventBus) {
this.selector = selector;
this.eventBus = eventBus;
this.module = project;
- this.sensorMatcher = sensorMatcher;
}
public void execute(SensorContext context) {
- Collection<Sensor> sensors = selector.select(Sensor.class, module, true, sensorMatcher);
+ Collection<Sensor> sensors = selector.select(Sensor.class, module, true, null);
eventBus.fireEvent(new SensorsPhaseEvent(Lists.newArrayList(sensors), true));
for (Sensor sensor : sensors) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/platform/DefaultServer.java b/sonar-batch/src/main/java/org/sonar/batch/platform/DefaultServer.java
index 662d5bd9a1e..3d19d4a12ce 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/platform/DefaultServer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/platform/DefaultServer.java
@@ -20,7 +20,7 @@
package org.sonar.batch.platform;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
import org.sonar.api.platform.Server;
@@ -33,7 +33,8 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
-public class DefaultServer extends Server implements BatchComponent {
+@BatchSide
+public class DefaultServer extends Server {
private Settings settings;
private ServerClient client;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/postjob/PostJobOptimizer.java b/sonar-batch/src/main/java/org/sonar/batch/postjob/PostJobOptimizer.java
index fa4f3ea613a..93362baf51d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/postjob/PostJobOptimizer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/postjob/PostJobOptimizer.java
@@ -21,12 +21,13 @@ package org.sonar.batch.postjob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.postjob.internal.DefaultPostJobDescriptor;
import org.sonar.api.config.Settings;
-public class PostJobOptimizer implements BatchComponent {
+@BatchSide
+public class PostJobOptimizer {
private static final Logger LOG = LoggerFactory.getLogger(PostJobOptimizer.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java b/sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java
index ee3f9f34a76..030571ce8d5 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/qualitygate/GenerateQualityGateEvents.java
@@ -19,7 +19,12 @@
*/
package org.sonar.batch.qualitygate;
-import org.sonar.api.batch.*;
+import org.sonar.api.batch.Decorator;
+import org.sonar.api.batch.DecoratorContext;
+import org.sonar.api.batch.DependsUpon;
+import org.sonar.api.batch.RequiresDB;
+import org.sonar.api.batch.TimeMachine;
+import org.sonar.api.batch.TimeMachineQuery;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Measure;
import org.sonar.api.measures.Metric;
@@ -34,6 +39,7 @@ import org.sonar.batch.report.EventCache;
import java.util.List;
+@RequiresDB
public class GenerateQualityGateEvents implements Decorator {
private final QualityGate qualityGate;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/qualitygate/QualityGate.java b/sonar-batch/src/main/java/org/sonar/batch/qualitygate/QualityGate.java
index 2684f8d9cfa..644d5804807 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/qualitygate/QualityGate.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/qualitygate/QualityGate.java
@@ -21,13 +21,14 @@ package org.sonar.batch.qualitygate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import javax.annotation.Nullable;
import java.util.Collection;
-public class QualityGate implements BatchComponent {
+@BatchSide
+public class QualityGate {
private final String name;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/EventCache.java b/sonar-batch/src/main/java/org/sonar/batch/report/EventCache.java
index 387050f280e..d2936146d74 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/report/EventCache.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/report/EventCache.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.report;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.resources.Resource;
import org.sonar.batch.index.ResourceCache;
import org.sonar.batch.protocol.Constants.EventCategory;
@@ -27,9 +27,14 @@ import org.sonar.batch.protocol.output.BatchReport.Event;
import javax.annotation.Nullable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
-public class EventCache implements BatchComponent {
+@BatchSide
+public class EventCache {
private final Map<Integer, List<Event>> eventsByComponentBatchId = new HashMap<>();
private final ResourceCache resourceCache;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
index e062ccb1eac..be9bcbb49ad 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java
@@ -25,7 +25,7 @@ import org.apache.commons.io.FileUtils;
import org.picocontainer.Startable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.config.Settings;
@@ -41,7 +41,8 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-public class ReportPublisher implements BatchComponent, Startable {
+@BatchSide
+public class ReportPublisher implements Startable {
private static final Logger LOG = LoggerFactory.getLogger(ReportPublisher.class);
public static final String KEEP_REPORT_PROP_KEY = "sonar.batch.keepReport";
diff --git a/sonar-batch/src/main/java/org/sonar/batch/repository/language/LanguagesRepository.java b/sonar-batch/src/main/java/org/sonar/batch/repository/language/LanguagesRepository.java
index dd80fee1dcd..6c815677651 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/repository/language/LanguagesRepository.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/repository/language/LanguagesRepository.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.repository.language;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import javax.annotation.CheckForNull;
@@ -29,7 +29,8 @@ import java.util.Collection;
* Languages repository
* @since 4.4
*/
-public interface LanguagesRepository extends BatchComponent {
+@BatchSide
+public interface LanguagesRepository {
/**
* Get language.
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/ModuleQProfiles.java b/sonar-batch/src/main/java/org/sonar/batch/rule/ModuleQProfiles.java
index 9c0fe13d21e..65d166d2642 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/ModuleQProfiles.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/ModuleQProfiles.java
@@ -20,7 +20,7 @@
package org.sonar.batch.rule;
import com.google.common.collect.ImmutableMap;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.batch.protocol.input.ProjectRepositories;
import javax.annotation.CheckForNull;
@@ -31,7 +31,8 @@ import java.util.Map;
/**
* Lists the Quality profiles enabled on the current module.
*/
-public class ModuleQProfiles implements BatchComponent {
+@BatchSide
+public class ModuleQProfiles {
public static final String SONAR_PROFILE_PROP = "sonar.profile";
private final Map<String, QProfile> byLanguage;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java
index 4ebc91e489b..d879d976439 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileEventsDecorator.java
@@ -21,11 +21,20 @@ package org.sonar.batch.rule;
import com.google.common.collect.ImmutableSortedMap;
import org.apache.commons.lang.time.DateUtils;
-import org.sonar.api.batch.*;
+import org.sonar.api.batch.Decorator;
+import org.sonar.api.batch.DecoratorContext;
+import org.sonar.api.batch.DependsUpon;
+import org.sonar.api.batch.RequiresDB;
+import org.sonar.api.batch.TimeMachine;
+import org.sonar.api.batch.TimeMachineQuery;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Measure;
import org.sonar.api.measures.Metric;
-import org.sonar.api.resources.*;
+import org.sonar.api.resources.Language;
+import org.sonar.api.resources.Languages;
+import org.sonar.api.resources.Project;
+import org.sonar.api.resources.Qualifiers;
+import org.sonar.api.resources.Resource;
import org.sonar.api.utils.KeyValueFormat;
import org.sonar.batch.protocol.Constants.EventCategory;
import org.sonar.batch.report.EventCache;
@@ -37,6 +46,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
+@RequiresDB
public class QProfileEventsDecorator implements Decorator {
private final TimeMachine timeMachine;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java
index 009b9d56253..a141502fd6c 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java
@@ -23,12 +23,13 @@ import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.config.Settings;
import org.sonar.api.utils.MessageException;
-public class QProfileVerifier implements BatchComponent {
+@BatchSide
+public class QProfileVerifier {
private static final Logger LOG = LoggerFactory.getLogger(QProfileVerifier.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java
index f8312429543..e3e808b914d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java
@@ -21,7 +21,6 @@ package org.sonar.batch.scan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.fs.internal.FileMetadata;
@@ -31,9 +30,11 @@ import org.sonar.core.platform.ComponentContainer;
import org.sonar.api.resources.Project;
import org.sonar.api.scan.filesystem.FileExclusions;
import org.sonar.batch.ProjectTree;
-import org.sonar.batch.bootstrap.*;
-import org.sonar.batch.components.TimeMachineConfiguration;
-import org.sonar.batch.debt.*;
+import org.sonar.batch.bootstrap.BatchExtensionDictionnary;
+import org.sonar.batch.bootstrap.DefaultAnalysisMode;
+import org.sonar.batch.bootstrap.ExtensionInstaller;
+import org.sonar.batch.bootstrap.ExtensionMatcher;
+import org.sonar.batch.bootstrap.ExtensionUtils;
import org.sonar.batch.deprecated.DeprecatedSensorContext;
import org.sonar.batch.deprecated.ResourceFilters;
import org.sonar.batch.deprecated.components.DefaultProjectClasspath;
@@ -50,17 +51,34 @@ import org.sonar.batch.issue.ignore.pattern.IssueExclusionPatternInitializer;
import org.sonar.batch.issue.ignore.pattern.IssueInclusionPatternInitializer;
import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader;
import org.sonar.batch.issue.ignore.scanner.IssueExclusionsRegexpScanner;
-import org.sonar.batch.issue.tracking.InitialOpenIssuesSensor;
-import org.sonar.batch.issue.tracking.IssueHandlers;
-import org.sonar.batch.issue.tracking.IssueTrackingDecorator;
-import org.sonar.batch.language.LanguageDistributionDecorator;
-import org.sonar.batch.phases.*;
+import org.sonar.batch.phases.DecoratorsExecutor;
+import org.sonar.batch.phases.InitializersExecutor;
+import org.sonar.batch.phases.PersistersExecutor;
+import org.sonar.batch.phases.PhaseExecutor;
+import org.sonar.batch.phases.PhasesTimeProfiler;
+import org.sonar.batch.phases.PostJobsExecutor;
+import org.sonar.batch.phases.ProjectInitializer;
+import org.sonar.batch.phases.SensorsExecutor;
import org.sonar.batch.postjob.DefaultPostJobContext;
import org.sonar.batch.postjob.PostJobOptimizer;
-import org.sonar.batch.qualitygate.GenerateQualityGateEvents;
-import org.sonar.batch.qualitygate.QualityGateVerifier;
-import org.sonar.batch.rule.*;
-import org.sonar.batch.scan.filesystem.*;
+import org.sonar.batch.rule.ModuleQProfiles;
+import org.sonar.batch.rule.QProfileDecorator;
+import org.sonar.batch.rule.QProfileSensor;
+import org.sonar.batch.rule.QProfileVerifier;
+import org.sonar.batch.rule.RuleFinderCompatibility;
+import org.sonar.batch.rule.RulesProfileProvider;
+import org.sonar.batch.scan.filesystem.ComponentIndexer;
+import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem;
+import org.sonar.batch.scan.filesystem.DeprecatedFileFilters;
+import org.sonar.batch.scan.filesystem.ExclusionFilters;
+import org.sonar.batch.scan.filesystem.FileIndexer;
+import org.sonar.batch.scan.filesystem.FileSystemLogger;
+import org.sonar.batch.scan.filesystem.InputFileBuilderFactory;
+import org.sonar.batch.scan.filesystem.LanguageDetectionFactory;
+import org.sonar.batch.scan.filesystem.ModuleFileSystemInitializer;
+import org.sonar.batch.scan.filesystem.ModuleInputFileCache;
+import org.sonar.batch.scan.filesystem.ProjectFileSystemAdapter;
+import org.sonar.batch.scan.filesystem.StatusDetectionFactory;
import org.sonar.batch.scan.report.IssuesReports;
import org.sonar.batch.sensor.DefaultSensorContext;
import org.sonar.batch.sensor.DefaultSensorStorage;
@@ -68,6 +86,7 @@ import org.sonar.batch.sensor.SensorOptimizer;
import org.sonar.batch.sensor.coverage.CoverageExclusions;
import org.sonar.batch.source.HighlightableBuilder;
import org.sonar.batch.source.SymbolizableBuilder;
+import org.sonar.core.timemachine.Periods;
public class ModuleScanContainer extends ComponentContainer {
private static final Logger LOG = LoggerFactory.getLogger(ModuleScanContainer.class);
@@ -84,9 +103,6 @@ public class ModuleScanContainer extends ComponentContainer {
protected void doBeforeStart() {
LOG.info("------------- Scan {}", module.getName());
addCoreComponents();
- if (analysisMode.isDb()) {
- addDataBaseComponents();
- }
addExtensions();
}
@@ -102,6 +118,7 @@ public class ModuleScanContainer extends ComponentContainer {
module.setSettings(moduleSettings);
add(
+ Periods.class,
PhaseExecutor.class,
RuleFinderCompatibility.class,
EventBus.class,
@@ -176,39 +193,12 @@ public class ModuleScanContainer extends ComponentContainer {
SymbolizableBuilder.class);
}
- private void addDataBaseComponents() {
- add(
- // Quality Gate
- QualityGateVerifier.class,
- GenerateQualityGateEvents.class,
-
- // language
- LanguageDistributionDecorator.class,
-
- // Debt
- IssueChangelogDebtCalculator.class,
- DebtDecorator.class,
- NewDebtDecorator.class,
- SqaleRatingDecorator.class,
- SqaleRatingSettings.class,
-
- // Issue tracking
- IssueTrackingDecorator.class,
- IssueHandlers.class,
- InitialOpenIssuesSensor.class,
-
- QProfileEventsDecorator.class,
-
- TimeMachineConfiguration.class);
-
- }
-
private void addExtensions() {
ExtensionInstaller installer = getComponentByType(ExtensionInstaller.class);
installer.install(this, new ExtensionMatcher() {
@Override
public boolean accept(Object extension) {
- if (ExtensionUtils.isType(extension, BatchComponent.class) && ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_PROJECT)) {
+ if (ExtensionUtils.isBatchSide(extension) && ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_PROJECT)) {
// Special use-case: the extension point ProjectBuilder is used in a Maven environment to define some
// new sub-projects without pom.
// Example : C# plugin adds sub-projects at runtime, even if they are not defined in root pom.
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java
index 12a23bf62e4..4105dab49c1 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java
@@ -20,7 +20,6 @@
package org.sonar.batch.scan;
import com.google.common.annotations.VisibleForTesting;
-import org.sonar.api.BatchComponent;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.batch.bootstrap.ProjectBootstrapper;
@@ -34,13 +33,22 @@ import org.sonar.api.utils.SonarException;
import org.sonar.batch.DefaultFileLinesContextFactory;
import org.sonar.batch.ProjectConfigurator;
import org.sonar.batch.ProjectTree;
-import org.sonar.batch.bootstrap.*;
+import org.sonar.batch.bootstrap.DefaultAnalysisMode;
+import org.sonar.batch.bootstrap.ExtensionInstaller;
+import org.sonar.batch.bootstrap.ExtensionMatcher;
+import org.sonar.batch.bootstrap.ExtensionUtils;
+import org.sonar.batch.bootstrap.MetricProvider;
+import org.sonar.batch.components.PastMeasuresLoader;
import org.sonar.batch.debt.DebtModelProvider;
-import org.sonar.batch.debt.IssueChangelogDebtCalculator;
import org.sonar.batch.deprecated.components.DefaultResourceCreationLock;
import org.sonar.batch.deprecated.components.PeriodsDefinition;
import org.sonar.batch.duplication.DuplicationCache;
-import org.sonar.batch.index.*;
+import org.sonar.batch.index.Caches;
+import org.sonar.batch.index.DefaultIndex;
+import org.sonar.batch.index.DependencyPersister;
+import org.sonar.batch.index.ResourceCache;
+import org.sonar.batch.index.ResourceKeyMigration;
+import org.sonar.batch.index.ResourcePersister;
import org.sonar.batch.issue.DefaultProjectIssues;
import org.sonar.batch.issue.IssueCache;
import org.sonar.batch.issue.tracking.InitialOpenIssuesStack;
@@ -50,19 +58,28 @@ import org.sonar.batch.mediumtest.ScanTaskObservers;
import org.sonar.batch.phases.GraphPersister;
import org.sonar.batch.profiling.PhasesSumUpTimeProfiler;
import org.sonar.batch.qualitygate.QualityGateProvider;
-import org.sonar.batch.report.*;
+import org.sonar.batch.report.ComponentsPublisher;
+import org.sonar.batch.report.CoveragePublisher;
+import org.sonar.batch.report.DuplicationsPublisher;
+import org.sonar.batch.report.EventCache;
+import org.sonar.batch.report.IssuesPublisher;
+import org.sonar.batch.report.MeasuresPublisher;
+import org.sonar.batch.report.ReportPublisher;
+import org.sonar.batch.report.SourcePublisher;
+import org.sonar.batch.report.TestExecutionAndCoveragePublisher;
import org.sonar.batch.repository.ProjectRepositoriesProvider;
import org.sonar.batch.repository.language.DefaultLanguagesRepository;
import org.sonar.batch.rule.ActiveRulesProvider;
import org.sonar.batch.rule.RulesProvider;
import org.sonar.batch.scan.filesystem.InputPathCache;
+import org.sonar.batch.scan.measure.DefaultMetricFinder;
+import org.sonar.batch.scan.measure.DeprecatedMetricFinder;
import org.sonar.batch.scan.measure.MeasureCache;
import org.sonar.batch.source.CodeColorizers;
import org.sonar.core.component.ScanGraph;
import org.sonar.core.issue.IssueUpdater;
import org.sonar.core.issue.workflow.FunctionExecutor;
import org.sonar.core.issue.workflow.IssueWorkflow;
-import org.sonar.core.notification.DefaultNotificationManager;
import org.sonar.core.technicaldebt.DefaultTechnicalDebtModel;
import org.sonar.core.test.TestPlanBuilder;
import org.sonar.core.test.TestPlanPerspectiveLoader;
@@ -121,7 +138,6 @@ public class ProjectScanContainer extends ComponentContainer {
new ProjectRepositoriesProvider(),
DefaultResourceCreationLock.class,
CodeColorizers.class,
- DefaultNotificationManager.class,
MetricProvider.class,
ProjectConfigurator.class,
DefaultIndex.class,
@@ -142,10 +158,13 @@ public class ProjectScanContainer extends ComponentContainer {
IssueWorkflow.class,
IssueCache.class,
DefaultProjectIssues.class,
- IssueChangelogDebtCalculator.class,
LocalIssueTracking.class,
ServerIssueRepository.class,
+ // metrics
+ DefaultMetricFinder.class,
+ DeprecatedMetricFinder.class,
+
// tests
TestPlanPerspectiveLoader.class,
TestablePerspectiveLoader.class,
@@ -192,6 +211,7 @@ public class ProjectScanContainer extends ComponentContainer {
private void addDataBaseComponents() {
add(
+ PastMeasuresLoader.class,
ResourcePersister.class,
ResourceKeyMigration.class,
GraphPersister.class,
@@ -240,7 +260,7 @@ public class ProjectScanContainer extends ComponentContainer {
static class BatchExtensionFilter implements ExtensionMatcher {
@Override
public boolean accept(Object extension) {
- return ExtensionUtils.isType(extension, BatchComponent.class)
+ return ExtensionUtils.isBatchSide(extension)
&& ExtensionUtils.isInstantiationStrategy(extension, InstantiationStrategy.PER_BATCH);
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java
index bb3f0f8a021..f6d8a8b59ac 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ScanTask.java
@@ -50,8 +50,7 @@ public class ScanTask implements Task {
DefaultProjectTree.class,
ProjectExclusions.class,
ProjectReactorValidator.class,
- ProjectReactorReady.class,
- DefaultSensorMatcher.class);
+ ProjectReactorReady.class);
scanContainer.execute();
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
index a30037a1c00..b8b48ec47fa 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
@@ -19,7 +19,7 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.SonarIndex;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.resources.File;
@@ -37,7 +37,8 @@ import javax.annotation.Nullable;
*
* @since 4.2
*/
-public class ComponentIndexer implements BatchComponent {
+@BatchSide
+public class ComponentIndexer {
private final Languages languages;
private final SonarIndex sonarIndex;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFilters.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFilters.java
index 16441588ac9..be1c52e58c2 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFilters.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ExclusionFilters.java
@@ -22,12 +22,13 @@ package org.sonar.batch.scan.filesystem;
import org.apache.commons.lang.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.PathPattern;
import org.sonar.api.scan.filesystem.FileExclusions;
-public class ExclusionFilters implements BatchComponent {
+@BatchSide
+public class ExclusionFilters {
private static final Logger LOG = LoggerFactory.getLogger(ExclusionFilters.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java
index fbc40556475..0e5dec4bbad 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileIndexer.java
@@ -25,7 +25,7 @@ import org.apache.commons.io.filefilter.HiddenFileFilter;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.InputFileFilter;
@@ -37,13 +37,23 @@ import org.sonar.batch.util.ProgressReport;
import java.io.File;
import java.nio.file.Path;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
/**
* Index input files into {@link InputPathCache}.
*/
-public class FileIndexer implements BatchComponent {
+@BatchSide
+public class FileIndexer {
private static final Logger LOG = LoggerFactory.getLogger(FileIndexer.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileSystemLogger.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileSystemLogger.java
index 20fb55af219..6f1ba9e306c 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileSystemLogger.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/FileSystemLogger.java
@@ -23,7 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.scan.filesystem.PathResolver;
import java.io.File;
@@ -32,7 +32,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Locale;
-public class FileSystemLogger implements BatchComponent {
+@BatchSide
+public class FileSystemLogger {
private final DefaultModuleFileSystem fs;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java
index 74685bd7955..cdee734908e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java
@@ -19,15 +19,15 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.api.batch.fs.internal.FileMetadata;
-
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
+import org.sonar.api.batch.fs.internal.FileMetadata;
import org.sonar.api.config.Settings;
import org.sonar.api.scan.filesystem.PathResolver;
import org.sonar.batch.bootstrap.DefaultAnalysisMode;
-public class InputFileBuilderFactory implements BatchComponent {
+@BatchSide
+public class InputFileBuilderFactory {
private final String moduleKey;
private final PathResolver pathResolver;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java
index 92423f3a25d..f2ee0374493 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputPathCache.java
@@ -21,7 +21,7 @@ package org.sonar.batch.scan.filesystem;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.fs.InputDir;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.InputPath;
@@ -29,13 +29,19 @@ import org.sonar.batch.index.BatchResource;
import javax.annotation.CheckForNull;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
/**
* Cache of all files and dirs. This cache is shared amongst all project modules. Inclusion and
* exclusion patterns are already applied.
*/
-public class InputPathCache implements BatchComponent {
+@BatchSide
+public class InputPathCache {
private final Map<String, SortedMap<String, InputFile>> inputFileCache = new LinkedHashMap<>();
private final Map<String, SortedMap<String, InputDir>> inputDirCache = new LinkedHashMap<>();
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactory.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactory.java
index c52118612c3..114dcf8543c 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactory.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/LanguageDetectionFactory.java
@@ -19,12 +19,12 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.batch.repository.language.LanguagesRepository;
-
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.config.Settings;
+import org.sonar.batch.repository.language.LanguagesRepository;
-public class LanguageDetectionFactory implements BatchComponent {
+@BatchSide
+public class LanguageDetectionFactory {
private final Settings settings;
private final LanguagesRepository languages;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleFileSystemInitializer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleFileSystemInitializer.java
index 3f25a94c6c7..fd98170dbb5 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleFileSystemInitializer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleFileSystemInitializer.java
@@ -21,7 +21,7 @@ package org.sonar.batch.scan.filesystem;
import com.google.common.collect.Lists;
import org.apache.commons.io.FileUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.scan.filesystem.PathResolver;
import org.sonar.api.utils.TempFolder;
@@ -34,7 +34,8 @@ import java.util.List;
/**
* @since 3.5
*/
-public class ModuleFileSystemInitializer implements BatchComponent {
+@BatchSide
+public class ModuleFileSystemInitializer {
private File baseDir, workingDir, buildDir;
private List<File> sourceDirsOrFiles = Lists.newArrayList();
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleInputFileCache.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleInputFileCache.java
index 17420fc2dc8..dd4044b1bbc 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleInputFileCache.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ModuleInputFileCache.java
@@ -19,13 +19,14 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.fs.InputDir;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
-public class ModuleInputFileCache extends DefaultFileSystem.Cache implements BatchComponent {
+@BatchSide
+public class ModuleInputFileCache extends DefaultFileSystem.Cache {
private final String moduleKey;
private final InputPathCache inputPathCache;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/StatusDetectionFactory.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/StatusDetectionFactory.java
index 7ec9b895461..99acd6313ed 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/StatusDetectionFactory.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/StatusDetectionFactory.java
@@ -19,10 +19,11 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.batch.protocol.input.ProjectRepositories;
-public class StatusDetectionFactory implements BatchComponent {
+@BatchSide
+public class StatusDetectionFactory {
private final ProjectRepositories projectReferentials;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureCache.java b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureCache.java
index 5cf7ce73f75..290f2955d07 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureCache.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/measure/MeasureCache.java
@@ -20,7 +20,7 @@
package org.sonar.batch.scan.measure;
import com.google.common.base.Preconditions;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.measure.MetricFinder;
import org.sonar.api.measures.Measure;
import org.sonar.api.measures.RuleMeasure;
@@ -34,7 +34,8 @@ import org.sonar.batch.index.Caches;
/**
* Cache of all measures. This cache is shared amongst all project modules.
*/
-public class MeasureCache implements BatchComponent {
+@BatchSide
+public class MeasureCache {
private final Cache<Measure> cache;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReportBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReportBuilder.java
index 36af32c9c92..f98704634a1 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReportBuilder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReportBuilder.java
@@ -21,7 +21,7 @@ package org.sonar.batch.scan.report;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.internal.DefaultIssue;
import org.sonar.api.resources.Project;
@@ -37,7 +37,8 @@ import org.sonar.batch.scan.filesystem.InputPathCache;
import javax.annotation.CheckForNull;
-public class IssuesReportBuilder implements BatchExtension {
+@BatchSide
+public class IssuesReportBuilder {
private static final Logger LOG = LoggerFactory.getLogger(IssuesReportBuilder.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReports.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReports.java
index 986ba12d7e6..50f2a0ddb6e 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReports.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/IssuesReports.java
@@ -19,10 +19,11 @@
*/
package org.sonar.batch.scan.report;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.batch.bootstrap.DefaultAnalysisMode;
-public class IssuesReports implements BatchComponent {
+@BatchSide
+public class IssuesReports {
private final DefaultAnalysisMode analysisMode;
private final Reporter[] reporters;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/Reporter.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/Reporter.java
index f2c84e963f7..4e1f5ea8199 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/Reporter.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/Reporter.java
@@ -19,9 +19,10 @@
*/
package org.sonar.batch.scan.report;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
-public interface Reporter extends BatchComponent {
+@BatchSide
+public interface Reporter {
public void execute();
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/RuleNameProvider.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/RuleNameProvider.java
index 6828fca449d..d7d50aafabe 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/RuleNameProvider.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/RuleNameProvider.java
@@ -20,14 +20,15 @@
package org.sonar.batch.scan.report;
import org.apache.commons.lang.StringEscapeUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleFinder;
import javax.annotation.CheckForNull;
-public class RuleNameProvider implements BatchComponent {
+@BatchSide
+public class RuleNameProvider {
private RuleFinder ruleFinder;
public RuleNameProvider(RuleFinder ruleFinder) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java b/sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java
index 264a7202386..1f913e2b63f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/report/SourceProvider.java
@@ -23,7 +23,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.batch.index.BatchResource;
@@ -34,7 +34,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-public class SourceProvider implements BatchComponent {
+@BatchSide
+public class SourceProvider {
private static final Logger LOG = LoggerFactory.getLogger(SourceProvider.class);
private final InputPathCache inputPathCache;
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java
index ec96767341e..526316f16f2 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scm/ScmConfiguration.java
@@ -23,7 +23,11 @@ import com.google.common.base.Joiner;
import org.picocontainer.Startable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.*;
+import org.sonar.api.BatchSide;
+import org.sonar.api.CoreProperties;
+import org.sonar.api.Properties;
+import org.sonar.api.Property;
+import org.sonar.api.PropertyType;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.batch.bootstrap.ProjectReactor;
@@ -47,7 +51,8 @@ import java.util.Map;
)
})
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public final class ScmConfiguration implements BatchComponent, Startable {
+@BatchSide
+public final class ScmConfiguration implements Startable {
private static final Logger LOG = LoggerFactory.getLogger(ScmConfiguration.class);
public static final String FORCE_RELOAD_KEY = "sonar.scm.forceReloadAll";
diff --git a/sonar-batch/src/main/java/org/sonar/batch/sensor/SensorOptimizer.java b/sonar-batch/src/main/java/org/sonar/batch/sensor/SensorOptimizer.java
index dbc4eac19e1..74c1e305e25 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/sensor/SensorOptimizer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/sensor/SensorOptimizer.java
@@ -21,7 +21,7 @@ package org.sonar.batch.sensor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.FilePredicate;
import org.sonar.api.batch.fs.FileSystem;
@@ -29,7 +29,8 @@ import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
import org.sonar.api.config.Settings;
-public class SensorOptimizer implements BatchComponent {
+@BatchSide
+public class SensorOptimizer {
private static final Logger LOG = LoggerFactory.getLogger(SensorOptimizer.class);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java b/sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java
index 7ed223e5199..c8eb840272f 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/source/CodeColorizers.java
@@ -24,7 +24,7 @@ import org.apache.commons.io.input.BOMInputStream;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.sensor.highlighting.NewHighlighting;
import org.sonar.api.web.CodeColorizerFormat;
import org.sonar.colorizer.CodeColorizer;
@@ -32,7 +32,11 @@ import org.sonar.colorizer.Tokenizer;
import javax.annotation.CheckForNull;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
@@ -41,7 +45,8 @@ import java.util.Map;
/**
* Central point for sonar-colorizer extensions
*/
-public class CodeColorizers implements BatchComponent {
+@BatchSide
+public class CodeColorizers {
private static final Logger LOG = LoggerFactory.getLogger(CodeColorizers.class);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java
index 95138b2e904..9deaf93ac81 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java
@@ -20,8 +20,9 @@
package org.sonar.batch.bootstrap;
import org.junit.Test;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.batch.RequiresDB;
import org.sonar.api.batch.SupportedEnvironment;
@@ -52,12 +53,13 @@ public class ExtensionUtilsTest {
}
@Test
- public void testIsBatchExtension() {
- assertThat(ExtensionUtils.isBatchExtension(BatchService.class)).isTrue();
- assertThat(ExtensionUtils.isBatchExtension(new BatchService())).isTrue();
+ public void testIsBatchSide() {
+ assertThat(ExtensionUtils.isBatchSide(BatchService.class)).isTrue();
+ assertThat(ExtensionUtils.isBatchSide(new BatchService())).isTrue();
+ assertThat(ExtensionUtils.isBatchSide(DeprecatedBatchService.class)).isTrue();
- assertThat(ExtensionUtils.isBatchExtension(ServerService.class)).isFalse();
- assertThat(ExtensionUtils.isBatchExtension(new ServerService())).isFalse();
+ assertThat(ExtensionUtils.isBatchSide(ServerService.class)).isFalse();
+ assertThat(ExtensionUtils.isBatchSide(new ServerService())).isFalse();
}
@Test
@@ -87,36 +89,47 @@ public class ExtensionUtilsTest {
assertThat(ExtensionUtils.requiresDB(new PersistentService())).isTrue();
}
+ @BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
- public static class BatchService implements BatchExtension {
+ public static class BatchService {
}
+ public static class DeprecatedBatchService implements BatchComponent {
+
+ }
+
+ @BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_PROJECT)
- public static class ProjectService implements BatchExtension {
+ public static class ProjectService {
}
- public static class DefaultService implements BatchExtension {
+ @BatchSide
+ public static class DefaultService {
}
- public static class ServerService implements ServerExtension {
+ @ServerSide
+ public static class ServerService {
}
+ @BatchSide
@SupportedEnvironment("maven")
- public static class MavenService implements BatchExtension {
+ public static class MavenService {
}
+ @BatchSide
@SupportedEnvironment({"maven", "ant", "gradle"})
- public static class BuildToolService implements BatchExtension {
+ public static class BuildToolService {
}
+ @BatchSide
@RequiresDB
- public static class PersistentService implements BatchExtension {
+ public static class PersistentService {
}
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
index 000c64140d0..2ac9bab0fff 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
@@ -66,7 +66,7 @@ public class MeasuresMediumTest {
.newScanTask(new File(projectDir, "sonar-project.properties"))
.start();
- assertThat(result.allMeasures()).hasSize(58);
+ assertThat(result.allMeasures()).hasSize(79);
}
@Test
@@ -93,7 +93,7 @@ public class MeasuresMediumTest {
.build())
.start();
- assertThat(result.allMeasures()).hasSize(28);
+ assertThat(result.allMeasures()).hasSize(37);
assertThat(result.allMeasures()).contains(new DefaultMeasure<Integer>()
.forMetric(CoreMetrics.LINES)
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java
index b4f7dc49ce3..7037ec35550 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectScanContainerTest.java
@@ -109,8 +109,8 @@ public class ProjectScanContainerTest {
assertThat(filter.accept(MyProjectExtension.class)).isFalse();
assertThat(filter.accept(new MyServerExtension())).isFalse();
assertThat(filter.accept(MyServerExtension.class)).isFalse();
- assertThat(filter.accept(new MyTaskExtension())).isFalse();
- assertThat(filter.accept(MyTaskExtension.class)).isFalse();
+ assertThat(filter.accept(new MyTaskExtension())).isTrue();
+ assertThat(filter.accept(MyTaskExtension.class)).isTrue();
}
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
diff --git a/sonar-core/src/main/java/org/sonar/core/component/PerspectiveBuilder.java b/sonar-core/src/main/java/org/sonar/core/component/PerspectiveBuilder.java
index 31f9c323d61..928a3938046 100644
--- a/sonar-core/src/main/java/org/sonar/core/component/PerspectiveBuilder.java
+++ b/sonar-core/src/main/java/org/sonar/core/component/PerspectiveBuilder.java
@@ -19,14 +19,16 @@
*/
package org.sonar.core.component;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.component.Component;
import org.sonar.api.component.Perspective;
import javax.annotation.CheckForNull;
-public abstract class PerspectiveBuilder<T extends Perspective> implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public abstract class PerspectiveBuilder<T extends Perspective> {
private final Class<T> perspectiveClass;
diff --git a/sonar-core/src/main/java/org/sonar/core/component/ScanGraph.java b/sonar-core/src/main/java/org/sonar/core/component/ScanGraph.java
index 6d89d0b9824..ce76fe74c2a 100644
--- a/sonar-core/src/main/java/org/sonar/core/component/ScanGraph.java
+++ b/sonar-core/src/main/java/org/sonar/core/component/ScanGraph.java
@@ -23,14 +23,15 @@ import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.component.Component;
import org.sonar.api.resources.Resource;
import org.sonar.core.graph.BeanGraph;
import org.sonar.core.graph.BeanIterable;
import org.sonar.core.graph.GraphUtil;
-public class ScanGraph extends BeanGraph implements BatchComponent {
+@BatchSide
+public class ScanGraph extends BeanGraph {
private static final String COMPONENT = "component";
private final Vertex componentsRoot;
diff --git a/sonar-core/src/main/java/org/sonar/core/component/SnapshotPerspectives.java b/sonar-core/src/main/java/org/sonar/core/component/SnapshotPerspectives.java
index 951f52fa279..03a1e2c30f7 100644
--- a/sonar-core/src/main/java/org/sonar/core/component/SnapshotPerspectives.java
+++ b/sonar-core/src/main/java/org/sonar/core/component/SnapshotPerspectives.java
@@ -21,7 +21,7 @@ package org.sonar.core.component;
import com.google.common.collect.Maps;
import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.component.Perspective;
import org.sonar.core.graph.graphson.GraphsonReader;
import org.sonar.core.graph.jdbc.GraphDao;
@@ -32,7 +32,8 @@ import javax.annotation.CheckForNull;
import java.io.StringReader;
import java.util.Map;
-public class SnapshotPerspectives implements ServerComponent {
+@ServerSide
+public class SnapshotPerspectives {
private final GraphDao dao;
private final Map<Class<?>, GraphPerspectiveLoader<?>> loaders = Maps.newHashMap();
diff --git a/sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/period/DefaultPeriodCleaner.java b/sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/period/DefaultPeriodCleaner.java
index 5b003323855..f89cfc80d79 100644
--- a/sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/period/DefaultPeriodCleaner.java
+++ b/sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/period/DefaultPeriodCleaner.java
@@ -21,9 +21,9 @@
package org.sonar.core.computation.dbcleaner.period;
import com.google.common.annotations.VisibleForTesting;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.config.Settings;
-import org.sonar.api.task.TaskExtension;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
@@ -35,7 +35,9 @@ import org.sonar.core.purge.PurgeableSnapshotDto;
import java.util.List;
-public class DefaultPeriodCleaner implements TaskExtension, ServerExtension {
+@BatchSide
+@ServerSide
+public class DefaultPeriodCleaner {
private static final Logger LOG = Loggers.get(DefaultPeriodCleaner.class);
private PurgeDao purgeDao;
diff --git a/sonar-core/src/main/java/org/sonar/core/config/Logback.java b/sonar-core/src/main/java/org/sonar/core/config/Logback.java
index ac9a7b4e00c..d3bc1e52e00 100644
--- a/sonar-core/src/main/java/org/sonar/core/config/Logback.java
+++ b/sonar-core/src/main/java/org/sonar/core/config/Logback.java
@@ -27,8 +27,8 @@ import ch.qos.logback.core.util.StatusPrinter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import java.io.File;
import java.io.FileInputStream;
@@ -41,7 +41,9 @@ import java.util.Map;
*
* @since 2.12
*/
-public class Logback implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class Logback {
public static void configure(String classloaderPath, Map<String, String> substitutionVariables) {
InputStream input = Logback.class.getResourceAsStream(classloaderPath);
diff --git a/sonar-core/src/main/java/org/sonar/core/dashboard/ActiveDashboardDao.java b/sonar-core/src/main/java/org/sonar/core/dashboard/ActiveDashboardDao.java
index de705d74eae..6e5de5d7539 100644
--- a/sonar-core/src/main/java/org/sonar/core/dashboard/ActiveDashboardDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/dashboard/ActiveDashboardDao.java
@@ -20,8 +20,8 @@
package org.sonar.core.dashboard;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DaoComponent;
import org.sonar.core.persistence.MyBatis;
@@ -29,7 +29,9 @@ import javax.annotation.Nullable;
import java.util.List;
-public class ActiveDashboardDao implements BatchComponent, ServerComponent, DaoComponent {
+@BatchSide
+@ServerSide
+public class ActiveDashboardDao implements DaoComponent {
private MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/dashboard/DashboardDao.java b/sonar-core/src/main/java/org/sonar/core/dashboard/DashboardDao.java
index 9051746fcf7..2726f42967c 100644
--- a/sonar-core/src/main/java/org/sonar/core/dashboard/DashboardDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/dashboard/DashboardDao.java
@@ -20,12 +20,14 @@
package org.sonar.core.dashboard;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DaoComponent;
import org.sonar.core.persistence.MyBatis;
-public class DashboardDao implements BatchComponent, ServerComponent, DaoComponent {
+@BatchSide
+@ServerSide
+public class DashboardDao implements DaoComponent {
private MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java
index 57887646ee6..1556d5dda50 100644
--- a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java
@@ -20,15 +20,17 @@
package org.sonar.core.duplication;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
import java.util.Collection;
import java.util.List;
-public class DuplicationDao implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class DuplicationDao {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java b/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
index 8190b0f6e3e..8fbddc73f12 100644
--- a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
+++ b/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
@@ -23,6 +23,8 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import org.apache.commons.io.IOUtils;
import org.picocontainer.Startable;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.i18n.I18n;
import org.sonar.api.utils.SonarException;
import org.sonar.api.utils.System2;
@@ -51,6 +53,8 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
+@BatchSide
+@ServerSide
public class DefaultI18n implements I18n, Startable {
private static final Logger LOG = Loggers.get(DefaultI18n.class);
@@ -120,7 +124,7 @@ public class DefaultI18n implements I18n, Startable {
@Override
public void stop() {
if (classloader instanceof Closeable) {
- IOUtils.closeQuietly((Closeable)classloader);
+ IOUtils.closeQuietly((Closeable) classloader);
}
classloader = null;
propertyToBundles = null;
diff --git a/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java b/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java
index e19a624429f..9a374593155 100644
--- a/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java
+++ b/sonar-core/src/main/java/org/sonar/core/i18n/RuleI18nManager.java
@@ -20,8 +20,8 @@
package org.sonar.core.i18n;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.i18n.RuleI18n;
import org.sonar.api.rules.Rule;
@@ -33,7 +33,9 @@ import java.util.Locale;
* @deprecated in 4.1. Rules are not localized anymore. See http://jira.codehaus.org/browse/SONAR-4885
*/
@Deprecated
-public class RuleI18nManager implements RuleI18n, ServerExtension, BatchExtension {
+@BatchSide
+@ServerSide
+public class RuleI18nManager implements RuleI18n {
private static final String NAME_SUFFIX = ".name";
private static final String RULE_PREFIX = "rule.";
@@ -80,7 +82,6 @@ public class RuleI18nManager implements RuleI18n, ServerExtension, BatchExtensio
return getParamDescription(repositoryKey, ruleKey, paramKey);
}
-
@Override
@CheckForNull
public String getName(String repositoryKey, String ruleKey) {
@@ -129,7 +130,6 @@ public class RuleI18nManager implements RuleI18n, ServerExtension, BatchExtensio
return defaultI18n.message(Locale.ENGLISH, propertyKey, null);
}
-
static boolean isRuleProperty(String propertyKey) {
return StringUtils.startsWith(propertyKey, RULE_PREFIX) && StringUtils.endsWith(propertyKey, NAME_SUFFIX) && !propertyKey.contains(".param.");
}
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/IssueFilterSerializer.java b/sonar-core/src/main/java/org/sonar/core/issue/IssueFilterSerializer.java
index 939acb22274..7e9a24aae50 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/IssueFilterSerializer.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/IssueFilterSerializer.java
@@ -23,7 +23,7 @@ package org.sonar.core.issue;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import java.util.Iterator;
import java.util.List;
@@ -32,7 +32,8 @@ import java.util.Map;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Maps.newHashMap;
-public class IssueFilterSerializer implements ServerComponent {
+@ServerSide
+public class IssueFilterSerializer {
public static final String SEPARATOR = "|";
public static final String KEY_VALUE_SEPARATOR = "=";
@@ -60,7 +61,7 @@ public class IssueFilterSerializer implements ServerComponent {
if (!valuesList.isEmpty()) {
stringBuilder.append(key);
stringBuilder.append(IssueFilterSerializer.KEY_VALUE_SEPARATOR);
- for (Iterator<Object> valueListIter = valuesList.iterator(); valueListIter.hasNext(); ) {
+ for (Iterator<Object> valueListIter = valuesList.iterator(); valueListIter.hasNext();) {
Object valueList = valueListIter.next();
stringBuilder.append(valueList);
if (valueListIter.hasNext()) {
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java b/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java
index 369abddfef5..d9e491540f5 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/IssueUpdater.java
@@ -27,8 +27,8 @@ import com.google.common.collect.Collections2;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.issue.ActionPlan;
import org.sonar.api.issue.internal.DefaultIssue;
import org.sonar.api.issue.internal.DefaultIssueComment;
@@ -47,7 +47,9 @@ import java.util.Set;
/**
* Updates issue fields and chooses if changes must be kept in history.
*/
-public class IssueUpdater implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class IssueUpdater {
public static final String UNUSED = "";
public static final String SEVERITY = "severity";
@@ -291,7 +293,7 @@ public class IssueUpdater implements BatchComponent, ServerComponent {
}));
Set<String> oldTags = Sets.newHashSet(issue.tags());
-
+
if (!oldTags.equals(newTags)) {
issue.setFieldChange(context, TAGS,
oldTags.isEmpty() ? null : CHANGELOG_TAG_JOINER.join(oldTags),
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDao.java
index 1d30a3e7926..6708103a780 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanDao.java
@@ -22,8 +22,8 @@ package org.sonar.core.issue.db;
import com.google.common.collect.Lists;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DaoComponent;
import org.sonar.core.persistence.MyBatis;
@@ -36,7 +36,9 @@ import static com.google.common.collect.Lists.newArrayList;
/**
* @since 3.6
*/
-public class ActionPlanDao implements BatchComponent, ServerComponent, DaoComponent {
+@BatchSide
+@ServerSide
+public class ActionPlanDao implements DaoComponent {
private final MyBatis mybatis;
@@ -95,7 +97,7 @@ public class ActionPlanDao implements BatchComponent, ServerComponent, DaoCompon
List<ActionPlanDto> dtos = session.getMapper(ActionPlanMapper.class).findByKeys(partition);
dtosList.addAll(dtos);
}
- return dtosList;
+ return dtosList;
} finally {
MyBatis.closeQuietly(session);
}
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanStatsDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanStatsDao.java
index f32d2fc9750..18faf0ef3b3 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanStatsDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/db/ActionPlanStatsDao.java
@@ -21,8 +21,8 @@
package org.sonar.core.issue.db;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.MyBatis;
import java.util.List;
@@ -30,7 +30,9 @@ import java.util.List;
/**
* @since 3.6
*/
-public class ActionPlanStatsDao implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class ActionPlanStatsDao {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueChangeDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueChangeDao.java
index a766d024592..77ae58983f9 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueChangeDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueChangeDao.java
@@ -22,8 +22,8 @@ package org.sonar.core.issue.db;
import com.google.common.collect.Lists;
import org.apache.ibatis.session.ResultHandler;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.issue.internal.DefaultIssueComment;
import org.sonar.api.issue.internal.FieldDiffs;
import org.sonar.core.persistence.DaoComponent;
@@ -44,7 +44,9 @@ import static com.google.common.collect.Maps.newHashMap;
/**
* @since 3.6
*/
-public class IssueChangeDao implements DaoComponent, BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class IssueChangeDao implements DaoComponent {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java
index 7305b319490..6854b62ddb1 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueDao.java
@@ -22,8 +22,8 @@ package org.sonar.core.issue.db;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
@@ -32,7 +32,9 @@ import javax.annotation.CheckForNull;
/**
* @since 3.6
*/
-public class IssueDao implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class IssueDao {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java
index 770c503de03..9a5d551f339 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java
@@ -21,8 +21,8 @@
package org.sonar.core.issue.db;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DaoComponent;
import org.sonar.core.persistence.MyBatis;
@@ -33,7 +33,9 @@ import java.util.List;
/**
* @since 3.7
*/
-public class IssueFilterDao implements BatchComponent, ServerComponent, DaoComponent {
+@BatchSide
+@ServerSide
+public class IssueFilterDao implements DaoComponent {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterFavouriteDao.java b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterFavouriteDao.java
index 7f3705ce567..2b97ce14595 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterFavouriteDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterFavouriteDao.java
@@ -21,8 +21,8 @@
package org.sonar.core.issue.db;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.MyBatis;
import java.util.List;
@@ -30,7 +30,9 @@ import java.util.List;
/**
* @since 3.7
*/
-public class IssueFilterFavouriteDao implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class IssueFilterFavouriteDao {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/workflow/FunctionExecutor.java b/sonar-core/src/main/java/org/sonar/core/issue/workflow/FunctionExecutor.java
index c530ede249a..ea91619ce32 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/workflow/FunctionExecutor.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/workflow/FunctionExecutor.java
@@ -19,8 +19,8 @@
*/
package org.sonar.core.issue.workflow;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.internal.DefaultIssue;
import org.sonar.api.issue.internal.IssueChangeContext;
@@ -29,7 +29,9 @@ import org.sonar.core.issue.IssueUpdater;
import javax.annotation.Nullable;
-public class FunctionExecutor implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class FunctionExecutor {
private final IssueUpdater updater;
diff --git a/sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java b/sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java
index 10924b43533..1fcc51fe2bd 100644
--- a/sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java
+++ b/sonar-core/src/main/java/org/sonar/core/issue/workflow/IssueWorkflow.java
@@ -20,8 +20,8 @@
package org.sonar.core.issue.workflow;
import org.picocontainer.Startable;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.issue.DefaultTransitions;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.condition.HasResolution;
@@ -32,7 +32,9 @@ import org.sonar.core.issue.IssueUpdater;
import java.util.List;
-public class IssueWorkflow implements BatchComponent, ServerComponent, Startable {
+@BatchSide
+@ServerSide
+public class IssueWorkflow implements Startable {
private final FunctionExecutor functionExecutor;
private final IssueUpdater updater;
@@ -89,7 +91,7 @@ public class IssueWorkflow implements BatchComponent, ServerComponent, Startable
.functions(new SetResolution(null), new SetCloseDate(false))
.build())
- // resolve as false-positive
+ // resolve as false-positive
.transition(Transition.builder(DefaultTransitions.FALSE_POSITIVE)
.from(Issue.STATUS_OPEN).to(Issue.STATUS_RESOLVED)
.functions(new SetResolution(Issue.RESOLUTION_FALSE_POSITIVE), SetAssignee.UNASSIGN)
@@ -118,10 +120,10 @@ public class IssueWorkflow implements BatchComponent, ServerComponent, Startable
.requiredProjectPermission(UserRole.ISSUE_ADMIN)
.build())
.transition(Transition.builder(DefaultTransitions.WONT_FIX)
- .from(Issue.STATUS_CONFIRMED).to(Issue.STATUS_RESOLVED)
- .functions(new SetResolution(Issue.RESOLUTION_WONT_FIX), SetAssignee.UNASSIGN)
- .requiredProjectPermission(UserRole.ISSUE_ADMIN)
- .build()
+ .from(Issue.STATUS_CONFIRMED).to(Issue.STATUS_RESOLVED)
+ .functions(new SetResolution(Issue.RESOLUTION_WONT_FIX), SetAssignee.UNASSIGN)
+ .requiredProjectPermission(UserRole.ISSUE_ADMIN)
+ .build()
);
}
@@ -159,14 +161,14 @@ public class IssueWorkflow implements BatchComponent, ServerComponent, Startable
.automatic()
.build())
- // Reopen issues that are marked as resolved but that are still alive.
- // Manual issues are kept resolved.
+ // Reopen issues that are marked as resolved but that are still alive.
+ // Manual issues are kept resolved.
.transition(Transition.builder("automaticreopen")
- .from(Issue.STATUS_RESOLVED).to(Issue.STATUS_REOPENED)
- .conditions(new IsEndOfLife(false), new HasResolution(Issue.RESOLUTION_FIXED), new IsManual(false))
- .functions(new SetResolution(null), new SetCloseDate(false))
- .automatic()
- .build()
+ .from(Issue.STATUS_RESOLVED).to(Issue.STATUS_REOPENED)
+ .conditions(new IsEndOfLife(false), new HasResolution(Issue.RESOLUTION_FIXED), new IsManual(false))
+ .functions(new SetResolution(null), new SetCloseDate(false))
+ .automatic()
+ .build()
);
}
diff --git a/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureFilterDao.java b/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureFilterDao.java
index 50a26d25477..d8af4832f7c 100644
--- a/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureFilterDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureFilterDao.java
@@ -20,14 +20,16 @@
package org.sonar.core.measure.db;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.MyBatis;
/**
* @since 3.4
*/
-public class MeasureFilterDao implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class MeasureFilterDao {
private MyBatis mybatis;
public MeasureFilterDao(MyBatis mybatis) {
diff --git a/sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java b/sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java
index 368367441df..e6776438549 100644
--- a/sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java
+++ b/sonar-core/src/main/java/org/sonar/core/notification/DefaultNotificationManager.java
@@ -27,6 +27,7 @@ import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.sonar.api.batch.RequiresDB;
import org.sonar.api.notifications.Notification;
import org.sonar.api.notifications.NotificationChannel;
import org.sonar.api.notifications.NotificationDispatcher;
@@ -46,6 +47,7 @@ import java.util.List;
/**
* @since 2.10
*/
+@RequiresDB
public class DefaultNotificationManager implements NotificationManager {
private static final Logger LOG = LoggerFactory.getLogger(DefaultNotificationManager.class);
diff --git a/sonar-core/src/main/java/org/sonar/core/notification/db/NotificationQueueDao.java b/sonar-core/src/main/java/org/sonar/core/notification/db/NotificationQueueDao.java
index 98f2f78b47b..cfb0b0be132 100644
--- a/sonar-core/src/main/java/org/sonar/core/notification/db/NotificationQueueDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/notification/db/NotificationQueueDao.java
@@ -21,8 +21,8 @@
package org.sonar.core.notification.db;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
@@ -32,7 +32,9 @@ import java.util.List;
/**
* @since 3.7.1
*/
-public class NotificationQueueDao implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class NotificationQueueDao {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/permission/PermissionDao.java b/sonar-core/src/main/java/org/sonar/core/permission/PermissionDao.java
index b3071be9403..7899d000524 100644
--- a/sonar-core/src/main/java/org/sonar/core/permission/PermissionDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/permission/PermissionDao.java
@@ -23,17 +23,19 @@ package org.sonar.core.permission;
import com.google.common.annotations.VisibleForTesting;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.security.DefaultGroups;
import org.sonar.core.persistence.MyBatis;
import javax.annotation.Nullable;
+
import java.util.List;
import java.util.Map;
import static com.google.common.collect.Maps.newHashMap;
-public class PermissionDao implements ServerComponent {
+@ServerSide
+public class PermissionDao {
private static final String QUERY_PARAMETER = "query";
private static final String COMPONENT_ID_PARAMETER = "componentId";
diff --git a/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java b/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
index 7fb5c14598d..0d8399f6cfd 100644
--- a/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
+++ b/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
@@ -22,14 +22,18 @@ package org.sonar.core.permission;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.config.Settings;
import org.sonar.api.security.DefaultGroups;
-import org.sonar.api.task.TaskComponent;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.resource.ResourceDao;
import org.sonar.core.resource.ResourceDto;
-import org.sonar.core.user.*;
+import org.sonar.core.user.GroupDto;
+import org.sonar.core.user.GroupRoleDto;
+import org.sonar.core.user.RoleDao;
+import org.sonar.core.user.UserDao;
+import org.sonar.core.user.UserRoleDto;
import javax.annotation.Nullable;
@@ -45,7 +49,9 @@ import java.util.List;
*
* WARNING, this class is called by Views to apply default permission template on new views
*/
-public class PermissionFacade implements TaskComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class PermissionFacade {
private final RoleDao roleDao;
private final UserDao userDao;
diff --git a/sonar-core/src/main/java/org/sonar/core/permission/PermissionTemplateDao.java b/sonar-core/src/main/java/org/sonar/core/permission/PermissionTemplateDao.java
index 34165a634ca..adbc3ae2528 100644
--- a/sonar-core/src/main/java/org/sonar/core/permission/PermissionTemplateDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/permission/PermissionTemplateDao.java
@@ -24,9 +24,9 @@ import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.security.DefaultGroups;
-import org.sonar.api.task.TaskComponent;
import org.sonar.api.utils.System2;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
@@ -41,7 +41,9 @@ import java.util.Map;
import static com.google.common.collect.Maps.newHashMap;
-public class PermissionTemplateDao implements TaskComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class PermissionTemplateDao {
public static final String QUERY_PARAMETER = "query";
public static final String TEMPLATE_ID_PARAMETER = "templateId";
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
index 440c39d1052..334245aa769 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
@@ -22,8 +22,8 @@ package org.sonar.core.persistence;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import java.util.Collections;
import java.util.List;
@@ -31,7 +31,9 @@ import java.util.List;
/**
* @since 3.0
*/
-public class DatabaseVersion implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class DatabaseVersion {
public static final int LAST_VERSION = 914;
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java
index f231431ce7f..35d49d5a0d4 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java
@@ -35,8 +35,8 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import org.apache.ibatis.type.JdbcType;
import org.slf4j.LoggerFactory;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.database.model.MeasureModel;
import org.sonar.core.activity.db.ActivityDto;
import org.sonar.core.activity.db.ActivityMapper;
@@ -145,7 +145,9 @@ import ch.qos.logback.classic.Level;
import com.google.common.io.Closeables;
-public class MyBatis implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class MyBatis {
private final Database database;
private final Logback logback;
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java b/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java
index 3c05901b9aa..8bd7e50166b 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/SemaphoreUpdater.java
@@ -22,8 +22,8 @@ package org.sonar.core.persistence;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.ServerComponent;
-import org.sonar.api.task.TaskComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.Semaphores;
import java.util.Map;
@@ -34,7 +34,9 @@ import java.util.concurrent.TimeUnit;
/**
* @since 3.5
*/
-public class SemaphoreUpdater implements TaskComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class SemaphoreUpdater {
private static final Logger LOG = LoggerFactory.getLogger(SemaphoreUpdater.class);
diff --git a/sonar-core/src/main/java/org/sonar/core/platform/ComponentContainer.java b/sonar-core/src/main/java/org/sonar/core/platform/ComponentContainer.java
index 868208b12a0..49dc10b3687 100644
--- a/sonar-core/src/main/java/org/sonar/core/platform/ComponentContainer.java
+++ b/sonar-core/src/main/java/org/sonar/core/platform/ComponentContainer.java
@@ -27,8 +27,8 @@ import org.picocontainer.MutablePicoContainer;
import org.picocontainer.behaviors.OptInCaching;
import org.picocontainer.lifecycle.ReflectionLifecycleStrategy;
import org.picocontainer.monitors.NullComponentMonitor;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.config.PropertyDefinitions;
import javax.annotation.Nullable;
@@ -36,7 +36,9 @@ import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
-public class ComponentContainer implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class ComponentContainer {
// no need for multiple children
ComponentContainer parent, child;
diff --git a/sonar-core/src/main/java/org/sonar/core/platform/PluginRepository.java b/sonar-core/src/main/java/org/sonar/core/platform/PluginRepository.java
index 1b3b170a938..eec28b6b532 100644
--- a/sonar-core/src/main/java/org/sonar/core/platform/PluginRepository.java
+++ b/sonar-core/src/main/java/org/sonar/core/platform/PluginRepository.java
@@ -19,16 +19,18 @@
*/
package org.sonar.core.platform;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.Plugin;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import java.util.Collection;
/**
* Provides information about the plugins installed in the dependency injection container
*/
-public interface PluginRepository extends BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public interface PluginRepository {
Collection<PluginInfo> getPluginInfos();
diff --git a/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java b/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java
index e32589f1b0c..b45253b0aeb 100644
--- a/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java
@@ -25,8 +25,8 @@ import com.google.common.base.Strings;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.resources.Scopes;
import org.sonar.core.persistence.DaoComponent;
import org.sonar.core.persistence.DaoUtils;
@@ -43,7 +43,9 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
-public class PropertiesDao implements BatchComponent, ServerComponent, DaoComponent {
+@BatchSide
+@ServerSide
+public class PropertiesDao implements DaoComponent {
private static final String NOTIFICATION_PREFIX = "notification.";
private MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java
index d65e7af2f6f..589d2765255 100644
--- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/ActiveRuleDao.java
@@ -21,7 +21,7 @@
package org.sonar.core.qualityprofile.db;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
@@ -31,7 +31,8 @@ import java.util.List;
* @deprecated use the ActiveRuleDao class defined in sonar-server
*/
@Deprecated
-public class ActiveRuleDao implements ServerComponent {
+@ServerSide
+public class ActiveRuleDao {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
index 19af5b22d78..198ff265d61 100644
--- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
@@ -23,7 +23,7 @@ package org.sonar.core.qualityprofile.db;
import com.google.common.base.Preconditions;
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.utils.System2;
import org.sonar.core.component.ComponentDto;
import org.sonar.core.persistence.DaoComponent;
@@ -37,7 +37,8 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
-public class QualityProfileDao implements ServerComponent, DaoComponent {
+@ServerSide
+public class QualityProfileDao implements DaoComponent {
private final MyBatis mybatis;
private final System2 system;
diff --git a/sonar-core/src/main/java/org/sonar/core/rule/RuleDao.java b/sonar-core/src/main/java/org/sonar/core/rule/RuleDao.java
index dcc8cba0a11..f813aa905f8 100644
--- a/sonar-core/src/main/java/org/sonar/core/rule/RuleDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/rule/RuleDao.java
@@ -20,8 +20,8 @@
package org.sonar.core.rule;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.MyBatis;
import java.util.List;
@@ -30,7 +30,9 @@ import java.util.List;
* @deprecated in 4.4 moved to org.sonar.server.rule.db.RuleDao.
*/
@Deprecated
-public class RuleDao implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class RuleDao {
private MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java
index 25d826376f4..a7016a55947 100644
--- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java
+++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DefaultTechnicalDebtModel.java
@@ -22,6 +22,7 @@ package org.sonar.core.technicaldebt;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
+import org.sonar.api.batch.RequiresDB;
import org.sonar.api.batch.debt.DebtCharacteristic;
import org.sonar.api.batch.debt.DebtModel;
import org.sonar.api.batch.debt.internal.DefaultDebtCharacteristic;
@@ -38,6 +39,7 @@ import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
+@RequiresDB
public class DefaultTechnicalDebtModel implements TechnicalDebtModel {
private final DebtModel model;
diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java
index 2eb94c33bd1..1141bf3d040 100644
--- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/db/CharacteristicDao.java
@@ -22,18 +22,21 @@ package org.sonar.core.technicaldebt.db;
import com.google.common.collect.Lists;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DaoComponent;
-import org.sonar.api.ServerComponent;
import org.sonar.core.persistence.MyBatis;
import javax.annotation.CheckForNull;
+
import java.util.Collection;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
-public class CharacteristicDao implements BatchComponent, ServerComponent, DaoComponent {
+@BatchSide
+@ServerSide
+public class CharacteristicDao implements DaoComponent {
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/template/LoadedTemplateDao.java b/sonar-core/src/main/java/org/sonar/core/template/LoadedTemplateDao.java
index d786ef60b04..83ff2f18cb5 100644
--- a/sonar-core/src/main/java/org/sonar/core/template/LoadedTemplateDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/template/LoadedTemplateDao.java
@@ -20,13 +20,15 @@
package org.sonar.core.template;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DaoComponent;
-import org.sonar.api.ServerComponent;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
-public class LoadedTemplateDao implements DaoComponent, BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class LoadedTemplateDao implements DaoComponent {
private MyBatis mybatis;
@@ -47,7 +49,6 @@ public class LoadedTemplateDao implements DaoComponent, BatchComponent, ServerCo
return session.getMapper(LoadedTemplateMapper.class).countByTypeAndKey(type, key);
}
-
public void insert(LoadedTemplateDto loadedTemplateDto) {
SqlSession session = mybatis.openSession(false);
try {
diff --git a/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java b/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java
index 713cb620ace..6a9df77dffe 100644
--- a/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java
+++ b/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java
@@ -20,9 +20,9 @@
package org.sonar.core.timemachine;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.batch.RequiresDB;
import org.sonar.api.config.Settings;
import org.sonar.api.database.model.Snapshot;
@@ -30,6 +30,7 @@ import org.sonar.api.i18n.I18n;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -38,7 +39,9 @@ import java.util.Locale;
import static org.sonar.api.utils.DateUtils.longToDate;
@RequiresDB
-public class Periods implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class Periods {
private final Settings settings;
private final I18n i18n;
diff --git a/sonar-core/src/main/java/org/sonar/core/user/AuthorDao.java b/sonar-core/src/main/java/org/sonar/core/user/AuthorDao.java
index 7b8d140d282..6bc659a0a61 100644
--- a/sonar-core/src/main/java/org/sonar/core/user/AuthorDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/user/AuthorDao.java
@@ -22,8 +22,8 @@ package org.sonar.core.user;
import com.google.common.base.Function;
import com.google.common.base.Strings;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.core.component.ComponentDto;
import org.sonar.core.persistence.DaoComponent;
import org.sonar.core.persistence.DaoUtils;
@@ -40,7 +40,9 @@ import java.util.List;
*
* Be careful when updating this class because it's used by the Dev Cockpit plugin.
*/
-public class AuthorDao implements BatchComponent, ServerComponent, DaoComponent {
+@BatchSide
+@ServerSide
+public class AuthorDao implements DaoComponent {
private final MyBatis mybatis;
private final ResourceDao resourceDao;
diff --git a/sonar-core/src/main/java/org/sonar/core/user/AuthorizationDao.java b/sonar-core/src/main/java/org/sonar/core/user/AuthorizationDao.java
index e12b3b27d02..6c43e1280a4 100644
--- a/sonar-core/src/main/java/org/sonar/core/user/AuthorizationDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/user/AuthorizationDao.java
@@ -22,7 +22,7 @@ package org.sonar.core.user;
import com.google.common.base.Function;
import com.google.common.collect.Sets;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.core.persistence.DaoComponent;
import org.sonar.core.persistence.DaoUtils;
import org.sonar.core.persistence.DbSession;
@@ -37,7 +37,8 @@ import java.util.Map;
import static com.google.common.collect.Maps.newHashMap;
-public class AuthorizationDao implements ServerComponent, DaoComponent {
+@ServerSide
+public class AuthorizationDao implements DaoComponent {
private static final String USER_ID_PARAM = "userId";
private final MyBatis mybatis;
diff --git a/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java b/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
index c1eadd17538..ba18cd5cd22 100644
--- a/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
@@ -21,16 +21,18 @@
package org.sonar.core.user;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.security.DefaultGroups;
-import org.sonar.api.task.TaskComponent;
import org.sonar.core.persistence.DbSession;
import javax.annotation.Nullable;
import java.util.List;
-public class RoleDao implements TaskComponent, ServerComponent {
+@ServerSide
+@BatchSide
+public class RoleDao {
public List<String> selectUserPermissions(DbSession session, String userLogin, @Nullable Long resourceId) {
return session.getMapper(RoleMapper.class).selectUserPermissions(userLogin, resourceId);
diff --git a/sonar-core/src/main/java/org/sonar/core/user/UserDao.java b/sonar-core/src/main/java/org/sonar/core/user/UserDao.java
index 97f7e6a26cd..73f1daac623 100644
--- a/sonar-core/src/main/java/org/sonar/core/user/UserDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/user/UserDao.java
@@ -21,8 +21,8 @@ package org.sonar.core.user;
import com.google.common.collect.Lists;
import org.apache.ibatis.session.SqlSession;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.user.UserQuery;
import org.sonar.api.utils.System2;
import org.sonar.core.persistence.DaoComponent;
@@ -36,7 +36,9 @@ import java.util.List;
/**
* @since 3.2
*/
-public class UserDao implements BatchComponent, ServerComponent, DaoComponent {
+@BatchSide
+@ServerSide
+public class UserDao implements DaoComponent {
private final MyBatis mybatis;
private final System2 system2;
diff --git a/sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java b/sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java
index efe1fe5a141..181e9b6e190 100644
--- a/sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java
+++ b/sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java
@@ -19,15 +19,17 @@
*/
package org.sonar.plugins.dbcleaner.api;
-import org.sonar.api.ServerExtension;
-import org.sonar.api.task.TaskExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
/**
* @since 2.14
* @deprecated (is used by the plugin views only. Will rely on the implementation when views analysis views moved on the server side)
*/
@Deprecated
-public interface PurgeTask extends TaskExtension, ServerExtension {
+@BatchSide
+@ServerSide
+public interface PurgeTask {
/**
* Purges the data related to a tree of resources.
* <p/>
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceCreationLock.java b/sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceCreationLock.java
index 34d3ffc1b34..1b485ddd96d 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceCreationLock.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceCreationLock.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
/**
* This lock is used to ensure that Sonar resources (files, packages, directories) are not created by buggy plugins
@@ -29,12 +29,13 @@ import org.sonar.api.BatchComponent;
* @deprecated since 4.2. File system is immutable and does not require this class anymore.
*/
@Deprecated
-public interface ResourceCreationLock extends BatchComponent {
+@BatchSide
+public interface ResourceCreationLock {
/**
* Forbids the creation of resources when saving violations and measures. By default it's unlocked, so only warnings
* are logged. When locked, then an exception is thrown.
*/
void lock();
-
+
}
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceFilter.java b/sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceFilter.java
index bf5e90207d0..23ab301d309 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceFilter.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/batch/ResourceFilter.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.resources.Resource;
/**
@@ -32,11 +33,13 @@ import org.sonar.api.resources.Resource;
* @deprecated since 4.2. Analysis is file-system oriented. See {@link org.sonar.api.scan.filesystem.InputFileFilter}
*/
@Deprecated
-public interface ResourceFilter extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface ResourceFilter {
/**
* Return true if the resource must be ignored, else it's saved into database.
*/
boolean isIgnored(Resource resource);
-
+
}
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/charts/Chart.java b/sonar-deprecated/src/main/java/org/sonar/api/charts/Chart.java
index f9404bd835d..fedd88138ce 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/charts/Chart.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/charts/Chart.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.charts;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ServerSide;
import java.awt.image.BufferedImage;
@@ -30,7 +30,8 @@ import java.awt.image.BufferedImage;
* @deprecated in 4.5.1, replaced by Javascript charts
*/
@Deprecated
-public interface Chart extends ServerExtension {
+@ServerSide
+public interface Chart {
String getKey();
/**
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java
index 6a458a3ba72..328b522e7a9 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/AnnotationRuleParser.java
@@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.PropertyType;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.AnnotationUtils;
import org.sonar.api.utils.FieldUtils2;
import org.sonar.api.utils.SonarException;
@@ -42,7 +42,8 @@ import java.util.List;
* @deprecated in 4.2. Replaced by {@link org.sonar.api.server.rule.RulesDefinitionAnnotationLoader}
*/
@Deprecated
-public final class AnnotationRuleParser implements ServerComponent {
+@ServerSide
+public final class AnnotationRuleParser {
private static final Logger LOG = Loggers.get(AnnotationRuleParser.class);
@@ -101,15 +102,15 @@ public final class AnnotationRuleParser implements ServerComponent {
}
private static final Function<Class<?>, PropertyType> TYPE_FOR_CLASS = Functions.forMap(
- ImmutableMap.<Class<?>, PropertyType> builder()
- .put(Integer.class, PropertyType.INTEGER)
- .put(int.class, PropertyType.INTEGER)
- .put(Float.class, PropertyType.FLOAT)
- .put(float.class, PropertyType.FLOAT)
- .put(Boolean.class, PropertyType.BOOLEAN)
- .put(boolean.class, PropertyType.BOOLEAN)
- .build(),
- PropertyType.STRING);
+ ImmutableMap.<Class<?>, PropertyType>builder()
+ .put(Integer.class, PropertyType.INTEGER)
+ .put(int.class, PropertyType.INTEGER)
+ .put(Float.class, PropertyType.FLOAT)
+ .put(float.class, PropertyType.FLOAT)
+ .put(Boolean.class, PropertyType.BOOLEAN)
+ .put(boolean.class, PropertyType.BOOLEAN)
+ .build(),
+ PropertyType.STRING);
@VisibleForTesting
static PropertyType guessType(Class<?> type) {
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/rules/RuleRepository.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/RuleRepository.java
index 0275e58736a..e7725ff73d1 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/rules/RuleRepository.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/RuleRepository.java
@@ -22,7 +22,8 @@ package org.sonar.api.rules;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import java.util.List;
@@ -31,7 +32,9 @@ import java.util.List;
* @deprecated in 4.2. Replaced by org.sonar.api.server.rule.RulesDefinition
*/
@Deprecated
-public abstract class RuleRepository implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class RuleRepository {
private String key;
private String language;
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/rules/XMLRuleParser.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/XMLRuleParser.java
index 479d2a93402..ed1752d49c5 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/rules/XMLRuleParser.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/XMLRuleParser.java
@@ -31,14 +31,18 @@ import org.codehaus.staxmate.SMInputFactory;
import org.codehaus.staxmate.in.SMHierarchicCursor;
import org.codehaus.staxmate.in.SMInputCursor;
import org.sonar.api.PropertyType;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.SonarException;
import org.sonar.check.Cardinality;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -48,7 +52,8 @@ import java.util.Map;
* @deprecated in 4.2. Replaced by org.sonar.api.server.rule.RulesDefinition and org.sonar.api.server.rule.RulesDefinitionXmlLoader
*/
@Deprecated
-public final class XMLRuleParser implements ServerComponent {
+@ServerSide
+public final class XMLRuleParser {
private static final Map<String, String> TYPE_MAP = typeMapWithDeprecatedValues();
public List<Rule> parse(File file) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java
index 21c785caa1e..f6585e9ce4c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/BatchComponent.java
@@ -36,6 +36,9 @@ package org.sonar.api;
* </pre>
*
* @since 2.2
+ * @deprecated since 5.2 use {@link BatchSide} annotation
*/
+@Deprecated
+@BatchSide
public interface BatchComponent {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java b/sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java
index 95cc1c0f8f7..e24322a2609 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/BatchExtension.java
@@ -24,7 +24,9 @@ package org.sonar.api;
* by plugins.
*
* @since 1.10
+ * @deprecated since 5.2 replaced by {@link BatchSide} and {@link ExtensionPoint} annotations
*/
+@Deprecated
public interface BatchExtension extends Extension, BatchComponent {
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorMatcher.java b/sonar-plugin-api/src/main/java/org/sonar/api/BatchSide.java
index c098deb5f0f..323e44d175c 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/SensorMatcher.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/BatchSide.java
@@ -17,29 +17,34 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.batch.phases;
+package org.sonar.api;
-import org.apache.commons.lang.ClassUtils;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.batch.InstantiationStrategy;
-import org.sonar.api.batch.Sensor;
-import org.sonar.batch.bootstrap.ExtensionMatcher;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
- * Allow to filter sensors that will be executed.
- * Used by views !!
- * @since 3.6
+ * Marker annotation for all the components available in container of batch (code analyzer). Note that
+ * injection of dependencies by constructor is used :
+ * <pre>
+ * {@literal @}BatchSide
+ * public class Foo {
*
+ * }
+ * {@literal @}BatchSide
+ * public class Bar {
+ * private final Foo foo;
+ * public Bar(Foo f) {
+ * this.foo = f;
+ * }
+ * }
+ *
+ * </pre>
+ *
+ * @since 5.2
*/
-@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public abstract class SensorMatcher implements BatchExtension, ExtensionMatcher {
-
- @Override
- public final boolean accept(Object extension) {
- return (ClassUtils.isAssignable(extension.getClass(), Sensor.class) && acceptSensor((Sensor) extension))
- || ClassUtils.isAssignable(extension.getClass(), org.sonar.api.batch.sensor.Sensor.class);
- }
-
- public abstract boolean acceptSensor(Sensor sensor);
-
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface BatchSide {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/Extension.java b/sonar-plugin-api/src/main/java/org/sonar/api/Extension.java
index 1c5c8a52c07..f5cbf9e4161 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/Extension.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/Extension.java
@@ -23,6 +23,9 @@ package org.sonar.api;
* Plugin extension point
*
* @since 1.10
+ * @deprecated since 5.2 replaced by {@link ExtensionPoint} annotation
*/
+@Deprecated
+@ExtensionPoint
public interface Extension {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java b/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java
new file mode 100644
index 00000000000..6ccf977aa86
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java
@@ -0,0 +1,36 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marker annotation for all the interfaces that are extension point (ie can be implemented by plugins
+ * and will be called at some point of time by the platform).
+ *
+ * @since 5.2
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface ExtensionPoint {
+}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java
index 281c3058a7a..2ace0f246d5 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/ServerComponent.java
@@ -23,6 +23,9 @@ package org.sonar.api;
* Same than {@link org.sonar.api.BatchComponent} but for server-side components.
*
* @since 2.2
+ * @deprecated since 5.2 use {@link ServerSide} annotation
*/
+@Deprecated
+@ServerSide
public interface ServerComponent {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java b/sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java
index 52a0051230c..49fcabf3f3b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/ServerExtension.java
@@ -23,6 +23,8 @@ package org.sonar.api;
* Server extension point.
*
* @since 1.10
+ * @deprecated since 5.2 replaced by {@link ServerSide} and {@link ExtensionPoint} annotations
*/
+@Deprecated
public interface ServerExtension extends Extension, ServerComponent {
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/DefaultSensorMatcher.java b/sonar-plugin-api/src/main/java/org/sonar/api/ServerSide.java
index 46cffb93ff7..6beb3b0951b 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/DefaultSensorMatcher.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/ServerSide.java
@@ -17,21 +17,19 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.batch.scan;
+package org.sonar.api;
-import org.sonar.api.batch.Sensor;
-import org.sonar.batch.phases.SensorMatcher;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
- * By default all sensors are executed
- * @since 3.6
+ * Same than {@link org.sonar.api.BatchSide} but for server-side components.
*
+ * @since 5.2
*/
-public class DefaultSensorMatcher extends SensorMatcher {
-
- @Override
- public boolean acceptSensor(Sensor sensor) {
- return true;
- }
-
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface ServerSide {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java
index 300215a1591..df652a6a6eb 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java
@@ -19,13 +19,14 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
/**
* Use this component to find the current running mode.
* @since 5.1
*/
-public interface AnalysisMode extends BatchComponent {
+@BatchSide
+public interface AnalysisMode {
boolean isPreview();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java
index 779f79c4630..f755e50cb6f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/CoverageExtension.java
@@ -19,13 +19,16 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
/**
* @since 2.6
* @deprecated since 5.2 not used anymore
*/
@Deprecated
-public interface CoverageExtension extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface CoverageExtension {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java
index 71c48c45a04..ab7d930b5b4 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/CpdMapping.java
@@ -20,7 +20,8 @@
package org.sonar.api.batch;
import net.sourceforge.pmd.cpd.Tokenizer;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.resources.Language;
import org.sonar.api.resources.Resource;
@@ -31,7 +32,9 @@ import java.util.List;
* Implement this extension to get Copy/Paste detection for your language.
* @since 1.10
*/
-public interface CpdMapping extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface CpdMapping {
Tokenizer getTokenizer();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java
index b3f2792b507..70d018299bb 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Decorator.java
@@ -19,13 +19,16 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.resources.Resource;
/**
* @since 1.10
*/
-public interface Decorator extends BatchExtension, CheckProject {
+@BatchSide
+@ExtensionPoint
+public interface Decorator extends CheckProject {
/**
* @param resource resource that is currently decorated, equivalent of <code>context.getResource()</code>
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java
index a530f6cc954..0758dcd9b23 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.resources.Project;
/**
@@ -34,7 +35,9 @@ import org.sonar.api.resources.Project;
*
* @since 2.6
*/
-public abstract class Initializer implements BatchExtension, CheckProject {
+@BatchSide
+@ExtensionPoint
+public abstract class Initializer implements CheckProject {
@Override
public boolean shouldExecuteOnProject(Project project) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java
index 5cfea413fc5..46b2e7abd26 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/InstantiationStrategy.java
@@ -25,7 +25,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Define instantiation strategy of batch extensions. If an extension is not annotated, then default value
+ * Define instantiation strategy of batch IoC components. If a component is not annotated, then default value
* is {@link org.sonar.api.batch.InstantiationStrategy#PER_PROJECT}.
* @since 4.4
*/
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java
index a01a83178e0..7279bea5301 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/PostJob.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.resources.Project;
/**
@@ -30,7 +31,9 @@ import org.sonar.api.resources.Project;
*
* @since 1.10
*/
-public interface PostJob extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface PostJob {
void executeOn(Project project, SensorContext context);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java
index 98502636ad2..f97e5df5e31 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/ProjectClasspath.java
@@ -21,7 +21,7 @@ package org.sonar.api.batch;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.project.MavenProject;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.utils.SonarException;
import java.io.File;
@@ -36,7 +36,8 @@ import java.util.List;
* @deprecated since 4.5 this is some Java specific stuff that should by handled by SQ Java plugin
*/
@Deprecated
-public class ProjectClasspath implements BatchComponent {
+@BatchSide
+public class ProjectClasspath {
protected MavenProject pom;
private List<File> elements;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java
index fc055e6da5c..7bc1dd1197c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Sensor.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.resources.Project;
/**
@@ -41,7 +42,9 @@ import org.sonar.api.resources.Project;
*
* @since 1.10
*/
-public interface Sensor extends BatchExtension, CheckProject {
+@BatchSide
+@ExtensionPoint
+public interface Sensor extends CheckProject {
/**
* Sensors that depend upon Squid must declare the following method :
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java
index 4322439a220..0356a3bb1a3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/SupportedEnvironment.java
@@ -25,15 +25,15 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * This annotation allows to specify in which environments {@link org.sonar.api.BatchExtension} would be active.
+ * This annotation allows to specify in which environments {@link org.sonar.api.BatchSide} components would be active.
* For example: "maven", "ant".
* Usage of this annotation is discouraged and we strictly recommend you to not overuse it.
- * Most preferable is to design extensions to work in all environments.
+ * Most preferable is to design components to work in all environments.
*
* @since 2.6
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE })
+@Target({ElementType.TYPE})
public @interface SupportedEnvironment {
String[] value();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java
index 81ffb504294..ed61ad1faec 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachine.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.measures.Measure;
import java.util.List;
@@ -32,7 +32,8 @@ import java.util.List;
*/
@Deprecated
@RequiresDB
-public interface TimeMachine extends BatchComponent {
+@BatchSide
+public interface TimeMachine {
/**
* Past measures, sorted by date. Returns all fields.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java
index 7ddcd960049..307c6960879 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.batch.bootstrap;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.batch.InstantiationStrategy;
/**
@@ -34,8 +35,10 @@ import org.sonar.api.batch.InstantiationStrategy;
*
* @since 2.9
*/
+@BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public abstract class ProjectBuilder implements BatchExtension {
+@ExtensionPoint
+public abstract class ProjectBuilder {
/**
* Plugins can use the implementation {@link org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext}
@@ -44,6 +47,7 @@ public abstract class ProjectBuilder implements BatchExtension {
public interface Context {
ProjectReactor projectReactor();
}
+
/**
* Don't inject ProjectReactor as it may not be available
* @deprecated since 3.7 use {@link #ProjectBuilder()}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java
index a272c2f1cb9..2d58e233af1 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectReactor.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch.bootstrap;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import java.util.ArrayList;
import java.util.List;
@@ -27,7 +27,8 @@ import java.util.List;
/**
* @since 2.9
*/
-public class ProjectReactor implements BatchComponent {
+@BatchSide
+public class ProjectReactor {
private ProjectDefinition root;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java
index 4be4aa1389c..412593db9ad 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/EventHandler.java
@@ -19,14 +19,17 @@
*/
package org.sonar.api.batch.events;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
/**
- * Marker interface for event handlers.
+ * Common interface for event handlers.
* This interface is not intended to be implemented by clients.
*
* @since 2.8
*/
-public interface EventHandler extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface EventHandler {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java
index 64b80ea8b3c..0ce72b884fd 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/FileSystem.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch.fs;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import javax.annotation.CheckForNull;
@@ -53,7 +53,8 @@ import java.util.SortedSet;
*
* @since 4.2
*/
-public interface FileSystem extends BatchComponent {
+@BatchSide
+public interface FileSystem {
/**
* Absolute base directory of module
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java
index 91836823e43..7033aacbb75 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java
@@ -19,13 +19,16 @@
*/
package org.sonar.api.batch.fs;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
/**
* Extension point to exclude some files from inspection
* @since 4.2
*/
-public interface InputFileFilter extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface InputFileFilter {
boolean accept(InputFile f);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java
index fa894077be4..0862cfca9e8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/FileMetadata.java
@@ -19,13 +19,14 @@
*/
package org.sonar.api.batch.fs.internal;
+import org.sonar.api.BatchSide;
+
import com.google.common.base.Charsets;
import com.google.common.primitives.Ints;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.ByteOrderMark;
import org.apache.commons.io.input.BOMInputStream;
-import org.sonar.api.BatchComponent;
import org.sonar.api.CoreProperties;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
@@ -33,7 +34,12 @@ import org.sonar.api.utils.log.Loggers;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.util.ArrayList;
@@ -43,7 +49,8 @@ import java.util.List;
* Computes hash of files. Ends of Lines are ignored, so files with
* same content but different EOL encoding have the same hash.
*/
-public class FileMetadata implements BatchComponent {
+@BatchSide
+public class FileMetadata {
private static final Logger LOG = Loggers.get(FileMetadata.class);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java
index 4f91ea5aae4..4bb74ed232d 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch.measure;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import javax.annotation.CheckForNull;
@@ -29,7 +29,8 @@ import java.util.List;
/**
* @since 4.5
*/
-public interface MetricFinder extends BatchComponent {
+@BatchSide
+public interface MetricFinder {
@CheckForNull
Metric findByKey(String key);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java
index 06ac3e3533c..2e37e179404 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJob.java
@@ -20,7 +20,8 @@
package org.sonar.api.batch.postjob;
import com.google.common.annotations.Beta;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
/**
* PostJobs are executed at the very end of batch analysis. A PostJob can't do any modification
@@ -31,7 +32,9 @@ import org.sonar.api.BatchExtension;
* @since 5.2
*/
@Beta
-public interface PostJob extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface PostJob {
/**
* Populate {@link PostJobDescriptor} of this PostJob.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java
index e717c35d83a..45e069cf955 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRules.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch.rule;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.rule.RuleKey;
import javax.annotation.CheckForNull;
@@ -35,7 +35,8 @@ import java.util.Collection;
*
* @since 4.2
*/
-public interface ActiveRules extends BatchComponent {
+@BatchSide
+public interface ActiveRules {
/**
* Find a {@link ActiveRule} by the associated rule key. <code>null</code>
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java
index d479d24806b..93fca999844 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch.rule;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
/**
* Creates {@link org.sonar.api.batch.rule.Checks}. This class is available
@@ -27,7 +27,8 @@ import org.sonar.api.BatchComponent;
*
* @since 4.2
*/
-public class CheckFactory implements BatchComponent {
+@BatchSide
+public class CheckFactory {
private final ActiveRules activeRules;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java
index 7690bd56c94..47bcec5bc45 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/Rules.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch.rule;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.rule.RuleKey;
import javax.annotation.CheckForNull;
@@ -32,7 +32,8 @@ import java.util.Collection;
*
* @since 4.2
*/
-public interface Rules extends BatchComponent {
+@BatchSide
+public interface Rules {
/**
* Get a rule by its key. Returns <code>null</code> if rule does not exist.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java
index b6e16d48bc7..063e4ac0f37 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/BlameCommand.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch.scm;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
@@ -31,7 +31,8 @@ import java.util.List;
* @since 5.0
*/
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public abstract class BlameCommand implements BatchComponent {
+@BatchSide
+public abstract class BlameCommand {
/**
* Compute blame of the provided files.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java
index c3f86878293..a00a8d54bd7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/scm/ScmProvider.java
@@ -19,8 +19,9 @@
*/
package org.sonar.api.batch.scm;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.batch.InstantiationStrategy;
import java.io.File;
@@ -29,8 +30,10 @@ import java.io.File;
* See {@link CoreProperties#LINKS_SOURCES_DEV} to get old Maven URL format.
* @since 5.0
*/
+@BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public abstract class ScmProvider implements BatchExtension {
+@ExtensionPoint
+public abstract class ScmProvider {
/**
* Unique identifier of the provider. Can be passed to {@link CoreProperties#SCM_PROVIDER_KEY}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java
index fe2d78b5cad..35bda609ea9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/Sensor.java
@@ -20,7 +20,8 @@
package org.sonar.api.batch.sensor;
import com.google.common.annotations.Beta;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
/**
* <p>
@@ -35,7 +36,9 @@ import org.sonar.api.BatchExtension;
* @since 5.1
*/
@Beta
-public interface Sensor extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface Sensor {
/**
* Populate {@link SensorDescriptor} of this sensor.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java
index 6f81ce61226..10beba2c5d3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/SensorStorage.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.batch.sensor.internal;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage;
import org.sonar.api.batch.sensor.dependency.Dependency;
import org.sonar.api.batch.sensor.duplication.Duplication;
@@ -31,7 +31,8 @@ import org.sonar.api.batch.sensor.measure.Measure;
* Interface for storing data computed by sensors.
* @since 5.1
*/
-public interface SensorStorage extends BatchComponent {
+@BatchSide
+public interface SensorStorage {
void store(Measure measure);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java b/sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java
index 8f16849892e..d2f86d7800b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/component/Perspectives.java
@@ -19,14 +19,16 @@
*/
package org.sonar.api.component;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
/**
* @deprecated since 5.2 unused
*/
@Deprecated
-public interface Perspectives extends BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public interface Perspectives {
<P extends Perspective> P as(Class<P> perspectiveClass, Component component);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java b/sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java
index 61a669ee75c..d4afa4d5389 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java
@@ -19,14 +19,15 @@
*/
package org.sonar.api.component;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import javax.annotation.CheckForNull;
/**
* @since 3.6
*/
-public interface RubyComponentService extends ServerComponent {
+@ServerSide
+public interface RubyComponentService {
@CheckForNull
Component findByKey(String key);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java
index 5d955aa1ec9..5e45bcc6185 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/EmailSettings.java
@@ -20,16 +20,18 @@
package org.sonar.api.config;
import com.google.common.base.Objects;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
/**
* If batch extensions use this component, then batch must be executed with administrator rights (see properties sonar.login and sonar.password)
*
* @since 3.2
*/
-public class EmailSettings implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class EmailSettings {
public static final String SMTP_HOST = "email.smtp_host.secured";
public static final String SMTP_HOST_DEFAULT = "";
public static final String SMTP_PORT = "email.smtp_port.secured";
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java
index dae8b5238ad..5d1be0f877d 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/GlobalPropertyChangeHandler.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.config;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import javax.annotation.Nullable;
@@ -33,7 +34,9 @@ import javax.annotation.Nullable;
*
* @since 3.0
*/
-public abstract class GlobalPropertyChangeHandler implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class GlobalPropertyChangeHandler {
public static final class PropertyChange {
private String key;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
index c8c73bde7e5..b82b340e4ba 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
@@ -25,10 +25,11 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.Property;
import org.sonar.api.PropertyType;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ServerSide;
import org.sonar.api.resources.Qualifiers;
import javax.annotation.Nullable;
@@ -67,7 +68,10 @@ import java.util.List;
*
* @since 3.6
*/
-public final class PropertyDefinition implements BatchExtension, ServerExtension {
+@BatchSide
+@ServerSide
+@ExtensionPoint
+public final class PropertyDefinition {
private String key;
private String defaultValue;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java
index b44f6696d27..4907cda4609 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java
@@ -21,11 +21,11 @@ package org.sonar.api.config;
import com.google.common.base.Strings;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.Properties;
import org.sonar.api.Property;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.AnnotationUtils;
import javax.annotation.Nullable;
@@ -41,7 +41,9 @@ import java.util.Map;
*
* @since 2.12
*/
-public final class PropertyDefinitions implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public final class PropertyDefinitions {
private final Map<String, PropertyDefinition> definitions = new HashMap<>();
private final Map<String, Category> categories = new HashMap<>();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
index 662c661d195..8c20de9b3a5 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
@@ -26,8 +26,8 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.DateUtils;
import javax.annotation.Nullable;
@@ -85,7 +85,9 @@ import java.util.Properties;
* </p>
* @since 2.12
*/
-public class Settings implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class Settings {
protected Map<String, String> properties;
protected PropertyDefinitions definitions;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java
index 74bd4939f42..f6474fd8fa0 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseSession.java
@@ -19,10 +19,11 @@
*/
package org.sonar.api.database;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import javax.persistence.EntityManager;
import javax.persistence.Query;
+
import java.util.List;
/**
@@ -30,14 +31,13 @@ import java.util.List;
*
* @since 1.10
*/
-public abstract class DatabaseSession implements BatchComponent {
-
+@BatchSide
+public abstract class DatabaseSession {
// IMPORTANT : this value must be the same than the property
// hibernate.jdbc.batch_size from /META-INF/persistence.xml (module sonar-database)
public static final int BATCH_SIZE = 30;
-
public abstract EntityManager getEntityManager();
public abstract void start();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java
index 3cc0936c099..03fd8c9913e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java
@@ -19,8 +19,8 @@
*/
package org.sonar.api.i18n;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import javax.annotation.Nullable;
@@ -32,7 +32,9 @@ import java.util.Locale;
*
* @since 2.10
*/
-public interface I18n extends ServerComponent, BatchComponent {
+@BatchSide
+@ServerSide
+public interface I18n {
/**
* Searches the message of the <code>key</code> for the <code>locale</code> in the list of available bundles.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java
index 0dbcee23cc7..ef9c68009ed 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java
@@ -19,8 +19,8 @@
*/
package org.sonar.api.i18n;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.rules.Rule;
import javax.annotation.CheckForNull;
@@ -34,7 +34,9 @@ import java.util.Locale;
* @deprecated in 4.1. Rules are not localized anymore. See http://jira.codehaus.org/browse/SONAR-4885
*/
@Deprecated
-public interface RuleI18n extends ServerComponent, BatchComponent {
+@BatchSide
+@ServerSide
+public interface RuleI18n {
/**
* Returns the localized name of the rule identified by its repository key and rule key.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java
index 778b57135c7..b87f69dc7f0 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java
@@ -171,7 +171,7 @@ public interface Issue extends Serializable {
* Non-null list of comments, ordered by chronological order.
* <p/>
* IMPORTANT: existing comments are not loaded when this method is called when analyzing project
- * (from {@link org.sonar.api.BatchExtension}).
+ * (from {@link org.sonar.api.BatchSide}).
*/
List<IssueComment> comments();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java
index 8592f9513d6..903a5a7e692 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFilter.java
@@ -19,14 +19,17 @@
*/
package org.sonar.api.issue;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
/**
* @since 3.6
* @deprecated since 4.0
*/
@Deprecated
-public interface IssueFilter extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface IssueFilter {
boolean accept(Issue issue);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java
index 794859794a7..205b6a02ccb 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueHandler.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.issue;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.user.User;
import javax.annotation.Nullable;
@@ -27,7 +28,9 @@ import javax.annotation.Nullable;
/**
* @since 3.6
*/
-public interface IssueHandler extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface IssueHandler {
interface Context {
Issue issue();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java
index 591aa0f539b..f39046cf2cd 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/NoSonarFilter.java
@@ -31,7 +31,7 @@ import java.util.Set;
/**
* Issue filter used to ignore issues created on lines commented with the tag "NOSONAR".
* <p/>
- * Plugins, via {@link org.sonar.api.BatchExtension}s, must feed this filter by registering the
+ * Plugins, via {@link org.sonar.api.BatchSide}s, must feed this filter by registering the
* lines that contain "NOSONAR". Note that filters are disabled for the issues reported by
* end-users from UI or web services.
*
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java
index 096fcd36533..e0cac630b21 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/ProjectIssues.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.issue;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
import static org.sonar.api.batch.InstantiationStrategy.PER_BATCH;
@@ -30,7 +30,8 @@ import static org.sonar.api.batch.InstantiationStrategy.PER_BATCH;
* @since 4.0
*/
@InstantiationStrategy(PER_BATCH)
-public interface ProjectIssues extends BatchComponent {
+@BatchSide
+public interface ProjectIssues {
/**
* All the unresolved issues of the project, including the issues reported by end-users.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java
index 149a7450994..0c239a04733 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/action/Actions.java
@@ -20,7 +20,8 @@
package org.sonar.api.issue.action;
import com.google.common.annotations.Beta;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import java.util.ArrayList;
import java.util.List;
@@ -29,7 +30,9 @@ import java.util.List;
* @since 3.6
*/
@Beta
-public class Actions implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public class Actions {
private final List<Action> actions = new ArrayList<>();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java
index 1b240687719..bb2eacf3296 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/batch/IssueFilter.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.issue.batch;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.issue.Issue;
/**
@@ -27,7 +28,9 @@ import org.sonar.api.issue.Issue;
* @since 4.0
*
*/
-public interface IssueFilter extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface IssueFilter {
/**
* The <code>accept</code> method is called for each {@link Issue} created during analysis, to check if it has to be persisted. Examples of use cases are:
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java
index ad80aa5bb42..611784734a2 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.measures;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.resources.Resource;
@@ -28,7 +28,8 @@ import org.sonar.api.resources.Resource;
*
* @since 2.14
*/
-public interface FileLinesContextFactory extends BatchComponent {
+@BatchSide
+public interface FileLinesContextFactory {
/**
* @deprecated since 4.4 use {@link #createFor(InputFile)}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
index 111581d2f75..e53c1471b44 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
@@ -22,13 +22,20 @@ package org.sonar.api.measures;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.batch.InstantiationStrategy;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import javax.persistence.*;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
import java.io.Serializable;
@@ -39,8 +46,10 @@ import java.io.Serializable;
*/
@Table(name = "metrics")
@Entity(name = "Metric")
+@BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public class Metric<G extends Serializable> implements ServerExtension, BatchExtension, Serializable, org.sonar.api.batch.measure.Metric<G> {
+@ServerSide
+public class Metric<G extends Serializable> implements Serializable, org.sonar.api.batch.measure.Metric<G> {
/**
* A metric bigger value means a degradation
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java
index bb89c172a07..bbb309528c7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/MetricFinder.java
@@ -19,8 +19,8 @@
*/
package org.sonar.api.measures;
-import org.sonar.api.ServerComponent;
-import org.sonar.api.task.TaskComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import javax.annotation.CheckForNull;
@@ -32,7 +32,9 @@ import java.util.List;
* @deprecated since 5.1 use {@link org.sonar.api.batch.measure.MetricFinder} on batch side
*/
@Deprecated
-public interface MetricFinder extends TaskComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public interface MetricFinder {
@CheckForNull
Metric findById(int id);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java
index badcf51c331..e8d80b58a25 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metrics.java
@@ -19,8 +19,9 @@
*/
package org.sonar.api.measures;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import org.sonar.api.batch.InstantiationStrategy;
import java.util.List;
@@ -28,7 +29,10 @@ import java.util.List;
/**
* @since 1.10
*/
+@BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public interface Metrics extends BatchExtension, ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface Metrics {
List<Metric> getMetrics();
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java
index 40c6d2b71d5..49521fe55d9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationChannel.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.notifications;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* <p>
@@ -34,7 +35,9 @@ import org.sonar.api.ServerExtension;
*
* @since 2.10
*/
-public abstract class NotificationChannel implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class NotificationChannel {
/**
* Returns the unique key of this channel.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java
index 5ad0be8ed66..e662421d126 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcher.java
@@ -20,7 +20,8 @@
package org.sonar.api.notifications;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* <p>
@@ -37,7 +38,9 @@ import org.sonar.api.ServerExtension;
*
* @since 2.10
*/
-public abstract class NotificationDispatcher implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class NotificationDispatcher {
private final String notificationType;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java
index 8660f559b4f..57b602ae2fc 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationDispatcherMetadata.java
@@ -20,7 +20,8 @@
package org.sonar.api.notifications;
import com.google.common.collect.Maps;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import java.util.Map;
@@ -33,7 +34,9 @@ import java.util.Map;
*
* @since 3.5
*/
-public final class NotificationDispatcherMetadata implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public final class NotificationDispatcherMetadata {
public static final String GLOBAL_NOTIFICATION = "globalNotification";
public static final String PER_PROJECT_NOTIFICATION = "perProjectNotification";
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java
index 535793eddf7..c56c733b98d 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/notifications/NotificationManager.java
@@ -20,8 +20,9 @@
package org.sonar.api.notifications;
import com.google.common.collect.Multimap;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
+import org.sonar.api.batch.InstantiationStrategy;
import javax.annotation.Nullable;
@@ -38,7 +39,10 @@ import java.util.List;
*
* @since 2.10
*/
-public interface NotificationManager extends ServerComponent, BatchComponent {
+@ServerSide
+@BatchSide
+@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
+public interface NotificationManager {
/**
* Receives a notification and stores it so that it is processed by the notification service.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java
index ec2cdf5b218..829bc81dd60 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/NewUserHandler.java
@@ -20,14 +20,17 @@
package org.sonar.api.platform;
import com.google.common.base.Preconditions;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import javax.annotation.Nullable;
/**
* @since 3.2
*/
-public interface NewUserHandler extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface NewUserHandler {
final class Context {
private String login;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java
index 4f4502779ab..ef33d6d9b35 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/Server.java
@@ -19,8 +19,8 @@
*/
package org.sonar.api.platform;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import javax.annotation.CheckForNull;
@@ -30,7 +30,9 @@ import java.util.Date;
/**
* @since 2.2
*/
-public abstract class Server implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public abstract class Server {
public abstract String getId();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java
index 98233374fc7..b07a1a3cae7 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.platform;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import java.io.File;
import java.util.List;
@@ -27,7 +27,8 @@ import java.util.List;
/**
* @since 2.3
*/
-public interface ServerFileSystem extends ServerComponent {
+@ServerSide
+public interface ServerFileSystem {
File getHomeDir();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java
index 2df19eebc0b..8c1c09d0916 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java
@@ -19,12 +19,15 @@
*/
package org.sonar.api.platform;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* @since 2.2
*/
-public interface ServerStartHandler extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface ServerStartHandler {
void onServerStart(Server server);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java
index 7d6517c1ec9..315d5a16cc5 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java
@@ -19,12 +19,15 @@
*/
package org.sonar.api.platform;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* @since 2.2
*/
-public interface ServerStopHandler extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface ServerStopHandler {
void onServerStop(Server server);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java
index 74bb3763006..95d99239711 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java
@@ -19,12 +19,13 @@
*/
package org.sonar.api.platform;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
/**
* @since 2.5
*/
-public interface ServerUpgradeStatus extends ServerComponent {
+@ServerSide
+public interface ServerUpgradeStatus {
/**
* Has the database been upgraded during the current startup ? Return false when {@link #isFreshInstall()} is true.
@@ -40,5 +41,5 @@ public interface ServerUpgradeStatus extends ServerComponent {
* The database version before the server startup. Returns <=0 if db created from scratch.
*/
int getInitialDbVersion();
-
+
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java
index d3760d31a26..8b45e85f2ad 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/AnnotationProfileParser.java
@@ -20,7 +20,7 @@
package org.sonar.api.profiles;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleAnnotationUtils;
import org.sonar.api.rules.RuleFinder;
@@ -33,7 +33,8 @@ import java.util.Collection;
/**
* @since 2.3
*/
-public final class AnnotationProfileParser implements ServerComponent {
+@ServerSide
+public final class AnnotationProfileParser {
private final RuleFinder ruleFinder;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java
index 41b273f1e9d..7905aa164ba 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileDefinition.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.profiles;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.ValidationMessages;
/**
@@ -28,7 +29,9 @@ import org.sonar.api.utils.ValidationMessages;
*
* @since 2.3
*/
-public abstract class ProfileDefinition implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class ProfileDefinition {
public abstract RulesProfile createProfile(ValidationMessages validation);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java
index f8ca5084ae5..69ede33467b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java
@@ -22,15 +22,19 @@ package org.sonar.api.profiles;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import java.io.Writer;
/**
* @since 2.3
*/
-public abstract class ProfileExporter implements BatchExtension, ServerExtension {
+@BatchSide
+@ServerSide
+@ExtensionPoint
+public abstract class ProfileExporter {
private String[] supportedLanguages = new String[0];
private String key;
@@ -105,10 +109,10 @@ public abstract class ProfileExporter implements BatchExtension, ServerExtension
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("key", key)
- .append("name", name)
- .append("mimeType", mimeType)
- .append("languages", supportedLanguages)
- .toString();
+ .append("key", key)
+ .append("name", name)
+ .append("mimeType", mimeType)
+ .append("languages", supportedLanguages)
+ .toString();
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java
index a468e2a9acc..8d58254f965 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java
@@ -21,7 +21,8 @@ package org.sonar.api.profiles;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.ValidationMessages;
import java.io.Reader;
@@ -29,7 +30,9 @@ import java.io.Reader;
/**
* @since 2.3
*/
-public abstract class ProfileImporter implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class ProfileImporter {
private String[] supportedLanguages = new String[0];
private String importerKey;
@@ -92,9 +95,9 @@ public abstract class ProfileImporter implements ServerExtension {
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
- .append("key", importerKey)
- .append("name", importerName)
- .append("languages", supportedLanguages)
- .toString();
+ .append("key", importerKey)
+ .append("name", importerName)
+ .append("languages", supportedLanguages)
+ .toString();
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java
index 8519072307c..84b971dbe92 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileParser.java
@@ -25,7 +25,7 @@ import org.apache.commons.lang.StringUtils;
import org.codehaus.staxmate.SMInputFactory;
import org.codehaus.staxmate.in.SMHierarchicCursor;
import org.codehaus.staxmate.in.SMInputCursor;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleFinder;
@@ -34,6 +34,7 @@ import org.sonar.api.utils.ValidationMessages;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
+
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
@@ -42,7 +43,8 @@ import java.util.Map;
/**
* @since 2.3
*/
-public class XMLProfileParser implements ServerComponent {
+@ServerSide
+public class XMLProfileParser {
private final RuleFinder ruleFinder;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java
index 47822090414..ec56276649d 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/XMLProfileSerializer.java
@@ -21,7 +21,7 @@ package org.sonar.api.profiles;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.ActiveRuleParam;
import org.sonar.api.utils.SonarException;
@@ -32,7 +32,8 @@ import java.io.Writer;
/**
* @since 2.3
*/
-public class XMLProfileSerializer implements ServerComponent {
+@ServerSide
+public class XMLProfileSerializer {
public void write(RulesProfile profile, Writer writer) {
try {
@@ -47,8 +48,8 @@ public class XMLProfileSerializer implements ServerComponent {
private void appendHeader(RulesProfile profile, Writer writer) throws IOException {
writer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<!-- Generated by SonarQube -->"
- + "<profile><name>");
+ + "<!-- Generated by SonarQube -->"
+ + "<profile><name>");
StringEscapeUtils.escapeXml(writer, profile.getName());
writer.append("</name><language>");
StringEscapeUtils.escapeXml(writer, profile.getLanguage());
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java
index a5665394c43..2634e3564a2 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Language.java
@@ -19,8 +19,9 @@
*/
package org.sonar.api.resources;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import org.sonar.api.batch.InstantiationStrategy;
/**
@@ -30,8 +31,11 @@ import org.sonar.api.batch.InstantiationStrategy;
*
* @since 1.10
*/
+@BatchSide
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public interface Language extends BatchExtension, ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface Language {
/**
* For example "java". Should not be more than 20 chars.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java
index 055b3897c1d..d0ae370809f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/Languages.java
@@ -21,8 +21,8 @@ package org.sonar.api.resources;
import com.google.common.collect.Maps;
import org.apache.commons.lang.ArrayUtils;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
@@ -37,7 +37,9 @@ import java.util.Map;
*
* @since 1.10
*/
-public class Languages implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class Languages {
private static final Logger LOG = Loggers.get(Languages.class);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java
index f6fa337b482..6d620e722ac 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypeTree.java
@@ -26,8 +26,8 @@ import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ListMultimap;
-import org.sonar.api.ServerExtension;
-import org.sonar.api.task.TaskExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import java.util.ArrayList;
import java.util.Arrays;
@@ -37,7 +37,9 @@ import java.util.List;
/**
* @since 2.14
*/
-public class ResourceTypeTree implements TaskExtension, ServerExtension {
+@BatchSide
+@ServerSide
+public class ResourceTypeTree {
private final List<ResourceType> types;
private final ListMultimap<String, String> relations;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java
index 83962edd5f8..b9be315c6fe 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java
@@ -30,8 +30,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import org.sonar.api.ServerComponent;
-import org.sonar.api.task.TaskComponent;
+import org.sonar.api.ServerSide;
import javax.annotation.Nullable;
@@ -44,7 +43,8 @@ import java.util.Map;
* @since 2.14
*/
@Beta
-public class ResourceTypes implements TaskComponent, ServerComponent {
+@ServerSide
+public class ResourceTypes {
public static final Predicate<ResourceType> AVAILABLE_FOR_FILTERS = new Predicate<ResourceType>() {
@Override
@@ -184,7 +184,7 @@ public class ResourceTypes implements TaskComponent, ServerComponent {
return treeByQualifier.get(qualifier);
}
- public ResourceType getRoot(String qualifier){
+ public ResourceType getRoot(String qualifier) {
return getTree(qualifier).getRootType();
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java
index a5ecacd1df9..53a7498b039 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RuleFinder.java
@@ -19,10 +19,10 @@
*/
package org.sonar.api.rules;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.rule.RuleKey;
-import org.sonar.api.task.TaskComponent;
import javax.annotation.CheckForNull;
@@ -33,7 +33,9 @@ import java.util.Collection;
* @deprecated since 5.1. Use {@link ActiveRules} on batch side.
*/
@Deprecated
-public interface RuleFinder extends TaskComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public interface RuleFinder {
/**
* @since 2.5
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java
index b5032895f83..a9e19d4331e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileExclusions.java
@@ -21,7 +21,7 @@ package org.sonar.api.scan.filesystem;
import com.google.common.collect.ObjectArrays;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
import org.sonar.api.config.Settings;
@@ -35,7 +35,8 @@ import java.util.List;
*
* @since 3.5
*/
-public class FileExclusions implements BatchComponent {
+@BatchSide
+public class FileExclusions {
private final Settings settings;
public FileExclusions(Settings settings) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java
index 7665b406f1b..3fedb814ea4 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/FileSystemFilter.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.scan.filesystem;
-import org.sonar.api.BatchExtension;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ExtensionPoint;
import org.sonar.api.batch.fs.InputFileFilter;
import java.io.File;
@@ -35,7 +36,9 @@ import java.io.File;
* @deprecated since 4.2 use {@link InputFileFilter}
*/
@Deprecated
-public interface FileSystemFilter extends BatchExtension {
+@BatchSide
+@ExtensionPoint
+public interface FileSystemFilter {
/**
* Plugins must not implement this interface. It is provided at runtime.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java
index b3c14832f88..152a1c14fb8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/ModuleFileSystem.java
@@ -19,7 +19,7 @@
*/
package org.sonar.api.scan.filesystem;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
@@ -34,7 +34,8 @@ import java.util.List;
* @deprecated in 4.2. Replaced by {@link org.sonar.api.batch.fs.FileSystem}
*/
@Deprecated
-public interface ModuleFileSystem extends BatchComponent {
+@BatchSide
+public interface ModuleFileSystem {
/**
* Base directory.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java
index 9bd4ac7be0c..d0468c24d97 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/scan/filesystem/PathResolver.java
@@ -21,7 +21,7 @@ package org.sonar.api.scan.filesystem;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.utils.PathUtils;
import javax.annotation.CheckForNull;
@@ -34,7 +34,8 @@ import java.util.List;
/**
* @since 3.5
*/
-public class PathResolver implements BatchComponent {
+@BatchSide
+public class PathResolver {
public File relativeFile(File dir, String path) {
Preconditions.checkArgument(dir.isDirectory(), "Not a directory: " + dir.getAbsolutePath());
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java
index 6d096999a17..5c2a7dadf8e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/Authenticator.java
@@ -20,7 +20,8 @@
package org.sonar.api.security;
import com.google.common.base.Preconditions;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
@@ -29,7 +30,9 @@ import javax.servlet.http.HttpServletRequest;
* @see SecurityRealm
* @since 3.1
*/
-public abstract class Authenticator implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class Authenticator {
/**
* @return true if user was successfully authenticated with specified credentials, false otherwise
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java
index 12f917efacc..f09256dc5bb 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/LoginPasswordAuthenticator.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.security;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* @since 1.12
@@ -27,7 +28,9 @@ import org.sonar.api.ServerExtension;
* @deprecated replaced by Authenticator in version 3.1
*/
@Deprecated
-public interface LoginPasswordAuthenticator extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface LoginPasswordAuthenticator {
/**
* @throws RuntimeException if the authenticator can not be initialized at sonar server startup, eg. if the connection to LDAP server is refused
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java
index ab062823987..54d8c44195e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/ResourcePermissions.java
@@ -19,9 +19,9 @@
*/
package org.sonar.api.security;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.resources.Resource;
-import org.sonar.api.task.TaskComponent;
/**
* Grant access to newly created projects.
@@ -30,7 +30,9 @@ import org.sonar.api.task.TaskComponent;
*
* @since 3.2
*/
-public interface ResourcePermissions extends TaskComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public interface ResourcePermissions {
/**
* Limitation - the resource id is used instead of logical key.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java
index 53a03c1ac09..ba310849d2b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/SecurityRealm.java
@@ -19,12 +19,15 @@
*/
package org.sonar.api.security;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* @since 2.14
*/
-public abstract class SecurityRealm implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class SecurityRealm {
/**
* @return unique name of this realm, e.g. "ldap"
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java
index dc6b50293f6..c3f4a739cdd 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/security/UserFinder.java
@@ -19,8 +19,8 @@
*/
package org.sonar.api.security;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.database.model.User;
/**
@@ -28,7 +28,9 @@ import org.sonar.api.database.model.User;
* @deprecated since 5.1 DB access will soon be removed from batch side
*/
@Deprecated
-public interface UserFinder extends ServerComponent, BatchComponent {
+@BatchSide
+@ServerSide
+public interface UserFinder {
User findById(int id);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java
index b2d668fa239..d9a9234976d 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java
@@ -20,14 +20,15 @@
package org.sonar.api.server.debt;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import java.util.List;
/**
* @since 4.3
*/
-public interface DebtModel extends ServerComponent {
+@ServerSide
+public interface DebtModel {
/**
* @return all characteristics
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
index 6caa31b5217..c70a11a0de2 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinition.java
@@ -20,10 +20,17 @@
package org.sonar.api.server.rule;
import com.google.common.base.Strings;
-import com.google.common.collect.*;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSortedSet;
+import com.google.common.collect.ListMultimap;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import org.sonar.api.rule.RuleStatus;
import org.sonar.api.rule.Severity;
import org.sonar.api.server.debt.DebtRemediationFunction;
@@ -132,7 +139,9 @@ import java.util.Set;
*
* @since 4.3
*/
-public interface RulesDefinition extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface RulesDefinition {
/**
* Default sub-characteristics of technical debt model. See http://www.sqale.org
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java
index 70973c5a124..61d6ada2353 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionI18nLoader.java
@@ -20,7 +20,7 @@
package org.sonar.api.server.rule;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.i18n.RuleI18n;
/**
@@ -35,7 +35,8 @@ import org.sonar.api.i18n.RuleI18n;
* @see org.sonar.api.server.rule.RulesDefinition for an example
* @since 4.3
*/
-public class RulesDefinitionI18nLoader implements ServerComponent {
+@ServerSide
+public class RulesDefinitionI18nLoader {
private final RuleI18n i18n;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java
index 55612d860aa..910f56fe2fb 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java
@@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUtils;
import org.codehaus.staxmate.SMInputFactory;
import org.codehaus.staxmate.in.SMHierarchicCursor;
import org.codehaus.staxmate.in.SMInputCursor;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.rule.RuleStatus;
import org.sonar.api.rule.Severity;
import org.sonar.check.Cardinality;
@@ -81,7 +81,8 @@ import java.util.List;
* @see org.sonar.api.server.rule.RulesDefinition
* @since 4.3
*/
-public class RulesDefinitionXmlLoader implements ServerComponent {
+@ServerSide
+public class RulesDefinitionXmlLoader {
public void load(RulesDefinition.NewRepository repo, InputStream input, String encoding) {
load(repo, input, Charset.forName(encoding));
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java
index 84eb2af2e90..7b45a5ea5f3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java
@@ -19,12 +19,15 @@
*/
package org.sonar.api.server.ws;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* @since 4.2
*/
-public interface RequestHandler extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface RequestHandler {
void handle(Request request, Response response) throws Exception;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
index af429ac9b69..2535dcd72b9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
@@ -27,7 +27,8 @@ import com.google.common.collect.Sets;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@@ -100,7 +101,9 @@ import java.util.Set;
*
* @since 4.2
*/
-public interface WebService extends ServerExtension, Definable<WebService.Context> {
+@ServerSide
+@ExtensionPoint
+public interface WebService extends Definable<WebService.Context> {
class Context {
private final Map<String, Controller> controllers = Maps.newHashMap();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java b/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java
index 65d5e055093..1aff5a51796 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/task/TaskComponent.java
@@ -19,6 +19,9 @@
*/
package org.sonar.api.task;
+import org.sonar.api.BatchSide;
+import org.sonar.api.batch.InstantiationStrategy;
+
/**
* All the classes implementing this interface can be injected in public constructors of {@link TaskExtension}.
*
@@ -26,5 +29,7 @@ package org.sonar.api.task;
* @deprecated since 5.1 all tasks (devcockpit, views) will be moved to server side
*/
@Deprecated
+@BatchSide
+@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
public interface TaskComponent {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java
index 33eb7e48a76..56000eca609 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/batch/TechnicalDebtModel.java
@@ -20,7 +20,7 @@
package org.sonar.api.technicaldebt.batch;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.technicaldebt.batch.internal.DefaultCharacteristic;
@@ -30,11 +30,11 @@ import java.util.List;
/**
* @since 4.1
- * Used by Views plugin
* @deprecated since 4.3
*/
@Deprecated
-public interface TechnicalDebtModel extends BatchComponent {
+@BatchSide
+public interface TechnicalDebtModel {
@CheckForNull
Characteristic characteristicById(Integer id);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java
index 1e303d01db9..5d9a92d0c3b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/user/RubyUserService.java
@@ -19,16 +19,18 @@
*/
package org.sonar.api.user;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import javax.annotation.CheckForNull;
+
import java.util.List;
import java.util.Map;
/**
* @since 3.6
*/
-public interface RubyUserService extends ServerComponent {
+@ServerSide
+public interface RubyUserService {
@CheckForNull
User findByLogin(String login);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java
index 7e869810b2d..1a261424b7f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/user/UserFinder.java
@@ -19,8 +19,8 @@
*/
package org.sonar.api.user;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import javax.annotation.CheckForNull;
@@ -31,7 +31,9 @@ import java.util.List;
* @deprecated since 5.1 DB access will soon be removed from batch side
*/
@Deprecated
-public interface UserFinder extends BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public interface UserFinder {
@CheckForNull
User findByLogin(String login);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
index 05f2ba422d5..5e3ae2a0632 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java
@@ -20,9 +20,9 @@
package org.sonar.api.utils;
-import org.sonar.api.BatchComponent;
+import org.sonar.api.BatchSide;
import org.sonar.api.CoreProperties;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.ServerSide;
import org.sonar.api.config.Settings;
import org.sonar.api.i18n.I18n;
@@ -35,7 +35,9 @@ import java.util.Locale;
*
* @since 4.3
*/
-public class Durations implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class Durations {
public enum DurationFormat {
/**
@@ -111,7 +113,7 @@ public class Durations implements BatchComponent, ServerComponent {
return format(locale, days, hours, minutes, isNegative);
}
- private String format(Locale locale, int days, int hours, int minutes, boolean isNegative){
+ private String format(Locale locale, int days, int hours, int minutes, boolean isNegative) {
StringBuilder message = new StringBuilder();
if (days > 0) {
message.append(message(locale, "work_duration.x_days", isNegative ? -1 * days : days));
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java
index 4965f14d3d4..fc2d9d36c1c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/HttpDownloader.java
@@ -19,8 +19,8 @@
*/
package org.sonar.api.utils;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import java.io.File;
import java.io.InputStream;
@@ -30,7 +30,9 @@ import java.net.URI;
* This component is available in IoC container, so it should be injected through
* a constructor parameter. It is available in both batch and server.
*/
-public abstract class HttpDownloader extends UriReader.SchemeProcessor implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public abstract class HttpDownloader extends UriReader.SchemeProcessor {
public static final int TIMEOUT_MILLISECONDS = 20 * 1000;
public abstract String downloadPlainText(URI uri, String encoding);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java
index 713d85265e2..a756709e092 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Semaphores.java
@@ -19,10 +19,11 @@
*/
package org.sonar.api.utils;
-import org.sonar.api.ServerComponent;
-import org.sonar.api.task.TaskComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import javax.annotation.Nullable;
+
import java.util.Date;
/**
@@ -31,7 +32,9 @@ import java.util.Date;
*
* @since 3.4
*/
-public interface Semaphores extends TaskComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public interface Semaphores {
/**
* Try to acquire a semaphore for a given duration.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java
index 2b05df0de86..03e8f5122c8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/System2.java
@@ -20,8 +20,8 @@
package org.sonar.api.utils;
import org.apache.commons.lang.SystemUtils;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import javax.annotation.CheckForNull;
@@ -63,7 +63,9 @@ import java.util.TimeZone;
*
* @since 4.2
*/
-public class System2 implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class System2 {
public static final System2 INSTANCE = new System2();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java
index 92a695b57b1..8a15c2fcc73 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java
@@ -19,8 +19,8 @@
*/
package org.sonar.api.utils;
-import org.sonar.api.ServerComponent;
-import org.sonar.api.task.TaskComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import javax.annotation.Nullable;
@@ -36,7 +36,9 @@ import java.io.File;
* @since 4.0
*
*/
-public interface TempFolder extends TaskComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public interface TempFolder {
/**
* Create a directory in temp folder with a random unique name.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java
index ad435de7b23..9f5ceb4e80b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java
@@ -25,8 +25,8 @@ import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.ServerComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import java.io.File;
import java.io.IOException;
@@ -41,7 +41,9 @@ import java.util.Map;
*
* @since 3.2
*/
-public class UriReader implements BatchComponent, ServerComponent {
+@BatchSide
+@ServerSide
+public class UriReader {
private final Map<String, SchemeProcessor> processorsByScheme = Maps.newHashMap();
@@ -96,7 +98,6 @@ public class UriReader implements BatchComponent, ServerComponent {
protected abstract String description(URI uri);
}
-
/**
* This implementation is not exposed in API and is kept private.
*/
@@ -104,7 +105,7 @@ public class UriReader implements BatchComponent, ServerComponent {
@Override
public String[] getSupportedSchemes() {
- return new String[]{"file"};
+ return new String[] {"file"};
}
@Override
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java
index e0e8a87ca52..8ba70571379 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/TempFolderCleaner.java
@@ -20,11 +20,13 @@
package org.sonar.api.utils.internal;
import org.picocontainer.Startable;
-import org.sonar.api.ServerComponent;
-import org.sonar.api.task.TaskComponent;
+import org.sonar.api.BatchSide;
+import org.sonar.api.ServerSide;
import org.sonar.api.utils.TempFolder;
-public class TempFolderCleaner implements TaskComponent, ServerComponent, Startable {
+@BatchSide
+@ServerSide
+public class TempFolderCleaner implements Startable {
private TempFolder defaultTempFolder;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java
index ce40f5fe041..2060b0d7d9e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/DashboardTemplate.java
@@ -19,14 +19,17 @@
*/
package org.sonar.api.web;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* This extension point must be implemented to define a new dashboard.
*
* @since 2.13
*/
-public abstract class DashboardTemplate implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class DashboardTemplate {
/**
* Returns the {@link Dashboard} object that represents the dashboard to use.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java
index 5ba0cc14bf8..ec7e6fc918b 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/FilterTemplate.java
@@ -19,14 +19,17 @@
*/
package org.sonar.api.web;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* This extension point must be implemented to define a new filter.
*
* @since 3.1
*/
-public abstract class FilterTemplate implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class FilterTemplate {
/**
* Returns the {@link Filter} object that represents the filter to use.
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java
index 4dbbdade375..3aa3d3e97fa 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/Footer.java
@@ -19,12 +19,15 @@
*/
package org.sonar.api.web;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* @since 1.10
*/
-public interface Footer extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface Footer {
/**
* Static HTML (no Ruby on Rails)
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java
index 4505a42c32c..b34a7913c02 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.web;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* Adds content to HTML pages. A PageDecoration is a Rails template (html.erb file) that executes content_for blocks on predefined locations :
@@ -44,6 +45,8 @@ import org.sonar.api.ServerExtension;
*
* @since 3.3
*/
-public abstract class PageDecoration extends AbstractRubyTemplate implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class PageDecoration extends AbstractRubyTemplate {
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java
index 29e9c99ab01..e50462060f8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/ServletFilter.java
@@ -21,14 +21,17 @@ package org.sonar.api.web;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import javax.servlet.Filter;
/**
* @since 3.1
*/
-public abstract class ServletFilter implements ServerExtension, Filter {
+@ServerSide
+@ExtensionPoint
+public abstract class ServletFilter implements Filter {
/**
* Override to change URL. Default is /*
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/View.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/View.java
index adfac3917ba..fed5625d6b3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/web/View.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/View.java
@@ -19,12 +19,15 @@
*/
package org.sonar.api.web;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* @since 1.11
*/
-public interface View extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface View {
String getId();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java
index 1b33222abba..28b9d0f027a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/Webservice.java
@@ -19,7 +19,8 @@
*/
package org.sonar.api.web;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
/**
* Interface to create a web service extension point
@@ -28,7 +29,9 @@ import org.sonar.api.ServerExtension;
* @deprecated in 4.2. Replaced by {@link org.sonar.api.server.ws.WebService}
*/
@Deprecated
-public interface Webservice extends ServerExtension {
+@ServerSide
+@ExtensionPoint
+public interface Webservice {
/**
* @return The id of the web service
diff --git a/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java b/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java
index 09a8a5c1e40..fda958539be 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java
@@ -19,13 +19,16 @@
*/
package org.sonar.plugins.emailnotifications.api;
-import org.sonar.api.ServerExtension;
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.ServerSide;
import org.sonar.api.notifications.Notification;
/**
* @since 2.10
*/
-public abstract class EmailTemplate implements ServerExtension {
+@ServerSide
+@ExtensionPoint
+public abstract class EmailTemplate {
public abstract EmailMessage format(Notification notification);