KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mvnforum > MVNForumFactoryConfig


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/MVNForumFactoryConfig.java,v 1.15 2006/04/14 17:05:25 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.15 $
5  * $Date: 2006/04/14 17:05:25 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding mvnForum MUST remain
12  * intact in the scripts and in the outputted HTML.
13  * The "powered by" text/logo with a link back to
14  * http://www.mvnForum.com and http://www.MyVietnam.net in
15  * the footer of the pages MUST remain visible when the pages
16  * are viewed on the internet or intranet.
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31  *
32  * Support can be obtained from support forums at:
33  * http://www.mvnForum.com/mvnforum/index
34  *
35  * Correspondence and Marketing Questions can be sent to:
36  * info at MyVietnam net
37  *
38  * @author: Luis Miguel Hernanz
39  * @author: Minh Nguyen
40  */

41 package com.mvnforum;
42
43 import java.io.File JavaDoc;
44
45 import net.myvietnam.mvncore.configuration.DOM4JConfiguration;
46 import org.apache.commons.logging.Log;
47 import org.apache.commons.logging.LogFactory;
48 import net.myvietnam.mvncore.util.FileUtil;
49
50 /**
51  * Class that loads and makes accesible the factory configuration.
52  *
53  * @author <a HREF="luish@germinus.com">Luis Miguel Hernanz</a>
54  * @version $Revision: 1.15 $
55  */

56 public class MVNForumFactoryConfig {
57
58     private static Log log = LogFactory.getLog(MVNForumFactoryConfig.class);
59
60     private static final String JavaDoc OPTION_FILE_NAME = "mvnforum.xml";
61
62     private static String JavaDoc authenticatorClassName = null;
63     private static String JavaDoc memberManagerClassName = "com.mvnforum.db.jdbc.MemberDAOImplJDBC";
64     private static String JavaDoc onlineUserFactoryClassName = "com.mvnforum.auth.OnlineUserFactoryImpl";
65     private static String JavaDoc requestProcessorClassName = "com.mvnforum.RequestProcessorDefault";
66     private static String JavaDoc luceneAnalyzerClassName = "org.apache.lucene.analysis.standard.StandardAnalyzer";
67     private static String JavaDoc binaryStorageClassName = "com.mvnforum.impl.BinaryStorageImplDisk";
68
69     public static String JavaDoc getMemberManagerClassName() {
70         return memberManagerClassName;
71     }
72
73     public static String JavaDoc getOnlineUserFactoryClassName() {
74         return onlineUserFactoryClassName;
75     }
76
77     public static String JavaDoc getAuthenticatorClassName() {
78         return authenticatorClassName;
79     }
80
81     public static String JavaDoc getRequestProcessorClassName() {
82         return requestProcessorClassName;
83     }
84
85     public static String JavaDoc getLuceneAnalyzerClassName() {
86         return luceneAnalyzerClassName;
87     }
88    
89     public static String JavaDoc getBinaryStorageClassName() {
90         return binaryStorageClassName;
91     }
92     
93     static {
94         try {
95             String JavaDoc strPathName = FileUtil.getServletClassesPath();
96             String JavaDoc configFilename = strPathName + OPTION_FILE_NAME;
97             DOM4JConfiguration conf = new DOM4JConfiguration(new File JavaDoc(configFilename));
98
99             memberManagerClassName = conf.getString("mvnforumfactoryconfig.member_implementation", memberManagerClassName);
100             onlineUserFactoryClassName = conf.getString("mvnforumfactoryconfig.onlineuser_implementation", onlineUserFactoryClassName);
101             authenticatorClassName = conf.getString("mvnforumfactoryconfig.authenticator_implementation", authenticatorClassName);
102             requestProcessorClassName = conf.getString("mvnforumfactoryconfig.requestprocessor_implementation", requestProcessorClassName);
103             luceneAnalyzerClassName = conf.getString("mvnforumfactoryconfig.lucene_analyzer_implementation", luceneAnalyzerClassName);
104             binaryStorageClassName = conf.getString("mvnforumfactoryconfig.binarystorage_implementation", binaryStorageClassName);
105         } catch (Exception JavaDoc e) {
106             log.error("Error loading the factory properties", e);
107         }
108     }
109 }
110
Popular Tags