KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > folder > mbox > CachedMboxFolder


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.mbox;
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 public class CachedMboxFolder extends AbstractLocalFolder {
28
29     
30     
31     /**
32      * Constructs the CachedMboxFolder.java.
33      *
34      * @param item
35      * @param path
36      */

37     public CachedMboxFolder(FolderItem item, String JavaDoc path) {
38         super(item, path);
39
40         // enable lucene search index by default
41
boolean enableLucene = getConfiguration().getBooleanWithDefault("property",
42                 "enable_lucene", true);
43         if (enableLucene) {
44             getSearchEngine().setNonDefaultEngine(new LuceneQueryEngine(this));
45         }
46     }
47
48     /**
49      * Constructs the CachedMboxFolder.java.
50      *
51      * @param name
52      * @param type
53      * @param path
54      */

55     public CachedMboxFolder(String JavaDoc name, String JavaDoc type, String JavaDoc path) {
56         super(name, type, path);
57
58         IFolderItem item = getConfiguration();
59         item.setString("property", "accessrights", "user");
60         item.setString("property", "subfolder", "true");
61
62         boolean enableLucene = getConfiguration().getBooleanWithDefault("property",
63                 "enable_lucene", false);
64         if (enableLucene) {
65             getSearchEngine().setNonDefaultEngine(new LuceneQueryEngine(this));
66         }
67     }
68
69     
70     
71     /**
72      * @see org.columba.mail.folder.AbstractLocalFolder#getDataStorageInstance()
73      */

74     public IDataStorage getDataStorageInstance() {
75         if (dataStorage == null) {
76             dataStorage = new MboxDataStorage(this);
77         }
78
79         return dataStorage;
80     }
81
82     /**
83      * @see org.columba.mail.folder.AbstractMessageFolder#save()
84      */

85     public void save() throws Exception JavaDoc {
86         super.save();
87         ((MboxDataStorage)getDataStorageInstance()).save();
88     }
89 }
90
Popular Tags