Added javadocs

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@367470 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Edwin L. Punzalan 2006-01-10 03:12:17 +00:00
parent 6707098809
commit ec0735c119
19 changed files with 321 additions and 20 deletions

View File

@ -40,6 +40,14 @@ public abstract class AbstractRepositoryIndex
protected ArtifactRepository repository; protected ArtifactRepository repository;
/**
* Class constructor
*
* @param indexPath
* @param repository
* @param indexFields
* @throws RepositoryIndexException
*/
protected AbstractRepositoryIndex( String indexPath, ArtifactRepository repository, String[] indexFields ) protected AbstractRepositoryIndex( String indexPath, ArtifactRepository repository, String[] indexFields )
throws RepositoryIndexException throws RepositoryIndexException
{ {
@ -57,7 +65,7 @@ public abstract class AbstractRepositoryIndex
} }
/** /**
* method to encapsulate the optimize() method for lucene * @see org.apache.maven.repository.indexing.RepositoryIndex#optimize()
*/ */
public void optimize() public void optimize()
throws RepositoryIndexException throws RepositoryIndexException
@ -78,9 +86,7 @@ public abstract class AbstractRepositoryIndex
} }
/** /**
* method used to query the index status * @see org.apache.maven.repository.indexing.RepositoryIndex#isOpen()
*
* @return true if the index is open.
*/ */
public boolean isOpen() public boolean isOpen()
{ {
@ -88,7 +94,7 @@ public abstract class AbstractRepositoryIndex
} }
/** /**
* method used to close all open streams to the index directory * @see org.apache.maven.repository.indexing.RepositoryIndex#close()
*/ */
public void close() public void close()
throws RepositoryIndexException throws RepositoryIndexException
@ -109,11 +115,20 @@ public abstract class AbstractRepositoryIndex
} }
} }
/**
* @see org.apache.maven.repository.indexing.RepositoryIndex#getIndexPath()
*/
public String getIndexPath() public String getIndexPath()
{ {
return indexPath; return indexPath;
} }
/**
* Method to retrieve the lucene IndexWriter used in creating/updating the index
*
* @return the lucene IndexWriter object used to update the index
* @throws IOException
*/
protected IndexWriter getIndexWriter() protected IndexWriter getIndexWriter()
throws IOException throws IOException
{ {
@ -173,6 +188,9 @@ public abstract class AbstractRepositoryIndex
indexOpen = true; indexOpen = true;
} }
/**
* @see org.apache.maven.repository.indexing.RepositoryIndex#getRepository()
*/
public ArtifactRepository getRepository() public ArtifactRepository getRepository()
{ {
return repository; return repository;

View File

@ -36,7 +36,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
* * Abstract Class to hold common codes for the different RepositoryIndexSearcher
*/ */
public abstract class AbstractRepositoryIndexSearcher public abstract class AbstractRepositoryIndexSearcher
extends AbstractLogEnabled extends AbstractLogEnabled
@ -55,12 +55,7 @@ public abstract class AbstractRepositoryIndexSearcher
} }
/** /**
* Search the artifact based on the search criteria specified in the query * @see RepositoryIndexSearcher#search(org.apache.maven.repository.indexing.query.Query)
* object. Returns a list of artifact objects
*
* @param query the query object that contains the search criteria
* @return List
* @throws RepositoryIndexSearchException
*/ */
public List search( Query query ) public List search( Query query )
throws RepositoryIndexSearchException throws RepositoryIndexSearchException
@ -111,6 +106,14 @@ public abstract class AbstractRepositoryIndexSearcher
return docs; return docs;
} }
/**
* Method to create a lucene Query object from a single query phrase
*
* @param field the index field name to search into
* @param value the index field value to match the field with
* @return a lucene Query object representing the query phrase field = value
* @throws ParseException
*/
private org.apache.lucene.search.Query createLuceneQuery( String field, String value ) private org.apache.lucene.search.Query createLuceneQuery( String field, String value )
throws ParseException throws ParseException
{ {
@ -128,6 +131,13 @@ public abstract class AbstractRepositoryIndexSearcher
return qry; return qry;
} }
/**
* Method to create a lucene Query object by converting a prepared Query object
*
* @param query the prepared Query object to be converted into a lucene Query object
* @return a lucene Query object to represent the passed Query object
* @throws ParseException
*/
private org.apache.lucene.search.Query createLuceneQuery( Query query ) private org.apache.lucene.search.Query createLuceneQuery( Query query )
throws ParseException throws ParseException
{ {

View File

@ -34,7 +34,7 @@ import java.util.zip.ZipFile;
/** /**
* Class used to index Artifact objects in a specified repository * Class used to index Artifact objects in a specific repository
* *
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */
@ -66,6 +66,14 @@ public class ArtifactRepositoryIndex
private Digester digester; private Digester digester;
/**
* Class constructor
*
* @param indexPath the path where the lucene index will be created/updated.
* @param repository the repository where the indexed artifacts are located
* @param digester the digester object to generate the checksum strings
* @throws RepositoryIndexException
*/
public ArtifactRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester ) public ArtifactRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester )
throws RepositoryIndexException throws RepositoryIndexException
{ {
@ -74,9 +82,7 @@ public class ArtifactRepositoryIndex
} }
/** /**
* method to get the Analyzer used to create indices * @see org.apache.maven.repository.indexing.RepositoryIndex#getAnalyzer()
*
* @return the Analyzer object used to create the artifact indices
*/ */
public Analyzer getAnalyzer() public Analyzer getAnalyzer()
{ {
@ -89,9 +95,10 @@ public class ArtifactRepositoryIndex
} }
/** /**
* method to index a given artifact * Method to index a given artifact
* *
* @param artifact the Artifact object to be indexed * @param artifact the Artifact object to be indexed
* @throws RepositoryIndexException
*/ */
public void indexArtifact( Artifact artifact ) public void indexArtifact( Artifact artifact )
throws RepositoryIndexException throws RepositoryIndexException
@ -174,11 +181,21 @@ public class ArtifactRepositoryIndex
} }
} }
/**
* @see RepositoryIndex#isKeywordField(String)
*/
public boolean isKeywordField( String field ) public boolean isKeywordField( String field )
{ {
return false; return false;
} }
/**
* Method to test a zip entry if it is a java class, and adds it to the classes buffer
*
* @param entry the zip entry to test for java class
* @param classes the String buffer to add the java class if the test result as true
* @return true if the zip entry is a java class and was successfully added to the buffer
*/
private boolean addIfClassEntry( ZipEntry entry, StringBuffer classes ) private boolean addIfClassEntry( ZipEntry entry, StringBuffer classes )
{ {
boolean isAdded = false; boolean isAdded = false;
@ -203,6 +220,13 @@ public class ArtifactRepositoryIndex
return isAdded; return isAdded;
} }
/**
* Method to add a class package to the buffer of packages
*
* @param name the complete path name of the class
* @param packages the packages buffer
* @return true if the package is successfully added
*/
private boolean addClassPackage( String name, StringBuffer packages ) private boolean addClassPackage( String name, StringBuffer packages )
{ {
boolean isAdded = false; boolean isAdded = false;
@ -221,6 +245,13 @@ public class ArtifactRepositoryIndex
return isAdded; return isAdded;
} }
/**
* Method to add the zip entry as a file list
*
* @param entry the zip entry to be added
* @param files the buffer of files to update
* @return true if the file was successfully added
*/
private boolean addFile( ZipEntry entry, StringBuffer files ) private boolean addFile( ZipEntry entry, StringBuffer files )
{ {
String name = entry.getName(); String name = entry.getName();

View File

@ -26,7 +26,6 @@ import java.io.File;
* This class searches the index for existing artifacts that contains the * This class searches the index for existing artifacts that contains the
* specified query string. * specified query string.
* *
* @author Maria Odea Ching
*/ */
public class ArtifactRepositoryIndexSearcher public class ArtifactRepositoryIndexSearcher
extends AbstractRepositoryIndexSearcher extends AbstractRepositoryIndexSearcher
@ -45,6 +44,9 @@ public class ArtifactRepositoryIndexSearcher
this.factory = factory; this.factory = factory;
} }
/**
* @see AbstractRepositoryIndexSearcher#createSearchedObjectFromIndexDocument(org.apache.lucene.document.Document)
*/
protected Object createSearchedObjectFromIndexDocument( Document doc ) protected Object createSearchedObjectFromIndexDocument( Document doc )
{ {
String groupId = doc.get( ArtifactRepositoryIndex.FLD_GROUPID ); String groupId = doc.get( ArtifactRepositoryIndex.FLD_GROUPID );

View File

@ -38,23 +38,35 @@ public class DefaultRepositoryIndexingFactory
*/ */
private ArtifactFactory artifactFactory; private ArtifactFactory artifactFactory;
/**
* @see RepositoryIndexingFactory#createArtifactRepositoryIndexSearcher(ArtifactRepositoryIndex)
*/
public ArtifactRepositoryIndexSearcher createArtifactRepositoryIndexSearcher( ArtifactRepositoryIndex index ) public ArtifactRepositoryIndexSearcher createArtifactRepositoryIndexSearcher( ArtifactRepositoryIndex index )
{ {
return new ArtifactRepositoryIndexSearcher( index, artifactFactory ); return new ArtifactRepositoryIndexSearcher( index, artifactFactory );
} }
/**
* @see RepositoryIndexingFactory#createArtifactRepositoryIndex(String, org.apache.maven.artifact.repository.ArtifactRepository)
*/
public ArtifactRepositoryIndex createArtifactRepositoryIndex( String indexPath, ArtifactRepository repository ) public ArtifactRepositoryIndex createArtifactRepositoryIndex( String indexPath, ArtifactRepository repository )
throws RepositoryIndexException throws RepositoryIndexException
{ {
return new ArtifactRepositoryIndex( indexPath, repository, digester ); return new ArtifactRepositoryIndex( indexPath, repository, digester );
} }
/**
* @see RepositoryIndexingFactory#createPomRepositoryIndex(String, org.apache.maven.artifact.repository.ArtifactRepository)
*/
public PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository ) public PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository )
throws RepositoryIndexException throws RepositoryIndexException
{ {
return new PomRepositoryIndex( indexPath, repository, digester, artifactFactory ); return new PomRepositoryIndex( indexPath, repository, digester, artifactFactory );
} }
/**
* @see RepositoryIndexingFactory#createPomRepositoryIndexSearcher(PomRepositoryIndex)
*/
public PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index ) public PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index )
{ {
return new PomRepositoryIndexSearcher( index, artifactFactory ); return new PomRepositoryIndexSearcher( index, artifactFactory );

View File

@ -40,6 +40,8 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
* Class to create index entries for a given pom in a repository
*
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */
public class PomRepositoryIndex public class PomRepositoryIndex
@ -79,6 +81,15 @@ public class PomRepositoryIndex
private static final List KEYWORD_FIELDS = Arrays.asList( private static final List KEYWORD_FIELDS = Arrays.asList(
new String[]{FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} ); new String[]{FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} );
/**
* Class Constructor
*
* @param indexPath the path where the index is available or will be made available
* @param repository the repository where objects indexed by this class resides
* @param digester the digester to be used for generating checksums
* @param artifactFactory the factory for building artifact objects
* @throws RepositoryIndexException
*/
public PomRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester, public PomRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester,
ArtifactFactory artifactFactory ) ArtifactFactory artifactFactory )
throws RepositoryIndexException throws RepositoryIndexException
@ -88,6 +99,9 @@ public class PomRepositoryIndex
this.artifactFactory = artifactFactory; this.artifactFactory = artifactFactory;
} }
/**
* @see org.apache.maven.repository.indexing.RepositoryIndex#getAnalyzer()
*/
public Analyzer getAnalyzer() public Analyzer getAnalyzer()
{ {
if ( analyzer == null ) if ( analyzer == null )
@ -98,6 +112,12 @@ public class PomRepositoryIndex
return analyzer; return analyzer;
} }
/**
* Method to create the index fields for a Model object into the index
*
* @param pom the Model object to be indexed
* @throws RepositoryIndexException
*/
public void indexPom( Model pom ) public void indexPom( Model pom )
throws RepositoryIndexException throws RepositoryIndexException
{ {
@ -160,11 +180,20 @@ public class PomRepositoryIndex
} }
} }
/**
* @see RepositoryIndex#isKeywordField(String)
*/
public boolean isKeywordField( String field ) public boolean isKeywordField( String field )
{ {
return KEYWORD_FIELDS.contains( field ); return KEYWORD_FIELDS.contains( field );
} }
/**
* Method to index license urls found inside the passed pom
*
* @param doc the index object to create the fields for the license urls
* @param pom the Model object to be indexed
*/
private void indexLicenseUrls( Document doc, Model pom ) private void indexLicenseUrls( Document doc, Model pom )
{ {
List licenseList = pom.getLicenses(); List licenseList = pom.getLicenses();
@ -187,6 +216,12 @@ public class PomRepositoryIndex
} }
} }
/**
* Method to index declared dependencies found inside the passed pom
*
* @param doc the index object to create the fields for the dependencies
* @param pom the Model object to be indexed
*/
private void indexDependencies( Document doc, Model pom ) private void indexDependencies( Document doc, Model pom )
{ {
List dependencyList = pom.getDependencies(); List dependencyList = pom.getDependencies();
@ -206,6 +241,13 @@ public class PomRepositoryIndex
} }
} }
/**
* Method to index plugins to a specified index field
*
* @param doc the index object to create the fields for the plugins
* @param field the index field to store the passed plugin
* @param plugins the iterator to the list of plugins to be indexed
*/
private void indexPlugins( Document doc, String field, Iterator plugins ) private void indexPlugins( Document doc, String field, Iterator plugins )
{ {
while ( plugins.hasNext() ) while ( plugins.hasNext() )
@ -216,6 +258,13 @@ public class PomRepositoryIndex
} }
} }
/**
* Method to index report plugins to a specified index field
*
* @param doc the index object to create the fields for the report plugins
* @param field the index field to store the passed report plugin
* @param plugins the iterator to the list of report plugins to be indexed
*/
private void indexReportPlugins( Document doc, String field, Iterator plugins ) private void indexReportPlugins( Document doc, String field, Iterator plugins )
{ {
while ( plugins.hasNext() ) while ( plugins.hasNext() )
@ -226,6 +275,14 @@ public class PomRepositoryIndex
} }
} }
/**
* Method to generate the computed checksum of an existing file using the specified algorithm.
*
* @param algorithm the algorithm to be used to generate the checksum
* @param file the file to match the generated checksum
* @return a string representing the checksum
* @throws RepositoryIndexException
*/
private String getChecksum( String algorithm, String file ) private String getChecksum( String algorithm, String file )
throws RepositoryIndexException throws RepositoryIndexException
{ {
@ -243,6 +300,14 @@ public class PomRepositoryIndex
} }
} }
/**
* Method to create the unique artifact id to represent the artifact in the repository
*
* @param groupId the artifact groupId
* @param artifactId the artifact artifactId
* @param version the artifact version
* @return the String id to uniquely represent the artifact
*/
private String getId( String groupId, String artifactId, String version ) private String getId( String groupId, String artifactId, String version )
{ {
return groupId + ":" + artifactId + ":" + version; return groupId + ":" + artifactId + ":" + version;

View File

@ -20,6 +20,8 @@ import org.apache.lucene.document.Document;
import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.factory.ArtifactFactory;
/** /**
* The PomRepositoryIndexSearcher is used to search for artifacts in the index created by a PomRepositoryIndex class.
*
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */
public class PomRepositoryIndexSearcher public class PomRepositoryIndexSearcher
@ -27,12 +29,20 @@ public class PomRepositoryIndexSearcher
{ {
private ArtifactFactory factory; private ArtifactFactory factory;
/**
*
* @param index the PomRepositoryIndex
* @param artifactFactory
*/
public PomRepositoryIndexSearcher( RepositoryIndex index, ArtifactFactory artifactFactory ) public PomRepositoryIndexSearcher( RepositoryIndex index, ArtifactFactory artifactFactory )
{ {
super( index ); super( index );
this.factory = artifactFactory; this.factory = artifactFactory;
} }
/**
* @see AbstractRepositoryIndexSearcher#createSearchedObjectFromIndexDocument(org.apache.lucene.document.Document)
*/
protected Object createSearchedObjectFromIndexDocument( Document doc ) protected Object createSearchedObjectFromIndexDocument( Document doc )
{ {
String groupId = doc.get( PomRepositoryIndex.FLD_GROUPID ); String groupId = doc.get( PomRepositoryIndex.FLD_GROUPID );

View File

@ -24,19 +24,46 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
*/ */
public interface RepositoryIndex public interface RepositoryIndex
{ {
/**
* Method used to query the index status
*
* @return true if the index is open.
*/
boolean isOpen(); boolean isOpen();
/**
* Method to close open streams to the index directory
*/
void close() void close()
throws RepositoryIndexException; throws RepositoryIndexException;
ArtifactRepository getRepository(); ArtifactRepository getRepository();
/**
* Method to encapsulate the optimize() method for lucene
*/
void optimize() void optimize()
throws RepositoryIndexException; throws RepositoryIndexException;
/**
* Method to retrieve the lucene analyzer object used in creating the document fields for this index
*
* @return lucene Analyzer object used in creating the index fields
*/
Analyzer getAnalyzer(); Analyzer getAnalyzer();
/**
* Method to retrieve the path where the index is made available
*
* @return the path where the index resides
*/
String getIndexPath(); String getIndexPath();
/**
* Tests an index field if it is a keyword field
*
* @param field the name of the index field to test
* @return true if the index field passed is a keyword, otherwise its false
*/
boolean isKeywordField( String field ); boolean isKeywordField( String field );
} }

View File

@ -21,7 +21,7 @@ import org.apache.maven.repository.indexing.query.Query;
import java.util.List; import java.util.List;
/** /**
* @author Maria Odea Ching *
*/ */
public interface RepositoryIndexSearcher public interface RepositoryIndexSearcher
{ {

View File

@ -27,13 +27,41 @@ public interface RepositoryIndexingFactory
{ {
String ROLE = RepositoryIndexingFactory.class.getName(); String ROLE = RepositoryIndexingFactory.class.getName();
/**
* Method to create an instance of the ArtifactRepositoryIndexSearcher
*
* @param index the ArtifactRepositoryIndex instance that the returned searcher will be searching into
* @return the ArtifactRepositoryIndexSearcher instance
*/
ArtifactRepositoryIndexSearcher createArtifactRepositoryIndexSearcher( ArtifactRepositoryIndex index ); ArtifactRepositoryIndexSearcher createArtifactRepositoryIndexSearcher( ArtifactRepositoryIndex index );
/**
* Method to create an instance of the ArtifactRepositoryIndex
*
* @param indexPath the path where the index will be created/updated
* @param repository the repository where the indexed artifacts are located
* @return the ArtifactRepositoryIndex instance
* @throws RepositoryIndexException
*/
ArtifactRepositoryIndex createArtifactRepositoryIndex( String indexPath, ArtifactRepository repository ) ArtifactRepositoryIndex createArtifactRepositoryIndex( String indexPath, ArtifactRepository repository )
throws RepositoryIndexException; throws RepositoryIndexException;
/**
* Method to create an instance of the PomRepositoryIndex
*
* @param indexPath the path where the index will be created/updated
* @param repository the repository where the indexed poms are located
* @return the PomRepositoryIndex instance
* @throws RepositoryIndexException
*/
PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository ) PomRepositoryIndex createPomRepositoryIndex( String indexPath, ArtifactRepository repository )
throws RepositoryIndexException; throws RepositoryIndexException;
/**
* Method to create an instance of the PomRepositoryIndexSearcher
*
* @param index the PomRepositoryIndex instance that the returned searcher will be searching into
* @return the PomRepositoryIndexSearcher instance
*/
PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index ); PomRepositoryIndexSearcher createPomRepositoryIndexSearcher( PomRepositoryIndex index );
} }

View File

@ -29,21 +29,35 @@ public abstract class AbstractCompoundQueryTerm
*/ */
private Query query; private Query query;
/**
* Class constructor
*
* @param query the query represented by this object
*/
protected AbstractCompoundQueryTerm( Query query ) protected AbstractCompoundQueryTerm( Query query )
{ {
this.query = query; this.query = query;
} }
/**
* @see CompoundQueryTerm#isRequired()
*/
public boolean isRequired() public boolean isRequired()
{ {
return false; return false;
} }
/**
* @see CompoundQueryTerm#isProhibited()
*/
public boolean isProhibited() public boolean isProhibited()
{ {
return false; return false;
} }
/**
* @see CompoundQueryTerm#getQuery()
*/
public Query getQuery() public Query getQuery()
{ {
return query; return query;

View File

@ -24,11 +24,19 @@ package org.apache.maven.repository.indexing.query;
public class AndQueryTerm public class AndQueryTerm
extends AbstractCompoundQueryTerm extends AbstractCompoundQueryTerm
{ {
/**
* Class constructor
*
* @param query the Query object represented by this object
*/
public AndQueryTerm( Query query ) public AndQueryTerm( Query query )
{ {
super( query ); super( query );
} }
/**
* @see AbstractCompoundQueryTerm#isRequired()
*/
public boolean isRequired() public boolean isRequired()
{ {
return true; return true;

View File

@ -20,6 +20,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Class to hold multiple SinglePhraseQueries and/or other CompoundQueries.
*
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */
public class CompoundQuery public class CompoundQuery
@ -27,26 +29,52 @@ public class CompoundQuery
{ {
protected List queries; protected List queries;
/**
* Class constructor
*/
public CompoundQuery() public CompoundQuery()
{ {
queries = new ArrayList(); queries = new ArrayList();
} }
/**
* Appends a required Query object to this Query object. The Query object will be encapsulated inside an
* AndQueryTerm object.
*
* @param query the Query object to be appended to this Query object
*/
public void and( Query query ) public void and( Query query )
{ {
queries.add( new AndQueryTerm( query ) ); queries.add( new AndQueryTerm( query ) );
} }
/**
* Appends an optional Query object to this Query object. The Query object will be encapsulated inside an
* OrQueryTerm object.
*
* @param query the Query object to be appended to this Query object
*/
public void or( Query query ) public void or( Query query )
{ {
queries.add( new OrQueryTerm( query ) ); queries.add( new OrQueryTerm( query ) );
} }
/**
* Appends a prohibited Query object to this Query object. The Query object will be encapsulated inside an
* NotQueryTerm object.
*
* @param query the Query object to be appended to this Query object
*/
public void not( Query query ) public void not( Query query )
{ {
queries.add( new NotQueryTerm( query ) ); queries.add( new NotQueryTerm( query ) );
} }
/**
* Method to get the List of Queries appended into this
*
* @return List of all Queries added to this Query
*/
public List getQueries() public List getQueries()
{ {
return queries; return queries;

View File

@ -23,9 +23,24 @@ package org.apache.maven.repository.indexing.query;
*/ */
public interface CompoundQueryTerm public interface CompoundQueryTerm
{ {
/**
* Method to test if the Query is a search requirement
*
* @return true if this Query is a search requirement, otherwise returns false
*/
boolean isRequired(); boolean isRequired();
/**
* Method to test if the Query is prohibited in the search result
*
* @return true if this Query is prohibited in the search result
*/
boolean isProhibited(); boolean isProhibited();
/**
* Method to get the Query object represented by this object
*
* @return the Query object represented by this object
*/
Query getQuery(); Query getQuery();
} }

View File

@ -24,11 +24,19 @@ package org.apache.maven.repository.indexing.query;
public class NotQueryTerm public class NotQueryTerm
extends AbstractCompoundQueryTerm extends AbstractCompoundQueryTerm
{ {
/**
* Class constructor
*
* @param query the Query object represented by this Query object
*/
public NotQueryTerm( Query query ) public NotQueryTerm( Query query )
{ {
super( query ); super( query );
} }
/**
* @see CompoundQueryTerm#isProhibited()
*/
public boolean isProhibited() public boolean isProhibited()
{ {
return true; return true;

View File

@ -24,6 +24,11 @@ package org.apache.maven.repository.indexing.query;
public class OrQueryTerm public class OrQueryTerm
extends AbstractCompoundQueryTerm extends AbstractCompoundQueryTerm
{ {
/**
* Class constructor
*
* @param query the Query object represented by this Query object
*/
public OrQueryTerm( Query query ) public OrQueryTerm( Query query )
{ {
super( query ); super( query );

View File

@ -18,6 +18,8 @@ package org.apache.maven.repository.indexing.query;
*/ */
/** /**
* Interface to label the query classes
*
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */
public interface Query public interface Query

View File

@ -18,6 +18,8 @@ package org.apache.maven.repository.indexing.query;
*/ */
/** /**
* Class to hold a single field search condition
*
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */
public class SinglePhraseQuery public class SinglePhraseQuery
@ -27,17 +29,33 @@ public class SinglePhraseQuery
private String value; private String value;
/**
* Class constructor
*
* @param field the index field to search
* @param value the index value requirement
*/
public SinglePhraseQuery( String field, String value ) public SinglePhraseQuery( String field, String value )
{ {
this.field = field; this.field = field;
this.value = value; this.value = value;
} }
/**
* Method to retrieve the name of the index field searched
*
* @return the name of the index field
*/
public String getField() public String getField()
{ {
return field; return field;
} }
/**
* Method to retrieve the value used in searching the index field
*
* @return the value to corresspond the index field
*/
public String getValue() public String getValue()
{ {
return value; return value;

View File

@ -34,7 +34,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
* @author Edwin Punzalan/Maria Odea Ching * @author Edwin Punzalan
*/ */
public class ArtifactRepositoryIndexingTest public class ArtifactRepositoryIndexingTest
extends PlexusTestCase extends PlexusTestCase