Package org.apache.maven.index.context
Interface IndexingContext
-
- All Known Implementing Classes:
AbstractIndexingContext,DefaultIndexingContext,MergedIndexingContext
public interface IndexingContextAn indexing context is representing artifact repository for indexing and searching. Indexing context is a statefull component, it keeps state of index readers and writers.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringINDEX_CHAIN_IDAn id that defines the current incremental chain.static java.lang.StringINDEX_CHUNK_COUNTERA counter used to id the chunksstatic java.lang.StringINDEX_CHUNK_PREFIXA prefix used to specify an incremental update chunk namestatic java.lang.StringINDEX_FILE_PREFIXStandard name of the full repository index that is used when clients requesting index information have nothing to start with.static java.lang.StringINDEX_IDA property name used to specify index idstatic java.lang.StringINDEX_LEGACY_TIMESTAMPA property name used to specify legacy index timestamp (the last update time)static java.lang.StringINDEX_PACKER_PROPERTIES_FILEstatic java.lang.StringINDEX_PROPERTY_PREFIXA prefix used for all index property namesstatic java.lang.StringINDEX_REMOTE_PROPERTIES_FILEstatic java.lang.StringINDEX_TIME_DAY_FORMATA date format used for incremental update chunk namesstatic java.lang.StringINDEX_TIME_FORMATA date format used for index timestampstatic java.lang.StringINDEX_TIMESTAMPA property name used to specify index timtestampstatic java.lang.StringINDEX_UPDATER_PROPERTIES_FILE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.lucene.search.IndexSearcheracquireIndexSearcher()Acquires a fresh instance ofIndexSearcher.voidclose(boolean deleteFiles)Shuts down this context.voidcommit()Commits changes to context, eventually refreshing readers/searchers too.java.util.Set<java.lang.String>getAllGroups()Gets all group names stored in the current indexing contextorg.apache.lucene.analysis.AnalyzergetAnalyzer()Returns the Lucene Analyzer of this context used for by IndexWriter and IndexSearcher.GavCalculatorgetGavCalculator()Returns the GavCalculator for this Context.java.lang.StringgetId()Returns this indexing context id.java.util.List<IndexCreator>getIndexCreators()List of IndexCreators used in this context.org.apache.lucene.store.DirectorygetIndexDirectory()java.io.FilegetIndexDirectoryFile()java.lang.StringgetIndexUpdateUrl()Returns url for the index updateorg.apache.lucene.index.IndexWritergetIndexWriter()Returns the Lucene IndexWriter (thread safe, shared instance) of this context.java.io.FilegetRepository()Returns location for the local repository.java.lang.StringgetRepositoryId()Returns repository id.java.lang.StringgetRepositoryUrl()Returns public repository url.java.util.Set<java.lang.String>getRootGroups()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?).java.util.DategetTimestamp()Returns index update timebooleanisReceivingUpdates()Returns true if this context is receiving updates from remote via IndexUpdater.booleanisSearchable()Is 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.voidoptimize()Optimizes index.voidpurge()Purge (cleans) the context, deletes/empties the index and restores the context to new/empty state.voidrebuildGroups()Rebuilds stored group names from the indexvoidreleaseIndexSearcher(org.apache.lucene.search.IndexSearcher s)Releases theIndexSearcherinstance.voidreplace(org.apache.lucene.store.Directory directory)Replaces the Lucene index with the one from supplied directory.voidreplace(org.apache.lucene.store.Directory directory, java.util.Set<java.lang.String> allGroups, java.util.Set<java.lang.String> rootGroups)voidrollback()Rolls back changes to context, eventually refreshing readers/searchers too.voidsetAllGroups(java.util.Collection<java.lang.String> groups)Sets all group names stored in the current indexing contextvoidsetRootGroups(java.util.Collection<java.lang.String> groups)Sets root group names stored in the current indexing contextvoidsetSearchable(boolean searchable)Sets is the context searchable when doing "non-targeted" searches.voidupdateTimestamp()voidupdateTimestamp(boolean save)voidupdateTimestamp(boolean save, java.util.Date date)
-
-
-
Field Detail
-
INDEX_FILE_PREFIX
static final java.lang.String INDEX_FILE_PREFIX
Standard name of the full repository index that is used when clients requesting index information have nothing to start with.- See Also:
- Constant Field Values
-
INDEX_REMOTE_PROPERTIES_FILE
static final java.lang.String INDEX_REMOTE_PROPERTIES_FILE
- See Also:
- Constant Field Values
-
INDEX_UPDATER_PROPERTIES_FILE
static final java.lang.String INDEX_UPDATER_PROPERTIES_FILE
- See Also:
- Constant Field Values
-
INDEX_PACKER_PROPERTIES_FILE
static final java.lang.String INDEX_PACKER_PROPERTIES_FILE
- See Also:
- Constant Field Values
-
INDEX_PROPERTY_PREFIX
static final java.lang.String INDEX_PROPERTY_PREFIX
A prefix used for all index property names- See Also:
- Constant Field Values
-
INDEX_ID
static final java.lang.String INDEX_ID
A property name used to specify index id- See Also:
- Constant Field Values
-
INDEX_LEGACY_TIMESTAMP
static final java.lang.String INDEX_LEGACY_TIMESTAMP
A property name used to specify legacy index timestamp (the last update time)- See Also:
- Constant Field Values
-
INDEX_TIMESTAMP
static final java.lang.String INDEX_TIMESTAMP
A property name used to specify index timtestamp- See Also:
- Constant Field Values
-
INDEX_CHUNK_PREFIX
static final java.lang.String INDEX_CHUNK_PREFIX
A prefix used to specify an incremental update chunk name- See Also:
- Constant Field Values
-
INDEX_TIME_FORMAT
static final java.lang.String INDEX_TIME_FORMAT
A date format used for index timestamp- See Also:
- Constant Field Values
-
INDEX_TIME_DAY_FORMAT
static final java.lang.String INDEX_TIME_DAY_FORMAT
A date format used for incremental update chunk names- See Also:
- Constant Field Values
-
INDEX_CHUNK_COUNTER
static final java.lang.String INDEX_CHUNK_COUNTER
A counter used to id the chunks- See Also:
- Constant Field Values
-
INDEX_CHAIN_ID
static final java.lang.String INDEX_CHAIN_ID
An id that defines the current incremental chain. If when checking remote repo, the index chain doesn't match you'll know that you need to download the full index- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
java.lang.String getId()
Returns this indexing context id.
-
getRepositoryId
java.lang.String getRepositoryId()
Returns repository id.
-
getRepository
java.io.File getRepository()
Returns location for the local repository.
-
getRepositoryUrl
java.lang.String getRepositoryUrl()
Returns public repository url.
-
getIndexUpdateUrl
java.lang.String getIndexUpdateUrl()
Returns url for the index update
-
isSearchable
boolean isSearchable()
Is the context searchable when doing "non-targeted" searches? Ie. Should it take a part when searching without specifying context?- Returns:
-
setSearchable
void setSearchable(boolean searchable)
Sets is the context searchable when doing "non-targeted" searches.- Parameters:
searchable-
-
getTimestamp
java.util.Date getTimestamp()
Returns index update time
-
updateTimestamp
void updateTimestamp() throws java.io.IOException- Throws:
java.io.IOException
-
updateTimestamp
void updateTimestamp(boolean save) throws java.io.IOException- Throws:
java.io.IOException
-
updateTimestamp
void updateTimestamp(boolean save, java.util.Date date) throws java.io.IOException- Throws:
java.io.IOException
-
getSize
int getSize() throws java.io.IOExceptionReturns 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:
java.io.IOException
-
acquireIndexSearcher
org.apache.lucene.search.IndexSearcher acquireIndexSearcher() throws java.io.IOExceptionAcquires a fresh instance ofIndexSearcher. You have to release the received instance withreleaseIndexSearcher(IndexSearcher)otherwise you are about to introduce leak.- Returns:
- Throws:
java.io.IOException
-
releaseIndexSearcher
void releaseIndexSearcher(org.apache.lucene.search.IndexSearcher s) throws java.io.IOExceptionReleases theIndexSearcherinstance.- Parameters:
s-- Throws:
java.io.IOException
-
getIndexWriter
org.apache.lucene.index.IndexWriter getIndexWriter() throws java.io.IOExceptionReturns the Lucene IndexWriter (thread safe, shared instance) of this context.- Returns:
- indexWriter
- Throws:
java.io.IOException
-
getIndexCreators
java.util.List<IndexCreator> getIndexCreators()
List of IndexCreators used in this context.- Returns:
- list of index creators.
-
getAnalyzer
org.apache.lucene.analysis.Analyzer getAnalyzer()
Returns the Lucene Analyzer of this context used for by IndexWriter and IndexSearcher. Note: this method always creates a new instance of analyzer!- Returns:
-
commit
void commit() throws java.io.IOExceptionCommits changes to context, eventually refreshing readers/searchers too.- Throws:
java.io.IOException
-
rollback
void rollback() throws java.io.IOExceptionRolls back changes to context, eventually refreshing readers/searchers too.- Throws:
java.io.IOException
-
optimize
void optimize() throws java.io.IOExceptionOptimizes index. According to Lucene 3.6+ Javadoc, there is no more sense to optimize, so this method might become "noop".- Throws:
java.io.IOException
-
close
void close(boolean deleteFiles) throws java.io.IOExceptionShuts down this context.- Throws:
java.io.IOException
-
purge
void purge() throws java.io.IOExceptionPurge (cleans) the context, deletes/empties the index and restores the context to new/empty state.- Throws:
java.io.IOException
-
merge
void merge(org.apache.lucene.store.Directory directory) throws java.io.IOExceptionMerges content of given Lucene directory with this context.- Parameters:
directory- - the directory to merge- Throws:
java.io.IOException
-
merge
void merge(org.apache.lucene.store.Directory directory, DocumentFilter filter) throws java.io.IOExceptionMerges content of given Lucene directory with this context, but filters out the unwanted ones.- Parameters:
directory- - the directory to merge- Throws:
java.io.IOException
-
replace
void replace(org.apache.lucene.store.Directory directory) throws java.io.IOExceptionReplaces the Lucene index with the one from supplied directory.- Parameters:
directory-- Throws:
java.io.IOException
-
replace
void replace(org.apache.lucene.store.Directory directory, java.util.Set<java.lang.String> allGroups, java.util.Set<java.lang.String> rootGroups) throws java.io.IOException- Throws:
java.io.IOException
-
getIndexDirectory
org.apache.lucene.store.Directory getIndexDirectory()
-
getIndexDirectoryFile
java.io.File getIndexDirectoryFile()
-
getGavCalculator
GavCalculator getGavCalculator()
Returns the GavCalculator for this Context. Implies repository layout.
-
setAllGroups
void setAllGroups(java.util.Collection<java.lang.String> groups) throws java.io.IOExceptionSets all group names stored in the current indexing context- Throws:
java.io.IOException
-
getAllGroups
java.util.Set<java.lang.String> getAllGroups() throws java.io.IOExceptionGets all group names stored in the current indexing context- Throws:
java.io.IOException
-
setRootGroups
void setRootGroups(java.util.Collection<java.lang.String> groups) throws java.io.IOExceptionSets root group names stored in the current indexing context- Throws:
java.io.IOException
-
getRootGroups
java.util.Set<java.lang.String> getRootGroups() throws java.io.IOExceptionGets root group names stored in the current indexing context- Throws:
java.io.IOException
-
rebuildGroups
void rebuildGroups() throws java.io.IOExceptionRebuilds stored group names from the index- Throws:
java.io.IOException
-
isReceivingUpdates
boolean isReceivingUpdates()
Returns true if this context is receiving updates from remote via IndexUpdater.- Returns:
-
-