changeset 953:4b64b4d1f0cf

Add more Javadocs gnv/trunk@1097 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 18 May 2010 07:32:45 +0000 (2010-05-18)
parents 902d4de27c37
children a88fc6320cf8
files gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/package.html
diffstat 5 files changed, 76 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Mon May 17 14:21:19 2010 +0000
+++ b/gnv/ChangeLog	Tue May 18 07:32:45 2010 +0000
@@ -1,3 +1,11 @@
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/parser/package.html,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java:
+	  Added more Javadocs. Format some Linees of code which are longer than 80 Chars.
+
 2010-05-17  Tim Englich  <tim.englich@intevation.de>
 
 	* src/main/java/de/intevation/gnv/action/mapviewer/package.html,
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java	Mon May 17 14:21:19 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java	Tue May 18 07:32:45 2010 +0000
@@ -1,20 +1,37 @@
 package de.intevation.gnv.action.mapviewer.parser;
 
+import java.util.Collection;
+
 import de.intevation.gnv.artifactdatabase.objects.map.MapService;
 
-import java.util.Collection;
-
 /**
+ * Interfacedefinition for an XMl-parser of the MV-GNV-Interface requestdocument.
  * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface ExternalCallParser {
 
 
+    /**
+     * Returns the geometry which was parsed from the XML-document.
+     * @return the geometry.
+     */
     String getGeometry();
 
+    /**
+     * Returns the srid which was parsed from the XML-document.
+     * @return the srid.
+     */
     String getSRS();
 
+    /**
+     * Returns the mapservices which was parsed from the XML-document.
+     * @return the mapservices.
+     */
     Collection<MapService> getMapServices();
 
+    /**
+     * Does the parsing work.
+     * @throws ExternalCallParserException
+     */
     void parse() throws ExternalCallParserException;
 }
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java	Mon May 17 14:21:19 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java	Tue May 18 07:32:45 2010 +0000
@@ -1,6 +1,8 @@
 package de.intevation.gnv.action.mapviewer.parser;
 
 /**
+ * Exceptionclass for qualifying exception which were caused by the
+ * <code>ExternalCallParser.</code>
  * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java	Mon May 17 14:21:19 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java	Tue May 18 07:32:45 2010 +0000
@@ -1,24 +1,25 @@
 package de.intevation.gnv.action.mapviewer.parser;
 
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
 import de.intevation.gnv.artifactdatabase.objects.map.DefaultLayer;
 import de.intevation.gnv.artifactdatabase.objects.map.DefaultMapService;
 import de.intevation.gnv.artifactdatabase.objects.map.Layer;
 import de.intevation.gnv.artifactdatabase.objects.map.MapService;
-
 import de.intevation.gnv.util.XMLUtils;
 
-import java.io.InputStream;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.log4j.Logger;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
 /**
+ * This class provides an XMl-Parser which try's to create an DOM from
+ * an given Inputstream. Is this is possible it try to read the required
+ * informations e.g. Mapservices, Layer, SRID and Geometry from the 
+ * document.
  * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class XMLExternalCallParser implements ExternalCallParser {
@@ -37,47 +38,54 @@
     private static String ATTRIBUTE_TYPE = "type";
     private static String ATTRIBUTE_URL = "url";
 
+    /**
+     * The geometry which was parsed from the document.
+     */
     private String geometry = null;
+    
+    /**
+     * The srid which was parsed from the document.
+     */
     private String srs = null;
 
+    /**
+     * The mapservices that were parsed from the document.
+     */
     private Collection<MapService> mapServices = null;
 
+    /**
+     * The inputstream where the data should be read from.
+     */
     private InputStream inputStream = null;
 
     /**
      * Constructor
+     * @param inputStream The stream where the data should be read from
      */
     public XMLExternalCallParser(InputStream inputStream) {
         this.inputStream = inputStream;
     }
 
-    /**
-     * @see de.intevation.gnv.action.mapviewer.parser.ExternalCallParser#getGeometry()
-     */
     public String getGeometry() {
         return this.geometry;
     }
 
-    /**
-     * @see de.intevation.gnv.action.mapviewer.parser.ExternalCallParser#getMapServices()
-     */
     public Collection<MapService> getMapServices() {
         return this.mapServices;
     }
 
-    /**
-     * @see de.intevation.gnv.action.mapviewer.parser.ExternalCallParser#parse()
-     */
     public void parse() throws ExternalCallParserException {
         if (inputStream != null){
             XMLUtils xmlUtils = new XMLUtils();
             Document document = xmlUtils.readDocument(this.inputStream);
             if (document != null){
 
-                this.geometry = xmlUtils.getStringXPath(document, XPATH_GEOMETRY);
+                this.geometry = xmlUtils.getStringXPath(document, 
+                                                        XPATH_GEOMETRY);
                 this.srs = xmlUtils.getStringXPath(document, XPATH_SRS);
                 NodeList mapservicesNodes =
-                      xmlUtils.getNodeSetXPath(document, XPATH_MAPSERVICES_NODESET);
+                      xmlUtils.getNodeSetXPath(document, 
+                                               XPATH_MAPSERVICES_NODESET);
                 if (mapservicesNodes != null){
                     this.mapServices = new ArrayList<MapService>(mapservicesNodes.getLength());
                     for (int i = 0; i < mapservicesNodes.getLength(); i++){
@@ -100,13 +108,15 @@
                     }
 
                 }else{
-                    String errMsg = "XML-Document does not contain any Mapservices which are required.";
+                    String errMsg = "XML-Document does not contain any " +
+                                    "Mapservices which are required.";
                     log.error(errMsg);
                     throw new ExternalCallParserException(errMsg);
                 }
 
             }else{
-                String errMsg = "XML-Document could not be read from InputStream.";
+                String errMsg = "XML-Document could not " +
+                                "be read from InputStream.";
                 log.error(errMsg);
                 throw new ExternalCallParserException(errMsg);
             }
@@ -119,18 +129,21 @@
 
     /**
      * This Method extracts all Layers and put them into the Collection.
-     * @param layer
-     * @param groupId
-     * @param layerNodes
-     * @return
+     * @param layer the collection where the layer should be add to.
+     * @param groupId the id of the group of the layers
+     * @param layerNodes the Nodes which should contain the intormations 
+     *                   about layers
+     * @return the layer
      */
-    private Collection<Layer> extractLayer(Collection<Layer> layer, String groupId, NodeList layerNodes){
-        XMLUtils xmlUtils = new XMLUtils();
+    private Collection<Layer> extractLayer(Collection<Layer> layer, 
+                                           String groupId, 
+                                           NodeList layerNodes){
         for (int i = 0; i < layerNodes.getLength(); i++){
             Element layerNode = (Element)layerNodes.item(i);
             String id = layerNode.getAttribute(ATTRIBUTE_ID);
             String name = layerNode.getAttribute(ATTRIBUTE_NAME);
-            NodeList localLayerNodes = xmlUtils.getNodeSetXPath(layerNode, XPATH_LAYER);
+            NodeList localLayerNodes = XMLUtils.getNodeSetXPath(layerNode, 
+                                                                XPATH_LAYER);
             Layer tmpLayer = new DefaultLayer(id, name,
                                               (localLayerNodes != null &&
                                                localLayerNodes.getLength() > 0),
@@ -143,9 +156,6 @@
         return layer;
     }
 
-    /**
-     * @see de.intevation.gnv.action.mapviewer.parser.ExternalCallParser#getSRS()
-     */
     public String getSRS() {
         return this.srs;
     }
--- a/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/package.html	Mon May 17 14:21:19 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/package.html	Tue May 18 07:32:45 2010 +0000
@@ -3,6 +3,7 @@
 <head>
 </head>
 <body>
-DOCUMENT ME!
+This package provides the XML-parser for parsing the XML-Documents which 
+were send by the MapViewer to the GMV-WebClient.
 </body>
 </html>

http://dive4elements.wald.intevation.org