Project

General

Profile

1
/*
2
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
3
$Id$
4
*/
5

    
6
/**
7
 * Stores a Web Processing service (WPS) Capabilities document as defined by the 
8
 * Open Geospatial Consortium (http://opengis.org).
9
 *
10
 * @constructor
11
 * @author Mike Adair
12
 * @param modelNode   The model's XML object node from the configuration document.
13
 * @param parent The model object that this widget belongs to.
14
 */
15
function WpsCapabilities(modelNode, parent) {
16
  // Inherit the ModelBase functions and parameters
17
  ModelBase.apply(this, new Array(modelNode, parent));
18

    
19
  this.namespace = "xmlns:wps='http://www.opengis.net/wps' xmlns:ows='http://www.opengis.net/ows' xmlns:xlink='http://www.w3.org/1999/xlink'";
20

    
21
  /**
22
   * Returns the serverUrl for the WFS request passed in with the specified
23
   * HTTP method from the capabilities doc.
24
   * @param requestName the WFS request to get the URL for
25
   * @param method http method for the request
26
   * @param feature ignored for WFS docs
27
   * @return URL for the specified request with the specified method
28
   */
29
  this.getServerUrl = function(requestName, method, feature) {
30
    var requestParts = requestName.split(':');
31
    var xpath = "/wps:Capabilities/ows:OperationsMetadata/ows:Operation[@name='"+requestParts[1]+"']";
32
    if (method.toLowerCase() == "post") {
33
      xpath += "/ows:DCP/ows:HTTP/ows:Post";
34
    } else {
35
      xpath += "/ows:DCP/ows:HTTP/ows:Get";
36
    }
37
    var urlNode = this.doc.selectSingleNode(xpath);
38
    if (urlNode) {
39
      return urlNode.getAttribute("xlink:href");
40
    } else {
41
      return null;
42
    }
43
  }
44

    
45
  /**
46
   * Returns the version for the wps
47
   * @return the wps version
48
   */
49
  this.getVersion = function() {
50
    var xpath = "/wps:Capabilities";
51
    return this.doc.selectSingleNode(xpath).getAttribute("version");
52
  }
53

    
54
  /**
55
   * Get HTTP method used to retreive this model
56
   * @return the HTTP method 
57
   */
58
  this.getMethod = function() {
59
    return this.method;
60
  }
61

    
62
  /**
63
   * Returns the featureType node with the specified name from the list of nodes
64
   * selected by the nodeSelectXpath from the capabilities doc.
65
   * @param featureName name of the featureType to look up
66
   * @return the featureType node with the specified name.
67
   */
68
  this.getFeatureNode = function(featureName) {
69
    return this.doc.selectSingleNode(this.nodeSelectXpath+"[wps:Name='"+featureName+"']");
70
  }
71

    
72
}
73

    
(17-17/18)