Updated some javadocs

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@414549 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Edwin L. Punzalan 2006-06-15 10:50:19 +00:00
parent 78f88941cf
commit 4e9afa78cb
6 changed files with 106 additions and 47 deletions

View File

@ -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

View File

@ -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
{

View File

@ -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
{

View File

@ -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 );
}
}
}

View File

@ -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
{

View File

@ -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;
}