01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.core.lucene.engine.transaction;
18:
19: import org.apache.lucene.analysis.Analyzer;
20: import org.compass.core.Resource;
21: import org.compass.core.engine.SearchEngineException;
22: import org.compass.core.engine.SearchEngineHits;
23: import org.compass.core.engine.SearchEngineInternalSearch;
24: import org.compass.core.engine.SearchEngineQuery;
25: import org.compass.core.lucene.engine.LuceneSearchEngine;
26: import org.compass.core.spi.InternalResource;
27: import org.compass.core.spi.ResourceKey;
28:
29: /**
30: * A Lucene transaction interface. All Lucene based transactions must implement
31: * the interface for the LuceneSearchEngine to work with them.
32: *
33: * @author kimchy
34: */
35: public interface LuceneSearchEngineTransaction {
36:
37: void configure(LuceneSearchEngine searchEngine);
38:
39: boolean isDirty();
40:
41: void begin() throws SearchEngineException;
42:
43: void prepare() throws SearchEngineException;
44:
45: void commit(boolean onePhase) throws SearchEngineException;
46:
47: void rollback() throws SearchEngineException;
48:
49: /**
50: * Supported only in batch insert transacitons.
51: */
52: void flush() throws SearchEngineException;
53:
54: void create(final InternalResource resource, Analyzer analyzer)
55: throws SearchEngineException;
56:
57: void update(final InternalResource resource, Analyzer analyzer)
58: throws SearchEngineException;
59:
60: void delete(final ResourceKey resourceKey)
61: throws SearchEngineException;
62:
63: SearchEngineHits find(SearchEngineQuery query)
64: throws SearchEngineException;
65:
66: Resource[] get(ResourceKey resourceKey)
67: throws SearchEngineException;
68:
69: SearchEngineInternalSearch internalSearch(String[] subIndexes,
70: String[] aliases) throws SearchEngineException;
71: }
|