diff flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java @ 184:4ab2c3bd474c

Added parsing of PEGEL.GLT files. flys-backend/trunk@1501 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 17 Mar 2011 15:21:50 +0000
parents 31895d24387e
children cf8cbcb6a10d
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Thu Mar 17 10:47:31 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Thu Mar 17 15:21:50 2011 +0000
@@ -1,15 +1,28 @@
 package de.intevation.flys.importer;
 
+import java.util.List;
+
 import java.io.File;
+import java.io.IOException;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.utils.FileTools;
 
 public class ImportRiver
 {
+    private static Logger log = Logger.getLogger(ImportRiver.class);
+
+    public static final String PEGEL_GLT = "PEGEL.GLT";
+
     protected String name;
 
     protected File   wstFile;
 
     protected File   bbInfoFile;
 
+    protected List<ImportGauge> gauges;
+
     public ImportRiver() {
     }
 
@@ -42,5 +55,20 @@
     public void setBBInfo(File bbInfoFile) {
         this.bbInfoFile = bbInfoFile;
     }
+
+    public void parseGauges() throws IOException {
+        File gltFile = new File(wstFile.getParentFile(), PEGEL_GLT);
+        gltFile = FileTools.repair(gltFile);
+
+        if (!gltFile.isFile() || !gltFile.canRead()) {
+            log.warn("cannot read gauges from '" + gltFile + "'");
+            return;
+        }
+
+        PegelGltParser pgltp = new PegelGltParser();
+        pgltp.parse(gltFile);
+
+        gauges = pgltp.getGauges();
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org