Skip to content

Commit c95c615

Browse files
author
Bart van den Eijnden
committed
make WPSDescribeProcess format versioned
1 parent 99b7de4 commit c95c615

File tree

3 files changed

+199
-146
lines changed

3 files changed

+199
-146
lines changed

lib/OpenLayers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@
386386
"OpenLayers/Format/WPSCapabilities.js",
387387
"OpenLayers/Format/WPSCapabilities/v1_0_0.js",
388388
"OpenLayers/Format/WPSDescribeProcess.js",
389+
"OpenLayers/Format/WPSDescribeProcess/v1_0_0.js",
389390
"OpenLayers/Format/WPSExecute.js",
390391
"OpenLayers/Format/XLS.js",
391392
"OpenLayers/Format/XLS/v1.js",

lib/OpenLayers/Format/WPSDescribeProcess.js

Lines changed: 10 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,29 @@
44
* full text of the license. */
55

66
/**
7-
* @requires OpenLayers/Format/XML.js
8-
* @requires OpenLayers/Format/OWSCommon/v1_1_0.js
7+
* @requires OpenLayers/Format/XML/VersionedOGC.js
98
*/
109

1110
/**
1211
* Class: OpenLayers.Format.WPSDescribeProcess
1312
* Read WPS DescribeProcess responses.
1413
*
1514
* Inherits from:
16-
* - <OpenLayers.Format.XML>
15+
* - <OpenLayers.Format.VersionedOGC>
1716
*/
1817
OpenLayers.Format.WPSDescribeProcess = OpenLayers.Class(
19-
OpenLayers.Format.XML, {
20-
21-
/**
22-
* Constant: VERSION
23-
* {String} 1.0.0
24-
*/
25-
VERSION: "1.0.0",
26-
27-
/**
28-
* Property: namespaces
29-
* {Object} Mapping of namespace aliases to namespace URIs.
30-
*/
31-
namespaces: {
32-
wps: "http://www.opengis.net/wps/1.0.0",
33-
ows: "http://www.opengis.net/ows/1.1",
34-
xsi: "http://www.w3.org/2001/XMLSchema-instance"
35-
},
36-
37-
/**
38-
* Property: schemaLocation
39-
* {String} Schema location
40-
*/
41-
schemaLocation: "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",
18+
OpenLayers.Format.XML.VersionedOGC, {
19+
4220

4321
/**
44-
* Property: defaultPrefix
22+
* APIProperty: defaultVersion
23+
* {String} Version number to assume if none found. Default is "1.0.0".
4524
*/
46-
defaultPrefix: "wps",
25+
defaultVersion: "1.0.0",
4726

48-
/**
49-
* Property: regExes
50-
* Compiled regular expressions for manipulating strings.
51-
*/
52-
regExes: {
53-
trimSpace: (/^\s*|\s*$/g),
54-
removeSpace: (/\s*/g),
55-
splitSpace: (/\s+/),
56-
trimComma: (/\s*,\s*/g)
57-
},
58-
5927
/**
6028
* Constructor: OpenLayers.Format.WPSDescribeProcess
29+
* Create a new parser for WPS DescribeProcess.
6130
*
6231
* Parameters:
6332
* options - {Object} An optional object whose properties will be set on
@@ -67,119 +36,14 @@ OpenLayers.Format.WPSDescribeProcess = OpenLayers.Class(
6736
/**
6837
* APIMethod: read
6938
* Parse a WPS DescribeProcess and return an object with its information.
70-
*
71-
* Parameters:
39+
*
40+
* Parameters:
7241
* data - {String} or {DOMElement} data to read/parse.
7342
*
7443
* Returns:
7544
* {Object}
7645
*/
77-
read: function(data) {
78-
if(typeof data == "string") {
79-
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
80-
}
81-
if(data && data.nodeType == 9) {
82-
data = data.documentElement;
83-
}
84-
var info = {};
85-
this.readNode(data, info);
86-
return info;
87-
},
8846

89-
/**
90-
* Property: readers
91-
* Contains public functions, grouped by namespace prefix, that will
92-
* be applied when a namespaced node is found matching the function
93-
* name. The function will be applied in the scope of this parser
94-
* with two arguments: the node being read and a context object passed
95-
* from the parent.
96-
*/
97-
readers: {
98-
"wps": {
99-
"ProcessDescriptions": function(node, obj) {
100-
obj.processDescriptions = {};
101-
this.readChildNodes(node, obj.processDescriptions);
102-
},
103-
"ProcessDescription": function(node, processDescriptions) {
104-
var processVersion = this.getAttributeNS(node, this.namespaces.wps, "processVersion");
105-
var processDescription = {
106-
processVersion: processVersion,
107-
statusSupported: (node.getAttribute("statusSupported") === "true"),
108-
storeSupported: (node.getAttribute("storeSupported") === "true")
109-
};
110-
this.readChildNodes(node, processDescription);
111-
processDescriptions[processDescription.identifier] = processDescription;
112-
},
113-
"DataInputs": function(node, processDescription) {
114-
processDescription.dataInputs = [];
115-
this.readChildNodes(node, processDescription.dataInputs);
116-
},
117-
"ProcessOutputs": function(node, processDescription) {
118-
processDescription.processOutputs = [];
119-
this.readChildNodes(node, processDescription.processOutputs);
120-
},
121-
"Output": function(node, processOutputs) {
122-
var output = {};
123-
this.readChildNodes(node, output);
124-
processOutputs.push(output);
125-
},
126-
"ComplexOutput": function(node, output) {
127-
output.complexOutput = {};
128-
this.readChildNodes(node, output.complexOutput);
129-
},
130-
"LiteralOutput": function(node, output) {
131-
output.literalOutput = {};
132-
this.readChildNodes(node, output.literalOutput);
133-
},
134-
"Input": function(node, dataInputs) {
135-
var input = {
136-
maxOccurs: parseInt(node.getAttribute("maxOccurs")),
137-
minOccurs: parseInt(node.getAttribute("minOccurs"))
138-
};
139-
this.readChildNodes(node, input);
140-
dataInputs.push(input);
141-
},
142-
"BoundingBoxData": function(node, input) {
143-
input.boundingBoxData = {};
144-
this.readChildNodes(node, input.boundingBoxData);
145-
},
146-
"CRS": function(node, obj) {
147-
if (!obj.CRSs) {
148-
obj.CRSs = {};
149-
}
150-
obj.CRSs[this.getChildValue(node)] = true;
151-
},
152-
"LiteralData": function(node, input) {
153-
input.literalData = {};
154-
this.readChildNodes(node, input.literalData);
155-
},
156-
"ComplexData": function(node, input) {
157-
input.complexData = {};
158-
this.readChildNodes(node, input.complexData);
159-
},
160-
"Default": function(node, complexData) {
161-
complexData["default"] = {};
162-
this.readChildNodes(node, complexData["default"]);
163-
},
164-
"Supported": function(node, complexData) {
165-
complexData["supported"] = {};
166-
this.readChildNodes(node, complexData["supported"]);
167-
},
168-
"Format": function(node, obj) {
169-
var format = {};
170-
this.readChildNodes(node, format);
171-
if (!obj.formats) {
172-
obj.formats = {};
173-
}
174-
obj.formats[format.mimeType] = true;
175-
},
176-
"MimeType": function(node, format) {
177-
format.mimeType = this.getChildValue(node);
178-
}
179-
},
180-
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]
181-
},
182-
18347
CLASS_NAME: "OpenLayers.Format.WPSDescribeProcess"
18448

18549
});
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
2+
* full list of contributors). Published under the 2-clause BSD license.
3+
* See license.txt in the OpenLayers distribution or repository for the
4+
* full text of the license. */
5+
6+
/**
7+
* @requires OpenLayers/Format/XML.js
8+
* @requires OpenLayers/Format/OWSCommon/v1_1_0.js
9+
*/
10+
11+
/**
12+
* Class: OpenLayers.Format.WPSDescribeProcess.v1_0_0
13+
* Read WPS DescribeProcess 1.0.0 responses.
14+
*
15+
* Inherits from:
16+
* - <OpenLayers.Format.XML>
17+
*/
18+
OpenLayers.Format.WPSDescribeProcess.v1_0_0 = OpenLayers.Class(
19+
OpenLayers.Format.XML, {
20+
21+
/**
22+
* Property: namespaces
23+
* {Object} Mapping of namespace aliases to namespace URIs.
24+
*/
25+
namespaces: {
26+
wps: "http://www.opengis.net/wps/1.0.0",
27+
ows: "http://www.opengis.net/ows/1.1",
28+
xsi: "http://www.w3.org/2001/XMLSchema-instance"
29+
},
30+
31+
/**
32+
* APIProperty: errorProperty
33+
* {String} Which property of the returned object to check for in order to
34+
* determine whether or not parsing has failed. In the case that the
35+
* errorProperty is undefined on the returned object, the document will be
36+
* run through an OGCExceptionReport parser.
37+
*/
38+
errorProperty: "processDescriptions",
39+
40+
/**
41+
* Property: schemaLocation
42+
* {String} Schema location
43+
*/
44+
schemaLocation: "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",
45+
46+
/**
47+
* Property: defaultPrefix
48+
*/
49+
defaultPrefix: "wps",
50+
51+
/**
52+
* Property: regExes
53+
* Compiled regular expressions for manipulating strings.
54+
*/
55+
regExes: {
56+
trimSpace: (/^\s*|\s*$/g),
57+
removeSpace: (/\s*/g),
58+
splitSpace: (/\s+/),
59+
trimComma: (/\s*,\s*/g)
60+
},
61+
62+
/**
63+
* Constructor: OpenLayers.Format.WPSDescribeProcess
64+
*
65+
* Parameters:
66+
* options - {Object} An optional object whose properties will be set on
67+
* this instance.
68+
*/
69+
70+
/**
71+
* APIMethod: read
72+
* Parse a WPS DescribeProcess and return an object with its information.
73+
*
74+
* Parameters:
75+
* data - {String} or {DOMElement} data to read/parse.
76+
*
77+
* Returns:
78+
* {Object}
79+
*/
80+
read: function(data) {
81+
if(typeof data == "string") {
82+
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
83+
}
84+
if(data && data.nodeType == 9) {
85+
data = data.documentElement;
86+
}
87+
var info = {};
88+
this.readNode(data, info);
89+
return info;
90+
},
91+
92+
/**
93+
* Property: readers
94+
* Contains public functions, grouped by namespace prefix, that will
95+
* be applied when a namespaced node is found matching the function
96+
* name. The function will be applied in the scope of this parser
97+
* with two arguments: the node being read and a context object passed
98+
* from the parent.
99+
*/
100+
readers: {
101+
"wps": {
102+
"ProcessDescriptions": function(node, obj) {
103+
obj.processDescriptions = {};
104+
this.readChildNodes(node, obj.processDescriptions);
105+
},
106+
"ProcessDescription": function(node, processDescriptions) {
107+
var processVersion = this.getAttributeNS(node, this.namespaces.wps, "processVersion");
108+
var processDescription = {
109+
processVersion: processVersion,
110+
statusSupported: (node.getAttribute("statusSupported") === "true"),
111+
storeSupported: (node.getAttribute("storeSupported") === "true")
112+
};
113+
this.readChildNodes(node, processDescription);
114+
processDescriptions[processDescription.identifier] = processDescription;
115+
},
116+
"DataInputs": function(node, processDescription) {
117+
processDescription.dataInputs = [];
118+
this.readChildNodes(node, processDescription.dataInputs);
119+
},
120+
"ProcessOutputs": function(node, processDescription) {
121+
processDescription.processOutputs = [];
122+
this.readChildNodes(node, processDescription.processOutputs);
123+
},
124+
"Output": function(node, processOutputs) {
125+
var output = {};
126+
this.readChildNodes(node, output);
127+
processOutputs.push(output);
128+
},
129+
"ComplexOutput": function(node, output) {
130+
output.complexOutput = {};
131+
this.readChildNodes(node, output.complexOutput);
132+
},
133+
"LiteralOutput": function(node, output) {
134+
output.literalOutput = {};
135+
this.readChildNodes(node, output.literalOutput);
136+
},
137+
"Input": function(node, dataInputs) {
138+
var input = {
139+
maxOccurs: parseInt(node.getAttribute("maxOccurs")),
140+
minOccurs: parseInt(node.getAttribute("minOccurs"))
141+
};
142+
this.readChildNodes(node, input);
143+
dataInputs.push(input);
144+
},
145+
"BoundingBoxData": function(node, input) {
146+
input.boundingBoxData = {};
147+
this.readChildNodes(node, input.boundingBoxData);
148+
},
149+
"CRS": function(node, obj) {
150+
if (!obj.CRSs) {
151+
obj.CRSs = {};
152+
}
153+
obj.CRSs[this.getChildValue(node)] = true;
154+
},
155+
"LiteralData": function(node, input) {
156+
input.literalData = {};
157+
this.readChildNodes(node, input.literalData);
158+
},
159+
"ComplexData": function(node, input) {
160+
input.complexData = {};
161+
this.readChildNodes(node, input.complexData);
162+
},
163+
"Default": function(node, complexData) {
164+
complexData["default"] = {};
165+
this.readChildNodes(node, complexData["default"]);
166+
},
167+
"Supported": function(node, complexData) {
168+
complexData["supported"] = {};
169+
this.readChildNodes(node, complexData["supported"]);
170+
},
171+
"Format": function(node, obj) {
172+
var format = {};
173+
this.readChildNodes(node, format);
174+
if (!obj.formats) {
175+
obj.formats = {};
176+
}
177+
obj.formats[format.mimeType] = true;
178+
},
179+
"MimeType": function(node, format) {
180+
format.mimeType = this.getChildValue(node);
181+
}
182+
},
183+
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]
184+
},
185+
186+
CLASS_NAME: "OpenLayers.Format.WPSDescribeProcess"
187+
188+
});

0 commit comments

Comments
 (0)