aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-scheduler
diff options
context:
space:
mode:
authorolivier lamy <olamy@apache.org>2017-07-07 17:20:47 +1000
committerolivier lamy <olamy@apache.org>2017-07-07 17:20:47 +1000
commit22430044a4626cafb3bf9f2d3c9cafa2e0e679fd (patch)
treefcc86aefb27bdc01447c0d604e9e15bb786353c2 /archiva-modules/archiva-scheduler
parent58ac86f011603664b34dfc5089c1a998d7fdbbc9 (diff)
downloadarchiva-22430044a4626cafb3bf9f2d3c9cafa2e0e679fd.tar.gz
archiva-22430044a4626cafb3bf9f2d3c9cafa2e0e679fd.zip
push work started with shaded lucene
Signed-off-by: olivier lamy <olamy@apache.org>
Diffstat (limited to 'archiva-modules/archiva-scheduler')
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml11
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java55
2 files changed, 16 insertions, 50 deletions
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
index 58a5f5bb1..2f2c6244e 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
@@ -44,16 +44,7 @@
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-queryparser</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-analyzers-common</artifactId>
- </exclusion>
- </exclusions>
+ <classifier>shaded-lucene</classifier>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
index 71fb58460..b585fb782 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
@@ -23,13 +23,9 @@ package org.apache.archiva.scheduler.indexing;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.archiva.redback.components.taskqueue.Task;
import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutionException;
import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutor;
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanQuery;
import org.apache.maven.index.ArtifactContext;
import org.apache.maven.index.ArtifactContextProducer;
import org.apache.maven.index.FlatSearchRequest;
@@ -40,11 +36,12 @@ import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.index.expr.SourcedSearchExpression;
import org.apache.maven.index.packer.IndexPacker;
import org.apache.maven.index.packer.IndexPackingRequest;
+import org.apache.maven.index.shaded.lucene.search.BooleanClause;
+import org.apache.maven.index.shaded.lucene.search.BooleanQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
@@ -60,31 +57,18 @@ public class ArchivaIndexingTaskExecutor
{
private Logger log = LoggerFactory.getLogger( ArchivaIndexingTaskExecutor.class );
+ @Inject
private IndexPacker indexPacker;
- private ArtifactContextProducer artifactContextProducer;
-
@Inject
- private PlexusSisuBridge plexusSisuBridge;
+ private ArtifactContextProducer artifactContextProducer;
@Inject
private ManagedRepositoryAdmin managedRepositoryAdmin;
+ @Inject
private NexusIndexer nexusIndexer;
- @PostConstruct
- public void initialize()
- throws PlexusSisuBridgeException
- {
- log.info( "Initialized {}", this.getClass().getName() );
-
- artifactContextProducer = plexusSisuBridge.lookup( ArtifactContextProducer.class );
-
- indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
-
- nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
-
- }
/**
* depending on current {@link Task} you have.
@@ -162,9 +146,9 @@ public class ArchivaIndexingTaskExecutor
// TODO make that configurable?
if ( artifactFile.getPath().endsWith( ".pom" ) )
{
- ac.getArtifactInfo().fextension = "pom";
- ac.getArtifactInfo().packaging = "pom";
- ac.getArtifactInfo().classifier = "pom";
+ ac.getArtifactInfo().setFileExtension( "pom" );
+ ac.getArtifactInfo().setPackaging( "pom" );
+ ac.getArtifactInfo().setClassifier( "pom" );
}
if ( indexingTask.getAction().equals( ArtifactIndexingTask.Action.ADD ) )
{
@@ -174,20 +158,20 @@ public class ArchivaIndexingTaskExecutor
BooleanQuery q = new BooleanQuery();
q.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression(
- ac.getArtifactInfo().groupId ) ), BooleanClause.Occur.MUST );
+ ac.getArtifactInfo().getGroupId() ) ), BooleanClause.Occur.MUST );
q.add( nexusIndexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression(
- ac.getArtifactInfo().artifactId ) ), BooleanClause.Occur.MUST );
+ ac.getArtifactInfo().getArtifactId() ) ), BooleanClause.Occur.MUST );
q.add( nexusIndexer.constructQuery( MAVEN.VERSION, new SourcedSearchExpression(
- ac.getArtifactInfo().version ) ), BooleanClause.Occur.MUST );
- if ( ac.getArtifactInfo().classifier != null )
+ ac.getArtifactInfo().getVersion() ) ), BooleanClause.Occur.MUST );
+ if ( ac.getArtifactInfo().getClassifier() != null )
{
q.add( nexusIndexer.constructQuery( MAVEN.CLASSIFIER, new SourcedSearchExpression(
- ac.getArtifactInfo().classifier ) ), BooleanClause.Occur.MUST );
+ ac.getArtifactInfo().getClassifier() ) ), BooleanClause.Occur.MUST );
}
- if ( ac.getArtifactInfo().packaging != null )
+ if ( ac.getArtifactInfo().getPackaging() != null )
{
q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression(
- ac.getArtifactInfo().packaging ) ), BooleanClause.Occur.MUST );
+ ac.getArtifactInfo().getPackaging() ) ), BooleanClause.Occur.MUST );
}
FlatSearchRequest flatSearchRequest = new FlatSearchRequest( q, context );
FlatSearchResponse flatSearchResponse = nexusIndexer.searchFlat( flatSearchRequest );
@@ -272,13 +256,4 @@ public class ArchivaIndexingTaskExecutor
this.indexPacker = indexPacker;
}
- public PlexusSisuBridge getPlexusSisuBridge()
- {
- return plexusSisuBridge;
- }
-
- public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge )
- {
- this.plexusSisuBridge = plexusSisuBridge;
- }
}