From 4e9afa78cbeb3d1364309a5dc8c4f1ee40954ae5 Mon Sep 17 00:00:00 2001 From: "Edwin L. Punzalan" Date: Thu, 15 Jun 2006 10:50:19 +0000 Subject: [PATCH] Updated some javadocs git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@414549 13f79535-47bb-0310-9956-ffa450edef68 --- .../indexing/AbstractRepositoryIndex.java | 9 ++--- .../indexing/ArtifactRepositoryIndex.java | 38 +++++++++++------- .../indexing/EclipseRepositoryIndex.java | 13 ++++++ .../indexing/MetadataRepositoryIndex.java | 40 ++++++++++++------- .../indexing/PomRepositoryIndex.java | 39 ++++++++++++------ .../repository/indexing/RepositoryIndex.java | 14 +++++++ 6 files changed, 106 insertions(+), 47 deletions(-) diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java index 5903cebb6..30ea608b2 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java @@ -200,6 +200,9 @@ public abstract class AbstractRepositoryIndex deleteDocuments( Collections.singletonList( term ) ); } + /** + * @see RepositoryIndex#deleteDocuments(java.util.List) + */ public void deleteDocuments( List termList ) throws RepositoryIndexException, IOException { @@ -228,11 +231,7 @@ public abstract class AbstractRepositoryIndex } /** - * Opens the lucene index and add all the lucene documents inside the list into the index. - * Closes the index at the end. - * - * @param docList List of Lucene Documents - * @throws RepositoryIndexException when an error occurred during the indexing of the documents + * @see RepositoryIndex#addDocuments(java.util.List) */ public void addDocuments( List docList ) throws RepositoryIndexException diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java index 9d669af64..8a1f8fb55 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java @@ -62,24 +62,12 @@ public class ArtifactRepositoryIndex } /** - * Checks if the artifact has already been indexed and deletes it if it is. + * Indexes the artifacts found within the specified list. Deletes existing indices for the same artifacts first, + * before proceeding on adding them into the index. * - * @param artifact the object to be indexed. + * @param artifactList * @throws RepositoryIndexException */ - private void deleteIfIndexed( Artifact artifact ) - throws RepositoryIndexException - { - try - { - deleteDocument( FLD_ID, ARTIFACT + ":" + artifact.getId() ); - } - catch ( IOException e ) - { - throw new RepositoryIndexException( "Failed to delete a document", e ); - } - } - public void indexArtifacts( List artifactList ) throws RepositoryIndexException { @@ -95,6 +83,12 @@ public class ArtifactRepositoryIndex addDocuments( getDocumentList( artifactList ) ); } + /** + * Creates a list of Lucene Term object used in index deletion + * + * @param artifactList + * @return List of Term object + */ private List getTermList( List artifactList ) { List list = new ArrayList(); @@ -109,6 +103,13 @@ public class ArtifactRepositoryIndex return list; } + /** + * Creates a list of Lucene documents, used for index additions + * + * @param artifactList + * @return + * @throws RepositoryIndexException + */ private List getDocumentList( List artifactList ) throws RepositoryIndexException { @@ -136,6 +137,13 @@ public class ArtifactRepositoryIndex indexArtifacts( Collections.singletonList( artifact ) ); } + /** + * Creates a Lucene Document from an artifact; used for index additions + * + * @param artifact + * @return + * @throws RepositoryIndexException + */ private Document createDocument( Artifact artifact ) throws RepositoryIndexException { diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java index 52795d84c..a0a298c84 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java @@ -88,6 +88,12 @@ public class EclipseRepositoryIndex return new EclipseIndexAnalyzer( new SimpleAnalyzer() ); } + /** + * Indexes the artifacts inside the provided list + * + * @param artifactList + * @throws RepositoryIndexException + */ public void indexArtifacts( List artifactList ) throws RepositoryIndexException { @@ -124,6 +130,13 @@ public class EclipseRepositoryIndex } } + /** + * Creates a Lucene Document from an artifact; used for index additions + * + * @param artifact + * @return + * @throws RepositoryIndexException + */ private Document createDocument( Artifact artifact ) throws RepositoryIndexException { diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java index 6fad583ad..56b754188 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java @@ -51,7 +51,7 @@ public class MetadataRepositoryIndex } /** - * Index the contents of the specified RepositoryMetadata paramter object + * Index the contents of the specified RepositoryMetadata parameter object * * @param repoMetadata the metadata object to be indexed * @throws RepositoryIndexException @@ -62,6 +62,13 @@ public class MetadataRepositoryIndex indexMetadata( Collections.singletonList( repoMetadata ) ); } + /** + * Index the metadata found within the provided list. Deletes existing entries in the index first before + * proceeding with the index additions. + * + * @param metadataList + * @throws RepositoryIndexException + */ public void indexMetadata( List metadataList ) throws RepositoryIndexException { @@ -77,6 +84,12 @@ public class MetadataRepositoryIndex addDocuments( getDocumentList( metadataList ) ); } + /** + * Creates a list of Lucene Term object used in index deletion + * + * @param metadataList + * @return List of Term object + */ private List getTermList( List metadataList ) { List terms = new ArrayList(); @@ -91,6 +104,12 @@ public class MetadataRepositoryIndex return terms; } + /** + * Creates a list of Lucene documents + * + * @param metadataList + * @return List of Lucene Documents + */ private List getDocumentList( List metadataList ) { List docs = new ArrayList(); @@ -105,6 +124,12 @@ public class MetadataRepositoryIndex return docs; } + /** + * Creates a Lucene Document from a RepositoryMetadata; used for index additions + * + * @param repoMetadata + * @return Lucene Document + */ private Document createDocument( RepositoryMetadata repoMetadata ) { //get lastUpdated from Versioning (specified in Metadata object) @@ -172,17 +197,4 @@ public class MetadataRepositoryIndex doc.add( Field.Keyword( FLD_PLUGINS_ALL, "" ) ); return doc; } - - private void deleteIfIndexed( RepositoryMetadata repoMetadata ) - throws RepositoryIndexException - { - try - { - deleteDocument( FLD_ID, (String) repoMetadata.getKey() ); - } - catch ( IOException e ) - { - throw new RepositoryIndexException( "Failed to delete document", e ); - } - } } 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 7ca9f0179..0a13c9716 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 @@ -68,19 +68,6 @@ public class PomRepositoryIndex this.artifactFactory = artifactFactory; } - private void deleteIfIndexed( Model pom ) - throws RepositoryIndexException - { - try - { - deleteDocument( FLD_ID, POM + ":" + pom.getId() ); - } - catch ( IOException e ) - { - throw new RepositoryIndexException( "Failed to delete document", e ); - } - } - /** * Method to create the index fields for a Model object into the index * @@ -93,6 +80,12 @@ public class PomRepositoryIndex indexPoms( Collections.singletonList( pom ) ); } + /** + * Index the Models within the supplied List. Deletes existing index values before adding them to the list. + * + * @param pomList + * @throws RepositoryIndexException + */ public void indexPoms( List pomList ) throws RepositoryIndexException { @@ -108,6 +101,12 @@ public class PomRepositoryIndex addDocuments( getDocumentList( pomList ) ); } + /** + * Creates a list of Lucene Term object used in index deletion + * + * @param pomList + * @return List of Term object + */ private List getTermList( List pomList ) { List terms = new ArrayList(); @@ -122,6 +121,13 @@ public class PomRepositoryIndex return terms; } + /** + * Creates a list of Lucene documents + * + * @param pomList + * @return + * @throws RepositoryIndexException + */ private List getDocumentList( List pomList ) throws RepositoryIndexException { @@ -137,6 +143,13 @@ public class PomRepositoryIndex return docs; } + /** + * Creates a Lucene Document from a Model; used for index additions + * + * @param pom + * @return + * @throws RepositoryIndexException + */ private Document createDocument( Model pom ) throws RepositoryIndexException { diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java index ecbdfd6db..8fb8ff73e 100644 --- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java +++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java @@ -120,9 +120,23 @@ public interface RepositoryIndex public void validate() throws RepositoryIndexException, IOException; + /** + * Opens the lucene index and add all the lucene documents inside the list into the index. + * Closes the index at the end. + * + * @param docList List of Lucene Documents + * @throws RepositoryIndexException when an error occurred during the indexing of the documents + */ public void addDocuments( List docList ) throws RepositoryIndexException; + /** + * Delete from the index matching the list of lucene Terms + * + * @param termList List of Lucene Term + * @throws RepositoryIndexException + * @throws IOException + */ public void deleteDocuments( List termList ) throws RepositoryIndexException, IOException; } -- 2.39.5