Commit 2a42aad33f100f2939c5658a3701525e71bd357e

Authored by Benjamin Renard
1 parent 60aa4707
Exists in master and in 3 other branches WIP, epntap, ubuntu

Add getGranules in DDService

src/DATA/TOOLS/GetGranules.c
... ... @@ -4,7 +4,7 @@
4 4 *
5 5 * @details GetGranules(string *) <br>
6 6 * @arg \c argv[1] Path to VI
7   -* @arg \c argv[2] Prefix
  7 +* @arg \c argv[2] Times file name
8 8 *
9 9 */
10 10  
... ... @@ -32,7 +32,7 @@ int main(int argc, char *argv[])
32 32 int status;
33 33  
34 34 if (argc < 3){
35   - fprintf(stderr,"Usage: GetGranules path_to_vi prefix\n");
  35 + fprintf(stderr,"Usage: GetGranules path_to_vi times_file_name\n");
36 36 exit(1);
37 37 }
38 38  
... ... @@ -41,7 +41,6 @@ int main(int argc, char *argv[])
41 41 strcat(timesPath, argv[1]);
42 42 strcat(timesPath, "/");
43 43 strcat(timesPath, argv[2]);
44   - strcat(timesPath, "_times.nc");
45 44  
46 45 // Open VI_times.nc
47 46 int DataID;
... ...
src/DDSERVICES/REST/getGranules.php 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +<?php
  2 +
  3 +/**
  4 +* @file getGranules.php
  5 +* @brief Returns Granules for a given DataSet
  6 +* @version $Id: $
  7 +*/
  8 +
  9 + if (!isset($_GET['id'])) exit('INPUT ERROR');
  10 +
  11 + require_once './DDserverWeb_ini.php';
  12 +
  13 + error_reporting(E_ERROR | E_WARNING | E_PARSE);
  14 +
  15 + $replace = array("-" => "_");
  16 +
  17 + $dataSet = strtr($_GET['id'], $replace);
  18 +
  19 + $referXML = baseDir."/DDsys.xml";
  20 + $DDsys = new DOMDocument("1.0");
  21 + $DDsys->load($referXML);
  22 + $xp = new domxpath($DDsys);
  23 + $VI = $xp->query("//NAME[.='".$dataSet."']");
  24 +
  25 + if ($VI->item(0)->nodeValue != NULL)
  26 + {
  27 + $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue;
  28 + $times = $VI->item(0)->parentNode->getElementsByTagName("TIMES")->item(0)->nodeValue;
  29 + $cmd = "/opt/tools/DDServer/bin/GetGranules ".$location." ".$times;
  30 + exec($cmd, $output, $result_code);
  31 + if ($result_code === 0)
  32 + exit(implode("\n",$output));
  33 + }
  34 + exit('ERROR');
  35 +?>
... ...
src/DDSERVICES/SOAP/DDserverWeb.php
... ... @@ -492,6 +492,26 @@
492 492 return null;
493 493 }
494 494  
  495 +
  496 + function getGranules($dataset)
  497 + {
  498 + $referXML = baseDir."/DDsys.xml";
  499 + $DDsys = new DOMDocument("1.0");
  500 + $DDsys->load($referXML);
  501 + $xp = new domxpath($DDsys);
  502 + $VI = $xp->query("//NAME[.='".$dataSet."']");
  503 +
  504 + if ($VI->item(0)->nodeValue != NULL)
  505 + {
  506 + $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue;
  507 + $times = $VI->item(0)->parentNode->getElementsByTagName("TIMES")->item(0)->nodeValue;
  508 + $cmd = "/opt/tools/DDServer/bin/GetGranules ".$location." ".$times;
  509 + exec($cmd, $output, $result_code);
  510 + if ($result_code === 0)
  511 + return implode("\n",$output);
  512 + }
  513 + return NULL;
  514 + }
495 515  
496 516 /**
497 517 * Returns String Start-Stop for local DataSet in DD Base
... ...
src/DDSERVICES/SOAP/dd.wsdl.in
... ... @@ -86,6 +86,12 @@
86 86 <message name='getLastRealUpdateResponse'>
87 87 <part name='Result' type='xsd:string'/>
88 88 </message>
  89 +<message name='getGranulesRequest'>
  90 + <part name='dataSet' type='xsd:string'/>
  91 +</message>
  92 +<message name='getGranulesResponse'>
  93 + <part name='Result' type='xsd:string'/>
  94 +</message>
89 95 <message name='getInfoRequest'>
90 96 <part name='dataSet' type='xsd:string'/>
91 97 <part name='infoName' type='xsd:string'/>
... ... @@ -193,6 +199,10 @@
193 199 <operation name='getLastRealUpdate'>
194 200 <input message='tns:getLastRealUpdateRequest'/>
195 201 <output message='tns:getLastRealUpdateResponse'/>
  202 + </operation>
  203 + <operation name='getGranules'>
  204 + <input message='tns:getGranulesRequest'/>
  205 + <output message='tns:getGranulesResponse'/>
196 206 </operation>
197 207 <operation name='getInfo'>
198 208 <input message='tns:getInfoRequest'/>
... ... @@ -316,7 +326,18 @@
316 326 <soap:body use='encoded'
317 327 encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
318 328 </output>
319   - </operation>
  329 + </operation>
  330 + <operation name='getGranules'>
  331 + <soap:operation soapAction='getGranules'/>
  332 + <input>
  333 + <soap:body use='encoded'
  334 + encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
  335 + </input>
  336 + <output>
  337 + <soap:body use='encoded'
  338 + encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
  339 + </output>
  340 + </operation>
320 341 <operation name='getInfo'>
321 342 <soap:operation soapAction='getSInfo'/>
322 343 <input>
... ...