view 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 source
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() {
    }

    public ImportRiver(String name, File wstFile, File bbInfoFile) {
        this.name       = name;
        this.wstFile    = wstFile;
        this.bbInfoFile = bbInfoFile;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public File getWstFile() {
        return wstFile;
    }

    public void setWstFile(File wstFile) {
        this.wstFile = wstFile;
    }

    public File getBBInfo() {
        return bbInfoFile;
    }

    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