Package org.apache.maven.index.context
Interface IndexingContext
- All Known Implementing Classes:
AbstractIndexingContext
,DefaultIndexingContext
,MergedIndexingContext
public interface IndexingContext
An indexing context is representing artifact repository for indexing and searching. Indexing context is a statefull
component, it keeps state of index readers and writers.
- Author:
- Jason van Zyl, Tamas Cservenak, Eugene Kuleshov
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
An id that defines the current incremental chain.static final String
A counter used to id the chunksstatic final String
A prefix used to specify an incremental update chunk namestatic final String
Standard name of the full repository index that is used when clients requesting index information have nothing to start with.static final String
A property name used to specify index idstatic final String
A property name used to specify legacy index timestamp (the last update time)static final String
static final String
A prefix used for all index property namesstatic final String
static final String
A date format used for incremental update chunk namesstatic final String
A date format used for index timestampstatic final String
A property name used to specify index timtestampstatic final String
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.IndexSearcher
Acquires a fresh instance ofIndexSearcher
.void
close
(boolean deleteFiles) Shuts down this context.void
commit()
Commits changes to context, eventually refreshing readers/searchers too.Gets all group names stored in the current indexing contextorg.apache.lucene.analysis.Analyzer
Returns 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.Directory
Returns url for the index updateorg.apache.lucene.index.IndexWriter
Returns 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 contextint
getSize()
Returns a number that represents the "size" useful for doing comparisons between contexts (which one has more data indexed?).Returns index update timeboolean
Returns true if this context is receiving updates from remote via IndexUpdater.boolean
Is the context searchable when doing "non-targeted" searches? Ie.void
merge
(org.apache.lucene.store.Directory directory) Merges content of given Lucene directory with this context.void
merge
(org.apache.lucene.store.Directory directory, DocumentFilter filter) Merges content of given Lucene directory with this context, but filters out the unwanted ones.void
merge
(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.void
optimize()
Optimizes index.void
purge()
Purge (cleans) the context, deletes/empties the index and restores the context to new/empty state.void
Rebuilds stored group names from the indexvoid
releaseIndexSearcher
(org.apache.lucene.search.IndexSearcher s) Releases theIndexSearcher
instance.void
replace
(org.apache.lucene.store.Directory directory) Replaces the Lucene index with the one from supplied directory.void
void
rollback()
Rolls back changes to context, eventually refreshing readers/searchers too.void
setAllGroups
(Collection<String> groups) Sets all group names stored in the current indexing contextvoid
setRootGroups
(Collection<String> groups) Sets root group names stored in the current indexing contextvoid
setSearchable
(boolean searchable) Sets is the context searchable when doing "non-targeted" searches.void
void
updateTimestamp
(boolean save) void
updateTimestamp
(boolean save, Date date)
-
Field Details
-
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:
-
INDEX_REMOTE_PROPERTIES_FILE
- See Also:
-
INDEX_UPDATER_PROPERTIES_FILE
- See Also:
-
INDEX_PACKER_PROPERTIES_FILE
- See Also:
-
INDEX_PROPERTY_PREFIX
A prefix used for all index property names- See Also:
-
INDEX_ID
A property name used to specify index id- See Also:
-
INDEX_LEGACY_TIMESTAMP
A property name used to specify legacy index timestamp (the last update time)- See Also:
-
INDEX_TIMESTAMP
A property name used to specify index timtestamp- See Also:
-
INDEX_CHUNK_PREFIX
A prefix used to specify an incremental update chunk name- See Also:
-
INDEX_TIME_FORMAT
A date format used for index timestamp- See Also:
-
INDEX_TIME_DAY_FORMAT
A date format used for incremental update chunk names- See Also:
-
INDEX_CHUNK_COUNTER
A counter used to id the chunks- See Also:
-
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:
-
-
Method Details
-
getId
String getId()Returns this indexing context id. -
getRepositoryId
String getRepositoryId()Returns repository id. -
getRepository
File getRepository()Returns location for the local repository. -
getRepositoryUrl
String getRepositoryUrl()Returns public repository url. -
getIndexUpdateUrl
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
Date getTimestamp()Returns index update time -
updateTimestamp
- Throws:
IOException
-
updateTimestamp
- Throws:
IOException
-
updateTimestamp
- Throws:
IOException
-
getSize
Returns 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
-
acquireIndexSearcher
Acquires a fresh instance ofIndexSearcher
. You have to release the received instance withreleaseIndexSearcher(IndexSearcher)
otherwise you are about to introduce leak.- Returns:
- Throws:
IOException
-
releaseIndexSearcher
Releases theIndexSearcher
instance.- Parameters:
s
-- Throws:
IOException
-
getIndexWriter
Returns the Lucene IndexWriter (thread safe, shared instance) of this context.- Returns:
- indexWriter
- Throws:
IOException
-
getIndexCreators
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
Commits changes to context, eventually refreshing readers/searchers too.- Throws:
IOException
-
rollback
Rolls back changes to context, eventually refreshing readers/searchers too.- Throws:
IOException
-
optimize
Optimizes index. According to Lucene 3.6+ Javadoc, there is no more sense to optimize, so this method might become "noop".- Throws:
IOException
-
close
Shuts down this context.- Throws:
IOException
-
purge
Purge (cleans) the context, deletes/empties the index and restores the context to new/empty state.- Throws:
IOException
-
merge
Merges content of given Lucene directory with this context.- Parameters:
directory
- - the directory to merge- Throws:
IOException
-
merge
Merges content of given Lucene directory with this context, but filters out the unwanted ones.- Parameters:
directory
- - the directory to merge- Throws:
IOException
-
merge
void merge(org.apache.lucene.store.Directory directory, DocumentFilter filter, Set<String> allGroups, Set<String> rootGroups) throws IOException Merges 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
-
replace
Replaces the Lucene index with the one from supplied directory.- Parameters:
directory
-- Throws:
IOException
-
replace
void replace(org.apache.lucene.store.Directory directory, Set<String> allGroups, Set<String> rootGroups) throws IOException - Throws:
IOException
-
getIndexDirectory
org.apache.lucene.store.Directory getIndexDirectory() -
getIndexDirectoryFile
File getIndexDirectoryFile() -
getGavCalculator
GavCalculator getGavCalculator()Returns the GavCalculator for this Context. Implies repository layout. -
setAllGroups
Sets all group names stored in the current indexing context- Throws:
IOException
-
getAllGroups
Gets all group names stored in the current indexing context- Throws:
IOException
-
setRootGroups
Sets root group names stored in the current indexing context- Throws:
IOException
-
getRootGroups
Gets root group names stored in the current indexing context- Throws:
IOException
-
rebuildGroups
Rebuilds stored group names from the index- Throws:
IOException
-
isReceivingUpdates
boolean isReceivingUpdates()Returns true if this context is receiving updates from remote via IndexUpdater.- Returns:
-