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 Details

    • 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:
    • INDEX_REMOTE_PROPERTIES_FILE

      static final String INDEX_REMOTE_PROPERTIES_FILE
      See Also:
    • INDEX_UPDATER_PROPERTIES_FILE

      static final String INDEX_UPDATER_PROPERTIES_FILE
      See Also:
    • INDEX_PACKER_PROPERTIES_FILE

      static final String INDEX_PACKER_PROPERTIES_FILE
      See Also:
    • INDEX_PROPERTY_PREFIX

      static final String INDEX_PROPERTY_PREFIX
      A prefix used for all index property names
      See Also:
    • INDEX_ID

      static final String INDEX_ID
      A property name used to specify index id
      See Also:
    • INDEX_LEGACY_TIMESTAMP

      static final String INDEX_LEGACY_TIMESTAMP
      A property name used to specify legacy index timestamp (the last update time)
      See Also:
    • INDEX_TIMESTAMP

      static final String INDEX_TIMESTAMP
      A property name used to specify index timtestamp
      See Also:
    • INDEX_CHUNK_PREFIX

      static final String INDEX_CHUNK_PREFIX
      A prefix used to specify an incremental update chunk name
      See Also:
    • INDEX_TIME_FORMAT

      static final String INDEX_TIME_FORMAT
      A date format used for index timestamp
      See Also:
    • INDEX_TIME_DAY_FORMAT

      static final String INDEX_TIME_DAY_FORMAT
      A date format used for incremental update chunk names
      See Also:
    • INDEX_CHUNK_COUNTER

      static final String INDEX_CHUNK_COUNTER
      A counter used to id the chunks
      See Also:
    • 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:
  • 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

      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
    • acquireIndexSearcher

      org.apache.lucene.search.IndexSearcher acquireIndexSearcher() throws IOException
      Acquires a fresh instance of IndexSearcher. You have to release the received instance with releaseIndexSearcher(IndexSearcher) otherwise you are about to introduce leak.
      Returns:
      Throws:
      IOException
    • releaseIndexSearcher

      void releaseIndexSearcher(org.apache.lucene.search.IndexSearcher s) throws IOException
      Releases the IndexSearcher instance.
      Parameters:
      s -
      Throws:
      IOException
    • getIndexWriter

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

      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. According to Lucene 3.6+ Javadoc, there is no more sense to optimize, so this method might become "noop".
      Throws:
      IOException
    • 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
    • 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

      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: