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.apache.lucene.store.jdbc.dialect;
18:
19: import java.util.Iterator;
20: import java.util.Map;
21:
22: import org.apache.lucene.store.jdbc.JdbcDirectorySettings;
23: import org.apache.lucene.store.jdbc.JdbcFileEntrySettings;
24: import org.apache.lucene.store.jdbc.index.FileJdbcIndexOutput;
25: import org.apache.lucene.store.jdbc.index.RAMAndFileJdbcIndexOutput;
26: import org.apache.lucene.store.jdbc.index.RAMJdbcIndexOutput;
27: import org.apache.lucene.store.jdbc.index.oracle.OracleFileJdbcIndexOutput;
28: import org.apache.lucene.store.jdbc.index.oracle.OracleRAMAndFileJdbcIndexOutput;
29: import org.apache.lucene.store.jdbc.index.oracle.OracleRAMJdbcIndexOutput;
30:
31: /**
32: * An Oralce 9i dialect, changes all to work with Oracle related
33: * index output.
34: *
35: * @author kimchy
36: */
37: public class Oracle9Dialect extends OracleDialect {
38:
39: public void processSettings(JdbcDirectorySettings settings) {
40: Map filesEntrySettings = settings.getFileEntrySettings();
41: for (Iterator it = filesEntrySettings.values().iterator(); it
42: .hasNext();) {
43: JdbcFileEntrySettings fileEntrySettings = (JdbcFileEntrySettings) it
44: .next();
45: try {
46: Class indexOutputClass = fileEntrySettings
47: .getSettingAsClass(
48: JdbcFileEntrySettings.INDEX_OUTPUT_TYPE_SETTING,
49: RAMAndFileJdbcIndexOutput.class);
50: if (indexOutputClass
51: .equals(RAMAndFileJdbcIndexOutput.class)) {
52: indexOutputClass = OracleRAMAndFileJdbcIndexOutput.class;
53: } else if (indexOutputClass
54: .equals(RAMJdbcIndexOutput.class)) {
55: indexOutputClass = OracleRAMJdbcIndexOutput.class;
56: } else if (indexOutputClass
57: .equals(FileJdbcIndexOutput.class)) {
58: indexOutputClass = OracleFileJdbcIndexOutput.class;
59: }
60: fileEntrySettings
61: .setClassSetting(
62: JdbcFileEntrySettings.INDEX_OUTPUT_TYPE_SETTING,
63: indexOutputClass);
64: } catch (ClassNotFoundException e) {
65: throw new RuntimeException("Failed to find class", e);
66: }
67: }
68: }
69: }
|