diff gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 481:20dde2b6f1b5

Added end of life support for artifact states. Implemented ZIP download for "Horizontalschnitte". Laid some tracks for WMS (un-)publishing. gnv-artifacts/trunk@554 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 17 Jan 2010 16:34:11 +0000
parents 211cad2fb5ba
children 79e80c289018
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Sun Jan 17 12:22:56 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Sun Jan 17 16:34:11 2010 +0000
@@ -68,16 +68,6 @@
 import java.util.Locale;
 import java.util.Vector;
 
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-
-import javax.xml.transform.dom.DOMSource;
-
-import javax.xml.transform.stream.StreamResult;
-
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.ChartTheme;
@@ -89,8 +79,8 @@
 
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author Tim Englich    (tim.englich@intevation.de)
+ * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
  */
 public class TimeSeriesOutputState extends OutputStateBase {
 
@@ -408,7 +398,7 @@
 
                 Document doc = writeStatistics2XML(statistics);
 
-                writeDocument2OutputStream(doc, outputStream);
+                XMLUtils.toStream(doc, outputStream);
 
             } else if (outputMode.equalsIgnoreCase("odv")) {
                 
@@ -519,24 +509,6 @@
         return s;
     }
 
-    protected void writeDocument2OutputStream(Document document, OutputStream os) {
-
-        try {
-            TransformerFactory transformerFactory = TransformerFactory
-                    .newInstance();
-            Transformer transformer = transformerFactory.newTransformer();
-            DOMSource source = new DOMSource(document);
-            StreamResult result = new StreamResult(os);
-            transformer.transform(source, result);
-        } catch (TransformerConfigurationException e) {
-            log.error(e, e);
-        } catch (TransformerFactoryConfigurationError e) {
-            log.error(e, e);
-        } catch (TransformerException e) {
-            log.error(e, e);
-        }
-    }
-
     protected Document writeStatistics2XML( Collection<StatisticSet> statistic) {
         ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
         Document doc = XMLUtils.newDocument();
@@ -689,21 +661,6 @@
             PDF_FORMAT_LANDSCAPE,
             50F, 50F, 50F, 50F
         );
-
-        /* XXX: @Ingo: What's this? Looks like dev test remains.
-        try {
-            OutputStream toFile = new FileOutputStream("/vol1/home/iweinzierl/tmp/test.svg");
-            ChartExportHelper.exportSVG(
-                toFile,
-                chart.generateChart(),
-                null,
-                600, 400
-            );
-            toFile.flush();
-            toFile.close();
-        }
-        catch(Exception e) { log.debug("ERROR WHLILE TEST."); }
-        */
     }
 
 

http://dive4elements.wald.intevation.org