continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r679588 [1/8] - in /continuum/branches/CONTINUUM-782: ./ continuum-api/ continuum-api/src/main/java/org/apache/continuum/purge/ continuum-api/src/main/java/org/apache/continuum/purge/controller/ continuum-api/src/main/java/org/apache/contin...
Date Thu, 24 Jul 2008 22:31:26 GMT
Author: olamy
Date: Thu Jul 24 15:31:19 2008
New Revision: 679588

URL: http://svn.apache.org/viewvc?rev=679588&view=rev
Log:
[CONTINUUM-782] Add a feature to allow cleaning the m2 local repo once every N days
Submitted by Maria Catherine Tan


Added:
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/controller/
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/content/
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/purge/
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/repository/
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/repository/DefaultRepositoryService.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/ContinuumPurgeJob.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-core/src/test/java/org/apache/continuum/
    continuum/branches/CONTINUUM-782/continuum-core/src/test/java/org/apache/continuum/purge/
    continuum/branches/CONTINUUM-782/continuum-core/src/test/java/org/apache/continuum/purge/DefaultContinuumPurgeManagerTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-core/src/test/java/org/apache/continuum/repository/
    continuum/branches/CONTINUUM-782/continuum-core/src/test/java/org/apache/continuum/repository/DefaultRepositoryServiceTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-core/src/test/resources/org/apache/continuum/
    continuum/branches/CONTINUUM-782/continuum-core/src/test/resources/org/apache/continuum/purge/
    continuum/branches/CONTINUUM-782/continuum-core/src/test/resources/org/apache/continuum/purge/DefaultContinuumPurgeManagerTest.xml   (with props)
    continuum/branches/CONTINUUM-782/continuum-core/src/test/resources/org/apache/continuum/repository/
    continuum/branches/CONTINUUM-782/continuum-core/src/test/resources/org/apache/continuum/repository/DefaultRepositoryServiceTest.xml   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/
    continuum/branches/CONTINUUM-782/continuum-purge-07242008.patch   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/pom.xml   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/ContinuumPurgeConstants.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/DefaultPurgeConfigurationService.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/controller/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/controller/DirectoryPurgeController.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/controller/RepositoryPurgeController.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/executor/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/executor/AbstractContinuumPurgeExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/content/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/content/ManagedDefaultRepositoryContent.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/content/ManagedLegacyRepositoryContent.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/scanner/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/scanner/DefaultRepositoryScanner.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScannerInstance.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/utils/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/utils/FileTypes.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/utils/FilenameParser.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/repository/utils/LegacyPathParser.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/task/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/task/PurgeTask.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/java/org/apache/continuum/purge/task/PurgeTaskExecutor.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/resources/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/resources/META-INF/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/resources/META-INF/plexus/
    continuum/branches/CONTINUUM-782/continuum-purge/src/main/resources/META-INF/plexus/components.xml   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/AbstractPurgeTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/DefaultPurgeConfigurationServiceTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/continuum/
    continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/continuum/web/action/
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/org/apache/continuum/
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/org/apache/continuum/web/
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/org/apache/continuum/web/action/
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/org/apache/continuum/web/action/admin/
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/org/apache/continuum/web/action/admin/LocalRepositoryAction-saveRepository-validation.xml   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/org/apache/continuum/web/action/admin/LocalRepositoryAction.properties   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/org/apache/continuum/web/action/admin/PurgeConfigurationAction-savePurgeConfig-validation.xml   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/org/apache/continuum/web/action/admin/PurgeConfigurationAction.properties   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/confirmDeleteLocalRepository.jsp   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editLocalRepository.jsp   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/editPurgeConfiguration.jsp   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/localRepositoriesList.jsp   (with props)
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/purgeConfigurationsList.jsp   (with props)
Modified:
    continuum/branches/CONTINUUM-782/continuum-api/pom.xml
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
    continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    continuum/branches/CONTINUUM-782/continuum-core/pom.xml
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/core/action/DeployArtifactContinuumAction.java
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m1/MavenOneBuildExecutor.java
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenBuilderHelper.java
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/MavenTwoBuildExecutor.java
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
    continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    continuum/branches/CONTINUUM-782/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    continuum/branches/CONTINUUM-782/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
    continuum/branches/CONTINUUM-782/continuum-data-management/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java
    continuum/branches/CONTINUUM-782/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
    continuum/branches/CONTINUUM-782/continuum-model/pom.xml
    continuum/branches/CONTINUUM-782/continuum-model/src/main/mdo/continuum.xml
    continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
    continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
    continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java
    continuum/branches/CONTINUUM-782/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
    continuum/branches/CONTINUUM-782/continuum-security/src/main/resources/META-INF/redback/redback.xml
    continuum/branches/CONTINUUM-782/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    continuum/branches/CONTINUUM-782/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
    continuum/branches/CONTINUUM-782/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/continuum/web/startup/ContinuumStartup.java
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/mdo/view-models.mdo
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/META-INF/plexus/application.xml
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/resources/xwork.xml
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/groupSummary.jsp
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/navigations/Menu.jsp
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/projectGroupAdd.jsp
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/projectGroupEdit.jsp
    continuum/branches/CONTINUUM-782/continuum-webapp/src/main/webapp/WEB-INF/jsp/projectGroupSummary.jsp
    continuum/branches/CONTINUUM-782/pom.xml

Modified: continuum/branches/CONTINUUM-782/continuum-api/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/pom.xml?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/pom.xml (original)
+++ continuum/branches/CONTINUUM-782/continuum-api/pom.xml Thu Jul 24 15:31:19 2008
@@ -55,5 +55,15 @@
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-common</artifactId>
+      <version>${archiva.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-layer</artifactId>
+      <version>${archiva.version}</version>
+    </dependency>
   </dependencies>
 </project>
\ No newline at end of file

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,105 @@
+package org.apache.continuum.purge;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
+import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
+import org.apache.maven.continuum.model.project.Schedule;
+
+/**
+ * @author Maria Catherine Tan
+ */
+public interface ContinuumPurgeManager
+{   
+    String ROLE = ContinuumPurgeManager.class.getName();
+    
+    /**
+     * Purge repositories and directories 
+     * @param schedule
+     * @throws ContinuumPurgeManagerException
+     */
+    void purge( Schedule schedule )
+        throws ContinuumPurgeManagerException;
+    
+    /**
+     * Purge repository
+     * @param repoPurgeConfig
+     * @throws ContinuumPurgeManagerException
+     */
+    void purgeRepository( RepositoryPurgeConfiguration repoPurgeConfig )
+        throws ContinuumPurgeManagerException;
+    
+    /**
+     * Purge directory 
+     * @param dirPurgeConfig
+     * @throws ContinuumPurgeManagerException
+     */
+    void purgeDirectory( DirectoryPurgeConfiguration dirPurgeConfig )
+        throws ContinuumPurgeManagerException;
+    
+    /**
+     * Check if the repository is already in the purging queue
+     * 
+     * @param repositoryId the id of the repository purge configuration
+     * @return true if the repository is in the purging queue, otherwise false
+     * @throws ContinuumPurgeManagerException
+     */
+    boolean isRepositoryInPurgeQueue( int repositoryId )
+        throws ContinuumPurgeManagerException;
+    
+    /**
+     * Check if the repository is being used by a project that is currently building
+     * 
+     * @param repositoryId the id of the local repository
+     * @return true if the repository is in use, otherwise false
+     * @throws ContinuumPurgeManagerException
+     */
+    boolean isRepositoryInUse( int repositoryId )
+        throws ContinuumPurgeManagerException;
+
+    /**
+     * Remove local repository from the purge queue
+     * 
+     * @param repositoryId the id of the local repository
+     * @throws ContinuumPurgeManagerException
+     */
+    void removeRepositoryFromPurgeQueue( int repositoryId )
+        throws ContinuumPurgeManagerException;
+    
+    /**
+     * Remove local repository from the purge queue
+     * 
+     * @param purgeConfigId the id of the purge configuration
+     * @return true if the purge configuration was successfully removed from the purge queue, otherwise false
+     * @throws ContinuumPurgeManagerException
+     */
+    boolean removeFromPurgeQueue( int purgeConfigId )
+        throws ContinuumPurgeManagerException;
+    
+    /**
+     * Remove local repositories from the purge queue
+     * 
+     * @param purgeConfigIds the ids of the purge configuration
+     * @return true if the purge configurations were successfully removed from the purge queue, otherwise false
+     * @throws ContinuumPurgeManagerException
+     */
+    boolean removeFromPurgeQueue( int[] purgeConfigIds )
+        throws ContinuumPurgeManagerException;
+}

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,42 @@
+package org.apache.continuum.purge;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class ContinuumPurgeManagerException
+    extends Exception
+{
+    public ContinuumPurgeManagerException( String message )
+    {
+        super( message );
+    }
+    
+    public ContinuumPurgeManagerException( Throwable cause )
+    {
+        super( cause );
+    }
+    
+    public ContinuumPurgeManagerException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}
\ No newline at end of file

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,96 @@
+package org.apache.continuum.purge;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.continuum.model.repository.AbstractPurgeConfiguration;
+import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
+import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
+import org.apache.continuum.purge.repository.content.RepositoryManagedContent;
+
+/**
+ * @author Maria Catherine Tan
+ */
+public interface PurgeConfigurationService
+{
+    String ROLE = PurgeConfigurationService.class.getName();
+    
+    AbstractPurgeConfiguration addPurgeConfiguration( AbstractPurgeConfiguration purgeConfig )
+        throws PurgeConfigurationServiceException;
+    
+    void updatePurgeConfiguration( AbstractPurgeConfiguration purgeConfig )
+        throws PurgeConfigurationServiceException;
+
+    void removePurgeConfiguration( int purgeConfigId )
+        throws PurgeConfigurationServiceException;
+    
+    RepositoryPurgeConfiguration addRepositoryPurgeConfiguration( RepositoryPurgeConfiguration repoPurge )
+        throws PurgeConfigurationServiceException;
+    
+    void updateRepositoryPurgeConfiguration( RepositoryPurgeConfiguration repoPurge )
+        throws PurgeConfigurationServiceException;
+    
+    void removeRepositoryPurgeConfiguration( RepositoryPurgeConfiguration repoPurge )
+        throws PurgeConfigurationServiceException;
+    
+    RepositoryPurgeConfiguration getRepositoryPurgeConfiguration( int repoPurgeId )
+        throws PurgeConfigurationServiceException;
+    
+    RepositoryPurgeConfiguration getDefaultPurgeConfigurationForRepository( int repositoryId );
+    
+    List<RepositoryPurgeConfiguration> getRepositoryPurgeConfigurationsBySchedule( int scheduleId );
+    
+    List<RepositoryPurgeConfiguration> getRepositoryPurgeConfigurationsByRepository( int repositoryId );
+    
+    List<RepositoryPurgeConfiguration> getAllRepositoryPurgeConfigurations();
+    
+    DirectoryPurgeConfiguration addDirectoryPurgeConfiguration( DirectoryPurgeConfiguration dirPurge )
+        throws PurgeConfigurationServiceException;
+    
+    void updateDirectoryPurgeConfiguration( DirectoryPurgeConfiguration dirPurge )
+        throws PurgeConfigurationServiceException;
+    
+    void removeDirectoryPurgeConfiguration( DirectoryPurgeConfiguration dirPurge )
+        throws PurgeConfigurationServiceException;
+    
+    DirectoryPurgeConfiguration getDirectoryPurgeConfiguration( int dirPurgeId )
+        throws PurgeConfigurationServiceException;
+    
+    DirectoryPurgeConfiguration getDefaultPurgeConfigurationForDirectoryType( String directoryType );
+    
+    List<DirectoryPurgeConfiguration> getDirectoryPurgeConfigurationsBySchedule( int scheduleId );
+    
+    List<DirectoryPurgeConfiguration> getDirectoryPurgeConfigurationsByLocation( String location );
+    
+    List<DirectoryPurgeConfiguration> getAllDirectoryPurgeConfigurations();
+    
+    List<AbstractPurgeConfiguration> getAllPurgeConfigurations();
+    
+    AbstractPurgeConfiguration getPurgeConfiguration( int purgeConfigId );
+    
+    /**
+     * @param repositoryId
+     * @return
+     * @throws PurgeConfigurationServiceException
+     */
+    RepositoryManagedContent getManagedRepositoryContent( int repositoryId)
+        throws PurgeConfigurationServiceException;
+}

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,42 @@
+package org.apache.continuum.purge;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class PurgeConfigurationServiceException
+    extends Exception
+{
+    public PurgeConfigurationServiceException( String message )
+    {
+        super( message );
+    }
+    
+    public PurgeConfigurationServiceException( Throwable cause )
+    {
+        super( cause );
+    }
+    
+    public PurgeConfigurationServiceException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,36 @@
+package org.apache.continuum.purge.controller;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.model.repository.AbstractPurgeConfiguration;
+import org.apache.continuum.purge.executor.ContinuumPurgeExecutorException;
+
+/**
+ * @author Maria Catherine Tan
+ */
+public interface PurgeController
+{
+    String ROLE = PurgeController.class.getName();
+    
+    void initializeExecutors( AbstractPurgeConfiguration purgeConfig )
+        throws ContinuumPurgeExecutorException;
+    
+    void doPurge( String path );
+}

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,32 @@
+package org.apache.continuum.purge.executor;
+
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Maria Catherine Tan
+ */
+public interface ContinuumPurgeExecutor
+{
+    String ROLE = ContinuumPurgeExecutor.class.getName();
+    
+    void purge( String path )
+        throws ContinuumPurgeExecutorException;
+}
\ No newline at end of file

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,42 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class ContinuumPurgeExecutorException
+    extends Exception
+{
+    public ContinuumPurgeExecutorException( String message )
+    {
+        super( message );
+    }
+    
+    public ContinuumPurgeExecutorException( Throwable cause )
+    {
+        super( cause );
+    }
+    
+    public ContinuumPurgeExecutorException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}
\ No newline at end of file

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,182 @@
+package org.apache.continuum.purge.repository.content;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.Set;
+
+import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.ProjectReference;
+import org.apache.maven.archiva.model.VersionedReference;
+import org.apache.maven.archiva.repository.ContentNotFoundException;
+import org.apache.maven.archiva.repository.layout.LayoutException;
+
+/**
+ * Taken from Archiva's ManagedRepositoryContent interface and made some few changes.
+ */
+public interface RepositoryManagedContent
+{
+    /**
+     * Delete from the local repository all files / directories associated with the
+     * provided version reference.
+     * 
+     * @param reference the version reference to delete.
+     * @throws ContentNotFoundException 
+     */
+    public void deleteVersion( VersionedReference reference )
+        throws ContentNotFoundException;
+    
+    /**
+     * <p>
+     * Convenience method to get the repository id.
+     * </p>
+     * 
+     * <p>
+     * Equivalent to calling <code>.getRepository().getId()</code>
+     * </p>
+     * 
+     * @return the repository id.
+     */
+    public int getId();
+    
+    /**
+     * <p>
+     * Gather up the list of related artifacts to the ArtifactReference provided.
+     * This typically inclues the pom files, and those things with 
+     * classifiers (such as doc, source code, test libs, etc...)
+     * </p>
+     * 
+     * <p>
+     * <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query.
+     * </p> 
+     * 
+     * @param reference the reference to work off of.
+     * @return the set of ArtifactReferences for related artifacts.
+     * @throws ContentNotFoundException if the initial artifact reference does not exist within the repository.
+     * @throws LayoutException 
+     */
+    public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
+        throws ContentNotFoundException, LayoutException;
+
+    /**
+     * <p>
+     * Convenience method to get the repository (on disk) root directory.
+     * </p>
+     * 
+     * <p>
+     * Equivalent to calling <code>.getLocalRepository().getDirectory()</code>
+     * </p>
+     * 
+     * @return the repository (on disk) root directory.
+     */
+    public String getRepoRoot();
+
+    /**
+     * Get the local repository associated with this
+     * repository content.
+     * 
+     * @return the local repository that is associated with this repository content.
+     */
+    public LocalRepository getRepository();
+
+    /**
+     * Given a specific {@link ProjectReference}, return the list of available versions for
+     * that project reference.
+     * 
+     * @param reference the project reference to work off of.
+     * @return the list of versions found for that project reference.
+     * @throws ContentNotFoundException if the project reference does not exist within the repository.
+     * @throws LayoutException 
+     */
+    public Set<String> getVersions( ProjectReference reference )
+        throws ContentNotFoundException, LayoutException;
+
+    /**
+     * <p>
+     * Given a specific {@link VersionedReference}, return the list of available versions for that
+     * versioned reference.
+     * </p>
+     * 
+     * <p>
+     * <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs.
+     * </p>
+     * 
+     * @param reference the versioned reference to work off of.
+     * @return the set of versions found.
+     * @throws ContentNotFoundException if the versioned reference does not exist within the repository.
+     * @throws LayoutException 
+     */
+    public Set<String> getVersions( VersionedReference reference )
+        throws ContentNotFoundException, LayoutException;
+    
+    /**
+     * Set the local repository to associate with this
+     * repository content.
+     * 
+     * @param repo the repository to associate with this repository content.
+     */
+    public void setRepository( LocalRepository repo );
+
+    /**
+     * Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path.
+     *
+     * @param path the path relative to the repository base dir for the artifact.
+     * @return the {@link ArtifactReference} representing the path.  (or null if path cannot be converted to
+     *         a {@link ArtifactReference})
+     * @throws LayoutException if there was a problem converting the path to an artifact.
+     */
+    public ArtifactReference toArtifactReference( String path )
+        throws LayoutException;
+
+    /**
+     * Given an {@link ArtifactReference}, return the file reference to the artifact.
+     *
+     * @param reference the artifact reference to use.
+     * @return the relative path to the artifact.
+     */
+    public File toFile( ArtifactReference reference );
+
+    /**
+     * Given a {@link ProjectReference}, return the path to the metadata for
+     * the project. 
+     * 
+     * @param reference the reference to use.
+     * @return the path to the metadata file, or null if no metadata is appropriate.
+     */
+    public String toMetadataPath( ProjectReference reference );
+
+    /**
+     * Given a {@link VersionedReference}, return the path to the metadata for
+     * the specific version of the project. 
+     * 
+     * @param reference the reference to use.
+     * @return the path to the metadata file, or null if no metadata is appropriate.
+     */
+    public String toMetadataPath( VersionedReference reference );
+
+    /**
+     * Given an {@link ArtifactReference}, return the relative path to the artifact.
+     *
+     * @param reference the artifact reference to use.
+     * @return the relative path to the artifact.
+     */
+    public String toPath( ArtifactReference reference );
+}
\ No newline at end of file

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,62 @@
+package org.apache.continuum.purge.repository.scanner;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.purge.controller.PurgeController;
+import org.apache.continuum.purge.executor.ContinuumPurgeExecutorException;
+
+/**
+ * Codes were taken from Archiva and made some changes.
+ */
+public interface RepositoryScanner
+{
+    /**
+     * <p>
+     * Typical Ignorable Content patterns.
+     * </p>
+     */
+    public static final String[] IGNORABLE_CONTENT = {
+        "bin/**",
+        "reports/**",
+        ".index",
+        ".reports/**",
+        ".maven/**",
+        "**/.svn/**",
+        "**/*snapshot-version",
+        "*/website/**",
+        "*/licences/**",
+        "**/.htaccess",
+        "**/*.html",
+        "**/*.txt",
+        "**/README*",
+        "**/CHANGELOG*",
+        "**/KEYS*" +
+        "**/*.xml*" };
+    
+    public void scan( LocalRepository repository, PurgeController purgeController )
+        throws ContinuumPurgeExecutorException;
+    
+    public void scan( LocalRepository repository, PurgeController purgeController,
+                      List<String> ignoredContentPatterns )
+        throws ContinuumPurgeExecutorException;
+}
\ No newline at end of file

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,99 @@
+package org.apache.continuum.repository;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.continuum.model.repository.LocalRepository;
+
+/**
+ * @author Maria Catherine Tan
+ */
+public interface RepositoryService
+{
+    String ROLE = RepositoryService.class.getName();
+    
+    // ------------------------------------------------------
+    //  LocalRepository
+    // ------------------------------------------------------
+    
+    /**
+     * Add the local repository
+     * 
+     * @param repository the local repository to add
+     * @return LocalRepository the local repository
+     * @throws RepositoryServiceException
+     */
+    LocalRepository addLocalRepository( LocalRepository repository )
+        throws RepositoryServiceException;
+
+    /**
+     * Update the local repository
+     * 
+     * @param repository the local repository to update
+     * @throws RepositoryServiceException
+     */
+    void updateLocalRepository( LocalRepository repository )
+        throws RepositoryServiceException;
+
+    /**
+     * Remove the local repository
+     * 
+     * @param repositoryId the id of the local repository to remove
+     * @throws RepositoryServiceException
+     */
+    void removeLocalRepository( int repositoryId )
+        throws RepositoryServiceException;
+
+    /**
+     * Retrieve all local repositories
+     * 
+     * @return list of all local repositories
+     */
+    List<LocalRepository> getAllLocalRepositories();
+    
+    /**
+     * Retrieve local repository
+     * 
+     * @param location the system file path of the repository
+     * @return LocalRepository the local repository
+     * @throws RepositoryServiceException
+     */
+    LocalRepository getLocalRepositoryByLocation( String location )
+        throws RepositoryServiceException;
+    
+    /**
+     * Retrieve list of local repositories with the specified layout
+     * @param layout the layout of the repository. "default" or "legacy"
+     * @return List of local repositories
+     * @throws RepositoryServiceException
+     */
+    List<LocalRepository> getLocalRepositoriesByLayout( String layout );
+    
+    /**
+     * Retrieve local repository
+     * 
+     * @param repositoryId the id of the local repository
+     * @return LocalRepository the local repository
+     * @throws RepositoryServiceException
+     */
+    LocalRepository getLocalRepository( int repositoryId )
+        throws RepositoryServiceException;
+}
\ No newline at end of file

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Added: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,42 @@
+package org.apache.continuum.repository;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class RepositoryServiceException
+    extends Exception
+{
+    public RepositoryServiceException( String message )
+    {
+        super( message );
+    }
+    
+    public RepositoryServiceException( Throwable cause )
+    {
+        super( cause );
+    }
+    
+    public RepositoryServiceException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id

Modified: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java (original)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java Thu Jul 24 15:31:19 2008
@@ -24,6 +24,8 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.continuum.purge.ContinuumPurgeManager;
+import org.apache.continuum.repository.RepositoryService;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionService;
 import org.apache.maven.continuum.buildqueue.BuildProjectTask;
 import org.apache.maven.continuum.configuration.ConfigurationService;
@@ -96,6 +98,8 @@
     public ProjectGroup getProjectGroupByGroupIdWithBuildDetails( String groupId )
         throws ContinuumException;
 
+    public List<ProjectGroup> getAllProjectGroupsWithRepository( int repositoryId );
+    
     // ----------------------------------------------------------------------
     // Project
     // ----------------------------------------------------------------------
@@ -632,6 +636,15 @@
 
     BuildDefinitionService getBuildDefinitionService();
     
+    // ----------------------------------------------------------------------
+    // Continuum Purge
+    // ----------------------------------------------------------------------
+    ContinuumPurgeManager getPurgeManager();
+    
+    // ----------------------------------------------------------------------
+    // Repository Service
+    // ----------------------------------------------------------------------
+    RepositoryService getRepositoryService();
     
     public void startup()
         throws ContinuumException;

Modified: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java (original)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java Thu Jul 24 15:31:19 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.maven.continuum.model.project.Project;
 
 import java.io.File;
@@ -94,4 +95,8 @@
     Map getReleaseResults();
 
     Map getListeners();
+    
+    void perform( String releaseId, File buildDirectory, String goals, boolean useReleaseProfile,
+                  ContinuumReleaseManagerListener listener, LocalRepository repository )
+        throws ContinuumReleaseException;
 }

Modified: continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java (original)
+++ continuum/branches/CONTINUUM-782/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java Thu Jul 24 15:31:19 2008
@@ -19,6 +19,9 @@
  * under the License.
  */
 
+import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
+import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -109,6 +112,8 @@
 
     List<BuildDefinition> getAllTemplates()
         throws ContinuumStoreException;
+    
+    List<BuildDefinition> getBuildDefinitionsBySchedule ( int scheduleId );
 
     // ------------------------------------------------------
     //  BuildDefinitionTemplate
@@ -163,7 +168,9 @@
 
     public ProjectGroup getProjectGroupByProjectId( int projectId )
         throws ContinuumObjectNotFoundException;
-
+    
+    public List<ProjectGroup> getProjectGroupByRepository( int repositoryId );
+    
     void updateProjectGroup( ProjectGroup group )
         throws ContinuumStoreException;
 
@@ -348,4 +355,77 @@
     Collection<ProjectGroup> getAllProjectGroupsWithTheLot();
 
     void eraseDatabase();
+    
+    // ----------------------------------------------------------------
+    // LocalRepository
+    // ----------------------------------------------------------------
+    
+    List<LocalRepository> getAllLocalRepositories();
+
+    List<LocalRepository> getLocalRepositoriesByLayout( String layout );
+
+    LocalRepository getLocalRepository( int repositoryId )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException;
+
+    LocalRepository getLocalRepositoryByName( String repositoryName )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException;
+    
+    LocalRepository getLocalRepositoryByLocation( String location )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException;
+    
+    LocalRepository addLocalRepository( LocalRepository repository )
+        throws ContinuumStoreException;
+    
+    void updateLocalRepository( LocalRepository repository )
+        throws ContinuumStoreException;
+    
+    void removeLocalRepository( LocalRepository repository )
+        throws ContinuumStoreException;
+    
+    // ----------------------------------------------------------------
+    // RepositoryPurgeConfiguration
+    // ----------------------------------------------------------------
+    
+    List<RepositoryPurgeConfiguration> getAllRepositoryPurgeConfigurations();
+    
+    List<RepositoryPurgeConfiguration> getRepositoryPurgeConfigurationsBySchedule( int scheduleId );
+
+    List<RepositoryPurgeConfiguration> getRepositoryPurgeConfigurationsByLocalRepository( int repositoryId );
+    
+    RepositoryPurgeConfiguration getRepositoryPurgeConfiguration( int configurationId )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException;
+    
+    RepositoryPurgeConfiguration addRepositoryPurgeConfiguration( RepositoryPurgeConfiguration purgeConfiguration )
+        throws ContinuumStoreException;
+    
+    void updateRepositoryPurgeConfiguration( RepositoryPurgeConfiguration purgeConfiguration )
+        throws ContinuumStoreException;
+    
+    void removeRepositoryPurgeConfiguration( RepositoryPurgeConfiguration purgeConfiguration )
+        throws ContinuumStoreException;
+
+    
+    // ----------------------------------------------------------------
+    // DirectoryPurgeConfiguration
+    // ----------------------------------------------------------------
+    
+    List<DirectoryPurgeConfiguration> getAllDirectoryPurgeConfigurations();
+    
+    List<DirectoryPurgeConfiguration> getDirectoryPurgeConfigurationsBySchedule( int scheduleId );
+    
+    List<DirectoryPurgeConfiguration> getDirectoryPurgeConfigurationsByLocation( String location );
+    
+    List<DirectoryPurgeConfiguration> getDirectoryPurgeConfigurationsByType( String type );
+    
+    DirectoryPurgeConfiguration getDirectoryPurgeConfiguration( int configurationId )
+        throws ContinuumStoreException, ContinuumObjectNotFoundException;
+    
+    DirectoryPurgeConfiguration addDirectoryPurgeConfiguration( DirectoryPurgeConfiguration purgeConfiguration )
+        throws ContinuumStoreException;
+    
+    void updateDirectoryPurgeConfiguration( DirectoryPurgeConfiguration purgeConfiguration )
+        throws ContinuumStoreException;
+    
+    void removeDirectoryPurgeConfiguration( DirectoryPurgeConfiguration purgeConfiguration )
+        throws ContinuumStoreException;
 }

Modified: continuum/branches/CONTINUUM-782/continuum-core/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-core/pom.xml?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-core/pom.xml (original)
+++ continuum/branches/CONTINUUM-782/continuum-core/pom.xml Thu Jul 24 15:31:19 2008
@@ -150,6 +150,20 @@
       <groupId>org.codehaus.plexus.redback</groupId>
       <artifactId>redback-rbac-role-manager</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-purge</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-common</artifactId>
+      <version>${archiva.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-layer</artifactId>
+      <version>${archiva.version}</version>
+    </dependency>
     <!-- === Testing Dependencies === -->
     <dependency>
       <groupId>hsqldb</groupId>
@@ -231,7 +245,7 @@
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
       <scope>test</scope>
-    </dependency>            
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Added: continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,330 @@
+package org.apache.continuum.purge;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
+import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
+import org.apache.continuum.purge.ContinuumPurgeManager;
+import org.apache.continuum.purge.ContinuumPurgeManagerException;
+import org.apache.continuum.purge.PurgeConfigurationService;
+import org.apache.continuum.purge.task.PurgeTask;
+import org.apache.maven.continuum.buildqueue.BuildProjectTask;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.Schedule;
+import org.apache.maven.continuum.release.tasks.PerformReleaseProjectTask;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.taskqueue.Task;
+import org.codehaus.plexus.taskqueue.TaskQueue;
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
+
+/**
+ * DefaultContinuumPurgeManager
+ * 
+ * @author Maria Catherine Tan
+ * @plexus.component role="org.apache.continuum.purge.ContinuumPurgeManager" role-hint="default"
+ */
+public class DefaultContinuumPurgeManager
+    implements ContinuumPurgeManager, Contextualizable
+{
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    private ContinuumStore store;
+    
+    /**
+     * @plexus.requirement role-hint="purge"
+     */
+    private TaskQueue purgeQueue;
+    
+    /**
+     * @plexus.requirement
+     */
+    private PurgeConfigurationService purgeConfigurationService;
+    
+    private PlexusContainer container;
+    
+    public void purge( Schedule schedule )
+        throws ContinuumPurgeManagerException
+    {
+        List<RepositoryPurgeConfiguration> repoPurgeList = null;
+        List<DirectoryPurgeConfiguration> dirPurgeList = null;
+        
+        repoPurgeList = purgeConfigurationService.getRepositoryPurgeConfigurationsBySchedule( schedule.getId() );
+        dirPurgeList = purgeConfigurationService.getDirectoryPurgeConfigurationsBySchedule( schedule.getId() );
+
+        if ( repoPurgeList != null && repoPurgeList.size() > 0 )
+        {
+            for ( RepositoryPurgeConfiguration repoPurge : repoPurgeList )
+            {
+                purgeRepository( repoPurge );
+            }
+        }
+        
+        if ( dirPurgeList != null && dirPurgeList.size() > 0 )
+        {
+            for ( DirectoryPurgeConfiguration dirPurge : dirPurgeList )
+            {
+                purgeDirectory( dirPurge );
+            }
+        }
+    }
+    
+    public boolean isRepositoryInPurgeQueue( int repositoryId )
+        throws ContinuumPurgeManagerException
+    {
+        List<RepositoryPurgeConfiguration> repoPurgeConfigs = 
+            purgeConfigurationService.getRepositoryPurgeConfigurationsByRepository( repositoryId );
+            
+        for ( RepositoryPurgeConfiguration repoPurge : repoPurgeConfigs )
+        {
+            if ( isInPurgeQueue( repoPurge.getId() ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    public boolean isRepositoryInUse( int repositoryId )
+        throws ContinuumPurgeManagerException
+    {
+        try
+        {
+            Task task = getCurrentTask( "build-project" );
+        
+            if ( task != null && task instanceof BuildProjectTask )
+            {
+                int projectId = ((BuildProjectTask) task).getProjectId();
+        
+                Project project = store.getProject( projectId );
+                LocalRepository repository = project.getProjectGroup().getLocalRepository();
+                
+                if ( repository != null && repository.getId() == repositoryId )
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumPurgeManagerException( e.getMessage(), e );
+        }
+    }
+
+    public void removeRepositoryFromPurgeQueue( int repositoryId )
+        throws ContinuumPurgeManagerException
+    {
+        List<RepositoryPurgeConfiguration> repoPurgeConfigs = 
+            purgeConfigurationService.getRepositoryPurgeConfigurationsByRepository( repositoryId );
+            
+        for ( RepositoryPurgeConfiguration repoPurge : repoPurgeConfigs )
+        {
+            removeFromPurgeQueue( repoPurge.getId() );
+        }
+    }
+    
+    public boolean removeFromPurgeQueue( int[] purgeConfigIds )
+        throws ContinuumPurgeManagerException
+    {
+        if ( purgeConfigIds == null )
+        {
+            return false;
+        }
+        
+        if ( purgeConfigIds.length < 1 )
+        {
+            return false;
+        }
+        
+        List<PurgeTask> queue = getAllPurgeConfigurationsInPurgeQueue();
+        
+        List<PurgeTask> tasks = new ArrayList<PurgeTask>();
+        
+        for ( PurgeTask task : queue )
+        {
+            if ( task != null )
+            {
+                if ( ArrayUtils.contains( purgeConfigIds, task.getPurgeConfigurationId() ) )
+                {
+                    tasks.add( task );
+                }
+            }
+        }
+        
+        if ( !tasks.isEmpty() )
+        {
+            return purgeQueue.removeAll( tasks );
+        }
+    
+        return false;
+    }
+    
+    public boolean removeFromPurgeQueue( int purgeConfigId )
+        throws ContinuumPurgeManagerException
+    {
+        List<PurgeTask> queue = getAllPurgeConfigurationsInPurgeQueue();
+        
+        for ( PurgeTask task : queue )
+        {
+            if ( task != null && task.getPurgeConfigurationId() == purgeConfigId )
+            {
+                return purgeQueue.remove( task );
+            }
+        }
+        return false;
+    }
+
+    public void purgeRepository( RepositoryPurgeConfiguration repoPurge )
+        throws ContinuumPurgeManagerException
+    {
+        try
+        {
+            LocalRepository repository = repoPurge.getRepository();
+            
+            // do not purge if repository is in use and if repository is already in purge queue
+            if ( !isRepositoryInUse( repository.getId() ) && 
+                 !isInPurgeQueue( repoPurge.getId() ) )
+            {
+                purgeQueue.put( new PurgeTask( repoPurge.getId() ) );
+            }
+        }
+        catch ( TaskQueueException e )
+        {
+            throw new ContinuumPurgeManagerException( "Error while enqueuing repository", e );
+        }
+    }
+    
+    public void purgeDirectory( DirectoryPurgeConfiguration dirPurge )
+        throws ContinuumPurgeManagerException
+    {
+        try
+        {
+            if ( "releases".equals( dirPurge.getDirectoryType() ) )
+            {
+                // do not purge if release in progress
+                if ( !releaseInProgress() && !isInPurgeQueue( dirPurge.getId() ) )
+                {
+                    purgeQueue.put( new PurgeTask( dirPurge.getId() ) );
+                }
+            }
+            else if ( "buildOutput".equals( dirPurge.getDirectoryType() ) )
+            {
+                // do not purge if build in progress
+                if ( !buildInProgress() && !isInPurgeQueue( dirPurge.getId() ) )
+                {
+                    purgeQueue.put(  new PurgeTask( dirPurge.getId() ) );
+                }
+            }
+            
+        }
+        catch ( TaskQueueException e )
+        {
+            throw new ContinuumPurgeManagerException( "Error while enqueuing repository", e );
+        }
+    }
+    
+    public void contextualize( Context context )
+        throws ContextException
+    {
+        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+    }
+
+    private boolean isInPurgeQueue( int purgeConfigId )
+        throws ContinuumPurgeManagerException
+    {
+        List<PurgeTask> queue = getAllPurgeConfigurationsInPurgeQueue();
+        
+        for ( PurgeTask task : queue )
+        {
+            if ( task != null && task.getPurgeConfigurationId() == purgeConfigId)
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    private List<PurgeTask> getAllPurgeConfigurationsInPurgeQueue()
+        throws ContinuumPurgeManagerException
+    {
+        try
+        {
+            return purgeQueue.getQueueSnapshot();
+        }
+        catch ( TaskQueueException e )
+        {
+            throw new ContinuumPurgeManagerException( "Error while getting the purge configs in purge queue", e );
+        }
+    }
+    
+    private Task getCurrentTask( String task )
+        throws ContinuumPurgeManagerException
+    {
+        try
+        {
+            TaskQueueExecutor executor = (TaskQueueExecutor) container.lookup( TaskQueueExecutor.class, task );
+            return executor.getCurrentTask();
+        }
+        catch ( ComponentLookupException e )
+        {
+            throw new ContinuumPurgeManagerException( "Unable to lookup current task", e );
+        }
+    }
+    
+    private boolean buildInProgress() 
+        throws ContinuumPurgeManagerException
+    {
+        Task task = getCurrentTask( "build-project" );
+        
+        if ( task != null && task instanceof BuildProjectTask )
+        {
+            return true;
+        }
+        
+        return false;
+    }
+    
+    private boolean releaseInProgress()
+        throws ContinuumPurgeManagerException
+    {
+        Task task = getCurrentTask( "perform-release" );
+        
+        if ( task != null && task instanceof PerformReleaseProjectTask )
+        {
+            return true;
+        }
+        
+        return false;
+    }
+}
\ No newline at end of file

Propchange: continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/branches/CONTINUUM-782/continuum-core/src/main/java/org/apache/continuum/purge/DefaultContinuumPurgeManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Revision Id



Mime
View raw message