001: /**********************************************************************************
002:
003: Feedzeo!
004: A free and open source RSS/Atom/RDF feed aggregator
005:
006: Copyright (C) 2005-2006 Anand Rao (anandrao@users.sourceforge.net)
007:
008: This library is free software; you can redistribute it and/or
009: modify it under the terms of the GNU Lesser General Public
010: License as published by the Free Software Foundation; either
011: version 2.1 of the License, or (at your option) any later version.
012:
013: This library is distributed in the hope that it will be useful,
014: but WITHOUT ANY WARRANTY; without even the implied warranty of
015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: Lesser General Public License for more details.
017:
018: You should have received a copy of the GNU Lesser General Public
019: License along with this library; if not, write to the Free Software
020: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
021:
022: ************************************************************************************/package app;
023:
024: import java.util.*;
025:
026: import util.*;
027:
028: class ConfigFileKey {
029: static String FEED_FILE_KEY = "FeedFile";
030: static String STYLE_FILE_KEY = "StyleFile";
031: static String LAYOUT_FILE_KEY = "LayoutFile";
032: static String WEBROOT_KEY = "Webroot";
033: static String HTTP_PORT_KEY = "HttpServerPort";
034: static String REFRESH_INTERVAL = "RefreshIntervalMins";
035: static String LAUNCH_BROWSER_KEY = "LaunchBrowserOnStartup";
036: };
037:
038: /**
039: *
040: * @author Anand Rao
041: * Class reads the config.txt file stores the settings for use by other parts
042: * of the application
043: */
044: public class AppConfigData {
045:
046: // configuration parameters stored in config.txt
047:
048: static String feedFileName;
049: static String styleFileName;
050: static String layoutFileName;
051: static String webRootDir;
052: static int httpPort;
053: static int refreshInterval;
054: static String launchBrowser;
055:
056: public AppConfigData(String configFileName) {
057:
058: PropertyFile p = new PropertyFile(configFileName, 'r');
059:
060: feedFileName = p.readProperty(ConfigFileKey.FEED_FILE_KEY);
061: styleFileName = p.readProperty(ConfigFileKey.STYLE_FILE_KEY);
062: layoutFileName = p.readProperty(ConfigFileKey.LAYOUT_FILE_KEY);
063: webRootDir = p.readProperty(ConfigFileKey.WEBROOT_KEY);
064: httpPort = Integer.parseInt(p
065: .readProperty(ConfigFileKey.HTTP_PORT_KEY));
066: refreshInterval = Integer.parseInt(p
067: .readProperty(ConfigFileKey.REFRESH_INTERVAL));
068: launchBrowser = p
069: .readProperty(ConfigFileKey.LAUNCH_BROWSER_KEY);
070:
071: System.out.println(" Application Configuration settings := ");
072: System.out.println(" feedFileName:" + feedFileName + "\n"
073: + " styleFileName:" + styleFileName + "\n"
074: + " layoutFileName:" + layoutFileName + "\n"
075: + " webRootDir:" + webRootDir + "\n" + " httpPort:"
076: + httpPort + "\n" + " launchBrowser:" + launchBrowser);
077:
078: p.close();
079: }
080:
081: public String getFeedFileName() {
082: return feedFileName;
083: }
084:
085: public String getStyleFileName() {
086: return styleFileName;
087: }
088:
089: public String getLayoutFileName() {
090: return layoutFileName;
091: }
092:
093: public String getWebRootDir() {
094: return webRootDir;
095: }
096:
097: public int getHttpPort() {
098: return httpPort;
099: }
100:
101: public int getRefreshInterval() {
102: return refreshInterval;
103: }
104:
105: public boolean IsLaunchBrowserOnStartup() {
106: if (launchBrowser.equalsIgnoreCase("true"))
107: return true;
108: return false;
109: }
110:
111: }
|