|
@@ -17,6 +17,7 @@ Lib::loadClass('Api_WpsV1_DescribeProcess');
|
|
|
Lib::loadClass('Core_AclBase');
|
|
Lib::loadClass('Core_AclBase');
|
|
|
Lib::loadClass('Type_ApiRequest');
|
|
Lib::loadClass('Type_ApiRequest');
|
|
|
Lib::loadClass('Type_WpsProcess');
|
|
Lib::loadClass('Type_WpsProcess');
|
|
|
|
|
+Lib::loadClass('Api_WpsHelper');
|
|
|
|
|
|
|
|
class Api_WpsV1_Server extends Api_WpsV1_ServerBase {
|
|
class Api_WpsV1_Server extends Api_WpsV1_ServerBase {
|
|
|
|
|
|
|
@@ -84,40 +85,11 @@ class Api_WpsV1_Server extends Api_WpsV1_ServerBase {
|
|
|
if ('vec:Feature' === $identifier) return self::exampleDescribeProcess_vec_Feature();
|
|
if ('vec:Feature' === $identifier) return self::exampleDescribeProcess_vec_Feature();
|
|
|
|
|
|
|
|
$wpsServerUrl = $this->getBaseUri();
|
|
$wpsServerUrl = $this->getBaseUri();
|
|
|
- $wpsProcess = $this->_getWpsProcess($identifier); // TODO: get from WPS Process Factory/Helper
|
|
|
|
|
|
|
+ $wpsProcess = Api_WpsHelper::getUserWpsProcess($identifier);
|
|
|
if (!$wpsProcess) throw new Api_WfsException("Forbidden", 403);
|
|
if (!$wpsProcess) throw new Api_WfsException("Forbidden", 403);
|
|
|
Api_WpsV1_DescribeProcess::sendDescribeProcessXml($wpsServerUrl, $wpsProcess);
|
|
Api_WpsV1_DescribeProcess::sendDescribeProcessXml($wpsServerUrl, $wpsProcess);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function _getWpsProcess($identifier) {
|
|
|
|
|
- $wpsProcess = Type_WpsProcess::build([
|
|
|
|
|
- 'identifier' => $identifier,
|
|
|
|
|
- 'title' => "Title({$identifier})",
|
|
|
|
|
- 'description' => "Desc($identifier)",
|
|
|
|
|
- 'maxOccurs' => "1",
|
|
|
|
|
- 'minOccurs' => "1",
|
|
|
|
|
- 'dataInputs' => [
|
|
|
|
|
- [
|
|
|
|
|
- 'identifier' => $identifier,
|
|
|
|
|
- 'title' => $title,
|
|
|
|
|
- 'description' => $description,
|
|
|
|
|
- 'type' => 'literal',
|
|
|
|
|
- ],
|
|
|
|
|
- ],
|
|
|
|
|
- // 'MimeType' => text/xml, 'Encoding' => base64, 'Schema' => http://foo.bar/gml/3.1.0/polygon.xsd
|
|
|
|
|
- 'defaultOutput' => [ 'MimeType' => "text/xml; subtype=wfs-collection/1.0" ],
|
|
|
|
|
- 'supportedOutput' => [
|
|
|
|
|
- [ 'MimeType' => "text/xml; subtype=wfs-collection/1.0" ],
|
|
|
|
|
- [ 'MimeType' => "text/xml; subtype=wfs-collection/1.1" ],
|
|
|
|
|
- [ 'MimeType' => "application/json" ],
|
|
|
|
|
- // [ 'MimeType' => "application/wfs-collection-1.0" ],
|
|
|
|
|
- // [ 'MimeType' => "application/wfs-collection-1.1" ],
|
|
|
|
|
- // [ 'MimeType' => "application/zip" ],
|
|
|
|
|
- ]
|
|
|
|
|
- ]);
|
|
|
|
|
- return $wpsProcess;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
static function exampleDescribeProcess_JTS_Area() {
|
|
static function exampleDescribeProcess_JTS_Area() {
|
|
|
header('Content-type: application/xml; charset=utf-8');
|
|
header('Content-type: application/xml; charset=utf-8');
|
|
|
echo '<?xml version="1.0" encoding="UTF-8"?><wps:ProcessDescriptions xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" service="WPS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"><ProcessDescription wps:processVersion="1.0.0" statusSupported="true" storeSupported="true"><ows:Identifier>JTS:area</ows:Identifier><ows:Title>Area</ows:Title><ows:Abstract>Returns the area of a geometry, in the units of the geometry. Assumes a Cartesian plane, so this process is only recommended for non-geographic CRSes.</ows:Abstract><DataInputs><Input maxOccurs="1" minOccurs="1"><ows:Identifier>geom</ows:Identifier><ows:Title>geom</ows:Title><ows:Abstract>Input geometry</ows:Abstract><ComplexData><Default><Format><MimeType>text/xml; subtype=gml/3.1.1</MimeType></Format></Default><Supported><Format><MimeType>text/xml; subtype=gml/3.1.1</MimeType></Format><Format><MimeType>text/xml; subtype=gml/2.1.2</MimeType></Format><Format><MimeType>application/wkt</MimeType></Format><Format><MimeType>application/json</MimeType></Format><Format><MimeType>application/gml-3.1.1</MimeType></Format><Format><MimeType>application/gml-2.1.2</MimeType></Format></Supported></ComplexData></Input></DataInputs><ProcessOutputs><Output><ows:Identifier>result</ows:Identifier><ows:Title>result</ows:Title><LiteralOutput><ows:DataType>double</ows:DataType></LiteralOutput></Output></ProcessOutputs></ProcessDescription></wps:ProcessDescriptions>';
|
|
echo '<?xml version="1.0" encoding="UTF-8"?><wps:ProcessDescriptions xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" service="WPS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd"><ProcessDescription wps:processVersion="1.0.0" statusSupported="true" storeSupported="true"><ows:Identifier>JTS:area</ows:Identifier><ows:Title>Area</ows:Title><ows:Abstract>Returns the area of a geometry, in the units of the geometry. Assumes a Cartesian plane, so this process is only recommended for non-geographic CRSes.</ows:Abstract><DataInputs><Input maxOccurs="1" minOccurs="1"><ows:Identifier>geom</ows:Identifier><ows:Title>geom</ows:Title><ows:Abstract>Input geometry</ows:Abstract><ComplexData><Default><Format><MimeType>text/xml; subtype=gml/3.1.1</MimeType></Format></Default><Supported><Format><MimeType>text/xml; subtype=gml/3.1.1</MimeType></Format><Format><MimeType>text/xml; subtype=gml/2.1.2</MimeType></Format><Format><MimeType>application/wkt</MimeType></Format><Format><MimeType>application/json</MimeType></Format><Format><MimeType>application/gml-3.1.1</MimeType></Format><Format><MimeType>application/gml-2.1.2</MimeType></Format></Supported></ComplexData></Input></DataInputs><ProcessOutputs><Output><ows:Identifier>result</ows:Identifier><ows:Title>result</ows:Title><LiteralOutput><ows:DataType>double</ows:DataType></LiteralOutput></Output></ProcessOutputs></ProcessDescription></wps:ProcessDescriptions>';
|
|
@@ -135,27 +107,14 @@ class Api_WpsV1_Server extends Api_WpsV1_ServerBase {
|
|
|
$serviceDescription = "Web Processing Service";
|
|
$serviceDescription = "Web Processing Service";
|
|
|
|
|
|
|
|
$idDefaultDB = DB::getPDO()->getZasobId();
|
|
$idDefaultDB = DB::getPDO()->getZasobId();
|
|
|
- $aclList = array_filter($this->_usrAcl->getTablesAcl(), function ($acl) use ($idDefaultDB) {
|
|
|
|
|
- // // $dataSourceName = 'default_db';// TODO: getSourceName
|
|
|
|
|
- // // $tblName = $tblAcl->getName();
|
|
|
|
|
- // // try {
|
|
|
|
|
- // // $acl = $this->getAclFromTypeName($typeName = "p5_{$dataSourceName}:{$tblName}");
|
|
|
|
|
- // // } catch (Exception $e) {
|
|
|
|
|
- // // // echo "Error for table({$tblName}): " . $e->getMessage() . "\n";
|
|
|
|
|
- // // }
|
|
|
|
|
- // // if (!$acl) {
|
|
|
|
|
- // // // TODO: error log msg
|
|
|
|
|
- // // return false;
|
|
|
|
|
- // // }
|
|
|
|
|
- return ($acl instanceof Core_AclBase && $idDefaultDB == $acl->getDB()); // hide non default_db tables
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ $wpsProcessList = Api_WpsHelper::getUserWpsProcessList();
|
|
|
|
|
|
|
|
switch (V::get('outputFormat', 'xml', $_GET)) {
|
|
switch (V::get('outputFormat', 'xml', $_GET)) {
|
|
|
case 'csv': {
|
|
case 'csv': {
|
|
|
- Api_WpsV1_GetCapabilities::sendGetCapabilitiesCsv($wpsServerUrl, $serviceTitle, $serviceDescription, $aclList);
|
|
|
|
|
|
|
+ Api_WpsV1_GetCapabilities::sendGetCapabilitiesCsv($wpsServerUrl, $serviceTitle, $serviceDescription, $wpsProcessList);
|
|
|
} break;
|
|
} break;
|
|
|
case 'xml': {
|
|
case 'xml': {
|
|
|
- Api_WpsV1_GetCapabilities::sendGetCapabilitiesXml($wpsServerUrl, $serviceTitle, $serviceDescription, $aclList);
|
|
|
|
|
|
|
+ Api_WpsV1_GetCapabilities::sendGetCapabilitiesXml($wpsServerUrl, $serviceTitle, $serviceDescription, $wpsProcessList);
|
|
|
} break;
|
|
} break;
|
|
|
default: throw new Api_WfsException("Not Implemented outputFormat", 501); // , null, 'NotImplemented', 'request');
|
|
default: throw new Api_WfsException("Not Implemented outputFormat", 501); // , null, 'NotImplemented', 'request');
|
|
|
}
|
|
}
|