summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2007-10-08 22:07:39 +0000
committerJoakim Erdfelt <joakime@apache.org>2007-10-08 22:07:39 +0000
commit8af86cd884b34ecfa98c6a42d2975fdd45c48fff (patch)
tree3747df8c304e8c84090f325abab84775e961db6e
parent4b9cf4b9298b9906ae4975146706e6a870349e43 (diff)
downloadarchiva-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
-rw-r--r--archiva-base/archiva-consumers/archiva-consumer-api/pom.xml4
-rw-r--r--archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java4
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java10
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java6
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java6
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java10
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java6
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java8
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java6
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java6
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java5
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java6
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java44
-rw-r--r--archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.xml15
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java10
-rw-r--r--archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexArtifactConsumer.java11
-rw-r--r--archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/maven/archiva/consumers/lucene/IndexContentConsumer.java10
-rw-r--r--archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java22
-rw-r--r--archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java4
-rw-r--r--archiva-base/archiva-converter/src/test/java/org/apache/maven/archiva/converter/RepositoryConverterTest.java14
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java4
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndexFactory.java8
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/BytecodeIndexTransformer.java6
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/FileContentIndexTransformer.java6
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/HashcodesIndexTransformer.java6
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/UserAllowedToSearchRepositoryPredicate.java4
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java8
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java13
-rw-r--r--archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java3
-rw-r--r--archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java23
-rw-r--r--archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.java4
-rw-r--r--archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java4
-rw-r--r--archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java4
-rw-r--r--archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java4
-rw-r--r--archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java16
-rw-r--r--archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java137
-rw-r--r--archiva-base/archiva-model/src/main/mdo/archiva-base.xml129
-rw-r--r--archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java145
-rw-r--r--archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java15
-rw-r--r--archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java12
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java85
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AllTests.java48
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java4
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java19
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java2
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaConfigurationAdaptor.java67
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java11
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java47
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java17
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ManagedRepositoryProjectResolver.java (renamed from archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java)12
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java77
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java153
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java144
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java22
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java28
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/TriggerBeginScanClosure.java6
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java54
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java18
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java119
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java13
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java4
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java4
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java8
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerTest.java34
-rw-r--r--archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java4
-rw-r--r--archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java4
-rw-r--r--archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java12
-rw-r--r--archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java8
-rw-r--r--archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java2
-rw-r--r--archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDAO.java71
-rw-r--r--archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java11
-rw-r--r--archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoRepositoryDAO.java118
-rw-r--r--archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java3
-rw-r--r--archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoRepositoryDAOTest.java96
-rw-r--r--archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java16
-rw-r--r--archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java32
-rw-r--r--archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java29
-rw-r--r--archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java36
-rw-r--r--archiva-scheduled/src/test/resources/archiva-test.xml10
-rw-r--r--archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml5
-rw-r--r--archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java23
-rw-r--r--archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java4
-rw-r--r--archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java (renamed from archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ConfigurationSynchronization.java)48
-rw-r--r--archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java29
-rw-r--r--archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java9
85 files changed, 881 insertions, 1443 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 )
{
diff --git a/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java b/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
index b72afbed2..f4c3dcf2b 100644
--- a/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
+++ b/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/DefaultLegacyRepositoryConverter.java
@@ -21,8 +21,8 @@ package org.apache.maven.archiva.converter.legacy;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.converter.RepositoryConversionException;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.archiva.repository.scanner.RepositoryScanner;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -72,23 +72,13 @@ public class DefaultLegacyRepositoryConverter
{
try
{
- String legacyRepositoryUrl = PathUtil.toUrl( legacyRepositoryDirectory );
String defaultRepositoryUrl = PathUtil.toUrl( repositoryDirectory );
- // workaround for spaces non converted by PathUtils in wagon
- // TODO: remove it when PathUtils will be fixed
- if ( legacyRepositoryUrl.indexOf( "%20" ) >= 0 )
- {
- legacyRepositoryUrl = StringUtils.replace( legacyRepositoryUrl, "%20", " " );
- }
- if ( defaultRepositoryUrl.indexOf( "%20" ) >= 0 )
- {
- defaultRepositoryUrl = StringUtils.replace( defaultRepositoryUrl, "%20", " " );
- }
-
- ArchivaRepository legacyRepository = new ArchivaRepository( "legacy", "Legacy Repository",
- legacyRepositoryUrl );
- legacyRepository.getModel().setLayoutName( "legacy" );
+ ManagedRepositoryConfiguration legacyRepository = new ManagedRepositoryConfiguration();
+ legacyRepository.setId( "legacy");
+ legacyRepository.setName( "Legacy Repository" );
+ legacyRepository.setLocation( legacyRepositoryDirectory.getAbsolutePath() );
+ legacyRepository.setLayout( "legacy" );
ArtifactRepository repository = artifactRepositoryFactory.createArtifactRepository( "default",
defaultRepositoryUrl,
diff --git a/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java b/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
index a30146a6a..fe83b6ec3 100644
--- a/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
+++ b/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
@@ -19,12 +19,12 @@ package org.apache.maven.archiva.converter.legacy;
* 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.converter.artifact.ArtifactConversionException;
import org.apache.maven.archiva.converter.artifact.ArtifactConverter;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.LayoutException;
@@ -79,7 +79,7 @@ public class LegacyConverterArtifactConsumer
includes.add( "**/*.war" );
}
- public void beginScan( ArchivaRepository repository )
+ public void beginScan( ManagedRepositoryConfiguration repository )
throws ConsumerException
{
diff --git a/archiva-base/archiva-converter/src/test/java/org/apache/maven/archiva/converter/RepositoryConverterTest.java b/archiva-base/archiva-converter/src/test/java/org/apache/maven/archiva/converter/RepositoryConverterTest.java
index e5bfc4441..70a5ca1ff 100644
--- a/archiva-base/archiva-converter/src/test/java/org/apache/maven/archiva/converter/RepositoryConverterTest.java
+++ b/archiva-base/archiva-converter/src/test/java/org/apache/maven/archiva/converter/RepositoryConverterTest.java
@@ -20,9 +20,8 @@ package org.apache.maven.archiva.converter;
*/
import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.PathUtil;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.converter.legacy.LegacyRepositoryConverter;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
@@ -49,7 +48,7 @@ public class RepositoryConverterTest
{
private ArtifactRepository sourceRepository;
- private ArchivaRepository targetRepository;
+ private ManagedRepositoryConfiguration targetRepository;
private LegacyRepositoryConverter repositoryConverter;
@@ -77,8 +76,11 @@ public class RepositoryConverterTest
File targetBase = getTestFile( "target/test-target-repository" );
copyDirectoryStructure( getTestFile( "src/test/target-repository" ), targetBase );
- targetRepository = new ArchivaRepository( "target", "Target Repo", PathUtil.toUrl( targetBase ) );
- targetRepository.getModel().setLayoutName( "default" );
+ targetRepository = new ManagedRepositoryConfiguration();
+ targetRepository.setId( "target" );
+ targetRepository.setName( "Target Repo" );
+ targetRepository.setLocation( targetBase.getAbsolutePath() );
+ targetRepository.setLayout( "default" );
repositoryConverter = (LegacyRepositoryConverter) lookup( LegacyRepositoryConverter.ROLE, "default" );
@@ -144,7 +146,7 @@ public class RepositoryConverterTest
throws IOException, RepositoryConversionException
{
File legacyRepoDir = new File( sourceRepository.getBasedir() );
- File destRepoDir = new File( targetRepository.getUrl().getPath() );
+ File destRepoDir = new File( targetRepository.getLocation() );
List excludes = new ArrayList();
repositoryConverter.convertLegacyRepository( legacyRepoDir, destRepoDir, excludes );
}
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java
index 984c861f8..b45f5727a 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndex.java
@@ -22,9 +22,9 @@ package org.apache.maven.archiva.indexer;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Searchable;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.lucene.LuceneEntryConverter;
import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
-import org.apache.maven.archiva.model.ArchivaRepository;
import java.io.File;
import java.util.Collection;
@@ -116,7 +116,7 @@ public interface RepositoryContentIndex
*
* @return the repository that this index belongs to.
*/
- ArchivaRepository getRepository();
+ ManagedRepositoryConfiguration getRepository();
/**
* Get the analyzer in use for this index.
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndexFactory.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndexFactory.java
index fa80e2d8d..2eb796eed 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndexFactory.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/RepositoryContentIndexFactory.java
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.indexer;
* under the License.
*/
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
/**
* Obtain an index instance.
@@ -34,7 +34,7 @@ public interface RepositoryContentIndexFactory
* @param repository the repository to create the content index from.
* @return the index instance
*/
- RepositoryContentIndex createBytecodeIndex( ArchivaRepository repository );
+ RepositoryContentIndex createBytecodeIndex( ManagedRepositoryConfiguration repository );
/**
* Method to create an instance of the file content index.
@@ -42,7 +42,7 @@ public interface RepositoryContentIndexFactory
* @param repository the repository to create the file content index from.
* @return the index instance
*/
- RepositoryContentIndex createFileContentIndex( ArchivaRepository repository );
+ RepositoryContentIndex createFileContentIndex( ManagedRepositoryConfiguration repository );
/**
* Method to create an instance of the hashcode index.
@@ -50,5 +50,5 @@ public interface RepositoryContentIndexFactory
* @param repository the repository to create the content index from.
* @return the index instance
*/
- RepositoryContentIndex createHashcodeIndex( ArchivaRepository repository );
+ RepositoryContentIndex createHashcodeIndex( ManagedRepositoryConfiguration repository );
}
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/BytecodeIndexTransformer.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/BytecodeIndexTransformer.java
index 53e0b0043..5d232aef5 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/BytecodeIndexTransformer.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/BytecodeIndexTransformer.java
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.indexer.functors;
*/
import org.apache.commons.collections.Transformer;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
-import org.apache.maven.archiva.model.ArchivaRepository;
/**
* BytecodeIndexTransformer
@@ -41,9 +41,9 @@ public class BytecodeIndexTransformer
public Object transform( Object input )
{
- if ( input instanceof ArchivaRepository )
+ if ( input instanceof ManagedRepositoryConfiguration )
{
- return indexFactory.createBytecodeIndex( (ArchivaRepository) input );
+ return indexFactory.createBytecodeIndex( (ManagedRepositoryConfiguration) input );
}
return input;
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/FileContentIndexTransformer.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/FileContentIndexTransformer.java
index 311eb92ac..2b20cbf2e 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/FileContentIndexTransformer.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/FileContentIndexTransformer.java
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.indexer.functors;
*/
import org.apache.commons.collections.Transformer;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
-import org.apache.maven.archiva.model.ArchivaRepository;
/**
* FileContentIndexTransformer
@@ -41,9 +41,9 @@ public class FileContentIndexTransformer
public Object transform( Object input )
{
- if ( input instanceof ArchivaRepository )
+ if ( input instanceof ManagedRepositoryConfiguration )
{
- return indexFactory.createFileContentIndex( (ArchivaRepository) input );
+ return indexFactory.createFileContentIndex( (ManagedRepositoryConfiguration) input );
}
return input;
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/HashcodesIndexTransformer.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/HashcodesIndexTransformer.java
index 56258608a..6101e8891 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/HashcodesIndexTransformer.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/HashcodesIndexTransformer.java
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.indexer.functors;
*/
import org.apache.commons.collections.Transformer;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
-import org.apache.maven.archiva.model.ArchivaRepository;
/**
* HashcodesIndexTransformer
@@ -41,9 +41,9 @@ public class HashcodesIndexTransformer
public Object transform( Object input )
{
- if ( input instanceof ArchivaRepository )
+ if ( input instanceof ManagedRepositoryConfiguration )
{
- return indexFactory.createHashcodeIndex( (ArchivaRepository) input );
+ return indexFactory.createHashcodeIndex( (ManagedRepositoryConfiguration) input );
}
return input;
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/UserAllowedToSearchRepositoryPredicate.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/UserAllowedToSearchRepositoryPredicate.java
index 7ecac1fe3..528de940d 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/UserAllowedToSearchRepositoryPredicate.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/UserAllowedToSearchRepositoryPredicate.java
@@ -20,7 +20,7 @@ package org.apache.maven.archiva.indexer.functors;
*/
import org.apache.commons.collections.Predicate;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
/**
* UserAllowedToSearchRepositoryPredicate
@@ -35,7 +35,7 @@ public class UserAllowedToSearchRepositoryPredicate
{
boolean satisfies = false;
- if ( object instanceof ArchivaRepository )
+ if ( object instanceof ManagedRepositoryConfiguration )
{
// TODO: perform check here.
satisfies = true; // Everyone is allowed! (for now)
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java
index 5fcfa10e5..8793682fa 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndex.java
@@ -29,10 +29,10 @@ import org.apache.lucene.index.TermEnum;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Searchable;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.RepositoryContentIndex;
import org.apache.maven.archiva.indexer.RepositoryIndexException;
import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
-import org.apache.maven.archiva.model.ArchivaRepository;
import java.io.File;
import java.io.IOException;
@@ -64,9 +64,9 @@ public class LuceneRepositoryContentIndex
*/
private LuceneIndexHandlers indexHandlers;
- private ArchivaRepository repository;
+ private ManagedRepositoryConfiguration repository;
- public LuceneRepositoryContentIndex( ArchivaRepository repository, File indexDir, LuceneIndexHandlers handlers )
+ public LuceneRepositoryContentIndex( ManagedRepositoryConfiguration repository, File indexDir, LuceneIndexHandlers handlers )
{
this.repository = repository;
this.indexLocation = indexDir;
@@ -399,7 +399,7 @@ public class LuceneRepositoryContentIndex
return this.indexHandlers.getId();
}
- public ArchivaRepository getRepository()
+ public ManagedRepositoryConfiguration getRepository()
{
return repository;
}
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java
index de6b8626d..8564bd74a 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/lucene/LuceneRepositoryContentIndexFactory.java
@@ -27,7 +27,6 @@ import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
import org.apache.maven.archiva.indexer.bytecode.BytecodeHandlers;
import org.apache.maven.archiva.indexer.filecontent.FileContentHandlers;
import org.apache.maven.archiva.indexer.hashcodes.HashcodesHandlers;
-import org.apache.maven.archiva.model.ArchivaRepository;
import java.io.File;
@@ -46,19 +45,19 @@ public class LuceneRepositoryContentIndexFactory
*/
private ArchivaConfiguration configuration;
- public RepositoryContentIndex createBytecodeIndex( ArchivaRepository repository )
+ public RepositoryContentIndex createBytecodeIndex( ManagedRepositoryConfiguration repository )
{
File indexDir = toIndexDir( repository, "bytecode" );
return new LuceneRepositoryContentIndex( repository, indexDir, new BytecodeHandlers() );
}
- public RepositoryContentIndex createFileContentIndex( ArchivaRepository repository )
+ public RepositoryContentIndex createFileContentIndex( ManagedRepositoryConfiguration repository )
{
File indexDir = toIndexDir( repository, "filecontent" );
return new LuceneRepositoryContentIndex( repository, indexDir, new FileContentHandlers() );
}
- public RepositoryContentIndex createHashcodeIndex( ArchivaRepository repository )
+ public RepositoryContentIndex createHashcodeIndex( ManagedRepositoryConfiguration repository )
{
File indexDir = toIndexDir( repository, "hashcodes" );
return new LuceneRepositoryContentIndex( repository, indexDir, new HashcodesHandlers() );
@@ -71,7 +70,7 @@ public class LuceneRepositoryContentIndexFactory
* @param indexId the id of the index
* @return the directory to put the index into.
*/
- private File toIndexDir( ArchivaRepository repository, String indexId )
+ private File toIndexDir( ManagedRepositoryConfiguration repository, String indexId )
{
// Attempt to get the specified indexDir in the configuration first.
ManagedRepositoryConfiguration repoConfig =
@@ -81,7 +80,7 @@ public class LuceneRepositoryContentIndexFactory
if ( repoConfig == null )
{
// No configured index dir, use the repository path instead.
- String repoPath = repository.getUrl().getPath();
+ String repoPath = repository.getLocation();
indexDir = new File( repoPath, ".index/" + indexId + "/" );
}
else
@@ -90,7 +89,7 @@ public class LuceneRepositoryContentIndexFactory
String repoPath = repoConfig.getIndexDir();
if ( StringUtils.isBlank( repoPath ) )
{
- repoPath = repository.getUrl().getPath();
+ repoPath = repository.getLocation();
if ( !repoPath.endsWith( "/" ) )
{
repoPath += "/";
diff --git a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java
index c98d2500a..3021ab2a5 100644
--- a/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java
+++ b/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearch.java
@@ -41,7 +41,6 @@ import org.apache.maven.archiva.indexer.hashcodes.HashcodesKeys;
import org.apache.maven.archiva.indexer.lucene.LuceneEntryConverter;
import org.apache.maven.archiva.indexer.lucene.LuceneQuery;
import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
-import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -330,7 +329,7 @@ public class DefaultCrossRepositorySearch
{
if ( repo.isScanned() )
{
- localIndexedRepositories.add( ArchivaConfigurationAdaptor.toArchivaRepository( repo ) );
+ localIndexedRepositories.add( repo );
}
}
}
diff --git a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java
index a670a1619..3aaec0272 100644
--- a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java
+++ b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/AbstractIndexerTestCase.java
@@ -19,7 +19,6 @@ package org.apache.maven.archiva.indexer;
* under the License.
*/
-import org.apache.commons.lang.StringUtils;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexWriter;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
@@ -27,7 +26,6 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
@@ -73,7 +71,7 @@ public abstract class AbstractIndexerTestCase
}
public abstract RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory,
- ArchivaRepository repository );
+ ManagedRepositoryConfiguration repository );
public abstract LuceneIndexHandlers getIndexHandler();
@@ -86,14 +84,14 @@ public abstract class AbstractIndexerTestCase
(RepositoryContentIndexFactory) lookup( RepositoryContentIndexFactory.class
.getName(), "lucene" );
- ArchivaRepository repository = createTestIndex( getIndexName() );
+ ManagedRepositoryConfiguration repository = createTestIndex( getIndexName() );
index = createIndex( indexFactory, repository );
indexHandlers = getIndexHandler();
}
- private ArchivaRepository createTestIndex( String indexName )
+ private ManagedRepositoryConfiguration createTestIndex( String indexName )
throws Exception
{
File repoDir = new File( getBasedir(), "src/test/managed-repository" );
@@ -106,10 +104,8 @@ public abstract class AbstractIndexerTestCase
assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
- String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
-
- ArchivaRepository repository =
- new ArchivaRepository( TEST_DEFAULT_REPO_ID, TEST_DEFAULT_REPOSITORY_NAME, repoUri );
+ ManagedRepositoryConfiguration repository = createRepository( TEST_DEFAULT_REPO_ID,
+ TEST_DEFAULT_REPOSITORY_NAME, repoDir );
File indexLocation = new File( testIndexesDir, "/index-" + indexName + "-" + getName() + "/" );
@@ -228,4 +224,13 @@ public abstract class AbstractIndexerTestCase
writer.optimize();
writer.close();
}
+
+ protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+ {
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setLocation( location.getAbsolutePath() );
+ return repo;
+ }
}
diff --git a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.java b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.java
index c0db8e536..a4bba0f41 100644
--- a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.java
+++ b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeIndexTest.java
@@ -19,13 +19,13 @@ package org.apache.maven.archiva.indexer.bytecode;
* under the License.
*/
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.AbstractIndexCreationTestCase;
import org.apache.maven.archiva.indexer.RepositoryContentIndex;
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaRepository;
import java.io.File;
import java.util.Map;
@@ -48,7 +48,7 @@ public class BytecodeIndexTest extends AbstractIndexCreationTestCase
return new BytecodeHandlers();
}
- public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ArchivaRepository repository )
+ public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ManagedRepositoryConfiguration repository )
{
return indexFactory.createBytecodeIndex( repository );
}
diff --git a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java
index 46c0ca84f..2dba5a4b2 100644
--- a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java
+++ b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/bytecode/BytecodeSearchTest.java
@@ -22,13 +22,13 @@ package org.apache.maven.archiva.indexer.bytecode;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.AbstractSearchTestCase;
import org.apache.maven.archiva.indexer.ArtifactKeys;
import org.apache.maven.archiva.indexer.RepositoryContentIndex;
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaRepository;
import java.io.File;
import java.util.HashMap;
@@ -54,7 +54,7 @@ public class BytecodeSearchTest extends AbstractSearchTestCase
return new BytecodeHandlers();
}
- public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ArchivaRepository repository )
+ public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ManagedRepositoryConfiguration repository )
{
return indexFactory.createBytecodeIndex( repository );
}
diff --git a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java
index 2bb635078..6f03d560d 100644
--- a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java
+++ b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesIndexTest.java
@@ -19,13 +19,13 @@ package org.apache.maven.archiva.indexer.hashcodes;
* under the License.
*/
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.AbstractIndexCreationTestCase;
import org.apache.maven.archiva.indexer.RepositoryContentIndex;
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord;
import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaRepository;
/**
* HashcodesIndexTest
@@ -45,7 +45,7 @@ public class HashcodesIndexTest extends AbstractIndexCreationTestCase
return new HashcodesHandlers();
}
- public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ArchivaRepository repository )
+ public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ManagedRepositoryConfiguration repository )
{
return indexFactory.createHashcodeIndex( repository );
}
diff --git a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java
index 18a688f03..b0d7b71ab 100644
--- a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java
+++ b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/hashcodes/HashcodesSearchTest.java
@@ -22,13 +22,13 @@ package org.apache.maven.archiva.indexer.hashcodes;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.AbstractSearchTestCase;
import org.apache.maven.archiva.indexer.ArtifactKeys;
import org.apache.maven.archiva.indexer.RepositoryContentIndex;
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
import org.apache.maven.archiva.indexer.lucene.LuceneIndexHandlers;
import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaRepository;
import java.io.File;
import java.util.HashMap;
@@ -54,7 +54,7 @@ public class HashcodesSearchTest extends AbstractSearchTestCase
return new HashcodesHandlers();
}
- public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ArchivaRepository repository )
+ public RepositoryContentIndex createIndex( RepositoryContentIndexFactory indexFactory, ManagedRepositoryConfiguration repository )
{
return indexFactory.createHashcodeIndex( repository );
}
diff --git a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java
index 40c9e054b..fef16cba7 100644
--- a/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java
+++ b/archiva-base/archiva-indexer/src/test/java/org/apache/maven/archiva/indexer/search/DefaultCrossRepositorySearchTest.java
@@ -19,7 +19,6 @@ package org.apache.maven.archiva.indexer.search;
* under the License.
*/
-import org.apache.commons.lang.StringUtils;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.Query;
@@ -29,7 +28,6 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.indexer.MockConfiguration;
import org.apache.maven.archiva.indexer.RepositoryContentIndex;
import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
@@ -62,10 +60,7 @@ public class DefaultCrossRepositorySearchTest
assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
- String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
-
- ArchivaRepository repository =
- new ArchivaRepository( TEST_DEFAULT_REPO_ID, TEST_DEFAULT_REPOSITORY_NAME, repoUri );
+ ManagedRepositoryConfiguration repository = createRepository( TEST_DEFAULT_REPO_ID, TEST_DEFAULT_REPOSITORY_NAME, repoDir );
File indexLocation = new File( "target/index-crossrepo-" + getName() + "/" );
@@ -168,4 +163,13 @@ public class DefaultCrossRepositorySearchTest
assertEquals( "Search Result Hits", hitCount, results.getHits().size() );
}
+
+ protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+ {
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setLocation( location.getAbsolutePath() );
+ return repo;
+ }
}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java
deleted file mode 100644
index a0149d727..000000000
--- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.apache.maven.archiva.model;
-
-/*
- * 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.
- */
-
-/**
- * ArchivaRepository
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class ArchivaRepository
-{
- private ArchivaRepositoryModel model;
-
- private RepositoryURL url;
-
- protected boolean blacklisted;
-
- /**
- * Construct a Repository.
- *
- * @param id the unique identifier for this repository.
- * @param name the name for this repository.
- * @param url the base URL for this repository (this should point to the top level URL for the entire repository)
- * @param layout the layout technique for this repository.
- */
- public ArchivaRepository( String id, String name, String url )
- {
- model = new ArchivaRepositoryModel();
-
- model.setId( id );
- model.setName( name );
- setUrl( new RepositoryURL( url ) );
- }
-
- /**
- * Construct a Repository.
- *
- * @param model the model to use
- */
- public ArchivaRepository( ArchivaRepositoryModel model )
- {
- this.model = model;
-
- this.url = new RepositoryURL( model.getUrl() );
- }
-
- public String getId()
- {
- return model.getId();
- }
-
- public void setUrl( RepositoryURL url )
- {
- this.url = url;
- model.setUrl( url.getUrl() );
- }
-
- public RepositoryURL getUrl()
- {
- return this.url;
- }
-
- public void setUsername(String username)
- {
- this.model.setRepositoryUsername(username);
- }
-
- public void setPassword(String password)
- {
- this.model.setRepositoryPassword(password);
- }
-
- public ArchivaRepositoryModel getModel()
- {
- return this.model;
- }
-
- public boolean isBlacklisted()
- {
- return blacklisted;
- }
-
- public void setBlacklisted( boolean blacklisted )
- {
- this.blacklisted = blacklisted;
- }
-
- public String getLayoutType()
- {
- return this.model.getLayoutName();
- }
-
- public String getName()
- {
- return this.model.getName();
- }
-
- public String getUsername()
- {
- return model.getRepositoryUsername();
- }
-
- public String getPassword()
- {
- return model.getRepositoryPassword();
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
-
- sb.append( "ArchivaRepository[" );
- sb.append( this.model.getId() ).append( "," );
- sb.append( this.model.getUrl() );
- sb.append( "]" );
-
- return sb.toString();
- }
-}
diff --git a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
index a2b13a15d..663cc4f71 100644
--- a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
+++ b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
@@ -25,7 +25,7 @@
This object is not serialized to the Database.
</description>
<fields>
- <!-- Note: these are only managed repositories. This should be reviewed as to whether they are still needed -->
+ <!-- Note: these are only managed repositories. This should be reviewed as to whether they are still needed
<field>
<name>repositories</name>
<version>1.0.0+</version>
@@ -34,6 +34,7 @@
<multiplicity>*</multiplicity>
</association>
</field>
+ -->
<field>
<name>artifacts</name>
<version>1.0.0+</version>
@@ -93,7 +94,7 @@
|_| \_\___| .__/ \___/|___/_|\__\___/|_| \__, |
|_| |___/
-->
-
+ <!--
<class stash.storable="true"
jpox.table="REPOSITORIES"
jpox.not-persisted-fields="modelEncoding">
@@ -205,6 +206,7 @@
</codeSegment>
</codeSegments>
</class>
+ -->
<!-- _______________________________________________________________
_ _ _ __ _
@@ -2289,129 +2291,6 @@
private static final long serialVersionUID = -7113629916828442780L;
]]></code>
</codeSegment>
- <codeSegment>
- <version>1.0.0+</version>
- <code><![CDATA[
- private transient long startTimestamp;
-
- public void triggerStart()
- {
- startTimestamp = System.currentTimeMillis();
- }
-
- public void triggerFinished()
- {
- long finished = System.currentTimeMillis();
- setDuration( finished - startTimestamp );
- setWhenGathered( new java.util.Date( finished ) );
- }
-
- public void increaseFileCount()
- {
- this.totalFileCount++;
- }
-
- public void increaseNewFileCount()
- {
- this.newFileCount++;
- }
-
- private transient java.util.List knownConsumers;
-
- private transient java.util.List invalidConsumers;
-
- public void setKnownConsumers( java.util.List consumers )
- {
- knownConsumers = consumers;
- }
-
- public void setInvalidConsumers( java.util.List consumers )
- {
- invalidConsumers = consumers;
- }
-
- private static boolean isEmpty( java.util.Collection coll )
- {
- if ( coll == null )
- {
- return true;
- }
-
- return coll.isEmpty();
- }
-
- public String toDump( ArchivaRepository repo )
- {
- java.text.SimpleDateFormat df = new java.text.SimpleDateFormat();
- StringBuffer buf = new StringBuffer();
-
- buf.append( "\n.\\ Scan of " ).append( this.getRepositoryId() );
- buf.append( " \\.__________________________________________" );
-
- buf.append( "\n Repository URL : " ).append( repo.getUrl() );
- buf.append( "\n Repository Name : " ).append( repo.getModel().getName() );
- buf.append( "\n Repository Layout : " ).append( repo.getModel().getLayoutName() );
-
- buf.append( "\n Known Consumers : " );
- if ( !isEmpty( knownConsumers ) )
- {
- buf.append( "(" ).append( knownConsumers.size() ).append( " configured)" );
- for ( java.util.Iterator iter = knownConsumers.iterator(); iter.hasNext(); )
- {
- String id = (String) iter.next();
- buf.append( "\n " ).append( id );
- }
- }
- else
- {
- buf.append( "<none>" );
- }
-
- buf.append( "\n Invalid Consumers : " );
- if ( !isEmpty( invalidConsumers ) )
- {
- buf.append( "(" ).append( invalidConsumers.size() ).append( " configured)" );
- for ( java.util.Iterator iter = invalidConsumers.iterator(); iter.hasNext(); )
- {
- String id = (String) iter.next();
- buf.append( "\n " ).append( id );
- }
- }
- else
- {
- buf.append( "<none>" );
- }
-
- buf.append( "\n Duration : " );
- buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) );
- buf.append( "\n When Gathered : " );
- if ( this.getWhenGathered() == null )
- {
- buf.append( "<null>" );
- }
- else
- {
- buf.append( df.format( this.getWhenGathered() ) );
- }
-
- buf.append( "\n Total File Count : " ).append( this.getTotalFileCount() );
-
- long averageMsPerFile = 0;
-
- if ( this.totalFileCount != 0 )
- {
- averageMsPerFile = ( this.getDuration() / this.getTotalFileCount() );
- }
-
- buf.append( "\n Avg Time Per File : " );
- buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) );
- buf.append( "\n______________________________________________________________" );
-
- return buf.toString();
- }
-
- ]]></code>
- </codeSegment>
</codeSegments>
</class>
</classes>
diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
index 0251768d7..7a0251874 100644
--- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
+++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
@@ -28,15 +28,14 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
-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.RepositoryURL;
import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.policies.DownloadPolicy;
import org.apache.maven.archiva.policies.PostDownloadPolicy;
import org.apache.maven.archiva.policies.PreDownloadPolicy;
import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
-import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
import org.apache.maven.archiva.repository.layout.LayoutException;
@@ -132,7 +131,7 @@ public class DefaultRepositoryProxyConnectors
* could not be) fetched.
* @throws ProxyException if there was a problem fetching the artifact.
*/
- public File fetchFromProxies( ArchivaRepository repository, ArtifactReference artifact )
+ public File fetchFromProxies( ManagedRepositoryConfiguration repository, ArtifactReference artifact )
throws ProxyException
{
File localFile = toLocalFile( repository, artifact );
@@ -141,9 +140,9 @@ public class DefaultRepositoryProxyConnectors
requestProperties.setProperty( "version", artifact.getVersion() );
List<ProxyConnector> connectors = getProxyConnectors( repository );
- for( ProxyConnector connector: connectors )
+ for ( ProxyConnector connector : connectors )
{
- ArchivaRepository targetRepository = connector.getTargetRepository();
+ RemoteRepositoryConfiguration targetRepository = connector.getTargetRepository();
String targetPath = getLayout( targetRepository ).toPath( artifact );
File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile, requestProperties );
@@ -163,7 +162,7 @@ public class DefaultRepositoryProxyConnectors
*
* @return the (local) metadata file that was fetched/merged/updated, or null if no metadata file exists.
*/
- public File fetchFromProxies( ArchivaRepository repository, VersionedReference metadata )
+ public File fetchFromProxies( ManagedRepositoryConfiguration repository, VersionedReference metadata )
throws ProxyException
{
File localFile = toLocalFile( repository, metadata );
@@ -172,9 +171,9 @@ public class DefaultRepositoryProxyConnectors
boolean hasFetched = false;
List<ProxyConnector> connectors = getProxyConnectors( repository );
- for( ProxyConnector connector: connectors )
+ for ( ProxyConnector connector : connectors )
{
- ArchivaRepository targetRepository = connector.getTargetRepository();
+ RemoteRepositoryConfiguration targetRepository = connector.getTargetRepository();
String targetPath = metadataTools.toPath( metadata );
File localRepoFile = toLocalRepoFile( repository, targetRepository, targetPath );
@@ -226,7 +225,7 @@ public class DefaultRepositoryProxyConnectors
*
* @return the (local) metadata file that was fetched/merged/updated, or null if no metadata file exists.
*/
- public File fetchFromProxies( ArchivaRepository repository, ProjectReference metadata )
+ public File fetchFromProxies( ManagedRepositoryConfiguration repository, ProjectReference metadata )
throws ProxyException
{
File localFile = toLocalFile( repository, metadata );
@@ -235,9 +234,9 @@ public class DefaultRepositoryProxyConnectors
boolean hasFetched = false;
List<ProxyConnector> connectors = getProxyConnectors( repository );
- for( ProxyConnector connector: connectors )
+ for ( ProxyConnector connector : connectors )
{
- ArchivaRepository targetRepository = connector.getTargetRepository();
+ RemoteRepositoryConfiguration targetRepository = connector.getTargetRepository();
String targetPath = metadataTools.toPath( metadata );
File localRepoFile = toLocalRepoFile( repository, targetRepository, targetPath );
@@ -284,16 +283,17 @@ public class DefaultRepositoryProxyConnectors
return null;
}
- private File toLocalRepoFile( ArchivaRepository repository, ArchivaRepository targetRepository, String targetPath )
+ private File toLocalRepoFile( ManagedRepositoryConfiguration repository,
+ RemoteRepositoryConfiguration targetRepository, String targetPath )
{
String repoPath = metadataTools.getRepositorySpecificName( targetRepository, targetPath );
- return new File( repository.getUrl().getPath(), repoPath );
+ return new File( repository.getLocation(), repoPath );
}
/**
- * Test if the provided ArchivaRepository has any proxies configured for it.
+ * Test if the provided ManagedRepositoryConfiguration has any proxies configured for it.
*/
- public boolean hasProxies( ArchivaRepository repository )
+ public boolean hasProxies( ManagedRepositoryConfiguration repository )
{
synchronized ( this.proxyConnectorMap )
{
@@ -301,26 +301,26 @@ public class DefaultRepositoryProxyConnectors
}
}
- private File toLocalFile( ArchivaRepository repository, ArtifactReference artifact )
+ private File toLocalFile( ManagedRepositoryConfiguration repository, ArtifactReference artifact )
throws ProxyException
{
BidirectionalRepositoryLayout sourceLayout = getLayout( repository );
String sourcePath = sourceLayout.toPath( artifact );
- return new File( repository.getUrl().getPath(), sourcePath );
+ return new File( repository.getLocation(), sourcePath );
}
- private File toLocalFile( ArchivaRepository repository, ProjectReference metadata )
+ private File toLocalFile( ManagedRepositoryConfiguration repository, ProjectReference metadata )
throws ProxyException
{
String sourcePath = metadataTools.toPath( metadata );
- return new File( repository.getUrl().getPath(), sourcePath );
+ return new File( repository.getLocation(), sourcePath );
}
- private File toLocalFile( ArchivaRepository repository, VersionedReference metadata )
+ private File toLocalFile( ManagedRepositoryConfiguration repository, VersionedReference metadata )
throws ProxyException
{
String sourcePath = metadataTools.toPath( metadata );
- return new File( repository.getUrl().getPath(), sourcePath );
+ return new File( repository.getLocation(), sourcePath );
}
/**
@@ -331,17 +331,43 @@ public class DefaultRepositoryProxyConnectors
* @throws ProxyException if there was a problem obtaining the layout from the repository (usually due to a bad
* configuration of the repository)
*/
- private BidirectionalRepositoryLayout getLayout( ArchivaRepository repository )
+ private BidirectionalRepositoryLayout getLayout( ManagedRepositoryConfiguration repository )
throws ProxyException
{
try
{
- return layoutFactory.getLayout( repository.getLayoutType() );
+ return layoutFactory.getLayout( repository.getLayout() );
}
catch ( LayoutException e )
{
- throw new ProxyException( "Unable to proxy due to bad repository layout definition [" + repository.getId()
- + "] had a layout defined as [" + repository.getLayoutType() + "] : " + e.getMessage(), e );
+ throw new ProxyException(
+ "Unable to proxy due to bad managed repository layout definition ["
+ + repository.getId() + "] had a layout defined as [" + repository.getLayout()
+ + "] : " + e.getMessage(), e );
+ }
+ }
+
+ /**
+ * Get the layout for the repository.
+ *
+ * @param repository the repository to get the layout from.
+ * @return the layout
+ * @throws ProxyException if there was a problem obtaining the layout from the repository (usually due to a bad
+ * configuration of the repository)
+ */
+ private BidirectionalRepositoryLayout getLayout( RemoteRepositoryConfiguration repository )
+ throws ProxyException
+ {
+ try
+ {
+ return layoutFactory.getLayout( repository.getLayout() );
+ }
+ catch ( LayoutException e )
+ {
+ throw new ProxyException(
+ "Unable to proxy due to bad remote repository layout definition ["
+ + repository.getId() + "] had a layout defined as [" + repository.getLayout()
+ + "] : " + e.getMessage(), e );
}
}
@@ -382,11 +408,11 @@ public class DefaultRepositoryProxyConnectors
* @return the local file that was downloaded, or null if not downloaded.
* @throws ProxyException if transfer was unsuccessful.
*/
- private File transferFile( ProxyConnector connector, ArchivaRepository remoteRepository, String remotePath,
- File localFile, Properties requestProperties )
+ private File transferFile( ProxyConnector connector, RemoteRepositoryConfiguration remoteRepository,
+ String remotePath, File localFile, Properties requestProperties )
throws ProxyException
{
- String url = remoteRepository.getUrl().toString() + remotePath;
+ String url = remoteRepository.getUrl() + remotePath;
requestProperties.setProperty( "url", url );
// Is a whitelist defined?
@@ -423,7 +449,8 @@ public class DefaultRepositoryProxyConnectors
Wagon wagon = null;
try
{
- String protocol = remoteRepository.getUrl().getProtocol();
+ RepositoryURL repoUrl = new RepositoryURL( remoteRepository.getUrl() );
+ String protocol = repoUrl.getProtocol();
wagon = (Wagon) wagons.get( protocol );
if ( wagon == null )
{
@@ -497,11 +524,11 @@ public class DefaultRepositoryProxyConnectors
* @param type the type of checksum to transfer (example: ".md5" or ".sha1")
* @throws ProxyException if copying the downloaded file into place did not succeed.
*/
- private void transferChecksum( Wagon wagon, ArchivaRepository remoteRepository, String remotePath, File localFile,
- String type )
+ private void transferChecksum( Wagon wagon, RemoteRepositoryConfiguration remoteRepository, String remotePath,
+ File localFile, String type )
throws ProxyException
{
- String url = remoteRepository.getUrl().toString() + remotePath;
+ String url = remoteRepository.getUrl() + remotePath;
// Transfer checksum does not use the policy.
if ( urlFailureCache.hasFailedBefore( url + type ) )
@@ -537,7 +564,8 @@ public class DefaultRepositoryProxyConnectors
* @throws ProxyException if there was a problem moving the downloaded file into place.
* @throws WagonException if there was a problem tranfering the file.
*/
- private File transferSimpleFile( Wagon wagon, ArchivaRepository remoteRepository, String remotePath, File localFile )
+ private File transferSimpleFile( Wagon wagon, RemoteRepositoryConfiguration remoteRepository, String remotePath,
+ File localFile )
throws ProxyException, WagonException
{
assert ( remotePath != null );
@@ -612,9 +640,10 @@ public class DefaultRepositoryProxyConnectors
* @param localFile the local file (utilized by the {@link DownloadPolicy#applyPolicy(String,Properties,File)})
* @return true if all of the policies passed, false if a policy failed.
*/
- private boolean applyPolicies( Map<String, ? extends DownloadPolicy> policies, Map<String, String> settings, Properties request, File localFile )
+ private boolean applyPolicies( Map<String, ? extends DownloadPolicy> policies, Map<String, String> settings,
+ Properties request, File localFile )
{
- for( Entry<String, ? extends DownloadPolicy> entry: policies.entrySet() )
+ for ( Entry<String, ? extends DownloadPolicy> entry : policies.entrySet() )
{
String key = (String) entry.getKey();
DownloadPolicy policy = entry.getValue();
@@ -674,7 +703,8 @@ public class DefaultRepositoryProxyConnectors
* @param remoteRepository the remote repository to connect to.
* @return true if the connection was successful. false if not connected.
*/
- private boolean connectToRepository( ProxyConnector connector, Wagon wagon, ArchivaRepository remoteRepository )
+ private boolean connectToRepository( ProxyConnector connector, Wagon wagon,
+ RemoteRepositoryConfiguration remoteRepository )
{
boolean connected = false;
@@ -691,7 +721,7 @@ public class DefaultRepositoryProxyConnectors
String password = remoteRepository.getPassword();
if ( username != null && password != null )
{
- getLogger().info(
+ getLogger().debug(
"Using username " + username + " to connect to remote repository "
+ remoteRepository.getUrl() );
authInfo = new AuthenticationInfo();
@@ -700,7 +730,7 @@ public class DefaultRepositoryProxyConnectors
}
else
{
- getLogger().info( "No authentication for remote repository needed" );
+ getLogger().debug( "No authentication for remote repository needed" );
}
Repository wagonRepository = new Repository( remoteRepository.getId(), remoteRepository.getUrl().toString() );
@@ -742,7 +772,7 @@ public class DefaultRepositoryProxyConnectors
return false;
}
- for( String pattern: patterns )
+ for ( String pattern : patterns )
{
if ( SelectorUtils.matchPath( pattern, path, false ) )
{
@@ -756,7 +786,7 @@ public class DefaultRepositoryProxyConnectors
/**
* TODO: Ensure that list is correctly ordered based on configuration. See MRM-477
*/
- public List<ProxyConnector> getProxyConnectors( ArchivaRepository repository )
+ public List<ProxyConnector> getProxyConnectors( ManagedRepositoryConfiguration repository )
{
synchronized ( this.proxyConnectorMap )
{
@@ -765,6 +795,8 @@ public class DefaultRepositoryProxyConnectors
{
return Collections.EMPTY_LIST;
}
+
+ Collections.sort( ret, ProxyConnectorOrderComparator.getInstance() );
return ret;
}
}
@@ -792,8 +824,9 @@ public class DefaultRepositoryProxyConnectors
ProxyConnectorOrderComparator proxyOrderSorter = new ProxyConnectorOrderComparator();
this.proxyConnectorMap.clear();
- List<ProxyConnectorConfiguration> proxyConfigs = archivaConfiguration.getConfiguration().getProxyConnectors();
- for( ProxyConnectorConfiguration proxyConfig: proxyConfigs )
+ List<ProxyConnectorConfiguration> proxyConfigs = archivaConfiguration.getConfiguration()
+ .getProxyConnectors();
+ for ( ProxyConnectorConfiguration proxyConfig : proxyConfigs )
{
String key = proxyConfig.getSourceRepoId();
@@ -831,23 +864,23 @@ public class DefaultRepositoryProxyConnectors
// Add the connector.
connectors.add( connector );
-
+
// Ensure the list is sorted.
Collections.sort( connectors, proxyOrderSorter );
// Set the key to the list of connectors.
this.proxyConnectorMap.put( key, connectors );
}
-
-
+
}
synchronized ( this.networkProxyMap )
{
this.networkProxyMap.clear();
- List<NetworkProxyConfiguration> networkProxies = archivaConfiguration.getConfiguration().getNetworkProxies();
- for( NetworkProxyConfiguration networkProxyConfig: networkProxies )
+ List<NetworkProxyConfiguration> networkProxies = archivaConfiguration.getConfiguration()
+ .getNetworkProxies();
+ for ( NetworkProxyConfiguration networkProxyConfig : networkProxies )
{
String key = networkProxyConfig.getId();
@@ -864,24 +897,14 @@ public class DefaultRepositoryProxyConnectors
}
}
- private ArchivaRepository getRemoteRepository( String repoId )
+ private RemoteRepositoryConfiguration getRemoteRepository( String repoId )
{
- RemoteRepositoryConfiguration repoConfig = archivaConfiguration.getConfiguration()
- .findRemoteRepositoryById( repoId );
-
- ArchivaRepository repo = new ArchivaRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl() );
- repo.getModel().setLayoutName( repoConfig.getLayout() );
- repo.setUsername( repoConfig.getUsername() );
- repo.setPassword( repoConfig.getPassword() );
- return repo;
+ return archivaConfiguration.getConfiguration().findRemoteRepositoryById( repoId );
}
- private ArchivaRepository getManagedRepository( String repoId )
+ private ManagedRepositoryConfiguration getManagedRepository( String repoId )
{
- ManagedRepositoryConfiguration repoConfig = archivaConfiguration.getConfiguration()
- .findManagedRepositoryById( repoId );
-
- return ArchivaConfigurationAdaptor.toArchivaRepository( repoConfig );
+ return archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId );
}
public void initialize()
diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
index d40034856..a17cc2b24 100644
--- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
+++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/ProxyConnector.java
@@ -19,7 +19,8 @@ package org.apache.maven.archiva.proxy;
* under the License.
*/
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.repository.connector.RepositoryConnector;
import java.util.Iterator;
@@ -35,9 +36,9 @@ import java.util.Map;
public class ProxyConnector
implements RepositoryConnector
{
- private ArchivaRepository sourceRepository;
+ private ManagedRepositoryConfiguration sourceRepository;
- private ArchivaRepository targetRepository;
+ private RemoteRepositoryConfiguration targetRepository;
private List<String> blacklist;
@@ -59,22 +60,22 @@ public class ProxyConnector
this.blacklist = blacklist;
}
- public ArchivaRepository getSourceRepository()
+ public ManagedRepositoryConfiguration getSourceRepository()
{
return sourceRepository;
}
- public void setSourceRepository( ArchivaRepository sourceRepository )
+ public void setSourceRepository( ManagedRepositoryConfiguration sourceRepository )
{
this.sourceRepository = sourceRepository;
}
- public ArchivaRepository getTargetRepository()
+ public RemoteRepositoryConfiguration getTargetRepository()
{
return targetRepository;
}
- public void setTargetRepository( ArchivaRepository targetRepository )
+ public void setTargetRepository( RemoteRepositoryConfiguration targetRepository )
{
this.targetRepository = targetRepository;
}
diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java
index 1a0ef7ac5..083705abb 100644
--- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java
+++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/RepositoryProxyConnectors.java
@@ -19,7 +19,7 @@ package org.apache.maven.archiva.proxy;
* under the License.
*/
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
@@ -47,7 +47,7 @@ public interface RepositoryProxyConnectors
* @return true if the fetch operation succeeded in obtaining content, false if no content was obtained.
* @throws ProxyException if there was a problem fetching the content from the target repositories.
*/
- public File fetchFromProxies( ArchivaRepository repository, ArtifactReference artifact )
+ public File fetchFromProxies( ManagedRepositoryConfiguration repository, ArtifactReference artifact )
throws ProxyException;
/**
@@ -62,7 +62,7 @@ public interface RepositoryProxyConnectors
* @return true if the fetch operation succeeded in obtaining content, false if no content was obtained.
* @throws ProxyException if there was a problem fetching the content from the target repositories.
*/
- public File fetchFromProxies( ArchivaRepository repository, VersionedReference metadata )
+ public File fetchFromProxies( ManagedRepositoryConfiguration repository, VersionedReference metadata )
throws ProxyException;
/**
@@ -77,7 +77,7 @@ public interface RepositoryProxyConnectors
* @return true if the fetch operation succeeded in obtaining content, false if no content was obtained.
* @throws ProxyException if there was a problem fetching the content from the target repositories.
*/
- public File fetchFromProxies( ArchivaRepository repository, ProjectReference metadata )
+ public File fetchFromProxies( ManagedRepositoryConfiguration repository, ProjectReference metadata )
throws ProxyException;
/**
@@ -86,7 +86,7 @@ public interface RepositoryProxyConnectors
* @param repository the source repository to look for.
* @return the List of {@link ProxyConnector} objects.
*/
- public List<ProxyConnector> getProxyConnectors( ArchivaRepository repository );
+ public List<ProxyConnector> getProxyConnectors( ManagedRepositoryConfiguration repository );
/**
* Tests to see if the provided repository is a source repository for
@@ -96,5 +96,5 @@ public interface RepositoryProxyConnectors
* @return true if there are proxy connectors that use the provided
* repository as a source repository.
*/
- public boolean hasProxies( ArchivaRepository repository );
+ public boolean hasProxies( ManagedRepositoryConfiguration repository );
}
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
index 53631e4c3..e3f89d50d 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
@@ -20,14 +20,16 @@ package org.apache.maven.archiva.proxy;
*/
import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.policies.CachedFailuresPolicy;
+import org.apache.maven.archiva.policies.ChecksumPolicy;
+import org.apache.maven.archiva.policies.ReleasesPolicy;
+import org.apache.maven.archiva.policies.SnapshotsPolicy;
import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
@@ -93,11 +95,11 @@ public abstract class AbstractProxyTestCase
protected RepositoryProxyConnectors proxyHandler;
- protected ArchivaRepository managedDefaultRepository;
+ protected ManagedRepositoryConfiguration managedDefaultRepository;
protected File managedDefaultDir;
- protected ArchivaRepository managedLegacyRepository;
+ protected ManagedRepositoryConfiguration managedLegacyRepository;
protected File managedLegacyDir;
@@ -246,40 +248,25 @@ public abstract class AbstractProxyTestCase
return ref;
}
- protected ArchivaRepository createManagedLegacyRepository()
+ protected ManagedRepositoryConfiguration createManagedLegacyRepository()
{
- return createRepository( "src/test/repositories/legacy-managed", "testManagedLegacyRepo",
- "Test Managed (Legacy) Repository", "legacy" );
+ return createRepository( "testManagedLegacyRepo", "Test Managed (Legacy) Repository",
+ "src/test/repositories/legacy-managed", "legacy" );
}
- protected ArchivaRepository createProxiedLegacyRepository()
+ protected ManagedRepositoryConfiguration createProxiedLegacyRepository()
{
- return createRepository( "src/test/repositories/legacy-proxied", "testProxiedLegacyRepo",
- "Test Proxied (Legacy) Repository", "legacy" );
+ return createRepository( "testProxiedLegacyRepo", "Test Proxied (Legacy) Repository",
+ "src/test/repositories/legacy-proxied", "legacy" );
}
- protected ManagedRepositoryConfiguration createRepoConfig( ArchivaRepository repo )
+ protected ManagedRepositoryConfiguration createRepository( String id, String name, String path, String layout )
{
- return createRepoConfig( repo.getId(), repo.getName(), repo.getUrl().toString(), repo.getLayoutType() );
- }
-
- protected ManagedRepositoryConfiguration createRepoConfig( String id, String name, String path, String layout )
- {
- ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
-
- repoConfig.setId( id );
- repoConfig.setName( name );
-
- repoConfig.setLocation( path );
- repoConfig.setLayout( layout );
-
- return repoConfig;
- }
-
- protected ArchivaRepository createRepository( String id, String name, String path, String layout )
- {
- ArchivaRepository repo = new ArchivaRepository( id, name, PathUtil.toUrl( path ) );
- repo.getModel().setLayoutName( layout );
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setLocation( path );
+ repo.setLayout( layout );
return repo;
}
@@ -320,6 +307,12 @@ public abstract class AbstractProxyTestCase
}
}
}
+
+ protected void saveConnector( String sourceRepoId, String targetRepoId )
+ {
+ saveConnector( sourceRepoId, targetRepoId, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ }
protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
String snapshotPolicy, String cacheFailuresPolicy )
@@ -356,24 +349,33 @@ public abstract class AbstractProxyTestCase
repoConfig.setLocation( path );
+ int count = config.getConfiguration().getManagedRepositories().size();
config.getConfiguration().addManagedRepository( repoConfig );
- config.triggerChange( "repository", "" );
+ String prefix = "managedRepositories.managedRepository(" + count + ")";
+ config.triggerChange( prefix + ".id", repoConfig.getId() );
+ config.triggerChange( prefix + ".name", repoConfig.getName() );
+ config.triggerChange( prefix + ".location", repoConfig.getLocation() );
+ config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
}
- protected void saveRemoteRepositoryConfig( String id, String name, String path, String layout )
+ protected void saveRemoteRepositoryConfig( String id, String name, String url, String layout )
{
RemoteRepositoryConfiguration repoConfig = new RemoteRepositoryConfiguration();
repoConfig.setId( id );
repoConfig.setName( name );
repoConfig.setLayout( layout );
+ repoConfig.setUrl( url );
- repoConfig.setUrl( path );
-
+ int count = config.getConfiguration().getRemoteRepositories().size();
config.getConfiguration().addRemoteRepository( repoConfig );
- config.triggerChange( "repository", "" );
+ String prefix = "remoteRepositories.remoteRepository(" + count + ")";
+ config.triggerChange( prefix + ".id", repoConfig.getId() );
+ config.triggerChange( prefix + ".name", repoConfig.getName() );
+ config.triggerChange( prefix + ".url", repoConfig.getUrl() );
+ config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
}
protected File saveTargetedRepositoryConfig( String id, String originalPath, String targetPath, String layout )
@@ -388,6 +390,7 @@ public abstract class AbstractProxyTestCase
return repoLocation;
}
+ @Override
protected void setUp()
throws Exception
{
@@ -405,9 +408,9 @@ public abstract class AbstractProxyTestCase
managedDefaultRepository =
createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" );
- managedDefaultDir = new File( managedDefaultRepository.getUrl().getPath() );
+ managedDefaultDir = new File( managedDefaultRepository.getLocation() );
- ManagedRepositoryConfiguration repoConfig = createRepoConfig( managedDefaultRepository );
+ ManagedRepositoryConfiguration repoConfig = managedDefaultRepository;
config.getConfiguration().addManagedRepository( repoConfig );
@@ -419,9 +422,9 @@ public abstract class AbstractProxyTestCase
managedLegacyRepository = createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository",
REPOPATH_LEGACY_MANAGED_TARGET, "legacy" );
- managedLegacyDir = new File( managedLegacyRepository.getUrl().getPath() );
+ managedLegacyDir = new File( managedLegacyRepository.getLocation() );
- repoConfig = createRepoConfig( managedLegacyRepository );
+ repoConfig = managedLegacyRepository;
config.getConfiguration().addManagedRepository( repoConfig );
@@ -484,7 +487,7 @@ public abstract class AbstractProxyTestCase
{
// This is just a warning.
System.err.println(
- "Skipping setup of testable managed repsoitory, source dir does not exist: " + sourceDir );
+ "[WARN] Skipping setup of testable managed repository, source dir does not exist: " + sourceDir );
return;
}
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AllTests.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AllTests.java
deleted file mode 100644
index 548c6d860..000000000
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AllTests.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.maven.archiva.proxy;
-
-/*
- * 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 junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * IDE Provided Utility Class for all tests.
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class AllTests
-{
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.proxy" );
- //$JUnit-BEGIN$
- suite.addTestSuite( ChecksumTransferTest.class );
- suite.addTestSuite( MetadataTransferTest.class );
- suite.addTestSuite( CacheFailuresTransferTest.class );
- suite.addTestSuite( ManagedDefaultTransferTest.class );
- suite.addTestSuite( SnapshotTransferTest.class );
- suite.addTestSuite( ManagedLegacyTransferTest.class );
- suite.addTestSuite( RelocateTransferTest.class );
- //$JUnit-END$
- return suite;
- }
-}
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java
index 622c7bc04..ba1cc6b17 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.java
@@ -44,7 +44,7 @@ public class CacheFailuresTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
- File expectedFile = new File( managedDefaultDir, path );
+ File expectedFile = new File( managedDefaultDir.getAbsoluteFile(), path );
ArtifactReference artifact = createArtifactReference( "default", path );
expectedFile.delete();
@@ -78,7 +78,7 @@ public class CacheFailuresTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
- File expectedFile = new File( managedDefaultDir, path );
+ File expectedFile = new File( managedDefaultDir.getAbsoluteFile(), path );
ArtifactReference artifact = createArtifactReference( "default", path );
expectedFile.delete();
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
index 08163e452..0087fda97 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
@@ -286,10 +286,8 @@ public class ManagedDefaultTransferTest
wagonMockControl.replay();
// Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
- SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
- SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied" );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2 );
// Attempt the proxy fetch.
File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
@@ -307,7 +305,7 @@ public class ManagedDefaultTransferTest
String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
setupTestableManagedRepository( path );
- File expectedFile = new File( managedDefaultDir, path );
+ File expectedFile = new File( managedDefaultDir.getAbsoluteFile(), path );
ArtifactReference artifact = createArtifactReference( "default", path );
expectedFile.delete();
@@ -318,15 +316,14 @@ public class ManagedDefaultTransferTest
saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://dead.machine.com/repo/", "default" );
// Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
- SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
- SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied1" );
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied2" );
- wagonMock.getIfNewer( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ), 0 );
+ File tmpFile = new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" );
+ wagonMock.getIfNewer( path, tmpFile, 0 );
wagonMockControl.setThrowable( new TransferFailedException( "transfer failed" ) );
- wagonMock.getIfNewer( path, new File( expectedFile.getParentFile(), expectedFile.getName() + ".tmp" ), 0 );
+ wagonMock.getIfNewer( path, tmpFile, 0 );
wagonMockControl.setThrowable( new TransferFailedException( "transfer failed" ) );
wagonMockControl.replay();
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java
index 75985185d..e6a4d6f62 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/WagonDelegate.java
@@ -61,7 +61,7 @@ public class WagonDelegate
public boolean getIfNewer( String resourceName, File destination, long timestamp )
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
- getLogger().debug( ".getIfNewer(" + resourceName + ", " + destination + ", " + timestamp + ")" );
+ getLogger().info( ".getIfNewer(" + resourceName + ", " + destination + ", " + timestamp + ")" );
boolean result = delegate.getIfNewer( resourceName, destination, timestamp );
createIfMissing( destination );
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaConfigurationAdaptor.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaConfigurationAdaptor.java
deleted file mode 100644
index 21aabb429..000000000
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ArchivaConfigurationAdaptor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.apache.maven.archiva.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 org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.PathUtil;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepository;
-
-/**
- * ArchivaConfigurationAdaptor
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- * @todo the whole need for 2 objects is a consequence of using jpox. hopefully JPA will address some of this mess.
- */
-public class ArchivaConfigurationAdaptor
-{
- private ArchivaConfigurationAdaptor()
- {
- }
-
- public static ArchivaRepository toArchivaRepository( ManagedRepositoryConfiguration config )
- {
- if ( config == null )
- {
- throw new IllegalArgumentException( "Unable to convert null repository config to archiva repository." );
- }
-
- if ( StringUtils.isBlank( config.getId() ) )
- {
- throw new IllegalArgumentException( "Unable to repository config with blank ID to archiva repository." );
- }
-
- if ( StringUtils.isBlank( config.getLocation() ) )
- {
- throw new IllegalArgumentException(
- "Unable to convert repository config with blank location to archiva repository." );
- }
-
- ArchivaRepository repository =
- new ArchivaRepository( config.getId(), config.getName(), PathUtil.toUrl( config.getLocation() ) );
-
- repository.getModel().setLayoutName( config.getLayout() );
- repository.getModel().setReleasePolicy( config.isReleases() );
- repository.getModel().setSnapshotPolicy( config.isSnapshots() );
-
- return repository;
- }
-}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
index 21d479416..a656df066 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/connector/RepositoryConnector.java
@@ -19,7 +19,8 @@ package org.apache.maven.archiva.repository.connector;
* under the License.
*/
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import java.util.List;
@@ -31,11 +32,11 @@ import java.util.List;
*/
public interface RepositoryConnector
{
- public ArchivaRepository getSourceRepository();
+ public ManagedRepositoryConfiguration getSourceRepository();
- public ArchivaRepository getTargetRepository();
+ public RemoteRepositoryConfiguration getTargetRepository();
- public List getBlacklist();
+ public List<String> getBlacklist();
- public List getWhitelist();
+ public List<String> getWhitelist();
}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
index ed3d6b639..6b90bf161 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
@@ -24,8 +24,9 @@ import org.apache.maven.archiva.common.utils.VersionUtil;
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.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
@@ -116,7 +117,7 @@ public class MetadataTools
* @return the Set of available versions, based on the project reference.
* @throws LayoutException
*/
- public Set<String> gatherAvailableVersions( ArchivaRepository managedRepository, ProjectReference reference )
+ public Set<String> gatherAvailableVersions( ManagedRepositoryConfiguration managedRepository, ProjectReference reference )
throws LayoutException, IOException
{
String path = toPath( reference );
@@ -127,7 +128,7 @@ public class MetadataTools
path = path.substring( 0, idx );
}
- File repoDir = new File( managedRepository.getUrl().getPath(), path );
+ File repoDir = new File( managedRepository.getLocation(), path );
if ( !repoDir.exists() )
{
@@ -169,7 +170,7 @@ public class MetadataTools
return foundVersions;
}
- private boolean hasArtifact( ArchivaRepository managedRepository, VersionedReference reference )
+ private boolean hasArtifact( ManagedRepositoryConfiguration managedRepository, VersionedReference reference )
throws LayoutException
{
try
@@ -192,10 +193,10 @@ public class MetadataTools
* @throws IOException if the versioned reference is invalid (example: doesn't exist, or isn't a directory)
* @throws LayoutException
*/
- public ArtifactReference getFirstArtifact( ArchivaRepository managedRepository, VersionedReference reference )
+ public ArtifactReference getFirstArtifact( ManagedRepositoryConfiguration managedRepository, VersionedReference reference )
throws LayoutException, IOException
{
- BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayoutType() );
+ BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayout() );
String path = toPath( reference );
int idx = path.lastIndexOf( '/' );
@@ -204,7 +205,7 @@ public class MetadataTools
path = path.substring( 0, idx );
}
- File repoDir = new File( managedRepository.getUrl().getPath(), path );
+ File repoDir = new File( managedRepository.getLocation(), path );
if ( !repoDir.exists() )
{
@@ -227,7 +228,7 @@ public class MetadataTools
continue;
}
- String relativePath = PathUtil.getRelative( managedRepository.getUrl().getPath(), repoFiles[i] );
+ String relativePath = PathUtil.getRelative( managedRepository.getLocation(), repoFiles[i] );
if ( matchesArtifactPattern( relativePath ) )
{
@@ -247,10 +248,10 @@ public class MetadataTools
* @return the Set of snapshot artifact versions found.
* @throws LayoutException
*/
- public Set<String> gatherSnapshotVersions( ArchivaRepository managedRepository, VersionedReference reference )
+ public Set<String> gatherSnapshotVersions( ManagedRepositoryConfiguration managedRepository, VersionedReference reference )
throws LayoutException, IOException
{
- BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayoutType() );
+ BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayout() );
String path = toPath( reference );
int idx = path.lastIndexOf( '/' );
@@ -259,7 +260,7 @@ public class MetadataTools
path = path.substring( 0, idx );
}
- File repoDir = new File( managedRepository.getUrl().getPath(), path );
+ File repoDir = new File( managedRepository.getLocation(), path );
if ( !repoDir.exists() )
{
@@ -285,7 +286,7 @@ public class MetadataTools
continue;
}
- String relativePath = PathUtil.getRelative( managedRepository.getUrl().getPath(), repoFiles[i] );
+ String relativePath = PathUtil.getRelative( managedRepository.getLocation(), repoFiles[i] );
if ( matchesArtifactPattern( relativePath ) )
{
@@ -490,7 +491,7 @@ public class MetadataTools
* @param path the path to the metadata.xml file to adjust the name of.
* @return the newly adjusted path reference to the repository specific metadata path.
*/
- public String getRepositorySpecificName( ArchivaRepository repository, String path )
+ public String getRepositorySpecificName( RemoteRepositoryConfiguration repository, String path )
{
return getRepositorySpecificName( repository.getId(), path );
}
@@ -528,11 +529,11 @@ public class MetadataTools
configuration.addChangeListener( this );
}
- public ArchivaRepositoryMetadata readProxyMetadata( ArchivaRepository managedRepository, ProjectReference reference,
+ public ArchivaRepositoryMetadata readProxyMetadata( ManagedRepositoryConfiguration managedRepository, ProjectReference reference,
String proxyId )
{
String metadataPath = getRepositorySpecificName( proxyId, toPath( reference ) );
- File metadataFile = new File( managedRepository.getUrl().getPath(), metadataPath );
+ File metadataFile = new File( managedRepository.getLocation(), metadataPath );
try
{
@@ -547,11 +548,11 @@ public class MetadataTools
}
}
- public ArchivaRepositoryMetadata readProxyMetadata( ArchivaRepository managedRepository,
+ public ArchivaRepositoryMetadata readProxyMetadata( ManagedRepositoryConfiguration managedRepository,
VersionedReference reference, String proxyId )
{
String metadataPath = getRepositorySpecificName( proxyId, toPath( reference ) );
- File metadataFile = new File( managedRepository.getUrl().getPath(), metadataPath );
+ File metadataFile = new File( managedRepository.getLocation(), metadataPath );
try
{
@@ -579,12 +580,12 @@ public class MetadataTools
* @throws RepositoryMetadataException
* @throws IOException
*/
- public void updateMetadata( ArchivaRepository managedRepository, ProjectReference reference )
+ public void updateMetadata( ManagedRepositoryConfiguration managedRepository, ProjectReference reference )
throws LayoutException, RepositoryMetadataException, IOException
{
Comparator<String> comparator = VersionComparator.getInstance();
- File metadataFile = new File( managedRepository.getUrl().getPath(), toPath( reference ) );
+ File metadataFile = new File( managedRepository.getLocation(), toPath( reference ) );
ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
metadata.setGroupId( reference.getGroupId() );
@@ -660,11 +661,11 @@ public class MetadataTools
* @throws RepositoryMetadataException
* @throws IOException
*/
- public void updateMetadata( ArchivaRepository managedRepository, VersionedReference reference )
+ public void updateMetadata( ManagedRepositoryConfiguration managedRepository, VersionedReference reference )
throws LayoutException, RepositoryMetadataException, IOException
{
- BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayoutType() );
- File metadataFile = new File( managedRepository.getUrl().getPath(), toPath( reference ) );
+ BidirectionalRepositoryLayout layout = layoutFactory.getLayout( managedRepository.getLayout() );
+ File metadataFile = new File( managedRepository.getLocation(), toPath( reference ) );
ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
metadata.setGroupId( reference.getGroupId() );
@@ -730,7 +731,7 @@ public class MetadataTools
throw new IOException( "Not snapshot artifact found to reference in " + reference );
}
- File artifactFile = new File( managedRepository.getUrl().getPath(), layout.toPath( artifact ) );
+ File artifactFile = new File( managedRepository.getLocation(), layout.toPath( artifact ) );
if ( artifactFile.exists() )
{
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java
index 30475056b..68988af67 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java
@@ -23,15 +23,13 @@ import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
import org.apache.maven.archiva.repository.layout.LayoutException;
import org.apache.maven.archiva.repository.project.resolvers.NopProjectResolver;
import org.apache.maven.archiva.repository.project.resolvers.ProjectModelResolverStack;
-import org.apache.maven.archiva.repository.project.resolvers.RepositoryProjectResolver;
+import org.apache.maven.archiva.repository.project.resolvers.ManagedRepositoryProjectResolver;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -98,20 +96,20 @@ public class ProjectModelResolverFactory
archivaConfiguration.addChangeListener( this );
}
- private RepositoryProjectResolver toResolver( ArchivaRepository repo )
+ private ManagedRepositoryProjectResolver toResolver( ManagedRepositoryConfiguration repo )
throws RepositoryException
{
try
{
- BidirectionalRepositoryLayout layout = layoutFactory.getLayout( repo.getLayoutType() );
+ BidirectionalRepositoryLayout layout = layoutFactory.getLayout( repo.getLayout() );
ProjectModelReader reader = project400Reader;
- if ( StringUtils.equals( "legacy", repo.getLayoutType() ) )
+ if ( StringUtils.equals( "legacy", repo.getLayout() ) )
{
reader = project300Reader;
}
- RepositoryProjectResolver resolver = new RepositoryProjectResolver( repo, reader, layout );
+ ManagedRepositoryProjectResolver resolver = new ManagedRepositoryProjectResolver( repo, reader, layout );
return resolver;
}
catch ( LayoutException e )
@@ -129,12 +127,11 @@ public class ProjectModelResolverFactory
List<ManagedRepositoryConfiguration> list =
archivaConfiguration.getConfiguration().getManagedRepositories();
- for ( ManagedRepositoryConfiguration repositoryConfiguration : list )
+ for ( ManagedRepositoryConfiguration repo : list )
{
- ArchivaRepository repo = ArchivaConfigurationAdaptor.toArchivaRepository( repositoryConfiguration );
try
{
- RepositoryProjectResolver resolver = toResolver( repo );
+ ManagedRepositoryProjectResolver resolver = toResolver( repo );
// Add filesystem based resolver.
this.currentResolverStack.addProjectModelResolver( resolver );
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ManagedRepositoryProjectResolver.java
index fa678c563..4463569b6 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/RepositoryProjectResolver.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ManagedRepositoryProjectResolver.java
@@ -19,9 +19,9 @@ package org.apache.maven.archiva.repository.project.resolvers;
* under the License.
*/
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.project.ProjectModelException;
@@ -31,21 +31,21 @@ import org.apache.maven.archiva.repository.project.ProjectModelResolver;
import java.io.File;
/**
- * Resolve Project from filesystem.
+ * Resolve Project from managed repository.
*
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$
*/
-public class RepositoryProjectResolver
+public class ManagedRepositoryProjectResolver
implements ProjectModelResolver, FilesystemBasedResolver
{
- private ArchivaRepository repository;
+ private ManagedRepositoryConfiguration repository;
private ProjectModelReader reader;
private BidirectionalRepositoryLayout layout;
- public RepositoryProjectResolver( ArchivaRepository repository, ProjectModelReader reader,
+ public ManagedRepositoryProjectResolver( ManagedRepositoryConfiguration repository, ProjectModelReader reader,
BidirectionalRepositoryLayout layout )
{
this.repository = repository;
@@ -60,7 +60,7 @@ public class RepositoryProjectResolver
.getVersion(), "", "pom" );
String path = layout.toPath( artifact );
- File repoFile = new File( this.repository.getUrl().getPath(), path );
+ File repoFile = new File( this.repository.getLocation(), path );
return reader.read( repoFile );
}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java
index d9f513874..1034ed738 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java
@@ -19,12 +19,12 @@ package org.apache.maven.archiva.repository.scanner;
* under the License.
*/
-import org.apache.commons.collections.Closure;
import org.apache.commons.collections.CollectionUtils;
import org.apache.maven.archiva.configuration.FileTypes;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.archiva.repository.RepositoryException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.DirectoryWalker;
@@ -54,19 +54,20 @@ public class DefaultRepositoryScanner
*/
private RepositoryContentConsumers consumerUtil;
- public RepositoryContentStatistics scan( ArchivaRepository repository, long changesSince )
+ public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository, long changesSince )
throws RepositoryException
{
- List knownContentConsumers = consumerUtil.getSelectedKnownConsumers();
- List invalidContentConsumers = consumerUtil.getSelectedInvalidConsumers();
- List ignoredPatterns = filetypes.getFileTypePatterns( FileTypes.IGNORED );
+ List<KnownRepositoryContentConsumer> knownContentConsumers = consumerUtil.getSelectedKnownConsumers();
+ List<InvalidRepositoryContentConsumer> invalidContentConsumers = consumerUtil.getSelectedInvalidConsumers();
+ List<String> ignoredPatterns = filetypes.getFileTypePatterns( FileTypes.IGNORED );
return scan( repository, knownContentConsumers, invalidContentConsumers, ignoredPatterns, changesSince );
}
- public RepositoryContentStatistics scan( ArchivaRepository repository, List knownContentConsumers,
- List invalidContentConsumers, List ignoredContentPatterns,
- long changesSince )
+ public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository,
+ List<KnownRepositoryContentConsumer> knownContentConsumers,
+ List<InvalidRepositoryContentConsumer> invalidContentConsumers,
+ List<String> ignoredContentPatterns, long changesSince )
throws RepositoryException
{
if ( repository == null )
@@ -74,29 +75,24 @@ public class DefaultRepositoryScanner
throw new IllegalArgumentException( "Unable to operate on a null repository." );
}
- if ( !"file".equals( repository.getUrl().getProtocol() ) )
- {
- throw new UnsupportedOperationException( "Only filesystem repositories are supported." );
- }
-
- File repositoryBase = new File( repository.getUrl().getPath() );
+ File repositoryBase = new File( repository.getLocation() );
if ( !repositoryBase.exists() )
{
- throw new UnsupportedOperationException(
- "Unable to scan a repository, directory " + repositoryBase.getAbsolutePath() + " does not exist." );
+ throw new UnsupportedOperationException( "Unable to scan a repository, directory "
+ + repositoryBase.getAbsolutePath() + " does not exist." );
}
if ( !repositoryBase.isDirectory() )
{
- throw new UnsupportedOperationException(
- "Unable to scan a repository, path " + repositoryBase.getAbsolutePath() + " is not a directory." );
+ throw new UnsupportedOperationException( "Unable to scan a repository, path "
+ + repositoryBase.getAbsolutePath() + " is not a directory." );
}
// Setup Includes / Excludes.
- List allExcludes = new ArrayList();
- List allIncludes = new ArrayList();
+ List<String> allExcludes = new ArrayList<String>();
+ List<String> allIncludes = new ArrayList<String>();
if ( CollectionUtils.isNotEmpty( ignoredContentPatterns ) )
{
@@ -115,8 +111,8 @@ public class DefaultRepositoryScanner
dirWalker.setExcludes( allExcludes );
// Setup the Scan Instance
- RepositoryScannerInstance scannerInstance =
- new RepositoryScannerInstance( repository, knownContentConsumers, invalidContentConsumers, getLogger() );
+ RepositoryScannerInstance scannerInstance = new RepositoryScannerInstance( repository, knownContentConsumers,
+ invalidContentConsumers, getLogger() );
scannerInstance.setOnlyModifiedAfterTimestamp( changesSince );
dirWalker.addDirectoryWalkListener( scannerInstance );
@@ -124,38 +120,21 @@ public class DefaultRepositoryScanner
// Execute scan.
dirWalker.scan();
- RepositoryContentStatistics stats = scannerInstance.getStatistics();
-
- ConsumerIdClosure consumerIdList;
-
- consumerIdList = new ConsumerIdClosure();
- CollectionUtils.forAllDo( knownContentConsumers, consumerIdList );
- stats.setKnownConsumers( consumerIdList.getList() );
+ RepositoryScanStatistics stats = scannerInstance.getStatistics();
- consumerIdList = new ConsumerIdClosure();
- CollectionUtils.forAllDo( invalidContentConsumers, consumerIdList );
- stats.setInvalidConsumers( consumerIdList.getList() );
+ stats.setKnownConsumers( gatherIds( knownContentConsumers ) );
+ stats.setInvalidConsumers( gatherIds( invalidContentConsumers ) );
return stats;
}
- class ConsumerIdClosure
- implements Closure
+ private List<String> gatherIds( List<? extends RepositoryContentConsumer> consumers )
{
- private List list = new ArrayList();
-
- public void execute( Object input )
- {
- if ( input instanceof RepositoryContentConsumer )
- {
- RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
- list.add( consumer.getId() );
- }
- }
-
- public List getList()
+ List<String> ids = new ArrayList<String>();
+ for ( RepositoryContentConsumer consumer : consumers )
{
- return list;
+ ids.add( consumer.getId() );
}
+ return ids;
}
}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
index a253a2c05..ccb27874c 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java
@@ -21,23 +21,17 @@ package org.apache.maven.archiva.repository.scanner;
import org.apache.commons.collections.Closure;
import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.functors.IfClosure;
-import org.apache.commons.collections.functors.OrPredicate;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
-import org.apache.maven.archiva.consumers.functors.PermanentConsumerPredicate;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.maven.archiva.repository.scanner.functors.ConsumerWantsFilePredicate;
import org.apache.maven.archiva.repository.scanner.functors.TriggerBeginScanClosure;
import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import java.io.File;
import java.util.ArrayList;
@@ -55,7 +49,6 @@ import java.util.Map;
*/
public class RepositoryContentConsumers
extends AbstractLogEnabled
- implements Initializable
{
/**
* @plexus.requirement
@@ -72,122 +65,82 @@ public class RepositoryContentConsumers
*/
private List<InvalidRepositoryContentConsumer> availableInvalidConsumers;
- private Predicate selectedKnownPredicate;
-
- private Predicate selectedInvalidPredicate;
-
- class SelectedKnownRepoConsumersPredicate
- implements Predicate
+ public List<String> getSelectedKnownConsumerIds()
{
- public boolean evaluate( Object object )
- {
- boolean satisfies = false;
-
- if ( object instanceof KnownRepositoryContentConsumer )
- {
- KnownRepositoryContentConsumer known = (KnownRepositoryContentConsumer) object;
- RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration()
- .getRepositoryScanning();
-
- return scanning.getKnownContentConsumers().contains( known.getId() );
- }
-
- return satisfies;
- }
+ RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
+ return scanning.getKnownContentConsumers();
}
- class SelectedInvalidRepoConsumersPredicate
- implements Predicate
+ public List<String> getSelectedInvalidConsumerIds()
{
- public boolean evaluate( Object object )
- {
- boolean satisfies = false;
-
- if ( object instanceof InvalidRepositoryContentConsumer )
- {
- InvalidRepositoryContentConsumer invalid = (InvalidRepositoryContentConsumer) object;
- RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration()
- .getRepositoryScanning();
-
- return scanning.getInvalidContentConsumers().contains( invalid.getId() );
- }
-
- return satisfies;
- }
+ RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
+ return scanning.getInvalidContentConsumers();
}
- class RepoConsumerToMapClosure
- implements Closure
+ public Map<String, KnownRepositoryContentConsumer> getSelectedKnownConsumersMap()
{
- private Map map = new HashMap();
+ Map<String, KnownRepositoryContentConsumer> consumerMap = new HashMap<String, KnownRepositoryContentConsumer>();
+
+ List<String> knownSelected = getSelectedKnownConsumerIds();
- public void execute( Object input )
+ for ( KnownRepositoryContentConsumer consumer : availableKnownConsumers )
{
- if ( input instanceof RepositoryContentConsumer )
+ if ( knownSelected.contains( consumer.getId() ) || consumer.isPermanent() )
{
- RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
- map.put( consumer.getId(), consumer );
+ consumerMap.put( consumer.getId(), consumer );
}
}
- public Map getMap()
- {
- return map;
- }
+ return consumerMap;
}
- public void initialize()
- throws InitializationException
+ public Map<String, InvalidRepositoryContentConsumer> getSelectedInvalidConsumersMap()
{
- Predicate permanentConsumers = new PermanentConsumerPredicate();
+ Map<String, InvalidRepositoryContentConsumer> consumerMap = new HashMap<String, InvalidRepositoryContentConsumer>();
- this.selectedKnownPredicate = new OrPredicate( permanentConsumers, new SelectedKnownRepoConsumersPredicate() );
- this.selectedInvalidPredicate = new OrPredicate( permanentConsumers,
- new SelectedInvalidRepoConsumersPredicate() );
- }
+ List<String> invalidSelected = getSelectedInvalidConsumerIds();
- public List getSelectedKnownConsumerIds()
- {
- RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
- return scanning.getKnownContentConsumers();
- }
+ for ( InvalidRepositoryContentConsumer consumer : availableInvalidConsumers )
+ {
+ if ( invalidSelected.contains( consumer.getId() ) || consumer.isPermanent() )
+ {
+ consumerMap.put( consumer.getId(), consumer );
+ }
+ }
- public List getSelectedInvalidConsumerIds()
- {
- RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning();
- return scanning.getInvalidContentConsumers();
+ return consumerMap;
}
- public Map getSelectedKnownConsumersMap()
+ public List<KnownRepositoryContentConsumer> getSelectedKnownConsumers()
{
- RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure();
- Closure ifclosure = IfClosure.getInstance( selectedKnownPredicate, consumerMapClosure );
- CollectionUtils.forAllDo( availableKnownConsumers, ifclosure );
+ List<KnownRepositoryContentConsumer> ret = new ArrayList<KnownRepositoryContentConsumer>();
- return consumerMapClosure.getMap();
- }
+ List<String> knownSelected = getSelectedInvalidConsumerIds();
- public Map getSelectedInvalidConsumersMap()
- {
- RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure();
- Closure ifclosure = IfClosure.getInstance( selectedInvalidPredicate, consumerMapClosure );
- CollectionUtils.forAllDo( availableInvalidConsumers, ifclosure );
+ for ( KnownRepositoryContentConsumer consumer : availableKnownConsumers )
+ {
+ if ( knownSelected.contains( consumer.getId() ) || consumer.isPermanent() )
+ {
+ ret.add( consumer );
+ }
+ }
- return consumerMapClosure.getMap();
+ return ret;
}
- public List getSelectedKnownConsumers()
+ public List<InvalidRepositoryContentConsumer> getSelectedInvalidConsumers()
{
- List ret = new ArrayList();
- ret.addAll( CollectionUtils.select( availableKnownConsumers, selectedKnownPredicate ) );
+ List<InvalidRepositoryContentConsumer> ret = new ArrayList<InvalidRepositoryContentConsumer>();
- return ret;
- }
+ List<String> invalidSelected = getSelectedInvalidConsumerIds();
- public List getSelectedInvalidConsumers()
- {
- List ret = new ArrayList();
- ret.addAll( CollectionUtils.select( availableInvalidConsumers, selectedInvalidPredicate ) );
+ for ( InvalidRepositoryContentConsumer consumer : availableInvalidConsumers )
+ {
+ if ( invalidSelected.contains( consumer.getId() ) || consumer.isPermanent() )
+ {
+ ret.add( consumer );
+ }
+ }
return ret;
}
@@ -212,7 +165,7 @@ public class RepositoryContentConsumers
this.availableInvalidConsumers = availableInvalidConsumers;
}
- public void executeConsumers( ArchivaRepository repository, File localFile )
+ public void executeConsumers( ManagedRepositoryConfiguration repository, File localFile )
{
// Run the repository consumers
try
@@ -224,7 +177,7 @@ public class RepositoryContentConsumers
// yuck. In case you can't read this, it says
// "process the file if the consumer has it in the includes list, and not in the excludes list"
- BaseFile baseFile = new BaseFile( repository.getUrl().getPath(), localFile );
+ BaseFile baseFile = new BaseFile( repository.getLocation(), localFile );
ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
predicate.setBasefile( baseFile );
ConsumerProcessFileClosure closure = new ConsumerProcessFileClosure( getLogger() );
@@ -242,10 +195,10 @@ public class RepositoryContentConsumers
}
finally
{
-/* TODO: This is never called by the repository scanner instance, so not calling here either - but it probably should be?
- CollectionUtils.forAllDo( availableKnownConsumers, triggerCompleteScan );
- CollectionUtils.forAllDo( availableInvalidConsumers, triggerCompleteScan );
-*/
+ /* TODO: This is never called by the repository scanner instance, so not calling here either - but it probably should be?
+ CollectionUtils.forAllDo( availableKnownConsumers, triggerCompleteScan );
+ CollectionUtils.forAllDo( availableInvalidConsumers, triggerCompleteScan );
+ */
}
}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java
new file mode 100644
index 000000000..4d9ebf3c3
--- /dev/null
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java
@@ -0,0 +1,144 @@
+package org.apache.maven.archiva.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 org.apache.commons.collections.CollectionUtils;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.model.RepositoryContentStatistics;
+
+import java.util.List;
+
+/**
+ * RepositoryScanStatistics - extension to the RepositoryContentStatistics model.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryScanStatistics
+ extends RepositoryContentStatistics
+{
+ private transient List<String> knownConsumers;
+
+ private transient List<String> invalidConsumers;
+
+ private transient long startTimestamp;
+
+ public void triggerStart()
+ {
+ startTimestamp = System.currentTimeMillis();
+ }
+
+ public void triggerFinished()
+ {
+ long finished = System.currentTimeMillis();
+ setDuration( finished - startTimestamp );
+ setWhenGathered( new java.util.Date( finished ) );
+ }
+
+ public void increaseFileCount()
+ {
+ long count = getTotalFileCount();
+ setTotalFileCount( ++count );
+ }
+
+ public void increaseNewFileCount()
+ {
+ long count = getNewFileCount();
+ setNewFileCount( ++count );
+ }
+
+ public void setKnownConsumers( List<String> consumers )
+ {
+ knownConsumers = consumers;
+ }
+
+ public void setInvalidConsumers( List<String> consumers )
+ {
+ invalidConsumers = consumers;
+ }
+
+ public String toDump( ManagedRepositoryConfiguration repo )
+ {
+ java.text.SimpleDateFormat df = new java.text.SimpleDateFormat();
+ StringBuffer buf = new StringBuffer();
+
+ buf.append( "\n.\\ Scan of " ).append( this.getRepositoryId() );
+ buf.append( " \\.__________________________________________" );
+
+ buf.append( "\n Repository Dir : " ).append( repo.getLocation() );
+ buf.append( "\n Repository Name : " ).append( repo.getName() );
+ buf.append( "\n Repository Layout : " ).append( repo.getLayout() );
+
+ buf.append( "\n Known Consumers : " );
+ if ( CollectionUtils.isNotEmpty( knownConsumers ) )
+ {
+ buf.append( "(" ).append( knownConsumers.size() ).append( " configured)" );
+ for ( String id : knownConsumers )
+ {
+ buf.append( "\n " ).append( id );
+ }
+ }
+ else
+ {
+ buf.append( "<none>" );
+ }
+
+ buf.append( "\n Invalid Consumers : " );
+ if ( CollectionUtils.isNotEmpty( invalidConsumers ) )
+ {
+ buf.append( "(" ).append( invalidConsumers.size() ).append( " configured)" );
+ for ( String id : invalidConsumers )
+ {
+ buf.append( "\n " ).append( id );
+ }
+ }
+ else
+ {
+ buf.append( "<none>" );
+ }
+
+ buf.append( "\n Duration : " );
+ buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) );
+ buf.append( "\n When Gathered : " );
+ if ( this.getWhenGathered() == null )
+ {
+ buf.append( "<null>" );
+ }
+ else
+ {
+ buf.append( df.format( this.getWhenGathered() ) );
+ }
+
+ buf.append( "\n Total File Count : " ).append( this.getTotalFileCount() );
+
+ long averageMsPerFile = 0;
+
+ if ( getTotalFileCount() != 0 )
+ {
+ averageMsPerFile = ( this.getDuration() / this.getTotalFileCount() );
+ }
+
+ buf.append( "\n Avg Time Per File : " );
+ buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) );
+ buf.append( "\n______________________________________________________________" );
+
+ return buf.toString();
+ }
+}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java
index 9d9f2a665..dae6ef575 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanner.java
@@ -19,10 +19,9 @@ package org.apache.maven.archiva.repository.scanner;
* under the License.
*/
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.archiva.repository.RepositoryException;
import java.util.List;
@@ -36,11 +35,11 @@ import java.util.List;
public interface RepositoryScanner
{
/**
- * The value to pass to {@link #scan(ArchivaRepository, long)} to have the scan
+ * The value to pass to {@link #scan(ManagedRepositoryConfiguration, long)} to have the scan
* operate in a fresh fashion, with no check on changes based on timestamp.
*/
public static final long FRESH_SCAN = 0;
-
+
/**
* <p>
* Typical Ignorable Content patterns.
@@ -70,7 +69,7 @@ public interface RepositoryScanner
"**/README*",
"**/CHANGELOG*",
"**/KEYS*" };
-
+
/**
* Scan the repository for content changes.
*
@@ -83,9 +82,9 @@ public interface RepositoryScanner
* @return the statistics for this scan.
* @throws RepositoryException if there was a fundamental problem with getting the discoverer started.
*/
- public RepositoryContentStatistics scan( ArchivaRepository repository, long changesSince )
+ public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository, long changesSince )
throws RepositoryException;
-
+
/**
* Scan the repository for content changes.
*
@@ -103,9 +102,10 @@ public interface RepositoryScanner
* @return the statistics for this scan.
* @throws RepositoryException if there was a fundamental problem with getting the discoverer started.
*/
- public RepositoryContentStatistics scan( ArchivaRepository repository, List knownContentConsumers,
- List invalidContentConsumers, List ignoredContentPatterns,
- long changesSince )
+ public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository,
+ List<KnownRepositoryContentConsumer> knownContentConsumers,
+ List<InvalidRepositoryContentConsumer> invalidContentConsumers,
+ List<String> ignoredContentPatterns, long changesSince )
throws RepositoryException;
-
+
}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java
index 7943f9367..646c44161 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java
@@ -24,8 +24,9 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.functors.IfClosure;
import org.apache.commons.lang.SystemUtils;
import org.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.model.RepositoryContentStatistics;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.maven.archiva.repository.scanner.functors.ConsumerProcessFileClosure;
import org.apache.maven.archiva.repository.scanner.functors.ConsumerWantsFilePredicate;
import org.apache.maven.archiva.repository.scanner.functors.TriggerBeginScanClosure;
@@ -47,16 +48,16 @@ public class RepositoryScannerInstance
/**
* Consumers that process known content.
*/
- private List knownConsumers;
+ private List<KnownRepositoryContentConsumer> knownConsumers;
/**
* Consumers that process unknown/invalid content.
*/
- private List invalidConsumers;
+ private List<InvalidRepositoryContentConsumer> invalidConsumers;
- ArchivaRepository repository;
+ private ManagedRepositoryConfiguration repository;
- private RepositoryContentStatistics stats;
+ private RepositoryScanStatistics stats;
private long onlyModifiedAfterTimestamp = 0;
@@ -66,8 +67,9 @@ public class RepositoryScannerInstance
private Logger logger;
- public RepositoryScannerInstance( ArchivaRepository repository, List knownConsumerList, List invalidConsumerList,
- Logger logger )
+ public RepositoryScannerInstance( ManagedRepositoryConfiguration repository,
+ List<KnownRepositoryContentConsumer> knownConsumerList,
+ List<InvalidRepositoryContentConsumer> invalidConsumerList, Logger logger )
{
this.repository = repository;
this.knownConsumers = knownConsumerList;
@@ -77,7 +79,7 @@ public class RepositoryScannerInstance
this.consumerProcessFile = new ConsumerProcessFileClosure( logger );
this.consumerWantsFile = new ConsumerWantsFilePredicate();
- stats = new RepositoryContentStatistics();
+ stats = new RepositoryScanStatistics();
stats.setRepositoryId( repository.getId() );
Closure triggerBeginScan = new TriggerBeginScanClosure( repository, logger );
@@ -91,14 +93,14 @@ public class RepositoryScannerInstance
}
}
- public RepositoryContentStatistics getStatistics()
+ public RepositoryScanStatistics getStatistics()
{
return stats;
}
public void directoryWalkStarting( File basedir )
{
- logger.info( "Walk Started: [" + this.repository.getId() + "] " + this.repository.getUrl() );
+ logger.info( "Walk Started: [" + this.repository.getId() + "] " + this.repository.getLocation() );
stats.triggerStart();
}
@@ -118,7 +120,7 @@ public class RepositoryScannerInstance
stats.increaseNewFileCount();
- BaseFile basefile = new BaseFile( repository.getUrl().getPath(), file );
+ BaseFile basefile = new BaseFile( repository.getLocation(), file );
consumerProcessFile.setBasefile( basefile );
consumerWantsFile.setBasefile( basefile );
@@ -135,7 +137,7 @@ public class RepositoryScannerInstance
public void directoryWalkFinished()
{
- logger.info( "Walk Finished: [" + this.repository.getId() + "] " + this.repository.getUrl() );
+ logger.info( "Walk Finished: [" + this.repository.getId() + "] " + this.repository.getLocation() );
stats.triggerFinished();
}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/TriggerBeginScanClosure.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
index a0fbaf90c..d1e85ab72 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
@@ -20,9 +20,9 @@ package org.apache.maven.archiva.repository.scanner.functors;
*/
import org.apache.commons.collections.Closure;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.codehaus.plexus.logging.Logger;
/**
@@ -34,11 +34,11 @@ import org.codehaus.plexus.logging.Logger;
public class TriggerBeginScanClosure
implements Closure
{
- private ArchivaRepository repository;
+ private ManagedRepositoryConfiguration repository;
private Logger logger;
- public TriggerBeginScanClosure( ArchivaRepository repository, Logger logger )
+ public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository, Logger logger )
{
this.repository = repository;
this.logger = logger;
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java
new file mode 100644
index 000000000..911af6ca7
--- /dev/null
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java
@@ -0,0 +1,54 @@
+package org.apache.maven.archiva.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 org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
+import org.codehaus.plexus.PlexusTestCase;
+
+import java.io.File;
+
+/**
+ * AbstractRepositoryLayerTestCase
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractRepositoryLayerTestCase
+ extends PlexusTestCase
+{
+ protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+ {
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setLocation( location.getAbsolutePath() );
+ return repo;
+ }
+
+ protected RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
+ {
+ RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setUrl( url );
+ return repo;
+ }
+}
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java
index e0c38757b..be5a1b8f8 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/layout/AbstractBidirectionalRepositoryLayoutTestCase.java
@@ -20,8 +20,8 @@ package org.apache.maven.archiva.repository.layout;
*/
import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.model.ArchivaArtifact;
-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;
@@ -38,7 +38,7 @@ import java.io.File;
public abstract class AbstractBidirectionalRepositoryLayoutTestCase
extends PlexusTestCase
{
- protected ArchivaRepository repository;
+ protected ManagedRepositoryConfiguration repository;
protected void setUp()
throws Exception
@@ -48,7 +48,7 @@ public abstract class AbstractBidirectionalRepositoryLayoutTestCase
repository = createTestRepository();
}
- protected ArchivaRepository createTestRepository()
+ protected ManagedRepositoryConfiguration createTestRepository()
{
File targetDir = new File( getBasedir(), "target" );
File testRepo = new File( targetDir, "test-repo" );
@@ -58,9 +58,11 @@ public abstract class AbstractBidirectionalRepositoryLayoutTestCase
testRepo.mkdirs();
}
- String repoUri = "file://" + StringUtils.replace( testRepo.getAbsolutePath(), "\\", "/" );
-
- return new ArchivaRepository( "testRepo", "Test Repository", repoUri );
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( "testRepo" );
+ repo.setName( "Test Repository" );
+ repo.setLocation( testRepo.getAbsolutePath() );
+ return repo;
}
protected ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String classifier,
@@ -92,8 +94,8 @@ public abstract class AbstractBidirectionalRepositoryLayoutTestCase
protected void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId,
String version, String classifier, String type )
{
- String expectedId =
- "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + classifier + ":" + type;
+ String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + classifier
+ + ":" + type;
assertNotNull( expectedId + " - Should not be null.", actualReference );
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
index 94ff9fb2c..82f948bd1 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
@@ -18,23 +18,22 @@ package org.apache.maven.archiva.repository.metadata;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.common.utils.VersionComparator;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.policies.DownloadPolicy;
+import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
import org.apache.maven.archiva.repository.MockConfiguration;
import org.apache.maven.archiva.repository.layout.LayoutException;
-import org.codehaus.plexus.PlexusTestCase;
import org.custommonkey.xmlunit.DetailedDiff;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLAssert;
import org.xml.sax.SAXException;
-import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -43,6 +42,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Set;
+import javax.xml.parsers.ParserConfigurationException;
+
/**
* MetadataToolsTest
*
@@ -50,7 +51,7 @@ import java.util.Set;
* @version $Id$
*/
public class MetadataToolsTest
- extends PlexusTestCase
+ extends AbstractRepositoryLayerTestCase
{
private MetadataTools tools;
@@ -65,8 +66,8 @@ public class MetadataToolsTest
public void testGatherAvailableVersionsMissingMultipleVersions()
throws Exception
{
- assertAvailableVersions( "missing_metadata_b",
- Arrays.asList( "1.0", "1.0.1", "2.0", "2.0.1", "2.0-20070821-dev" ) );
+ assertAvailableVersions( "missing_metadata_b", Arrays.asList( "1.0", "1.0.1", "2.0", "2.0.1",
+ "2.0-20070821-dev" ) );
}
public void testGatherAvailableVersionsSimpleYetIncomplete()
@@ -84,10 +85,15 @@ public class MetadataToolsTest
public void testGatherSnapshotVersionsA()
throws Exception
{
- assertSnapshotVersions( "snap_shots_a", "1.0-alpha-11-SNAPSHOT", new String[]{"1.0-alpha-11-SNAPSHOT",
- "1.0-alpha-11-20070221.194724-2", "1.0-alpha-11-20070302.212723-3", "1.0-alpha-11-20070303.152828-4",
- "1.0-alpha-11-20070305.215149-5", "1.0-alpha-11-20070307.170909-6", "1.0-alpha-11-20070314.211405-9",
- "1.0-alpha-11-20070316.175232-11"} );
+ assertSnapshotVersions( "snap_shots_a", "1.0-alpha-11-SNAPSHOT", new String[] {
+ "1.0-alpha-11-SNAPSHOT",
+ "1.0-alpha-11-20070221.194724-2",
+ "1.0-alpha-11-20070302.212723-3",
+ "1.0-alpha-11-20070303.152828-4",
+ "1.0-alpha-11-20070305.215149-5",
+ "1.0-alpha-11-20070307.170909-6",
+ "1.0-alpha-11-20070314.211405-9",
+ "1.0-alpha-11-20070316.175232-11" } );
}
public void testGatherSnapshotVersionsAWithProxies()
@@ -99,23 +105,28 @@ public class MetadataToolsTest
createProxyConnector( "test-repo", "internal-snapshots" );
createProxyConnector( "test-repo", "snapshots.codehaus.org" );
- assertSnapshotVersions( "snap_shots_a", "1.0-alpha-11-SNAPSHOT", new String[]{"1.0-alpha-11-SNAPSHOT",
- "1.0-alpha-11-20070221.194724-2", "1.0-alpha-11-20070302.212723-3", "1.0-alpha-11-20070303.152828-4",
- "1.0-alpha-11-20070305.215149-5", "1.0-alpha-11-20070307.170909-6", "1.0-alpha-11-20070314.211405-9",
+ assertSnapshotVersions( "snap_shots_a", "1.0-alpha-11-SNAPSHOT", new String[] {
+ "1.0-alpha-11-SNAPSHOT",
+ "1.0-alpha-11-20070221.194724-2",
+ "1.0-alpha-11-20070302.212723-3",
+ "1.0-alpha-11-20070303.152828-4",
+ "1.0-alpha-11-20070305.215149-5",
+ "1.0-alpha-11-20070307.170909-6",
+ "1.0-alpha-11-20070314.211405-9",
"1.0-alpha-11-20070315.033030-10" /* Arrives in via snapshots.codehaus.org proxy */,
- "1.0-alpha-11-20070316.175232-11"} );
+ "1.0-alpha-11-20070316.175232-11" } );
}
public void testGetRepositorySpecificName()
{
- ArchivaRepository repoJavaNet = new ArchivaRepository( "maven2-repository.dev.java.net",
- "Java.net Repository for Maven 2",
- "http://download.java.net/maven/2/" );
- ArchivaRepository repoCentral =
- new ArchivaRepository( "central", "Central Global Repository", "http://repo1.maven.org/maven2/" );
+ RemoteRepositoryConfiguration repoJavaNet = createRemoteRepository( "maven2-repository.dev.java.net",
+ "Java.net Repository for Maven 2",
+ "http://download.java.net/maven/2/" );
+ RemoteRepositoryConfiguration repoCentral = createRemoteRepository( "central", "Central Global Repository",
+ "http://repo1.maven.org/maven2/" );
- String convertedName =
- tools.getRepositorySpecificName( repoJavaNet, "commons-lang/commons-lang/maven-metadata.xml" );
+ String convertedName = tools.getRepositorySpecificName( repoJavaNet,
+ "commons-lang/commons-lang/maven-metadata.xml" );
assertMetadataPath( "commons-lang/commons-lang/maven-metadata-maven2-repository.dev.java.net.xml",
convertedName );
@@ -140,8 +151,12 @@ public class MetadataToolsTest
public void testUpdateProjectMissingMultipleVersions()
throws Exception
{
- assertUpdatedProjectMetadata( "missing_metadata_b",
- new String[]{"1.0", "1.0.1", "2.0", "2.0.1", "2.0-20070821-dev"} );
+ assertUpdatedProjectMetadata( "missing_metadata_b", new String[] {
+ "1.0",
+ "1.0.1",
+ "2.0",
+ "2.0.1",
+ "2.0-20070821-dev" } );
}
public void testUpdateProjectMissingMultipleVersionsWithProxies()
@@ -153,22 +168,30 @@ public class MetadataToolsTest
createProxyConnector( "test-repo", "central" );
createProxyConnector( "test-repo", "java.net" );
- assertUpdatedProjectMetadata( "proxied_multi", new String[]{"1.0-spec" /* in java.net */, "1.0"
- /* in managed, and central */, "1.0.1" /* in central */, "1.1" /* in managed */, "2.0-proposal-beta"
- /* in java.net */, "2.0-spec" /* in java.net */, "2.0" /* in central, and java.net */, "2.0.1"
- /* in java.net */, "2.1" /* in managed */, "3.0" /* in central */, "3.1" /* in central */}, "3.1", "3.1" );
+ assertUpdatedProjectMetadata( "proxied_multi", new String[] {
+ "1.0-spec" /* in java.net */,
+ "1.0" /* in managed, and central */,
+ "1.0.1" /* in central */,
+ "1.1" /* in managed */,
+ "2.0-proposal-beta" /* in java.net */,
+ "2.0-spec" /* in java.net */,
+ "2.0" /* in central, and java.net */,
+ "2.0.1" /* in java.net */,
+ "2.1" /* in managed */,
+ "3.0" /* in central */,
+ "3.1" /* in central */}, "3.1", "3.1" );
}
public void testUpdateProjectSimpleYetIncomplete()
throws Exception
{
- assertUpdatedProjectMetadata( "incomplete_metadata_a", new String[]{"1.0"} );
+ assertUpdatedProjectMetadata( "incomplete_metadata_a", new String[] { "1.0" } );
}
public void testUpdateProjectSimpleYetMissing()
throws Exception
{
- assertUpdatedProjectMetadata( "missing_metadata_a", new String[]{"1.0"} );
+ assertUpdatedProjectMetadata( "missing_metadata_a", new String[] { "1.0" } );
}
public void testUpdateVersionSimple10()
@@ -314,8 +337,8 @@ public class MetadataToolsTest
reference.setGroupId( "org.apache.archiva.metadata.tests" );
reference.setArtifactId( artifactId );
- String repoRootURL = PathUtil.toUrl( repoRootDir );
- ArchivaRepository repo = new ArchivaRepository( "test-repo", "Test Repository: " + getName(), repoRootURL );
+ ManagedRepositoryConfiguration repo = createRepository( "test-repo", "Test Repository: "
+ + getName(), repoRootDir );
Set<String> testedVersionSet = tools.gatherAvailableVersions( repo, reference );
@@ -338,8 +361,8 @@ public class MetadataToolsTest
reference.setArtifactId( artifactId );
reference.setVersion( version );
- String repoRootURL = PathUtil.toUrl( repoRootDir );
- ArchivaRepository repo = new ArchivaRepository( "test-repo", "Test Repository: " + getName(), repoRootURL );
+ ManagedRepositoryConfiguration repo = createRepository( "test-repo", "Test Repository: "
+ + getName(), repoRootDir );
Set<String> testedVersionSet = tools.gatherSnapshotVersions( repo, reference );
@@ -358,19 +381,21 @@ public class MetadataToolsTest
}
}
- private void assertMetadata( String expectedMetadata, ArchivaRepository repository, ProjectReference reference )
+ private void assertMetadata( String expectedMetadata, ManagedRepositoryConfiguration repository,
+ ProjectReference reference )
throws LayoutException, IOException, SAXException, ParserConfigurationException
{
- File metadataFile = new File( repository.getUrl().getPath(), tools.toPath( reference ) );
+ File metadataFile = new File( repository.getLocation(), tools.toPath( reference ) );
String actualMetadata = FileUtils.readFileToString( metadataFile, null );
XMLAssert.assertXMLEqual( expectedMetadata, actualMetadata );
}
- private void assertMetadata( String expectedMetadata, ArchivaRepository repository, VersionedReference reference )
+ private void assertMetadata( String expectedMetadata, ManagedRepositoryConfiguration repository,
+ VersionedReference reference )
throws LayoutException, IOException, SAXException, ParserConfigurationException
{
- File metadataFile = new File( repository.getUrl().getPath(), tools.toPath( reference ) );
+ File metadataFile = new File( repository.getLocation(), tools.toPath( reference ) );
String actualMetadata = FileUtils.readFileToString( metadataFile, null );
DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) );
@@ -396,7 +421,7 @@ public class MetadataToolsTest
String releaseVersion )
throws IOException, LayoutException, RepositoryMetadataException, SAXException, ParserConfigurationException
{
- ArchivaRepository testRepo = createTestRepo();
+ ManagedRepositoryConfiguration testRepo = createTestRepo();
ProjectReference reference = new ProjectReference();
reference.setGroupId( "org.apache.archiva.metadata.tests" );
reference.setArtifactId( artifactId );
@@ -439,7 +464,7 @@ public class MetadataToolsTest
private void assertUpdatedReleaseVersionMetadata( String artifactId, String version )
throws IOException, LayoutException, RepositoryMetadataException, SAXException, ParserConfigurationException
{
- ArchivaRepository testRepo = createTestRepo();
+ ManagedRepositoryConfiguration testRepo = createTestRepo();
VersionedReference reference = new VersionedReference();
reference.setGroupId( "org.apache.archiva.metadata.tests" );
reference.setArtifactId( artifactId );
@@ -463,7 +488,7 @@ public class MetadataToolsTest
String expectedTime, String expectedBuildNumber )
throws IOException, LayoutException, RepositoryMetadataException, SAXException, ParserConfigurationException
{
- ArchivaRepository testRepo = createTestRepo();
+ ManagedRepositoryConfiguration testRepo = createTestRepo();
VersionedReference reference = new VersionedReference();
reference.setGroupId( "org.apache.archiva.metadata.tests" );
reference.setArtifactId( artifactId );
@@ -516,7 +541,7 @@ public class MetadataToolsTest
config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) );
}
- private ArchivaRepository createTestRepo()
+ private ManagedRepositoryConfiguration createTestRepo()
throws IOException
{
File repoRoot = new File( "target/metadata-tests/" + getName() );
@@ -527,12 +552,10 @@ public class MetadataToolsTest
repoRoot.mkdirs();
- String repoRootURL = PathUtil.toUrl( repoRoot );
-
- return new ArchivaRepository( "test-repo", "Test Repository: " + getName(), repoRootURL );
+ return createRepository( "test-repo", "Test Repository: " + getName(), repoRoot );
}
- private void prepTestRepo( ArchivaRepository repo, ProjectReference reference )
+ private void prepTestRepo( ManagedRepositoryConfiguration repo, ProjectReference reference )
throws IOException
{
String groupDir = StringUtils.replaceChars( reference.getGroupId(), '.', '/' );
@@ -540,7 +563,7 @@ public class MetadataToolsTest
File srcRepoDir = new File( "src/test/repositories/metadata-repository" );
File srcDir = new File( srcRepoDir, path );
- File destDir = new File( repo.getUrl().getPath(), path );
+ File destDir = new File( repo.getLocation(), path );
assertTrue( "Source Dir exists: " + srcDir, srcDir.exists() );
destDir.mkdirs();
@@ -548,7 +571,7 @@ public class MetadataToolsTest
FileUtils.copyDirectory( srcDir, destDir );
}
- private void prepTestRepo( ArchivaRepository repo, VersionedReference reference )
+ private void prepTestRepo( ManagedRepositoryConfiguration repo, VersionedReference reference )
throws IOException
{
ProjectReference projectRef = new ProjectReference();
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java
index cd0c70e0a..16ab3aecb 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java
@@ -20,10 +20,11 @@ package org.apache.maven.archiva.repository.project.filters;
*/
import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.Dependency;
import org.apache.maven.archiva.model.Individual;
+import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.DefaultBidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.project.ProjectModelException;
@@ -32,8 +33,7 @@ import org.apache.maven.archiva.repository.project.ProjectModelReader;
import org.apache.maven.archiva.repository.project.ProjectModelResolver;
import org.apache.maven.archiva.repository.project.ProjectModelResolverFactory;
import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader;
-import org.apache.maven.archiva.repository.project.resolvers.RepositoryProjectResolver;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.archiva.repository.project.resolvers.ManagedRepositoryProjectResolver;
import java.io.File;
import java.util.HashMap;
@@ -48,7 +48,7 @@ import java.util.Map;
* @version $Id$
*/
public class EffectiveProjectModelFilterTest
- extends PlexusTestCase
+ extends AbstractRepositoryLayerTestCase
{
private static final String DEFAULT_REPOSITORY = "src/test/repositories/default-repository";
@@ -72,12 +72,11 @@ public class EffectiveProjectModelFilterTest
{
File defaultRepoDir = new File( getBasedir(), DEFAULT_REPOSITORY );
- ArchivaRepository repo = new ArchivaRepository( "defaultTestRepo", "Default Test Repo", "file://"
- + defaultRepoDir.getAbsolutePath() );
+ ManagedRepositoryConfiguration repo = createRepository( "defaultTestRepo", "Default Test Repo", defaultRepoDir );
ProjectModelReader reader = new ProjectModel400Reader();
BidirectionalRepositoryLayout layout = new DefaultBidirectionalRepositoryLayout();
- RepositoryProjectResolver resolver = new RepositoryProjectResolver( repo, reader, layout );
+ ManagedRepositoryProjectResolver resolver = new ManagedRepositoryProjectResolver( repo, reader, layout );
return resolver;
}
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java
index 8f3f804aa..bb5e7a315 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.repository.scanner;
* 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.InvalidRepositoryContentConsumer;
-import org.apache.maven.archiva.model.ArchivaRepository;
import java.util.List;
@@ -38,7 +38,7 @@ public class InvalidScanConsumer
{
private int processCount = 0;
- public void beginScan( ArchivaRepository repository )
+ public void beginScan( ManagedRepositoryConfiguration repository )
throws ConsumerException
{
/* do nothing */
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java
index 0ba3099e1..dc49f0875 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.repository.scanner;
* 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 java.util.ArrayList;
import java.util.Arrays;
@@ -68,7 +68,7 @@ public class KnownScanConsumer
return "Scan Consumer (for testing)";
}
- public void beginScan( ArchivaRepository repository )
+ public void beginScan( ManagedRepositoryConfiguration repository )
throws ConsumerException
{
/* do nothing */
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java
index 707cac441..f1a345d50 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java
@@ -19,10 +19,11 @@ package org.apache.maven.archiva.repository.scanner;
* under the License.
*/
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
import org.codehaus.plexus.PlexusTestCase;
import org.easymock.MockControl;
@@ -38,7 +39,7 @@ import java.util.Map;
* @version $Id$
*/
public class RepositoryContentConsumerUtilTest
- extends PlexusTestCase
+ extends AbstractRepositoryLayerTestCase
{
private RepositoryContentConsumers lookupRepositoryConsumerUtil()
throws Exception
@@ -118,8 +119,7 @@ public class RepositoryContentConsumerUtilTest
InvalidRepositoryContentConsumer invalidConsumer = (InvalidRepositoryContentConsumer) invalidControl.getMock();
consumers.setAvailableInvalidConsumers( Collections.singletonList( invalidConsumer ) );
- ArchivaRepository repo =
- new ArchivaRepository( "id", "name", getTestFile( "target/test-repo" ).toURL().toExternalForm() );
+ ManagedRepositoryConfiguration repo = createRepository( "id", "name", getTestFile( "target/test-repo" ) );
File testFile = getTestFile( "target/test-repo/path/to/test-file.txt" );
knownConsumer.beginScan( repo );
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerTest.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerTest.java
index cb113f284..40ea93d7f 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerTest.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerTest.java
@@ -19,11 +19,9 @@ package org.apache.maven.archiva.repository.scanner;
* under the License.
*/
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.model.ArchivaRepository;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
-import org.apache.maven.archiva.repository.RepositoryException;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
import java.io.File;
import java.util.ArrayList;
@@ -37,7 +35,7 @@ import java.util.List;
* @version $Id$
*/
public class RepositoryScannerTest
- extends PlexusTestCase
+ extends AbstractRepositoryLayerTestCase
{
private static final String[] ARTIFACT_PATTERNS = new String[] {
"**/*.jar",
@@ -47,29 +45,25 @@ public class RepositoryScannerTest
"**/*.war",
"**/*.tar.gz" };
- private ArchivaRepository createDefaultRepository()
+ private ManagedRepositoryConfiguration createDefaultRepository()
{
File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" );
assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
-
- String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
-
- ArchivaRepository repo = new ArchivaRepository( "testDefaultRepo", "Test Default Repository", repoUri );
+
+ ManagedRepositoryConfiguration repo = createRepository( "testDefaultRepo", "Test Default Repository", repoDir );
return repo;
}
- private ArchivaRepository createLegacyRepository()
+ private ManagedRepositoryConfiguration createLegacyRepository()
{
File repoDir = new File( getBasedir(), "src/test/repositories/legacy-repository" );
assertTrue( "Legacy Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
- String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
-
- ArchivaRepository repo = new ArchivaRepository( "testLegacyRepo", "Test Legacy Repository", repoUri );
- repo.getModel().setLayoutName( "legacy" );
+ ManagedRepositoryConfiguration repo = createRepository( "testLegacyRepo", "Test Legacy Repository", repoDir );
+ repo.setLayout( "legacy" );
return repo;
}
@@ -99,7 +93,7 @@ public class RepositoryScannerTest
public void testDefaultRepositoryScanner()
throws Exception
{
- ArchivaRepository repository = createDefaultRepository();
+ ManagedRepositoryConfiguration repository = createDefaultRepository();
List knownConsumers = new ArrayList();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -166,7 +160,7 @@ public class RepositoryScannerTest
actualArtifactPaths.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
actualArtifactPaths.add( "javax/sql/jdbc/2.0/jdbc-2.0.jar" );
- ArchivaRepository repository = createDefaultRepository();
+ ManagedRepositoryConfiguration repository = createDefaultRepository();
List knownConsumers = new ArrayList();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -202,7 +196,7 @@ public class RepositoryScannerTest
actualMetadataPaths.add( "javax/sql/maven-metadata-repository.xml" );
actualMetadataPaths.add( "javax/maven-metadata.xml" );
- ArchivaRepository repository = createDefaultRepository();
+ ManagedRepositoryConfiguration repository = createDefaultRepository();
List knownConsumers = new ArrayList();
KnownScanConsumer knownConsumer = new KnownScanConsumer();
@@ -238,7 +232,7 @@ public class RepositoryScannerTest
actualProjectPaths.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.pom" );
actualProjectPaths.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
- ArchivaRepository repository = createDefaultRepository();
+ ManagedRepositoryConfiguration repository = createDefaultRepository();
List knownConsumers = new ArrayList();
KnownScanConsumer consumer = new KnownScanConsumer();
@@ -278,7 +272,7 @@ public class RepositoryScannerTest
actualArtifactPaths.add( "org.apache.maven.update/jars/test-not-updated-1.0.jar" );
actualArtifactPaths.add( "org.apache.maven.update/jars/test-updated-1.0.jar" );
- ArchivaRepository repository = createLegacyRepository();
+ ManagedRepositoryConfiguration repository = createLegacyRepository();
List knownConsumers = new ArrayList();
KnownScanConsumer consumer = new KnownScanConsumer();
diff --git a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java
index 04f658741..3cd495920 100644
--- a/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java
+++ b/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.repository.scanner;
* 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 java.util.List;
@@ -39,7 +39,7 @@ public class SampleKnownConsumer
extends AbstractMonitoredConsumer
implements KnownRepositoryContentConsumer
{
- public void beginScan( ArchivaRepository repository )
+ public void beginScan( ManagedRepositoryConfiguration repository )
throws ConsumerException
{
/* nothing to do */
diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java
index 36229c844..6e916fa19 100644
--- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java
+++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/AbstractProgressConsumer.java
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.cli;
* 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.RepositoryContentConsumer;
-import org.apache.maven.archiva.model.ArchivaRepository;
/**
* AbstractProgressConsumer
@@ -36,7 +36,7 @@ public abstract class AbstractProgressConsumer
{
private int count = 0;
- public void beginScan( ArchivaRepository repository )
+ public void beginScan( ManagedRepositoryConfiguration repository )
throws ConsumerException
{
this.count = 0;
diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
index fbbe7593f..f4c358d09 100644
--- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
+++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java
@@ -24,13 +24,14 @@ import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
import org.apache.maven.archiva.converter.RepositoryConversionException;
import org.apache.maven.archiva.converter.legacy.LegacyRepositoryConverter;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.archiva.repository.RepositoryException;
+import org.apache.maven.archiva.repository.scanner.RepositoryScanStatistics;
import org.apache.maven.archiva.repository.scanner.RepositoryScanner;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@@ -167,7 +168,10 @@ public class ArchivaCli
{
String path = cli.getOptionValue( SCAN );
- ArchivaRepository repo = new ArchivaRepository( "cliRepo", "Archiva CLI Provided Repo", "file://" + path );
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( "cliRepo" );
+ repo.setName( "Archiva CLI Provided Repo" );
+ repo.setLocation( path );
List knownConsumerList = new ArrayList();
@@ -182,8 +186,8 @@ public class ArchivaCli
try
{
- RepositoryContentStatistics stats = scanner.scan( repo, knownConsumerList, invalidConsumerList,
- ignoredContent, RepositoryScanner.FRESH_SCAN );
+ RepositoryScanStatistics stats = scanner.scan( repo, knownConsumerList, invalidConsumerList,
+ ignoredContent, RepositoryScanner.FRESH_SCAN );
System.out.println( "\n" + stats.toDump( repo ) );
}
diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java
index 537060c06..1a6511270 100644
--- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java
+++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ProjectReaderConsumer.java
@@ -19,10 +19,10 @@ package org.apache.maven.archiva.cli;
* under the License.
*/
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.repository.project.ProjectModelException;
import org.apache.maven.archiva.repository.project.ProjectModelReader;
import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader;
@@ -57,7 +57,7 @@ public class ProjectReaderConsumer
private ProjectModelReader reader;
- private ArchivaRepository repo;
+ private ManagedRepositoryConfiguration repo;
private List includes;
@@ -94,7 +94,7 @@ public class ProjectReaderConsumer
return includes;
}
- public void beginScan( ArchivaRepository repository )
+ public void beginScan( ManagedRepositoryConfiguration repository )
throws ConsumerException
{
super.beginScan( repository );
@@ -106,7 +106,7 @@ public class ProjectReaderConsumer
{
super.processFile( path );
- File pomFile = new File( repo.getUrl().getPath(), path );
+ File pomFile = new File( repo.getLocation(), path );
try
{
ArchivaProjectModel model = reader.read( pomFile );
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java
index bfe15ef0c..18b1821d3 100644
--- a/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java
+++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java
@@ -52,7 +52,5 @@ public interface ArchivaDAO
ProjectModelDAO getProjectModelDAO();
- RepositoryDAO getRepositoryDAO();
-
RepositoryProblemDAO getRepositoryProblemDAO();
}
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDAO.java
deleted file mode 100644
index 15a1b265e..000000000
--- a/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryDAO.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.apache.maven.archiva.database;
-
-/*
- * 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.maven.archiva.model.ArchivaRepository;
-
-import java.util.List;
-
-/**
- * RepositoryDAO
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public interface RepositoryDAO
-{
- /* NOTE TO ARCHIVA DEVELOPERS.
- *
- * Please keep this interface clean and lean.
- * We don't want a repeat of the Continuum Store.
- * You should have the following methods per object type ...
- *
- * (Required Methods)
- *
- * DatabaseObject .createDatabaseObject( Required Params ) ;
- * List .queryDatabaseObject( Constraint ) throws ObjectNotFoundException, DatabaseException;
- * DatabaseObject .saveDatabaseObject( DatabaseObject ) throws DatabaseException;
- *
- * (Optional Methods)
- *
- * DatabaseObject .getDatabaseObject( Id ) throws ObjectNotFoundException, DatabaseException;
- * List .getDatabaseObjects() throws ObjectNotFoundException, DatabaseException;
- * void .deleteDatabaseObject( DatabaseObject ) throws DatabaseException;
- *
- * This is the only list of options created in this DAO.
- */
-
- public ArchivaRepository createRepository( String id, String name, String url );
-
- public List /*<ArchivaRepository>*/getRepositories()
- throws ObjectNotFoundException, ArchivaDatabaseException;
-
- public ArchivaRepository getRepository( String id )
- throws ObjectNotFoundException, ArchivaDatabaseException;
-
- public List /*<ArchivaRepository>*/queryRepositories( Constraint constraint )
- throws ObjectNotFoundException, ArchivaDatabaseException;
-
- public ArchivaRepository saveRepository( ArchivaRepository repository )
- throws ArchivaDatabaseException;
-
- public void deleteRepository( ArchivaRepository repository )
- throws ArchivaDatabaseException;
-}
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
index 40d9f4228..639106184 100644
--- a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
+++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java
@@ -22,7 +22,6 @@ package org.apache.maven.archiva.database.jdo;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArtifactDAO;
import org.apache.maven.archiva.database.ProjectModelDAO;
-import org.apache.maven.archiva.database.RepositoryDAO;
import org.apache.maven.archiva.database.RepositoryProblemDAO;
import org.apache.maven.archiva.database.SimpleConstraint;
import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -60,11 +59,6 @@ public class JdoArchivaDAO
/**
* @plexus.requirement role-hint="jdo"
*/
- private RepositoryDAO repositoryDAO;
-
- /**
- * @plexus.requirement role-hint="jdo"
- */
private RepositoryProblemDAO repositoryProblemDAO;
public List query( SimpleConstraint constraint )
@@ -87,11 +81,6 @@ public class JdoArchivaDAO
return projectModelDAO;
}
- public RepositoryDAO getRepositoryDAO()
- {
- return repositoryDAO;
- }
-
public RepositoryProblemDAO getRepositoryProblemDAO()
{
return repositoryProblemDAO;
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoRepositoryDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoRepositoryDAO.java
deleted file mode 100644
index eaef9bd88..000000000
--- a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoRepositoryDAO.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package org.apache.maven.archiva.database.jdo;
-
-/*
- * 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.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.Constraint;
-import org.apache.maven.archiva.database.ObjectNotFoundException;
-import org.apache.maven.archiva.database.RepositoryDAO;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.model.ArchivaRepositoryModel;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * JdoRepositoryDAO
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- *
- * @plexus.component role-hint="jdo"
- */
-public class JdoRepositoryDAO
- implements RepositoryDAO
-{
- /**
- * @plexus.requirement role-hint="archiva"
- */
- private JdoAccess jdo;
-
- /* .\ Archiva Repository \.____________________________________________________________ */
-
- public ArchivaRepository createRepository( String id, String name, String url )
- {
- ArchivaRepository repo;
-
- try
- {
- repo = getRepository( id );
- }
- catch ( ArchivaDatabaseException e )
- {
- repo = new ArchivaRepository( id, name, url );
- }
-
- return repo;
- }
-
- public List getRepositories()
- throws ObjectNotFoundException, ArchivaDatabaseException
- {
- return queryRepositories( null );
- }
-
- public ArchivaRepository getRepository( String id )
- throws ObjectNotFoundException, ArchivaDatabaseException
- {
- ArchivaRepositoryModel model = (ArchivaRepositoryModel) jdo.getObjectById( ArchivaRepositoryModel.class, id,
- null );
- return new ArchivaRepository( model );
- }
-
- public List queryRepositories( Constraint constraint )
- throws ObjectNotFoundException, ArchivaDatabaseException
- {
- List results = jdo.queryObjects( ArchivaRepositoryModel.class, constraint );
-
- if ( ( results == null ) || results.isEmpty() )
- {
- return results;
- }
-
- List ret = new ArrayList();
- Iterator it = results.iterator();
- while ( it.hasNext() )
- {
- ArchivaRepositoryModel model = (ArchivaRepositoryModel) it.next();
- ret.add( new ArchivaRepository( model ) );
- }
-
- return ret;
- }
-
- public ArchivaRepository saveRepository( ArchivaRepository repository )
- {
- ArchivaRepositoryModel model = (ArchivaRepositoryModel) jdo.saveObject( repository.getModel() );
- if ( model == null )
- {
- return null;
- }
-
- return new ArchivaRepository( model );
- }
-
- public void deleteRepository( ArchivaRepository repository )
- throws ArchivaDatabaseException
- {
- jdo.removeObject( repository.getModel() );
- }
-}
diff --git a/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java b/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java
index df0de8692..4f51e5bb5 100644
--- a/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java
+++ b/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAOTest.java
@@ -33,6 +33,7 @@ public class JdoArchivaDAOTest
public void testSubDAOs()
{
assertNotNull( "Artifact DAO", dao.getArtifactDAO() );
- assertNotNull( "Repository DAO", dao.getRepositoryDAO() );
+ assertNotNull( "Project Model DAO", dao.getProjectModelDAO() );
+ assertNotNull( "Repository Problem DAO", dao.getRepositoryProblemDAO() );
}
}
diff --git a/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoRepositoryDAOTest.java b/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoRepositoryDAOTest.java
deleted file mode 100644
index 3398ab712..000000000
--- a/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoRepositoryDAOTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.apache.maven.archiva.database.jdo;
-
-/*
- * 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.maven.archiva.database.AbstractArchivaDatabaseTestCase;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.RepositoryDAO;
-import org.apache.maven.archiva.model.ArchivaRepository;
-
-import java.util.List;
-
-import javax.jdo.JDOHelper;
-
-/**
- * JdoRepositoryDAOTest
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class JdoRepositoryDAOTest
- extends AbstractArchivaDatabaseTestCase
-{
- public void testRepositoryCRUD()
- throws ArchivaDatabaseException
- {
- RepositoryDAO repoDao = dao.getRepositoryDAO();
-
- // Create it
- ArchivaRepository repo = repoDao.createRepository( "testRepo", "Test Repository",
- "http://localhost:8080/repository/foo" );
- assertNotNull( repo );
-
- // Set some mandatory values
- repo.getModel().setCreationSource( "Test Case" );
- repo.getModel().setLayoutName( "default" );
-
- // Save it.
- ArchivaRepository repoSaved = repoDao.saveRepository( repo );
- assertNotNull( repoSaved );
- assertNotNull( repoSaved.getModel() );
- assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() );
-
- // Test that something has been saved.
- List repos = repoDao.getRepositories();
- assertNotNull( repos );
- assertEquals( 1, repos.size() );
-
- // Test that retreived object is what we expect.
- ArchivaRepository firstRepo = (ArchivaRepository) repos.get( 0 );
- assertNotNull( firstRepo );
- assertEquals( "testRepo", repo.getId() );
- assertEquals( "Test Repository", repo.getModel().getName() );
- assertEquals( "Test Case", repo.getModel().getCreationSource() );
- assertEquals( "default", repo.getModel().getLayoutName() );
-
- // Change value and save.
- repoSaved.getModel().setCreationSource( "Changed" );
- repoDao.saveRepository( repoSaved );
-
- // Test that only 1 object is saved.
- assertEquals( 1, repoDao.getRepositories().size() );
-
- // Get the specific repo.
- ArchivaRepository actualRepo = repoDao.getRepository( "testRepo" );
- assertNotNull( actualRepo );
-
- // Test expected values.
- assertEquals( "testRepo", actualRepo.getId() );
- assertEquals( "http://localhost:8080/repository/foo", actualRepo.getUrl().toString() );
- assertEquals( "Changed", actualRepo.getModel().getCreationSource() );
-
- // Test that only 1 object is saved.
- assertEquals( 1, repoDao.getRepositories().size() );
-
- // Delete object.
- repoDao.deleteRepository( actualRepo );
- assertEquals( 0, repoDao.getRepositories().size() );
- }
-}
diff --git a/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java b/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java
index f461baf46..e9cc8416b 100644
--- a/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java
+++ b/archiva-reporting/archiva-artifact-reports/src/main/java/org/apache/maven/archiva/reporting/artifact/LocationArtifactsConsumer.java
@@ -31,9 +31,7 @@ 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.ArchivaProjectModel;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.RepositoryProblem;
-import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
import org.apache.maven.archiva.repository.layout.LayoutException;
@@ -142,9 +140,9 @@ public class LocationArtifactsConsumer
public void processArchivaArtifact( ArchivaArtifact artifact )
throws ConsumerException
{
- ArchivaRepository repository = findRepository( artifact );
+ ManagedRepositoryConfiguration repository = findRepository( artifact );
- File artifactFile = new File( repository.getUrl().toString(), toPath( artifact ) );
+ File artifactFile = new File( repository.getLocation(), toPath( artifact ) );
ArchivaProjectModel fsModel = readFilesystemModel( artifactFile );
ArchivaProjectModel embeddedModel = readEmbeddedModel( artifact, artifactFile );
@@ -287,9 +285,9 @@ public class LocationArtifactsConsumer
return new File( pomFilename );
}
- private ArchivaRepository findRepository( ArchivaArtifact artifact )
+ private ManagedRepositoryConfiguration findRepository( ArchivaArtifact artifact )
{
- return (ArchivaRepository) this.repositoryMap.get( artifact.getModel().getRepositoryId() );
+ return (ManagedRepositoryConfiguration) this.repositoryMap.get( artifact.getModel().getRepositoryId() );
}
private String toPath( ArchivaArtifact artifact )
@@ -337,12 +335,12 @@ public class LocationArtifactsConsumer
{
this.repositoryMap.clear();
- Map<String, ManagedRepositoryConfiguration> map =
+ Map<String, ManagedRepositoryConfiguration> map =
configuration.getConfiguration().getManagedRepositoriesAsMap();
+
for ( Map.Entry<String, ManagedRepositoryConfiguration> entry : map.entrySet() )
{
- ArchivaRepository repository = ArchivaConfigurationAdaptor.toArchivaRepository( entry.getValue() );
- this.repositoryMap.put( entry.getKey(), repository );
+ this.repositoryMap.put( entry.getKey(), entry.getValue() );
}
}
}
diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java
index e435afddb..885c9d530 100644
--- a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java
+++ b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java
@@ -21,13 +21,13 @@ package org.apache.maven.archiva.scheduled.executors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.RepositoryDAO;
import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.archiva.repository.RepositoryException;
+import org.apache.maven.archiva.repository.scanner.RepositoryScanStatistics;
import org.apache.maven.archiva.repository.scanner.RepositoryScanner;
import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -57,11 +57,11 @@ public class ArchivaRepositoryScanningTaskExecutor
* @plexus.requirement role-hint="jdo"
*/
private ArchivaDAO dao;
-
+
/**
- * @plexus.requirement role-hint="jdo"
+ * @plexus.requirement
*/
- private RepositoryDAO repositoryDAO;
+ private ArchivaConfiguration archivaConfiguration;
/**
* The repository scanner component.
@@ -90,11 +90,11 @@ public class ArchivaRepositoryScanningTaskExecutor
try
{
- ArchivaRepository arepo = repositoryDAO.getRepository( repoTask.getRepositoryId() );
+ ManagedRepositoryConfiguration arepo = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoTask.getRepositoryId() );
long sinceWhen = RepositoryScanner.FRESH_SCAN;
- List results = dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );
+ List<RepositoryContentStatistics> results = dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );
if ( CollectionUtils.isNotEmpty( results ) )
{
@@ -102,15 +102,19 @@ public class ArchivaRepositoryScanningTaskExecutor
sinceWhen = lastStats.getWhenGathered().getTime() + lastStats.getDuration();
}
- RepositoryContentStatistics stats = repoScanner.scan( arepo, sinceWhen );
+ RepositoryScanStatistics stats = repoScanner.scan( arepo, sinceWhen );
getLogger().info( "Finished repository task: " + stats.toDump( arepo ) );
- stats = (RepositoryContentStatistics) dao.save( stats );
- }
- catch ( ArchivaDatabaseException e )
- {
- throw new TaskExecutionException( "Database error when executing repository job.", e );
+ // I hate jpox and modello
+ RepositoryContentStatistics dbstats = new RepositoryContentStatistics();
+ dbstats.setDuration( stats.getDuration() );
+ dbstats.setNewFileCount( stats.getNewFileCount() );
+ dbstats.setRepositoryId( stats.getRepositoryId() );
+ dbstats.setTotalFileCount( stats.getTotalFileCount() );
+ dbstats.setWhenGathered( stats.getWhenGathered() );
+
+ dao.save( dbstats );
}
catch ( RepositoryException e )
{
diff --git a/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java
index bfa8ab963..ebdb592c3 100644
--- a/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java
+++ b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java
@@ -20,12 +20,11 @@ package org.apache.maven.archiva.scheduled.executors;
*/
import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.database.RepositoryDAO;
import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint;
import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
@@ -142,28 +141,13 @@ public class ArchivaDatabaseUpdateTaskExecutorTest
public void testExecutor()
throws Exception
{
- RepositoryDAO repoDao = dao.getRepositoryDAO();
-
File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" );
assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
- String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
-
- // Create it
- ArchivaRepository repo = repoDao.createRepository( "testRepo", "Test Repository", repoUri );
+ ManagedRepositoryConfiguration repo = createRepository( "testRepo", "Test Repository", repoDir );
assertNotNull( repo );
- // Set some mandatory values
- repo.getModel().setCreationSource( "Test Case" );
- repo.getModel().setLayoutName( "default" );
-
- // Save it.
- ArchivaRepository repoSaved = repoDao.saveRepository( repo );
- assertNotNull( repoSaved );
- assertNotNull( repoSaved.getModel() );
- assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() );
-
ArtifactDAO adao = dao.getArtifactDAO();
ArchivaArtifact sqlArtifact = adao.createArtifact( "javax.sql", "jdbc", "2.0", "", "jar" );
@@ -205,4 +189,13 @@ public class ArchivaDatabaseUpdateTaskExecutorTest
assertNotNull( "Processed Results should not be null.", processedResultList );
assertEquals( "Incorrect number of processed artifacts detected.", 1, processedResultList.size() );
}
+
+ protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+ {
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setLocation( location.getAbsolutePath() );
+ return repo;
+ }
}
diff --git a/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java
index 7824462e3..8f935289f 100644
--- a/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java
+++ b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java
@@ -19,12 +19,12 @@ package org.apache.maven.archiva.scheduled.executors;
* under the License.
*/
-import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArtifactDAO;
-import org.apache.maven.archiva.database.RepositoryDAO;
import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint;
-import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
@@ -39,7 +39,6 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
-import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
@@ -140,28 +139,18 @@ public class ArchivaRepositoryScanningTaskExecutorTest
public void testExecutor() throws Exception
{
- RepositoryDAO repoDao = dao.getRepositoryDAO();
-
File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" );
assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() );
- String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" );
+ ArchivaConfiguration archivaConfig = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
+ assertNotNull( archivaConfig );
// Create it
- ArchivaRepository repo =
- repoDao.createRepository( "testRepo", "Test Repository", repoUri );
+ ManagedRepositoryConfiguration repo = createRepository( "testRepo", "Test Repository", repoDir );
assertNotNull( repo );
-
- // Set some mandatory values
- repo.getModel().setCreationSource( "Test Case" );
- repo.getModel().setLayoutName( "default" );
-
- // Save it.
- ArchivaRepository repoSaved = repoDao.saveRepository( repo );
- assertNotNull( repoSaved );
- assertNotNull( repoSaved.getModel() );
- assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() );
+ archivaConfig.getConfiguration().getManagedRepositories().clear();
+ archivaConfig.getConfiguration().addManagedRepository( repo );
RepositoryTask repoTask = new RepositoryTask();
@@ -176,4 +165,13 @@ public class ArchivaRepositoryScanningTaskExecutorTest
assertNotNull( unprocessedResultList );
assertEquals("Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() );
}
+
+ protected ManagedRepositoryConfiguration createRepository( String id, String name, File location )
+ {
+ ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
+ repo.setId( id );
+ repo.setName( name );
+ repo.setLocation( location.getAbsolutePath() );
+ return repo;
+ }
}
diff --git a/archiva-scheduled/src/test/resources/archiva-test.xml b/archiva-scheduled/src/test/resources/archiva-test.xml
index dbed5bf00..32b43b1bf 100644
--- a/archiva-scheduled/src/test/resources/archiva-test.xml
+++ b/archiva-scheduled/src/test/resources/archiva-test.xml
@@ -19,18 +19,18 @@
-->
<configuration>
- <repositories>
- <repository>
+ <managedRepositories>
+ <managedRepository>
<id>testRepo</id>
<name>Archiva Test Repository</name>
- <url>file://${basedir}/src/test/repositories/default-repository</url>
+ <location>${basedir}/src/test/repositories/default-repository</location>
<layout>default</layout>
<releases>true</releases>
<snapshots>false</snapshots>
<indexed>true</indexed>
<refreshCronExpression>0 0 * * ?</refreshCronExpression>
- </repository>
- </repositories>
+ </managedRepository>
+ </managedRepositories>
<proxyConnectors />
diff --git a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml
index aa04d5931..cd6fbe9fb 100644
--- a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml
+++ b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml
@@ -33,9 +33,8 @@
<field-name>dao</field-name>
</requirement>
<requirement>
- <role>org.apache.maven.archiva.database.RepositoryDAO</role>
- <role-hint>jdo</role-hint>
- <field-name>repositoryDAO</field-name>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <field-name>archivaConfiguration</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.scanner.RepositoryScanner</role>
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java
index 0233e3d71..f56968c45 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java
@@ -22,13 +22,11 @@ package org.apache.maven.archiva.web.repository;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-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;
import org.apache.maven.archiva.proxy.ProxyException;
import org.apache.maven.archiva.proxy.RepositoryProxyConnectors;
-import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
import org.apache.maven.archiva.repository.layout.LayoutException;
@@ -38,21 +36,21 @@ import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Model;
import org.apache.maven.model.Relocation;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.codehaus.plexus.webdav.AbstractDavServerComponent;
import org.codehaus.plexus.webdav.DavServerComponent;
import org.codehaus.plexus.webdav.DavServerException;
import org.codehaus.plexus.webdav.servlet.DavServerRequest;
import org.codehaus.plexus.webdav.util.WebdavMethodUtil;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+
/**
* ProxiedDavServer
*
@@ -91,9 +89,7 @@ public class ProxiedDavServer
private BidirectionalRepositoryLayout layout;
- private ManagedRepositoryConfiguration repositoryConfiguration;
-
- private ArchivaRepository managedRepository;
+ private ManagedRepositoryConfiguration managedRepository;
public String getPrefix()
{
@@ -122,14 +118,11 @@ public class ProxiedDavServer
Configuration config = archivaConfiguration.getConfiguration();
- repositoryConfiguration = config.findManagedRepositoryById( getPrefix() );
-
- managedRepository =
- ArchivaConfigurationAdaptor.toArchivaRepository( repositoryConfiguration );
+ managedRepository = config.findManagedRepositoryById( getPrefix() );
try
{
- layout = layoutFactory.getLayout( managedRepository.getLayoutType() );
+ layout = layoutFactory.getLayout( managedRepository.getLayout() );
}
catch ( LayoutException e )
{
@@ -332,6 +325,6 @@ public class ProxiedDavServer
public ManagedRepositoryConfiguration getRepositoryConfiguration()
{
- return repositoryConfiguration;
+ return managedRepository;
}
}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
index 20246eda6..74070ed3a 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java
@@ -42,7 +42,7 @@ public class ArchivaStartup
/**
* @plexus.requirement role-hint="default"
*/
- private ConfigurationSynchronization configSync;
+ private SecuritySynchronization securitySync;
/**
* @plexus.requirement role-hint="default"
@@ -61,7 +61,7 @@ public class ArchivaStartup
try
{
- configSync.startup();
+ securitySync.startup();
resolverFactory.startup();
taskScheduler.startup();
}
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ConfigurationSynchronization.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
index 267219808..234e5f0e2 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ConfigurationSynchronization.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
@@ -20,15 +20,9 @@ package org.apache.maven.archiva.web.startup;
*/
import org.apache.maven.archiva.common.ArchivaException;
-import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.ConfigurationNames;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.ObjectNotFoundException;
-import org.apache.maven.archiva.model.ArchivaRepository;
-import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.redback.role.RoleManager;
import org.codehaus.plexus.redback.role.RoleManagerException;
@@ -42,20 +36,15 @@ import java.util.List;
*
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$
- * @plexus.component role="org.apache.maven.archiva.web.startup.ConfigurationSynchronization"
+ *
+ * @plexus.component role="org.apache.maven.archiva.web.startup.SecuritySynchronization"
* role-hint="default"
- * @todo consider whether we really need these in the database or not
*/
-public class ConfigurationSynchronization
+public class SecuritySynchronization
extends AbstractLogEnabled
implements RegistryListener
{
/**
- * @plexus.requirement role-hint="jdo"
- */
- private ArchivaDAO dao;
-
- /**
* @plexus.requirement role-hint="default"
*/
private RoleManager roleManager;
@@ -82,37 +71,6 @@ public class ConfigurationSynchronization
{
for ( ManagedRepositoryConfiguration repoConfig : repos )
{
- try
- {
- try
- {
- ArchivaRepository repository = dao.getRepositoryDAO().getRepository( repoConfig.getId() );
- // Found repository. Update it.
-
- repository.getModel().setName( repoConfig.getName() );
- repository.getModel().setUrl( PathUtil.toUrl( repoConfig.getLocation() ) );
- repository.getModel().setLayoutName( repoConfig.getLayout() );
- repository.getModel().setCreationSource( "configuration" );
- repository.getModel().setReleasePolicy( repoConfig.isReleases() );
- repository.getModel().setSnapshotPolicy( repoConfig.isSnapshots() );
-
- dao.getRepositoryDAO().saveRepository( repository );
- }
- catch ( ObjectNotFoundException e )
- {
- // Add the repository to the database.
- getLogger().info( "Adding repository configuration to DB: " + repoConfig );
- ArchivaRepository drepo = ArchivaConfigurationAdaptor.toArchivaRepository( repoConfig );
- drepo.getModel().setCreationSource( "configuration" );
- dao.getRepositoryDAO().saveRepository( drepo );
- }
- }
- catch ( ArchivaDatabaseException e )
- {
- // Log error.
- getLogger().error( "Unable to add configured repositories to the database: " + e.getMessage(), e );
- }
-
// manage roles for repositories
try
{
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java
index 21092cafe..db73fb0cf 100644
--- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java
+++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java
@@ -22,29 +22,32 @@ package org.apache.maven.archiva.web.tags;
import com.opensymphony.webwork.WebWorkException;
import com.opensymphony.webwork.components.Component;
import com.opensymphony.xwork.util.OgnlValueStack;
+
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.apache.maven.archiva.database.constraints.ArtifactsRelatedConstraint;
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;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.PageContext;
import java.io.IOException;
import java.io.Writer;
import java.text.DecimalFormat;
import java.util.Iterator;
import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.PageContext;
+
/**
* DownloadArtifact
*
@@ -60,6 +63,11 @@ public class DownloadArtifact
* @plexus.requirement role-hint="jdo"
*/
private ArchivaDAO dao;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchivaConfiguration archivaConfiguration;
/**
* @plexus.requirement
@@ -110,8 +118,8 @@ public class DownloadArtifact
if ( relatedArtifacts != null )
{
String repoId = ( (ArchivaArtifact) relatedArtifacts.get( 0 ) ).getModel().getRepositoryId();
- ArchivaRepository repo = dao.getRepositoryDAO().getRepository( repoId );
- BidirectionalRepositoryLayout layout = layoutFactory.getLayout( repo.getLayoutType() );
+ ManagedRepositoryConfiguration repo = findRepository( repoId );
+ BidirectionalRepositoryLayout layout = layoutFactory.getLayout( repo.getLayout() );
String prefix = req.getContextPath() + "/repository/" + repoId;
@@ -150,18 +158,23 @@ public class DownloadArtifact
return super.end( writer, body );
}
+ private ManagedRepositoryConfiguration findRepository( String repoId )
+ {
+ return archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId );
+ }
+
private void appendError( StringBuffer sb, Exception e )
{
/* do nothing */
}
- private void appendMini( StringBuffer sb, String prefix, ArchivaRepository repo,
+ private void appendMini( StringBuffer sb, String prefix, ManagedRepositoryConfiguration repo,
BidirectionalRepositoryLayout layout, List relatedArtifacts )
{
/* do nothing */
}
- private void appendNormal( StringBuffer sb, String prefix, ArchivaRepository repo,
+ private void appendNormal( StringBuffer sb, String prefix, ManagedRepositoryConfiguration repo,
BidirectionalRepositoryLayout layout, List relatedArtifacts )
{
/*
diff --git a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java
index 3b522e782..2c464c4f7 100644
--- a/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java
+++ b/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java
@@ -1,11 +1,9 @@
package org.apache.maven.archiva.web.action.admin.repositories;
-import junit.framework.Assert;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArtifactDAO;
import org.apache.maven.archiva.database.ProjectModelDAO;
-import org.apache.maven.archiva.database.RepositoryDAO;
import org.apache.maven.archiva.database.RepositoryProblemDAO;
import org.apache.maven.archiva.database.SimpleConstraint;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
@@ -14,6 +12,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import junit.framework.Assert;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -72,11 +72,6 @@ public class ArchivaDAOStub
throw new UnsupportedOperationException( "query not implemented for stub" );
}
- public RepositoryDAO getRepositoryDAO()
- {
- throw new UnsupportedOperationException( "query not implemented for stub" );
- }
-
public RepositoryProblemDAO getRepositoryProblemDAO()
{
throw new UnsupportedOperationException( "query not implemented for stub" );