Mercurial > dive4elements > river
changeset 3775:d52c4ca93ffb
More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
flys-artifacts/trunk@5481 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 16 Sep 2012 11:40:38 +0000 |
parents | a66df8e8d3df |
children | 1ddbf66a2b0a |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeResult.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java |
diffstat | 6 files changed, 145 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Sun Sep 16 08:51:14 2012 +0000 +++ b/flys-artifacts/ChangeLog Sun Sep 16 11:40:38 2012 +0000 @@ -1,3 +1,22 @@ +2012-09-16 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen". + + * src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java: + New. Stub for "Auslagerung extremer Wasserspiegellagen" calculation. + + * src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeResult.java: + New. Stub for the cacheable results of the calculation. + + * src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java: + New. Stub compute state for the calculation. + + * src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java: + New. Sub access to the artifact to extract the relevant data. + + * src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java: + A little code reordering to keep related stuff together more closely. + 2012-09-16 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/BedHeightsArtifact.java,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java Sun Sep 16 11:40:38 2012 +0000 @@ -0,0 +1,19 @@ +package de.intevation.flys.artifacts.access; + +import de.intevation.flys.artifacts.FLYSArtifact; + +import org.apache.log4j.Logger; + +public class ExtremeAccess +extends Access +{ + private static Logger log = Logger.getLogger(ExtremeAccess.class); + + public ExtremeAccess() { + } + + public ExtremeAccess(FLYSArtifact artifact) { + super(artifact); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java Sun Sep 16 11:40:38 2012 +0000 @@ -0,0 +1,28 @@ +package de.intevation.flys.artifacts.model.extreme; + +import de.intevation.flys.artifacts.access.ExtremeAccess; + +import de.intevation.flys.artifacts.model.Calculation; +import de.intevation.flys.artifacts.model.CalculationResult; + +public class ExtremeCalculation +extends Calculation +{ + public ExtremeCalculation() { + } + + public ExtremeCalculation(ExtremeAccess access) { + // TODO: Implement me! + } + + public CalculationResult calculate() { + if (hasProblems()) { + return new CalculationResult(this); + } + // TODO: Implement me! + ExtremeResult result = new ExtremeResult(); + + return new CalculationResult(result, this); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeResult.java Sun Sep 16 11:40:38 2012 +0000 @@ -0,0 +1,11 @@ +package de.intevation.flys.artifacts.model.extreme; + +import java.io.Serializable; + +public class ExtremeResult +implements Serializable +{ + public ExtremeResult() { + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java Sun Sep 16 11:40:38 2012 +0000 @@ -0,0 +1,65 @@ +package de.intevation.flys.artifacts.states.extreme; + +import de.intevation.artifactdatabase.state.Facet; + +import de.intevation.artifacts.CallContext; + +import de.intevation.flys.artifacts.FLYSArtifact; + +import de.intevation.flys.artifacts.access.ExtremeAccess; + +import de.intevation.flys.artifacts.model.CalculationResult; +import de.intevation.flys.artifacts.model.ReportFacet; + +import de.intevation.flys.artifacts.model.extreme.ExtremeCalculation; + +import de.intevation.flys.artifacts.states.DefaultState; + +import java.util.List; + +import org.apache.log4j.Logger; + +public class ExtremeCompute +extends DefaultState +{ + private static Logger log = Logger.getLogger(ExtremeCompute.class); + + public ExtremeCompute() { + } + + @Override + public Object computeAdvance( + FLYSArtifact artifact, + String hash, + CallContext context, + List<Facet> facets, + Object old + ) { + log.debug("ExtremeCompute.computeAdvance"); + + CalculationResult res; + + ExtremeAccess access = new ExtremeAccess(artifact); + + if (old instanceof CalculationResult) { + res = (CalculationResult)old; + } + else { + ExtremeCalculation calc = new ExtremeCalculation(access); + res = calc.calculate(); + } + + if (facets == null) { + return res; + } + + if (res.getReport().hasProblems()) { + facets.add(new ReportFacet()); + } + + // TODO: Add more facets. + + return res; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java Sun Sep 16 08:51:14 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java Sun Sep 16 11:40:38 2012 +0000 @@ -40,7 +40,6 @@ public static final String I18N_WQ_EVENTS = "fix.vollmer.wq.events"; - /** * The default constructor that initializes an empty State object. */ @@ -57,9 +56,6 @@ ) { logger.debug("FixRealizingCompute.computeAdvance"); - String id = getID(); - CallMeta meta = context.getMeta(); - CalculationResult res; FixRealizingAccess access = @@ -81,6 +77,9 @@ facets.add(new ReportFacet()); } + String id = getID(); + CallMeta meta = context.getMeta(); + FixRealizingResult fixRes = (FixRealizingResult) res.getData(); WQKms [] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0];