~verterok/bzr-jira/trunk

« back to all changes in this revision

Viewing changes to src/main/java/com/atlassian/jira/plugin/ext/bazaar/revisions/LuceneIndexAccessor.java

  • Committer: Guillermo Gonzalez
  • Date: 2008-10-20 22:22:57 UTC
  • Revision ID: guillo.gonzo@gmail.com-20081020222257-123y4n1oj2sl1cp0
 * initial code import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.atlassian.jira.plugin.ext.bazaar.revisions;
 
2
 
 
3
import org.apache.lucene.analysis.Analyzer;
 
4
import org.apache.lucene.index.IndexReader;
 
5
import org.apache.lucene.index.IndexWriter;
 
6
 
 
7
import com.atlassian.jira.issue.index.IndexException;
 
8
 
 
9
/**
 
10
 * Small abstraction for Lucene index reader and writer acquisition. Helps
 
11
 * contain the dependencies of RevisionIndexer on the internals of lucene and
 
12
 * specifically the knock-on effects of static references to Bonnie classes in
 
13
 * LuceneUtils. Introduced to aid testability.
 
14
 * 
 
15
 */
 
16
interface LuceneIndexAccessor {
 
17
        /**
 
18
         * Gets a Lucene {@link org.apache.lucene.index.IndexReader} at the given
 
19
         * path.
 
20
         * 
 
21
         * @param path
 
22
         *            the path.
 
23
         * @return the IndexReader.
 
24
         * @throws IndexException
 
25
         *             if there's some problem getting the reader.
 
26
         */
 
27
        IndexReader getIndexReader(String path) throws IndexException;
 
28
 
 
29
        /**
 
30
         * Gets a Lucene {@link org.apache.lucene.index.IndexWriter} at the given
 
31
         * path.
 
32
         * 
 
33
         * @param path
 
34
         *            the path.
 
35
         * @param create
 
36
         *            if true, then create if absent.
 
37
         * @param analyzer
 
38
         *            the {@link org.apache.lucene.analysis.Analyzer} to use.
 
39
         * @throws IndexException
 
40
         *             if there's some problem getting the writer.
 
41
         * @return the IndexWriter.
 
42
         */
 
43
        IndexWriter getIndexWriter(String path, boolean create, Analyzer analyzer)
 
44
                        throws IndexException;
 
45
}