changeset 2804:68d1661a57cf

Added a new config option to specify a INFO.gew file by system property. flys-backend/trunk@4182 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 29 Mar 2012 07:24:15 +0000
parents cdc084071c14
children a55b7b35cc3a
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/Config.java flys-backend/src/main/java/de/intevation/flys/importer/Importer.java
diffstat 3 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Mon Mar 19 06:11:38 2012 +0000
+++ b/flys-backend/ChangeLog	Thu Mar 29 07:24:15 2012 +0000
@@ -1,3 +1,12 @@
+2012-03-29  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/Config.java: Added a config
+	  option "flys.backend.importer.infogew.file" to set the path of an
+	  INFO.gew file.
+
+	* src/main/java/de/intevation/flys/importer/Importer.java: Read the path
+	  to the INFO.gew from the new config option and try to parse it.
+
 2012-03-19  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/schema/oracle-spatial.sql: Set the type of 'lower' and 'upper' column
--- a/flys-backend/src/main/java/de/intevation/flys/importer/Config.java	Mon Mar 19 06:11:38 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/Config.java	Thu Mar 29 07:24:15 2012 +0000
@@ -5,6 +5,9 @@
     public static final String DRY_RUN =
         "flys.backend.importer.dry.run";
 
+    public static final String INFO_GEW_FILE =
+        "flys.backend.importer.infogew.file";
+
     public static final String ANNOTATION_TYPES =
         "flys.backend.importer.annotation.types";
 
@@ -47,6 +50,10 @@
         return Boolean.getBoolean(DRY_RUN);
     }
 
+    public String getInfoGewFile() {
+        return System.getProperty(INFO_GEW_FILE);
+    }
+
     public String getAnnotationTypes() {
         return System.getProperty(ANNOTATION_TYPES);
     }
--- a/flys-backend/src/main/java/de/intevation/flys/importer/Importer.java	Mon Mar 19 06:11:38 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/Importer.java	Thu Mar 29 07:24:15 2012 +0000
@@ -125,6 +125,17 @@
             }
         }
 
+        String gew = Config.INSTANCE.getInfoGewFile();
+        if (gew != null && gew.length() > 0) {
+            log.info("parsing info gew file: " + gew);
+            try {
+                infoGewParser.parse(new File(gew));
+            }
+            catch (IOException ioe) {
+                log.error("cannot parse file: " + gew);
+            }
+        }
+
         if (!Config.INSTANCE.dryRun()) {
             new Importer(infoGewParser.getRivers()).writeToDatabase();
         }

http://dive4elements.wald.intevation.org