[OpenLayers-Commits] r11932 - in sandbox/bartvde/wps/openlayers: lib lib/OpenLayers/Format tests tests/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Apr 29 09:07:31 EDT 2011


Author: bartvde
Date: 2011-04-29 06:07:31 -0700 (Fri, 29 Apr 2011)
New Revision: 11932

Added:
   sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
   sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
Modified:
   sandbox/bartvde/wps/openlayers/lib/OpenLayers.js
   sandbox/bartvde/wps/openlayers/tests/list-tests.html
Log:
start on WPS Execute write format

Added: sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
===================================================================
--- sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js	                        (rev 0)
+++ sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js	2011-04-29 13:07:31 UTC (rev 11932)
@@ -0,0 +1,109 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for 
+ * full list of contributors). Published under the Clear BSD license.  
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XML.js
+ */
+
+/**
+ * Class: OpenLayers.Format.WPSExecute version 1.0.0
+ *
+ * Inherits from:
+ *  - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
+    
+    /**
+     * Property: namespaces
+     * {Object} Mapping of namespace aliases to namespace URIs.
+     */
+    namespaces: {
+        ows: "http://www.opengis.net/ows",
+        gml: "http://www.opengis.net/gml",
+        wps: "http://www.opengis.net/wps/1.0.0",
+        ogc: "http://www.opengis.net/ogc",
+        wcs: "http://www.opengis.net/wcs/1.1.1",
+        xlink: "http://www.w3.org/1999/xlink",
+        xsi: "http://www.w3.org/2001/XMLSchema-instance"
+    },
+
+    /**
+     * Property: regExes
+     * Compiled regular expressions for manipulating strings.
+     */
+    regExes: {
+        trimSpace: (/^\s*|\s*$/g),
+        removeSpace: (/\s*/g),
+        splitSpace: (/\s+/),
+        trimComma: (/\s*,\s*/g)
+    },
+
+    /**
+     * Constant: VERSION
+     * {String} 1.0.0
+     */
+    VERSION: "1.0.0",
+
+    /**
+     * Property: schemaLocation
+     * {String} Schema location
+     */
+    schemaLocation: "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",
+
+    /**
+     * Property: defaultPrefix
+     */
+    defaultPrefix: "wps",
+
+    /**
+     * Constructor: OpenLayers.Format.WPSExecute
+     *
+     * Parameters:
+     * options - {Object} An optional object whose properties will be set on
+     *     this instance.
+     */
+
+    /**
+     * Method: write
+     *
+     * Parameters:
+     * options - {Object} Optional object.
+     *
+     * Returns:
+     * {String} An WPS Execute request XML string.
+     */
+    write: function(options) {
+        var node = this.writeNode("wps:Execute", options);
+        this.setAttributeNS(
+            node, this.namespaces.xsi,
+            "xsi:schemaLocation", this.schemaLocation
+        );
+        return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
+    }, 
+
+    /**
+     * Property: writers
+     * As a compliment to the readers property, this structure contains public
+     *     writing functions grouped by namespace alias and named like the
+     *     node names they produce.
+     */
+    writers: {
+        "wps": {
+            "Execute": function(options) {
+                var node = this.createElementNSPlus("Execute", {
+                    attributes: {
+                        version: this.VERSION,
+                        service: 'WPS'
+                    } 
+                }); 
+                this.writeNode("ows:Identifier", options, node);
+                return node; 
+            }
+        }
+    },
+    
+    CLASS_NAME: "OpenLayers.Format.WPSExecute" 
+
+});

Modified: sandbox/bartvde/wps/openlayers/lib/OpenLayers.js
===================================================================
--- sandbox/bartvde/wps/openlayers/lib/OpenLayers.js	2011-04-29 12:32:41 UTC (rev 11931)
+++ sandbox/bartvde/wps/openlayers/lib/OpenLayers.js	2011-04-29 13:07:31 UTC (rev 11932)
@@ -332,6 +332,7 @@
                 "OpenLayers/Format/WPSCapabilities.js",
                 "OpenLayers/Format/WPSCapabilities/v1_0_0.js",
                 "OpenLayers/Format/WPSDescribeProcess.js",
+                "OpenLayers/Format/WPSExecute.js",
                 "OpenLayers/Format/XLS.js",
                 "OpenLayers/Format/XLS/v1.js",
                 "OpenLayers/Format/XLS/v1_1_0.js",

Added: sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
===================================================================
--- sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html	                        (rev 0)
+++ sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html	2011-04-29 13:07:31 UTC (rev 11932)
@@ -0,0 +1,60 @@
+<html>
+<head>
+    <script src="../OLLoader.js"></script>
+    <script type="text/javascript">
+
+    function test_write_WPSExecute(t) {
+        var expected = '<?xml version="1.0" encoding="UTF-8"?>' +
+'<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
+'    xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs"' +
+'    xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1"' +
+'    xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"' +
+'    xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink"' +
+'    xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">' +
+'    <ows:Identifier>JTS:area</ows:Identifier>' +
+'    <wps:DataInputs>' +
+'        <wps:Input>' +
+'            <ows:Identifier>geom</ows:Identifier>' +
+'            <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="http://geoserver/wps"' +
+'                method="POST">' +
+'                <Body>' +
+'                    <wps:Execute service="WPS" version="1.0.0">' +
+'                        <ows:Identifier>gs:CollectGeometries</ows:Identifier>' +
+'                        <wps:DataInputs>' +
+'                            <wps:Input>' +
+'                                <ows:Identifier>features</ows:Identifier>' +
+'                                <wps:Reference mimeType="text/xml; subtype=wfs-collection/1.0"' +
+'                                    xlink:href="http://geoserver/wfs" method="POST">' +
+'                                    <wps:Body>' +
+'                                        <wfs:GetFeature service="WFS" version="1.0.0"' +
+'                                            outputFormat="GML2">' +
+'                                            <wfs:Query typeName="sf:archsites"/>' +
+'                                        </wfs:GetFeature>' +
+'                                    </wps:Body>' +
+'                                </wps:Reference>' +
+'                            </wps:Input>' +
+'                        </wps:DataInputs>' +
+'                        <wps:ResponseForm>' +
+'                            <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1">' +
+'                                <ows:Identifier>result</ows:Identifier>' +
+'                            </wps:RawDataOutput>' +
+'                        </wps:ResponseForm>' +
+'                    </wps:Execute>' +
+'                </Body>' +
+'            </wps:Reference>' +
+'        </wps:Input>' +
+'    </wps:DataInputs>' +
+'    <wps:ResponseForm>' +
+'        <wps:RawDataOutput>' +
+'            <ows:Identifier>result</ows:Identifier>' +
+'        </wps:RawDataOutput>' +
+'    </wps:ResponseForm>' +
+'</wps:Execute>';
+
+    }
+
+    </script>
+</head>
+<body>
+</body>
+</html>

Modified: sandbox/bartvde/wps/openlayers/tests/list-tests.html
===================================================================
--- sandbox/bartvde/wps/openlayers/tests/list-tests.html	2011-04-29 12:32:41 UTC (rev 11931)
+++ sandbox/bartvde/wps/openlayers/tests/list-tests.html	2011-04-29 13:07:31 UTC (rev 11932)
@@ -106,6 +106,7 @@
     <li>Format/XLS/v1_1_0.html</li>
     <li>Format/WPSCapabilities/v1_0_0.html</li>
     <li>Format/WPSDescribeProcess.html</li>
+    <li>Format/WPSExecute.html</li>
     <li>Format/XML.html</li>
     <li>Geometry.html</li>
     <li>Geometry/Collection.html</li>



More information about the Commits mailing list