Mercurial > dive4elements > gnv-client
changeset 632:62ea2a7b1067
'Profilschnitte' are working without cache as well, now.
gnv-artifacts/trunk@711 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 25 Feb 2010 09:06:36 +0000 |
parents | f4331a0df032 |
children | 7a136b99ad71 |
files | gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java |
diffstat | 2 files changed, 37 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Thu Feb 25 08:23:46 2010 +0000 +++ b/gnv-artifacts/ChangeLog Thu Feb 25 09:06:36 2010 +0000 @@ -1,3 +1,15 @@ +2010-02-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java: + Changed the way of using cache to store verticalcrosssection chart data. + Now, this type of chart is working without cache, as well. + +2010-02-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/OutputStateBase.java: Changed the + way of using the cache to store chart / histogram data. Now, output modes + 'chart' and 'histogram' are working without cache. + 2010-02-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> * src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java Thu Feb 25 08:23:46 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java Thu Feb 25 09:06:36 2010 +0000 @@ -76,6 +76,7 @@ import java.util.Locale; import java.util.Map; +import net.sf.ehcache.Cache; import net.sf.ehcache.Element; import org.apache.log4j.Logger; @@ -171,17 +172,34 @@ @Override protected Object getChartResult(String uuid, CallContext callContext) { log.debug("VerticalCrossSectionOutputState.getChartResult"); - Collection<Result> result = null; String key = uuid + super.getID(); - Element element = CacheFactory.getInstance().getCache().get(key); - if (element != null) - return element.getObjectValue(); + CacheFactory factory = CacheFactory.getInstance(); + if (factory.isInitialized()) { + log.info("Using a cachce."); + Cache cache = factory.getCache(); - log.debug("No results in cache yet."); + Element element = cache.get(key); + if (element != null) + return element.getObjectValue(); - InputData meshLine = inputData.get("mesh_linestring"); - InputData meshId = inputData.get("meshid"); + log.debug("No results in cache yet."); + Object obj = getData(uuid, callContext); + cache.put(new Element(key, obj)); + + return obj; + } + else { + log.info("Not using a cache."); + return getData(uuid, callContext); + } + } + + + protected Object getData(String uuid, CallContext callContext) { + Collection<Result> result = null; + InputData meshLine = inputData.get("mesh_linestring"); + InputData meshId = inputData.get("meshid"); if (meshLine == null) { log.error("mesh_linestring is not defined"); @@ -228,8 +246,6 @@ preProcess(result), callContext); - CacheFactory.getInstance().getCache().put(new Element(key, obj)); - return obj; }