KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > rc > Configuration


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

17
18 /* $Id: Configuration.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.cms.rc;
21
22 import java.util.Properties JavaDoc;
23
24 import org.apache.log4j.Category;
25
26
27 /**
28  * Reads conf.properties
29  */

30 public class Configuration {
31     private static Category log = Category.getInstance(Configuration.class);
32     
33     private String JavaDoc rcmlDirectory = null;
34     private String JavaDoc backupDirectory = null;
35
36     /**
37      * Creates a new Configuration object.
38      */

39     public Configuration() {
40         String JavaDoc propertiesFileName = "conf.properties";
41         Properties JavaDoc properties = new Properties JavaDoc();
42
43         try {
44             properties.load(Configuration.class.getResourceAsStream(propertiesFileName));
45         } catch (Exception JavaDoc e) {
46             log.fatal(": Failed to load properties from resource: " + propertiesFileName);
47         }
48
49         rcmlDirectory = properties.getProperty("rcmlDirectory");
50         backupDirectory = properties.getProperty("backupDirectory");
51     }
52
53     /**
54      * Get the backup directory
55      *
56      * @return the backup directory
57      */

58     public String JavaDoc getBackupDirectory() {
59         return backupDirectory;
60     }
61
62     /**
63      * Get the rcml directory
64      *
65      * @return the rcml directory
66      */

67     public String JavaDoc getRcmlDirectory() {
68         return rcmlDirectory;
69     }
70 }
71
Popular Tags