diff gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java @ 171:7fb9441dd8af

Format Code to max 80 Chars per Row and Cleanup gnv-artifacts/trunk@208 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 09 Oct 2009 07:54:48 +0000
parents cde042a0a395
children 3dcd2b0b456e
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java	Fri Oct 09 07:49:47 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java	Fri Oct 09 07:54:48 2009 +0000
@@ -31,9 +31,9 @@
 
 /**
  * @author Tim Englich <tim.englich@intevation.de>
- *
+ * 
  */
-public class ArtifactXMLUtilities implements Serializable{
+public class ArtifactXMLUtilities implements Serializable {
     /**
      *
      */
@@ -42,93 +42,97 @@
     /**
      * the logger, used to log exceptions and additonaly information
      */
-    private static Logger log = Logger.getLogger(TimeSeriesOutputTransition.class);
-  
+    private static Logger log = Logger
+            .getLogger(TimeSeriesOutputTransition.class);
+
     public static final String XFORM_URL = "http://www.w3.org/2002/xforms";
     public static final String XFORM_PREFIX = "xform";
-    
+
     /**
      * Constructor
      */
     public ArtifactXMLUtilities() {
     }
-    
+
     /**
      * @param document
      * @return
      */
     public Element createArtifactElement(Document document, String name) {
-        Element node = document.createElementNS(ArtifactNamespaceContext.NAMESPACE_URI, name);
+        Element node = document.createElementNS(
+                ArtifactNamespaceContext.NAMESPACE_URI, name);
         node.setPrefix(ArtifactNamespaceContext.NAMESPACE_PREFIX);
         return node;
     }
-    
-    public String writeDocument2String(Document document){
+
+    public String writeDocument2String(Document document) {
         try {
-            TransformerFactory transformerFactory = TransformerFactory.newInstance();
+            TransformerFactory transformerFactory = TransformerFactory
+                    .newInstance();
             Transformer transformer = transformerFactory.newTransformer();
             DOMSource source = new DOMSource(document);
             StringWriter sw = new StringWriter();
-            StreamResult result =  new StreamResult(sw);
+            StreamResult result = new StreamResult(sw);
             transformer.transform(source, result);
             return sw.getBuffer().toString();
         } catch (TransformerConfigurationException e) {
-            log.error(e,e);
+            log.error(e, e);
         } catch (TransformerFactoryConfigurationError e) {
-            log.error(e,e);
+            log.error(e, e);
         } catch (TransformerException e) {
-            log.error(e,e);
+            log.error(e, e);
         }
         return null;
     }
-    
 
-    
-    
-    public Document readDocument(InputStream inputStream){
+    public Document readDocument(InputStream inputStream) {
         Document returnValue = null;
         try {
-            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
+                    .newInstance();
             DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
-            returnValue = docBuilder.parse (inputStream);
+            returnValue = docBuilder.parse(inputStream);
         } catch (ParserConfigurationException e) {
-            log.error(e,e);
+            log.error(e, e);
         } catch (SAXException e) {
-            log.error(e,e);
+            log.error(e, e);
         } catch (IOException e) {
-            log.error(e,e);
+            log.error(e, e);
         }
         return returnValue;
     }
-    
-    public Document reInitDocument(Document document){
+
+    public Document reInitDocument(Document document) {
         try {
-            byte[] barray = this.writeDocument2String(document).getBytes("UTF-8");
-            InputStream inputStream = new ByteArrayInputStream(barray); 
+            byte[] barray = this.writeDocument2String(document).getBytes(
+                    "UTF-8");
+            InputStream inputStream = new ByteArrayInputStream(barray);
             return this.readDocument(inputStream);
         } catch (UnsupportedEncodingException e) {
-            log.error(e,e);
+            log.error(e, e);
         }
         return document;
     }
-    
+
     public Element createXFormElement(Document document, String name) {
         Element node = document.createElementNS(XFORM_URL, name);
         node.setPrefix(XFORM_PREFIX);
         return node;
     }
-    
-    public Document createExceptionReport(String message, Document document){
+
+    public Document createExceptionReport(String message, Document document) {
         log.debug("ArtifactXMLUtilities.createExceptionReport");
-        Element exceptionReportNode = this.createArtifactElement(document, "exceptionreport");
+        Element exceptionReportNode = this.createArtifactElement(document,
+                "exceptionreport");
         document.appendChild(exceptionReportNode);
-        Element exceptionNode = this.createArtifactElement(document, "exception");
+        Element exceptionNode = this.createArtifactElement(document,
+                "exception");
         exceptionNode.setTextContent(message);
         exceptionReportNode.appendChild(exceptionNode);
         return document;
     }
-    
-    public Document createSuccessReport(String message, Document document){
+
+    public Document createSuccessReport(String message, Document document) {
         log.debug("ArtifactXMLUtilities.creatSuccessReport");
         Element reportNode = this.createArtifactElement(document, "result");
         document.appendChild(reportNode);
@@ -137,6 +141,5 @@
         reportNode.appendChild(successNode);
         return document;
     }
-    
 
 }

http://dive4elements.wald.intevation.org