Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/wsplgen/ProblemObserver.java @ 2792:fe987587ebc9
Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-artifacts/trunk
........
r4539 | teichmann | 2012-05-27 20:02:13 +0200 (So, 27 Mai 2012) | 1 line
FixA: Added forgotten csv/report facets/generators to conf.
........
r4540 | teichmann | 2012-05-27 20:11:31 +0200 (So, 27 Mai 2012) | 1 line
FixA: Fixed class cast bug in report facet.
........
r4543 | teichmann | 2012-05-28 20:35:01 +0200 (Mo, 28 Mai 2012) | 1 line
FixA: Added facet to return delta w/t as CSV
........
r4545 | teichmann | 2012-05-28 22:59:27 +0200 (Mo, 28 Mai 2012) | 1 line
FixA: Made Delta W/t calculation finally work
........
r4546 | teichmann | 2012-05-28 23:34:24 +0200 (Mo, 28 Mai 2012) | 1 line
FixA: corrected fitting (Q->W instead W->Q).
........
flys-artifacts/tags/2.7@4547 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 29 May 2012 04:58:29 +0000 |
parents | 74142aa5d938 |
children | 453d2d0c4258 |
line wrap: on
line source
package de.intevation.flys.wsplgen; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.log4j.Logger; import de.intevation.flys.artifacts.model.WSPLGENCalculation; import de.intevation.flys.artifacts.model.WSPLGENJob; public class ProblemObserver extends JobObserver { private static Logger logger = Logger.getLogger(ProblemObserver.class); public static final Pattern WSPLGEN_ERROR_START = Pattern.compile( ".*->(.*Fehler)(\\s*\\((\\d+)\\).*)*", Pattern.DOTALL); public static final Pattern WSPLGEN_ERROR_END = Pattern.compile( ".*<-(.*Fehler).*", Pattern.DOTALL); public static final Pattern WSPLGEN_WARNING_START = Pattern.compile( ".*->Warnung\\s*\\((\\d+)\\).*", Pattern.DOTALL); public static final Pattern WSPLGEN_WARNING_END = Pattern.compile( ".*<-Warnung .*", Pattern.DOTALL); protected int error; protected int warning; protected WSPLGENCalculation calculation; public ProblemObserver(WSPLGENJob job) { super(job); error = -1; warning = -1; calculation = job.getCalculation(); } public void run() { logger.debug("Start observation..."); super.run(); } @Override protected void prepareRegexes() { // do nothing } @Override protected void update(String log) { Matcher startError = WSPLGEN_ERROR_START.matcher(log); if (startError.matches()) { if (startError.groupCount() >= 2) { String tmp = startError.group(3); if (tmp != null && tmp.length() > 0) { error = Integer.parseInt(tmp); } else error = 1; } else { error = 1; } return; } Matcher endError = WSPLGEN_ERROR_END.matcher(log); if (endError.matches()) { error = -1; } if (error > 0) { calculation.addError(new Integer(error), log); } Matcher startWarning = WSPLGEN_WARNING_START.matcher(log); if (startWarning.matches()) { warning = Integer.parseInt(startWarning.group(1)); return; } Matcher endWarning = WSPLGEN_WARNING_END.matcher(log); if (endWarning.matches()) { warning = -1; } if (warning > 0) { calculation.addWarning(new Integer(warning), log); } } public int numErrors() { return calculation.numErrors(); } public int numWarnings() { return calculation.numWarnings(); } } // vim:set ts=4 sw=4 si et sta sts=5 fenc=utf-8 :