KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > javabb > infra > Configuration


1 package org.javabb.infra;
2
3
4
5 import java.io.File JavaDoc;
6 import java.io.FileInputStream JavaDoc;
7 import java.io.FileNotFoundException JavaDoc;
8
9 /*
10  * Copyright 2004 JavaFree.org
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24
25 /**
26  * $Id: Configuration.java,v 1.13.6.1.2.2 2006/04/17 17:47:15 daltoncamargo Exp $
27  * @author Dalton Camargo - <a HREF="mailto:dalton@javabb.org">dalton@javabb.org </a>
28  */

29 public class Configuration {
30
31     public static String JavaDoc realPath;
32     
33     /********* CONFIG APP ************/
34     public static String JavaDoc showProperties = "";
35     public String JavaDoc theme = "";
36     public String JavaDoc domain = "";
37     public String JavaDoc forumName = "";
38     public String JavaDoc lang = "";
39     public String JavaDoc dateFormat = "";
40     public String JavaDoc timeFormat = "";
41     public String JavaDoc buttonLang = "";
42     public Integer JavaDoc topicsPage;
43     public Integer JavaDoc postsPage;
44     public String JavaDoc adminMail = "";
45     public String JavaDoc smtpServerHost = "";
46     public String JavaDoc smtpServerUserName = "";
47     public String JavaDoc smtpServerUserPassword = "";
48     
49     public String JavaDoc emailNofityTopic = "";
50     public String JavaDoc floodControl = "";
51     public String JavaDoc forumAnnounceText = "";
52
53     public Configuration() {
54         try {
55             String JavaDoc realPath = Configuration.realPath;
56             
57             if (realPath != null) {
58                 FileInputStream JavaDoc file = new FileInputStream JavaDoc(realPath + File.separator
59                         +"WEB-INF"+ File.separator
60                         +"appconf" + File.separator + "javabb.properties");
61
62                 MaintainProperties maintain = new MaintainProperties(file);
63
64                 /********* LOADING PROPERTIES ************/
65                 showProperties = maintain.getProperty("config.show.property");
66                 theme = maintain.getProperty("config.forum.theme");
67                 domain = maintain.getProperty("config.forum.domain");
68                 forumName = maintain.getProperty("config.forum.forum.name");
69                 lang = maintain.getProperty("config.forum.lang");
70                 dateFormat = maintain.getProperty("config.forum.date.format");
71                 timeFormat = maintain.getProperty("config.forum.time.format");
72                 buttonLang = maintain.getProperty("config.forum.button.lang");
73                 topicsPage = new Integer JavaDoc(maintain.getProperty("config.forum.topics.page"));
74                 postsPage = new Integer JavaDoc(maintain.getProperty("config.forum.posts.page"));
75                 smtpServerHost = maintain.getProperty("config.forum.smtp.server.host");
76                 smtpServerUserName = maintain.getProperty("config.forum.smtp.server.user");
77                 smtpServerUserPassword = maintain.getProperty("config.forum.smtp.server.senha");
78                 adminMail = maintain.getProperty("config.forum.admin.mail");
79                 emailNofityTopic = maintain.getProperty("config.email.notify.topic");
80                 floodControl = maintain.getProperty("config.forum.flood_control");
81                 forumAnnounceText = maintain.getProperty("config.forum.posts.announce.text");
82
83
84             }
85         } catch (FileNotFoundException JavaDoc e) {
86             e.printStackTrace();
87         } catch (Exception JavaDoc e) {
88             e.printStackTrace();
89         }
90     }
91
92     
93     
94     
95     //Just to Velocity Template Engine Integration
96
/**
97      * @return Returns the adminMail.
98      */

99     public String JavaDoc getAdminMail() {
100         return adminMail;
101     }
102     /**
103      * @param adminMail The adminMail to set.
104      */

105     public void setAdminMail(String JavaDoc adminMail) {
106         this.adminMail = adminMail;
107     }
108     /**
109      * @return Returns the buttonLang.
110      */

111     public String JavaDoc getButtonLang() {
112         return buttonLang;
113     }
114     /**
115      * @param buttonLang The buttonLang to set.
116      */

117     public void setButtonLang(String JavaDoc buttonLang) {
118         this.buttonLang = buttonLang;
119     }
120     /**
121      * @return Returns the dateFormat.
122      */

123     public String JavaDoc getDateFormat() {
124         return dateFormat;
125     }
126     /**
127      * @param dateFormat The dateFormat to set.
128      */

129     public void setDateFormat(String JavaDoc dateFormat) {
130         this.dateFormat = dateFormat;
131     }
132     /**
133      * @return Returns the domain.
134      */

135     public String JavaDoc getDomain() {
136         return domain;
137     }
138     /**
139      * @param domain The domain to set.
140      */

141     public void setDomain(String JavaDoc domain) {
142         this.domain = domain;
143     }
144     /**
145      * @return Returns the emailNofityTopic.
146      */

147     public String JavaDoc getEmailNofityTopic() {
148         return emailNofityTopic;
149     }
150     /**
151      * @param emailNofityTopic The emailNofityTopic to set.
152      */

153     public void setEmailNofityTopic(String JavaDoc emailNofityTopic) {
154         this.emailNofityTopic = emailNofityTopic;
155     }
156     /**
157      * @return Returns the forumName.
158      */

159     public String JavaDoc getForumName() {
160         return forumName;
161     }
162     /**
163      * @param forumName The forumName to set.
164      */

165     public void setForumName(String JavaDoc forumName) {
166         this.forumName = forumName;
167     }
168     /**
169      * @return Returns the lang.
170      */

171     public String JavaDoc getLang() {
172         return lang;
173     }
174     /**
175      * @param lang The lang to set.
176      */

177     public void setLang(String JavaDoc lang) {
178         this.lang = lang;
179     }
180     /**
181      * @return Returns the postsPage.
182      */

183     public Integer JavaDoc getPostsPage() {
184         return postsPage;
185     }
186     /**
187      * @param postsPage The postsPage to set.
188      */

189     public void setPostsPage(Integer JavaDoc postsPage) {
190         this.postsPage = postsPage;
191     }
192     /**
193      * @return Returns the smtpServerHost.
194      */

195     public String JavaDoc getSmtpServerHost() {
196         return smtpServerHost;
197     }
198     /**
199      * @param smtpServerHost The smtpServerHost to set.
200      */

201     public void setSmtpServerHost(String JavaDoc smtpServerHost) {
202         this.smtpServerHost = smtpServerHost;
203     }
204     /**
205      * @return Returns the smtpServerUserName.
206      */

207     public String JavaDoc getSmtpServerUserName() {
208         return smtpServerUserName;
209     }
210     /**
211      * @param smtpServerUserName The smtpServerUserName to set.
212      */

213     public void setSmtpServerUserName(String JavaDoc smtpServerUserName) {
214         this.smtpServerUserName = smtpServerUserName;
215     }
216     /**
217      * @return Returns the smtpServerUserPassword.
218      */

219     public String JavaDoc getSmtpServerUserPassword() {
220         return smtpServerUserPassword;
221     }
222     /**
223      * @param smtpServerUserPassword The smtpServerUserPassword to set.
224      */

225     public void setSmtpServerUserPassword(String JavaDoc smtpServerUserPassword) {
226         this.smtpServerUserPassword = smtpServerUserPassword;
227     }
228     /**
229      * @return Returns the theme.
230      */

231     public String JavaDoc getTheme() {
232         return theme;
233     }
234     /**
235      * @param theme The theme to set.
236      */

237     public void setTheme(String JavaDoc theme) {
238         this.theme = theme;
239     }
240     /**
241      * @return Returns the timeFormat.
242      */

243     public String JavaDoc getTimeFormat() {
244         return timeFormat;
245     }
246     /**
247      * @param timeFormat The timeFormat to set.
248      */

249     public void setTimeFormat(String JavaDoc timeFormat) {
250         this.timeFormat = timeFormat;
251     }
252     /**
253      * @return Returns the topicsPage.
254      */

255     public Integer JavaDoc getTopicsPage() {
256         return topicsPage;
257     }
258     /**
259      * @param topicsPage The topicsPage to set.
260      */

261     public void setTopicsPage(Integer JavaDoc topicsPage) {
262         this.topicsPage = topicsPage;
263     }
264 }
Popular Tags