diff artifact-database/src/main/java/de/intevation/artifactdatabase/Config.java @ 59:8cd770330f1b

Added path to chart template and added a method to retrieve its configuration. artifacts/trunk@361 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 23 Nov 2009 16:56:47 +0000
parents c2fc85e55f9f
children 911c684c8a1c
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/Config.java	Mon Nov 23 11:15:44 2009 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/Config.java	Mon Nov 23 16:56:47 2009 +0000
@@ -33,6 +33,8 @@
 
     public static final String CONFIG_FILE  = "conf.xml";
 
+    public static final String CHART_TEMPLATE = "charttemplate.xml";
+
     public static final String CONFIG_DIR_PLACEHOLDER = "${artifacts.config.dir}";
 
     private static Document config;
@@ -42,11 +44,15 @@
 
     public static synchronized final Document getConfig() {
         if (config == null) {
-            config = loadConfig();
+            config = loadConfig(CONFIG_FILE);
         }
         return config;
     }
 
+    public static Document getChartTemplate() {
+        return loadConfig(CHART_TEMPLATE);
+    }
+
     public static File getConfigDirectory() {
         String configDirString = System.getProperty(CONFIG_DIR);
 
@@ -67,11 +73,11 @@
         return path.replace(CONFIG_DIR_PLACEHOLDER, configDir);
     }
 
-    private static Document loadConfig() {
+    private static Document loadConfig(String config) {
 
         File configDir = getConfigDirectory();
 
-        File file = new File(configDir, CONFIG_FILE);
+        File file = new File(configDir, config);
 
         if (!file.canRead() && !file.isFile()) {
             logger.error("Cannot read config file '"

http://dive4elements.wald.intevation.org