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
static String INDEX_CHAIN_ID
          An id that defines the current incremental chain.
static String INDEX_CHUNK_COUNTER
          A counter used to id the chunks
static String INDEX_CHUNK_PREFIX
          A prefix used to specify an incremental update chunk name
static String INDEX_FILE_PREFIX
          Standard name of the full repository index that is used when clients requesting index information have nothing to start with.
static String INDEX_ID
          A property name used to specify index id
static String INDEX_LEGACY_TIMESTAMP
          A property name used to specify legacy index timestamp (the last update time)
static String INDEX_PACKER_PROPERTIES_FILE
           
static String INDEX_PROPERTY_PREFIX
          A prefix used for all index property names
static String INDEX_REMOTE_PROPERTIES_FILE
           
static String INDEX_TIME_DAY_FORMAT
          A date format used for incremental update chunk names
static String INDEX_TIME_FORMAT
          A date format used for index timestamp
static String INDEX_TIMESTAMP
          A property name used to specify index timtestamp
static String INDEX_UPDATER_PROPERTIES_FILE
           
 
Method Summary
 void close(boolean deleteFiles)
          Shuts down this context.
 void commit()
          Commits changes to context, eventually refreshing readers/searchers too.
 Set<String> getAllGroups()
          Gets all group names stored in the current indexing context
 org.apache.lucene.analysis.Analyzer getAnalyzer()
          Returns the Lucene Analyzer of this context used for by IndexWriter and IndexSearcher.
 GavCalculator getGavCalculator()
          Returns the GavCalculator for this Context.
 String getId()
          Returns this indexing context id.
 List<IndexCreator> getIndexCreators()
          List of IndexCreators used in this context.
 org.apache.lucene.store.Directory getIndexDirectory()
           
 File getIndexDirectoryFile()
           
 org.apache.lucene.index.IndexReader getIndexReader()
          Returns the Lucene IndexReader of this context.
 org.apache.lucene.search.IndexSearcher getIndexSearcher()
          Returns the Lucene IndexSearcher of this context.
 String getIndexUpdateUrl()
          Returns url for the index update
 org.apache.lucene.index.IndexWriter getIndexWriter()
          Returns the Lucene IndexWriter of this context.
 File getRepository()
          Returns location for the local repository.
 String getRepositoryId()
          Returns repository id.
 String getRepositoryUrl()
          Returns public repository url.
 Set<String> getRootGroups()
          Gets root group names stored in the current indexing context
 int getSize()
          Returns a number that represents the "size" useful for doing comparisons between contexts (which one has more data indexed?).
 Date getTimestamp()
          Returns index update time
 boolean isReceivingUpdates()
          Returns true if this context is receiving updates from remote via IndexUpdater.
 boolean isSearchable()
          Is the context searchable when doing "non-targeted" searches?
 void lock()
          Performs a shared locking on this context, guaranteeing that no IndexReader/Searcher/Writer close will occur.
 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 optimize()
          Optimizes index
 void purge()
          Purge (cleans) the context, deletes/empties the index and restores the context to new/empty state.
 void rebuildGroups()
          Rebuilds stored group names from the index
 void replace(org.apache.lucene.store.Directory directory)
          Replaces the Lucene index with the one from supplied directory.
 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 context
 void setRootGroups(Collection<String> groups)
          Sets root group names stored in the current indexing context
 void setSearchable(boolean searchable)
          Sets is the context searchable when doing "non-targeted" searches.
 void unlock()
          Releases the shared lock on this context.
 void updateTimestamp()
           
 void updateTimestamp(boolean save)
           
 void updateTimestamp(boolean save, Date date)
           
 

Field Detail

INDEX_FILE_PREFIX

static final 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 String INDEX_REMOTE_PROPERTIES_FILE
See Also:
Constant Field Values

INDEX_UPDATER_PROPERTIES_FILE

static final String INDEX_UPDATER_PROPERTIES_FILE
See Also:
Constant Field Values

INDEX_PACKER_PROPERTIES_FILE

static final String INDEX_PACKER_PROPERTIES_FILE
See Also:
Constant Field Values

INDEX_PROPERTY_PREFIX

static final String INDEX_PROPERTY_PREFIX
A prefix used for all index property names

See Also:
Constant Field Values

INDEX_ID

static final String INDEX_ID
A property name used to specify index id

See Also:
Constant Field Values

INDEX_LEGACY_TIMESTAMP

static final 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 String INDEX_TIMESTAMP
A property name used to specify index timtestamp

See Also:
Constant Field Values

INDEX_CHUNK_PREFIX

static final String INDEX_CHUNK_PREFIX
A prefix used to specify an incremental update chunk name

See Also:
Constant Field Values

INDEX_TIME_FORMAT

static final String INDEX_TIME_FORMAT
A date format used for index timestamp

See Also:
Constant Field Values

INDEX_TIME_DAY_FORMAT

static final String INDEX_TIME_DAY_FORMAT
A date format used for incremental update chunk names

See Also:
Constant Field Values

INDEX_CHUNK_COUNTER

static final String INDEX_CHUNK_COUNTER
A counter used to id the chunks

See Also:
Constant Field Values

INDEX_CHAIN_ID

static final 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

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

void updateTimestamp()
                     throws IOException
Throws:
IOException

updateTimestamp

void updateTimestamp(boolean save)
                     throws IOException
Throws:
IOException

updateTimestamp

void updateTimestamp(boolean save,
                     Date date)
                     throws IOException
Throws:
IOException

getSize

int getSize()
            throws IOException
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

getIndexReader

org.apache.lucene.index.IndexReader getIndexReader()
                                                   throws IOException
Returns the Lucene IndexReader of this context.

Returns:
reader
Throws:
IOException

getIndexSearcher

org.apache.lucene.search.IndexSearcher getIndexSearcher()
                                                        throws IOException
Returns the Lucene IndexSearcher of this context.

Returns:
searcher
Throws:
IOException

getIndexWriter

org.apache.lucene.index.IndexWriter getIndexWriter()
                                                   throws IOException
Returns the Lucene IndexWriter 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

void commit()
            throws IOException
Commits changes to context, eventually refreshing readers/searchers too.

Throws:
IOException

rollback

void rollback()
              throws IOException
Rolls back changes to context, eventually refreshing readers/searchers too.

Throws:
IOException

optimize

void optimize()
              throws IOException
Optimizes index

Throws:
IOException

lock

void lock()
Performs a shared locking on this context, guaranteeing that no IndexReader/Searcher/Writer close will occur. But the cost of it is potentially blocking other threads, so stay in critical region locking this context as less as possible.


unlock

void unlock()
Releases the shared lock on this context.


close

void close(boolean deleteFiles)
           throws IOException
Shuts down this context.

Throws:
IOException

purge

void purge()
           throws IOException
Purge (cleans) the context, deletes/empties the index and restores the context to new/empty state.

Throws:
IOException

merge

void merge(org.apache.lucene.store.Directory directory)
           throws IOException
Merges content of given Lucene directory with this context.

Parameters:
directory - - the directory to merge
Throws:
IOException

merge

void merge(org.apache.lucene.store.Directory directory,
           DocumentFilter filter)
           throws IOException
Merges content of given Lucene directory with this context, but filters out the unwanted ones.

Parameters:
directory - - the directory to merge
Throws:
IOException

replace

void replace(org.apache.lucene.store.Directory directory)
             throws IOException
Replaces the Lucene index with the one from supplied directory.

Parameters:
directory -
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

void setAllGroups(Collection<String> groups)
                  throws IOException
Sets all group names stored in the current indexing context

Throws:
IOException

getAllGroups

Set<String> getAllGroups()
                         throws IOException
Gets all group names stored in the current indexing context

Throws:
IOException

setRootGroups

void setRootGroups(Collection<String> groups)
                   throws IOException
Sets root group names stored in the current indexing context

Throws:
IOException

getRootGroups

Set<String> getRootGroups()
                          throws IOException
Gets root group names stored in the current indexing context

Throws:
IOException

rebuildGroups

void rebuildGroups()
                   throws IOException
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:


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.