001 /* 002 * Sonar, open source software quality management tool. 003 * Copyright (C) 2008-2011 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * Sonar is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * Sonar is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with Sonar; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 019 */ 020 package org.sonar.plugins.dbcleaner; 021 022 import java.util.Arrays; 023 import java.util.List; 024 025 import org.sonar.api.Properties; 026 import org.sonar.api.Property; 027 import org.sonar.api.SonarPlugin; 028 import org.sonar.plugins.dbcleaner.api.DbCleanerConstants; 029 import org.sonar.plugins.dbcleaner.period.DefaultPeriodCleaner; 030 import org.sonar.plugins.dbcleaner.period.PeriodPurge; 031 import org.sonar.plugins.dbcleaner.purges.PurgeDeletedResources; 032 import org.sonar.plugins.dbcleaner.purges.PurgeDependencies; 033 import org.sonar.plugins.dbcleaner.purges.PurgeDeprecatedLast; 034 import org.sonar.plugins.dbcleaner.purges.PurgeDisabledResources; 035 import org.sonar.plugins.dbcleaner.purges.PurgeEntities; 036 import org.sonar.plugins.dbcleaner.purges.PurgeEventOrphans; 037 import org.sonar.plugins.dbcleaner.purges.PurgeOrphanResources; 038 import org.sonar.plugins.dbcleaner.purges.PurgeOrphanReviews; 039 import org.sonar.plugins.dbcleaner.purges.PurgePropertyOrphans; 040 import org.sonar.plugins.dbcleaner.purges.PurgeResourceRoles; 041 import org.sonar.plugins.dbcleaner.purges.PurgeRuleMeasures; 042 import org.sonar.plugins.dbcleaner.purges.PurgeUnprocessed; 043 import org.sonar.plugins.dbcleaner.runner.PurgeRunner; 044 045 @Properties({ 046 @Property(key = DbCleanerConstants.MONTHS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_WEEK, defaultValue = DbCleanerConstants.ONE_MONTH, 047 name = "Number of months before starting to keep only one snapshot by week", 048 description = "After this number of months, if there are several snapshots during the same week, " 049 + "the DbCleaner keeps the first one and fully delete the other ones.", global = true, project = true), 050 @Property(key = DbCleanerConstants.MONTHS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH, defaultValue = DbCleanerConstants.ONE_YEAR, 051 name = "Number of months before starting to keep only one snapshot by month", 052 description = "After this number of months, if there are several snapshots during the same month, " 053 + "the DbCleaner keeps the first one and fully delete the other ones.", global = true, project = true), 054 @Property(key = DbCleanerConstants.MONTHS_BEFORE_DELETING_ALL_SNAPSHOTS, defaultValue = DbCleanerConstants.FIVE_YEARS, 055 name = "Number of months before starting to delete all remaining snapshots", 056 description = "After this number of months, all snapshots are fully deleted.", global = true, project = true) }) 057 public final class DbCleanerPlugin extends SonarPlugin { 058 059 public List getExtensions() { 060 return Arrays.asList( 061 // shared components 062 DefaultPeriodCleaner.class, 063 064 // purges 065 PurgeOrphanResources.class, PurgeEntities.class, PurgeRuleMeasures.class, PurgeUnprocessed.class, PurgeDeletedResources.class, 066 PurgeDeprecatedLast.class, PurgeDisabledResources.class, PurgeResourceRoles.class, PurgeEventOrphans.class, 067 PurgePropertyOrphans.class, PeriodPurge.class, PurgeDependencies.class, PurgeOrphanReviews.class, 068 069 // post-job 070 PurgeRunner.class); 071 } 072 }