diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-10-08 22:07:39 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-10-08 22:07:39 +0000 |
commit | 8af86cd884b34ecfa98c6a42d2975fdd45c48fff (patch) | |
tree | 3747df8c304e8c84090f325abab84775e961db6e /archiva-base/archiva-consumers | |
parent | 4b9cf4b9298b9906ae4975146706e6a870349e43 (diff) | |
download | archiva-8af86cd884b34ecfa98c6a42d2975fdd45c48fff.tar.gz archiva-8af86cd884b34ecfa98c6a42d2975fdd45c48fff.zip |
Finishing the Repository split work that brett started.
ArchivaRepository has been removed from model.
This work was needed before repository layout/detection proposal work is started.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@582987 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-consumers')
17 files changed, 74 insertions, 93 deletions
diff --git a/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml b/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml index ea0716c02..5a2abf85b 100644 --- a/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml +++ b/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml @@ -31,6 +31,10 @@ <dependencies> <dependency> <groupId>org.apache.maven.archiva</groupId> + <artifactId>archiva-configuration</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.archiva</groupId> <artifactId>archiva-model</artifactId> </dependency> <dependency> diff --git a/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java index 005423f23..56dae57ef 100644 --- a/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java +++ b/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.consumers; * under the License. */ -import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import java.util.List; @@ -58,7 +58,7 @@ public interface RepositoryContentConsumer extends BaseConsumer * @param repository the repository that this consumer is being used for. * @throws ConsumerException if there was a problem with using the provided repository with the consumer. */ - public void beginScan( ArchivaRepository repository ) throws ConsumerException; + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException; /** * <p> diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java index 0760ad973..41c43293f 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java @@ -21,10 +21,10 @@ package org.apache.maven.archiva.consumers.core; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.FileTypes; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.codehaus.plexus.digest.ChecksumFile; import org.codehaus.plexus.digest.Digester; @@ -99,7 +99,7 @@ public class ArtifactMissingChecksumsConsumer private static final String TYPE_CHECKSUM_CANNOT_CREATE = "checksum-create-failure"; - private ArchivaRepository repository; + private ManagedRepositoryConfiguration repository; private File repositoryDir; @@ -124,13 +124,13 @@ public class ArtifactMissingChecksumsConsumer return false; } - public void beginScan( ArchivaRepository repository ) + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { this.repository = repository; - this.repositoryDir = new File( repository.getUrl().getPath() ); + this.repositoryDir = new File( repository.getLocation() ); - String layoutName = repository.getModel().getLayoutName(); + String layoutName = repository.getLayout(); if ( !bidirectionalLayoutMap.containsKey( layoutName ) ) { throw new ConsumerException( "Unable to process repository with layout [" + layoutName + diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java index b3d032002..d8f84be2e 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java @@ -21,10 +21,10 @@ package org.apache.maven.archiva.consumers.core; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.FileTypes; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.maven.archiva.model.ArchivaRepository; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; import org.codehaus.plexus.registry.Registry; @@ -88,10 +88,10 @@ public class AutoRemoveConsumer return false; } - public void beginScan( ArchivaRepository repository ) + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { - this.repositoryDir = new File( repository.getUrl().getPath() ); + this.repositoryDir = new File( repository.getLocation() ); } public void completeScan() diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java index b1004a80d..f373946a3 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java @@ -19,10 +19,10 @@ package org.apache.maven.archiva.consumers.core; * under the License. */ +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.maven.archiva.model.ArchivaRepository; import org.codehaus.plexus.util.FileUtils; import java.io.File; @@ -90,10 +90,10 @@ public class AutoRenameConsumer return false; } - public void beginScan( ArchivaRepository repository ) + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { - this.repositoryDir = new File( repository.getUrl().getPath() ); + this.repositoryDir = new File( repository.getLocation() ); } public void completeScan() diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java index b1be25012..21af9d294 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java @@ -22,10 +22,10 @@ package org.apache.maven.archiva.consumers.core; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ConfigurationNames; import org.apache.maven.archiva.configuration.FileTypes; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.ProjectReference; import org.apache.maven.archiva.model.VersionedReference; @@ -93,7 +93,7 @@ public class MetadataUpdaterConsumer private static final String TYPE_METADATA_IO = "metadata-io-warning"; - private ArchivaRepository repository; + private ManagedRepositoryConfiguration repository; private File repositoryDir; @@ -118,14 +118,14 @@ public class MetadataUpdaterConsumer this.includes = includes; } - public void beginScan( ArchivaRepository repository ) + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { this.repository = repository; - this.repositoryDir = new File( repository.getUrl().getPath() ); + this.repositoryDir = new File( repository.getLocation() ); try { - this.repositoryLayout = layoutFactory.getLayout( repository.getLayoutType() ); + this.repositoryLayout = layoutFactory.getLayout( repository.getLayout() ); } catch ( LayoutException e ) { diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java index 318d97857..cb3032847 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java @@ -19,10 +19,10 @@ package org.apache.maven.archiva.consumers.core; * under the License. */ +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; -import org.apache.maven.archiva.model.ArchivaRepository; import org.codehaus.plexus.digest.ChecksumFile; import org.codehaus.plexus.digest.Digester; import org.codehaus.plexus.digest.DigesterException; @@ -96,10 +96,10 @@ public class ValidateChecksumConsumer return false; } - public void beginScan( ArchivaRepository repository ) + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { - this.repositoryDir = new File( repository.getUrl().getPath() ); + this.repositoryDir = new File( repository.getLocation() ); } public void completeScan() diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java index 5bfd82675..ccbd0ebad 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java @@ -20,11 +20,11 @@ package org.apache.maven.archiva.consumers.core.repository; */ import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.ArtifactDAO; import org.apache.maven.archiva.indexer.RepositoryIndexException; import org.apache.maven.archiva.model.ArchivaArtifact; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.FilenameParts; import org.apache.maven.archiva.repository.layout.LayoutException; @@ -39,13 +39,13 @@ import java.io.FilenameFilter; public abstract class AbstractRepositoryPurge implements RepositoryPurge { - protected ArchivaRepository repository; + protected ManagedRepositoryConfiguration repository; protected BidirectionalRepositoryLayout layout; protected ArtifactDAO artifactDao; - public AbstractRepositoryPurge( ArchivaRepository repository, BidirectionalRepositoryLayout layout, + public AbstractRepositoryPurge( ManagedRepositoryConfiguration repository, BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao ) { this.repository = repository; @@ -81,7 +81,7 @@ public abstract class AbstractRepositoryPurge { artifactFiles[i].delete(); - String[] artifactPathParts = artifactFiles[i].getAbsolutePath().split( repository.getUrl().getPath() ); + String[] artifactPathParts = artifactFiles[i].getAbsolutePath().split( repository.getLocation() ); String artifactPath = artifactPathParts[artifactPathParts.length - 1]; if ( !artifactPath.toUpperCase().endsWith( "SHA1" ) && !artifactPath.toUpperCase().endsWith( "MD5" ) ) { diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java index 6a629cb16..227c19f8a 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java @@ -22,8 +22,8 @@ package org.apache.maven.archiva.consumers.core.repository; import org.apache.commons.io.FileUtils; import org.apache.maven.archiva.common.utils.VersionComparator; import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.database.ArtifactDAO; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.FilenameParts; @@ -53,7 +53,7 @@ public class CleanupReleasedSnapshotsRepositoryPurge private RepositoryMetadataReader metadataReader; - public CleanupReleasedSnapshotsRepositoryPurge( ArchivaRepository repository, BidirectionalRepositoryLayout layout, + public CleanupReleasedSnapshotsRepositoryPurge( ManagedRepositoryConfiguration repository, BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao ) { super( repository, layout, artifactDao ); @@ -65,7 +65,7 @@ public class CleanupReleasedSnapshotsRepositoryPurge { try { - File artifactFile = new File( repository.getUrl().getPath(), path ); + File artifactFile = new File( repository.getLocation(), path ); if ( !artifactFile.exists() ) { diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java index 14e0f0a8e..e092f4ba5 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java @@ -21,8 +21,8 @@ package org.apache.maven.archiva.consumers.core.repository; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.database.ArtifactDAO; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.FilenameParts; import org.apache.maven.archiva.repository.layout.LayoutException; @@ -40,7 +40,7 @@ public class DaysOldRepositoryPurge { private int daysOlder; - public DaysOldRepositoryPurge( ArchivaRepository repository, BidirectionalRepositoryLayout layout, + public DaysOldRepositoryPurge( ManagedRepositoryConfiguration repository, BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao, int daysOlder ) { super( repository, layout, artifactDao ); @@ -52,7 +52,7 @@ public class DaysOldRepositoryPurge { try { - File artifactFile = new File( repository.getUrl().getPath(), path ); + File artifactFile = new File( repository.getLocation(), path ); if ( !artifactFile.exists() ) { diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java index c40916fce..6a6df7c67 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java @@ -26,7 +26,6 @@ import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.maven.archiva.database.ArchivaDAO; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory; import org.apache.maven.archiva.repository.layout.LayoutException; @@ -116,13 +115,13 @@ public class RepositoryPurgeConsumer return this.includes; } - public void beginScan( ArchivaRepository repository ) + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { BidirectionalRepositoryLayout repositoryLayout; try { - repositoryLayout = layoutFactory.getLayout( repository.getLayoutType() ); + repositoryLayout = layoutFactory.getLayout( repository.getLayout() ); } catch ( LayoutException e ) { diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java index 76456bf95..7c7e6eb19 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java @@ -20,8 +20,8 @@ package org.apache.maven.archiva.consumers.core.repository; */ import org.apache.maven.archiva.common.utils.VersionUtil; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.database.ArtifactDAO; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.FilenameParts; import org.apache.maven.archiva.repository.layout.LayoutException; @@ -42,7 +42,7 @@ public class RetentionCountRepositoryPurge { private int retentionCount; - public RetentionCountRepositoryPurge( ArchivaRepository repository, BidirectionalRepositoryLayout layout, + public RetentionCountRepositoryPurge( ManagedRepositoryConfiguration repository, BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao, int retentionCount ) { super( repository, layout, artifactDao ); @@ -54,7 +54,7 @@ public class RetentionCountRepositoryPurge { try { - File artifactFile = new File( repository.getUrl().getPath(), path ); + File artifactFile = new File( repository.getLocation(), path ); if ( !artifactFile.exists() ) { diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index 5e2251b73..a7d93195b 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -19,12 +19,10 @@ package org.apache.maven.archiva.consumers.core.repository; * under the License. */ -import org.apache.maven.archiva.common.utils.PathUtil; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.ArtifactDAO; import org.apache.maven.archiva.model.ArchivaArtifact; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.DefaultBidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.LayoutException; @@ -33,8 +31,6 @@ import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory; import org.codehaus.plexus.jdo.JdoFactory; import org.jpox.SchemaTool; -import javax.jdo.PersistenceManager; -import javax.jdo.PersistenceManagerFactory; import java.io.File; import java.net.URL; import java.util.Date; @@ -43,6 +39,9 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + /** * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a> */ @@ -53,33 +52,27 @@ public abstract class AbstractRepositoryPurgeTest public static final String TEST_REPO_NAME = "Test Repository"; - public static final String TEST_REPO_URL = getBasedir() + "/target/test/test-repo/"; + public static final String TEST_REPO_LOCATION = getBasedir() + "/target/test/test-repo/"; public static final int TEST_RETENTION_COUNT = 2; public static final int TEST_DAYS_OLDER = 30; - public static final String PATH_TO_BY_DAYS_OLD_ARTIFACT = - "org/apache/maven/plugins/maven-install-plugin/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar"; + public static final String PATH_TO_BY_DAYS_OLD_ARTIFACT = "org/apache/maven/plugins/maven-install-plugin/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar"; - public static final String PATH_TO_BY_DAYS_OLD_METADATA_DRIVEN_ARTIFACT = - "org/codehaus/plexus/plexus-utils/1.4.3-SNAPSHOT/plexus-utils-1.4.3-20070113.163208-4.jar"; + public static final String PATH_TO_BY_DAYS_OLD_METADATA_DRIVEN_ARTIFACT = "org/codehaus/plexus/plexus-utils/1.4.3-SNAPSHOT/plexus-utils-1.4.3-20070113.163208-4.jar"; - public static final String PATH_TO_BY_RETENTION_COUNT_ARTIFACT = - "org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar"; + public static final String PATH_TO_BY_RETENTION_COUNT_ARTIFACT = "org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar"; - public static final String PATH_TO_BY_RETENTION_COUNT_POM = - "org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom"; + public static final String PATH_TO_BY_RETENTION_COUNT_POM = "org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom"; - public static final String PATH_TO_RELEASED_SNAPSHOT = - "org/apache/maven/plugins/maven-plugin-plugin/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.jar"; + public static final String PATH_TO_RELEASED_SNAPSHOT = "org/apache/maven/plugins/maven-plugin-plugin/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.jar"; - public static final String PATH_TO_HIGHER_SNAPSHOT_EXISTS = - "org/apache/maven/plugins/maven-source-plugin/2.0.3-SNAPSHOT/maven-source-plugin-2.0.3-SNAPSHOT.jar"; + public static final String PATH_TO_HIGHER_SNAPSHOT_EXISTS = "org/apache/maven/plugins/maven-source-plugin/2.0.3-SNAPSHOT/maven-source-plugin-2.0.3-SNAPSHOT.jar"; private ManagedRepositoryConfiguration config; - private ArchivaRepository repo; + private ManagedRepositoryConfiguration repo; private BidirectionalRepositoryLayout layout; @@ -131,7 +124,7 @@ public abstract class AbstractRepositoryPurgeTest System.setProperty( (String) entry.getKey(), (String) entry.getValue() ); } - URL jdoFileUrls[] = new URL[]{getClass().getResource( "/org/apache/maven/archiva/model/package.jdo" )}; + URL jdoFileUrls[] = new URL[] { getClass().getResource( "/org/apache/maven/archiva/model/package.jdo" ) }; if ( ( jdoFileUrls == null ) || ( jdoFileUrls[0] == null ) ) { @@ -141,8 +134,8 @@ public abstract class AbstractRepositoryPurgeTest File propsFile = null; // intentional boolean verbose = true; - SchemaTool.deleteSchemaTables( jdoFileUrls, new URL[]{}, propsFile, verbose ); - SchemaTool.createSchemaTables( jdoFileUrls, new URL[]{}, propsFile, verbose, null ); + SchemaTool.deleteSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose ); + SchemaTool.createSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose, null ); PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory(); @@ -165,7 +158,7 @@ public abstract class AbstractRepositoryPurgeTest config.setId( TEST_REPO_ID ); config.setName( TEST_REPO_NAME ); config.setDaysOlder( TEST_DAYS_OLDER ); - config.setLocation( TEST_REPO_URL ); + config.setLocation( TEST_REPO_LOCATION ); config.setReleases( true ); config.setSnapshots( true ); config.setRetentionCount( TEST_RETENTION_COUNT ); @@ -173,11 +166,14 @@ public abstract class AbstractRepositoryPurgeTest return config; } - public ArchivaRepository getRepository() + public ManagedRepositoryConfiguration getRepository() { if ( repo == null ) { - repo = new ArchivaRepository( TEST_REPO_ID, TEST_REPO_NAME, PathUtil.toUrl( TEST_REPO_URL ) ); + repo = new ManagedRepositoryConfiguration(); + repo.setId( TEST_REPO_ID ); + repo.setName( TEST_REPO_NAME ); + repo.setLocation( TEST_REPO_LOCATION ); } return repo; diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml index 4f1a11fe3..a87217f3b 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml @@ -198,10 +198,6 @@ <role-hint>jdo</role-hint> </requirement> <requirement> - <role>org.apache.maven.archiva.database.RepositoryDAO</role> - <role-hint>jdo</role-hint> - </requirement> - <requirement> <role>org.apache.maven.archiva.database.RepositoryProblemDAO</role> <role-hint>jdo</role-hint> </requirement> @@ -230,17 +226,6 @@ </requirements> </component> <component> - <role>org.apache.maven.archiva.database.RepositoryDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.database.jdo.JdoRepositoryDAO</implementation> - <requirements> - <requirement> - <role>org.apache.maven.archiva.database.jdo.JdoAccess</role> - <role-hint>archiva</role-hint> - </requirement> - </requirements> - </component> - <component> <role>org.apache.maven.archiva.database.RepositoryProblemDAO</role> <role-hint>jdo</role-hint> <implementation>org.apache.maven.archiva.database.jdo.JdoRepositoryProblemDAO</implementation> diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java index 600b9596b..bbba3dd84 100644 --- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java +++ b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java @@ -22,13 +22,13 @@ package org.apache.maven.archiva.consumers.database; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ConfigurationNames; import org.apache.maven.archiva.configuration.FileTypes; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.maven.archiva.database.ArchivaDAO; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.model.ArchivaArtifact; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory; import org.apache.maven.archiva.repository.layout.LayoutException; @@ -103,7 +103,7 @@ public class ArtifactUpdateDatabaseConsumer */ private Digester digestMd5; - private ArchivaRepository repository; + private ManagedRepositoryConfiguration repository; private File repositoryDir; @@ -136,15 +136,15 @@ public class ArtifactUpdateDatabaseConsumer return this.includes; } - public void beginScan( ArchivaRepository repository ) + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { this.repository = repository; - this.repositoryDir = new File( repository.getUrl().getPath() ); + this.repositoryDir = new File( repository.getLocation() ); try { - this.layout = layoutFactory.getLayout( repository.getModel().getLayoutName() ); + this.layout = layoutFactory.getLayout( repository.getLayout() ); } catch ( LayoutException e ) { diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java index 067f0f6fe..612ef5ecf 100644 --- a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java +++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java @@ -31,8 +31,6 @@ import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory; import org.apache.maven.archiva.indexer.RepositoryIndexException; import org.apache.maven.archiva.indexer.hashcodes.HashcodesRecord; import org.apache.maven.archiva.model.ArchivaArtifact; -import org.apache.maven.archiva.model.ArchivaRepository; -import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; @@ -184,17 +182,16 @@ public class IndexArtifactConsumer Iterator<ManagedRepositoryConfiguration> it = configuration.getConfiguration().getManagedRepositories().iterator(); while ( it.hasNext() ) { - ManagedRepositoryConfiguration repoconfig = it.next(); + ManagedRepositoryConfiguration repository = it.next(); - ArchivaRepository repository = ArchivaConfigurationAdaptor.toArchivaRepository( repoconfig ); IndexedRepositoryDetails pnl = new IndexedRepositoryDetails(); - pnl.path = repository.getUrl().getPath(); - pnl.layout = (BidirectionalRepositoryLayout) this.bidirectionalLayoutMap.get( repoconfig.getLayout() ); + pnl.path = repository.getLocation(); + pnl.layout = (BidirectionalRepositoryLayout) this.bidirectionalLayoutMap.get( repository.getLayout() ); pnl.index = indexFactory.createHashcodeIndex( repository ); - this.repositoryMap.put( repoconfig.getId(), pnl ); + this.repositoryMap.put( repository.getId(), pnl ); } } } diff --git a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java index 7be8b164a..aefaba8ad 100644 --- a/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java +++ b/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java @@ -22,6 +22,7 @@ package org.apache.maven.archiva.consumers.lucene; import org.apache.commons.io.FileUtils; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.FileTypes; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; @@ -30,7 +31,6 @@ import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory; import org.apache.maven.archiva.indexer.RepositoryIndexException; import org.apache.maven.archiva.indexer.filecontent.FileContentRecord; import org.apache.maven.archiva.model.ArchivaArtifact; -import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory; import org.apache.maven.archiva.repository.layout.LayoutException; @@ -97,7 +97,7 @@ public class IndexContentConsumer private RepositoryContentIndex index; - private ArchivaRepository repository; + private ManagedRepositoryConfiguration repository; private File repositoryDir; @@ -128,16 +128,16 @@ public class IndexContentConsumer return this.includes; } - public void beginScan( ArchivaRepository repository ) + public void beginScan( ManagedRepositoryConfiguration repository ) throws ConsumerException { this.repository = repository; - this.repositoryDir = new File( repository.getUrl().getPath() ); + this.repositoryDir = new File( repository.getLocation() ); this.index = indexFactory.createFileContentIndex( repository ); try { - this.repositoryLayout = layoutFactory.getLayout( this.repository.getLayoutType() ); + this.repositoryLayout = layoutFactory.getLayout( this.repository.getLayout() ); } catch ( LayoutException e ) { |