From cfd8ca2ffb4be4f0abda7a4a2e4600501d98a2b2 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Fri, 3 Dec 2010 14:11:05 +0000 Subject: [PATCH] [MRM-1097] 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) Updated unit tests with changes made Did not update the indexer as it would impact the API more significantly Merged from: r1039004 git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@1041824 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/cli/AbstractProgressConsumer.java | 17 +++ .../consumers/RepositoryContentConsumer.java | 31 +++++ .../ArtifactMissingChecksumsConsumer.java | 17 +++ .../consumers/core/AutoRemoveConsumer.java | 17 +++ .../consumers/core/AutoRenameConsumer.java | 17 +++ .../core/MetadataUpdaterConsumer.java | 17 +++ .../core/ValidateChecksumConsumer.java | 17 +++ .../repository/RepositoryPurgeConsumer.java | 17 +++ .../ArtifactUpdateDatabaseConsumer.java | 17 +++ .../DependencyTreeGeneratorConsumer.java | 17 +++ .../archiva-lucene-consumers/pom.xml | 4 + .../lucene/NexusIndexerConsumer.java | 53 +++++++++ .../resources/META-INF/spring-context.xml | 4 + .../LegacyConverterArtifactConsumer.java | 17 +++ .../indexer/search/NexusRepositorySearch.java | 1 + .../resources/META-INF/spring-context.xml | 6 +- .../functors/TriggerScanCompletedClosure.java | 10 +- .../scanner/RepositoryContentConsumers.java | 9 +- .../scanner/RepositoryScannerInstance.java | 5 +- .../functors/ConsumerProcessFileClosure.java | 14 ++- .../functors/TriggerBeginScanClosure.java | 10 +- .../scanner/InvalidScanConsumer.java | 17 +++ .../repository/scanner/KnownScanConsumer.java | 17 +++ .../RepositoryContentConsumersTest.java | 18 +-- .../scanner/SampleKnownConsumer.java | 17 +++ .../ArchivaIndexingTaskExecutor.java | 106 ++++++++++++------ .../scheduled/tasks/ArtifactIndexingTask.java | 19 ++++ .../resources/META-INF/spring-context.xml | 9 ++ .../ArchivaIndexingTaskExecutorTest.java | 3 + .../resources/META-INF/plexus/application.xml | 6 + pom.xml | 4 +- 31 files changed, 480 insertions(+), 53 deletions(-) create mode 100644 archiva-modules/archiva-scheduled/src/main/resources/META-INF/spring-context.xml 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 c464f70bb..14e7a87fd 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 @@ -43,6 +43,12 @@ public abstract class AbstractProgressConsumer this.count = 0; } + public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) + throws ConsumerException + { + beginScan( repository, whenGathered ); + } + public void processFile( String path ) throws ConsumerException { @@ -54,9 +60,20 @@ public abstract class AbstractProgressConsumer } + public void processFile( String path, boolean executeOnEntireRepo ) + throws ConsumerException + { + processFile( path ); + } + public void completeScan() { System.out.println( "Final Count of Artifacts processed by " + getId() + ": " + count ); } + public void completeScan( boolean executeOnEntireRepo ) + { + completeScan(); + } + } 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 @@ -61,6 +61,22 @@ public interface RepositoryContentConsumer extends Consumer */ public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered ) throws ConsumerException; + /** + *

+ * 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. + *

+ * + * @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; + /** *

* Event indicating a file is to be processed by this consumer. @@ -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; /** *

@@ -89,6 +113,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. 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 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 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 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..0025b0354 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,22 @@ public class MetadataUpdaterConsumer } } + public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) + throws ConsumerException + { + beginScan( repository, whenGathered ); + } + public void completeScan() { /* do nothing here */ } + public void completeScan( boolean executeOnEntireRepo ) + { + completeScan(); + } + public List getExcludes() { return getDefaultArtifactExclusions(); @@ -176,6 +187,12 @@ public class MetadataUpdaterConsumer } } + 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..7b4b773fd 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,22 @@ public class ValidateChecksumConsumer this.repositoryDir = new File( repository.getLocation() ); } + public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) + throws ConsumerException + { + beginScan( repository, whenGathered ); + } + public void completeScan() { /* nothing to do */ } + public void completeScan( boolean executeOnEntireRepo ) + { + completeScan(); + } + public List getExcludes() { return null; @@ -143,6 +154,12 @@ public class ValidateChecksumConsumer } } + 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 c71de5ca2..01650d66b 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,12 @@ public class RepositoryPurgeConsumer } } + public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) + throws ConsumerException + { + beginScan( repository, whenGathered ); + } + public void processFile( String path ) throws ConsumerException { @@ -175,11 +181,22 @@ public class RepositoryPurgeConsumer } } + public void processFile( String path, boolean executeOnEntireRepo ) + throws Exception + { + 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-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java index db2200006..5e6fd80a9 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java @@ -152,6 +152,12 @@ public class ArtifactUpdateDatabaseConsumer } } + public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) + throws ConsumerException + { + beginScan( repository, whenGathered ); + } + public void processFile( String path ) throws ConsumerException { @@ -210,6 +216,12 @@ public class ArtifactUpdateDatabaseConsumer } } + public void processFile( String path, boolean executeOnEntireRepo ) + throws Exception + { + processFile( path ); + } + /** * Get a Live Artifact from a Path. *

@@ -248,6 +260,11 @@ public class ArtifactUpdateDatabaseConsumer /* 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-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 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/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index 0c4123449..b1dd18558 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -64,6 +64,10 @@ bcel 5.2 + + org.slf4j + slf4j-api + org.slf4j slf4j-simple 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 2567d13ba..446de8b66 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 @@ -70,6 +70,8 @@ public class NexusIndexerConsumer private List includes = new ArrayList(); + private ManagedRepositoryConfiguration repository; + public NexusIndexerConsumer( ArchivaTaskScheduler scheduler, ArchivaConfiguration configuration, FileTypes filetypes ) { this.configuration = configuration; @@ -102,6 +104,7 @@ public class NexusIndexerConsumer try { + log.info( "Creating indexing context for repo : " + repository.getId() ); context = TaskCreator.createContext( repository ); } catch ( IOException e ) @@ -114,6 +117,20 @@ public class NexusIndexerConsumer } } + 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 { @@ -133,6 +150,32 @@ public class NexusIndexerConsumer } } + 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.queueIndexingTask( task ); + } + catch ( TaskQueueException e ) + { + throw new ConsumerException( e.getMessage(), e ); + } + } + } + public void completeScan() { ArtifactIndexingTask task = @@ -150,6 +193,16 @@ public class NexusIndexerConsumer context = null; } + 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 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 4e16b7f7d..6c4dd5694 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 @@ -13,4 +13,8 @@ + + + org.sonatype.nexus.index.DefaultNexusIndexer + \ No newline at end of file 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..dd03c4a34 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,22 @@ public class LegacyConverterArtifactConsumer this.managedRepository.setRepository( repository ); } + 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 getExcludes() { return excludes; @@ -124,6 +135,12 @@ public class LegacyConverterArtifactConsumer } } + 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/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java index 3c8f5a577..e04ffb728 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java @@ -37,6 +37,7 @@ import org.sonatype.nexus.index.ArtifactInfo; import org.sonatype.nexus.index.FlatSearchRequest; import org.sonatype.nexus.index.FlatSearchResponse; import org.sonatype.nexus.index.NexusIndexer; +import org.sonatype.nexus.index.context.IndexCreator; import org.sonatype.nexus.index.context.IndexingContext; import org.sonatype.nexus.index.context.UnsupportedExistingLuceneIndexException; 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 @@ - + + + org.sonatype.nexus.index.DefaultNexusIndexer + + \ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java index 82875a6ab..973230e93 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/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-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java index ec54b041e..f5c06f812 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java @@ -236,7 +236,7 @@ public class RepositoryContentConsumers // Run the repository consumers try { - Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime() ); + Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime(), false ); List selectedKnownConsumers = getSelectedKnownConsumers(); @@ -266,9 +266,12 @@ public class RepositoryContentConsumers 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 ); @@ -279,7 +282,7 @@ public class RepositoryContentConsumers 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-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java index e8d86d90c..63229aa97 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScannerInstance.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/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-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java index f8fe3ff70..e1a493926 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/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-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/TriggerBeginScanClosure.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/TriggerBeginScanClosure.java index d0a05cbc5..acacc72b1 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/functors/TriggerBeginScanClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/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-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java index 29e50a589..15bd8298d 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/InvalidScanConsumer.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/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 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-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java index 0ab62fe46..ce45cc55e 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/KnownScanConsumer.java @@ -76,17 +76,34 @@ public class KnownScanConsumer /* do nothing */ } + public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) + throws ConsumerException + { + beginScan( repository, whenGathered ); + } + public void processFile( String path ) throws ConsumerException { this.processCount++; } + public void processFile( String path, boolean executeOnEntireRepo ) + throws Exception + { + processFile( path ); + } + public void completeScan() { /* do nothing */ } + public void completeScan( boolean executeOnEntireRepo ) + { + completeScan(); + } + public int getProcessCount() { return processCount; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java index 86c4b5370..0b9653d49 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java @@ -241,16 +241,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(); @@ -264,7 +264,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(); @@ -272,8 +272,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(); @@ -289,14 +289,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-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java index c2358d702..1cba145ed 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/SampleKnownConsumer.java @@ -50,11 +50,22 @@ public class SampleKnownConsumer /* nothing to do */ } + public void beginScan( ManagedRepositoryConfiguration repository, Date whenGathered, boolean executeOnEntireRepo ) + throws ConsumerException + { + beginScan( repository, whenGathered ); + } + public void completeScan() { /* nothing to do */ } + public void completeScan( boolean executeOnEntireRepo ) + { + completeScan(); + } + public List getExcludes() { return null; @@ -71,6 +82,12 @@ public class SampleKnownConsumer /* nothing to do */ } + public void processFile( String path, boolean executeOnEntireRepo ) + throws Exception + { + processFile( path ); + } + public String getDescription() { return "Sample Known Consumer"; diff --git a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutor.java b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutor.java index 61a3f3460..3233a870e 100644 --- a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutor.java +++ b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutor.java @@ -21,11 +21,13 @@ package org.apache.maven.archiva.scheduled.executors; import java.io.File; import java.io.IOException; +import java.util.List; import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexReader; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.scheduled.tasks.ArtifactIndexingTask; +import org.apache.maven.archiva.scheduled.tasks.TaskCreator; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; import org.codehaus.plexus.taskqueue.Task; @@ -38,7 +40,9 @@ import org.sonatype.nexus.index.ArtifactContextProducer; import org.sonatype.nexus.index.ArtifactInfo; import org.sonatype.nexus.index.DefaultArtifactContextProducer; import org.sonatype.nexus.index.IndexerEngine; +import org.sonatype.nexus.index.context.IndexCreator; import org.sonatype.nexus.index.context.IndexingContext; +import org.sonatype.nexus.index.context.UnsupportedExistingLuceneIndexException; import org.sonatype.nexus.index.packer.IndexPacker; import org.sonatype.nexus.index.packer.IndexPackingRequest; @@ -78,44 +82,35 @@ public class ArchivaIndexingTaskExecutor ManagedRepositoryConfiguration repository = indexingTask.getRepository(); IndexingContext context = indexingTask.getContext(); - if ( ArtifactIndexingTask.Action.FINISH.equals( indexingTask.getAction() ) ) + if ( ArtifactIndexingTask.Action.FINISH.equals( indexingTask.getAction() ) + && indexingTask.isExecuteOnEntireRepo() ) { - try - { - context.optimize(); - - File managedRepository = new File( repository.getLocation() ); - final File indexLocation = new File( managedRepository, ".index" ); - IndexPackingRequest request = new IndexPackingRequest( context, indexLocation ); - indexPacker.packIndex( request ); - - log.debug( "Index file packaged at '" + indexLocation.getPath() + "'." ); - } - catch ( IOException e ) - { - log.error( "Error occurred while executing indexing task '" + indexingTask + "': " + e.getMessage() ); - throw new TaskExecutionException( "Error occurred while executing indexing task '" + indexingTask - + "'", e ); - } - finally + log.debug( "Finishing indexing task on repo: " + repository.getId() ); + finishIndexingTask( indexingTask, repository, context ); + } + else + { + // create context if not a repo scan request + if( !indexingTask.isExecuteOnEntireRepo() ) { - if ( context != null ) + try { - try - { - context.close( false ); - } - catch ( IOException e ) - { - log.error( "Error occurred while closing context: " + e.getMessage() ); - throw new TaskExecutionException( "Error occurred while closing context: " + e.getMessage() ); - } + log.debug( "Creating indexing context on resource: " + indexingTask.getResourceFile().getPath() ); + context = TaskCreator.createContext( repository ); + } + catch( IOException e ) + { + log.error( "Error occurred while creating context: " + e.getMessage() ); + throw new TaskExecutionException( "Error occurred while creating context: " + e.getMessage() ); + } + catch( UnsupportedExistingLuceneIndexException e ) + { + log.error( "Error occurred while creating context: " + e.getMessage() ); + throw new TaskExecutionException( "Error occurred while creating context: " + e.getMessage() ); } } - } - else - { - if ( context.getIndexDirectory() == null ) + + if ( context == null || context.getIndexDirectory() == null ) { throw new TaskExecutionException( "Trying to index an artifact but the context is already closed" ); } @@ -157,6 +152,13 @@ public class ArchivaIndexingTaskExecutor indexerEngine.update( context, ac ); context.getIndexWriter().commit(); } + + // close the context if not a repo scan request + if( !indexingTask.isExecuteOnEntireRepo() ) + { + log.debug( "Finishing indexing task on resource file : " + indexingTask.getResourceFile().getPath() ); + finishIndexingTask( indexingTask, repository, context ); + } } else { @@ -176,6 +178,44 @@ public class ArchivaIndexingTaskExecutor } } + private void finishIndexingTask( ArtifactIndexingTask indexingTask, ManagedRepositoryConfiguration repository, + IndexingContext context ) + throws TaskExecutionException + { + try + { + context.optimize(); + + File managedRepository = new File( repository.getLocation() ); + final File indexLocation = new File( managedRepository, ".index" ); + IndexPackingRequest request = new IndexPackingRequest( context, indexLocation ); + indexPacker.packIndex( request ); + + log.debug( "Index file packaged at '" + indexLocation.getPath() + "'." ); + } + catch ( IOException e ) + { + log.error( "Error occurred while executing indexing task '" + indexingTask + "': " + e.getMessage() ); + throw new TaskExecutionException( "Error occurred while executing indexing task '" + indexingTask + + "'", e ); + } + finally + { + if ( context != null ) + { + try + { + context.close( false ); + } + catch ( IOException e ) + { + log.error( "Error occurred while closing context: " + e.getMessage() ); + throw new TaskExecutionException( "Error occurred while closing context: " + e.getMessage() ); + } + } + } + } + public void initialize() throws InitializationException { diff --git a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/ArtifactIndexingTask.java b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/ArtifactIndexingTask.java index a9c0ac465..5d875a13a 100644 --- a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/ArtifactIndexingTask.java +++ b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/ArtifactIndexingTask.java @@ -41,6 +41,8 @@ public class ArtifactIndexingTask private final IndexingContext context; + private boolean executeOnEntireRepo = true; + public ArtifactIndexingTask( ManagedRepositoryConfiguration repository, File resourceFile, Action action, IndexingContext context ) { @@ -50,6 +52,23 @@ public class ArtifactIndexingTask this.context = context; } + public ArtifactIndexingTask( ManagedRepositoryConfiguration repository, File resourceFile, Action action, + IndexingContext context, boolean executeOnEntireRepo ) + { + this( repository, resourceFile, action, context ); + this.executeOnEntireRepo = executeOnEntireRepo; + } + + public boolean isExecuteOnEntireRepo() + { + return executeOnEntireRepo; + } + + public void setExecuteOnEntireRepo( boolean executeOnEntireRepo ) + { + this.executeOnEntireRepo = executeOnEntireRepo; + } + public long getMaxExecutionTime() { return 0; diff --git a/archiva-modules/archiva-scheduled/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-scheduled/src/main/resources/META-INF/spring-context.xml new file mode 100644 index 000000000..b3f04a157 --- /dev/null +++ b/archiva-modules/archiva-scheduled/src/main/resources/META-INF/spring-context.xml @@ -0,0 +1,9 @@ + + + + + org.sonatype.nexus.index.DefaultNexusIndexer + + \ No newline at end of file diff --git a/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java index a0e90b647..2c6ef3f95 100644 --- a/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java +++ b/archiva-modules/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaIndexingTaskExecutorTest.java @@ -26,6 +26,8 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; +import java.util.Collections; +import java.util.List; import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -45,6 +47,7 @@ import org.sonatype.nexus.index.FlatSearchRequest; import org.sonatype.nexus.index.FlatSearchResponse; import org.sonatype.nexus.index.IndexerEngine; import org.sonatype.nexus.index.NexusIndexer; +import org.sonatype.nexus.index.context.IndexCreator; import org.sonatype.nexus.index.context.IndexingContext; import org.sonatype.nexus.index.packer.IndexPacker; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml index c7823255a..af15d0c6f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml @@ -188,6 +188,12 @@ basic + + org.codehaus.plexus.logging.Logger + org.apache.maven.archiva.common.utils.Slf4JPlexusLogger + logger + + diff --git a/pom.xml b/pom.xml index 912b22397..85225852e 100644 --- a/pom.xml +++ b/pom.xml @@ -557,12 +557,12 @@ org.apache.lucene lucene-core - 2.4.0 + 2.4.1 org.apache.lucene lucene-queries - 2.4.0 + 2.4.1 javax.mail -- 2.39.5