TreebuildConfig.java: implemented own cachingmaster
authorEnrico Weigelt, metux IT service <[email protected]>
Fri, 6 Aug 2010 03:49:58 +0000 (6 05:49 +0200)
committerEnrico Weigelt, metux IT service <[email protected]>
Fri, 6 Aug 2010 03:49:58 +0000 (6 05:49 +0200)
base/TreebuildConfig.java

index f573c27..6557c0b 100644 (file)
@@ -2,7 +2,9 @@
 package org.de.metux.treebuild.base;
 
 import java.io.File;
+import java.util.Properties;
 import org.de.metux.util.StrUtil;
+import org.de.metux.datasource.Cached_TextDB_Loader;
 import org.de.metux.propertylist.IPropertylist;
 import org.de.metux.propertylist.Propertylist;
 import org.de.metux.propertylist.EIllegalValue;
@@ -16,6 +18,16 @@ public class TreebuildConfig
     public ToolConfig   unitool;
     
     public static final String cf_unitool_config = "@TARGET/unitool-config";
+    private Cached_TextDB_Loader textdb_loader = new Cached_TextDB_Loader();
+
+    private boolean __load_properties_top(String filename)
+    {
+       Properties pr = textdb_loader.load(filename);
+       if (pr == null)
+           return false;
+       conf.loadProperties_top(pr);
+       return true;
+    }
 
     public TreebuildConfig(File f)
        throws EPIException
@@ -23,7 +35,7 @@ public class TreebuildConfig
        String filename = f.getAbsolutePath();
        System.err.println("Using treebuild config file: "+filename);
        conf = new Propertylist();
-       if (!conf.loadTextDB_top(filename))
+       if (!__load_properties_top(filename))
            throw new RuntimeException("coud not load treebuild config: "+filename);
 
        //  now load the unitool config