# HG changeset patch # User Sascha L. Teichmann # Date 1347795638 0 # Node ID d52c4ca93ffb9b367698515d82662131f0667730 # Parent a66df8e8d3dfd7ae0934a92865fd53597b4cf85d More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen". flys-artifacts/trunk@5481 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a66df8e8d3df -r d52c4ca93ffb flys-artifacts/ChangeLog --- 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 + + 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 * src/main/java/de/intevation/flys/artifacts/BedHeightsArtifact.java, diff -r a66df8e8d3df -r d52c4ca93ffb flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.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 : diff -r a66df8e8d3df -r d52c4ca93ffb flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java --- /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 : diff -r a66df8e8d3df -r d52c4ca93ffb flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeResult.java --- /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 : diff -r a66df8e8d3df -r d52c4ca93ffb flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java --- /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 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 : diff -r a66df8e8d3df -r d52c4ca93ffb flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java --- 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];