deleteDocuments( Collections.singletonList( term ) );
}
+ /**
+ * @see RepositoryIndex#deleteDocuments(java.util.List)
+ */
public void deleteDocuments( List termList )
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
+ * @see RepositoryIndex#addDocuments(java.util.List)
*/
public void addDocuments( List docList )
throws RepositoryIndexException
}
/**
- * 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
{
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();
return list;
}
+ /**
+ * Creates a list of Lucene documents, used for index additions
+ *
+ * @param artifactList
+ * @return
+ * @throws RepositoryIndexException
+ */
private List getDocumentList( List artifactList )
throws RepositoryIndexException
{
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
{
return new EclipseIndexAnalyzer( new SimpleAnalyzer() );
}
+ /**
+ * Indexes the artifacts inside the provided list
+ *
+ * @param artifactList
+ * @throws RepositoryIndexException
+ */
public void indexArtifacts( List artifactList )
throws RepositoryIndexException
{
}
}
+ /**
+ * Creates a Lucene Document from an artifact; used for index additions
+ *
+ * @param artifact
+ * @return
+ * @throws RepositoryIndexException
+ */
private Document createDocument( Artifact artifact )
throws RepositoryIndexException
{
}\r
\r
/**\r
- * Index the contents of the specified RepositoryMetadata paramter object\r
+ * Index the contents of the specified RepositoryMetadata parameter object\r
*\r
* @param repoMetadata the metadata object to be indexed\r
* @throws RepositoryIndexException\r
indexMetadata( Collections.singletonList( repoMetadata ) );\r
}\r
\r
+ /**\r
+ * Index the metadata found within the provided list. Deletes existing entries in the index first before\r
+ * proceeding with the index additions.\r
+ *\r
+ * @param metadataList\r
+ * @throws RepositoryIndexException\r
+ */\r
public void indexMetadata( List metadataList )\r
throws RepositoryIndexException\r
{\r
addDocuments( getDocumentList( metadataList ) );\r
}\r
\r
+ /**\r
+ * Creates a list of Lucene Term object used in index deletion\r
+ *\r
+ * @param metadataList\r
+ * @return List of Term object\r
+ */\r
private List getTermList( List metadataList )\r
{\r
List terms = new ArrayList();\r
return terms;\r
}\r
\r
+ /**\r
+ * Creates a list of Lucene documents\r
+ *\r
+ * @param metadataList\r
+ * @return List of Lucene Documents\r
+ */\r
private List getDocumentList( List metadataList )\r
{\r
List docs = new ArrayList();\r
return docs;\r
}\r
\r
+ /**\r
+ * Creates a Lucene Document from a RepositoryMetadata; used for index additions\r
+ *\r
+ * @param repoMetadata\r
+ * @return Lucene Document\r
+ */\r
private Document createDocument( RepositoryMetadata repoMetadata )\r
{\r
//get lastUpdated from Versioning (specified in Metadata object)\r
doc.add( Field.Keyword( FLD_PLUGINS_ALL, "" ) );\r
return doc;\r
}\r
-\r
- private void deleteIfIndexed( RepositoryMetadata repoMetadata )\r
- throws RepositoryIndexException\r
- {\r
- try\r
- {\r
- deleteDocument( FLD_ID, (String) repoMetadata.getKey() );\r
- }\r
- catch ( IOException e )\r
- {\r
- throw new RepositoryIndexException( "Failed to delete document", e );\r
- }\r
- }\r
}\r
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
*
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
{
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();
return terms;
}
+ /**
+ * Creates a list of Lucene documents
+ *
+ * @param pomList
+ * @return
+ * @throws RepositoryIndexException
+ */
private List getDocumentList( List pomList )
throws RepositoryIndexException
{
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
{
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;
}