You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ol...@apache.org on 2008/07/25 00:31:26 UTC
svn commit: r679588 [3/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...
Added: continuum/branches/CONTINUUM-782/continuum-purge-07242008.patch
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge-07242008.patch?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge-07242008.patch (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge-07242008.patch Thu Jul 24 15:31:19 2008
@@ -0,0 +1,11571 @@
+Index: continuum-model/src/main/mdo/continuum.xml
+===================================================================
+--- continuum-model/src/main/mdo/continuum.xml (revision 679233)
++++ continuum-model/src/main/mdo/continuum.xml (working copy)
+@@ -75,6 +75,30 @@
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
++ <field>
++ <name>localRepositories</name>
++ <version>1.1.1+</version>
++ <association>
++ <type>LocalRepository</type>
++ <multiplicity>*</multiplicity>
++ </association>
++ </field>
++ <field>
++ <name>repositoryPurgeConfigurations</name>
++ <version>1.1.1+</version>
++ <association>
++ <type>RepositoryPurgeConfiguration</type>
++ <multiplicity>*</multiplicity>
++ </association>
++ </field>
++ <field>
++ <name>directoryPurgeConfigurations</name>
++ <version>1.1.1+</version>
++ <association>
++ <type>DirectoryPurgeConfiguration</type>
++ <multiplicity>*</multiplicity>
++ </association>
++ </field>
+ </fields>
+ </class>
+
+@@ -128,6 +152,13 @@
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
++ <field>
++ <name>localRepository</name>
++ <version>1.1.1+</version>
++ <association xml.reference="true" stash.part="true" jpox.dependent="false">
++ <type>LocalRepository</type>
++ </association>
++ </field>
+ </fields>
+ </class>
+
+@@ -1281,5 +1312,156 @@
+ </codeSegment>
+ </codeSegments>
+ </class>
++ <class>
++ <name>LocalRepository</name>
++ <version>1.1.1+</version>
++ <packageName>org.apache.continuum.model.repository</packageName>
++ <fields>
++ <field>
++ <name>id</name>
++ <version>1.1.1+</version>
++ <type>int</type>
++ <identifier>true</identifier>
++ </field>
++ <field>
++ <name>name</name>
++ <version>1.1.1+</version>
++ <type>String</type>
++ <required>true</required>
++ </field>
++ <field jpox.column="repoLocation">
++ <name>location</name>
++ <version>1.1.1+</version>
++ <type>String</type>
++ <required>true</required>
++ <description>
++ The file system location for this repository
++ </description>
++ </field>
++ <field>
++ <name>layout</name>
++ <version>1.1.1+</version>
++ <type>String</type>
++ <defaultValue>default</defaultValue>
++ <description>
++ The layout of the repository. Valid values are "default" and "legacy"
++ </description>
++ </field>
++ </fields>
++ </class>
++
++ <class>
++ <name>AbstractPurgeConfiguration</name>
++ <version>1.1.1+</version>
++ <abstract>true</abstract>
++ <packageName>org.apache.continuum.model.repository</packageName>
++ <fields>
++ <field>
++ <name>id</name>
++ <version>1.1.1+</version>
++ <identifier>true</identifier>
++ <type>int</type>
++ </field>
++ <field>
++ <name>description</name>
++ <version>1.1.1+</version>
++ <type>String</type>
++ </field>
++ <field>
++ <name>deleteAll</name>
++ <version>1.1.1+</version>
++ <type>boolean</type>
++ <defaultValue>false</defaultValue>
++ </field>
++ <field>
++ <name>retentionCount</name>
++ <version>1.1.1+</version>
++ <type>int</type>
++ <defaultValue>2</defaultValue>
++ <description>
++ The total count of the artifact for each snapshot or the release/build output folder to be retained.
++ </description>
++ </field>
++ <field>
++ <name>daysOlder</name>
++ <version>1.1.1+</version>
++ <type>int</type>
++ <defaultValue>100</defaultValue>
++ <description>
++ The number of days old which will be the basis for removing a snapshot or a folder.
++ </description>
++ </field>
++ <field>
++ <name>enabled</name>
++ <version>1.1.1+</version>
++ <type>boolean</type>
++ <defaultValue>true</defaultValue>
++ </field>
++ <field>
++ <name>schedule</name>
++ <version>1.1.1+</version>
++ <association xml.reference="true" stash.part="true" jpox.dependent="false">
++ <type>Schedule</type>
++ </association>
++ </field>
++ <field>
++ <name>defaultPurge</name>
++ <version>1.1.1+</version>
++ <type>boolean</type>
++ <defaultValue>false</defaultValue>
++ </field>
++ </fields>
++ </class>
++ <class>
++ <name>RepositoryPurgeConfiguration</name>
++ <version>1.1.1+</version>
++ <superClass>AbstractPurgeConfiguration</superClass>
++ <packageName>org.apache.continuum.model.repository</packageName>
++ <fields>
++ <field>
++ <name>repository</name>
++ <version>1.1.1+</version>
++ <association xml.reference="true" stash.part="true" jpox.dependent="false">
++ <type>LocalRepository</type>
++ </association>
++ <required>true</required>
++ </field>
++ <field>
++ <name>deleteReleasedSnapshots</name>
++ <version>1.1.1+</version>
++ <type>boolean</type>
++ <defaultValue>false</defaultValue>
++ <description>
++ True if the released snapshots are to be removed from the repo during repository purge.
++ </description>
++ </field>
++ </fields>
++ </class>
++ <class>
++ <name>DirectoryPurgeConfiguration</name>
++ <version>1.1.1+</version>
++ <superClass>AbstractPurgeConfiguration</superClass>
++ <packageName>org.apache.continuum.model.repository</packageName>
++ <fields>
++ <field jpox.column="directoryLocation">
++ <name>location</name>
++ <version>1.1.1+</version>
++ <type>String</type>
++ <description>
++ The file system path for this directory
++ </description>
++ <required>true</required>
++ </field>
++ <field>
++ <name>directoryType</name>
++ <version>1.1.1+</version>
++ <type>String</type>
++ <description>
++ The type of directory. Valid values are "releases" and "buildOutput"
++ </description>
++ </field>
++ </fields>
++ </class>
++
+ </classes>
+ </model>
+Index: continuum-model/pom.xml
+===================================================================
+--- continuum-model/pom.xml (revision 679233)
++++ continuum-model/pom.xml (working copy)
+@@ -63,7 +63,7 @@
+ </execution>
+ </executions>
+ <configuration>
+- <version>1.1.0</version>
++ <version>1.1.1</version>
+ <packageWithVersion>false</packageWithVersion>
+ <model>src/main/mdo/continuum.xml</model>
+ </configuration>
+Index: continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
+===================================================================
+--- continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java (revision 679233)
++++ continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java (working copy)
+@@ -117,4 +117,8 @@
+ public static final String CONTINUUM_MANAGE_QUEUES = "continuum-manage-queues";
+
+ public static final String CONTINUUM_VIEW_QUEUES = "continuum-view-queues";
++
++ public static final String CONTINUUM_MANAGE_REPOSITORIES = "continuum-manage-repositories";
++
++ public static final String CONTINUUM_MANAGE_PURGING = "continuum-manage-purging";
+ }
+Index: continuum-security/src/main/resources/META-INF/redback/redback.xml
+===================================================================
+--- continuum-security/src/main/resources/META-INF/redback/redback.xml (revision 679233)
++++ continuum-security/src/main/resources/META-INF/redback/redback.xml (working copy)
+@@ -155,6 +155,16 @@
+ <name>continuum-manage-profiles</name>
+ <description>Continuum Manage Installations</description>
+ </operation>
++ <operation>
++ <id>continuum-manage-repositories</id>
++ <name>continuum-manage-repositories</name>
++ <description>Continuum Manage Repositories</description>
++ </operation>
++ <operation>
++ <id>continuum-manage-purging</id>
++ <name>continuum-manage-purging</name>
++ <description>Continuum Manage Purging</description>
++ </operation>
+ </operations>
+ <roles>
+ <role>
+@@ -181,6 +191,8 @@
+ <childRole>continuum-manage-schedules</childRole>
+ <childRole>continuum-manage-build-templates</childRole>
+ <childRole>continuum-manage-queues</childRole>
++ <childRole>continuum-manage-repositories</childRole>
++ <childRole>continuum-manage-purging</childRole>
+ </childRoles>
+ </role>
+ <role>
+@@ -341,6 +353,36 @@
+ </permission>
+ </permissions>
+ </role>
++ <role>
++ <id>continuum-manage-repositories</id>
++ <name>continuum-manage-repositories</name>
++ <assignable>true</assignable>
++ <permanent>true</permanent>
++ <permissions>
++ <permission>
++ <id>continuum-manage-repositories</id>
++ <name>Manage Continuum Local Repositories</name>
++ <permanent>true</permanent>
++ <operation>continuum-manage-repositories</operation>
++ <resource>global</resource>
++ </permission>
++ </permissions>
++ </role>
++ <role>
++ <id>continuum-manage-purging</id>
++ <name>continuum-manage-purging</name>
++ <assignable>true</assignable>
++ <permanent>true</permanent>
++ <permissions>
++ <permission>
++ <id>continuum-manage-purging</id>
++ <name>Manage Continuum Purging</name>
++ <permanent>true</permanent>
++ <operation>continuum-manage-purging</operation>
++ <resource>global</resource>
++ </permission>
++ </permissions>
++ </role>
+ </roles>
+ <templates>
+ <template>
+@@ -366,6 +408,18 @@
+ <operation>user-management-role-grant</operation>
+ <resource>${resource}</resource>
+ </permission>
++ <permission>
++ <id>continuum-manage-repositories</id>
++ <name>Manage Continuum Local Repositories</name>
++ <operation>continuum-manage-repositories</operation>
++ <resource>global</resource>
++ </permission>
++ <permission>
++ <id>continuum-manage-purging</id>
++ <name>Manage Continuum Purging</name>
++ <operation>continuum-manage-purging</operation>
++ <resource>global</resource>
++ </permission>
+ </permissions>
+ <childTemplates>
+ <childTemplate>project-developer</childTemplate>
+Index: continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/repository/RepositoryServiceException.java (revision 0)
+@@ -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 );
++ }
++}
+Index: continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/repository/RepositoryService.java (revision 0)
+@@ -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
+Index: continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManager.java (revision 0)
+@@ -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;
++}
+Index: continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/repository/scanner/RepositoryScanner.java (revision 0)
+@@ -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
+Index: continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/repository/content/RepositoryManagedContent.java (revision 0)
+@@ -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
+Index: continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/controller/PurgeController.java (revision 0)
+@@ -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 );
++}
+Index: continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationServiceException.java (revision 0)
+@@ -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 );
++ }
++}
+Index: continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/PurgeConfigurationService.java (revision 0)
+@@ -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;
++}
+Index: continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/ContinuumPurgeManagerException.java (revision 0)
+@@ -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
+Index: continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutorException.java (revision 0)
+@@ -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
+Index: continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java (revision 0)
++++ continuum-api/src/main/java/org/apache/continuum/purge/executor/ContinuumPurgeExecutor.java (revision 0)
+@@ -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
+Index: continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java (revision 679233)
++++ continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java (working copy)
+@@ -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;
+ }
+Index: continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java (revision 679233)
++++ continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java (working copy)
+@@ -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;
+ }
+Index: continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
+===================================================================
+--- continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java (revision 679233)
++++ continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java (working copy)
+@@ -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,7 +636,16 @@
+
+ BuildDefinitionService getBuildDefinitionService();
+
++ // ----------------------------------------------------------------------
++ // Continuum Purge
++ // ----------------------------------------------------------------------
++ ContinuumPurgeManager getPurgeManager();
+
++ // ----------------------------------------------------------------------
++ // Repository Service
++ // ----------------------------------------------------------------------
++ RepositoryService getRepositoryService();
++
+ public void startup()
+ throws ContinuumException;
+ }
+Index: continuum-api/pom.xml
+===================================================================
+--- continuum-api/pom.xml (revision 679233)
++++ continuum-api/pom.xml (working copy)
+@@ -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
+Index: pom.xml
+===================================================================
+--- pom.xml (revision 679233)
++++ pom.xml (working copy)
+@@ -170,6 +170,7 @@
+ <module>maven-continuum-plugin</module>
+ <module>continuum-docs</module>
+ <module>continuum-jetty</module>
++ <module>continuum-purge</module>
+ </modules>
+ <repositories>
+ <repository>
+@@ -861,6 +862,21 @@
+ <artifactId>spring-web</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
++ <dependency>
++ <groupId>org.apache.continuum</groupId>
++ <artifactId>continuum-purge</artifactId>
++ <version>${pom.version}</version>
++ </dependency>
++ <dependency>
++ <groupId>org.apache.archiva</groupId>
++ <artifactId>archiva-common</artifactId>
++ <version>${archiva.version}</version>
++ </dependency>
++ <dependency>
++ <groupId>org.apache.maven.archiva</groupId>
++ <artifactId>archiva-repository-layer</artifactId>
++ <version>${archiva.version}</version>
++ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+@@ -910,5 +926,6 @@
+ <maven-scm.version>1.1-SNAPSHOT</maven-scm.version>
+ <redback.version>1.0.2</redback.version>
+ <mail-sender.version>1.0-alpha-7</mail-sender.version>
++ <archiva.version>1.1</archiva.version>
+ </properties>
+ </project>
+Index: continuum-webapp/src/main/mdo/view-models.mdo
+===================================================================
+--- continuum-webapp/src/main/mdo/view-models.mdo (revision 679233)
++++ continuum-webapp/src/main/mdo/view-models.mdo (working copy)
+@@ -254,6 +254,21 @@
+ <type>int</type>
+ <defaultValue>-1</defaultValue>
+ </field>
++ <field>
++ <name>repositoryId</name>
++ <version>1.0.0</version>
++ <required>false</required>
++ <description>local repository id of the project group</description>
++ <type>int</type>
++ <defaultValue>-1</defaultValue>
++ </field>
++ <field>
++ <name>repositoryName</name>
++ <version>1.0.0</version>
++ <required>false</required>
++ <description>local repository name of the project group</description>
++ <type>String</type>
++ </field>
+ </fields>
+ </class>
+ <class>
+Index: continuum-webapp/src/main/java/org/apache/continuum/web/startup/ContinuumStartup.java
+===================================================================
+--- continuum-webapp/src/main/java/org/apache/continuum/web/startup/ContinuumStartup.java (revision 679233)
++++ continuum-webapp/src/main/java/org/apache/continuum/web/startup/ContinuumStartup.java (working copy)
+@@ -75,6 +75,9 @@
+
+ TaskQueueExecutor rollbackRelease = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils
+ .buildSpringId( TaskQueueExecutor.class, "rollback-release" ) );
++
++ TaskQueueExecutor purge = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils
++ .buildSpringId( TaskQueueExecutor.class, "purge" ) );
+ }
+
+ }
+Index: continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
+===================================================================
+--- continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java (revision 0)
++++ continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java (revision 0)
+@@ -0,0 +1,353 @@
++package org.apache.continuum.web.action.admin;
++
++/*
++ * 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.HashMap;
++import java.util.List;
++import java.util.Map;
++
++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.PurgeConfigurationService;
++import org.apache.continuum.repository.RepositoryService;
++import org.apache.maven.continuum.model.project.ProjectGroup;
++import org.apache.maven.continuum.security.ContinuumRoleConstants;
++import org.apache.maven.continuum.web.action.ContinuumConfirmAction;
++import org.codehaus.plexus.redback.rbac.Resource;
++import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;
++import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
++import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
++
++import com.opensymphony.webwork.ServletActionContext;
++import com.opensymphony.xwork.Preparable;
++
++/**
++ * @author Maria Catherine Tan
++ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="localRepository"
++ */
++public class LocalRepositoryAction
++ extends ContinuumConfirmAction
++ implements Preparable, SecureAction
++{
++ private static final String LAYOUT_DEFAULT = "default";
++
++ private static final String LAYOUT_LEGACY = "legacy";
++
++ private boolean confirmed;
++
++ private boolean defaultRepo;
++
++ private LocalRepository repository;
++
++ private List<LocalRepository> repositories;
++
++ private List<ProjectGroup> groups;
++
++ private List<String> layouts;
++
++ private Map<String, Boolean> defaultPurgeMap;
++
++ private String message;
++
++ /**
++ * @plexus.requirement
++ */
++ private RepositoryService repositoryService;
++
++ /**
++ * @plexus.requirement
++ */
++ private PurgeConfigurationService purgeConfigService;
++
++ public void prepare()
++ throws Exception
++ {
++ super.prepare();
++
++ layouts = new ArrayList<String>();
++ layouts.add( LAYOUT_DEFAULT );
++ layouts.add( LAYOUT_LEGACY );
++ }
++
++ public String input()
++ throws Exception
++ {
++ defaultRepo = false;
++
++ if ( repository != null && repository.getId() > 0 )
++ {
++ repository = repositoryService.getLocalRepository( repository.getId() );
++
++ if ( repository.getName().equals( "DEFAULT" ) )
++ {
++ defaultRepo = true;
++ }
++ }
++
++ return INPUT;
++ }
++
++ public String list()
++ throws Exception
++ {
++ String errorMessage = ServletActionContext.getRequest().getParameter( "errorMessage" );
++
++ if ( errorMessage != null )
++ {
++ addActionError( errorMessage );
++ }
++
++ repositories = repositoryService.getAllLocalRepositories();
++
++ defaultPurgeMap = new HashMap<String, Boolean>();
++
++ for ( LocalRepository repo : repositories )
++ {
++ // get default purge config of repository
++ RepositoryPurgeConfiguration purgeConfig = purgeConfigService.getDefaultPurgeConfigurationForRepository( repo.getId() );
++
++ if ( purgeConfig == null )
++ {
++ defaultPurgeMap.put( repo.getName(), Boolean.FALSE );
++ }
++ else
++ {
++ defaultPurgeMap.put( repo.getName(), Boolean.TRUE );
++ }
++ }
++
++ return SUCCESS;
++ }
++
++ public String save()
++ throws Exception
++ {
++ List<LocalRepository> allRepositories = repositoryService.getAllLocalRepositories();
++
++ for( LocalRepository repo : allRepositories )
++ {
++ if ( repository.getId() != repo.getId() )
++ {
++ if ( repository.getName().equals( repo.getName() ) )
++ {
++ addActionError( "repository.error.name.unique" );
++ }
++
++ if ( repository.getLocation().equals( repo.getLocation() ) )
++ {
++ addActionError( "repository.error.location.unique" );
++ }
++ }
++ }
++
++ if ( repository.getName().trim().equals( "" ) )
++ {
++ addActionError( "repository.error.name.cannot.be.spaces" );
++ }
++
++ if ( repository.getLocation().trim().equals( "" ) )
++ {
++ addActionError( "repository.error.location.cannot.be.spaces" );
++ }
++
++ if ( hasActionErrors() )
++ {
++ return INPUT;
++ }
++
++ if ( repository.getId() == 0 )
++ {
++ repository = repositoryService.addLocalRepository( repository );
++
++ createDefaultPurgeConfiguration();
++ }
++ else
++ {
++ // check if repository is in use
++ ContinuumPurgeManager purgeManager = getContinuum().getPurgeManager();
++ if ( purgeManager.isRepositoryInUse( repository.getId() ) )
++ {
++ addActionError( "repository.error.save.in.use" );
++ return ERROR;
++ }
++
++ LocalRepository retrievedRepo = repositoryService.getLocalRepository( repository.getId() );
++
++ retrievedRepo.setName( repository.getName() );
++ retrievedRepo.setLocation( repository.getLocation() );
++ retrievedRepo.setLayout( repository.getLayout() );
++
++ repositoryService.updateLocalRepository( retrievedRepo );
++ }
++
++ return SUCCESS;
++ }
++
++ public String remove()
++ throws Exception
++ {
++ ContinuumPurgeManager purgeManager = getContinuum().getPurgeManager();
++ if ( purgeManager.isRepositoryInUse( repository.getId() ) )
++ {
++ message = "repository.error.remove.in.use";
++ return ERROR;
++ }
++
++ repository = repositoryService.getLocalRepository( repository.getId() );
++
++ if ( repository.getName().equals( "DEFAULT" ) )
++ {
++ message = "repository.error.remove.default";
++ return ERROR;
++ }
++
++ if ( confirmed )
++ {
++ repositoryService.removeLocalRepository( repository.getId() );
++ }
++ else
++ {
++ return CONFIRM;
++ }
++
++ return SUCCESS;
++ }
++
++ public String doPurge()
++ throws Exception
++ {
++ ContinuumPurgeManager purgeManager = getContinuum().getPurgeManager();
++
++ // check if repository is in use
++ if ( purgeManager.isRepositoryInUse( repository.getId() ) )
++ {
++ message = "repository.error.purge.in.use";
++ return ERROR;
++ }
++
++ // get default purge configuration for repository
++ RepositoryPurgeConfiguration purgeConfig = purgeConfigService.getDefaultPurgeConfigurationForRepository( repository.getId() );
++
++ if ( purgeConfig != null )
++ {
++ purgeManager.purgeRepository( purgeConfig );
++ }
++
++ return SUCCESS;
++ }
++
++ public LocalRepository getRepository()
++ {
++ return this.repository;
++ }
++
++ public void setRepository( LocalRepository repository )
++ {
++ this.repository = repository;
++ }
++
++ public List<LocalRepository> getRepositories()
++ {
++ return this.repositories;
++ }
++
++ public void setRepositories( List<LocalRepository> repositories )
++ {
++ this.repositories = repositories;
++ }
++
++ public List<ProjectGroup> getGroups()
++ {
++ return this.groups;
++ }
++
++ public void setGroups( List<ProjectGroup> groups )
++ {
++ this.groups = groups;
++ }
++
++ public boolean isConfirmed()
++ {
++ return this.confirmed;
++ }
++
++ public void setConfirmed( boolean confirmed )
++ {
++ this.confirmed = confirmed;
++ }
++
++ public boolean isDefaultRepo()
++ {
++ return this.defaultRepo;
++ }
++
++ public void setDefaultRepo( boolean defaultRepo )
++ {
++ this.defaultRepo = defaultRepo;
++ }
++
++ public List<String> getLayouts()
++ {
++ return this.layouts;
++ }
++
++ public Map<String, Boolean> getDefaultPurgeMap()
++ {
++ return this.defaultPurgeMap;
++ }
++
++ public void setDefaultPurgeMap( Map<String, Boolean> defaultPurgeMap )
++ {
++ this.defaultPurgeMap = defaultPurgeMap;
++ }
++
++ public String getMessage()
++ {
++ return this.message;
++ }
++
++ public void setMessage( String message )
++ {
++ this.message = message;
++ }
++
++ private void createDefaultPurgeConfiguration()
++ throws Exception
++ {
++ RepositoryPurgeConfiguration repoPurge = new RepositoryPurgeConfiguration();
++
++ repoPurge.setRepository( repository );
++ repoPurge.setDefaultPurge( true );
++
++ purgeConfigService.addRepositoryPurgeConfiguration( repoPurge );
++ }
++
++ public SecureActionBundle getSecureActionBundle()
++ throws SecureActionException
++ {
++ SecureActionBundle bundle = new SecureActionBundle();
++ bundle.setRequiresAuthentication( true );
++ bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_REPOSITORIES, Resource.GLOBAL );
++
++ return bundle;
++ }
++}
+Index: continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java
+===================================================================
+--- continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java (revision 0)
++++ continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java (revision 0)
+@@ -0,0 +1,612 @@
++package org.apache.continuum.web.action.admin;
++
++/*
++ * 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.Collection;
++import java.util.HashMap;
++import java.util.List;
++import java.util.Map;
++
++import org.apache.continuum.model.repository.AbstractPurgeConfiguration;
++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.PurgeConfigurationService;
++import org.apache.continuum.repository.RepositoryService;
++import org.apache.maven.continuum.configuration.ConfigurationService;
++import org.apache.maven.continuum.model.project.Schedule;
++import org.apache.maven.continuum.security.ContinuumRoleConstants;
++import org.apache.maven.continuum.web.action.ContinuumConfirmAction;
++import org.codehaus.plexus.redback.rbac.Resource;
++import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;
++import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
++import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
++
++import com.opensymphony.webwork.ServletActionContext;
++import com.opensymphony.xwork.Preparable;
++
++/**
++ * @author Maria Catherine Tan
++ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="purgeConfiguration"
++ *
++ */
++public class PurgeConfigurationAction
++ extends ContinuumConfirmAction
++ implements Preparable, SecureAction
++{
++ private static final String PURGE_TYPE_REPOSITORY = "repository";
++
++ private static final String PURGE_TYPE_DIRECTORY = "directory";
++
++ private static final String PURGE_DIRECTORY_RELEASES = "releases";
++
++ private static final String PURGE_DIRECTORY_BUILDOUTPUT = "buildOutput";
++
++ private static final int DEFAULT_RETENTION_COUNT = 2;
++
++ private static final int DEFAULT_DAYS_OLDER = 100;
++
++ private String purgeType;
++
++ private String directoryType;
++
++ private String description;
++
++ private String message;
++
++ private boolean deleteAll;
++
++ private boolean deleteReleasedSnapshots;
++
++ private boolean enabled;
++
++ private boolean confirmed;
++
++ private boolean defaultPurgeConfiguration;
++
++ private int retentionCount;
++
++ private int daysOlder;
++
++ private int repositoryId;
++
++ private int scheduleId;
++
++ private int purgeConfigId;
++
++ private AbstractPurgeConfiguration purgeConfig;
++
++ private Map<Integer, String> repositories;
++
++ private Map<Integer, String> schedules;
++
++ private List<RepositoryPurgeConfiguration> repoPurgeConfigs;
++
++ private List<DirectoryPurgeConfiguration> dirPurgeConfigs;
++
++ private List<String> directoryTypes;
++
++ /**
++ * @plexus.requirement
++ */
++ private PurgeConfigurationService purgeConfigService;
++
++ /**
++ * @plexus.requirement
++ */
++ private RepositoryService repositoryService;
++
++ public void prepare()
++ throws Exception
++ {
++ super.prepare();
++
++ // build schedules
++ if ( schedules == null )
++ {
++ schedules = new HashMap<Integer, String>();
++
++ Collection<Schedule> allSchedules = getContinuum().getSchedules();
++
++ for ( Schedule schedule : allSchedules )
++ {
++ schedules.put( new Integer( schedule.getId() ), schedule.getName() );
++ }
++ }
++
++ // build repositories
++ if ( repositories == null )
++ {
++ repositories = new HashMap<Integer, String>();
++
++ List<LocalRepository> allRepositories = repositoryService.getAllLocalRepositories();
++
++ for ( LocalRepository repository : allRepositories )
++ {
++ repositories.put( new Integer( repository.getId() ), repository.getName() );
++ }
++ }
++
++ directoryTypes = new ArrayList<String>();
++ directoryTypes.add( PURGE_DIRECTORY_RELEASES );
++ directoryTypes.add( PURGE_DIRECTORY_BUILDOUTPUT );
++ }
++
++ public String input()
++ throws Exception
++ {
++ if ( purgeConfigId != 0 )
++ {
++ purgeConfig = purgeConfigService.getPurgeConfiguration( purgeConfigId );
++
++ if ( purgeConfig instanceof RepositoryPurgeConfiguration )
++ {
++ RepositoryPurgeConfiguration repoPurge = (RepositoryPurgeConfiguration) purgeConfig;
++
++ this.purgeType = PURGE_TYPE_REPOSITORY;
++ this.daysOlder = repoPurge.getDaysOlder();
++ this.retentionCount = repoPurge.getRetentionCount();
++ this.deleteAll = repoPurge.isDeleteAll();
++ this.deleteReleasedSnapshots = repoPurge.isDeleteReleasedSnapshots();
++ this.enabled = repoPurge.isEnabled();
++ this.defaultPurgeConfiguration = repoPurge.isDefaultPurge();
++ this.description = repoPurge.getDescription();
++
++ if ( repoPurge.getRepository() != null )
++ {
++ this.repositoryId = repoPurge.getRepository().getId();
++ }
++
++ if ( repoPurge.getSchedule() != null )
++ {
++ this.scheduleId = repoPurge.getSchedule().getId();
++ }
++ }
++ else if ( purgeConfig instanceof DirectoryPurgeConfiguration )
++ {
++ DirectoryPurgeConfiguration dirPurge = (DirectoryPurgeConfiguration) purgeConfig;
++
++ this.purgeType = PURGE_TYPE_DIRECTORY;
++ this.daysOlder = dirPurge.getDaysOlder();
++ this.retentionCount = dirPurge.getRetentionCount();
++ this.directoryType = dirPurge.getDirectoryType();
++ this.deleteAll = dirPurge.isDeleteAll();
++ this.enabled = dirPurge.isEnabled();
++ this.defaultPurgeConfiguration = dirPurge.isDefaultPurge();
++ this.description = dirPurge.getDescription();
++
++ if ( dirPurge.getSchedule() != null )
++ {
++ this.scheduleId = dirPurge.getSchedule().getId();
++ }
++ }
++ }
++ else
++ {
++ this.retentionCount = DEFAULT_RETENTION_COUNT;
++ this.daysOlder = DEFAULT_DAYS_OLDER;
++ }
++
++ return INPUT;
++ }
++
++ public String list()
++ throws Exception
++ {
++ String errorMessage = ServletActionContext.getRequest().getParameter( "errorMessage" );
++
++ if ( errorMessage != null )
++ {
++ addActionError( errorMessage );
++ }
++
++ repoPurgeConfigs = purgeConfigService.getAllRepositoryPurgeConfigurations();
++ dirPurgeConfigs = purgeConfigService.getAllDirectoryPurgeConfigurations();
++
++ return SUCCESS;
++ }
++
++ public String save()
++ throws Exception
++ {
++ if ( purgeConfigId == 0 )
++ {
++ if ( purgeType.equals( PURGE_TYPE_REPOSITORY ) )
++ {
++ purgeConfig = new RepositoryPurgeConfiguration();
++ }
++ else
++ {
++ purgeConfig = new DirectoryPurgeConfiguration();
++ }
++
++ purgeConfig = setupPurgeConfiguration( purgeConfig );
++
++ purgeConfig = purgeConfigService.addPurgeConfiguration( purgeConfig );
++ }
++ else
++ {
++ purgeConfig = purgeConfigService.getPurgeConfiguration( purgeConfigId );
++ purgeConfig = setupPurgeConfiguration( purgeConfig );
++
++ purgeConfigService.updatePurgeConfiguration( purgeConfig );
++ }
++
++ if ( purgeConfig.isDefaultPurge() )
++ {
++ updateDefaultPurgeConfiguration();
++ }
++
++ return SUCCESS;
++ }
++
++ public String remove()
++ throws Exception
++ {
++ purgeConfigService.removePurgeConfiguration( purgeConfigId );
++
++ return SUCCESS;
++ }
++
++ public String purge()
++ throws Exception
++ {
++ ContinuumPurgeManager purgeManager = getContinuum().getPurgeManager();
++
++ if ( purgeConfigId > 0 )
++ {
++ purgeConfig = purgeConfigService.getPurgeConfiguration( purgeConfigId );
++
++ if ( purgeConfig instanceof RepositoryPurgeConfiguration )
++ {
++ RepositoryPurgeConfiguration repoPurge = (RepositoryPurgeConfiguration) purgeConfig;
++
++ // check if repository is in use
++ if ( purgeManager.isRepositoryInUse( repoPurge.getRepository().getId() ) )
++ {
++ message = "repository.error.purge.in.use";
++ return ERROR;
++ }
++
++ purgeManager.purgeRepository( repoPurge );
++ }
++ else
++ {
++ DirectoryPurgeConfiguration dirPurge = (DirectoryPurgeConfiguration) purgeConfig;
++ purgeManager.purgeDirectory( dirPurge );
++ }
++ }
++
++ return SUCCESS;
++ }
++
++ public String getPurgeType()
++ {
++ return this.purgeType;
++ }
++
++ public void setPurgeType( String purgeType )
++ {
++ this.purgeType = purgeType;
++ }
++
++ public String getDirectoryType()
++ {
++ return this.directoryType;
++ }
++
++ public void setDirectoryType( String directoryType )
++ {
++ this.directoryType = directoryType;
++ }
++
++ public String getDescription()
++ {
++ return this.description;
++ }
++
++ public void setDescription( String description )
++ {
++ this.description = description;
++ }
++
++ public String getMessage()
++ {
++ return this.message;
++ }
++
++ public void setMessage( String message )
++ {
++ this.message = message;
++ }
++
++ public boolean isDeleteAll()
++ {
++ return this.deleteAll;
++ }
++
++ public void setDeleteAll( boolean deleteAll )
++ {
++ this.deleteAll = deleteAll;
++ }
++
++ public boolean isDeleteReleasedSnapshots()
++ {
++ return this.deleteReleasedSnapshots;
++ }
++
++ public void setDeleteReleasedSnapshots( boolean deleteReleasedSnapshots )
++ {
++ this.deleteReleasedSnapshots = deleteReleasedSnapshots;
++ }
++
++ public boolean isEnabled()
++ {
++ return this.enabled;
++ }
++
++ public void setEnabled( boolean enabled )
++ {
++ this.enabled = enabled;
++ }
++
++ public boolean isConfirmed()
++ {
++ return this.confirmed;
++ }
++
++ public void setConfirmed( boolean confirmed )
++ {
++ this.confirmed = confirmed;
++ }
++
++ public boolean isDefaultPurgeConfiguration()
++ {
++ return this.defaultPurgeConfiguration;
++ }
++
++ public void setDefaultPurgeConfiguration( boolean defaultPurgeConfiguration )
++ {
++ this.defaultPurgeConfiguration = defaultPurgeConfiguration;
++ }
++
++ public int getRetentionCount()
++ {
++ return this.retentionCount;
++ }
++
++ public void setRetentionCount( int retentionCount )
++ {
++ this.retentionCount = retentionCount;
++ }
++
++ public int getDaysOlder()
++ {
++ return this.daysOlder;
++ }
++
++ public void setDaysOlder( int daysOlder )
++ {
++ this.daysOlder = daysOlder;
++ }
++
++ public int getRepositoryId()
++ {
++ return this.repositoryId;
++ }
++
++ public void setRepositoryId( int repositoryId )
++ {
++ this.repositoryId = repositoryId;
++ }
++
++ public int getScheduleId()
++ {
++ return this.scheduleId;
++ }
++
++ public void setScheduleId( int scheduleId )
++ {
++ this.scheduleId = scheduleId;
++ }
++
++ public int getPurgeConfigId()
++ {
++ return purgeConfigId;
++ }
++
++ public void setPurgeConfigId( int purgeConfigId )
++ {
++ this.purgeConfigId = purgeConfigId;
++ }
++
++ public AbstractPurgeConfiguration getPurgeConfig()
++ {
++ return this.purgeConfig;
++ }
++
++ public void setPurgeConfig( AbstractPurgeConfiguration purgeConfig )
++ {
++ this.purgeConfig = purgeConfig;
++ }
++
++ public Map<Integer, String> getRepositories()
++ {
++ return this.repositories;
++ }
++
++ public void setRepositories( Map<Integer, String> repositories )
++ {
++ this.repositories = repositories;
++ }
++
++ public Map<Integer, String> getSchedules()
++ {
++ return this.schedules;
++ }
++
++ public void setSchedules( Map<Integer, String> schedules )
++ {
++ this.schedules = schedules;
++ }
++
++ public List<RepositoryPurgeConfiguration> getRepoPurgeConfigs()
++ {
++ return this.repoPurgeConfigs;
++ }
++
++ public void setRepoPurgeConfigs( List<RepositoryPurgeConfiguration> repoPurgeConfigs )
++ {
++ this.repoPurgeConfigs = repoPurgeConfigs;
++ }
++
++ public List<DirectoryPurgeConfiguration> getDirPurgeConfigs()
++ {
++ return this.dirPurgeConfigs;
++ }
++
++ public void setDirPurgeConfigs( List<DirectoryPurgeConfiguration> dirPurgeConfigs )
++ {
++ this.dirPurgeConfigs = dirPurgeConfigs;
++ }
++
++ public List<String> getDirectoryTypes()
++ {
++ return this.directoryTypes;
++ }
++
++ public void setDirectoryTypes( List<String> directoryTypes )
++ {
++ this.directoryTypes = directoryTypes;
++ }
++
++ private AbstractPurgeConfiguration setupPurgeConfiguration( AbstractPurgeConfiguration purgeConfiguration )
++ throws Exception
++ {
++ if ( purgeConfiguration instanceof RepositoryPurgeConfiguration )
++ {
++ return buildRepoPurgeConfiguration();
++ }
++ else
++ {
++ return buildDirPurgeConfiguration();
++ }
++ }
++
++ private RepositoryPurgeConfiguration buildRepoPurgeConfiguration()
++ throws Exception
++ {
++ RepositoryPurgeConfiguration repoPurge = (RepositoryPurgeConfiguration) purgeConfig;
++ repoPurge.setDeleteAll( this.deleteAll );
++ repoPurge.setDeleteReleasedSnapshots( this.deleteReleasedSnapshots );
++ repoPurge.setDaysOlder( this.daysOlder );
++ repoPurge.setRetentionCount( this.retentionCount );
++ repoPurge.setEnabled( this.enabled );
++ repoPurge.setDefaultPurge( this.defaultPurgeConfiguration );
++ repoPurge.setDescription( this.description );
++ repoPurge.setDefaultPurge( this.defaultPurgeConfiguration );
++
++ if ( repositoryId != 0 )
++ {
++ LocalRepository repository = repositoryService.getLocalRepository( repositoryId );
++ repoPurge.setRepository( repository );
++ }
++
++ if ( scheduleId > 0 )
++ {
++ Schedule schedule = getContinuum().getSchedule( scheduleId );
++ repoPurge.setSchedule( schedule );
++ }
++
++ return repoPurge;
++ }
++
++ private DirectoryPurgeConfiguration buildDirPurgeConfiguration()
++ throws Exception
++ {
++ DirectoryPurgeConfiguration dirPurge = (DirectoryPurgeConfiguration) purgeConfig;
++ dirPurge.setDeleteAll( this.deleteAll );
++ dirPurge.setEnabled( this.enabled );
++ dirPurge.setDaysOlder( this.daysOlder );
++ dirPurge.setRetentionCount( this.retentionCount );
++ dirPurge.setDescription( this.description );
++ dirPurge.setDirectoryType( this.directoryType );
++ dirPurge.setDefaultPurge( this.defaultPurgeConfiguration );
++
++ if ( scheduleId > 0 )
++ {
++ Schedule schedule = getContinuum().getSchedule( scheduleId );
++ dirPurge.setSchedule( schedule );
++ }
++
++ ConfigurationService configService = getContinuum().getConfiguration();
++ String path = null;
++
++ if ( this.directoryType.equals( PURGE_DIRECTORY_RELEASES ) )
++ {
++ path = configService.getWorkingDirectory().getAbsolutePath();
++ }
++ else if ( this.directoryType.equals( PURGE_DIRECTORY_BUILDOUTPUT ) )
++ {
++ path = configService.getBuildOutputDirectory().getAbsolutePath();
++ }
++
++ dirPurge.setLocation( path );
++
++ return dirPurge;
++ }
++
++ private void updateDefaultPurgeConfiguration()
++ throws Exception
++ {
++ if ( purgeConfig instanceof RepositoryPurgeConfiguration )
++ {
++ RepositoryPurgeConfiguration repoPurge = purgeConfigService.getDefaultPurgeConfigurationForRepository( repositoryId );
++
++ if ( repoPurge != null && repoPurge.getId() != purgeConfig.getId() )
++ {
++ repoPurge.setDefaultPurge( false );
++ purgeConfigService.updateRepositoryPurgeConfiguration( repoPurge );
++ }
++ }
++ else if ( purgeConfig instanceof DirectoryPurgeConfiguration )
++ {
++ DirectoryPurgeConfiguration dirPurge = purgeConfigService.getDefaultPurgeConfigurationForDirectoryType( directoryType );
++
++ if ( dirPurge != null && dirPurge.getId() != purgeConfig.getId() )
++ {
++ dirPurge.setDefaultPurge( false );
++ purgeConfigService.updateDirectoryPurgeConfiguration( dirPurge );
++ }
++ }
++ }
++
++ public SecureActionBundle getSecureActionBundle()
++ throws SecureActionException
++ {
++ SecureActionBundle bundle = new SecureActionBundle();
++ bundle.setRequiresAuthentication( true );
++ bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_MANAGE_PURGING, Resource.GLOBAL );
++
++ return bundle;
++ }
++}
+Index: continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java
+===================================================================
+--- continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java (revision 679233)
++++ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/GroupSummaryAction.java (working copy)
+@@ -21,7 +21,6 @@
+
+ import java.util.ArrayList;
+ import java.util.Collection;
+-import java.util.Iterator;
+ import java.util.List;
+
+ import org.apache.maven.continuum.ContinuumException;
+@@ -61,6 +60,12 @@
+ groupModel.setGroupId( projectGroup.getGroupId() );
+ groupModel.setName( projectGroup.getName() );
+ groupModel.setDescription( projectGroup.getDescription() );
++
++ if ( projectGroup.getLocalRepository() != null )
++ {
++ groupModel.setRepositoryId( projectGroup.getLocalRepository().getId() );
++ groupModel.setRepositoryName( projectGroup.getLocalRepository().getName() );
++ }
+
[... 9141 lines stripped ...]