From: Brett Porter Date: Mon, 9 Jan 2006 02:22:14 +0000 (+0000) Subject: some cleanup X-Git-Tag: archiva-0.9-alpha-1~997 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5dc3b36312252aad7567197fee0e25297c371e03;p=archiva.git some cleanup git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@367162 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexSearcher.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexSearcher.java index e5f5ca386..37a882b05 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexSearcher.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexSearcher.java @@ -17,7 +17,6 @@ package org.apache.maven.repository.indexing; */ import org.apache.lucene.document.Document; -import org.apache.lucene.search.BooleanQuery; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -34,12 +33,6 @@ public class ArtifactRepositoryIndexSearcher { private ArtifactFactory factory; - private BooleanQuery bQry; - - private BooleanQuery mainQry; - - private boolean isRequired = true; - /** * Constructor * diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java index 9b164a0f7..5f8e8405e 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java @@ -35,6 +35,7 @@ import org.codehaus.plexus.util.StringUtils; import java.io.File; import java.io.IOException; import java.security.NoSuchAlgorithmException; +import java.util.Arrays; import java.util.Iterator; import java.util.List; @@ -75,6 +76,9 @@ public class PomRepositoryIndex private ArtifactFactory artifactFactory; + private static final List KEYWORD_FIELDS = Arrays.asList( + new String[]{FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} ); + public PomRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester, ArtifactFactory artifactFactory ) throws RepositoryIndexException @@ -172,34 +176,7 @@ public class PomRepositoryIndex public boolean isKeywordField( String field ) { - boolean keyword; - - if ( field.equals( PomRepositoryIndex.FLD_LICENSE_URLS ) ) - { - keyword = true; - } - else if ( field.equals( PomRepositoryIndex.FLD_DEPENDENCIES ) ) - { - keyword = true; - } - else if ( field.equals( PomRepositoryIndex.FLD_PLUGINS_BUILD ) ) - { - keyword = true; - } - else if ( field.equals( PomRepositoryIndex.FLD_PLUGINS_REPORT ) ) - { - keyword = true; - } - else if ( field.equals( PomRepositoryIndex.FLD_PLUGINS_ALL ) ) - { - keyword = true; - } - else - { - keyword = false; - } - - return keyword; + return KEYWORD_FIELDS.contains( field ); } private void indexLicenseUrls( Document doc, Model pom ) diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java index 1d085b523..45bdada92 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java @@ -35,5 +35,5 @@ public interface RepositoryIndexingFactory PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository ) throws RepositoryIndexException; - public PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index ); + PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index ); } diff --git a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java index 4ecc9c416..e3aaefa59 100644 --- a/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java +++ b/maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java @@ -84,7 +84,6 @@ public class ArtifactRepositoryIndexingTest public void testIndexerExceptions() throws Exception { - ArtifactRepositoryIndex indexer; RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE ); try @@ -112,7 +111,7 @@ public class ArtifactRepositoryIndexingTest Artifact artifact = getArtifact( "test", "test-artifactId", "1.0" ); artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) ); - indexer = factory.createArtifactRepositoryIndex( indexPath, repository ); + ArtifactRepositoryIndex indexer = factory.createArtifactRepositoryIndex( indexPath, repository ); indexer.close(); try