01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16:
17: package org.columba.mail.folder.mh;
18:
19: import org.columba.mail.config.FolderItem;
20: import org.columba.mail.config.IFolderItem;
21: import org.columba.mail.folder.AbstractLocalFolder;
22: import org.columba.mail.folder.IDataStorage;
23: import org.columba.mail.folder.search.LuceneQueryEngine;
24:
25: /**
26: * @author freddy
27: *
28: * To change this generated comment edit the template variable "typecomment":
29: * Window>Preferences>Java>Templates.
30: * To enable and disable the creation of type comments go to
31: * Window>Preferences>Java>Code Generation.
32: */
33: @SuppressWarnings({"serial","serial"})
34: public class CachedMHFolder extends AbstractLocalFolder {
35: public CachedMHFolder(FolderItem item, String path) {
36: super (item, path);
37:
38: // enable lucene search index by default
39: boolean enableLucene = getConfiguration()
40: .getBooleanWithDefault("property", "enable_lucene",
41: true);
42: if (enableLucene) {
43: getSearchEngine().setNonDefaultEngine(
44: new LuceneQueryEngine(this ));
45: }
46: }
47:
48: /**
49: * @param type
50: */
51: public CachedMHFolder(String name, String type, String path) {
52: super (name, type, path);
53:
54: IFolderItem item = getConfiguration();
55: item.setString("property", "accessrights", "user");
56: item.setString("property", "subfolder", "true");
57:
58: boolean enableLucene = getConfiguration()
59: .getBooleanWithDefault("property", "enable_lucene",
60: false);
61: if (enableLucene) {
62: getSearchEngine().setNonDefaultEngine(
63: new LuceneQueryEngine(this ));
64: }
65: }
66:
67: public IDataStorage getDataStorageInstance() {
68: if (dataStorage == null) {
69: dataStorage = new MHDataStorage(this);
70: }
71:
72: return dataStorage;
73: }
74:
75: }
|