comparison 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
comparison
equal deleted inserted replaced
183:222f4db3430a 184:4ab2c3bd474c
1 package de.intevation.flys.importer; 1 package de.intevation.flys.importer;
2 2
3 import java.util.List;
4
3 import java.io.File; 5 import java.io.File;
6 import java.io.IOException;
7
8 import org.apache.log4j.Logger;
9
10 import de.intevation.flys.utils.FileTools;
4 11
5 public class ImportRiver 12 public class ImportRiver
6 { 13 {
14 private static Logger log = Logger.getLogger(ImportRiver.class);
15
16 public static final String PEGEL_GLT = "PEGEL.GLT";
17
7 protected String name; 18 protected String name;
8 19
9 protected File wstFile; 20 protected File wstFile;
10 21
11 protected File bbInfoFile; 22 protected File bbInfoFile;
23
24 protected List<ImportGauge> gauges;
12 25
13 public ImportRiver() { 26 public ImportRiver() {
14 } 27 }
15 28
16 public ImportRiver(String name, File wstFile, File bbInfoFile) { 29 public ImportRiver(String name, File wstFile, File bbInfoFile) {
40 } 53 }
41 54
42 public void setBBInfo(File bbInfoFile) { 55 public void setBBInfo(File bbInfoFile) {
43 this.bbInfoFile = bbInfoFile; 56 this.bbInfoFile = bbInfoFile;
44 } 57 }
58
59 public void parseGauges() throws IOException {
60 File gltFile = new File(wstFile.getParentFile(), PEGEL_GLT);
61 gltFile = FileTools.repair(gltFile);
62
63 if (!gltFile.isFile() || !gltFile.canRead()) {
64 log.warn("cannot read gauges from '" + gltFile + "'");
65 return;
66 }
67
68 PegelGltParser pgltp = new PegelGltParser();
69 pgltp.parse(gltFile);
70
71 gauges = pgltp.getGauges();
72 }
45 } 73 }
46 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 74 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org