KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ve > luz > ica > jackass > util > ConfigurationManager


1 /*
2  * Copyright (c) 2003 by The Jackass Team
3  * Licensed under the Open Software License version 2.0
4  */

5 package ve.luz.ica.jackass.util;
6
7 import java.io.InputStream JavaDoc;
8 import java.util.Properties JavaDoc;
9
10 import org.apache.commons.logging.Log;
11 import org.apache.commons.logging.LogFactory;
12
13 /**
14  * This class manages configuration features.
15  * Currently, it provides access to the property
16  * configuration file.
17  * @author Carlos Arévalo, Guido Urdaneta
18  */

19 public final class ConfigurationManager
20 {
21     /**
22      * The name of the temp path property
23      */

24     public static final String JavaDoc TEMP_PATH_PROPERTY = "temp_path";
25
26     /**
27      * The name of the deployment path property
28      */

29     public static final String JavaDoc DEPLOYMENT_PATH_PROPERTY = "deployment_path";
30
31     private static final Log LOG = LogFactory.getLog(ConfigurationManager.class);
32
33     private static final String JavaDoc ERR_READ_PROPERTIES = "Properties file not found";
34     private static final String JavaDoc DEFAULT_PROPERTIES_FILE = "jackass.properties";
35
36     private static Properties JavaDoc configFile;
37
38     static
39     {
40         try
41         {
42             configFile = new Properties JavaDoc();
43             InputStream JavaDoc in = ClassLoader.getSystemResourceAsStream(DEFAULT_PROPERTIES_FILE);
44             configFile.load(in);
45         }
46         catch (Exception JavaDoc e)
47         {
48             if (LOG.isErrorEnabled()) LOG.error(ERR_READ_PROPERTIES, e);
49             throw new IllegalArgumentException JavaDoc(ERR_READ_PROPERTIES + e.getMessage());
50         }
51     }
52
53     /**
54      * Private constructor
55      */

56     private ConfigurationManager()
57     {
58     }
59
60     /**
61      * Returns a Properties object with the configuration file properties.
62      * @return the configuration file.
63      */

64     public static Properties JavaDoc getConfigFile()
65     {
66         return configFile;
67     }
68
69 }
70
Popular Tags