]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5628 - Compute Engine - Remove sonar-dbcleaner-plugin
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 27 Oct 2014 14:21:41 +0000 (15:21 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 27 Oct 2014 14:37:44 +0000 (15:37 +0100)
17 files changed:
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-dbcleaner-plugin/pom.xml [deleted file]
plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java [deleted file]
plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DeprecatedDefaultPurgeTask.java [deleted file]
plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/DbCleanerConstants.java [deleted file]
plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java [deleted file]
pom.xml
server/sonar-server/src/main/java/org/sonar/server/component/ComponentCleanerService.java
server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
sonar-application/pom.xml
sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java
sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/DefaultPurgeTask.java
sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/package-info.java [new file with mode: 0644]
sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/period/DefaultPeriodCleaner.java
sonar-core/src/main/java/org/sonar/core/computation/package-info.java [deleted file]
sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/DbCleanerConstants.java [new file with mode: 0644]
sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java [new file with mode: 0644]

index fc1d540c4aa72df0c8aa42a16b9e36a924c7abab..e1965074eb82c0afe396f4b426d8d905e6823d17 100644 (file)
 package org.sonar.plugins.core;
 
 import com.google.common.collect.ImmutableList;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.PropertyType;
-import org.sonar.api.SonarPlugin;
+import org.sonar.api.*;
 import org.sonar.api.checks.NoSonarFilter;
 import org.sonar.core.timemachine.Periods;
 import org.sonar.plugins.core.batch.IndexProjectPostJob;
@@ -35,81 +31,17 @@ import org.sonar.plugins.core.dashboards.GlobalDefaultDashboard;
 import org.sonar.plugins.core.dashboards.ProjectDefaultDashboard;
 import org.sonar.plugins.core.dashboards.ProjectIssuesDashboard;
 import org.sonar.plugins.core.dashboards.ProjectTimeMachineDashboard;
-import org.sonar.plugins.core.issue.CountFalsePositivesDecorator;
-import org.sonar.plugins.core.issue.CountUnresolvedIssuesDecorator;
-import org.sonar.plugins.core.issue.InitialOpenIssuesSensor;
-import org.sonar.plugins.core.issue.InitialOpenIssuesStack;
-import org.sonar.plugins.core.issue.IssueHandlers;
-import org.sonar.plugins.core.issue.IssueTracking;
-import org.sonar.plugins.core.issue.IssueTrackingDecorator;
-import org.sonar.plugins.core.issue.notification.ChangesOnMyIssueNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.IssueChangesEmailTemplate;
-import org.sonar.plugins.core.issue.notification.NewFalsePositiveNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.NewIssuesEmailTemplate;
-import org.sonar.plugins.core.issue.notification.NewIssuesNotificationDispatcher;
-import org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob;
+import org.sonar.plugins.core.issue.*;
+import org.sonar.plugins.core.issue.notification.*;
 import org.sonar.plugins.core.measurefilters.MyFavouritesFilter;
 import org.sonar.plugins.core.measurefilters.ProjectFilter;
 import org.sonar.plugins.core.notifications.alerts.NewAlerts;
 import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
-import org.sonar.plugins.core.sensors.BranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.CommentDensityDecorator;
-import org.sonar.plugins.core.sensors.CoverageDecorator;
-import org.sonar.plugins.core.sensors.CoverageMeasurementFilter;
-import org.sonar.plugins.core.sensors.DirectoriesDecorator;
-import org.sonar.plugins.core.sensors.FileHashSensor;
-import org.sonar.plugins.core.sensors.FilesDecorator;
-import org.sonar.plugins.core.sensors.ItBranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.ItCoverageDecorator;
-import org.sonar.plugins.core.sensors.ItLineCoverageDecorator;
-import org.sonar.plugins.core.sensors.LineCoverageDecorator;
-import org.sonar.plugins.core.sensors.ManualMeasureDecorator;
-import org.sonar.plugins.core.sensors.OverallBranchCoverageDecorator;
-import org.sonar.plugins.core.sensors.OverallCoverageDecorator;
-import org.sonar.plugins.core.sensors.OverallLineCoverageDecorator;
-import org.sonar.plugins.core.sensors.ProjectLinksSensor;
-import org.sonar.plugins.core.sensors.UnitTestDecorator;
-import org.sonar.plugins.core.sensors.VersionEventsSensor;
-import org.sonar.plugins.core.timemachine.NewCoverageAggregator;
-import org.sonar.plugins.core.timemachine.NewCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.NewItCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.NewOverallCoverageFileAnalyzer;
-import org.sonar.plugins.core.timemachine.TendencyDecorator;
-import org.sonar.plugins.core.timemachine.TimeMachineConfigurationPersister;
-import org.sonar.plugins.core.timemachine.VariationDecorator;
-import org.sonar.plugins.core.widgets.AlertsWidget;
-import org.sonar.plugins.core.widgets.BubbleChartWidget;
-import org.sonar.plugins.core.widgets.ComplexityWidget;
-import org.sonar.plugins.core.widgets.CoverageWidget;
-import org.sonar.plugins.core.widgets.CustomMeasuresWidget;
-import org.sonar.plugins.core.widgets.DebtOverviewWidget;
-import org.sonar.plugins.core.widgets.DescriptionWidget;
-import org.sonar.plugins.core.widgets.DocumentationCommentsWidget;
-import org.sonar.plugins.core.widgets.DuplicationsWidget;
-import org.sonar.plugins.core.widgets.EventsWidget;
-import org.sonar.plugins.core.widgets.HotspotMetricWidget;
-import org.sonar.plugins.core.widgets.HotspotMostViolatedRulesWidget;
-import org.sonar.plugins.core.widgets.ItCoverageWidget;
-import org.sonar.plugins.core.widgets.ProjectFileCloudWidget;
-import org.sonar.plugins.core.widgets.SizeWidget;
-import org.sonar.plugins.core.widgets.TechnicalDebtPyramidWidget;
-import org.sonar.plugins.core.widgets.TimeMachineWidget;
-import org.sonar.plugins.core.widgets.TimelineWidget;
-import org.sonar.plugins.core.widgets.TreemapWidget;
-import org.sonar.plugins.core.widgets.WelcomeWidget;
-import org.sonar.plugins.core.widgets.issues.ActionPlansWidget;
-import org.sonar.plugins.core.widgets.issues.FalsePositiveIssuesWidget;
-import org.sonar.plugins.core.widgets.issues.IssueFilterWidget;
-import org.sonar.plugins.core.widgets.issues.IssuesWidget;
-import org.sonar.plugins.core.widgets.issues.MyUnresolvedIssuesWidget;
-import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesPerAssigneeWidget;
-import org.sonar.plugins.core.widgets.issues.UnresolvedIssuesStatusesWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsBubbleChartWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsCloudWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsHistogramWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsPieChartWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterAsTreemapWidget;
-import org.sonar.plugins.core.widgets.measures.MeasureFilterListWidget;
+import org.sonar.plugins.core.sensors.*;
+import org.sonar.plugins.core.timemachine.*;
+import org.sonar.plugins.core.widgets.*;
+import org.sonar.plugins.core.widgets.issues.*;
+import org.sonar.plugins.core.widgets.measures.*;
 
 import java.util.List;
 
diff --git a/plugins/sonar-dbcleaner-plugin/pom.xml b/plugins/sonar-dbcleaner-plugin/pom.xml
deleted file mode 100644 (file)
index b968b02..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.codehaus.sonar</groupId>
-    <artifactId>sonar</artifactId>
-    <version>5.0-SNAPSHOT</version>
-    <relativePath>../..</relativePath>
-  </parent>
-  <groupId>org.codehaus.sonar.plugins</groupId>
-  <artifactId>sonar-dbcleaner-plugin</artifactId>
-  <packaging>sonar-plugin</packaging>
-
-  <name>SonarQube :: Plugins :: Database Cleaner</name>
-  <description>Optimizes database performances by removing old and useless data.</description>
-
-  <dependencies>
-    <dependency>
-      <groupId>com.google.code.findbugs</groupId>
-      <artifactId>jsr305</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.sonar</groupId>
-      <artifactId>sonar-core</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.sonar</groupId>
-      <artifactId>sonar-plugin-api</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.sonar</groupId>
-      <artifactId>sonar-deprecated</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
-      <scope>provided</scope>
-    </dependency>
-
-    <!-- unit tests -->
-    <dependency>
-      <groupId>org.codehaus.sonar</groupId>
-      <artifactId>sonar-testing-harness</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-all</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <!-- TODO http://jira.codehaus.org/browse/SONAR-2011
-    We need following dependency, otherwise we will receive
-    java.lang.NoClassDefFoundError: org/apache/maven/project/MavenProject
-    during call mock(org.sonar.api.resources.Project.class)
-    -->
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-
-      <plugin>
-        <groupId>org.codehaus.sonar</groupId>
-        <artifactId>sonar-packaging-maven-plugin</artifactId>
-        <configuration>
-          <pluginName>Database Cleaner</pluginName>
-          <pluginClass>org.sonar.plugins.dbcleaner.DbCleanerPlugin</pluginClass>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <skipTests>${skipBatchTests}</skipTests>
-        </configuration>
-      </plugin>
-
-    </plugins>
-  </build>
-</project>
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DbCleanerPlugin.java
deleted file mode 100644 (file)
index 56cad6f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.plugins.dbcleaner;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import org.sonar.api.SonarPlugin;
-import org.sonar.api.config.PropertyDefinition;
-import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner;
-
-import java.util.List;
-
-@Deprecated
-public final class DbCleanerPlugin extends SonarPlugin {
-
-  static List<PropertyDefinition> propertyDefinitions() {
-    return Lists.newArrayList();
-  }
-
-  @Override
-  public List getExtensions() {
-    return ImmutableList.builder().add(DefaultPeriodCleaner.class, DeprecatedDefaultPurgeTask.class)
-      .addAll(propertyDefinitions()).build();
-  }
-}
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DeprecatedDefaultPurgeTask.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/DeprecatedDefaultPurgeTask.java
deleted file mode 100644 (file)
index 50e340b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.plugins.dbcleaner;
-
-import org.sonar.api.config.Settings;
-import org.sonar.core.computation.dbcleaner.DefaultPurgeTask;
-import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner;
-import org.sonar.core.purge.PurgeDao;
-import org.sonar.core.purge.PurgeProfiler;
-import org.sonar.plugins.dbcleaner.api.PurgeTask;
-
-/**
- * @since 2.14
- */
-@Deprecated
-public class DeprecatedDefaultPurgeTask implements PurgeTask {
-  private final DefaultPurgeTask defaultPurgeTask;
-
-  public DeprecatedDefaultPurgeTask(PurgeDao purgeDao, Settings settings, DefaultPeriodCleaner periodCleaner, PurgeProfiler profiler) {
-    defaultPurgeTask = new DefaultPurgeTask(purgeDao, settings, periodCleaner, profiler);
-  }
-
-  @Override
-  public DeprecatedDefaultPurgeTask delete(long resourceId) {
-    defaultPurgeTask.delete(resourceId);
-    return this;
-  }
-
-  @Override
-  public DeprecatedDefaultPurgeTask purge(long resourceId) {
-    defaultPurgeTask.purge(resourceId);
-    return this;
-  }
-}
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/DbCleanerConstants.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/DbCleanerConstants.java
deleted file mode 100644 (file)
index 881fca7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.plugins.dbcleaner.api;
-
-@Deprecated
-public interface DbCleanerConstants extends org.sonar.core.computation.dbcleaner.DbCleanerConstants {
-}
diff --git a/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java b/plugins/sonar-dbcleaner-plugin/src/main/java/org/sonar/plugins/dbcleaner/api/PurgeTask.java
deleted file mode 100644 (file)
index 810608f..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.plugins.dbcleaner.api;
-
-import com.google.common.annotations.Beta;
-import org.sonar.api.task.TaskExtension;
-
-/**
- * @since 2.14
- */
-@Beta
-@Deprecated
-public interface PurgeTask extends TaskExtension {
-  /**
-   * Purges the data related to a tree of resources.
-   * <p/>
-   * Exceptions are logged and are not thrown again, so this method fails only on {@link Error}s.
-   *
-   * @param resourceId the root of the tree
-   * @return this
-   */
-  PurgeTask purge(long resourceId);
-
-  /**
-   * Completely deletes a tree of resources.
-   *
-   * @param resourceId the root of the tree
-   * @return this
-   */
-  PurgeTask delete(long resourceId);
-}
diff --git a/pom.xml b/pom.xml
index 3fd56df35f7b8e4c14c30060ada57177f7a75c0f..25529927afa888f41c30632fb16eb7335a3c9332 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,6 @@
     <module>server</module>
     <module>sonar-testing-harness</module>
     <module>plugins/sonar-core-plugin</module>
-    <module>plugins/sonar-dbcleaner-plugin</module>
     <module>plugins/sonar-cpd-plugin</module>
     <module>plugins/sonar-l10n-en-plugin</module>
     <module>plugins/sonar-email-notifications-plugin</module>
index f03ec5a6cb42e5a421577ee5ceeb6411ffc4751e..e49061336a79cded17fb60afddfc736d69772059 100644 (file)
@@ -46,10 +46,17 @@ public class ComponentCleanerService implements ServerComponent {
       }
       purgeDao.deleteResourceTree(project.getId());
       deletePermissionIndexes(session, project.uuid());
+
       session.commit();
     } finally {
       session.close();
     }
+
+    deleteIssuesFromIndex(projectKey);
+  }
+
+  private void deleteIssuesFromIndex(String projectKey) {
+
   }
 
   private void deletePermissionIndexes(DbSession session, String projectUuid) {
index 0288b69d3bb1c865be5352046a5f7378d549b2d6..f19c67df03366d95606b9eef373fa93082b011e7 100644 (file)
@@ -273,7 +273,7 @@ class ServerComponents {
       ActivityNormalizer.class,
       ActivityIndex.class,
       ActivityDao.class
-    ));
+      ));
     components.addAll(CorePropertyDefinitions.all());
     components.addAll(DatabaseMigrations.CLASSES);
     components.addAll(DaoUtils.getDaoClasses());
@@ -306,7 +306,7 @@ class ServerComponents {
       // ws
       RestartHandler.class,
       SystemWs.class
-    );
+      );
   }
 
   /**
@@ -323,7 +323,7 @@ class ServerComponents {
       HttpDownloader.class,
       UriReader.class,
       ServerIdGenerator.class
-    );
+      );
   }
 
   void startLevel4Components(ComponentContainer pico) {
@@ -605,8 +605,9 @@ class ServerComponents {
     pico.addSingleton(ActiveAnalysisReportsAction.class);
     pico.addSingleton(IsAnalysisReportQueueEmptyAction.class);
     pico.addSingleton(AnalysisReportHistorySearchAction.class);
-    pico.addSingleton(DefaultPurgeTask.class);
     pico.addSingleton(DefaultPeriodCleaner.class);
+    pico.addSingleton(DefaultPurgeTask.class);
+
 
     for (Object components : level4AddedComponents) {
       pico.addSingleton(components);
index f37ec52f4ee4890eb484581267ade9bb0b6a26e4..e2581689e3771e47377506f80c8264068c31aaf5 100644 (file)
       <type>sonar-plugin</type>
       <scope>provided</scope>
     </dependency>
-    <dependency>
-      <groupId>org.codehaus.sonar.plugins</groupId>
-      <artifactId>sonar-dbcleaner-plugin</artifactId>
-      <version>${project.version}</version>
-      <type>sonar-plugin</type>
-      <scope>provided</scope>
-    </dependency>
     <dependency>
       <groupId>org.codehaus.sonar.plugins</groupId>
       <artifactId>sonar-cpd-plugin</artifactId>
index 596400c89487f4c722ab30b1df0671946c5ee9f9..8d0f2bfb00dd25488bae7a77b6183d2d8b143760 100644 (file)
@@ -32,6 +32,8 @@ import org.sonar.batch.maven.MavenProjectBuilder;
 import org.sonar.batch.maven.MavenProjectConverter;
 import org.sonar.batch.scm.ScmConfiguration;
 import org.sonar.batch.scm.ScmSensor;
+import org.sonar.core.computation.dbcleaner.DefaultPurgeTask;
+import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner;
 import org.sonar.core.config.CorePropertyDefinitions;
 
 import java.util.Collection;
@@ -57,7 +59,11 @@ public class BatchComponents {
 
       // SCM
       ScmConfiguration.class,
-      ScmSensor.class
+      ScmSensor.class,
+
+      // dbcleaner
+      DefaultPeriodCleaner.class,
+      DefaultPurgeTask.class
       );
     components.addAll(CorePropertyDefinitions.all());
     return components;
index 4cd7799c297145040937c35e2882d29866352fe7..9f74b4fe341b2a195b5d3b900eb716c38dc6606b 100644 (file)
@@ -30,11 +30,12 @@ import org.sonar.core.computation.dbcleaner.period.DefaultPeriodCleaner;
 import org.sonar.core.purge.PurgeConfiguration;
 import org.sonar.core.purge.PurgeDao;
 import org.sonar.core.purge.PurgeProfiler;
+import org.sonar.plugins.dbcleaner.api.PurgeTask;
 
 /**
  * @since 2.14
  */
-public class DefaultPurgeTask {
+public class DefaultPurgeTask implements PurgeTask {
   private static final Logger LOG = LoggerFactory.getLogger(DefaultPurgeTask.class);
 
   private PurgeDao purgeDao;
diff --git a/sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/package-info.java b/sonar-core/src/main/java/org/sonar/core/computation/dbcleaner/package-info.java
new file mode 100644 (file)
index 0000000..8a7156f
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+@ParametersAreNonnullByDefault
+package org.sonar.core.computation.dbcleaner;
+
+import javax.annotation.ParametersAreNonnullByDefault;
index 76b1238dc07a44fa511031fec422fd1906d9252a..a7f8a482533392b9c4a8d602ee3a2d72da9fff45 100644 (file)
@@ -23,6 +23,7 @@ package org.sonar.core.computation.dbcleaner.period;
 import com.google.common.annotations.VisibleForTesting;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.sonar.api.ServerExtension;
 import org.sonar.api.config.Settings;
 import org.sonar.api.resources.Project;
 import org.sonar.api.task.TaskExtension;
@@ -33,7 +34,7 @@ import org.sonar.core.purge.PurgeableSnapshotDto;
 
 import java.util.List;
 
-public class DefaultPeriodCleaner implements TaskExtension {
+public class DefaultPeriodCleaner implements TaskExtension, ServerExtension {
 
   private static final Logger LOG = LoggerFactory.getLogger(DefaultPeriodCleaner.class);
   private PurgeDao purgeDao;
diff --git a/sonar-core/src/main/java/org/sonar/core/computation/package-info.java b/sonar-core/src/main/java/org/sonar/core/computation/package-info.java
deleted file mode 100644 (file)
index 218db23..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-@ParametersAreNonnullByDefault
-package org.sonar.core.computation;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/DbCleanerConstants.java b/sonar-core/src/main/java/org/sonar/plugins/dbcleaner/api/DbCleanerConstants.java
new file mode 100644 (file)
index 0000000..881fca7
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.plugins.dbcleaner.api;
+
+@Deprecated
+public interface DbCleanerConstants extends org.sonar.core.computation.dbcleaner.DbCleanerConstants {
+}
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
new file mode 100644 (file)
index 0000000..070866a
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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.plugins.dbcleaner.api;
+
+import org.sonar.api.ServerExtension;
+import org.sonar.api.task.TaskExtension;
+
+/**
+ * @since 2.14
+ */
+@Deprecated
+public interface PurgeTask extends TaskExtension, ServerExtension {
+  /**
+   * Purges the data related to a tree of resources.
+   * <p/>
+   * Exceptions are logged and are not thrown again, so this method fails only on {@link Error}s.
+   *
+   * @param resourceId the root of the tree
+   * @return this
+   */
+  PurgeTask purge(long resourceId);
+
+  /**
+   * Completely deletes a tree of resources.
+   *
+   * @param resourceId the root of the tree
+   * @return this
+   */
+  PurgeTask delete(long resourceId);
+}