From 2a42aad33f100f2939c5658a3701525e71bd357e Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 16 Dec 2022 15:37:30 +0000 Subject: [PATCH] Add getGranules in DDService --- src/DATA/TOOLS/GetGranules.c | 5 ++--- src/DDSERVICES/REST/getGranules.php | 35 +++++++++++++++++++++++++++++++++++ src/DDSERVICES/SOAP/DDserverWeb.php | 20 ++++++++++++++++++++ src/DDSERVICES/SOAP/dd.wsdl.in | 23 ++++++++++++++++++++++- 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 src/DDSERVICES/REST/getGranules.php diff --git a/src/DATA/TOOLS/GetGranules.c b/src/DATA/TOOLS/GetGranules.c index ba2ec42..a846cce 100644 --- a/src/DATA/TOOLS/GetGranules.c +++ b/src/DATA/TOOLS/GetGranules.c @@ -4,7 +4,7 @@ * * @details GetGranules(string *)
* @arg \c argv[1] Path to VI -* @arg \c argv[2] Prefix +* @arg \c argv[2] Times file name * */ @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) int status; if (argc < 3){ - fprintf(stderr,"Usage: GetGranules path_to_vi prefix\n"); + fprintf(stderr,"Usage: GetGranules path_to_vi times_file_name\n"); exit(1); } @@ -41,7 +41,6 @@ int main(int argc, char *argv[]) strcat(timesPath, argv[1]); strcat(timesPath, "/"); strcat(timesPath, argv[2]); - strcat(timesPath, "_times.nc"); // Open VI_times.nc int DataID; diff --git a/src/DDSERVICES/REST/getGranules.php b/src/DDSERVICES/REST/getGranules.php new file mode 100644 index 0000000..4069dd5 --- /dev/null +++ b/src/DDSERVICES/REST/getGranules.php @@ -0,0 +1,35 @@ + "_"); + + $dataSet = strtr($_GET['id'], $replace); + + $referXML = baseDir."/DDsys.xml"; + $DDsys = new DOMDocument("1.0"); + $DDsys->load($referXML); + $xp = new domxpath($DDsys); + $VI = $xp->query("//NAME[.='".$dataSet."']"); + + if ($VI->item(0)->nodeValue != NULL) + { + $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue; + $times = $VI->item(0)->parentNode->getElementsByTagName("TIMES")->item(0)->nodeValue; + $cmd = "/opt/tools/DDServer/bin/GetGranules ".$location." ".$times; + exec($cmd, $output, $result_code); + if ($result_code === 0) + exit(implode("\n",$output)); + } + exit('ERROR'); +?> diff --git a/src/DDSERVICES/SOAP/DDserverWeb.php b/src/DDSERVICES/SOAP/DDserverWeb.php index f4dc4b0..a01c910 100644 --- a/src/DDSERVICES/SOAP/DDserverWeb.php +++ b/src/DDSERVICES/SOAP/DDserverWeb.php @@ -492,6 +492,26 @@ return null; } + + function getGranules($dataset) + { + $referXML = baseDir."/DDsys.xml"; + $DDsys = new DOMDocument("1.0"); + $DDsys->load($referXML); + $xp = new domxpath($DDsys); + $VI = $xp->query("//NAME[.='".$dataSet."']"); + + if ($VI->item(0)->nodeValue != NULL) + { + $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue; + $times = $VI->item(0)->parentNode->getElementsByTagName("TIMES")->item(0)->nodeValue; + $cmd = "/opt/tools/DDServer/bin/GetGranules ".$location." ".$times; + exec($cmd, $output, $result_code); + if ($result_code === 0) + return implode("\n",$output); + } + return NULL; + } /** * Returns String Start-Stop for local DataSet in DD Base diff --git a/src/DDSERVICES/SOAP/dd.wsdl.in b/src/DDSERVICES/SOAP/dd.wsdl.in index 3bbae57..483a5c1 100644 --- a/src/DDSERVICES/SOAP/dd.wsdl.in +++ b/src/DDSERVICES/SOAP/dd.wsdl.in @@ -86,6 +86,12 @@ + + + + + + @@ -193,6 +199,10 @@ + + + + @@ -316,7 +326,18 @@ - + + + + + + + + + + -- libgit2 0.21.2