Package org.apache.maven.index.context
Class DefaultIndexingContext
java.lang.Object
org.apache.maven.index.context.AbstractIndexingContext
org.apache.maven.index.context.DefaultIndexingContext
- All Implemented Interfaces:
- IndexingContext
The default 
IndexingContext implementation.- Author:
- Jason van Zyl, Tamas Cservenak
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.apache.maven.index.context.IndexingContextINDEX_CHAIN_ID, INDEX_CHUNK_COUNTER, INDEX_CHUNK_PREFIX, INDEX_FILE_PREFIX, INDEX_ID, INDEX_LEGACY_TIMESTAMP, INDEX_PACKER_PROPERTIES_FILE, INDEX_PROPERTY_PREFIX, INDEX_REMOTE_PROPERTIES_FILE, INDEX_TIME_DAY_FORMAT, INDEX_TIME_FORMAT, INDEX_TIMESTAMP, INDEX_UPDATER_PROPERTIES_FILE
- 
Constructor SummaryConstructorsConstructorDescriptionDefaultIndexingContext(String id, String repositoryId, File repository, File indexDirectoryFile, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexCreators, boolean reclaimIndex) DefaultIndexingContext(String id, String repositoryId, File repository, org.apache.lucene.store.Directory indexDirectory, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexCreators, boolean reclaimIndex) Deprecated.
- 
Method SummaryModifier and TypeMethodDescriptionorg.apache.lucene.search.IndexSearcherAcquires a fresh instance ofIndexSearcher.voidclose(boolean deleteFiles) Shuts down this context.voidcommit()Commits changes to context, eventually refreshing readers/searchers too.Gets all group names stored in the current indexing contextorg.apache.lucene.analysis.AnalyzerReturns the Lucene Analyzer of this context used for by IndexWriter and IndexSearcher.Returns the GavCalculator for this Context.getId()Returns this indexing context id.List of IndexCreators used in this context.org.apache.lucene.store.DirectoryReturns url for the index updateorg.apache.lucene.index.IndexWriterReturns the Lucene IndexWriter (thread safe, shared instance) of this context.Returns location for the local repository.Returns repository id.Returns public repository url.Gets root group names stored in the current indexing contextintgetSize()Returns a number that represents the "size" useful for doing comparisons between contexts (which one has more data indexed?).Returns index update timeprotected org.apache.lucene.index.IndexWriterConfigReturns new IndexWriterConfig instancebooleanIs the context searchable when doing "non-targeted" searches? Ie.voidmerge(org.apache.lucene.store.Directory directory) Merges content of given Lucene directory with this context.voidmerge(org.apache.lucene.store.Directory directory, DocumentFilter filter) Merges content of given Lucene directory with this context, but filters out the unwanted ones.voidmerge(org.apache.lucene.store.Directory directory, DocumentFilter filter, Set<String> allGroups, Set<String> rootGroups) Merges content of given Lucene directory with this context, but filters out the unwanted ones and adds the groups to the context.protected voidvoidoptimize()Optimizes index.voidpurge()Purge (cleans) the context, deletes/empties the index and restores the context to new/empty state.voidRebuilds stored group names from the indexvoidreleaseIndexSearcher(org.apache.lucene.search.IndexSearcher is) Releases theIndexSearcherinstance.voidreplace(org.apache.lucene.store.Directory directory) Replaces the Lucene index with the one from supplied directory.voidvoidrollback()Rolls back changes to context, eventually refreshing readers/searchers too.voidsetAllGroups(Collection<String> groups) Sets all group names stored in the current indexing contextprotected voidSets index location.voidsetRootGroups(Collection<String> groups) Sets root group names stored in the current indexing contextvoidsetSearchable(boolean searchable) Sets is the context searchable when doing "non-targeted" searches.toString()voidvoidupdateTimestamp(boolean save) voidupdateTimestamp(boolean save, Date timestamp) Methods inherited from class org.apache.maven.index.context.AbstractIndexingContextisReceivingUpdates
- 
Field Details- 
FLD_DESCRIPTOR- See Also:
 
- 
FLD_DESCRIPTOR_CONTENTS- See Also:
 
- 
FLD_IDXINFO- See Also:
 
- 
VERSION- See Also:
 
 
- 
- 
Constructor Details- 
DefaultIndexingContextpublic DefaultIndexingContext(String id, String repositoryId, File repository, File indexDirectoryFile, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexCreators, boolean reclaimIndex) throws IOException, ExistingLuceneIndexMismatchException 
- 
DefaultIndexingContext@Deprecated public DefaultIndexingContext(String id, String repositoryId, File repository, org.apache.lucene.store.Directory indexDirectory, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexCreators, boolean reclaimIndex) throws IOException, ExistingLuceneIndexMismatchException Deprecated.
 
- 
- 
Method Details- 
getIndexDirectorypublic org.apache.lucene.store.Directory getIndexDirectory()
- 
setIndexDirectoryFileSets index location. As usually index is persistent (is on disk), this will point to that value, but in some circumstances (ie, using RAMDisk for index), this will point to an existing tmp directory.- Throws:
- IOException
 
- 
getIndexDirectoryFile
- 
isSearchablepublic boolean isSearchable()Description copied from interface:IndexingContextIs the context searchable when doing "non-targeted" searches? Ie. Should it take a part when searching without specifying context?- Returns:
 
- 
setSearchablepublic void setSearchable(boolean searchable) Description copied from interface:IndexingContextSets is the context searchable when doing "non-targeted" searches.- Parameters:
- searchable-
 
- 
getIdDescription copied from interface:IndexingContextReturns this indexing context id.
- 
updateTimestamp- Throws:
- IOException
 
- 
updateTimestamp- Throws:
- IOException
 
- 
updateTimestamp- Throws:
- IOException
 
- 
getTimestampDescription copied from interface:IndexingContextReturns index update time
- 
getSizeDescription copied from interface:IndexingContextReturns a number that represents the "size" useful for doing comparisons between contexts (which one has more data indexed?). The number return does not represent the count of ArtifactInfos, neither other "meaningful" info, it is purely to be used for inter-context comparisons only!- Returns:
- Throws:
- IOException
 
- 
getRepositoryIdDescription copied from interface:IndexingContextReturns repository id.
- 
getRepositoryDescription copied from interface:IndexingContextReturns location for the local repository.
- 
getRepositoryUrlDescription copied from interface:IndexingContextReturns public repository url.
- 
getIndexUpdateUrlDescription copied from interface:IndexingContextReturns url for the index update
- 
getAnalyzerpublic org.apache.lucene.analysis.Analyzer getAnalyzer()Description copied from interface:IndexingContextReturns the Lucene Analyzer of this context used for by IndexWriter and IndexSearcher. Note: this method always creates a new instance of analyzer!- Returns:
 
- 
openAndWarmup- Throws:
- IOException
 
- 
getWriterConfigprotected org.apache.lucene.index.IndexWriterConfig getWriterConfig()Returns new IndexWriterConfig instance- Since:
- 5.1
 
- 
getIndexWriterDescription copied from interface:IndexingContextReturns the Lucene IndexWriter (thread safe, shared instance) of this context.- Returns:
- indexWriter
- Throws:
- IOException
 
- 
acquireIndexSearcherDescription copied from interface:IndexingContextAcquires a fresh instance ofIndexSearcher. You have to release the received instance withIndexingContext.releaseIndexSearcher(IndexSearcher)otherwise you are about to introduce leak.- Returns:
- Throws:
- IOException
 
- 
releaseIndexSearcherDescription copied from interface:IndexingContextReleases theIndexSearcherinstance.- Parameters:
- is-
- Throws:
- IOException
 
- 
commitDescription copied from interface:IndexingContextCommits changes to context, eventually refreshing readers/searchers too.- Throws:
- IOException
 
- 
rollbackDescription copied from interface:IndexingContextRolls back changes to context, eventually refreshing readers/searchers too.- Throws:
- IOException
 
- 
optimizeDescription copied from interface:IndexingContextOptimizes index. According to Lucene 3.6+ Javadoc, there is no more sense to optimize, so this method might become "noop".- Throws:
- org.apache.lucene.index.CorruptIndexException
- IOException
 
- 
closeDescription copied from interface:IndexingContextShuts down this context.- Throws:
- IOException
 
- 
purgeDescription copied from interface:IndexingContextPurge (cleans) the context, deletes/empties the index and restores the context to new/empty state.- Throws:
- IOException
 
- 
replaceDescription copied from interface:IndexingContextReplaces the Lucene index with the one from supplied directory.- Parameters:
- directory-
- Throws:
- IOException
 
- 
replacepublic void replace(org.apache.lucene.store.Directory directory, Set<String> allGroups, Set<String> rootGroups) throws IOException - Throws:
- IOException
 
- 
mergeDescription copied from interface:IndexingContextMerges content of given Lucene directory with this context.- Parameters:
- directory- - the directory to merge
- Throws:
- IOException
 
- 
mergepublic void merge(org.apache.lucene.store.Directory directory, DocumentFilter filter) throws IOException Description copied from interface:IndexingContextMerges content of given Lucene directory with this context, but filters out the unwanted ones.- Parameters:
- directory- - the directory to merge
- Throws:
- IOException
 
- 
mergepublic void merge(org.apache.lucene.store.Directory directory, DocumentFilter filter, Set<String> allGroups, Set<String> rootGroups) throws IOException Description copied from interface:IndexingContextMerges content of given Lucene directory with this context, but filters out the unwanted ones and adds the groups to the context.- Parameters:
- directory- - the directory to merge
- Throws:
- IOException
 
- 
getGavCalculatorDescription copied from interface:IndexingContextReturns the GavCalculator for this Context. Implies repository layout.
- 
getIndexCreatorsDescription copied from interface:IndexingContextList of IndexCreators used in this context.- Returns:
- list of index creators.
 
- 
rebuildGroupsDescription copied from interface:IndexingContextRebuilds stored group names from the index- Throws:
- IOException
 
- 
getAllGroupsDescription copied from interface:IndexingContextGets all group names stored in the current indexing context
- 
setAllGroupsDescription copied from interface:IndexingContextSets all group names stored in the current indexing context
- 
getRootGroupsDescription copied from interface:IndexingContextGets root group names stored in the current indexing context- Throws:
- IOException
 
- 
setRootGroupsDescription copied from interface:IndexingContextSets root group names stored in the current indexing context
- 
toString
 
-