Manages storage and indexing of feed and entry documents, and delegates storage of resources to another Storage instance. @author mpowers
| 64 | * @author mpowers |
| 65 | */ |
| 66 | public class LuceneStorage implements Storage { |
| 67 | |
| 68 | /** |
| 69 | * Shared abdera instance. |
| 70 | */ |
| 71 | private Abdera abdera; |
| 72 | |
| 73 | /** |
| 74 | * Deletable storage delegate: used for caching feeds fetched from other |
| 75 | * servers. Basically, if this storage went away, it would be no big deal. |
| 76 | */ |
| 77 | private Storage cacheStorage; |
| 78 | |
| 79 | /** |
| 80 | * Persistent storage delegate: used for feeds managed by this server. This |
| 81 | * is basically the user's primary backup of all entries created. |
| 82 | */ |
| 83 | private Storage persistentStorage; |
| 84 | |
| 85 | /* |
| 86 | * Lucene readers/writers are thread-safe and shared instances are |
| 87 | * recommended. |
| 88 | */ |
| 89 | |
| 90 | private IndexWriter writer; |
| 91 | private IndexReader reader; |
| 92 | private Analyzer analyzer; |
| 93 | |
| 94 | /** |
| 95 | * Default constructor manages individual feed, entry, and resource |
| 96 | * documents with a FileStorage. |
| 97 | * |
| 98 | * @throws IOException |
| 99 | */ |
| 100 | public LuceneStorage() throws IOException { |
| 101 | this(new FileStorage()); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Manages index and calls to the specified storage delegate to handle |
| 106 | * individual feed, entry, and resource persistence. |
| 107 | * |
| 108 | * @param delegate |
| 109 | * @throws IOException |
| 110 | */ |
| 111 | public LuceneStorage(Storage delegate) throws IOException { |
| 112 | this(delegate, null); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Manages index and calls to the specified storage delegate to handle |
| 117 | * individual feed, entry, and resource persistence. Any feeds managed by |
| 118 | * this server will call to persistent storage rather than cache storage. |
| 119 | * |
| 120 | * @param delegate |
| 121 | * @throws IOException |
| 122 | */ |
| 123 | public LuceneStorage(Storage cache, Storage persistent) throws IOException { |
nothing calls this directly
no outgoing calls
no test coverage detected