aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java3
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java3
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml1
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java7
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/pom.xml13
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java11
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java26
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java115
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java2
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java24
-rw-r--r--archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml11
-rw-r--r--archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java19
-rw-r--r--archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml39
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java3
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml1
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml1
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java23
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml9
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml9
21 files changed, 175 insertions, 154 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
index 1176bc59c..715dc684c 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
@@ -56,7 +56,7 @@ public abstract class AbstractArtifactConsumerTest
ArchivaConfiguration archivaConfiguration;
@Inject
- protected PlexusSisuBridge plexusSisuBridge;
+ protected NexusIndexer nexusIndexer;
@Before
@@ -75,7 +75,6 @@ public abstract class AbstractArtifactConsumerTest
public void tearDown()
throws Exception
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
nexusIndexer.removeIndexingContext( indexingContext, false );
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
index 9412ac73c..f51753328 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
@@ -98,7 +98,7 @@ public abstract class AbstractRepositoryPurgeTest
protected ApplicationContext applicationContext;
@Inject
- protected PlexusSisuBridge plexusSisuBridge;
+ protected NexusIndexer nexusIndexer;
@Before
@@ -132,7 +132,6 @@ public abstract class AbstractRepositoryPurgeTest
protected void removeMavenIndexes()
throws Exception
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
nexusIndexer.removeIndexingContext( indexingContext, false );
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 e8b970b3e..208825140 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
@@ -80,6 +80,7 @@
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.lucene</groupId>
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 aa999bd6f..c85a8fbea 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
@@ -88,14 +88,13 @@ public class NexusIndexerConsumer
public NexusIndexerConsumer(
@Named( value = "archivaTaskScheduler#indexing" ) ArchivaTaskScheduler<ArtifactIndexingTask> scheduler,
@Named( value = "archivaConfiguration" ) ArchivaConfiguration configuration, FileTypes filetypes,
- PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils,
- ManagedRepositoryAdmin managedRepositoryAdmin )
- throws PlexusSisuBridgeException
+ MavenIndexerUtils mavenIndexerUtils,
+ ManagedRepositoryAdmin managedRepositoryAdmin, NexusIndexer nexusIndexer )
{
this.configuration = configuration;
this.filetypes = filetypes;
this.scheduler = scheduler;
- this.nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
+ this.nexusIndexer = nexusIndexer;
this.allIndexCreators = mavenIndexerUtils.getAllIndexCreators();
this.managedRepositoryAdmin = managedRepositoryAdmin;
}
diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml
index eae5642a9..a9f24ef0e 100644
--- a/archiva-modules/archiva-base/archiva-indexer/pom.xml
+++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml
@@ -49,14 +49,6 @@
</dependency>
<dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-queries</artifactId>
- </dependency>
- <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
@@ -84,7 +76,12 @@
</dependency>
<dependency>
<groupId>org.apache.maven.indexer</groupId>
+ <artifactId>indexer-reader</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.lucene</groupId>
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java
index 225cc78e8..663f0b63a 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java
@@ -19,7 +19,6 @@ package org.apache.archiva.indexer.merger;
*/
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.time.StopWatch;
@@ -62,12 +61,12 @@ public class DefaultIndexMerger
private List<String> runningGroups = new CopyOnWriteArrayList<String>();
@Inject
- public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils )
+ public DefaultIndexMerger( NexusIndexer nexusIndexer, IndexPacker indexPacker, MavenIndexerUtils mavenIndexerUtils )
throws PlexusSisuBridgeException
{
- this.indexer = plexusSisuBridge.lookup( NexusIndexer.class );
+ this.indexer = nexusIndexer;
this.mavenIndexerUtils = mavenIndexerUtils;
- indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
+ this.indexPacker = indexPacker;
}
@Override
@@ -112,7 +111,9 @@ public class DefaultIndexMerger
if ( indexMergerRequest.isPackIndex() )
{
- IndexPackingRequest request = new IndexPackingRequest( indexingContext, indexLocation );
+ IndexPackingRequest request = new IndexPackingRequest( indexingContext, //
+ indexingContext.acquireIndexSearcher().getIndexReader(), //
+ indexLocation );
indexPacker.packIndex( request );
}
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
index 322d82e06..dc7f5c03a 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java
@@ -44,10 +44,10 @@ public class TemporaryGroupIndexCleaner
private NexusIndexer indexer;
@Inject
- public TemporaryGroupIndexCleaner( PlexusSisuBridge plexusSisuBridge )
+ public TemporaryGroupIndexCleaner( NexusIndexer nexusIndexer )
throws PlexusSisuBridgeException
{
- indexer = plexusSisuBridge.lookup( NexusIndexer.class );
+ this.indexer = nexusIndexer;
}
// 900000
@@ -55,15 +55,19 @@ public class TemporaryGroupIndexCleaner
public void cleanTemporaryIndex()
{
- for ( TemporaryGroupIndex temporaryGroupIndex : indexMerger.getTemporaryGroupIndexes() )
- {
- // cleanup files older than the ttl
- if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > temporaryGroupIndex.getMergedIndexTtl() )
- {
- log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() );
- indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex );
+ indexMerger.getTemporaryGroupIndexes()
+ .stream()
+ .forEach( temporaryGroupIndex ->
+ {
+ // cleanup files older than the ttl
+ if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() >
+ temporaryGroupIndex.getMergedIndexTtl() )
+ {
+ log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() );
+ indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex );
- }
- }
+ }
+ }
+ );
}
}
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
index 848ca78c1..64db78594 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
@@ -25,15 +25,10 @@ import org.apache.archiva.admin.model.beans.ProxyConnector;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.archiva.indexer.util.SearchUtil;
import org.apache.commons.lang.StringUtils;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.search.BooleanClause;
-import org.apache.lucene.search.BooleanClause.Occur;
-import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.Query;
+
import org.apache.maven.index.ArtifactInfo;
import org.apache.maven.index.FlatSearchRequest;
import org.apache.maven.index.FlatSearchResponse;
@@ -48,6 +43,9 @@ import org.apache.maven.index.expr.SearchExpression;
import org.apache.maven.index.expr.SearchTyped;
import org.apache.maven.index.expr.SourcedSearchExpression;
import org.apache.maven.index.expr.UserInputSearchExpression;
+import org.apache.maven.index.shaded.lucene.search.BooleanClause;
+import org.apache.maven.index.shaded.lucene.search.BooleanClause.Occur;
+import org.apache.maven.index.shaded.lucene.search.BooleanQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -87,12 +85,13 @@ public class MavenRepositorySearch
}
@Inject
- public MavenRepositorySearch( PlexusSisuBridge plexusSisuBridge, ManagedRepositoryAdmin managedRepositoryAdmin,
- MavenIndexerUtils mavenIndexerUtils, ProxyConnectorAdmin proxyConnectorAdmin )
+ public MavenRepositorySearch( NexusIndexer nexusIndexer, ManagedRepositoryAdmin managedRepositoryAdmin,
+ MavenIndexerUtils mavenIndexerUtils, ProxyConnectorAdmin proxyConnectorAdmin,
+ QueryCreator queryCreator)
throws PlexusSisuBridgeException
{
- this.indexer = plexusSisuBridge.lookup( NexusIndexer.class );
- this.queryCreator = plexusSisuBridge.lookup( QueryCreator.class );
+ this.indexer = nexusIndexer;
+ this.queryCreator = queryCreator;
this.managedRepositoryAdmin = managedRepositoryAdmin;
this.mavenIndexerUtils = mavenIndexerUtils;
this.proxyConnectorAdmin = proxyConnectorAdmin;
@@ -124,12 +123,12 @@ public class MavenRepositorySearch
BooleanQuery iQuery = new BooleanQuery();
constructQuery( previousTerm, iQuery );
- q.add( iQuery, Occur.MUST );
+ q.add( iQuery, BooleanClause.Occur.MUST );
}
BooleanQuery iQuery = new BooleanQuery();
constructQuery( term, iQuery );
- q.add( iQuery, Occur.MUST );
+ q.add( iQuery, BooleanClause.Occur.MUST );
}
// we retun only artifacts without classifier in quick search, olamy cannot find a way to say with this field empty
@@ -166,7 +165,7 @@ public class MavenRepositorySearch
q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch()
? new SourcedSearchExpression( searchFields.getGroupId() )
: new UserInputSearchExpression( searchFields.getGroupId() )
- ), Occur.MUST
+ ), BooleanClause.Occur.MUST
);
}
@@ -176,35 +175,35 @@ public class MavenRepositorySearch
searchFields.isExactSearch()
? new SourcedSearchExpression( searchFields.getArtifactId() )
: new UserInputSearchExpression( searchFields.getArtifactId() )
- ), Occur.MUST
+ ), BooleanClause.Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getVersion() ) )
{
q.add( indexer.constructQuery( MAVEN.VERSION, searchFields.isExactSearch() ? new SourcedSearchExpression(
- searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ), Occur.MUST );
+ searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ), BooleanClause.Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getPackaging() ) )
{
q.add( indexer.constructQuery( MAVEN.PACKAGING, searchFields.isExactSearch() ? new SourcedSearchExpression(
searchFields.getPackaging() ) : new UserInputSearchExpression( searchFields.getPackaging() ) ),
- Occur.MUST
+ BooleanClause.Occur.MUST
);
}
if ( StringUtils.isNotBlank( searchFields.getClassName() ) )
{
q.add( indexer.constructQuery( MAVEN.CLASSNAMES,
- new UserInputSearchExpression( searchFields.getClassName() ) ), Occur.MUST );
+ new UserInputSearchExpression( searchFields.getClassName() ) ), BooleanClause.Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getBundleSymbolicName() ) )
{
q.add( indexer.constructQuery( OSGI.SYMBOLIC_NAME,
new UserInputSearchExpression( searchFields.getBundleSymbolicName() ) ),
- Occur.MUST
+ BooleanClause.Occur.MUST
);
}
@@ -212,7 +211,7 @@ public class MavenRepositorySearch
{
q.add( indexer.constructQuery( OSGI.VERSION,
new UserInputSearchExpression( searchFields.getBundleVersion() ) ),
- Occur.MUST
+ BooleanClause.Occur.MUST
);
}
@@ -494,12 +493,14 @@ public class MavenRepositorySearch
for ( ArtifactInfo artifactInfo : artifactInfos )
{
- if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.fextension ) && !includePoms )
+ if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.getFileExtension() ) && !includePoms )
{
continue;
}
- String id = SearchUtil.getHitId( artifactInfo.groupId, artifactInfo.artifactId, artifactInfo.classifier,
- artifactInfo.packaging );
+ String id = SearchUtil.getHitId( artifactInfo.getGroupId(), //
+ artifactInfo.getArtifactId(), //
+ artifactInfo.getClassifier(), //
+ artifactInfo.getPackaging() );
Map<String, SearchResultHit> hitsMap = results.getHitsMap();
if ( !applyArtifactInfoFilters( artifactInfo, artifactInfoFilters, hitsMap ) )
@@ -510,34 +511,34 @@ public class MavenRepositorySearch
SearchResultHit hit = hitsMap.get( id );
if ( hit != null )
{
- if ( !hit.getVersions().contains( artifactInfo.version ) )
+ if ( !hit.getVersions().contains( artifactInfo.getVersion() ) )
{
- hit.addVersion( artifactInfo.version );
+ hit.addVersion( artifactInfo.getVersion() );
}
}
else
{
hit = new SearchResultHit();
- hit.setArtifactId( artifactInfo.artifactId );
- hit.setGroupId( artifactInfo.groupId );
- hit.setRepositoryId( artifactInfo.repository );
- hit.addVersion( artifactInfo.version );
- hit.setBundleExportPackage( artifactInfo.bundleExportPackage );
- hit.setBundleExportService( artifactInfo.bundleExportService );
- hit.setBundleSymbolicName( artifactInfo.bundleSymbolicName );
- hit.setBundleVersion( artifactInfo.bundleVersion );
- hit.setBundleDescription( artifactInfo.bundleDescription );
- hit.setBundleDocUrl( artifactInfo.bundleDocUrl );
- hit.setBundleRequireBundle( artifactInfo.bundleRequireBundle );
- hit.setBundleImportPackage( artifactInfo.bundleImportPackage );
- hit.setBundleLicense( artifactInfo.bundleLicense );
- hit.setBundleName( artifactInfo.bundleName );
- hit.setContext( artifactInfo.context );
- hit.setGoals( artifactInfo.goals );
- hit.setPrefix( artifactInfo.prefix );
- hit.setPackaging( artifactInfo.packaging );
- hit.setClassifier( artifactInfo.classifier );
- hit.setFileExtension( artifactInfo.fextension );
+ hit.setArtifactId( artifactInfo.getArtifactId() );
+ hit.setGroupId( artifactInfo.getGroupId() );
+ hit.setRepositoryId( artifactInfo.getRepository() );
+ hit.addVersion( artifactInfo.getVersion() );
+ hit.setBundleExportPackage( artifactInfo.getBundleExportPackage() );
+ hit.setBundleExportService( artifactInfo.getBundleExportService() );
+ hit.setBundleSymbolicName( artifactInfo.getBundleSymbolicName() );
+ hit.setBundleVersion( artifactInfo.getBundleVersion() );
+ hit.setBundleDescription( artifactInfo.getBundleDescription() );
+ hit.setBundleDocUrl( artifactInfo.getBundleDocUrl() );
+ hit.setBundleRequireBundle( artifactInfo.getBundleRequireBundle() );
+ hit.setBundleImportPackage( artifactInfo.getBundleImportPackage() );
+ hit.setBundleLicense( artifactInfo.getBundleLicense() );
+ hit.setBundleName( artifactInfo.getBundleName() );
+ hit.setContext( artifactInfo.getContext() );
+ hit.setGoals( artifactInfo.getGoals() );
+ hit.setPrefix( artifactInfo.getPrefix() );
+ hit.setPackaging( artifactInfo.getPackaging() );
+ hit.setClassifier( artifactInfo.getClassifier() );
+ hit.setFileExtension( artifactInfo.getFileExtension() );
hit.setUrl( getBaseUrl( artifactInfo, selectedRepos ) );
}
@@ -569,40 +570,40 @@ public class MavenRepositorySearch
throws RepositoryAdminException
{
StringBuilder sb = new StringBuilder();
- if ( StringUtils.startsWith( artifactInfo.context, "remote-" ) )
+ if ( StringUtils.startsWith( artifactInfo.getContext(), "remote-" ) )
{
// it's a remote index result we search a managed which proxying this remote and on which
// current user has read karma
String managedRepoId =
- getManagedRepoId( StringUtils.substringAfter( artifactInfo.context, "remote-" ), selectedRepos );
+ getManagedRepoId( StringUtils.substringAfter( artifactInfo.getContext(), "remote-" ), selectedRepos );
if ( managedRepoId != null )
{
sb.append( '/' ).append( managedRepoId );
- artifactInfo.context = managedRepoId;
+ artifactInfo.setContext( managedRepoId );
}
}
else
{
- sb.append( '/' ).append( artifactInfo.context );
+ sb.append( '/' ).append( artifactInfo.getContext() );
}
- sb.append( '/' ).append( StringUtils.replaceChars( artifactInfo.groupId, '.', '/' ) );
- sb.append( '/' ).append( artifactInfo.artifactId );
- sb.append( '/' ).append( artifactInfo.version );
- sb.append( '/' ).append( artifactInfo.artifactId );
- sb.append( '-' ).append( artifactInfo.version );
- if ( StringUtils.isNotBlank( artifactInfo.classifier ) )
+ sb.append( '/' ).append( StringUtils.replaceChars( artifactInfo.getGroupId(), '.', '/' ) );
+ sb.append( '/' ).append( artifactInfo.getArtifactId() );
+ sb.append( '/' ).append( artifactInfo.getVersion() );
+ sb.append( '/' ).append( artifactInfo.getArtifactId() );
+ sb.append( '-' ).append( artifactInfo.getVersion() );
+ if ( StringUtils.isNotBlank( artifactInfo.getClassifier() ) )
{
- sb.append( '-' ).append( artifactInfo.classifier );
+ sb.append( '-' ).append( artifactInfo.getClassifier() );
}
// maven-plugin packaging is a jar
- if ( StringUtils.equals( "maven-plugin", artifactInfo.packaging ) )
+ if ( StringUtils.equals( "maven-plugin", artifactInfo.getPackaging() ) )
{
sb.append( "jar" );
}
else
{
- sb.append( '.' ).append( artifactInfo.packaging );
+ sb.append( '.' ).append( artifactInfo.getPackaging() );
}
return sb.toString();
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java
index 6068aa720..49feb2d81 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java
@@ -38,6 +38,6 @@ public class NoClassifierArtifactInfoFilter
@Override
public boolean addArtifactInResult( ArtifactInfo artifact, Map<String, SearchResultHit> currentResult )
{
- return StringUtils.isBlank( artifact.classifier );
+ return StringUtils.isBlank( artifact.getClassifier() );
}
}
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
index 461a4d76b..58fdf68d5 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
@@ -35,6 +35,7 @@ import org.apache.maven.index.ArtifactContext;
import org.apache.maven.index.ArtifactContextProducer;
import org.apache.maven.index.ArtifactScanningListener;
import org.apache.maven.index.NexusIndexer;
+import org.apache.maven.index.QueryCreator;
import org.apache.maven.index.ScanningResult;
import org.apache.maven.index.context.IndexingContext;
import org.easymock.EasyMock;
@@ -72,6 +73,7 @@ public abstract class AbstractMavenRepositorySearch
ArchivaConfiguration archivaConfig;
+ @Inject
ArtifactContextProducer artifactContextProducer;
IMocksControl archivaConfigControl;
@@ -84,8 +86,12 @@ public abstract class AbstractMavenRepositorySearch
@Inject
MavenIndexerUtils mavenIndexerUtils;
+ @Inject
NexusIndexer nexusIndexer;
+ @Inject
+ QueryCreator queryCreator;
+
@Before
@Override
public void setUp()
@@ -109,12 +115,8 @@ public abstract class AbstractMavenRepositorySearch
DefaultProxyConnectorAdmin defaultProxyConnectorAdmin = new DefaultProxyConnectorAdmin();
defaultProxyConnectorAdmin.setArchivaConfiguration( archivaConfig );
- search = new MavenRepositorySearch( plexusSisuBridge, defaultManagedRepositoryAdmin, mavenIndexerUtils,
- defaultProxyConnectorAdmin );
-
- nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
-
- artifactContextProducer = plexusSisuBridge.lookup( ArtifactContextProducer.class );
+ search = new MavenRepositorySearch( nexusIndexer, defaultManagedRepositoryAdmin, mavenIndexerUtils,
+ defaultProxyConnectorAdmin, queryCreator );
defaultManagedRepositoryAdmin.setMavenIndexerUtils( mavenIndexerUtils );
defaultManagedRepositoryAdmin.setIndexer( nexusIndexer );
@@ -205,8 +207,8 @@ public abstract class AbstractMavenRepositorySearch
search.getAllIndexCreators() );
// minimize datas in memory
- context.getIndexWriter().setMaxBufferedDocs( -1 );
- context.getIndexWriter().setRAMBufferSizeMB( 1 );
+// context.getIndexWriter().setMaxBufferedDocs( -1 );
+// context.getIndexWriter().setRAMBufferSizeMB( 1 );
for ( File artifactFile : filesToBeIndexed )
{
assertTrue( "file not exists " + artifactFile.getPath(), artifactFile.exists() );
@@ -214,9 +216,9 @@ public abstract class AbstractMavenRepositorySearch
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" );
}
nexusIndexer.addArtifactToIndex( ac, context );
context.updateTimestamp( true );
diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml
index d8b477e3f..3e85ac5a5 100644
--- a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml
+++ b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml
@@ -58,16 +58,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>org.codehaus.plexus</groupId>
diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java
index dc94ad5fe..7f86da4ff 100644
--- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java
+++ b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java
@@ -22,10 +22,15 @@ package org.apache.archiva.common.plexusbridge;
import org.apache.maven.index.context.IndexCreator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
+import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* @author Olivier Lamy
@@ -37,11 +42,21 @@ public class MavenIndexerUtils
private Logger log = LoggerFactory.getLogger( getClass() );
- @Inject
private List<? extends IndexCreator> allIndexCreators;
- public MavenIndexerUtils()
+ private ApplicationContext applicationContext;
+
+ @Inject
+ public MavenIndexerUtils(ApplicationContext applicationContext, Map<String, IndexCreator> indexers)
{
+ this.applicationContext = applicationContext;
+ }
+
+ @PostConstruct
+ public void initialize()
+ {
+ allIndexCreators = new ArrayList<>( applicationContext.getBeansOfType( IndexCreator.class ).values());
+
if ( allIndexCreators == null || allIndexCreators.isEmpty() )
{
throw new RuntimeException( "cannot initiliaze IndexCreators" );
diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml
index cd6acffd9..9c12ec813 100644
--- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml
@@ -21,12 +21,43 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
- default-lazy-init="true">
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd"
+ default-lazy-init="true">
<context:annotation-config/>
- <context:component-scan base-package="org.apache.archiva.common.plexusbridge,org.apache.maven.index"/>
+ <context:component-scan base-package="org.apache.archiva.common.plexusbridge
+ org.apache.maven.index"/>
+
+ <!--
+ <bean id="indexer" class="org.apache.maven.index.DefaultIndexer"/>
+ <bean id="scanner" class="org.apache.maven.index.DefaultScanner"/>
+ <bean id="indexerEngine" class="org.apache.maven.index.DefaultIndexerEngine"/>
+ <bean id="searchEngine" class="org.apache.maven.index.DefaultSearchEngine"/>
+ <bean id="queryCreator" class="org.apache.maven.index.DefaultQueryCreator"/>
+ <bean id="artifactContextProducer" class="org.apache.maven.index.DefaultArtifactContextProducer"/>
+ <bean id="artifactPackagingMapper" class="org.apache.maven.index.artifact.DefaultArtifactPackagingMapper"/>
+ -->
+
+ <!-- Index creators:
+ <bean id="minimalArtifactInfoIndexCreator" class="org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator"/>
+ <bean id="jarFileContentsIndexCreator" class="org.apache.maven.index.creator.JarFileContentsIndexCreator"/>
+ <bean id="mavenPluginArtifactInfoIndexCreator" class="org.apache.maven.index.creator.MavenPluginArtifactInfoIndexCreator"/>
+ -->
+ <!-- Index creators.
+
+ <util:map id="indexers"
+ key-type="java.lang.String"
+ value-type="org.apache.maven.index.context.IndexCreator"
+ map-class="java.util.LinkedHashMap">
+ <entry key="min" value-ref="minimalArtifactInfoIndexCreator"/>
+ <entry key="jarContent" value-ref="jarFileContentsIndexCreator"/>
+ <entry key="maven-plugin" value-ref="mavenPluginArtifactInfoIndexCreator"/>
+ </util:map>
+ -->
</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml
index 217a33d3b..7374f3685 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml
@@ -22,9 +22,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ http://www.springframework.org/schema/context/spring-context.xsd"
default-lazy-init="true">
<context:annotation-config/>
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml
index c19b3e867..7afd4a422 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml
@@ -20,11 +20,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ http://www.springframework.org/schema/beans/spring-beans.xsd"
default-lazy-init="true">
<bean name="wagon#file" scope="prototype" class="org.apache.maven.wagon.providers.file.FileWagon"/>
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
index 08226d2e8..4d0a9a810 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
@@ -120,7 +120,7 @@ public abstract class AbstractProxyTestCase
protected ManagedRepositoryAdmin managedRepositoryAdmin;
@Inject
- protected PlexusSisuBridge plexusSisuBridge;
+ protected NexusIndexer nexusIndexer;
@Before
public void setUp()
@@ -198,7 +198,6 @@ public abstract class AbstractProxyTestCase
protected void removeMavenIndexes()
throws Exception
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml
index d1ca7d768..b7e8ad21a 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml
@@ -44,6 +44,7 @@
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
index 44a2d7beb..23494f02f 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
@@ -40,6 +40,7 @@
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
+ <classifier>shaded-lucene</classifier>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
index 7d235758d..ad90b4e82 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
@@ -96,9 +96,6 @@ public class DefaultManagedRepositoryAdmin
private RepositoryStatisticsManager repositoryStatisticsManager;
@Inject
- private PlexusSisuBridge plexusSisuBridge;
-
- @Inject
private MavenIndexerUtils mavenIndexerUtils;
@Inject
@@ -369,20 +366,14 @@ public class DefaultManagedRepositoryAdmin
try
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
-
- IndexingContext context = nexusIndexer.getIndexingContexts().get( repository.getId() );
+ IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
if ( context != null )
{
// delete content only if directory exists
- nexusIndexer.removeIndexingContext( context,
+ indexer.removeIndexingContext( context,
deleteContent && context.getIndexDirectoryFile().exists() );
}
}
- catch ( PlexusSisuBridgeException e )
- {
- throw new RepositoryAdminException( e.getMessage(), e );
- }
catch ( IOException e )
{
throw new RepositoryAdminException( e.getMessage(), e );
@@ -826,16 +817,6 @@ public class DefaultManagedRepositoryAdmin
this.repositoryTaskScheduler = repositoryTaskScheduler;
}
- public PlexusSisuBridge getPlexusSisuBridge()
- {
- return plexusSisuBridge;
- }
-
- public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge )
- {
- this.plexusSisuBridge = plexusSisuBridge;
- }
-
public MavenIndexerUtils getMavenIndexerUtils()
{
return mavenIndexerUtils;
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml
index aa4743ccc..15d377058 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml
@@ -22,14 +22,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
-
+ http://www.springframework.org/schema/context/spring-context.xsd"
+ default-lazy-init="true">
<context:annotation-config />
- <context:component-scan
- base-package="org.apache.archiva.admin.repository"/>
+ <context:component-scan base-package="org.apache.archiva.admin.repository"/>
<alias name="redbackRuntimeConfigurationAdmin#default" alias="userConfiguration#archiva"/>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml
index 2901cbb46..84adf6d01 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml
@@ -20,11 +20,14 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/tx
+ http://www.springframework.org/schema/tx/spring-tx.xsd"
default-lazy-init="true">
<context:annotation-config/>