From e04d7cd6279c055777ba5394961973545130ce3e Mon Sep 17 00:00:00 2001
From: ahocevar
Date: Sat, 18 Aug 2012 18:56:36 +0200
Subject: [PATCH] Addressing final review comments.
---
examples/wps.html | 4 +++-
lib/OpenLayers/WPSClient.js | 11 ++++++++++-
lib/OpenLayers/WPSProcess.js | 11 +++++++----
tests/WPSClient.html | 13 +++++++++++++
4 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/examples/wps.html b/examples/wps.html
index 84567fff87..b136e3a29d 100644
--- a/examples/wps.html
+++ b/examples/wps.html
@@ -50,7 +50,9 @@ WPS Builder Example
This example shows WPS in action by using the WPSCapabilities,
WPSDescribeProcess and WPSExecute formats. See
wps.js for the
- source code.
+ source code. Note: For applications using WPS, the high level
+ approach shown in the wps-client example
+ is recommended instead.
- Select a process from the list below the map. The list is
populated with the result of a WPS GetCapabilities request, parsed
diff --git a/lib/OpenLayers/WPSClient.js b/lib/OpenLayers/WPSClient.js
index a335632219..dd36c3c2c1 100644
--- a/lib/OpenLayers/WPSClient.js
+++ b/lib/OpenLayers/WPSClient.js
@@ -198,7 +198,7 @@ OpenLayers.WPSClient = OpenLayers.Class({
this.events.register('describeprocess', this, function describe(evt) {
if (evt.identifier === processID) {
this.events.unregister('describeprocess', this, describe);
- callback.call(scope, evt);
+ callback.call(scope, evt.raw);
}
});
}
@@ -209,6 +209,15 @@ OpenLayers.WPSClient = OpenLayers.Class({
}
},
+ /**
+ * Method: destroy
+ */
+ destroy: function() {
+ this.events.destroy();
+ this.events = null;
+ this.servers = null;
+ },
+
CLASS_NAME: 'OpenLayers.WPSClient'
});
diff --git a/lib/OpenLayers/WPSProcess.js b/lib/OpenLayers/WPSProcess.js
index 323d87bded..0e7f6e22df 100644
--- a/lib/OpenLayers/WPSProcess.js
+++ b/lib/OpenLayers/WPSProcess.js
@@ -104,7 +104,7 @@ OpenLayers.WPSProcess = OpenLayers.Class({
/**
* Method: describe
- * Makes the client ssues a DescribeProcess request asynchronously.
+ * Makes the client issue a DescribeProcess request asynchronously.
*
* Parameters:
* options - {Object} Configuration for the method call
@@ -144,6 +144,9 @@ OpenLayers.WPSProcess = OpenLayers.Class({
* Parameters:
* options - {Object}
*
+ * Returns:
+ * {} this process.
+ *
* Available options:
* inputs - {Object} The inputs for the process, keyed by input identifier.
* For spatial data inputs, the value of an input is usually an
@@ -184,8 +187,8 @@ OpenLayers.WPSProcess = OpenLayers.Class({
* For spatial data inputs, the value of an input is usually an
* , an or an array of
* geometries or features.
- * output - {String} The identifier of an output to parse. Optional. If not
- * provided, the first output will be parsed.
+ * output - {String} The identifier of the output to request and parse.
+ * Optional. If not provided, the first output will be requested.
* success - {Function} Callback to call when the process is complete.
* This function is called with an outputs object as argument, which
* will have a property with the identifier of the requested output
@@ -254,7 +257,7 @@ OpenLayers.WPSProcess = OpenLayers.Class({
* buffer = client.getProcess('opengeo', 'JTS:buffer');
* buffer.execute({
* inputs: {
- * geom: intersect.output(), // <-- here we're chaining
+ * geom: intersect.output('result'), // <-- here we're chaining
* distance: 1
* },
* // ...
diff --git a/tests/WPSClient.html b/tests/WPSClient.html
index 2a9bc892b6..34b21f9362 100644
--- a/tests/WPSClient.html
+++ b/tests/WPSClient.html
@@ -87,6 +87,19 @@
client.execute({inputs: 'a', success: 'b', scope: 'c'});
t.eq(log[0], {inputs: 'a', success: 'b', scope: 'c'}, "process executed with correct options");
}
+
+ function test_destroy(t) {
+ t.plan(2);
+ client = new OpenLayers.WPSClient({
+ servers: {
+ local: "/geoserver/wps"
+ },
+ lazy: true
+ });
+ client.destroy();
+ t.eq(client.events, null, "Events nullified");
+ t.eq(client.servers, null, "Servers nullified");
+ }