]> source.dussan.org Git - archiva.git/commitdiff
some cleanup
authorBrett Porter <brett@apache.org>
Mon, 9 Jan 2006 02:22:14 +0000 (02:22 +0000)
committerBrett Porter <brett@apache.org>
Mon, 9 Jan 2006 02:22:14 +0000 (02:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@367162 13f79535-47bb-0310-9956-ffa450edef68

maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexSearcher.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java
maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java

index e5f5ca386bcae856f23658a6f69d01846577c366..37a882b05cc555077364627dac9b9735155767fc 100644 (file)
@@ -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
      *
index 9b164a0f7176516b42a868039c23b687f809c20d..5f8e8405ea3da4ffe0a037419e083cfeb43d473d 100644 (file)
@@ -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 )
index 1d085b523196dc559f63ebcd178331fc9b34af78..45bdada92427d0915528d9703100d3661705d544 100644 (file)
@@ -35,5 +35,5 @@ public interface RepositoryIndexingFactory
     PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository )
         throws RepositoryIndexException;
 
-    public PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index );
+    PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index );
 }
index 4ecc9c416ff087012c1b8c921c8adae0be71f3fa..e3aaefa59eff2fb67b166206a314ab8582a3b693 100644 (file)
@@ -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