KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > folder > mh > CachedMHFolder


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
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
20 import org.columba.mail.config.FolderItem;
21 import org.columba.mail.config.IFolderItem;
22 import org.columba.mail.folder.AbstractLocalFolder;
23 import org.columba.mail.folder.IDataStorage;
24 import org.columba.mail.folder.search.LuceneQueryEngine;
25
26 /**
27  * @author freddy
28  *
29  * To change this generated comment edit the template variable "typecomment":
30  * Window>Preferences>Java>Templates.
31  * To enable and disable the creation of type comments go to
32  * Window>Preferences>Java>Code Generation.
33  */

34 @SuppressWarnings JavaDoc({"serial","serial"})
35 public class CachedMHFolder extends AbstractLocalFolder {
36     public CachedMHFolder(FolderItem item, String JavaDoc path) {
37         super(item, path);
38
39         // enable lucene search index by default
40
boolean enableLucene = getConfiguration().getBooleanWithDefault("property",
41                 "enable_lucene", true);
42         if (enableLucene) {
43             getSearchEngine().setNonDefaultEngine(new LuceneQueryEngine(this));
44         }
45     }
46
47     /**
48  * @param type
49  */

50     public CachedMHFolder(String JavaDoc name, String JavaDoc type, String JavaDoc path) {
51         super(name, type, path);
52
53         IFolderItem item = getConfiguration();
54         item.setString("property", "accessrights", "user");
55         item.setString("property", "subfolder", "true");
56         
57         boolean enableLucene = getConfiguration().getBooleanWithDefault("property",
58                 "enable_lucene", false);
59         if (enableLucene) {
60             getSearchEngine().setNonDefaultEngine(new LuceneQueryEngine(this));
61         }
62     }
63
64     
65     public IDataStorage getDataStorageInstance() {
66         if (dataStorage == null) {
67             dataStorage = new MHDataStorage(this);
68         }
69
70         return dataStorage;
71     }
72
73 }
74
Popular Tags