summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2010-11-25 11:20:47 +0000
committerMaria Odea B. Ching <oching@apache.org>2010-11-25 11:20:47 +0000
commitbc56d6353c98c3ff4ed51033ac9ec8a09351926a (patch)
treeff25b2856250af4da932c051a125124ae35c093e /archiva-modules/archiva-base
parent0452f87c94754cd795fd526b0bcba8f1f1d937aa (diff)
downloadarchiva-bc56d6353c98c3ff4ed51033ac9ec8a09351926a.tar.gz
archiva-bc56d6353c98c3ff4ed51033ac9ec8a09351926a.zip
[MRM-1097]
o upgrade nexus indexer to 3.0.1 + added logger bean which is needed by NexusIndexer o for deployments/proxied artifacts, create and close indexing context when indexing task is executed as compared to the original behavior where the indexing context is created before it is queued (so as the indexing task queue builds up, more indexing contexts are being opened/created which might be causing the too many open files problem) o updated unit tests with changes made git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1039004 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java31
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java17
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java17
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java17
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java20
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java20
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java20
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java17
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java54
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java17
-rw-r--r--archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java20
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml6
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java9
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java5
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java14
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java10
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java10
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java17
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java20
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java18
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java20
22 files changed, 365 insertions, 18 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java
index 203e5bd76..f7b5a2487 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/maven/archiva/consumers/RepositoryContentConsumer.java
@@ -63,6 +63,22 @@ public interface RepositoryContentConsumer extends Consumer
/**
* <p>
+ * Event that triggers at the beginning of a scan, where you can also indicate whether the consumers will be
+ * executed on an entire repository or on a specific resource.
+ * </p>
+ *
+ * @see RepositoryContentConsumer#beginScan(org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration, java.util.Date )
+ *
+ * @param repository the repository that this consumer is being used for.
+ * @param whenGathered the start of the repository scan
+ * @param executeOnEntireRepo flags whether the consumer will be executed on an entire repository or just on a specific resource
+ * @throws ConsumerException if there was a problem with using the provided repository with the consumer.
+ */
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException;
+
+ /**
+ * <p>
* Event indicating a file is to be processed by this consumer.
* </p>
*
@@ -76,6 +92,14 @@ public interface RepositoryContentConsumer extends Consumer
* @throws ConsumerException if there was a problem processing this file.
*/
public void processFile( String path ) throws ConsumerException;
+
+ /**
+ *
+ * @param path
+ * @param executeOnEntireRepo
+ * @throws Exception
+ */
+ public void processFile( String path, boolean executeOnEntireRepo ) throws Exception;
/**
* <p>
@@ -90,6 +114,13 @@ public interface RepositoryContentConsumer extends Consumer
public void completeScan();
/**
+ *
+ * @param executeOnEntireRepo
+ * @throws Exception
+ */
+ public void completeScan( boolean executeOnEntireRepo );
+
+ /**
* Whether the consumer should process files that have not been modified since the time passed in to the scan
* method.
* @return whether to process the unmodified files
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
index fa2e28987..e01510882 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumer.java
@@ -99,11 +99,22 @@ public class ArtifactMissingChecksumsConsumer
this.repositoryDir = new File( repo.getLocation() );
}
+ public void beginScan( ManagedRepositoryConfiguration repo, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repo, whenGathered );
+ }
+
public void completeScan()
{
/* do nothing */
}
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return getDefaultArtifactExclusions();
@@ -120,6 +131,12 @@ public class ArtifactMissingChecksumsConsumer
createFixChecksum( path, new ChecksumAlgorithm[] { ChecksumAlgorithm.SHA1 } );
createFixChecksum( path, new ChecksumAlgorithm[] { ChecksumAlgorithm.MD5 } );
}
+
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ processFile( path );
+ }
private void createFixChecksum( String path, ChecksumAlgorithm checksumAlgorithm[] )
{
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java
index 9d39e8c2b..f510b81df 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRemoveConsumer.java
@@ -95,11 +95,22 @@ public class AutoRemoveConsumer
this.repositoryDir = new File( repository.getLocation() );
}
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void completeScan()
{
/* do nothing */
}
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return null;
@@ -121,6 +132,12 @@ public class AutoRemoveConsumer
}
}
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ processFile( path );
+ }
+
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
if ( ConfigurationNames.isRepositoryScanning( propertyName ) )
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java
index 2df8820db..3fb70b961 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/AutoRenameConsumer.java
@@ -96,11 +96,22 @@ public class AutoRenameConsumer
this.repositoryDir = new File( repository.getLocation() );
}
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void completeScan()
{
/* do nothing */
}
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return null;
@@ -143,4 +154,10 @@ public class AutoRenameConsumer
file.delete();
}
}
+
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ processFile( path );
+ }
}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
index e40bb8d27..c8d0ddc0a 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/MetadataUpdaterConsumer.java
@@ -142,11 +142,24 @@ public class MetadataUpdaterConsumer
}
}
+ @Override
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void completeScan()
{
/* do nothing here */
}
+ @Override
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return getDefaultArtifactExclusions();
@@ -176,6 +189,13 @@ public class MetadataUpdaterConsumer
}
}
+ @Override
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws Exception
+ {
+ processFile( path );
+ }
+
private void updateProjectMetadata( ArtifactReference artifact, String path )
{
ProjectReference projectRef = new ProjectReference();
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
index e7ac88799..051f8e514 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/ValidateChecksumConsumer.java
@@ -102,11 +102,24 @@ public class ValidateChecksumConsumer
this.repositoryDir = new File( repository.getLocation() );
}
+ @Override
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void completeScan()
{
/* nothing to do */
}
+ @Override
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return null;
@@ -143,6 +156,13 @@ public class ValidateChecksumConsumer
}
}
+ @Override
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws Exception
+ {
+ processFile( path );
+ }
+
public void initialize()
throws InitializationException
{
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
index bcdc5c5fa..a77507cf7 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
@@ -157,6 +157,13 @@ public class RepositoryPurgeConsumer
}
}
+ @Override
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void processFile( String path )
throws ConsumerException
{
@@ -175,11 +182,24 @@ public class RepositoryPurgeConsumer
}
}
+ @Override
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws Exception
+ {
+ processFile( path );
+ }
+
public void completeScan()
{
/* do nothing */
}
+ @Override
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
if ( ConfigurationNames.isRepositoryScanning( propertyName ) )
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java
index 75772566e..973e71f67 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/src/main/java/org/apache/archiva/consumers/dependencytree/DependencyTreeGeneratorConsumer.java
@@ -155,10 +155,21 @@ public class DependencyTreeGeneratorConsumer
}
}
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void completeScan()
{
}
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return null;
@@ -246,6 +257,12 @@ public class DependencyTreeGeneratorConsumer
}
}
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ processFile( path );
+ }
+
private void flushProjectCache( MavenProjectBuilder projectBuilder )
{
try
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
index 836fa6a8e..5e1f1ee9c 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
@@ -99,6 +99,7 @@ public class NexusIndexerConsumer
try
{
+ log.info( "Creating indexing context for repo : " + repository.getId() );
context = ArtifactIndexingTask.createContext( repository );
}
catch ( IOException e )
@@ -111,6 +112,21 @@ public class NexusIndexerConsumer
}
}
+ @Override
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ if( executeOnEntireRepo )
+ {
+ beginScan( repository, whenGathered );
+ }
+ else
+ {
+ this.repository = repository;
+ managedRepository = new File( repository.getLocation() );
+ }
+ }
+
public void processFile( String path )
throws ConsumerException
{
@@ -129,6 +145,33 @@ public class NexusIndexerConsumer
}
}
+ @Override
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws Exception
+ {
+ if( executeOnEntireRepo )
+ {
+ processFile( path );
+ }
+ else
+ {
+ File artifactFile = new File( managedRepository, path );
+
+ // specify in indexing task that this is not a repo scan request!
+ ArtifactIndexingTask task =
+ new ArtifactIndexingTask( repository, artifactFile, ArtifactIndexingTask.Action.ADD, context, false );
+ try
+ {
+ log.debug( "Queueing indexing task + '" + task + "' to add or update the artifact in the index." );
+ scheduler.queueTask( task );
+ }
+ catch ( TaskQueueException e )
+ {
+ throw new ConsumerException( e.getMessage(), e );
+ }
+ }
+ }
+
public void completeScan()
{
ArtifactIndexingTask task =
@@ -145,6 +188,17 @@ public class NexusIndexerConsumer
context = null;
}
+ @Override
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ if( executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
+ // else, do nothing as the context will be closed when indexing task is executed if not a repo scan request!
+ }
+
public List<String> getExcludes()
{
return Collections.emptyList();
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml
index 542215ff2..8282c6cb2 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/resources/META-INF/spring-context.xml
@@ -8,4 +8,8 @@
<constructor-arg ref="archivaConfiguration"/>
<constructor-arg ref="fileTypes"/>
</bean>
+
+ <bean id="logger" class="org.apache.maven.archiva.common.utils.Slf4JPlexusLogger">
+ <constructor-arg type="java.lang.Class"><value>org.sonatype.nexus.index.DefaultNexusIndexer</value></constructor-arg>
+ </bean>
</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
index 762f79d55..61e496f6a 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java
@@ -127,6 +127,12 @@ public class ArchivaMetadataCreationConsumer
this.whenGathered = whenGathered;
}
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void processFile( String path )
throws ConsumerException
{
@@ -174,11 +180,22 @@ public class ArchivaMetadataCreationConsumer
metadataRepository.updateProject( repoId, project );
}
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ processFile( path );
+ }
+
public void completeScan()
{
/* do nothing */
}
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
if ( ConfigurationNames.isRepositoryScanning( propertyName ) )
diff --git a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
index 0cd5bc3b2..df75dde2f 100644
--- a/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
+++ b/archiva-modules/archiva-base/archiva-converter/src/main/java/org/apache/maven/archiva/converter/legacy/LegacyConverterArtifactConsumer.java
@@ -88,11 +88,24 @@ public class LegacyConverterArtifactConsumer
this.managedRepository.setRepository( repository );
}
+ @Override
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void completeScan()
{
}
+ @Override
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return excludes;
@@ -124,6 +137,13 @@ public class LegacyConverterArtifactConsumer
}
}
+ @Override
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws Exception
+ {
+ processFile( path );
+ }
+
public String getDescription()
{
return "Legacy Artifact to Default Artifact Converter";
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml
index 019b9b78e..7401aec3f 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/resources/META-INF/spring-context.xml
@@ -7,6 +7,10 @@
<constructor-arg ref="nexusIndexer"/>
<constructor-arg ref="archivaConfiguration"/>
</bean>
-
+
+ <bean id="logger" class="org.apache.maven.archiva.common.utils.Slf4JPlexusLogger">
+ <constructor-arg type="java.lang.Class"><value>org.sonatype.nexus.index.DefaultNexusIndexer</value></constructor-arg>
+ </bean>
+
<!-- <bean id="indexingContextMap" class="org.apache.archiva.indexer.IndexingContextMap"/> -->
</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
index 6f22edebe..5b1e30a5d 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java
@@ -237,7 +237,7 @@ public class RepositoryContentConsumers implements ApplicationContextAware
// Run the repository consumers
try
{
- Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime() );
+ Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime(), false );
List<KnownRepositoryContentConsumer> selectedKnownConsumers = getSelectedKnownConsumers();
@@ -267,9 +267,12 @@ public class RepositoryContentConsumers implements ApplicationContextAware
BaseFile baseFile = new BaseFile( repository.getLocation(), localFile );
ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
predicate.setBasefile( baseFile );
+ predicate.setCaseSensitive( false );
+
ConsumerProcessFileClosure closure = new ConsumerProcessFileClosure();
closure.setBasefile( baseFile );
- predicate.setCaseSensitive( false );
+ closure.setExecuteOnEntireRepo( false );
+
Closure processIfWanted = IfClosure.getInstance( predicate, closure );
CollectionUtils.forAllDo( selectedKnownConsumers, processIfWanted );
@@ -280,7 +283,7 @@ public class RepositoryContentConsumers implements ApplicationContextAware
CollectionUtils.forAllDo( selectedInvalidConsumers, closure );
}
- TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure( repository );
+ TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure( repository, false );
CollectionUtils.forAllDo( selectedKnownConsumers, scanCompletedClosure );
}
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
index a2a1df75d..1ec749391 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java
@@ -82,7 +82,7 @@ public class RepositoryScannerInstance
stats = new RepositoryScanStatistics();
stats.setRepositoryId( repository.getId() );
- Closure triggerBeginScan = new TriggerBeginScanClosure( repository, new Date( System.currentTimeMillis() ) );
+ Closure triggerBeginScan = new TriggerBeginScanClosure( repository, new Date( System.currentTimeMillis() ), true );
CollectionUtils.forAllDo( knownConsumerList, triggerBeginScan );
CollectionUtils.forAllDo( invalidConsumerList, triggerBeginScan );
@@ -131,6 +131,7 @@ public class RepositoryScannerInstance
}
consumerProcessFile.setBasefile( basefile );
+ consumerProcessFile.setExecuteOnEntireRepo( true );
consumerWantsFile.setBasefile( basefile );
Closure processIfWanted = IfClosure.getInstance( consumerWantsFile, consumerProcessFile );
@@ -145,7 +146,7 @@ public class RepositoryScannerInstance
public void directoryWalkFinished()
{
- TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure( repository );
+ TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure( repository, true );
CollectionUtils.forAllDo( knownConsumers, scanCompletedClosure );
CollectionUtils.forAllDo( invalidConsumers, scanCompletedClosure );
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java
index 5fadde292..618463575 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java
@@ -37,6 +37,8 @@ public class ConsumerProcessFileClosure
private BaseFile basefile;
+ private boolean executeOnEntireRepo;
+
public void execute( Object input )
{
if ( input instanceof RepositoryContentConsumer )
@@ -47,7 +49,7 @@ public class ConsumerProcessFileClosure
{
log.debug( "Sending to consumer: " + consumer.getId() );
- consumer.processFile( basefile.getRelativePath() );
+ consumer.processFile( basefile.getRelativePath(), executeOnEntireRepo );
}
catch ( Exception e )
{
@@ -70,6 +72,16 @@ public class ConsumerProcessFileClosure
this.basefile = basefile;
}
+ public boolean isExecuteOnEntireRepo()
+ {
+ return executeOnEntireRepo;
+ }
+
+ public void setExecuteOnEntireRepo( boolean executeOnEntireRepo )
+ {
+ this.executeOnEntireRepo = executeOnEntireRepo;
+ }
+
public Logger getLogger()
{
return log;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
index 067ab1641..2976637b8 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java
@@ -42,6 +42,8 @@ public class TriggerBeginScanClosure
private Date whenGathered;
+ private boolean executeOnEntireRepo = true;
+
public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository )
{
this.repository = repository;
@@ -53,6 +55,12 @@ public class TriggerBeginScanClosure
this.whenGathered = whenGathered;
}
+ public TriggerBeginScanClosure( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ {
+ this( repository, whenGathered );
+ this.executeOnEntireRepo = executeOnEntireRepo;
+ }
+
public void execute( Object input )
{
if ( input instanceof RepositoryContentConsumer )
@@ -61,7 +69,7 @@ public class TriggerBeginScanClosure
try
{
- consumer.beginScan( repository, whenGathered );
+ consumer.beginScan( repository, whenGathered, executeOnEntireRepo );
}
catch ( ConsumerException e )
{
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
index 82875a6ab..973230e93 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java
@@ -35,17 +35,25 @@ public class TriggerScanCompletedClosure
private final ManagedRepositoryConfiguration repository;
+ private boolean executeOnEntireRepo = true;
+
public TriggerScanCompletedClosure( ManagedRepositoryConfiguration repository )
{
this.repository = repository;
}
+ public TriggerScanCompletedClosure( ManagedRepositoryConfiguration repository, boolean executeOnEntireRepo )
+ {
+ this( repository );
+ this.executeOnEntireRepo = executeOnEntireRepo;
+ }
+
public void execute( Object input )
{
if ( input instanceof RepositoryContentConsumer )
{
RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
- consumer.completeScan();
+ consumer.completeScan( executeOnEntireRepo );
log.debug( "Consumer [" + consumer.getId() + "] completed for repository [" + repository.getId() + "]" );
}
}
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
index 6e39db51a..ab5879ae6 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/InvalidScanConsumer.java
@@ -49,11 +49,22 @@ public class InvalidScanConsumer
/* do nothing */
}
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void completeScan()
{
/* do nothing */
}
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return null;
@@ -70,6 +81,12 @@ public class InvalidScanConsumer
processCount++;
}
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ processFile( path );
+ }
+
public String getDescription()
{
return "Bad Content Scan Consumer (for testing)";
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
index 8498b4dd8..6be497eb1 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/KnownScanConsumer.java
@@ -76,17 +76,37 @@ public class KnownScanConsumer
/* do nothing */
}
+ @Override
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void processFile( String path )
throws ConsumerException
{
this.processCount++;
}
+ @Override
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws Exception
+ {
+ processFile( path );
+ }
+
public void completeScan()
{
/* do nothing */
}
+ @Override
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public int getProcessCount()
{
return processCount;
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
index e6a5cc391..53e5433a6 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
@@ -270,16 +270,16 @@ public class RepositoryContentConsumersTest
Date startTime = new Date( System.currentTimeMillis() );
startTime.setTime( 12345678 );
- selectedKnownConsumer.beginScan( repo, startTime );
+ selectedKnownConsumer.beginScan( repo, startTime, false );
selectedKnownConsumer.getExcludes();
knownControl.setReturnValue( Collections.EMPTY_LIST );
selectedKnownConsumer.getIncludes();
knownControl.setReturnValue( Collections.singletonList( "**/*.txt" ) );
- selectedKnownConsumer.processFile( _OS( "path/to/test-file.txt" ) );
+ selectedKnownConsumer.processFile( _OS( "path/to/test-file.txt" ), false );
// knownConsumer.completeScan();
knownControl.replay();
- selectedInvalidConsumer.beginScan( repo, startTime );
+ selectedInvalidConsumer.beginScan( repo, startTime, false );
// invalidConsumer.completeScan();
invalidControl.replay();
@@ -293,7 +293,7 @@ public class RepositoryContentConsumersTest
File notIncludedTestFile = getTestFile( "target/test-repo/path/to/test-file.xml" );
- selectedKnownConsumer.beginScan( repo, startTime );
+ selectedKnownConsumer.beginScan( repo, startTime, false );
selectedKnownConsumer.getExcludes();
knownControl.setReturnValue( Collections.EMPTY_LIST );
selectedKnownConsumer.getIncludes();
@@ -301,8 +301,8 @@ public class RepositoryContentConsumersTest
// knownConsumer.completeScan();
knownControl.replay();
- selectedInvalidConsumer.beginScan( repo, startTime );
- selectedInvalidConsumer.processFile( _OS( "path/to/test-file.xml" ) );
+ selectedInvalidConsumer.beginScan( repo, startTime, false );
+ selectedInvalidConsumer.processFile( _OS( "path/to/test-file.xml" ), false );
selectedInvalidConsumer.getId();
invalidControl.setReturnValue( "invalid" );
// invalidConsumer.completeScan();
@@ -318,14 +318,14 @@ public class RepositoryContentConsumersTest
File excludedTestFile = getTestFile( "target/test-repo/path/to/test-file.txt" );
- selectedKnownConsumer.beginScan( repo, startTime );
+ selectedKnownConsumer.beginScan( repo, startTime, false );
selectedKnownConsumer.getExcludes();
knownControl.setReturnValue( Collections.singletonList( "**/test-file.txt" ) );
// knownConsumer.completeScan();
knownControl.replay();
- selectedInvalidConsumer.beginScan( repo, startTime );
- selectedInvalidConsumer.processFile( _OS( "path/to/test-file.txt" ) );
+ selectedInvalidConsumer.beginScan( repo, startTime, false );
+ selectedInvalidConsumer.processFile( _OS( "path/to/test-file.txt" ), false );
selectedInvalidConsumer.getId();
invalidControl.setReturnValue( "invalid" );
// invalidConsumer.completeScan();
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java
index 340be8b2b..0465d5e70 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/SampleKnownConsumer.java
@@ -50,11 +50,24 @@ public class SampleKnownConsumer
/* nothing to do */
}
+ @Override
+ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo )
+ throws ConsumerException
+ {
+ beginScan( repository, whenGathered );
+ }
+
public void completeScan()
{
/* nothing to do */
}
+ @Override
+ public void completeScan( boolean executeOnEntireRepo )
+ {
+ completeScan();
+ }
+
public List<String> getExcludes()
{
return null;
@@ -71,6 +84,13 @@ public class SampleKnownConsumer
/* nothing to do */
}
+ @Override
+ public void processFile( String path, boolean executeOnEntireRepo )
+ throws Exception
+ {
+ processFile( path );
+ }
+
public String getDescription()
{
return "Sample Known Consumer";