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.store;
18:
19: import java.io.IOException;
20:
21: import org.apache.commons.logging.Log;
22: import org.apache.commons.logging.LogFactory;
23: import org.apache.lucene.store.Directory;
24: import org.compass.core.engine.SearchEngine;
25: import org.compass.core.engine.SearchEngineException;
26: import org.compass.core.engine.event.SearchEngineEventManager;
27:
28: /**
29: * Base class for different {@link org.compass.core.lucene.engine.store.DirectoryStore} implementations.
30: *
31: * @author kimchy
32: */
33: public abstract class AbstractDirectoryStore implements DirectoryStore {
34:
35: protected final transient Log log = LogFactory.getLog(getClass());
36:
37: public void closeDirectory(Directory dir, String subContext,
38: String subIndex) throws SearchEngineException {
39: try {
40: dir.close();
41: } catch (IOException e) {
42: log
43: .warn("Failed to close direcrtory for sub context ["
44: + subContext
45: + "] and sub index ["
46: + subIndex + "]");
47: }
48: }
49:
50: public Boolean indexExists(Directory dir)
51: throws SearchEngineException {
52: return null;
53: }
54:
55: public void deleteIndex(Directory dir, String subContext,
56: String subIndex) throws SearchEngineException {
57: }
58:
59: public void cleanIndex(Directory dir, String subContext,
60: String subIndex) throws SearchEngineException {
61: }
62:
63: public void performScheduledTasks(Directory dir, String subContext,
64: String subIndex) throws SearchEngineException {
65: }
66:
67: public void registerEventListeners(SearchEngine searchEngine,
68: SearchEngineEventManager eventManager) {
69: }
70:
71: public CopyFromHolder beforeCopyFrom(String subContext,
72: String subIndex, Directory dir)
73: throws SearchEngineException {
74: return new CopyFromHolder();
75: }
76:
77: public void afterSuccessfulCopyFrom(String subContext,
78: String subIndex, CopyFromHolder holder)
79: throws SearchEngineException {
80: }
81:
82: public void afterFailedCopyFrom(String subContext, String subIndex,
83: CopyFromHolder holder) throws SearchEngineException {
84: }
85:
86: public void close() {
87: }
88: }
|