Author: epunzalan Date: Mon Dec 26 18:34:36 2005 New Revision: 359161 URL: http://svn.apache.org/viewcvs?rev=359161&view=rev Log: Added javadoc annotations
Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndexer.java maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexAnalyzer.java maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexer.java Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndexer.java URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndexer.java?rev=359161&r1=359160&r2=359161&view=diff ============================================================================== --- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndexer.java (original) +++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndexer.java Mon Dec 26 18:34:36 2005 @@ -27,6 +27,7 @@ import org.apache.lucene.index.IndexWriter; /** + * Abstract class for RepositoryIndexers * * @author Edwin Punzalan */ @@ -38,6 +39,9 @@ protected IndexReader indexReader; protected IndexWriter indexWriter; + /** + * method to encapsulate the optimize() method for lucene + */ public void optimize() throws RepositoryIndexerException { @@ -56,11 +60,19 @@ } } + /** + * method used to query the index status + * + * @param true if the index is open. + */ public boolean isOpen() { return indexOpen; } + /** + * method used to close all open streams to the index directory + */ public void close() throws RepositoryIndexerException { @@ -86,6 +98,9 @@ } } + /** + * method for opening the index directory for indexing operations + */ public void open() throws RepositoryIndexerException { @@ -99,7 +114,6 @@ } } - protected void getIndexWriter() throws IOException { @@ -123,6 +137,11 @@ return new ArtifactRepositoryIndexAnalyzer( new SimpleAnalyzer() ); } + /** + * method for validating an index directory + * + * @throws RepositoryIndexerException if the given indexPath is not valid for this type of RepositoryIndexer + */ protected void validateIndex() throws RepositoryIndexerException { Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexAnalyzer.java URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexAnalyzer.java?rev=359161&r1=359160&r2=359161&view=diff ============================================================================== --- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexAnalyzer.java (original) +++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexAnalyzer.java Mon Dec 26 18:34:36 2005 @@ -25,6 +25,7 @@ import org.apache.lucene.analysis.TokenStream; /** + * Class created specifically to index artifacts * * @author Edwin Punzalan */ @@ -33,12 +34,25 @@ { private Analyzer defaultAnalyzer; + /** + * constructor to for this analyzer + * + * @character defaultAnalyzer the analyzer to use as default for the general fields of the artifact indeces + */ public ArtifactRepositoryIndexAnalyzer( Analyzer defaultAnalyzer ) { this.defaultAnalyzer = defaultAnalyzer; } - public TokenStream tokenStream(String fieldName, Reader reader) + /** + * Method called by lucence during indexing operations + * + * @character fieldName the field name that the lucene object is currently processing + * @character reader a Reader object to the index stream + * + * @return an analyzer to specific to the field name or the default analyzer if none is present + */ + public TokenStream tokenStream( String fieldName, Reader reader ) { TokenStream tokenStream; @@ -54,19 +68,34 @@ return tokenStream; } + /** + * Class used to tokenize an artifact's version. + */ private class VersionTokenizer extends CharTokenizer { + /** + * Constructor with the required reader to the index stream + * + * @reader the Reader object of the index stream + */ public VersionTokenizer( Reader reader ) { super( reader ); } - protected boolean isTokenChar( char param ) + /** + * method that lucene calls to check tokenization of a stream character + * + * @param character char currently being processed + * + * @return true if the char is a token, false if the char is a stop char + */ + protected boolean isTokenChar( char character ) { boolean token; - switch( param ) + switch( character ) { case '.': case '-': Modified: maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexer.java URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexer.java?rev=359161&r1=359160&r2=359161&view=diff ============================================================================== --- maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexer.java (original) +++ maven/repository-manager/trunk/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexer.java Mon Dec 26 18:34:36 2005 @@ -37,6 +37,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository; /** + * Class used to index Artifact objects in a specified repository * * @author Edwin Punzalan */ @@ -62,6 +63,14 @@ private StringBuffer packages; private StringBuffer files; + /** + * Constructor + * @todo change repository to layout ??? + * + * @param repository the repository where the indexed artifacts are located. This is necessary only to distinguish + * between default and legacy directory structure of the artifact location. + * @param path the directory where the index is located or will be created. + */ public ArtifactRepositoryIndexer( ArtifactRepository repository, String path ) throws RepositoryIndexerException { @@ -70,11 +79,21 @@ validateIndex(); } + /** + * method for collecting the available index fields usable for searching + * + * @return index field names + */ public String[] getIndexFields() { return FIELDS; } + /** + * generic method for indexing + * + * @param obj the object to be indexed by this indexer + */ public void addObjectIndex(Object obj) throws RepositoryIndexerException { @@ -89,6 +108,11 @@ } } + /** + * method to index a given artifact + * + * @param artifact the Artifact object to be indexed + */ public void addArtifactIndex( Artifact artifact ) throws RepositoryIndexerException {