Commit 464002c6006ad31af0ae9fa4ca1d9c2c80325b04
Exists in
master
and in
111 other branches
Merge branch 'webservices' into 'master'
Webservices See merge request !6
Showing
25 changed files
with
1266 additions
and
1417 deletions
Show diff stats
php/AMDA_METHODS_WSDL.php
... | ... | @@ -2,17 +2,14 @@ |
2 | 2 | |
3 | 3 | /** |
4 | 4 | * @file AMDA_METHODS_WSDL.php |
5 | -* @brief PHP SoapServer for IMPEx WebServices | |
6 | -* | |
7 | -* @version $Id: $ | |
8 | -* | |
5 | +* @brief PHP SoapServer for IMPEx WebServices | |
9 | 6 | */ |
10 | 7 | |
11 | - require_once 'config.php'; | |
12 | - | |
13 | - ini_set("soap.wsdl_cache_enabled", "0"); // desactive le cache WSDL | |
14 | - $server = new SoapServer('../public/wsdl/Methods_AMDA.wsdl'); | |
15 | - $server->setClass('WebServer'); | |
16 | - $server->handle(); | |
8 | + require_once 'config.php'; | |
17 | 9 | |
10 | + ini_set("soap.wsdl_cache_enabled", "0"); // desactive le cache WSDL | |
11 | + $server = new SoapServer('../public/wsdl/Methods_AMDA.wsdl'); | |
12 | + $server->setClass('WebServer'); | |
13 | + $server->handle(); | |
14 | + | |
18 | 15 | ?> |
19 | 16 | \ No newline at end of file |
... | ... |
php/classes/WSClientInterface.php renamed to php/WebServices/Client/WSClientInterface.php
... | ... | @@ -4,6 +4,7 @@ abstract class WSOutputFileFormat |
4 | 4 | const NETCDF = "netCDF"; |
5 | 5 | const VOTABLE = "VOTable"; |
6 | 6 | const ASCII = "ASCII"; |
7 | + const CDF = "CDF"; | |
7 | 8 | } |
8 | 9 | |
9 | 10 | abstract class WSOutputTimeFormat |
... | ... | @@ -29,7 +30,7 @@ abstract class WSOrbitUnit |
29 | 30 | |
30 | 31 | abstract class WSSpacecraft |
31 | 32 | { |
32 | - const CASSINI = "Cassini_Public"; | |
33 | + const CASSINI = "Cassini"; | |
33 | 34 | const GALILEO = "Galileo"; |
34 | 35 | const VOYAGER1 = "Voyager_1"; |
35 | 36 | const VOYAGER2 = "Voyager_2"; |
... | ... | @@ -117,7 +118,9 @@ Interface WSClientInterface |
117 | 118 | |
118 | 119 | public function getParameter($startTime, $stopTime, $parameterID, $sampling = 0, $userID = "", $password = "", |
119 | 120 | $outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0); |
120 | - | |
121 | + | |
122 | + public function getStatus($processID); | |
123 | + | |
121 | 124 | public function getDataset($startTime, $stopTime, $datasetID, $sampling = 0, $userID = "", $password = "", |
122 | 125 | $outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0); |
123 | 126 | |
... | ... |
php/classes/WSClientREST.php renamed to php/WebServices/Client/WSClientREST.php
php/classes/WSClientSOAP.php renamed to php/WebServices/Client/WSClientSOAP.php
... | ... | @@ -83,7 +83,16 @@ class WSClientSOAP implements WSClientInterface |
83 | 83 | |
84 | 84 | return $this->call(__FUNCTION__, $params); |
85 | 85 | } |
86 | - | |
86 | + | |
87 | + public function getStatus($processID) | |
88 | + { | |
89 | + $params = array('parameters' => array( | |
90 | + "id" => $processID | |
91 | + )); | |
92 | + | |
93 | + return $this->call(__FUNCTION__, $params); | |
94 | + } | |
95 | + | |
87 | 96 | public function getDataset($startTime, $stopTime, $datasetID, $sampling = 0, $userID = "", $password = "", |
88 | 97 | $outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0) |
89 | 98 | { |
... | ... |
php/testWebServer.php renamed to php/WebServices/Tests/testWebServer.php
1 | 1 | <?php |
2 | 2 | |
3 | -require_once("classes/WSClientSOAP.php"); | |
4 | -require_once("classes/WSClientREST.php"); | |
3 | +require_once("../Client/WSClientSOAP.php"); | |
4 | +//require_once("../Client/WSClientREST.php"); | |
5 | 5 | |
6 | 6 | function runSuiteTests($client) |
7 | 7 | { |
... | ... | @@ -11,44 +11,44 @@ function runSuiteTests($client) |
11 | 11 | echo "[ERROR] - Error during call of isAlive function".PHP_EOL; |
12 | 12 | else |
13 | 13 | echo "[OK] - isAlive".PHP_EOL; |
14 | - | |
14 | + | |
15 | 15 | //Test getTimeTablesList function without userID & password |
16 | - $res = $client->getTimeTablesList(); | |
17 | - if (!isset($res) || !$res->success) | |
18 | - echo "[ERROR] - Error during call of getTimeTablesList function - Test 1".PHP_EOL; | |
19 | - else | |
20 | - echo "[OK] - getTimeTablesList - Test 1 - ".$res->TimeTablesList.PHP_EOL; | |
21 | - | |
16 | +// $res = $client->getTimeTablesList(); | |
17 | +// if (!isset($res) || !$res->success) | |
18 | +// echo "[ERROR] - Error during call of getTimeTablesList function - Test 1".PHP_EOL; | |
19 | +// else | |
20 | +// echo "[OK] - getTimeTablesList - Test 1 - ".$res->TimeTablesList.PHP_EOL; | |
21 | + | |
22 | 22 | //Test getTimeTablesList function with userID & password |
23 | - $res = $client->getTimeTablesList("testKernel", "amda"); | |
23 | + $res = $client->getTimeTablesList("budnik", "Sacre-Cour"); | |
24 | 24 | if (!isset($res) || !$res->success) |
25 | 25 | echo "[ERROR] - Error during call of getTimeTablesList function - Test 2".PHP_EOL; |
26 | 26 | else |
27 | 27 | echo "[OK] - getTimeTablesList - Test 2 - ".$res->TimeTablesList.PHP_EOL; |
28 | - | |
28 | + | |
29 | 29 | //Test getTimeTable function without userID & password |
30 | - $res = $client->getTimeTable("sharedtt_0"); | |
31 | - if (!isset($res) || !$res->success) | |
32 | - echo "[ERROR] - Error during call of getTimeTable function - Test 1".PHP_EOL; | |
33 | - else | |
34 | - echo "[OK] - getTimeTable - Test 1 - ".$res->ttFileURL.PHP_EOL; | |
35 | - | |
30 | +// $res = $client->getTimeTable("sharedtt_0"); | |
31 | +// if (!isset($res) || !$res->success) | |
32 | +// echo "[ERROR] - Error during call of getTimeTable function - Test 1".PHP_EOL; | |
33 | +// else | |
34 | +// echo "[OK] - getTimeTable - Test 1 - ".$res->ttFileURL.PHP_EOL; | |
35 | + | |
36 | 36 | //Test getTimeTable function with userID & password |
37 | - $res = $client->getTimeTable("tt_0", "testKernel", "amda"); | |
37 | + $res = $client->getTimeTable("tt_0", "budnik", "Sacre-Cour"); | |
38 | 38 | if (!isset($res) || !$res->success) |
39 | 39 | echo "[ERROR] - Error during call of getTimeTable function - Test 2".PHP_EOL; |
40 | 40 | else |
41 | 41 | echo "[OK] - getTimeTable - Test 2 - ".$res->ttFileURL.PHP_EOL; |
42 | - | |
42 | + | |
43 | 43 | //Test getParameterList function for impex user |
44 | - $res = $client->getParameterList("impex"); | |
45 | - if (!isset($res) || !$res->success) | |
46 | - echo "[ERROR] - Error during call of getParameterList function - Test 1".PHP_EOL; | |
47 | - else | |
48 | - echo "[OK] - getParameterList - Test 1 - ".$res->ParameterList->LocalDataBaseParameters.PHP_EOL; | |
49 | - | |
44 | +// $res = $client->getParameterList("impex"); | |
45 | +// if (!isset($res) || !$res->success) | |
46 | +// echo "[ERROR] - Error during call of getParameterList function - Test 1".PHP_EOL; | |
47 | +// else | |
48 | +// echo "[OK] - getParameterList - Test 1 - ".$res->ParameterList->LocalDataBaseParameters.PHP_EOL; | |
49 | + | |
50 | 50 | //Test getParameterList function with userID & password |
51 | - $res = $client->getParameterList("testKernel", "amda"); | |
51 | + $res = $client->getParameterList("budnik", "Sacre-Cour"); | |
52 | 52 | if (!isset($res) || !$res->success) |
53 | 53 | echo "[ERROR] - Error during call of getParameterList function - Test 2".PHP_EOL; |
54 | 54 | else |
... | ... | @@ -57,7 +57,7 @@ function runSuiteTests($client) |
57 | 57 | echo " - UserDefinedParameters : ".$res->ParameterList->UserDefinedParameters.PHP_EOL; |
58 | 58 | echo " - LocalDataBaseParameters : ".$res->ParameterList->LocalDataBaseParameters.PHP_EOL; |
59 | 59 | } |
60 | - | |
60 | + | |
61 | 61 | //Test getObsDataTree function |
62 | 62 | $res = $client->getObsDataTree(); |
63 | 63 | if (!isset($res) || !$res->success) |
... | ... | @@ -150,7 +150,7 @@ function runSuiteTests($client) |
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | -$clientSOAP = new WSClientSOAP("http://localhost/NEWAMDA-BENJAMIN/public/wsdl/Methods_AMDA.wsdl"); | |
153 | +$clientSOAP = new WSClientSOAP("http://apus.irap.omp.eu/NEWAMDA/public/wsdl/Methods_AMDA.wsdl"); | |
154 | 154 | |
155 | 155 | echo "==> Suite tests for SOAP client".PHP_EOL; |
156 | 156 | runSuiteTests($clientSOAP); |
... | ... |
php/classes/WSUserMgr.php renamed to php/WebServices/WSUserMgr.php
... | ... | @@ -8,31 +8,37 @@ |
8 | 8 | class WSUserMgr extends UserMgr |
9 | 9 | { |
10 | 10 | protected $isSoap; |
11 | + | |
12 | + private function throwError($errorType, $msg) | |
13 | + { | |
14 | + if ($this->isSoap) | |
15 | + throw new SoapFault($errorType, $msg); | |
16 | + else | |
17 | + return array("error" => $msg); | |
18 | + } | |
11 | 19 | |
12 | - /***************************************************************** | |
13 | - * PUBLIC FUNCTIONS | |
14 | - *****************************************************************/ | |
15 | - | |
16 | - public function init($username, $password, $sessionID, $isSoap) | |
20 | + public function init($username, $password, $sessionID, $setPathOnly, $isSoap) | |
17 | 21 | { |
18 | 22 | $this->user = trim($username); |
19 | - $this->sessionID = trim($sessionID); | |
20 | - $this->passwd = trim($password); | |
23 | + if (isset($sessionID)) | |
24 | + $this->sessionID = trim($sessionID); | |
25 | + if (isset($password)) | |
26 | + $this->passwd = trim($password); | |
21 | 27 | |
22 | 28 | $this->isSoap = isset($isSoap); |
23 | 29 | |
24 | - // Check if user has DD session already open, otherwise - login | |
25 | - if ($this->ddCheckUser() != 0) | |
30 | + if (isset($password) && ! $setPathOnly) | |
26 | 31 | { |
27 | - if ($this->ddLogin() != 0) { // DD Login if user is not registered | |
28 | - if ($this->isSoap) throw new SoapFault("error", "Login procedure failed"); | |
29 | - else return array("error" => "Login procedure failed"); | |
30 | - } | |
31 | - | |
32 | + // Check if user has DD session already open, otherwise - login | |
32 | 33 | if ($this->ddCheckUser() != 0) |
33 | 34 | { |
34 | - if ($this->isSoap) throw new SoapFault("error", "CheckUser procedure failed"); | |
35 | - else return array("error" => "CheckUser procedure failed"); | |
35 | + if ($this->ddLogin() != 0) { // DD Login if user is not registered | |
36 | + $this->throwError("loginError", "Login procedure failed"); | |
37 | + } | |
38 | + | |
39 | + if ($this->ddCheckUser() != 0) { | |
40 | + $this->throwError("loginError", "CheckUser procedure failed"); | |
41 | + } | |
36 | 42 | } |
37 | 43 | } |
38 | 44 | |
... | ... | @@ -41,30 +47,18 @@ class WSUserMgr extends UserMgr |
41 | 47 | if (!is_dir($this->userdir)) |
42 | 48 | { |
43 | 49 | if (!$this->createDir()) { |
44 | - if ($this->isSoap) throw new SoapFault("error", "Cannot create UserDir"); | |
45 | - else return array("error" => "Cannot create UserDir"); | |
50 | + $this->throwError("loginError", "Cannot create UserDir"); | |
46 | 51 | } |
47 | 52 | } |
48 | - | |
49 | - // $this->userWS = USERPATH . "/" . $this->user . "/WS/"; | |
50 | - // chmod($this->userWS, 0775); | |
51 | - // $this->userMissions = $this->getAvailableMissionsByUser(); | |
52 | 53 | |
53 | 54 | $this->setPath(); |
54 | - | |
55 | - return array('success' => true); | |
56 | - } | |
57 | - | |
58 | - public function makeUserWS() | |
59 | - { | |
60 | - if (file_exists(USERWSDIR.'LocalParams.xml')) | |
61 | - unlink(USERWSDIR.'LocalParams.xml'); | |
62 | - // if (!file_exists(USERWSDIR.'LocalParams.xml')) | |
63 | - symlink(DATAPATH.'/LocalData/LocalParams.xml', USERWSDIR.'LocalParams.xml'); | |
64 | - // $this->makeLocalTree(); | |
55 | + if ( $setPathOnly ) | |
56 | + return array('success' => true); | |
57 | + | |
58 | + $this->makeLocalTree(); | |
65 | 59 | $this->makeRemoteTree(); |
66 | 60 | |
67 | - return $this->user; | |
61 | + return array('success' => true); | |
68 | 62 | } |
69 | 63 | } |
70 | 64 | ?> |
71 | 65 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,736 @@ |
1 | +<?php | |
2 | +/** | |
3 | +* @file WebServer.php | |
4 | +* @brief Web services AMDA | |
5 | +*/ | |
6 | + | |
7 | +class WebServer | |
8 | +{ | |
9 | + private $isSoap = false; | |
10 | + private $userID, $userPWD = null, $sessionID = null, $IPclient; | |
11 | + private $dataFileName; | |
12 | + private $requestManager = null; | |
13 | + private $paramLoader = null; | |
14 | + private $service; | |
15 | + private $requestTime; | |
16 | + | |
17 | + function __construct() | |
18 | + { | |
19 | + if (!is_dir(WSConfigClass::getWsResultDir())) mkdir(WSConfigClass::getWsResultDir(), 0775); | |
20 | + } | |
21 | + | |
22 | + protected function init($data) | |
23 | + { | |
24 | + $this->requestTime = date('Ymd',time()); | |
25 | + | |
26 | + if (!isset($data)) { | |
27 | + $this->userID = 'impex'; | |
28 | + return array('success' => true); | |
29 | + } | |
30 | + | |
31 | + if(is_object($data)){ | |
32 | + $vars = get_object_vars($data); | |
33 | + $this->isSoap = true; | |
34 | + } | |
35 | + else { | |
36 | + $vars = $data; | |
37 | + } | |
38 | + | |
39 | + if (isset($vars['userID'])){ | |
40 | + $this->userID = $vars['userID']; | |
41 | + } | |
42 | + else { | |
43 | + $this->userID = 'impex'; | |
44 | + } | |
45 | + | |
46 | + $this->sessionID = $this->userID; | |
47 | + | |
48 | + if (isset($vars['password'])) | |
49 | + $this->userPWD = $vars['password']; | |
50 | + else | |
51 | + $this->userPWD = 'impexfp7'; | |
52 | + | |
53 | + return array('success' => true, 'vars' => $vars); | |
54 | + } | |
55 | + | |
56 | + private function initUserMgr($setPatOnly = false) | |
57 | + { | |
58 | + $wsUserMgr = new WSUserMgr(); | |
59 | + $wsUserMgr->init($this->userID, $this->userPWD, $this->sessionID, $setPatOnly, $this->isSoap); | |
60 | + | |
61 | + $this->IPclient = $wsUserMgr->getIPClient(); | |
62 | + | |
63 | + return array('success' => true); | |
64 | + } | |
65 | + | |
66 | + private function throwError($errorType, $msg) | |
67 | + { | |
68 | + if ($this->isSoap) | |
69 | + throw new SoapFault($errorType, $msg); | |
70 | + else | |
71 | + return array("error" => $msg); | |
72 | + } | |
73 | + | |
74 | + private function isGetPlotRequest($name){ | |
75 | + | |
76 | + return (substr($name,0,7) == 'getplot'); | |
77 | + } | |
78 | + | |
79 | + private function xsl2vot($inputName, $outputName) | |
80 | + { | |
81 | + // Load Time table | |
82 | + $xml = new DomDocument("1.0"); | |
83 | + if (!@$xml->load($inputName)) | |
84 | + $this->throwError("wokrspaceError", "Cannot load time table $inputName for ".$this->userID); | |
85 | + | |
86 | + // Load XSL file | |
87 | + $xsl = new DomDocument("1.0"); | |
88 | + if (!@$xsl->load(WSConfigClass::getXslDir()."xml2vot.xsl")) | |
89 | + $this->throwError("systemError", "Cannot load xsl file"); | |
90 | + | |
91 | + // Import XSL and write output file in vot format | |
92 | + $xslt = new XSLTProcessor(); | |
93 | + $xslt->importStylesheet($xsl); | |
94 | + $vot = new DomDocument("1.0"); | |
95 | + if (!@$vot->loadXML($xslt->transformToXML($xml))) | |
96 | + $this->throwError("systemError", "Cannot convert time table to VOtable"); | |
97 | + | |
98 | + if (!$vot->save(WSConfigClass::getWsResultDir().$outputName)) | |
99 | + $this->throwError("systemError", "Cannot save time table to result dir"); | |
100 | + } | |
101 | + | |
102 | + private function getDatasetInfo($id) | |
103 | + { | |
104 | + $dataSetXml = WSConfigClass::getDataSetInfoDir().$id.".xml"; | |
105 | + | |
106 | + if (!file_exists($dataSetXml)) | |
107 | + $this->throwError("systemError", "Cannot find info file for dataset ".$id); | |
108 | + | |
109 | + $dataSetDom = new DomDocument("1.0"); | |
110 | + | |
111 | + if (!@$dataSetDom->load($dataSetXml)) | |
112 | + $this->throwError("systemError", "Cannot load info file for dataset ".$id); | |
113 | + | |
114 | + return $dataSetDom; | |
115 | + } | |
116 | + | |
117 | +/* | |
118 | +* get user TimeTables list; Shared for impex | |
119 | +*/ | |
120 | + private function getTimeTablesCatalogsList($object) | |
121 | + { | |
122 | + $this->initUserMgr(true); | |
123 | + $dom = new DOMDocument("1.0"); | |
124 | + | |
125 | + if ($this->userID == 'impex') { | |
126 | + $sharedObjMgr = new SharedObjectsMgr(); | |
127 | + if (!@$dom->load($sharedObjMgr->getTreeFilePath())) | |
128 | + $this->throwError("workspaceError", "Workspace Error : Cannot load Shared TimeTable list"); | |
129 | + } | |
130 | + else { | |
131 | + if (!@$dom->load(USERWSDIR.'Tt.xml')) | |
132 | + $this->throwError("workspaceError", "Workspace Error : Cannot load TimeTable list for ".$this->userID); | |
133 | + } | |
134 | + | |
135 | + $tagName = $object == "timetables" ? "timetabList" : "catalogList"; | |
136 | + $timetabNode = $dom->getElementsByTagName($tagName); | |
137 | + | |
138 | + if ($timetabNode->length < 1){ | |
139 | + $this->throwError("workspaceWarning", "Workspace Warning : No $object"); | |
140 | + } | |
141 | + | |
142 | + $outDOM = new DOMDocument("1.0"); | |
143 | + $outDOM->formatOutput = TRUE; | |
144 | + $outDOM->preserveWhiteSpace = FALSE; | |
145 | + | |
146 | + $newNode = $outDOM->importNode($timetabNode->item(0),TRUE); | |
147 | + $outDOM->appendChild($newNode); | |
148 | + | |
149 | + $ttListResult = $object.'_'.$this->userID.'_'.$this->requestTime.'.xml'; | |
150 | + | |
151 | + if (!$outDOM->save(WSConfigClass::getWsResultDir().$ttListResult)) | |
152 | + $this->throwError("workspaceError", "Workspace Error : problem while saving $object list file"); | |
153 | + | |
154 | + return WSConfigClass::getUrl().$ttListResult; | |
155 | + } | |
156 | + | |
157 | +/* | |
158 | +* Get corresponding orbit parameter ID | |
159 | +*/ | |
160 | + private function getOrbitParameter($orbitRequest) | |
161 | + { | |
162 | + if (!file_exists(WSConfigClass::getOrbitsXml())) | |
163 | + $this->throwError('systemError', "No AMDA system orbits file"); | |
164 | + | |
165 | + $orbitsXml = new DomDocument(); | |
166 | + | |
167 | + if (!@$orbitsXml->load(WSConfigClass::getOrbitsXml())) | |
168 | + $this->throwError('systemError', "Cannot load AMDA system orbits file"); | |
169 | + | |
170 | + $spacecraft = strtolower($orbitRequest['spacecraft']); | |
171 | + $spacecraft = str_replace('-', '', $spacecraft); | |
172 | + | |
173 | + $xpath = new DOMXpath($orbitsXml); | |
174 | + $path = '//orbites[@mission="'.$spacecraft.'" and @coordinate_system="'.$orbitRequest['coordinateSystem'].'" and @units="'.$orbitRequest['units'].'" ] '; | |
175 | + | |
176 | + $orbits = $xpath->query($path); | |
177 | + | |
178 | + foreach ($orbits as $orbit) | |
179 | + { | |
180 | + $datasetID = strtr($orbit->getAttribute('dataset'),"_","-"); | |
181 | + $dataSetDom = $this->getDatasetInfo($datasetID); | |
182 | + | |
183 | + $paramStart = strtotime($dataSetDom->getElementsByTagName('global_start')->item(0)->nodeValue); | |
184 | + $paramStop = strtotime($dataSetDom->getElementsByTagName('global_stop')->item(0)->nodeValue); | |
185 | + | |
186 | + if(($paramStart <= strtotime($orbitRequest['startTime']) && (strtotime($orbitRequest['stopTime'])) <= $paramStop)) { | |
187 | + | |
188 | + return array('success' => true, | |
189 | + 'parameterID' => $orbit->getAttribute('xml:id') | |
190 | + ); | |
191 | + } | |
192 | + } | |
193 | + | |
194 | + $this->throwError('systemError', | |
195 | + "Cannot find orbit data for ".$orbitRequest['spacecraft']." for ".$orbitRequest['startTime']."-".$orbitRequest['stopTime']." in ".$orbitRequest['units']." ".$orbitRequest['coordinateSystem']."($paramStart - $paramStop)"); | |
196 | + } | |
197 | + | |
198 | + private function doDownloadRequest($interval, $paramList, $formatInfo) | |
199 | + { | |
200 | + if (!isset($this->paramLoader)) | |
201 | + $this->paramLoader = new IHMUserParamLoaderClass(); | |
202 | + | |
203 | + //Build parameter list | |
204 | + $params = array(); | |
205 | + | |
206 | + //TODO template arguments to implement ? | |
207 | + foreach ($paramList['params'] as $paramId) | |
208 | + { | |
209 | + $param = new stdClass; | |
210 | + | |
211 | + if (preg_match("#^ws_#",$paramId)) | |
212 | + { | |
213 | + $res = $this->paramLoader->getDerivedParameterNameFromId($paramId); | |
214 | + | |
215 | + if (!$res["success"]) { | |
216 | + $this->throwError("serverError", "Not available derived parameter $paramId"); | |
217 | + } | |
218 | + $param->paramid = "ws_".$res['name']; | |
219 | + } | |
220 | + else if (preg_match("#^wsd_#",$paramId)) | |
221 | + { | |
222 | + $res = $this->paramLoader->getUploadedParameterNameFromId($paramId); | |
223 | + | |
224 | + if (!$res["success"]){ | |
225 | + $this->throwError("serverError", "Not available parameter $paramId"); | |
226 | + } | |
227 | + $param->paramid = "wsd_".$res['name']; | |
228 | + } | |
229 | + else { | |
230 | + $param->paramid = $paramId; | |
231 | + } | |
232 | + $params[] = $param; | |
233 | + } | |
234 | + | |
235 | + $obj = (object)array( | |
236 | + "sampling" => $interval['sampling'], | |
237 | + "startDate" => $interval['startTime'], | |
238 | + "stopDate" => $interval['stopTime'], | |
239 | + "list" => $params, | |
240 | + "fileformat" => $formatInfo['format'], | |
241 | + "timeformat" => $formatInfo['timeFormat'], | |
242 | + "compression" => $formatInfo['gzip'] | |
243 | + ); | |
244 | + | |
245 | + if (!isset($this->requestManager)) | |
246 | + $this->requestManager = new RequestManagerClass(); | |
247 | + | |
248 | + try { | |
249 | + $downloadResult = $this->requestManager->runWSRequest($this->userID, $this->IPclient, FunctionTypeEnumClass::PARAMS, $this->service, $obj); | |
250 | + } catch (Exception $e) { | |
251 | + $this->throwError("executionError", "Exception detected : ".$e->getMessage()); | |
252 | + } | |
253 | + | |
254 | + if (!$downloadResult['success']) { | |
255 | + $this->throwError("serverError", $downloadResult['message']); | |
256 | + } | |
257 | + | |
258 | + if($downloadResult['status'] == 'in_progress') { | |
259 | + return ['success' => true, 'status' => 'in progress', 'id' => $downloadResult['id']]; | |
260 | + } elseif ($downloadResult['status'] == 'done') | |
261 | + { | |
262 | + $this->deleteProcess($downloadResult['id']); | |
263 | + return array('success' => true, 'status' => 'done', 'dataFileURLs' => WSConfigClass::getUrl().$downloadResult['result']); | |
264 | + } else { | |
265 | + return ['success' => false, 'message' => 'Unknown status ' . $downloadResult['status']]; | |
266 | + } | |
267 | + } | |
268 | + | |
269 | +/* | |
270 | +* delete process after execution : | |
271 | +* delete temporary files/folders ( JOBS/process_xxxx, RES/DDxxx ); | |
272 | +* delete job node in processManager.xml | |
273 | +*/ | |
274 | + private function deleteProcess($id) | |
275 | + { | |
276 | + $obj = (object)array('id' => $id); | |
277 | + | |
278 | + if (!isset($this->requestManager)) | |
279 | + $this->requestManager = new RequestManagerClass(); | |
280 | + | |
281 | + try { | |
282 | + $downloadResult = $this->requestManager->runWSRequest($this->userID, $this->IPclient, FunctionTypeEnumClass::PROCESSDELETE, null, $obj); | |
283 | + } catch (Exception $e) { | |
284 | + $this->throwError("deleteProcessError", $e->getMessage()); | |
285 | + } | |
286 | + } | |
287 | + | |
288 | +/* | |
289 | +* generate AUTH token for access to REST services | |
290 | +*/ | |
291 | + public function getNewToken() | |
292 | + { | |
293 | + // generate token from timeStamp and some salt | |
294 | + $newToken = md5(1321 * (int)( time() / WSConfigClass::$timeLimitQuery)); | |
295 | + | |
296 | + return array('success' => true, 'token' => $newToken); | |
297 | + } | |
298 | + | |
299 | +/************************** WEB SERVICES **************************************/ | |
300 | + | |
301 | +/* | |
302 | +* public data only : user impex | |
303 | +*/ | |
304 | + public function getObsDataTree() | |
305 | + { | |
306 | + $res = $this->init(); | |
307 | + $this->initUserMgr(); | |
308 | + | |
309 | + $locParamSrc = USERWSDIR.'LocalParams.xml'; | |
310 | + $locParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_AmdaLocalDataBaseParameters.xml'; | |
311 | + | |
312 | + if (!copy($locParamSrc,WSConfigClass::getWsResultDir().$locParamDst)) | |
313 | + $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file'); | |
314 | + | |
315 | + return array('success' => true,'WorkSpace' => array("LocalDataBaseParameters" => WSConfigClass::getUrl().$locParamDst)); | |
316 | + } | |
317 | + | |
318 | +/* | |
319 | +* get Parameter List for given user | |
320 | +*/ | |
321 | + public function getParameterList($data) | |
322 | + { | |
323 | + $res = $this->init($data); | |
324 | + $this->initUserMgr(); | |
325 | + | |
326 | + $vars = $res['vars']; | |
327 | + | |
328 | + $locParamSrc = USERWSDIR.'LocalParams.xml'; | |
329 | + $wsParamSrc = USERWSDIR.'WsParams.xml'; | |
330 | + | |
331 | + $locParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_AmdaLocalDataBaseParameters.xml'; | |
332 | + $wsParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_UserDefinedParameters.xml'; | |
333 | + | |
334 | + if (!copy($locParamSrc, WSConfigClass::getWsResultDir().$locParamDst)) | |
335 | + $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file for '.$this->userID); | |
336 | + | |
337 | + if (!copy($wsParamSrc, WSConfigClass::getWsResultDir().$wsParamDst)) | |
338 | + $this->throwError('workspaceError', 'No User Defined Parameters description file for '.$this->userID); | |
339 | + | |
340 | + return array('success' => true,'ParameterList' => | |
341 | + array("UserDefinedParameters" => WSConfigClass::getUrl().$wsParamDst, | |
342 | + "LocalDataBaseParameters" => WSConfigClass::getUrl().$locParamDst, | |
343 | + "RemoteDataBaseParameters" => "not implemented")); | |
344 | + } | |
345 | + | |
346 | +/* | |
347 | +* getParameter | |
348 | +*/ | |
349 | + public function getParameter($data) | |
350 | + { | |
351 | + $res = $this->init($data); | |
352 | + | |
353 | + if (!$res['success']){ | |
354 | + $this->throwError("requestError", "Cannot parse request"); | |
355 | + } | |
356 | + | |
357 | + $this->initUserMgr(); | |
358 | + | |
359 | + $vars = $res['vars']; | |
360 | + | |
361 | + if (strtotime($vars["stopTime"]) <= strtotime($vars["startTime"])){ | |
362 | + $this->throwError("requestError", "Requested time interval should be greater than 0"); | |
363 | + } | |
364 | + | |
365 | + $paramId = array(); | |
366 | + array_push($paramId, $vars["parameterID"]); | |
367 | + | |
368 | + if (!$vars["timeFormat"]) | |
369 | + $timeFormat = "ISO8601"; | |
370 | + else | |
371 | + $timeFormat = $vars["timeFormat"]; | |
372 | + | |
373 | + if (!$vars["gzip"]) | |
374 | + $gzip = 0; | |
375 | + else | |
376 | + $gzip = $vars["gzip"]; | |
377 | + | |
378 | + if (!$vars["stream"]) | |
379 | + $stream = 0; | |
380 | + else | |
381 | + $stream = $vars["stream"]; | |
382 | + | |
383 | + $this->service = strtolower(__FUNCTION__); | |
384 | + | |
385 | + $res = $this->doDownloadRequest( | |
386 | + array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $vars["sampling"]), | |
387 | + array("params" => $paramId), | |
388 | + array("format" => $vars["outputFormat"], "timeFormat"=> $timeFormat, "gzip"=>$gzip, "stream"=>$stream)); | |
389 | + | |
390 | + if ($res['success']) | |
391 | + return $res; | |
392 | + | |
393 | + $this->throwError("serverError", $res['message']); | |
394 | + } | |
395 | + | |
396 | +/* | |
397 | +* get user Catalogs list; Shared for impex | |
398 | +*/ | |
399 | + public function getCatalogsList($data) | |
400 | + { | |
401 | + $this->init($data); | |
402 | + $this->init($data); | |
403 | + return array('success' => true, 'CatalogsList' => $this->getTimeTablesCatalogsList('catalogs')); | |
404 | + } | |
405 | + | |
406 | +/* | |
407 | +* get user TimeTables list; Shared for impex | |
408 | +*/ | |
409 | + public function getTimeTablesList($data) | |
410 | + { | |
411 | + $this->init($data); | |
412 | + | |
413 | + return array('success' => true, 'TimeTablesList' => $this->getTimeTablesCatalogsList('timetables')); | |
414 | + } | |
415 | + | |
416 | + public function isAlive() | |
417 | + { | |
418 | + return true; | |
419 | + } | |
420 | + | |
421 | +/* | |
422 | +* get Dataset | |
423 | +*/ | |
424 | + public function getDataset($data) | |
425 | + { | |
426 | + $res = $this->init($data); | |
427 | + | |
428 | + if (!$res['success']){ | |
429 | + $this->throwError("requestError", "Cannot parse request"); | |
430 | + } | |
431 | + | |
432 | + $this->initUserMgr(); | |
433 | + | |
434 | + $vars = $res['vars']; | |
435 | + | |
436 | + if (strtotime($vars["stopTime"]) <= strtotime($vars["startTime"])){ | |
437 | + $this->throwError("requestError", "Requested time interval should be greater than 0"); | |
438 | + } | |
439 | + | |
440 | + $dataSetDom = $this->getDatasetInfo($vars['datasetID']); | |
441 | + | |
442 | + $params = $dataSetDom->getElementsByTagName("parameter"); | |
443 | + | |
444 | + if ($params->length == 0) | |
445 | + $this->throwError("systemError", "Cannot find parameter list for dataset ".$vars['datasetID']); | |
446 | + | |
447 | + $paramId = array(); | |
448 | + | |
449 | + foreach ($params as $p) | |
450 | + $paramId[] = $p->nodeValue; | |
451 | + | |
452 | + if (!$vars["sampling"]) | |
453 | + { | |
454 | + $sampling = $dataSetDom->getElementsByTagName('min_sampling')->item(0)->nodeValue; | |
455 | + | |
456 | + $units = substr($sampling,-1); | |
457 | + $sampling = substr($sampling,0,strlen($sampling)-1); | |
458 | + | |
459 | + switch ($units) { | |
460 | +// case 'S': | |
461 | +// $sampling = floatval($sampling); | |
462 | +// break; | |
463 | + case 'M': | |
464 | + $sampling = floatval($sampling)*60; | |
465 | + break; | |
466 | + case 'H': | |
467 | + $sampling = floatval($sampling)*60*60; | |
468 | + break; | |
469 | + default: | |
470 | + } | |
471 | + } | |
472 | + else { | |
473 | + $sampling = $vars["sampling"]; | |
474 | + } | |
475 | + | |
476 | + if (!$vars["timeFormat"]) | |
477 | + $timeFormat = "ISO8601"; | |
478 | + else | |
479 | + $timeFormat = $vars["timeFormat"]; | |
480 | + | |
481 | + if (!$vars["gzip"]) | |
482 | + $gzip = 0; | |
483 | + else | |
484 | + $gzip = $vars["gzip"]; | |
485 | + | |
486 | + if (!$vars["stream"]) | |
487 | + $stream = 0; | |
488 | + else | |
489 | + $stream = $vars["stream"]; | |
490 | + | |
491 | + $this->service = strtolower(__FUNCTION__); | |
492 | + | |
493 | + $res = $this->doDownloadRequest( | |
494 | + array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $sampling), | |
495 | + array("params" => $paramId), | |
496 | + array("format" => $vars["outputFormat"], "timeFormat"=> $timeFormat, "gzip"=>$gzip, "stream"=>$stream)); | |
497 | + | |
498 | + if ($res['success']) return $res; | |
499 | + | |
500 | + $this->throwError("serverError", $res['message']); | |
501 | + } | |
502 | + | |
503 | +/* | |
504 | +* get status for jobs in batch | |
505 | +*/ | |
506 | + public function getStatus($data) | |
507 | + { | |
508 | + $result = $this->init($data); | |
509 | + | |
510 | + $id = $result['vars']['id']; | |
511 | + | |
512 | + if (!isset($this->requestManager)) | |
513 | + $this->requestManager = new RequestManagerClass(); | |
514 | + | |
515 | + try | |
516 | + { | |
517 | + $res = $this->requestManager->runWSRequest('nobody', 'nobody', FunctionTypeEnumClass::PROCESSGETINFO, null, $id); | |
518 | + } | |
519 | + catch (Exception $e) | |
520 | + { | |
521 | + // after first getStatus() call process is deleted | |
522 | + $jobsManager = new WSJobsManagerClass(); | |
523 | + | |
524 | + try | |
525 | + { | |
526 | + $res = $jobsManager->getResultFromProcessId($id); | |
527 | + if (!$res['success']) { | |
528 | + $this->throwError("processError","Cannot retrieve process $id info"); | |
529 | + } | |
530 | + | |
531 | + $resultTag = $this->isGetPlotRequest($res['result']) ? 'plotURL' : 'dataFileURLs'; | |
532 | + | |
533 | + return array('success' => true, 'status' => 'done', $resultTag => WSConfigClass::getUrl().$res['result']); | |
534 | + } | |
535 | + catch (Exception $e) | |
536 | + { | |
537 | + $this->throwError("getResultFromProcessIdError", "Exception detected : ".$e->getMessage()); | |
538 | + } | |
539 | + } | |
540 | + | |
541 | + if (!$res['success']) { | |
542 | + $this->throwError("processError","Cannot retrieve process $id info"); | |
543 | + } | |
544 | + | |
545 | + if ($res['status'] == 'in_progress') { | |
546 | + return array('success' => true, 'status' => 'in progress'); | |
547 | + } | |
548 | + | |
549 | + if ($res['error']) { | |
550 | + $this->throwError("processError","Process $id error code"); | |
551 | + } | |
552 | + | |
553 | + $this->deleteProcess($res['id']); | |
554 | + | |
555 | + $resultTag = $this->isGetPlotRequest($res['result']) ? 'plotURL' : 'dataFileURLs'; | |
556 | + | |
557 | + return array('success' => true, 'status' => $res['status'], $resultTag => WSConfigClass::getUrl().$res['result']); | |
558 | + } | |
559 | + | |
560 | +/* | |
561 | +* TODO Can be done by TTCONVERT function of AMDA_Kernel - more hard !!! | |
562 | +* TODO Think about this if merge/union will be also done by AMDA_Kernel | |
563 | +* | |
564 | +* get Time Table : shared for impex ; user' for user | |
565 | +*/ | |
566 | + public function getTimeTable($data) | |
567 | + { | |
568 | + $res = $this->init($data); | |
569 | + | |
570 | + if (!$res['success']){ | |
571 | + $this->throwError("requestError", "Cannot parse request"); | |
572 | + } | |
573 | + | |
574 | + $this->initUserMgr(true); | |
575 | + | |
576 | + $ttID = $res['vars']['ttID']; | |
577 | + | |
578 | + if ($this->userID == 'impex') { | |
579 | + $sharedObjMgr = new SharedObjectsMgr(); | |
580 | + $ttSrc = $sharedObjMgr->getDataFilePath('timeTable', $ttID); | |
581 | + } | |
582 | + else | |
583 | + $ttSrc = USERTTDIR.$ttID.'.xml'; | |
584 | + | |
585 | + if (!file_exists($ttSrc)) { | |
586 | + $this->throwError("workspaceError", "No such table ".$ttID." for user ".$this->userID); | |
587 | + } | |
588 | + | |
589 | + $ttDst = substr(strtolower(__FUNCTION__), 3)."_".$this->userID."_".$this->requestTime."_$ttID.xml"; | |
590 | + | |
591 | + //TODO can be done by | |
592 | + // $res = $this->requestManager->runWSRequest($this->userID, $this->IPclient,FunctionTypeEnumClass::TTCONVERT, null, $ttID); | |
593 | + $this->xsl2vot($ttSrc,$ttDst); | |
594 | + | |
595 | + return array('success' => true, 'ttFileURL' => WSConfigClass::getUrl().$ttDst); | |
596 | + } | |
597 | + | |
598 | +/* | |
599 | +* get Orbits | |
600 | +*/ | |
601 | + public function getOrbites($data) | |
602 | + { | |
603 | + $res = $this->init($data); | |
604 | + | |
605 | + if (!$res['success']){ | |
606 | + $this->throwError("requestError", "Cannot parse request"); | |
607 | + } | |
608 | + | |
609 | + $this->initUserMgr(); | |
610 | + | |
611 | + $vars = $res['vars']; | |
612 | + | |
613 | + if (strtotime($vars["stopTime"]) <= strtotime($vars["startTime"])){ | |
614 | + $this->throwError("requestError", "Requested time interval should be greater than 0"); | |
615 | + } | |
616 | + | |
617 | + $spacecraft = $vars["spacecraft"]; | |
618 | + $coordinateSystem = $vars["coordinateSystem"]; | |
619 | + | |
620 | + if (!$vars["units"]) | |
621 | + $units = "km"; | |
622 | + else | |
623 | + $units = $vars["units"]; | |
624 | + | |
625 | + $orbitRequest = array("startTime" => $vars["startTime"], | |
626 | + "stopTime" => $vars["stopTime"], | |
627 | + "spacecraft" => $spacecraft, | |
628 | + "coordinateSystem" => $coordinateSystem, | |
629 | + "units" => $units | |
630 | + ); | |
631 | + | |
632 | + $orbitParam = $this->getOrbitParameter($orbitRequest); | |
633 | + | |
634 | + $paramId = array(); | |
635 | + array_push($paramId, $orbitParam['parameterID']); | |
636 | + | |
637 | + if (!$vars["timeFormat"]) | |
638 | + $timeFormat = "ISO8601"; | |
639 | + else | |
640 | + $timeFormat = $vars["timeFormat"]; | |
641 | + | |
642 | + if (!$vars["gzip"]) | |
643 | + $gzip = 0; | |
644 | + else | |
645 | + $gzip = $vars["gzip"]; | |
646 | + | |
647 | + $this->service = strtolower(__FUNCTION__); | |
648 | + | |
649 | + $res = $this->doDownloadRequest( | |
650 | + array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $vars["sampling"]), | |
651 | + array("params" => $paramId), | |
652 | + array("format" => $vars["outputFormat"], "timeFormat"=> $timeFormat, "gzip"=>$gzip, "stream"=>$stream)); | |
653 | + | |
654 | + if ($res['success']) return $res; | |
655 | + | |
656 | + $this->throwError("serverError",$res['message']); | |
657 | + } | |
658 | + | |
659 | +/* | |
660 | +* getPlot : predefined; by mission | |
661 | +*/ | |
662 | + public function getPlot($data) | |
663 | + { | |
664 | + $res = $this->init($data); | |
665 | + | |
666 | + if (!$res['success']){ | |
667 | + $this->throwError("requestError", "Cannot parse request"); | |
668 | + } | |
669 | + | |
670 | + $this->initUserMgr(); | |
671 | + | |
672 | + $vars = $res['vars']; | |
673 | + $mission = $vars["missionID"]; | |
674 | + | |
675 | + $resultFilePrefix = strtolower(__FUNCTION__)."_".$mission."_".date("YmdHms",strtotime($vars["startTime"]))."_".date("YmdHms",strtotime($vars["stopTime"])); | |
676 | + | |
677 | + if ($this->userID != "impex") | |
678 | + $resultFilePrefix .= "_".$this->userID; | |
679 | + | |
680 | + $dom = new DomDocument("1.0"); | |
681 | + if (!@$dom->load(WSConfigClass::getXslDir()."AmdaPlots.xml")) | |
682 | + $this->throwError("systemError", "Cannot load predefined plot definition"); ; | |
683 | + | |
684 | + $missionTag = $dom->getElementById($mission); | |
685 | + $params = $missionTag->getElementsByTagName('param'); | |
686 | + | |
687 | + $paramsList = array(); | |
688 | + foreach ($params as $param) | |
689 | + $paramsList[] = $param->getAttribute('name'); | |
690 | + | |
691 | + $requestObject = (Object) array( | |
692 | + "nodeType" => "request", | |
693 | + "file-format" => "PNG", | |
694 | + "result-file" => $resultFilePrefix, | |
695 | + "timesrc" => "Interval", | |
696 | + "startDate" => $vars["startTime"], | |
697 | + "stopDate" => $vars["stopTime"], | |
698 | + "parameters" => array() | |
699 | + ); | |
700 | + | |
701 | + foreach ($paramsList as $paramToPlot) | |
702 | + { | |
703 | + $paramObject = (Object) array( | |
704 | + "paramid" => $paramToPlot | |
705 | + ); | |
706 | + | |
707 | + $requestObject->{"parameters"}[] = $paramObject; | |
708 | + } | |
709 | + | |
710 | + $this->service = strtolower(__FUNCTION__); | |
711 | + | |
712 | + if (!isset($this->requestManager)) | |
713 | + $this->requestManager = new RequestManagerClass(); | |
714 | + | |
715 | + try { | |
716 | + $plotResult = $this->requestManager->runWSRequest($this->userID, $this->IPclient, FunctionTypeEnumClass::PARAMS, $this->service, $requestObject); | |
717 | + } catch (Exception $e) { | |
718 | + $this->throwError("plotError", "Exeption detected : ".$e->getMessage()); | |
719 | + } | |
720 | + | |
721 | + if (!$plotResult['success']) { | |
722 | + $this->throwError("serverError", $plotResult['message']); | |
723 | + } | |
724 | + | |
725 | + if($plotResult['status'] == 'in_progress') { | |
726 | + return ['success' => true, 'status' => 'in progress', 'id' => $plotResult['id']]; | |
727 | + } elseif ($plotResult['status'] == 'done') | |
728 | + { | |
729 | + $this->deleteProcess($plotResult['id']); | |
730 | + return array('success' => true, 'status' => 'done', 'plotFileURL' => WSConfigClass::getUrl().$plotResult['result']); | |
731 | + } else { | |
732 | + return ['success' => false, 'message' => 'Unknown status ' . $plotResult['status']]; | |
733 | + } | |
734 | + } | |
735 | +} | |
736 | +?> | |
... | ... |
... | ... | @@ -0,0 +1,48 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<missions> | |
3 | + <mission xml:id='ACE'> | |
4 | + <param name='sw_vb'/> | |
5 | + <param name='sw_t'/> | |
6 | + <param name='sw_n'/> | |
7 | + <param name='imf'/> | |
8 | + <param name='imf_mag'/> | |
9 | + </mission> | |
10 | + <mission xml:id='WIND'> | |
11 | + <param name='wnd_swe_vmag'/> | |
12 | + <param name='wnd_swe_vth'/> | |
13 | + <param name='wnd_swe_n'/> | |
14 | + <param name='wnd_b' class="mag"/> | |
15 | + <param name='wnd_bmag'/> | |
16 | + </mission> | |
17 | + <mission xml:id='STEREO-A'> | |
18 | + <param name='vpbulk_sta'/> | |
19 | + <param name='vth_sta'/> | |
20 | + <param name='np_sta'/> | |
21 | + <param name='sta_b'/> | |
22 | + <param name='sta_btot'/> | |
23 | + </mission> | |
24 | + <mission xml:id='STEREO-B'> | |
25 | + <param name='vpbulk_stb'/> | |
26 | + <param name='vth_stb'/> | |
27 | + <param name='np_stb'/> | |
28 | + <param name='stb_b'/> | |
29 | + <param name='stb_btot'/> | |
30 | + </mission> | |
31 | + <mission xml:id='VEX'> | |
32 | + <param name='vex_mag_4s'/> | |
33 | + <param name='vex_mag_4s_tot'/> | |
34 | + </mission> | |
35 | + <mission xml:id='OMNI'> | |
36 | + <param name='omni_sw_v'/> | |
37 | + <param name='omni_sw_t'/> | |
38 | + <param name='omni_sw_n'/> | |
39 | + <param name='omni_imf' /> | |
40 | + <param name='omni_imf_mag'/> | |
41 | + </mission> | |
42 | + <mission xml:id='GEOMAG'> | |
43 | + <param name='omni_kp'/> | |
44 | + <param name='omni_dst'/> | |
45 | + <param name='omni_ae'/> | |
46 | + </mission> | |
47 | +</missions> | |
48 | + | |
... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +<xsl:stylesheet version="1.0" | |
2 | +xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
3 | + | |
4 | +<xsl:output method="xml"/> | |
5 | + | |
6 | +<xsl:template match="/timetable"> | |
7 | + <VOTABLE version='1.1'> | |
8 | + <DESCRIPTION> | |
9 | + Name: <xsl:value-of select="name"/>; | |
10 | + Description: <xsl:value-of select="description"/>; | |
11 | + Historic: <xsl:value-of select="history"/>; | |
12 | + Creation Date : <xsl:value-of select="created"/>; | |
13 | + </DESCRIPTION> | |
14 | +<RESOURCE> | |
15 | +<DESCRIPTION> | |
16 | + AMDA @ CDPP | |
17 | +</DESCRIPTION> | |
18 | +<TABLE> | |
19 | +<FIELD datatype='char' name='Start Time' ID='TimeIntervalStart' ucd='time.start'> | |
20 | + <DESCRIPTION>time tag for beginning of interval</DESCRIPTION> | |
21 | +</FIELD> | |
22 | +<FIELD datatype='char' name='Stop Time' ID='TimeIntervalStop' ucd='time.stop'> | |
23 | + <DESCRIPTION>time tag for end of interval</DESCRIPTION> | |
24 | +</FIELD> | |
25 | +<DATA> | |
26 | + <TABLEDATA> | |
27 | + <xsl:for-each select="intervals"> | |
28 | + <TR> | |
29 | + <TD><xsl:value-of select="start"/></TD> | |
30 | + <TD><xsl:value-of select="stop"/></TD> | |
31 | + </TR> | |
32 | + </xsl:for-each> | |
33 | + </TABLEDATA> | |
34 | + </DATA> | |
35 | + </TABLE> | |
36 | + </RESOURCE> | |
37 | + </VOTABLE> | |
38 | +</xsl:template> | |
39 | +</xsl:stylesheet> | |
... | ... |
php/classes/AmdaAction.php
... | ... | @@ -844,9 +844,9 @@ class AmdaAction |
844 | 844 | } |
845 | 845 | |
846 | 846 | /* |
847 | -* Get Jobs en cours | |
847 | +* Get running jobs | |
848 | 848 | */ |
849 | - public function getJobs() | |
849 | + public function getJobs($obj = null) | |
850 | 850 | { |
851 | 851 | $obj = (object) array(); |
852 | 852 | return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSRUNNINGINFO); |
... | ... | @@ -863,10 +863,10 @@ class AmdaAction |
863 | 863 | return array('success' => true); |
864 | 864 | } |
865 | 865 | |
866 | - if (isset($obj->username) && isset($obj->password) && isset($obj->sessionID)) { | |
867 | - //$dd = new WSUserMgr(); | |
868 | - //$dd->init($obj->username,$obj->password,$obj->sessionID); | |
869 | - return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support not implemented"); | |
866 | + if (isset($obj->username) && isset($obj->password) && isset($obj->sessionID)) | |
867 | + { | |
868 | + $dd = new WSUserMgr(); | |
869 | + $dd->init($obj->username,$obj->password,$obj->sessionID, false); | |
870 | 870 | } |
871 | 871 | else { |
872 | 872 | $dd = new UserMgr(); |
... | ... | @@ -881,8 +881,11 @@ class AmdaAction |
881 | 881 | return array('success' => false, 'message' => 'ddLogin error: '.$res); |
882 | 882 | } |
883 | 883 | |
884 | - if ($dd->user == 'impex') { | |
885 | - return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support for IMPEx not implemented"); | |
884 | + if ($dd->user == 'impex') | |
885 | + { | |
886 | + //if ($dd->getWsSize() > DISK_QUOTA * 100) | |
887 | + // error_log('Natacha! It is time to CLEAN UP IMPEX WS!',1,'nbourrel@irap.omp.eu'); | |
888 | +// return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support for IMPEx not implemented"); | |
886 | 889 | } |
887 | 890 | else { |
888 | 891 | // check disk space |
... | ... |
php/classes/RequestMgr.php
... | ... | @@ -241,7 +241,8 @@ class RequestMgr extends AmdaObjectMgr |
241 | 241 | if ($obj->timesrc != 'Interval') break; |
242 | 242 | |
243 | 243 | foreach ($obj->list as $param) |
244 | - { | |
244 | + { | |
245 | + | |
245 | 246 | //TODO not in code spase___IMPEX_ !!! |
246 | 247 | //TODO other models (tsyganenko etc) |
247 | 248 | if (preg_match("#^spase___IMPEX_#", $param->paramid)) |
... | ... | @@ -249,14 +250,16 @@ class RequestMgr extends AmdaObjectMgr |
249 | 250 | if ($param->template_args->url_XYZ) $params[] = $param->template_args->url_XYZ; |
250 | 251 | } |
251 | 252 | } |
252 | - if (!empty($params)) | |
253 | + | |
254 | + if (!empty($params)) | |
253 | 255 | { |
256 | + // tab is not defined, iterate over $obj->tabs? | |
254 | 257 | $argsTab['param'] = array_unique($params); |
255 | 258 | $argsTab['startTime'] = $tab->{'multi-plot-linked'} ? $obj->startDate : $tab->startDate; |
256 | 259 | $argsTab['stopTime'] = $tab->{'multi-plot-linked'} ? $obj->startDate : $tab->stopDate; |
257 | 260 | } |
258 | 261 | if (count($argsTab) > 0) $args[] = $argsTab; |
259 | - | |
262 | + | |
260 | 263 | break; |
261 | 264 | case 'statistics' : |
262 | 265 | return array('success' => true); |
... | ... | @@ -264,23 +267,23 @@ class RequestMgr extends AmdaObjectMgr |
264 | 267 | default : |
265 | 268 | return array('success' => false, 'message' => "unknown action ".$obj->nodeType); |
266 | 269 | } |
267 | - | |
268 | - if (count($args) === 0) return array('success' => true); | |
269 | - | |
270 | + | |
271 | + if (count($args) === 0) return array('success' => true); | |
272 | + | |
270 | 273 | try |
271 | 274 | { |
272 | 275 | $client = new SoapClient(DD_WSDL); |
273 | 276 | } |
274 | 277 | catch (SoapFault $exception) |
275 | - { | |
278 | + { | |
276 | 279 | return array('success' => false, 'message' => $exception->faultstring); |
277 | 280 | } |
278 | - | |
281 | + | |
279 | 282 | $orbitsXml = new DomDocument("1.0"); |
280 | 283 | $orbitsXml->load(orbitsAllXml); |
281 | 284 | $tr = array('_' => ':'); |
282 | - | |
283 | - foreach ($args as $tab) | |
285 | + | |
286 | + foreach ($args as $tab) | |
284 | 287 | { |
285 | 288 | $startTime = $tab['startTime']; |
286 | 289 | $stopTime = $tab['stopTime']; |
... | ... | @@ -309,8 +312,8 @@ class RequestMgr extends AmdaObjectMgr |
309 | 312 | return array('success' => false, 'message' => "Too big interval for IMPEX request : ".IMPEX_INTERVAL_LIMIT/86400.." day limit!"); |
310 | 313 | } |
311 | 314 | } |
312 | - | |
313 | - return array('success' => true); | |
315 | + | |
316 | + return array('success' => true); | |
314 | 317 | } |
315 | 318 | } |
316 | 319 | ?> |
... | ... |
php/classes/UserMgr.php
... | ... | @@ -542,8 +542,7 @@ unlink(USERWSDIR.'RemoteParams.xml'); |
542 | 542 | public function ddCheckUser() |
543 | 543 | { |
544 | 544 | $this->IP = $this->getIPclient(); |
545 | - | |
546 | - $cmdCheckUser = DDBIN."DDCheckUser ".$this->IP." ".$this->user." 1> /dev/null 2> /dev/null"; | |
545 | + $cmdCheckUser = DDBIN."DDCheckUser ".$this->IP." ".$this->user." 1> /dev/null 2> /dev/null"; | |
547 | 546 | system($cmdCheckUser, $res); |
548 | 547 | return $res; |
549 | 548 | } |
... | ... |
php/classes/WebServer.php deleted
... | ... | @@ -1,1037 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | -* @file WebServer.php | |
4 | -* @brief Web services AMDA | |
5 | -* | |
6 | -* @version $Id: WebServer.php 2968 2015-06-29 13:17:00Z natacha $ | |
7 | -*/ | |
8 | -class WebResultMgr | |
9 | -{ | |
10 | - private $resDOM; | |
11 | - private $rootEl; | |
12 | - private $resXP; | |
13 | - private $requestManager = null; | |
14 | - private $paramLoader = null; | |
15 | - | |
16 | - function __construct() | |
17 | - { | |
18 | - if (!is_dir(WSRESULT)) | |
19 | - mkdir(WSRESULT); | |
20 | - chmod(WSRESULT,0775); | |
21 | - | |
22 | - $this->resDOM = new DOMDocument("1.0"); | |
23 | - $this->resDOM->formatOutput = TRUE; | |
24 | - $this->resDOM->preserveWhiteSpace = FALSE; | |
25 | - | |
26 | - if (!file_exists(wsResultsXml)) | |
27 | - { | |
28 | - $this->rootEl = $this->resDOM->createElement('wsresults'); | |
29 | - $this->resDOM->appendChild($this->rootEl); | |
30 | - $this->resDOM->save(wsResultsXml); | |
31 | - } | |
32 | - | |
33 | - $this->resDOM->load(wsResultsXml); | |
34 | - | |
35 | - $this->resXP = new DOMXPath($this->resDOM); | |
36 | - | |
37 | - $this->rootEl = $this->resDOM->documentElement; | |
38 | - } | |
39 | - | |
40 | - public function addResult($function_name,$vars,$user,$IP,$output){ | |
41 | - $nodes = $this->rootEl->getElementsByTagName($function_name); | |
42 | - if($nodes->length < 1){ | |
43 | - $funcNode = $this->resDOM->createElement($function_name); | |
44 | - $this->rootEl->appendChild($funcNode); | |
45 | - } | |
46 | - else | |
47 | - $funcNode = $nodes->item(0); | |
48 | - | |
49 | - $oldOutput = $this->resXP->query('//'.$function_name.'/result[@output="'.$output.'"]'); | |
50 | - if ($oldOutput->length > 0) | |
51 | - $funcNode->removeChild($oldOutput->item(0)); | |
52 | - | |
53 | - $resNode = $this->resDOM->createElement('result'); | |
54 | - $resNode->setAttribute('date',time()); | |
55 | - $resNode->setAttribute('user',$user); | |
56 | -// $resNode->setAttribute('IP',$IP); | |
57 | - $resNode->setAttribute('input',json_encode($vars)); | |
58 | - $resNode->setAttribute('output',$output); | |
59 | - $funcNode->appendChild($resNode); | |
60 | - | |
61 | - $this->resDOM->save(wsResultsXml); | |
62 | - | |
63 | - return $resNode; | |
64 | - } | |
65 | - | |
66 | - public function getResOutputName($function_name,$user,$suffixe,$extension) | |
67 | - { | |
68 | - $outputFile = WSRESULT.$function_name."_".$user; | |
69 | - if (isset($suffixe)) | |
70 | - $outputFile .= ("_".$suffixe); | |
71 | - if (isset($extension)) | |
72 | - $outputFile .= (".".$extension); | |
73 | - else | |
74 | - $outputFile .= ".xml"; | |
75 | - return $outputFile; | |
76 | - } | |
77 | -} | |
78 | - | |
79 | -class WebServer | |
80 | -{ | |
81 | - private $isSoap = false; | |
82 | - private $userID, $userPWD, $sessionID; | |
83 | - private $wsUserMgr; | |
84 | - private $resultMgr, $myParamsInfoMgr; | |
85 | - private $dataFileName; | |
86 | - | |
87 | - function __construct() { | |
88 | - $this->userID = 'impex'; | |
89 | - $this->userPWD = 'impexfp7'; | |
90 | - $this->sessionID = $this->userID; | |
91 | - $this->myParamsInfoMgr = new ParamsInfoMgr(); | |
92 | - $this->resultMgr = new WebResultMgr(); | |
93 | - } | |
94 | - | |
95 | - protected function init($data) { | |
96 | - if(is_object($data)) | |
97 | - { | |
98 | - $vars = get_object_vars($data); | |
99 | - $this->isSoap = true; | |
100 | - } | |
101 | - else | |
102 | - $vars = $data; | |
103 | - | |
104 | - if (isset($vars['userID'])) | |
105 | - { | |
106 | - $this->userID = $vars['userID']; | |
107 | - $this->sessionID = $this->userID; | |
108 | - } | |
109 | - else { | |
110 | - $this->userID = 'impex'; | |
111 | - $this->sessionID = $this->userID; | |
112 | - } | |
113 | - if (isset($vars['password'])) | |
114 | - $this->userPWD = $vars['password']; | |
115 | - else | |
116 | - $this->userPWD = 'impexfp7'; | |
117 | - return array('success' => true, 'vars' => $vars); | |
118 | - } | |
119 | - | |
120 | - private function setID(){ | |
121 | - | |
122 | - $nb_min = 10000; | |
123 | - $nb_max = 99999; | |
124 | - $nombre = mt_rand($nb_min,$nb_max); | |
125 | - | |
126 | - $this->IP = $this->getIPclient(); | |
127 | - | |
128 | - return "PP".$nombre; | |
129 | - } | |
130 | - | |
131 | -/** | |
132 | - * Function getIPclient return the IP client sent a request for needs DD scripts (DDHtmlLogin, DDCheckUser, DD_Search) | |
133 | - * | |
134 | - * @param void | |
135 | - * @return string | |
136 | - */ | |
137 | - private function getIPclient(){ | |
138 | - | |
139 | - if (getenv('REMOTE_ADDR')) { | |
140 | - $realIP = getenv('REMOTE_ADDR'); | |
141 | - } | |
142 | - else { | |
143 | - //get local IP | |
144 | - $command="hostname -i"; | |
145 | - $realIP = exec($command); | |
146 | - } | |
147 | - | |
148 | - return $realIP; | |
149 | - } | |
150 | - | |
151 | - private function timeInterval2Days($TimeInterval){ | |
152 | - | |
153 | - $divDays = 60*60*24; | |
154 | - $nbDays = floor($TimeInterval / $divDays); | |
155 | - $divHours = 60*60; | |
156 | - $nbHours = floor(($TimeInterval - $divDays*$nbDays)/$divHours); | |
157 | - $nbMin = floor(($TimeInterval - $divDays*$nbDays - $divHours*$nbHours)/60); | |
158 | - $nbSec = $TimeInterval - $divDays*$nbDays - $divHours*$nbHours - $nbMin*60; | |
159 | - | |
160 | - $DD = sprintf("%03d", $nbDays); // format ex. 005 not 5 | |
161 | - $HH = sprintf("%02d", $nbHours); // format ex. 25 | |
162 | - $MM = sprintf("%02d", $nbMin); // format ex. 03 not 3 | |
163 | - $SS = sprintf("%02d", $nbSec); // format ex. 02 not 2 | |
164 | - | |
165 | - return $DD.':'.$HH.':'.$MM.':'.$SS; | |
166 | - | |
167 | - } | |
168 | - | |
169 | -/* Start Time into AMDA format YYYY:DOY-1:HH:MM:SS */ | |
170 | - private function startTime2Days($startTime){ | |
171 | - | |
172 | - $ddStart = getdate($startTime); | |
173 | - $date_start = sprintf("%04d",$ddStart["year"]).":".sprintf("%03d", $ddStart["yday"]).":" | |
174 | - .sprintf("%02d",$ddStart["hours"]).":".sprintf("%02d",$ddStart["minutes"]).":" | |
175 | - .sprintf("%02d",$ddStart["seconds"]); | |
176 | - return $date_start; | |
177 | - } | |
178 | - | |
179 | - private function rrmdir($dir){ | |
180 | - if (is_dir($dir)) { | |
181 | - $objects = scandir($dir); | |
182 | - | |
183 | - foreach ($objects as $object) { // Recursively delete a directory that is not empty and directorys in directory | |
184 | - if ($object != "." && $object != "..") { // If object isn't a directory recall recursively this function | |
185 | - if (filetype($dir."/".$object) == "dir") | |
186 | - $this->rrmdir($dir."/".$object); | |
187 | - else | |
188 | - unlink($dir."/".$object); | |
189 | - } | |
190 | - } | |
191 | - reset($objects); | |
192 | - rmdir($dir); | |
193 | - } | |
194 | - } | |
195 | - | |
196 | - protected function initUserMgr() { | |
197 | - if (isset($this->wsUserMgr)) | |
198 | - return array('success' => true); | |
199 | - $this->wsUserMgr = new WSUserMgr(); | |
200 | - $this->wsUserMgr->init($this->userID,$this->userPWD,$this->sessionID, $this->isSoap); | |
201 | - | |
202 | - return array('success' => true); | |
203 | - } | |
204 | - | |
205 | - public function getTimeTablesList($data) { | |
206 | - if(is_object($data)) | |
207 | - { | |
208 | - $vars = get_object_vars($data); | |
209 | - $this->isSoap = true; | |
210 | - } | |
211 | - else | |
212 | - $vars = $data; | |
213 | - if (isset($vars['userID']) && $vars['userID'] == 'impex'){ | |
214 | - if ($this->isSoap) throw new SoapFault("server00","Server Error: AMDA Login procedure failed"); | |
215 | - else return array("error" => "Server Error: AMDA Login procedure failed"); | |
216 | - } | |
217 | - | |
218 | - | |
219 | - $res = $this->init($data); | |
220 | - $vars = $res['vars']; | |
221 | - | |
222 | - $ttListWSresult = $this->resultMgr->getResOutputName(__FUNCTION__,$this->userID); | |
223 | - | |
224 | - $dom = new DOMDocument("1.0"); | |
225 | - if ($this->userID == 'impex') { | |
226 | - $sharedObjMgr = new SharedObjectsMgr(); | |
227 | - $loadDom = $dom->load($sharedObjMgr->getTreeFilePath()); | |
228 | - } | |
229 | - else | |
230 | - $loadDom = $dom->load(USERPATH.$this->userID.'/WS/Tt.xml'); | |
231 | - | |
232 | - if ($loadDom == FALSE){ | |
233 | - if ($this->isSoap) throw new SoapFault("server00","Server Error: AMDA Login procedure failed"); | |
234 | - else return array("error" => "Server Error: AMDA Login procedure failed"); | |
235 | - } | |
236 | - | |
237 | - $timetabNode = $dom->documentElement->getElementsByTagName('timetabList'); | |
238 | - | |
239 | - if ($timetabNode->length < 1){ | |
240 | - if ($this->isSoap) throw new SoapFault("server03","Cannot reach TT list"); | |
241 | - else return array('success' => false, 'message' => "Server Error: Cannot reach TT list"); | |
242 | - } | |
243 | - $outDOM = new DOMDocument("1.0"); | |
244 | - $outDOM->formatOutput = TRUE; | |
245 | - $outDOM->preserveWhiteSpace = FALSE; | |
246 | - | |
247 | - $newNode = $outDOM->importNode($timetabNode->item(0),TRUE); | |
248 | - $outDOM->appendChild($newNode); | |
249 | - | |
250 | - | |
251 | - $outXP = new domxpath($outDOM); | |
252 | - $ttNodes = $outXP->query('//timetab'); | |
253 | - | |
254 | - $outDOM->save($ttListWSresult); | |
255 | - | |
256 | - $wsres = $this->resultMgr->addResult(__FUNCTION__,$vars,$this->userID,$ttListWSresult); | |
257 | - | |
258 | - $ttListResult = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$ttListWSresult); | |
259 | - | |
260 | - $timeTablesList = array('success' => true, 'TimeTablesList' => $ttListResult); | |
261 | - | |
262 | - return $timeTablesList; | |
263 | - | |
264 | - } | |
265 | - | |
266 | - public function getTimeTable($data) { | |
267 | - $res = $this->init($data); | |
268 | - | |
269 | - $vars = $res['vars']; | |
270 | - $ttID = $vars['ttID']; | |
271 | - | |
272 | - if ($this->userID == 'impex') { | |
273 | - $sharedObjMgr = new SharedObjectsMgr(); | |
274 | - $ttSrc = $sharedObjMgr->getDataFilePath('timeTable', $ttID); | |
275 | - } | |
276 | - else | |
277 | - $ttSrc = USERPATH.$this->userID.'/TT/'.$ttID.'.xml'; | |
278 | - | |
279 | - if (!file_exists($ttSrc)) { | |
280 | - if ($this->isSoap) throw new SoapFault("server03","Cannot reach time table"); | |
281 | - else return array('success' => false, 'message' => "Cannot reach time table"); | |
282 | - } | |
283 | - | |
284 | - $ttWSresult = $this->resultMgr->getResOutputName(__FUNCTION__,$this->userID,$ttID); | |
285 | - | |
286 | - if (!copy($ttSrc,$ttWSresult)){ | |
287 | - if ($this->isSoap) throw new SoapFault("server04","Cannot copy time table"); | |
288 | - else return array('success' => false, 'message' => "Cannot copy time table"); | |
289 | - } | |
290 | - | |
291 | - $wsres = $this->resultMgr->addResult(__FUNCTION__,$vars,$this->userID, $ttWSresult); | |
292 | - | |
293 | - $myTimeTableMgr = new TimeTableMgr($this->userID); | |
294 | - $ttWSresultVot = $myTimeTableMgr->xsl2vot($ttWSresult); | |
295 | - if( file_exists ( $ttWSresultVot)){ | |
296 | - copy($ttWSresultVot, $ttWSresult); | |
297 | - unlink( $ttWSresultVot ) ; | |
298 | - } | |
299 | - return array('success' => true, 'ttFileURL' => 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$ttWSresult)); | |
300 | - | |
301 | - } | |
302 | - | |
303 | - | |
304 | - public function isAlive(){ | |
305 | - $res = $this->init($data); | |
306 | - return true; | |
307 | - } | |
308 | - | |
309 | - | |
310 | - public function getObsDataTree() { | |
311 | - | |
312 | - $res = $this->init(); | |
313 | - | |
314 | - $resMgr = $this->initUserMgr(); | |
315 | - | |
316 | - $vars = $res['vars']; | |
317 | - | |
318 | - $locParamSrc = USERPATH.$this->userID.'/WS/LocalParams.xml'; | |
319 | -// $remoteParamSrc = USERPATH.$this->userID.'/WS/RemoteParams.xml'; | |
320 | - $wsParamSrc = USERPATH.$this->userID.'/WS/WsParams.xml'; | |
321 | - $locParamResult = $this->resultMgr->getResOutputName(__FUNCTION__,$this->userID.'_'.'LocalParams'); | |
322 | -// $remoteParamResult = $this->resultMgr->getResOutputName(__FUNCTION__,'RemoteParams'); | |
323 | - $wsParamResult = $this->resultMgr->getResOutputName(__FUNCTION__,$this->userID.'_'.'WsParams'); | |
324 | - | |
325 | - if (!copy($locParamSrc,$locParamResult)) | |
326 | - $locParamResult = ''; | |
327 | - else { | |
328 | - $piBase = new DomDocument("1.0"); | |
329 | - $piBase->formatOutput = true; | |
330 | - $piBase->preserveWhiteSpace = false; | |
331 | - | |
332 | - $dom = new DomDocument("1.0"); | |
333 | - $dom->load($locParamResult); | |
334 | - | |
335 | - $xsl = new DomDocument("1.0"); | |
336 | - $xsl->load(XMLPATH.'dd2WStree.xsl'); | |
337 | - | |
338 | - $xslt = new XSLTProcessor(); | |
339 | - $xslt->importStylesheet($xsl); | |
340 | - | |
341 | - $dom->loadXML($xslt->transformToXML($dom)); | |
342 | - | |
343 | - $dom->formatOutput = true; | |
344 | - $dom->preserveWhiteSpace = false; | |
345 | - $chum_ger = $dom->getElementById("Rosetta@C-G : Plot Only!"); | |
346 | - if ($chum_ger != NULL) $chum_ger->setAttribute("target","Churyumov-Gerasimenko"); | |
347 | - | |
348 | - $dom->save($locParamResult); | |
349 | - } | |
350 | -// if (!copy($remoteParamSrc,$remoteParamResult)) | |
351 | -// $remoteParamResult = ''; | |
352 | - if (!copy($wsParamSrc,$wsParamResult)) | |
353 | - $wsParamResult = ''; | |
354 | - | |
355 | - if ($locParamResult !='') $locParamResult = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$locParamResult); | |
356 | -// if ($remoteParamResult !='') $remoteParamResult = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$remoteParamResult); | |
357 | - if ($wsParamResult !='') $wsParamResult = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$wsParamResult); | |
358 | - | |
359 | - if (($locParamResult =='') && ($remoteParamResult =='') && ($wsParamResult =='')){ | |
360 | - if ($this->isSoap) throw new SoapFault("server05","No params descriptions .xml files for ".$this->userID." user"); | |
361 | - else return array('success' => false, 'message' => "No params descriptions .xml files for ".$this->userID." user"); | |
362 | - } | |
363 | - | |
364 | - $wsres = $this->resultMgr->addResult(__FUNCTION__,$vars,$this->userID,$wsParamResult.";".$locParamResult.";".$remoteParamResult); | |
365 | - | |
366 | - return array('success' => true,'WorkSpace' => array("LocalDataBaseParameters"=>$locParamResult, "RemoteDataBaseParameters"=>$remoteParamResult)); | |
367 | - } | |
368 | - | |
369 | - public function getPlot($data) { | |
370 | - | |
371 | - $res = $this->init($data); | |
372 | - $resMgr = $this->initUserMgr(); | |
373 | - | |
374 | - $vars = $res['vars']; | |
375 | - $mission = $vars["missionID"]; | |
376 | - | |
377 | - $ID = $this->setID(); // unique JobID | |
378 | - $resDirName = WSRESULT.$ID; // Define a temporary directory for results | |
379 | - | |
380 | - if (is_dir($resDirName)) | |
381 | - $this->rrmdir($resDirName); | |
382 | - mkdir($resDirName); | |
383 | - chmod($resDirName,0775); | |
384 | - | |
385 | - $dom = new DomDocument("1.0"); | |
386 | - $dom->load(plotsXml); | |
387 | - | |
388 | - $missionTag = $dom->getElementById($mission); | |
389 | - $params = $missionTag->getElementsByTagName('param'); | |
390 | - | |
391 | - $paramsList = array(); | |
392 | - foreach ($params as $param) | |
393 | - $paramsList[] = $param->getAttribute('name'); | |
394 | - | |
395 | - $requestObject = (Object) array( | |
396 | - "nodeType" => "request", | |
397 | - "file-format" => "PNG", | |
398 | - "file-output" => "WS", | |
399 | - "ws-result-file" => $resDirName."/request.list.png", | |
400 | - "last-plotted-tab" => 1, | |
401 | - "timesrc" => "Interval", | |
402 | - "startDate" => $vars["startTime"], | |
403 | - "stopDate" => $vars["stopTime"], | |
404 | - "tabs" => array() | |
405 | - ); | |
406 | - | |
407 | - $pageObject = (Object) array( | |
408 | - "id" => 1, | |
409 | - "multi-plot-linked" => true, | |
410 | - "page-margins-activated" => true, | |
411 | - "page-margin-x" => 5, | |
412 | - "page-margin-y" => 5, | |
413 | - "page-orientation" => "portrait", | |
414 | - "page-dimension" => "ISO A4", | |
415 | - "page-layout-type" => "vertical", | |
416 | - "page-layout-object" => (Object) array( | |
417 | - "layout-panel-height" => 0.25, | |
418 | - "layout-panel-spacing" => 0, | |
419 | - "layout-expand" => false | |
420 | - ), | |
421 | - "panels" => array() | |
422 | - ); | |
423 | - | |
424 | - foreach ($paramsList as $paramToPlot) | |
425 | - { | |
426 | - $panelObject = (Object) array( | |
427 | - "panel-plot-type" => "timePlot", | |
428 | - "axes" => array(), | |
429 | - "params" => array() | |
430 | - ); | |
431 | - | |
432 | - $timeAxisObject = (Object) array( | |
433 | - "id" => "time", | |
434 | - "axis-type" => "time", | |
435 | - "axis-range-extend" => true | |
436 | - ); | |
437 | - $panelObject->{"axes"}[] = $timeAxisObject; | |
438 | - | |
439 | - $yAxisObject = (Object) array( | |
440 | - "id" => "y-left", | |
441 | - "axis-type" => "y-left", | |
442 | - "axis-range-extend" => true | |
443 | - ); | |
444 | - $panelObject->{"axes"}[] = $yAxisObject; | |
445 | - | |
446 | - $paramObject = (Object) array( | |
447 | - "id" => 1, | |
448 | - "param-id" => $paramToPlot, | |
449 | - "param-drawing-type" => "serie", | |
450 | - "param-drawing-object" => (Object) array( | |
451 | - "serie-yaxis" => "y-left", | |
452 | - "serie-lines-activated" => true | |
453 | - ) | |
454 | - ); | |
455 | - $panelObject->{"params"}[] = $paramObject; | |
456 | - | |
457 | - $pageObject->{"panels"}[] = $panelObject; | |
458 | - } | |
459 | - | |
460 | - $requestObject->{"tabs"}[] = $pageObject; | |
461 | - | |
462 | - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
463 | - if (!isset($this->requestManager)) | |
464 | - $this->requestManager = new RequestManagerClass(); | |
465 | - | |
466 | - try { | |
467 | - $plotResult = $this->requestManager->runIHMRequest($this->userID, $this->getIPclient(), FunctionTypeEnumClass::PARAMS, $requestObject); | |
468 | - } catch (Exception $e) { | |
469 | - if ($this->isSoap) throw new SoapFault("plot01", 'Exception detected : '.$e->getMessage()); | |
470 | - else return array('success' => false, 'message' => 'Exception detected : '.$e->getMessage()); | |
471 | - } | |
472 | - | |
473 | - return array('success' => true, 'plotDirectoryURL' => $ID); | |
474 | - } | |
475 | - | |
476 | - public function getResultPlot($data) { | |
477 | - | |
478 | - $res = $this->init($data); | |
479 | - $vars = $res['vars']; | |
480 | - $ID = $vars["plotDirectoryURL"]; | |
481 | - $filename = WSRESULT.$ID."/request.list.png"; | |
482 | - if (file_exists($filename)) { | |
483 | - $plotWSresult=WSRESULT.$ID."/request.list.png"; | |
484 | - return array('success' => true, 'plotFileURL' => 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$plotWSresult)); | |
485 | - } | |
486 | - else | |
487 | - return array('success' => false); | |
488 | - | |
489 | - } | |
490 | - | |
491 | - | |
492 | - public function getParameterList($data) { | |
493 | - | |
494 | - $res = $this->init($data); | |
495 | - | |
496 | - $resMgr = $this->initUserMgr(); | |
497 | - | |
498 | - $vars = $res['vars']; | |
499 | - | |
500 | - $locParamSrc = USERPATH.$this->userID.'/WS/LocalParams.xml'; | |
501 | -// $remoteParamSrc = USERPATH.$this->userID.'/WS/RemoteParams.xml'; | |
502 | - $wsParamSrc = USERPATH.$this->userID.'/WS/WsParams.xml'; | |
503 | - $locParamResult = $this->resultMgr->getResOutputName(__FUNCTION__,$this->userID.'_'.'LocalParams'); | |
504 | -// $remoteParamResult = $this->resultMgr->getResOutputName(__FUNCTION__,'RemoteParams'); | |
505 | - $wsParamResult = $this->resultMgr->getResOutputName(__FUNCTION__,$this->userID.'_'.'WsParams'); | |
506 | - | |
507 | - if (!copy($locParamSrc,$locParamResult)) | |
508 | - $locParamResult = ''; | |
509 | - else { | |
510 | - $piBase = new DomDocument("1.0"); | |
511 | - $piBase->formatOutput = true; | |
512 | - $piBase->preserveWhiteSpace = false; | |
513 | - | |
514 | - $dom = new DomDocument("1.0"); | |
515 | - $dom->load($locParamResult); | |
516 | - | |
517 | - $xsl = new DomDocument("1.0"); | |
518 | - $xsl->load(XMLPATH.'dd2WStree.xsl'); | |
519 | - | |
520 | - $xslt = new XSLTProcessor(); | |
521 | - $xslt->importStylesheet($xsl); | |
522 | - | |
523 | - $dom->loadXML($xslt->transformToXML($dom)); | |
524 | - | |
525 | - $dom->formatOutput = true; | |
526 | - $dom->preserveWhiteSpace = false; | |
527 | - $chum_ger = $dom->getElementById("Rosetta@C-G : Plot Only!"); | |
528 | - if ($chum_ger != NULL) $chum_ger->setAttribute("target","Churyumov-Gerasimenko"); | |
529 | - $dom->save($locParamResult); | |
530 | - } | |
531 | -// if (!copy($remoteParamSrc,$remoteParamResult)) | |
532 | -// $remoteParamResult = ''; | |
533 | - if (!copy($wsParamSrc,$wsParamResult)) | |
534 | - $wsParamResult = ''; | |
535 | - | |
536 | - if ($locParamResult !='') $locParamResult = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$locParamResult); | |
537 | -// if ($remoteParamResult !='') $remoteParamResult = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$remoteParamResult); | |
538 | - if ($wsParamResult !='') $wsParamResult = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$wsParamResult); | |
539 | - | |
540 | - if (($locParamResult =='') && ($remoteParamResult =='') && ($wsParamResult =='')){ | |
541 | - if ($this->isSoap) throw new SoapFault("server05","No params descriptions .xml files for ".$this->userID." user"); | |
542 | - else return array('success' => false, 'message' => "No params descriptions .xml files for ".$this->userID." user"); | |
543 | - } | |
544 | - | |
545 | - $wsres = $this->resultMgr->addResult(__FUNCTION__,$vars,$this->userID,$wsParamResult.";".$locParamResult.";".$remoteParamResult); | |
546 | - | |
547 | - return array('success' => true,'ParameterList' => array("UserDefinedParameters"=>$wsParamResult, "LocalDataBaseParameters"=>$locParamResult, "RemoteDataBaseParameters"=>$remoteParamResult)); | |
548 | - } | |
549 | -///////////////////////////////////////START GET DATASET /////////////////////////////// | |
550 | - public function getParameter($data) { | |
551 | - | |
552 | - $multiParam = false; | |
553 | - | |
554 | - $res = $this->init($data); | |
555 | - | |
556 | - $resMgr = $this->initUserMgr(); | |
557 | - | |
558 | - if (!$res['success']){ | |
559 | - if ($this->isSoap) throw new SoapFault("server01","Cannot init user manager"); | |
560 | - else return array('success' => false, 'message' => "Cannot init user manager"); | |
561 | - } | |
562 | - | |
563 | - $vars = $res['vars']; | |
564 | - | |
565 | - if ((strtotime($vars["stopTime"]) - strtotime($vars["startTime"])) < 0){ | |
566 | - if ($this->isSoap) throw new SoapFault("request01","Start time must be higher than stop time"); | |
567 | - else return array('success' => false, 'message' => "Start time must be higher than stop time"); | |
568 | - } | |
569 | - elseif ((strtotime($vars["stopTime"]) - strtotime($vars["startTime"])) == 0){ | |
570 | - if ($this->isSoap) throw new SoapFault("request02","You time interval equal 0 start is ".$vars["stopTime"]." stop is ".$vars["startTime"]); | |
571 | - else return array('success' => false, 'message' => "You time interval equal 0"); | |
572 | - } | |
573 | - | |
574 | - $dataFileName = $this->getDataFileName($vars, $multiParam); | |
575 | - | |
576 | - if ($dataFileName['success']) $this->dataFileName = $dataFileName['fileName']; | |
577 | - else { | |
578 | - if ($this->isSoap) throw new SoapFault("request03",$dataFileName['message']); | |
579 | - else return array('success' => false, 'message' => $dataFileName['message']); | |
580 | - } | |
581 | - | |
582 | - | |
583 | - $paramId = array(); | |
584 | - array_push($paramId, $vars["parameterID"]); | |
585 | -// $paramId[] = $vars["parameterID"]; | |
586 | - | |
587 | - if (!$vars["timeFormat"]) | |
588 | - $timeFormat = "ISO8601"; | |
589 | - else | |
590 | - $timeFormat = $vars["timeFormat"]; | |
591 | - | |
592 | - if (!$vars["gzip"]) | |
593 | - $gzip = 0; | |
594 | - else | |
595 | - $gzip = $vars["gzip"]; | |
596 | -/* | |
597 | - if (!$vars["stream"]) | |
598 | - $stream = 0; | |
599 | - else | |
600 | - $stream = $vars["stream"];*/ | |
601 | - | |
602 | - $res = $this->doDownloadRequest( | |
603 | - array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $vars["sampling"]), | |
604 | - array("params" => $paramId), | |
605 | - array("userName" => $this->userID, "userPwd" => $this->userPWD, "sessionID" => $this->sessionID), | |
606 | - array("format" => $vars["outputFormat"], "timeFormat"=> $timeFormat, "gzip"=>$gzip, "stream"=>$stream), | |
607 | - $dataFileName); | |
608 | - | |
609 | - | |
610 | - if ($res['success']) return $res; | |
611 | - else { | |
612 | - if ($this->isSoap) throw new SoapFault("request03",$res['message']); | |
613 | - else return array('success' => false, 'message' => $res['message']); | |
614 | - } | |
615 | - } | |
616 | -///////////////////////////////////////START GET ORBITES /////////////////////////////// | |
617 | - public function getOrbites($data) { | |
618 | - | |
619 | - $multiParam = false; | |
620 | - | |
621 | - $res = $this->init($data); | |
622 | - | |
623 | - $resMgr = $this->initUserMgr(); | |
624 | - | |
625 | - if (!$resMgr['success']){ | |
626 | - if ($this->isSoap) throw new SoapFault("server01","Cannot init user manager"); | |
627 | - else return array('success' => false, 'message' => "Cannot init user manager"); | |
628 | - } | |
629 | - | |
630 | - $vars = $res['vars']; | |
631 | - | |
632 | - if ((strtotime($vars["stopTime"]) - strtotime($vars["startTime"])) < 0){ | |
633 | - if ($this->isSoap) throw new SoapFault("request01","Start time must be higher than stop time"); | |
634 | - else return array('success' => false, 'message' => "Start time must be higher than stop time"); | |
635 | - } | |
636 | - elseif ((strtotime($vars["stopTime"]) - strtotime($vars["startTime"])) == 0){ | |
637 | - if ($this->isSoap) throw new SoapFault("request02","You time interval equal 0 start is ".$vars["stopTime"]." stop is ".$vars["startTime"]); | |
638 | - else return array('success' => false, 'message' => "You time interval equal 0"); | |
639 | - } | |
640 | - | |
641 | - | |
642 | - | |
643 | - $spacecraft = $vars["spacecraft"]; | |
644 | - $coordinateSystem = $vars["coordinateSystem"]; | |
645 | - if ($spacecraft == "GALILEO") $spacecraft = ucfirst(strtolower($spacecraft)); | |
646 | - if (!$vars["units"]) | |
647 | - $units = "km"; | |
648 | - else | |
649 | - $units = $vars["units"]; | |
650 | - | |
651 | - $paramId = array(); | |
652 | - | |
653 | - $orbitRequest = array("startTime" => $vars["startTime"], | |
654 | - "stopTime" => $vars["stopTime"], | |
655 | - "spacecraft" => $spacecraft, | |
656 | - "coordinateSystem" => $coordinateSystem, | |
657 | - "units" => $units | |
658 | - ); | |
659 | - | |
660 | - | |
661 | - $orbitesParam = $this->getOrbitesParameter($orbitRequest); | |
662 | - if ($orbitesParam['success']) $orbParam = $orbitesParam['parameterID']; | |
663 | - else { | |
664 | - $orbParam = 'successEstfalse'; | |
665 | - if ($this->isSoap) throw new SoapFault("request03",$orbitesParam['message']); | |
666 | - else return array('success' => false, 'message' => $orbitesParam['message']); | |
667 | - } | |
668 | - | |
669 | - | |
670 | - $dataFileName = $this->getDataFileName($orbitesParam, $multiParam); | |
671 | - | |
672 | - if ($dataFileName['success']) $this->dataFileName = $dataFileName['fileName']; | |
673 | - else { | |
674 | - if ($this->isSoap) throw new SoapFault("request03",$dataFileName['message']); | |
675 | - else return array('success' => false, 'message' => $dataFileName['message']); | |
676 | - } | |
677 | - | |
678 | - array_push($paramId, $orbParam); | |
679 | -// $paramId[] = $vars["parameterID"]; | |
680 | - | |
681 | - if (!$vars["timeFormat"]) | |
682 | - $timeFormat = "ISO8601"; | |
683 | - else | |
684 | - $timeFormat = $vars["timeFormat"]; | |
685 | - | |
686 | - if (!$vars["gzip"]) | |
687 | - $gzip = 0; | |
688 | - else | |
689 | - $gzip = $vars["gzip"]; | |
690 | - | |
691 | - $res = $this->doDownloadRequest( | |
692 | - array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $vars["sampling"]), | |
693 | - array("params" => $paramId), | |
694 | - array("userName" => $this->userID, "userPwd" => $this->userPWD, "sessionID" => $this->sessionID), | |
695 | - array("format" => $vars["outputFormat"], "timeFormat"=> $timeFormat, "gzip"=>$gzip, "stream"=>$stream), | |
696 | - $dataFileName); | |
697 | - | |
698 | - | |
699 | - if ($res['success']) return $res; | |
700 | - else { | |
701 | - if ($this->isSoap) throw new SoapFault("request03",$res['message']); | |
702 | - else return array('success' => false, 'message' => $res['message']); | |
703 | - } | |
704 | - } | |
705 | - | |
706 | -///////////////////////////////////////START GET DATASET /////////////////////////////// | |
707 | - | |
708 | - | |
709 | - public function getDataset($data) { | |
710 | - $multiParam = true; | |
711 | - | |
712 | - $res = $this->init($data); | |
713 | - | |
714 | - $resMgr = $this->initUserMgr(); | |
715 | - | |
716 | - $vars = $res['vars']; | |
717 | - | |
718 | - if ((strtotime($vars["stopTime"]) - strtotime($vars["startTime"])) < 0){ | |
719 | - if ($this->isSoap) throw new SoapFault("request01","Start time must be higher than stop time"); | |
720 | - else return array('success' => false, 'message' => "Start time must be higher than stop time"); | |
721 | - } | |
722 | - elseif ((strtotime($vars["stopTime"]) - strtotime($vars["startTime"])) == 0){ | |
723 | - if ($this->isSoap) throw new SoapFault("request02","You time interval equal 0"); | |
724 | - else return array('success' => false, 'message' => "You time interval equal 0"); | |
725 | - } | |
726 | - | |
727 | - $dataFileName = $this->getDataFileName($vars, $multiParam); | |
728 | - | |
729 | - if ($dataFileName['success']) $this->dataFileName = $dataFileName['fileName']; | |
730 | - else { | |
731 | - if ($this->isSoap) throw new SoapFault("request03",$dataFileName['message']); | |
732 | - else return array('success' => false, 'message' => $dataFileName['message']); | |
733 | - } | |
734 | - $paramId = array(); | |
735 | - $localData = simplexml_load_file(USERPATH.$this->userID.'/WS/LocalParams.xml'); | |
736 | - | |
737 | - if (!$vars["sampling"]){ | |
738 | -$xpath = "//dataset[@xml:id='".$vars['datasetID']."']/@sampling"; | |
739 | -$tmp = $localData->xpath($xpath); | |
740 | -$vars["sampling"] = (string)$tmp[0]; | |
741 | - | |
742 | -$matches=array(); | |
743 | -preg_match("/([a-z])$/", $vars["sampling"], $matches); | |
744 | - | |
745 | - | |
746 | -$dataFileName = $this->getDataFileName($vars, $multiParam); | |
747 | - | |
748 | -if ($dataFileName['success']) $this->dataFileName = $dataFileName['fileName']; | |
749 | -else { | |
750 | - if ($this->isSoap) throw new SoapFault("request03",$dataFileName['message']); | |
751 | - else return array('success' => false, 'message' => $dataFileName['message']); | |
752 | -} | |
753 | - | |
754 | -$vars["sampling"] = strtr($vars["sampling"], array($matches[1] => "")); | |
755 | - switch ($matches[1]) { | |
756 | - case 's': | |
757 | - $sampling = floatval($vars["sampling"]); | |
758 | - break; | |
759 | - case 'm': | |
760 | - $sampling = floatval($vars["sampling"])*60; | |
761 | - break; | |
762 | - case 'h': | |
763 | - $sampling = floatval($vars["sampling"])*60*60; | |
764 | - break; | |
765 | - default: | |
766 | - } | |
767 | - } | |
768 | - | |
769 | - $xpath = "//dataset[@xml:id='".$vars['datasetID']."']/parameter/@*[namespace-uri()='http://www.w3.org/XML/1998/namespace' and local-name()='id']"; | |
770 | - $pars = $localData->xpath($xpath); | |
771 | - | |
772 | - foreach ($pars as $p) | |
773 | - $paramId[] = (string)$p[0]; | |
774 | - | |
775 | - if (!$vars["timeFormat"]) | |
776 | - $timeFormat = "ISO8601"; | |
777 | - else | |
778 | - $timeFormat = $vars["timeFormat"]; | |
779 | - | |
780 | - if (!$vars["gzip"]) | |
781 | - $gzip = 0; | |
782 | - else | |
783 | - $gzip = $vars["gzip"]; | |
784 | - | |
785 | - $res = $this->doDownloadRequest( | |
786 | - array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $sampling), | |
787 | - array("params" => $paramId), | |
788 | - array("userName" => $this->userID, "userPwd" => $this->userPWD, "sessionID" => $this->sessionID), | |
789 | - array("format" => $vars["outputFormat"], "timeFormat"=> $timeFormat, "gzip"=>$gzip, "stream"=>$stream), | |
790 | - $dataFileName); | |
791 | - | |
792 | - | |
793 | - if ($res['success']) return $res; | |
794 | - else { | |
795 | - if ($this->isSoap) throw new SoapFault("request03",$res['message']); | |
796 | - else return array('success' => false, 'message' => $res['message']); | |
797 | - } | |
798 | - } | |
799 | - | |
800 | -////////////////////////////////////////END GET PARAMETERS ///////////////////////////////// | |
801 | - protected function getOrbitesParameter($orbitRequest) { | |
802 | - | |
803 | - $orbitesXml = new DomDocument(); | |
804 | - | |
805 | - if (file_exists(orbitesXml)) { | |
806 | - $orbitesXml -> load(orbitesXml); | |
807 | - $xpath = new DOMXpath($orbitesXml); | |
808 | - $path = '//orbites[@mission="'.$orbitRequest['spacecraft'].'" and @coordinate_system="'.$orbitRequest['coordinateSystem'].'" and @units="'.$orbitRequest['units'].'" ] '; | |
809 | - | |
810 | - $orbites = $xpath->query($path); | |
811 | - foreach ($orbites as $orbite){ | |
812 | - $paramInfo = $this->myParamsInfoMgr->GetDDInfoFromParameterID($orbite->getAttribute('xml:id')); | |
813 | - $paramStart = $paramInfo['dataset']['starttime']; | |
814 | - $paramStop = $paramInfo['dataset']['stoptime']; | |
815 | - | |
816 | - if((strtotime($paramStart) <= strtotime($orbitRequest['startTime']) && (strtotime($orbitRequest['stopTime'])) <= strtotime($paramStop))) { | |
817 | - | |
818 | - return array('success' => true, | |
819 | - 'parameterID' => $orbite->getAttribute('xml:id'), | |
820 | - 'startTime' => $orbitRequest['startTime'], | |
821 | - 'stopTime' => $orbitRequest['stopTime'] | |
822 | - ); | |
823 | - } | |
824 | - } | |
825 | - return array('success' => false, | |
826 | - 'message' => | |
827 | - "Cannot find orbites for ".$orbitRequest['spacecraft']." between ".$orbitRequest['startTime']." in ".$orbitRequest['units']." ".$orbitRequest['coordinateSystem']." and ".$orbitRequest['stopTime']." ($paramStart - $paramStop) "); | |
828 | - } | |
829 | - else { | |
830 | - return array('success' => false, 'message' => "Orbits file doesn't exist"); | |
831 | - } | |
832 | - } | |
833 | - | |
834 | - | |
835 | - protected function doDownloadRequest($interval,$paramList,$user,$formatInfo,$dataFileName) { | |
836 | - if ($interval['sampling']) | |
837 | - $structure = 0;// sampling | |
838 | - else | |
839 | - $structure = 2; // not sampling | |
840 | - | |
841 | - $fileExtension = ""; | |
842 | - switch ($formatInfo['format']) | |
843 | - { | |
844 | - case 'netCDF' : | |
845 | - if (!$jobMgr){ | |
846 | - if ($this->isSoap) throw new SoapFault("server01","netCDF format not implemented"); | |
847 | - else return array('success' => false, 'message' => "netCDF format not implemented"); | |
848 | - } | |
849 | - break; | |
850 | - case 'VOTable' : | |
851 | - $fileformat = "vot"; | |
852 | - $kernelExtension = ".vot"; | |
853 | - $wsExtension = ".xml"; | |
854 | - break; | |
855 | - case 'ASCII' : | |
856 | - default : | |
857 | - $fileformat = "ASCII"; | |
858 | - $kernelExtension = ".txt"; | |
859 | - $wsExtension = ".txt"; | |
860 | - } | |
861 | - | |
862 | - switch ($formatInfo['timeFormat']) | |
863 | - { | |
864 | - case 'unixtime' : | |
865 | - $timeformat = 'Timestamp'; | |
866 | - break; | |
867 | - default : | |
868 | - $timeformat = 'YYYY-MM-DDThh:mm:ss'; | |
869 | - } | |
870 | - | |
871 | - if ($formatInfo['gzip'] == 1) | |
872 | - { | |
873 | - $compression = "gzip"; | |
874 | - $kernelExtension .= ".gz"; | |
875 | - $wsExtension .= ".gz"; | |
876 | - } | |
877 | - else | |
878 | - $compression = ""; | |
879 | - | |
880 | - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
881 | - IHMConfigClass::setUserName($this->userID); | |
882 | - if (!isset($this->paramLoader)) | |
883 | - $this->paramLoader = new IHMUserParamLoaderClass(); | |
884 | - | |
885 | - //Build parameter list | |
886 | - $params = array(); | |
887 | - | |
888 | - //TODO template arguments to implementer ? | |
889 | - foreach ($paramList['params'] as $paramId) | |
890 | - { | |
891 | - $param = new stdClass; | |
892 | - | |
893 | - if (preg_match("#^ws_#",$paramId)) | |
894 | - { | |
895 | - $res = $this->paramLoader->getDerivedParameterNameFromId($paramId); | |
896 | - if (!$res["success"]) | |
897 | - { | |
898 | - if ($this->isSoap) throw new SoapFault("server02", 'Not available derived parameter '.$paramId); | |
899 | - else return array('success' => false, 'message' => 'Not available derived parameter '.$paramId); | |
900 | - } | |
901 | - $param->paramid = "ws_".$res['name']; | |
902 | - } | |
903 | - else if (preg_match("#^wsd_#",$paramId)) | |
904 | - { | |
905 | - $res = $this->paramLoader->getUploadedParameterNameFromId($paramId); | |
906 | - if (!$res["success"]) | |
907 | - { | |
908 | - if ($this->isSoap) throw new SoapFault("server02", 'Not available user parameter '.$paramId); | |
909 | - else return array('success' => false, 'message' => 'Not available user parameter '.$paramId); | |
910 | - } | |
911 | - $param->paramid = "wsd_".$res['name']; | |
912 | - } | |
913 | - else | |
914 | - { | |
915 | - $param->paramid = $paramId; | |
916 | - } | |
917 | - | |
918 | - $params[] = $param; | |
919 | - } | |
920 | - | |
921 | - $obj = (object)array( | |
922 | - "nodeType" => "download", | |
923 | - "downloadSrc" => "0", | |
924 | - "structure" => $structure, | |
925 | - "refparamSampling" => false, | |
926 | - "sampling" => $interval['sampling'], | |
927 | - "timesrc" => "Interval", | |
928 | - "startDate" => $interval['startTime'], | |
929 | - "stopDate" => $interval['stopTime'], | |
930 | - "list" => $params, | |
931 | - "fileformat" => $fileformat, | |
932 | - "timeformat" => $timeformat, | |
933 | - "compression" => $compression, | |
934 | - "disablebatch" => true | |
935 | - ); | |
936 | - | |
937 | - if (!isset($this->requestManager)) | |
938 | - $this->requestManager = new RequestManagerClass(); | |
939 | - | |
940 | - try { | |
941 | - $downloadResult = $this->requestManager->runIHMRequest($this->userID, $this->getIPclient(), FunctionTypeEnumClass::PARAMS, $obj); | |
942 | - } catch (Exception $e) { | |
943 | - if ($this->isSoap) throw new SoapFault("server02", 'Exception detected : '.$e->getMessage()); | |
944 | - else return array('success' => false, 'message' => 'Exception detected : '.$e->getMessage()); | |
945 | - } | |
946 | - | |
947 | - if (!$downloadResult['success']) | |
948 | - { | |
949 | - if ($this->isSoap) throw new SoapFault("server03", $downloadResult['message']); | |
950 | - else return array('success' => false, 'message' => $downloadResult['message']); | |
951 | - } | |
952 | - | |
953 | - $resultFile = USERPATH.$this->userID.'/RES/'.$downloadResult['folder'].'/'.$downloadResult['result']; | |
954 | - $resultFile .= $kernelExtension; | |
955 | - | |
956 | - if (!file_exists($resultFile)) | |
957 | - { | |
958 | - if ($this->isSoap) throw new SoapFault("server04", 'Cannot retrieve result file '.$resultFile); | |
959 | - else return array('success' => false, 'message' => 'Cannot retrieve result file'); | |
960 | - } | |
961 | - | |
962 | - rename($resultFile, WSRESULT.$this->dataFileName.$wsExtension); | |
963 | - $outputFile = WSRESULT.$this->dataFileName.$wsExtension; | |
964 | - chmod ($outputFile, 0664); | |
965 | - $outputFile = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$outputFile); | |
966 | - | |
967 | - $obj = (object)array( | |
968 | - 'id' => $downloadResult['id'] | |
969 | - ); | |
970 | - | |
971 | - try { | |
972 | - $downloadResult = $this->requestManager->runIHMRequest($this->userID, $this->getIPclient(), FunctionTypeEnumClass::PROCESSDELETE, $obj); | |
973 | - } catch (Exception $e) { | |
974 | - //Nothing to do | |
975 | - } | |
976 | - | |
977 | - return array('success' => true, 'dataFileURLs' => $outputFile); | |
978 | - | |
979 | - } | |
980 | - | |
981 | - protected function timeIntervalToDuration($startTime,$stopTime) { | |
982 | - | |
983 | - $duration = strtotime($stopTime) - strtotime($startTime); | |
984 | - $durationDay = intval($duration/(86400)); | |
985 | - $duration = $duration - $durationDay*86400; | |
986 | - $durationHour = intval($duration/(3600)); | |
987 | - $duration = $duration - $durationHour*3600; | |
988 | - $durationMin = intval($duration/(60)); | |
989 | - $durationSec = $duration - $durationMin*60; | |
990 | - | |
991 | - return array("success" => true, "days" => sprintf("%04s", strval($durationDay)), | |
992 | - "hours" => sprintf("%02s", strval($durationHour)), | |
993 | - "mins" => sprintf("%02s", strval($durationMin)), | |
994 | - "secs" => sprintf("%02s", strval($durationSec)) | |
995 | - ); | |
996 | - } | |
997 | - | |
998 | - protected function getDataFileName($vars, $multiParam){ | |
999 | - if ($vars['startTime'] && $vars['stopTime'] && $vars['parameterID'] && !$multiParam){ | |
1000 | - $fileName = $vars['parameterID']."-".strtotime($vars['startTime'])."-".strtotime($vars['stopTime']); | |
1001 | - if (isset($vars['sampling']) && $vars['sampling'] != "" && $vars['sampling'] != 0) | |
1002 | - $fileName .= "-".$vars['sampling']; | |
1003 | - return array('success' => true, 'fileName' => $fileName); | |
1004 | - } | |
1005 | - else if ($vars['startTime'] && $vars['stopTime'] && $vars['datasetID'] && $multiParam){ | |
1006 | - $datasetName = strtr($vars["datasetID"], array(":" => "_")); | |
1007 | - $fileName = $datasetName."-".strtotime($vars['startTime'])."-".strtotime($vars['stopTime']); | |
1008 | - if (isset($vars['sampling']) && $vars['sampling'] != "" && $vars['sampling'] != 0) | |
1009 | - $fileName .= "-".$vars['sampling']; | |
1010 | - return array('success' => true, 'fileName' => $fileName); | |
1011 | - } | |
1012 | - else { | |
1013 | - if (!$vars['startTime']) | |
1014 | - $message="Start time not specified"; | |
1015 | - if (!$vars['stopTime']) | |
1016 | - $message="Stop time not specified"; | |
1017 | - if (!$vars['parameterID'] && !$multiParam) | |
1018 | - $message="Parameter not specified"; | |
1019 | - if (!$vars['datasetID'] && $multiParam) | |
1020 | - $message="DataSet not specified"; | |
1021 | - return array('success' => false, 'message' => $message); | |
1022 | - } | |
1023 | - } | |
1024 | - | |
1025 | - private function compress($srcName, $dstName) { | |
1026 | - | |
1027 | - $fp = fopen($srcName, "r"); | |
1028 | - $data = fread ($fp, filesize($srcName)); | |
1029 | - fclose($fp); | |
1030 | - | |
1031 | - $zp = gzopen($dstName, "w9"); | |
1032 | - gzwrite($zp, $data); | |
1033 | - gzclose($zp); | |
1034 | - } | |
1035 | - | |
1036 | -} | |
1037 | -?> | |
1038 | 0 | \ No newline at end of file |
php/config.php
1 | 1 | <?php |
2 | - /** | |
2 | +/** | |
3 | 3 | * @file config.php |
4 | 4 | * @version $Id: config.php 2368 2014-05-21 08:46:23Z elena $ |
5 | 5 | */ |
... | ... | @@ -20,6 +20,7 @@ if (!defined('PHP_VERSION_ID')) { |
20 | 20 | define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); |
21 | 21 | } |
22 | 22 | if (!defined('MAGIC_FILE')) define('MAGIC_FILE','/usr/share/misc/magic'); |
23 | + | |
23 | 24 | date_default_timezone_set('UTC'); |
24 | 25 | |
25 | 26 | // GUESTS LOGIN section |
... | ... | @@ -33,7 +34,7 @@ define('DISK_QUOTA_standard', 1024*1024*200); // 200MB |
33 | 34 | // max lines of uploaded ascii file to show |
34 | 35 | define('MAX_FILE_INDEX_TO_SHOW', 100); |
35 | 36 | // private key used to be considerate as a trust client for some functions of DD web service |
36 | -define('DDSERVICE_PRIVATEKEY','!%p856Dc'); | |
37 | +define('DDSERVICE_PRIVATEKEY', '!%p856Dc'); | |
37 | 38 | |
38 | 39 | |
39 | 40 | // BATCH JOBS section |
... | ... | @@ -43,12 +44,13 @@ define('DDSERVICE_PRIVATEKEY','!%p856Dc'); |
43 | 44 | //define('TIMEOUT', '100'); //TODO secs wait before job is killed OR 'max_execution_time' - kill automatic? |
44 | 45 | |
45 | 46 | // EPN-TAP services |
46 | -define('EPNTAP_APIS','http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync'); | |
47 | -define('EPNTAP_AMDA','http://cdpp-epntap.irap.omp.eu/__system__/tap/run/tap/sync'); | |
47 | +define('EPNTAP_APIS', 'http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync'); | |
48 | +define('EPNTAP_AMDA', 'http://cdpp-epntap.irap.omp.eu/__system__/tap/run/tap/sync'); | |
48 | 49 | |
49 | 50 | // PHP run-time settings |
50 | 51 | ini_set('memory_limit',128000000); |
51 | 52 | ini_set('max_execution_time',600); // max PHP execution |
53 | + | |
52 | 54 | ini_set('default_socket_timeout', 600); //TODO if this is needed ? IMPEX LONG DURATION WEBSERVICES |
53 | 55 | // to avoid 403 error while copying from URL |
54 | 56 | ini_set('user_agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:7.0) Gecko/201001012 Firefox/7.0'); |
... | ... | @@ -58,21 +60,19 @@ ini_set('user_agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:7.0) Gecko/201 |
58 | 60 | |
59 | 61 | |
60 | 62 | // General Info dirs |
61 | -define('DATAPATH', IHM_SRC_DIR.'generic_data/'); | |
62 | -//define('Param', DATAPATH.'Param/'); | |
63 | -define('LocalData', DATAPATH.'LocalData/'); | |
64 | -define('RemoteData', DATAPATH.'RemoteData/'); | |
65 | -define('Functions', DATAPATH.'Functions/'); | |
66 | -//define('Plot', DATAPATH.'Plot/'); | |
67 | -define('Hst', DATAPATH.'Hst/'); | |
68 | -define('SpecialSettingsDir',DATAPATH.'SpecialSettings/'); | |
63 | +define('DATAPATH', IHM_SRC_DIR . 'generic_data/'); | |
64 | +define('LocalData', DATAPATH . 'LocalData/'); | |
65 | +define('RemoteData', DATAPATH . 'RemoteData/'); | |
66 | +define('Functions', DATAPATH . 'Functions/'); | |
67 | +define('Hst', DATAPATH . 'Hst/'); | |
68 | +define('SpecialSettingsDir', DATAPATH . 'SpecialSettings/'); | |
69 | 69 | |
70 | 70 | // General Info files |
71 | -define('orbitsXml',LocalData.'Orbites.xml'); | |
72 | -define('orbitsAllXml',LocalData.'OrbitsAll.xml'); | |
73 | -define('FeedbackXml', DATAPATH.'Feedback/Feedback.xml'); | |
74 | -define('specialGrpsXml',SpecialSettingsDir.'Groups.xml'); | |
75 | -define('specialSettingsXml',SpecialSettingsDir.'Settings.xml'); | |
71 | +define('orbitsXml', LocalData . 'Orbites.xml'); | |
72 | +define('orbitsAllXml', LocalData . 'OrbitsAll.xml'); | |
73 | +define('FeedbackXml', DATAPATH . 'Feedback/Feedback.xml'); | |
74 | +define('specialGrpsXml', SpecialSettingsDir . 'Groups.xml'); | |
75 | +define('specialSettingsXml', SpecialSettingsDir . 'Settings.xml'); | |
76 | 76 | |
77 | 77 | //Help info dirs |
78 | 78 | define('HELPPATH', IHM_SRC_DIR."help/"); |
... | ... | @@ -82,32 +82,23 @@ define('SimuTargetsXml', DATAPATH.'SimuTemplate/TargetsSimu.xml'); |
82 | 82 | define('IMPEX_INTERVAL_LIMIT', 86400); // one day for impex request |
83 | 83 | |
84 | 84 | // Root User dir : All user dirs are defined in UserMgr.php |
85 | -define('USERPATH', IHM_SRC_DIR.'data/'); | |
85 | +define('USERPATH', IHM_SRC_DIR . 'data/'); | |
86 | 86 | |
87 | 87 | // Shared dir |
88 | -define('SHAREDPATH', IHM_SRC_DIR.'shared_data/'); | |
89 | - | |
90 | -// WEB SERVICES section | |
91 | -define('WSRESULT', USERPATH.'WSRESULT/'); // Web Services result directory | |
92 | -define('wsResultsXml',WSRESULT.'WSresults.xml'); // Web Service result file | |
93 | -define('plotsXml', IHM_SRC_DIR.'public/WebServices/XML/AmdaPlots.xml'); // Web Service getPlot : list of parameters to plot | |
94 | - | |
95 | -// Web Service servers WSDL : $_SERVER['SERVER_NAME'] (par apache) gethostname() (par command) | |
96 | -$SERVER_NAME = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : gethostname(); | |
97 | -define('webAlias',"http://".$SERVER_NAME.APACHE_ALIAS); | |
98 | -define('wsdl_AMDA', webAlias."public/wsdl/Methods_AMDA.wsdl"); | |
88 | +define('SHAREDPATH', IHM_SRC_DIR . 'shared_data/'); | |
99 | 89 | |
100 | 90 | // AKKA - KERNELBIN is now the new kernel bin dir |
101 | -define('KERNELBIN',NEWKERNEL_INSTALL_DIR.'bin/'); | |
91 | +define('KERNELBIN', NEWKERNEL_INSTALL_DIR . 'bin/'); | |
102 | 92 | |
103 | -putenv("LD_LIBRARY_PATH=".SYS_LIBS.":".DDLIB.":".CEFLIB.":".CDFLIB); | |
104 | -putenv("PATH=./:".DDBIN.":".SYS_BIN.":".IHM_SRC_DIR."php/bin"); | |
93 | +putenv("LD_LIBRARY_PATH=" . SYS_LIBS . ":" . DDLIB . ":" . CEFLIB . ":" . CDFLIB); | |
94 | +putenv("PATH=./:" . DDBIN . ":" . SYS_BIN . ":" . IHM_SRC_DIR . "php/bin"); | |
105 | 95 | |
106 | 96 | putenv("DDPATH=".DDRES_DIR); |
107 | 97 | define('XMLPATH', IHM_SRC_DIR.'php/XML/'); |
108 | 98 | |
109 | 99 | require_once(INTEGRATION_BASE_PATH.'src/amdaintegration_autoload.php'); |
110 | 100 | |
101 | + | |
111 | 102 | global $API; |
112 | 103 | $API = array( |
113 | 104 | 'AmdaAction'=>array( |
... | ... |
php/makeOrbitsList.php
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 | $instruments = $node->getElementsByTagName('instrument'); |
44 | 44 | foreach ($instruments as $ins) |
45 | 45 | { |
46 | - if ($ins->getAttribute('name') != 'Ephemeris') continue; | |
46 | + if (substr($ins->getAttribute('name'),0,9) != 'Ephemeris') continue; // Ephemeris: cruise | |
47 | 47 | $parameters = $ins->getElementsByTagName('parameter'); |
48 | 48 | foreach ($parameters as $parameter) |
49 | 49 | { |
... | ... | @@ -59,7 +59,12 @@ |
59 | 59 | $orbitNode->setAttribute('xml:id',$parameter->getAttribute('xml:id')); |
60 | 60 | $orbitNode->setAttribute('coordinate_system', $paramXml->info->coordinates_system); |
61 | 61 | $orbitNode->setAttribute('units', $paramXml->info->units); |
62 | - $orbitNode->setAttribute('mission', $node->getAttribute('name')); | |
62 | + | |
63 | + $name = strtolower($node->getAttribute('name')); | |
64 | + $name = preg_replace('/\s+/', '', $name); | |
65 | + $name = str_replace('-', '', $name); | |
66 | + | |
67 | + $orbitNode->setAttribute('mission', $name); | |
63 | 68 | |
64 | 69 | if ( $node->tagName == 'observatory' ) |
65 | 70 | $orbitNode->setAttribute('missionGroup',$node->parentNode->getAttribute('name')); |
... | ... |
php/my_config.php
... | ... | @@ -6,11 +6,11 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | //AKKA - Path to AMDA_Integration base dir |
9 | -define('INTEGRATION_BASE_PATH', '/home/budnik/AMDA/AMDA_Integration/'); | |
9 | +define('INTEGRATION_BASE_PATH', '/home/myriam/AMDA_20161215/AMDA_Integration/'); | |
10 | 10 | |
11 | 11 | require_once(INTEGRATION_BASE_PATH.'config/AMDAIntegrationConfig.php'); |
12 | 12 | |
13 | -define('CEFLIB', '/usr/local/cef/lib'); | |
13 | +define('CEFLIB', '/opt/local/cef/lib'); | |
14 | 14 | define('CDFLIB', '/opt/local/lib'); |
15 | 15 | |
16 | 16 | define('SYS_LIBS', '/lib:/usr/lib:/usr/local/lib64'); |
... | ... | @@ -20,13 +20,15 @@ define('SYS_BIN', '/bin:/usr/bin/:/usr/local/bin/'); |
20 | 20 | define('BASE_PATH', IHM_SRC_DIR); |
21 | 21 | |
22 | 22 | //DD WebServices |
23 | +//define('INFOSITE', 'http://apus.irap.omp.eu/NEWAMDA/BASE/'); | |
23 | 24 | define('INFOSITE', 'http://amda-dev.irap.omp.eu/BASE/'); |
24 | 25 | //log for AmdaUpdate/AmdaInstall |
25 | 26 | define('log', IHM_SRC_DIR.'LOG'); |
26 | 27 | // User apache |
27 | 28 | define('APACHE_USER', 'apache'); |
28 | 29 | // Alias for name of AMDA |
29 | -define('APACHE_ALIAS', '/NEWAMDA/'); | |
30 | + | |
31 | +define('APACHE_ALIAS', '/'); | |
30 | 32 | //email to send errors from AmdaUpdate/AmdaInstall |
31 | 33 | define('email','ebudnik@irap.omp.eu'); |
32 | 34 | |
... | ... | @@ -36,11 +38,13 @@ define('DDLIB','/opt/local/lib/'); |
36 | 38 | |
37 | 39 | // for updateAmda |
38 | 40 | define('DD_WSDL','http://amda-dev.irap.omp.eu/BASE/DDService/dd.wsdl'); |
41 | + | |
42 | +//define('DD_WSDL','http://apus.irap.omp.eu/NEWAMDA/DDService/dd.wsdl'); | |
39 | 43 | define('TITLE', 'AMDANEW-Test'); |
40 | 44 | |
41 | 45 | // real upload_max_filesize is defined in /etc/php.ini : ini_get('upload_max_filesize') |
42 | 46 | // here for additional flexibility |
43 | -define('MAX_UPLOADED_FILESIZE',30000000); // in bytes !!! | |
47 | +define('MAX_UPLOADED_FILESIZE',100000000); // in bytes !!! | |
44 | 48 | |
45 | 49 | $is64 = true; |
46 | 50 | |
... | ... |
... | ... | @@ -0,0 +1,22 @@ |
1 | +<?php | |
2 | + | |
3 | +/** | |
4 | + * @file getParameter.php | |
5 | + * @brief REST interface for service getParameter | |
6 | + * | |
7 | + * | |
8 | + * @version $Id: $ | |
9 | + */ | |
10 | + | |
11 | +require_once '../config.php'; | |
12 | + | |
13 | +$amda_ws = new WebServer(); | |
14 | +$result = $amda_ws->getNewToken($_GET); | |
15 | + | |
16 | +if ($result['success']) { | |
17 | + echo $result['token']; | |
18 | +} else { | |
19 | + echo $result['message']; | |
20 | +} | |
21 | + | |
22 | +?> | |
0 | 23 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,27 @@ |
1 | +<?php | |
2 | +/** | |
3 | + * @file getDataset.php | |
4 | + * @brief REST interface for service getDataset | |
5 | + */ | |
6 | + | |
7 | +//ini_set("allow_url_fopen", true); | |
8 | + require_once '../config.php'; | |
9 | + | |
10 | + if (!key_exists("token", $_GET)) | |
11 | + { | |
12 | + $result = array('success' => false, 'message' => "Authentication is required for this webservice."); | |
13 | + exit(json_encode($result)); | |
14 | + } | |
15 | + | |
16 | + $amda_ws = new WebServer(); | |
17 | + | |
18 | + if ($amda_ws->getNewToken()['token'] != $_GET["token"]) | |
19 | + { | |
20 | + $result = array('success' => false, 'status' => 'expired', 'message' => "Token expired. Please authenticate again."); | |
21 | + } else | |
22 | + { | |
23 | + $result = $amda_ws->getDataset($_GET); | |
24 | + } | |
25 | + | |
26 | + echo json_encode($result); | |
27 | +?> | |
... | ... |
php/rest/getDatasetData.php deleted
... | ... | @@ -1,38 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | -* @file getParameter.php | |
4 | -* @brief REST interface for service getParameter | |
5 | -* | |
6 | -* | |
7 | -* @version $Id: $ | |
8 | -*/ | |
9 | - ini_set("allow_url_fopen", true); | |
10 | - require_once '../config.php'; | |
11 | - | |
12 | - $amda_ws = new WebServer(); | |
13 | - $result = $amda_ws->getDataset($_GET); | |
14 | - | |
15 | - if ($result['success']){ | |
16 | - $file = str_replace("http://oberoi.cesr.fr/AMDA-WS/",BASE_PATH ,$result['dataFileURLs']); | |
17 | - | |
18 | - if ($file){ | |
19 | -// header('Content-type: text/xml'); | |
20 | -// $contenu = file_get_contents($file); | |
21 | -// error_log($contenu,3,'/home/natacha/TMP/tmp.xml'); | |
22 | -// echo $contenu; | |
23 | - | |
24 | -header('Content-type: text/xml'); | |
25 | -$doc = new DOMDocument(); | |
26 | -$doc->load($file); | |
27 | -echo $doc->saveXML(); | |
28 | - | |
29 | - | |
30 | - } | |
31 | - } | |
32 | - else { | |
33 | - $success = "false"; | |
34 | - echo '<?xml version="1.0" encoding="UTF-8"?><getParameterResponse>'; | |
35 | - echo '<success>'.$success.'</success>'; | |
36 | - echo '<message>'.$result['message'].'</message></getParameterResponse>'; | |
37 | - } | |
38 | -?> |
php/rest/getOrbites.php
1 | 1 | <?php |
2 | - | |
3 | -/** | |
4 | -* @file getParameter.php | |
5 | -* @brief REST interface for service getParameter | |
6 | -* | |
7 | -* | |
8 | -* @version $Id: $ | |
9 | -*/ | |
10 | 2 | |
11 | - require_once '../config.php'; | |
3 | +/** | |
4 | + * @file getOrbites.php | |
5 | + * @brief REST interface for service getOrbites | |
6 | + */ | |
12 | 7 | |
13 | - $amda_ws = new WebServer(); | |
14 | - $result = $amda_ws->getOrbites($_GET); | |
8 | + require_once '../config.php'; | |
15 | 9 | |
16 | - if ($result['success']){ | |
17 | - echo $result['dataFileURLs']; | |
18 | - } | |
19 | - else { | |
20 | - echo $result['message']; | |
21 | - } | |
10 | + if (!key_exists("token", $_GET)) | |
11 | + { | |
12 | + $result = array('success' => false, 'message' => "Authentication is required for this webservice."); | |
13 | + exit(json_encode($result)); | |
14 | + } | |
15 | + | |
16 | + $amda_ws = new WebServer(); | |
17 | + | |
18 | + if ($amda_ws->getNewToken()['token'] != $_GET["token"]) | |
19 | + { | |
20 | + $result = array('success' => false, 'status' => 'expired', 'message' => "Token expired. Please authenticate again."); | |
21 | + } else | |
22 | + { | |
23 | + $result = $amda_ws->getOrbites($_GET); | |
24 | + } | |
25 | + | |
26 | + echo json_encode($result); | |
22 | 27 | |
23 | 28 | ?> |
24 | 29 | \ No newline at end of file |
... | ... |
php/rest/getParameter.php
1 | 1 | <?php |
2 | - | |
3 | -/** | |
4 | -* @file getParameter.php | |
5 | -* @brief REST interface for service getParameter | |
6 | -* | |
7 | -* | |
8 | -* @version $Id: $ | |
9 | -*/ | |
10 | 2 | |
11 | - require_once '../config.php'; | |
3 | +/** | |
4 | + * @file getParameter.php | |
5 | + * @brief REST interface for service getParameter | |
6 | + */ | |
12 | 7 | |
13 | - $amda_ws = new WebServer(); | |
14 | - $result = $amda_ws->getParameter($_GET); | |
8 | + require_once '../config.php'; | |
15 | 9 | |
16 | - if ($result['success']){ | |
17 | - echo $result['dataFileURLs']; | |
18 | - } | |
19 | - else { | |
20 | - echo $result['message']; | |
21 | - } | |
10 | + if (!key_exists("token", $_GET)) | |
11 | + { | |
12 | + $result = array('success' => false, 'message' => "Authentication is required for this webservice."); | |
13 | + exit(json_encode($result)); | |
14 | + } | |
15 | + | |
16 | + $amda_ws = new WebServer(); | |
22 | 17 | |
18 | + if ($amda_ws->getNewToken()['token'] != $_GET["token"]) | |
19 | + { | |
20 | + $result = array('success' => false, 'status' => 'expired', 'message' => "Token expired. Please authenticate again."); | |
21 | + } else | |
22 | + { | |
23 | + $result = $amda_ws->getParameter($_GET); | |
24 | + } | |
25 | + | |
26 | + echo json_encode($result); | |
23 | 27 | ?> |
24 | 28 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,18 @@ |
1 | +<?php | |
2 | + | |
3 | +/** | |
4 | + * @file getStatus.php | |
5 | + * @brief REST interface for service getParameter | |
6 | + * | |
7 | + * @version $Id: $ | |
8 | + */ | |
9 | + | |
10 | +require_once '../config.php'; | |
11 | + | |
12 | +if (!key_exists("id", $_GET)) { | |
13 | + $result = array('success' => false, 'message' => "You must provide a job id"); | |
14 | +} else { | |
15 | + $amda_ws = new WebServer(); | |
16 | + $result = $amda_ws->getStatus($_GET); | |
17 | +} | |
18 | +echo json_encode($result); | |
0 | 19 | \ No newline at end of file |
... | ... |
php/rest/getTimeTablesList.php
... | ... | @@ -3,23 +3,20 @@ |
3 | 3 | /** |
4 | 4 | * @file getTimeTablesList.php |
5 | 5 | * @brief REST interface for service getTimeTablesList |
6 | -* | |
7 | -* | |
8 | -* @version $Id: $ | |
9 | 6 | */ |
10 | 7 | |
11 | - require_once '../config.php'; | |
8 | + require_once '../config.php'; | |
12 | 9 | |
13 | - $amda_ws = new WebServer(); | |
10 | + $amda_ws = new WebServer(); | |
14 | 11 | |
15 | - $result = $amda_ws->getTimeTablesList($_GET); | |
12 | + $result = $amda_ws->getTimeTablesList($_GET); | |
16 | 13 | |
17 | - if ($result['success']){ | |
18 | - echo $result['TimeTablesList']; | |
19 | - } | |
20 | - else { | |
21 | - echo $result['message']; | |
22 | - } | |
14 | + if ($result['success']) | |
15 | + { | |
16 | + echo $result['TimeTablesList']; | |
17 | + } | |
18 | + else | |
19 | + { | |
20 | + echo $result['message']; | |
21 | + } | |
23 | 22 | ?> |
24 | - | |
25 | - | |
... | ... |
public/WebServices/XML/AmdaPlots.xml deleted
... | ... | @@ -1,49 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<des> | |
3 | - <missions> | |
4 | - <mission xml:id='ACE' name='ACE'> | |
5 | - <param name='sw_vb' class="plasma" description="velocity_magnitude" instrument="SWEPAM"/> | |
6 | - <param name='sw_t' class="plasma" description="temperature_radial" instrument="SWEPAM"/> | |
7 | - <param name='sw_n' class="plasma" description="ion_density" instrument="SWEPAM"/> | |
8 | - <param name='imf' class="mag" description="magnetic_field_vector" instrument="MAG"/> | |
9 | - <param name='imf_mag' class="mag" description="magnetic_field_magnitude" instrument="MAG"/> | |
10 | - </mission> | |
11 | - <mission xml:id='WIND' name='WIND'> | |
12 | - <param name='wnd_swe_vmag' class="plasma" description="velocity_magnitude" instrument="SWE"/> | |
13 | - <param name='wnd_swe_vth' class="plasma" description="v_thermal" instrument="SWE"/> | |
14 | - <param name='wnd_swe_n' class="plasma" description="ion_density" instrument="SWE"/> | |
15 | - <param name='wnd_b' class="mag" description="magnetic_field_vector" instrument="MFI"/> | |
16 | - <param name='wnd_bmag' class="mag" description="magnetic_field_magnitude" instrument="MFI"/> | |
17 | - </mission> | |
18 | - <mission xml:id='STEREO-A' name='STA'> | |
19 | - <param name='vpbulk_sta' class="plasma" description="velocity_magnitude" instrument="PLASTIC"/> | |
20 | - <param name='vth_sta' class="plasma" description="v_thermal" instrument="PLASTIC"/> | |
21 | - <param name='np_sta' class="plasma" description="ion_density" instrument="PLASTIC"/> | |
22 | - <param name='sta_b' class="mag" description="magnetic_field_vector" instrument="MAG" /> | |
23 | - <param name='sta_btot' class="mag" description="magnetic_field_magnitude" instrument="MAG" /> | |
24 | - </mission> | |
25 | - <mission xml:id='STEREO-B' name='STB'> | |
26 | - <param name='vpbulk_stb' class="plasma" description="velocity_magnitude" instrument="PLASTIC"/> | |
27 | - <param name='vth_stb' class="plasma" description="v_thermal" instrument="PLASTIC"/> | |
28 | - <param name='np_stb' class="plasma" description="ion_density" instrument="PLASTIC"/> | |
29 | - <param name='stb_b' class="mag" description="magnetic_field_vector" instrument="MAG"/> | |
30 | - <param name='stb_btot' class="mag" description="magnetic_field_magnitude" instrument="MAG"/> | |
31 | - </mission> | |
32 | - <mission xml:id='VEX' name='VEX'> | |
33 | - <param name='vex_mag_4s' class="mag" description="magnetic_field_magnitude" instrument="MAG"/> | |
34 | - <param name='vex_mag_4s_tot' class="mag" description="magnetic_field_magnitude" instrument="MAG"/> | |
35 | - </mission> | |
36 | - <mission xml:id='OMNI' name='OMNI'> | |
37 | - <param name='omni_sw_v' class="plasma" description="velocity" instrument="imf/sw/indices"/> | |
38 | - <param name='omni_sw_t' class="plasma" description="temperature" instrument="imf/sw/indices"/> | |
39 | - <param name='omni_sw_n' class="plasma" description="density" instrument="imf/sw/indices"/> | |
40 | - <param name='omni_imf' class="mag" description="magnetic_field_magnitude" instrument="imf/sw/indices"/> | |
41 | - <param name='omni_imf_mag' class="mag" description="magnetic_field_magnitude" instrument="imf/sw/indices"/> | |
42 | - </mission> | |
43 | - <mission xml:id='GEOMAG' name='GEOMAG'> | |
44 | - <param name='omni_kp' class="mag" description="geomagnetic_indices" instrument="imf/sw/indices"/> | |
45 | - <param name='omni_dst' class="mag" description="geomagnetic_indices" instrument="imf/sw/indices"/> | |
46 | - <param name='omni_ae' class="mag" description="geomagnetic_indices" instrument="imf/sw/indices"/> | |
47 | - </mission> | |
48 | - </missions> | |
49 | -</des> |
public/wsdl/Methods_AMDA.wsdl
... | ... | @@ -30,34 +30,32 @@ |
30 | 30 | <xs:element name="getParameter" type="tns:getParameter"/> |
31 | 31 | <xs:element name="getParameterResponse" type="tns:getParameterResponse"/> |
32 | 32 | |
33 | - <xs:element name="getDataset" type="tns:getDataset"/> | |
33 | + <xs:element name="getDataset" type="tns:getDataset"/> | |
34 | 34 | <xs:element name="getDatasetResponse" type="tns:getDatasetResponse"/> |
35 | 35 | |
36 | - <xs:element name="getPlot" type="tns:getPlot"/> | |
36 | + <xs:element name="getPlot" type="tns:getPlot"/> | |
37 | 37 | <xs:element name="getPlotResponse" type="tns:getPlotResponse"/> |
38 | 38 | |
39 | - <xs:element name="getResultPlot" type="tns:getResultPlot"/> | |
40 | - <xs:element name="getResultPlotResponse" type="tns:getResultPlotResponse"/> | |
41 | - | |
42 | 39 | <xs:element name="getOrbites" type="tns:getOrbites"/> |
43 | 40 | <xs:element name="getOrbitesResponse" type="tns:getOrbitesResponse"/> |
44 | 41 | |
45 | 42 | <xs:element name="getObsDataTreeResponse" type="tns:getObsDataTreeResponse"/> |
46 | 43 | |
44 | + <xs:element name="getStatus" type="tns:getStatus"/> | |
45 | + <xs:element name="getStatusResponse" type="tns:getStatusResponse"/> | |
46 | + | |
47 | 47 | <xs:element name="alive" type="xs:boolean"/> |
48 | 48 | |
49 | 49 | <xs:complexType name="getObsDataTreeResponse"> |
50 | 50 | <xs:sequence> |
51 | 51 | <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> |
52 | 52 | <xs:annotation> |
53 | - <xs:documentation>If methode is OK success = true, else success = false</xs:documentation> | |
53 | + <xs:documentation>If method is OK success = true, else success = false</xs:documentation> | |
54 | 54 | </xs:annotation> |
55 | 55 | </xs:element> |
56 | 56 | <xs:element name="WorkSpace" type="tns:WorkSpace" minOccurs="1" maxOccurs="1"> |
57 | 57 | <xs:annotation> |
58 | - <xs:documentation>Url's of AmdaUserTree file which must be generated | |
59 | - after connections. Contents: AMDA local parameters, Remote | |
60 | - Parameters, Shared Predefined Parameters. </xs:documentation> | |
58 | + <xs:documentation>Url's of AMDA local parameters </xs:documentation> | |
61 | 59 | </xs:annotation> |
62 | 60 | </xs:element> |
63 | 61 | </xs:sequence> |
... | ... | @@ -67,15 +65,12 @@ |
67 | 65 | <xs:sequence> |
68 | 66 | <xs:element name="userID" type="xs:string" minOccurs="0" maxOccurs="1"> |
69 | 67 | <xs:annotation> |
70 | - <xs:documentation>ID of AMDA user storing in the 3DView. Must TBD. If no | |
71 | - user ID, result is shared Timetables from IMPEX user. | |
72 | - </xs:documentation> | |
68 | + <xs:documentation>ID of AMDA user. If no user ID, user is IMPEX</xs:documentation> | |
73 | 69 | </xs:annotation> |
74 | 70 | </xs:element> |
75 | 71 | <xs:element name="password" type="xs:string" minOccurs="0" maxOccurs="1"> |
76 | 72 | <xs:annotation> |
77 | - <xs:documentation>Crypt Password of AMDA user storing in the 3DView. | |
78 | - Must TBD encryption types</xs:documentation> | |
73 | + <xs:documentation>Crypt Password of AMDA user </xs:documentation> | |
79 | 74 | </xs:annotation> |
80 | 75 | </xs:element> |
81 | 76 | </xs:sequence> |
... | ... | @@ -85,8 +80,7 @@ |
85 | 80 | <xs:sequence> |
86 | 81 | <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> |
87 | 82 | <xs:annotation> |
88 | - <xs:documentation>Url of TimeTables storage file with TimeTables | |
89 | - ID's.</xs:documentation> | |
83 | + <xs:documentation>If method is OK success = true, else success = false</xs:documentation> | |
90 | 84 | </xs:annotation> |
91 | 85 | </xs:element> |
92 | 86 | <xs:element name="TimeTablesList" minOccurs="0" maxOccurs="1" type="xs:anyURI"> |
... | ... | @@ -102,13 +96,12 @@ |
102 | 96 | <xs:sequence> |
103 | 97 | <xs:element name="userID" type="xs:string" minOccurs="1" maxOccurs="1"> |
104 | 98 | <xs:annotation> |
105 | - <xs:documentation>ID of AMDA user</xs:documentation> | |
99 | + <xs:documentation>ID of AMDA user. If no user ID, user is IMPEX</xs:documentation> | |
106 | 100 | </xs:annotation> |
107 | 101 | </xs:element> |
108 | 102 | <xs:element name="password" type="xs:string" minOccurs="0" maxOccurs="1"> |
109 | 103 | <xs:annotation> |
110 | - <xs:documentation>Crypt Password of AMDA user storing in the 3DView. | |
111 | - Must TBD encryption types</xs:documentation> | |
104 | + <xs:documentation>Crypt Password of AMDA user</xs:documentation> | |
112 | 105 | </xs:annotation> |
113 | 106 | </xs:element> |
114 | 107 | </xs:sequence> |
... | ... | @@ -118,16 +111,14 @@ |
118 | 111 | <xs:sequence> |
119 | 112 | <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> |
120 | 113 | <xs:annotation> |
121 | - <xs:documentation>Url of TimeTables storage file with TimeTables | |
122 | - ID's.</xs:documentation> | |
114 | + <xs:documentation>If method is OK success = true, else success = false</xs:documentation> | |
123 | 115 | </xs:annotation> |
124 | 116 | </xs:element> |
125 | 117 | <xs:element name="ParameterList" type="tns:ParameterList" minOccurs="1" |
126 | 118 | maxOccurs="1"> |
127 | 119 | <xs:annotation> |
128 | - <xs:documentation>Url of AmdaUserTree file which must be generated after | |
129 | - the user connections Contents: User groups local parameters, User | |
130 | - remote parameters, user predefined parameters. </xs:documentation> | |
120 | + <xs:documentation>Url of UserDefinedParameters, Url of AmdaLocalDataBaseParameters, | |
121 | + Url of RemoteDataBaseParameters ( not implemented ) </xs:documentation> | |
131 | 122 | </xs:annotation> |
132 | 123 | </xs:element> |
133 | 124 | </xs:sequence> |
... | ... | @@ -135,7 +126,7 @@ |
135 | 126 | |
136 | 127 | <xs:simpleType name="enumSpacecraft"> |
137 | 128 | <xs:restriction base="xs:string"> |
138 | - <xs:enumeration value="Cassini_Public"/> | |
129 | + <xs:enumeration value="Cassini"/> | |
139 | 130 | <xs:enumeration value="Galileo"/> |
140 | 131 | <xs:enumeration value="Voyager_1"/> |
141 | 132 | <xs:enumeration value="Voyager_2"/> |
... | ... | @@ -170,7 +161,19 @@ |
170 | 161 | <xs:enumeration value="ISEE-2"/> |
171 | 162 | </xs:restriction> |
172 | 163 | </xs:simpleType> |
173 | - | |
164 | + | |
165 | + <xs:simpleType name="enumMission"> | |
166 | + <xs:restriction base="xs:string"> | |
167 | + <xs:enumeration value="ACE"/> | |
168 | + <xs:enumeration value="STEREO-A"/> | |
169 | + <xs:enumeration value="STEREO-B"/> | |
170 | + <xs:enumeration value="WIND"/> | |
171 | + <xs:enumeration value="VEX"/> | |
172 | + <xs:enumeration value="OMNI"/> | |
173 | + <xs:enumeration value="GEOMAG"/> | |
174 | + </xs:restriction> | |
175 | + </xs:simpleType> | |
176 | + | |
174 | 177 | <xs:simpleType name="WorkSpaceValue"> |
175 | 178 | <xs:restriction base="xs:string"> |
176 | 179 | <xs:enumeration value="TimeTables"/> |
... | ... | @@ -673,21 +676,18 @@ of a set of typically orthogonal axes. |
673 | 676 | </xs:element> |
674 | 677 | <xs:element name="userID" type="xs:string" minOccurs="0" maxOccurs="1"> |
675 | 678 | <xs:annotation> |
676 | - <xs:documentation>ID of AMDA user storing in the 3DView. Must TBD For | |
677 | - public data is optional. </xs:documentation> | |
679 | + <xs:documentation>ID of AMDA user. If no user ID, user is IMPEX</xs:documentation> | |
678 | 680 | </xs:annotation> |
679 | 681 | </xs:element> |
680 | 682 | <xs:element name="password" type="xs:string" minOccurs="0" maxOccurs="1"> |
681 | 683 | <xs:annotation> |
682 | - <xs:documentation>Crypt Password of AMDA user storing in the 3DView. | |
683 | - Must TBD encryption types Required for predefined parameters. | |
684 | - </xs:documentation> | |
684 | + <xs:documentation>Crypt Password of AMDA user </xs:documentation> | |
685 | 685 | </xs:annotation> |
686 | 686 | </xs:element> |
687 | 687 | <xs:element name="outputFormat" minOccurs="0" maxOccurs="1"> |
688 | 688 | <xs:annotation> |
689 | - <xs:documentation> Choice is possible between the two formats: netCDF, | |
690 | - ASCII and VOTable. If the format is not specified it will be netCDF | |
689 | + <xs:documentation> Choice is possible between the four formats: netCDF, CDF, | |
690 | + ASCII and VOTable. If the format is not specified it will be ASCIIF | |
691 | 691 | by default</xs:documentation> |
692 | 692 | </xs:annotation> |
693 | 693 | <xs:simpleType> |
... | ... | @@ -695,6 +695,7 @@ of a set of typically orthogonal axes. |
695 | 695 | <xs:enumeration value="netCDF"/> |
696 | 696 | <xs:enumeration value="VOTable"/> |
697 | 697 | <xs:enumeration value="ASCII"/> |
698 | + <xs:enumeration value="CDF"/> | |
698 | 699 | </xs:restriction> |
699 | 700 | </xs:simpleType> |
700 | 701 | </xs:element> |
... | ... | @@ -724,20 +725,77 @@ of a set of typically orthogonal axes. |
724 | 725 | <xs:sequence> |
725 | 726 | <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> |
726 | 727 | <xs:annotation> |
727 | - <xs:documentation>Url of TimeTables storage file with TimeTables | |
728 | - ID's.</xs:documentation> | |
728 | + <xs:documentation>If method is OK success = true, else success = false</xs:documentation> | |
729 | 729 | </xs:annotation> |
730 | 730 | </xs:element> |
731 | - <xs:element maxOccurs="unbounded" minOccurs="0" name="dataFileURLs" | |
732 | - type="xs:anyURI"> | |
731 | + <xs:element maxOccurs="unbounded" minOccurs="0" name="dataFileURLs" type="xs:anyURI"> | |
733 | 732 | <xs:annotation> |
734 | - <xs:documentation>URLs of results data files. If not URLs - not data for | |
733 | + <xs:documentation>URLs of results data files. If no URLs - no data for | |
735 | 734 | required parameters</xs:documentation> |
736 | 735 | </xs:annotation> |
737 | 736 | </xs:element> |
737 | + <xs:element maxOccurs="1" minOccurs="0" name="status"> | |
738 | + <xs:annotation> | |
739 | + <xs:documentation></xs:documentation> | |
740 | + </xs:annotation> | |
741 | + <xs:simpleType> | |
742 | + <xs:restriction base="xs:string"> | |
743 | + <xs:enumeration value="in progress"/> | |
744 | + <xs:enumeration value="error"/> | |
745 | + </xs:restriction> | |
746 | + </xs:simpleType> | |
747 | + </xs:element> | |
748 | + <xs:element maxOccurs="1" minOccurs="0" name="id" type="xs:string"> | |
749 | + <xs:annotation> | |
750 | + <xs:documentation>process ID</xs:documentation> | |
751 | + </xs:annotation> | |
752 | + </xs:element> | |
738 | 753 | </xs:sequence> |
739 | 754 | </xs:complexType> |
740 | - | |
755 | + | |
756 | + <xs:complexType name="getStatus"> | |
757 | + <xs:sequence> | |
758 | + <xs:element minOccurs="1" maxOccurs="1" name="id" type="xs:string"> | |
759 | + <xs:annotation> | |
760 | + <xs:documentation>process ID</xs:documentation> | |
761 | + </xs:annotation> | |
762 | + </xs:element> | |
763 | + </xs:sequence> | |
764 | + </xs:complexType> | |
765 | + | |
766 | + <xs:complexType name="getStatusResponse"> | |
767 | + <xs:sequence> | |
768 | + <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> | |
769 | + <xs:annotation> | |
770 | + <xs:documentation></xs:documentation> | |
771 | + </xs:annotation> | |
772 | + </xs:element> | |
773 | + <xs:element maxOccurs="unbounded" minOccurs="0" name="dataFileURLs" type="xs:anyURI"> | |
774 | + <xs:annotation> | |
775 | + <xs:documentation>URLs of results data files. If no URLs - no data for | |
776 | + required parameters</xs:documentation> | |
777 | + </xs:annotation> | |
778 | + </xs:element> | |
779 | + <xs:element maxOccurs="1" minOccurs="0" name="plotURL" type="xs:anyURI"> | |
780 | + <xs:annotation> | |
781 | + <xs:documentation>URLs of results plot files. If no URLs - no data for | |
782 | + required parameters</xs:documentation> | |
783 | + </xs:annotation> | |
784 | + </xs:element> | |
785 | + <xs:element maxOccurs="1" minOccurs="0" name="status"> | |
786 | + <xs:annotation> | |
787 | + <xs:documentation></xs:documentation> | |
788 | + </xs:annotation> | |
789 | + <xs:simpleType> | |
790 | + <xs:restriction base="xs:string"> | |
791 | + <xs:enumeration value="in progress"/> | |
792 | + <xs:enumeration value="error"/> | |
793 | + </xs:restriction> | |
794 | + </xs:simpleType> | |
795 | + </xs:element> | |
796 | + </xs:sequence> | |
797 | + </xs:complexType> | |
798 | + | |
741 | 799 | <xs:complexType name="getDataset"> |
742 | 800 | <xs:sequence> |
743 | 801 | <xs:element name="startTime" type="xs:string" minOccurs="1" maxOccurs="1"> |
... | ... | @@ -763,21 +821,18 @@ of a set of typically orthogonal axes. |
763 | 821 | </xs:element> |
764 | 822 | <xs:element name="userID" type="xs:string" minOccurs="0" maxOccurs="1"> |
765 | 823 | <xs:annotation> |
766 | - <xs:documentation>ID of AMDA user. For | |
767 | - public data is optional. </xs:documentation> | |
824 | + <xs:documentation>ID of AMDA user. If no user ID, user is IMPEX</xs:documentation> | |
768 | 825 | </xs:annotation> |
769 | 826 | </xs:element> |
770 | 827 | <xs:element name="password" type="xs:string" minOccurs="0" maxOccurs="1"> |
771 | 828 | <xs:annotation> |
772 | - <xs:documentation>Crypt Password of AMDA user. | |
773 | - Must TBD encryption types Required for predefined parameters. | |
774 | - </xs:documentation> | |
829 | + <xs:documentation>Crypt Password of AMDA user </xs:documentation> | |
775 | 830 | </xs:annotation> |
776 | 831 | </xs:element> |
777 | 832 | <xs:element name="outputFormat" minOccurs="0" maxOccurs="1"> |
778 | 833 | <xs:annotation> |
779 | - <xs:documentation> Choice is possible between the 3 formats: netCDF, | |
780 | - ASCII and VOTable. If the format is not specified it will be netCDF | |
834 | + <xs:documentation> Choice is possible between the four formats: netCDF, CDF, | |
835 | + ASCII and VOTable. If the format is not specified it will be ASCII | |
781 | 836 | by default</xs:documentation> |
782 | 837 | </xs:annotation> |
783 | 838 | <xs:simpleType> |
... | ... | @@ -785,6 +840,7 @@ of a set of typically orthogonal axes. |
785 | 840 | <xs:enumeration value="netCDF"/> |
786 | 841 | <xs:enumeration value="VOTable"/> |
787 | 842 | <xs:enumeration value="ASCII"/> |
843 | + <xs:enumeration value="CDF"/> | |
788 | 844 | </xs:restriction> |
789 | 845 | </xs:simpleType> |
790 | 846 | </xs:element> |
... | ... | @@ -814,17 +870,32 @@ of a set of typically orthogonal axes. |
814 | 870 | <xs:sequence> |
815 | 871 | <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> |
816 | 872 | <xs:annotation> |
817 | - <xs:documentation>Url of TimeTables storage file with TimeTables | |
818 | - ID's.</xs:documentation> | |
873 | + <xs:documentation></xs:documentation> | |
819 | 874 | </xs:annotation> |
820 | 875 | </xs:element> |
821 | 876 | <xs:element maxOccurs="unbounded" minOccurs="0" name="dataFileURLs" |
822 | 877 | type="xs:anyURI"> |
823 | 878 | <xs:annotation> |
824 | 879 | <xs:documentation>URLs of results data files. If not URLs - not data for |
825 | - required parameters</xs:documentation> | |
880 | + required datasets</xs:documentation> | |
826 | 881 | </xs:annotation> |
827 | 882 | </xs:element> |
883 | + <xs:element maxOccurs="1" minOccurs="0" name="status"> | |
884 | + <xs:annotation> | |
885 | + <xs:documentation></xs:documentation> | |
886 | + </xs:annotation> | |
887 | + <xs:simpleType> | |
888 | + <xs:restriction base="xs:string"> | |
889 | + <xs:enumeration value="in progress"/> | |
890 | + <xs:enumeration value="error"/> | |
891 | + </xs:restriction> | |
892 | + </xs:simpleType> | |
893 | + </xs:element> | |
894 | + <xs:element maxOccurs="1" minOccurs="0" name="id" type="xs:string"> | |
895 | + <xs:annotation> | |
896 | + <xs:documentation>process ID</xs:documentation> | |
897 | + </xs:annotation> | |
898 | + </xs:element> | |
828 | 899 | </xs:sequence> |
829 | 900 | </xs:complexType> |
830 | 901 | |
... | ... | @@ -840,7 +911,7 @@ of a set of typically orthogonal axes. |
840 | 911 | <xs:documentation>Stop time in ISO 8601 format</xs:documentation> |
841 | 912 | </xs:annotation> |
842 | 913 | </xs:element> |
843 | - <xs:element name="missionID" type="xs:string" minOccurs="1" maxOccurs="1"> | |
914 | + <xs:element name="missionID" type="tns:enumMission" minOccurs="1" maxOccurs="1"> | |
844 | 915 | <xs:annotation> |
845 | 916 | <xs:documentation>Id of mission defined in |
846 | 917 | Amda LocalParams.xml</xs:documentation> |
... | ... | @@ -853,7 +924,7 @@ of a set of typically orthogonal axes. |
853 | 924 | </xs:element> |
854 | 925 | <xs:element name="password" type="xs:string" minOccurs="0" maxOccurs="1"> |
855 | 926 | <xs:annotation> |
856 | - <xs:documentation>Password of AMDA</xs:documentation> | |
927 | + <xs:documentation>Password of AMDA user</xs:documentation> | |
857 | 928 | </xs:annotation> |
858 | 929 | </xs:element> |
859 | 930 | </xs:sequence> |
... | ... | @@ -866,32 +937,23 @@ of a set of typically orthogonal axes. |
866 | 937 | <xs:documentation>success or not</xs:documentation> |
867 | 938 | </xs:annotation> |
868 | 939 | </xs:element> |
869 | - <xs:element name="plotDirectoryURL" type="xs:string" minOccurs="1" maxOccurs="1"> | |
870 | - <xs:annotation> | |
871 | - <xs:documentation>URL of directory of png file</xs:documentation> | |
872 | - </xs:annotation> | |
873 | - </xs:element> | |
874 | - </xs:sequence> | |
875 | - </xs:complexType> | |
876 | - | |
877 | - <xs:complexType name="getResultPlot"> | |
878 | - <xs:sequence> | |
879 | - <xs:element name="plotDirectoryURL" type="xs:string" minOccurs="1" maxOccurs="1"> | |
940 | + <xs:element maxOccurs="1" minOccurs="0" name="status"> | |
880 | 941 | <xs:annotation> |
881 | - <xs:documentation>URL of directory of png file</xs:documentation> | |
942 | + <xs:documentation></xs:documentation> | |
882 | 943 | </xs:annotation> |
944 | + <xs:simpleType> | |
945 | + <xs:restriction base="xs:string"> | |
946 | + <xs:enumeration value="in progress"/> | |
947 | + <xs:enumeration value="error"/> | |
948 | + </xs:restriction> | |
949 | + </xs:simpleType> | |
883 | 950 | </xs:element> |
884 | - </xs:sequence> | |
885 | - </xs:complexType> | |
886 | - | |
887 | - <xs:complexType name="getResultPlotResponse"> | |
888 | - <xs:sequence> | |
889 | - <xs:element name="success" minOccurs="1" maxOccurs="1" type="xs:boolean"> | |
951 | + <xs:element maxOccurs="1" minOccurs="0" name="id" type="xs:string"> | |
890 | 952 | <xs:annotation> |
891 | - <xs:documentation>success=true if plot exists and else false </xs:documentation> | |
953 | + <xs:documentation>process ID</xs:documentation> | |
892 | 954 | </xs:annotation> |
893 | 955 | </xs:element> |
894 | - <xs:element name="plotFileURL" type="xs:anyURI" minOccurs="0" maxOccurs="1"> | |
956 | + <xs:element name="plotFileURL" type="xs:string" minOccurs="0" maxOccurs="1"> | |
895 | 957 | <xs:annotation> |
896 | 958 | <xs:documentation>URL of png file</xs:documentation> |
897 | 959 | </xs:annotation> |
... | ... | @@ -913,7 +975,7 @@ of a set of typically orthogonal axes. |
913 | 975 | </xs:element> |
914 | 976 | <xs:element name="spacecraft" type="tns:enumSpacecraft" maxOccurs="1" minOccurs="1"> |
915 | 977 | <xs:annotation> |
916 | - <xs:documentation>List of spavecrafts from AMDA</xs:documentation> | |
978 | + <xs:documentation>List of spacecraft from AMDA</xs:documentation> | |
917 | 979 | </xs:annotation> |
918 | 980 | </xs:element> |
919 | 981 | <xs:element name="coordinateSystem" type="tns:enumCoordinateSystemName" minOccurs="1" maxOccurs="1"> |
... | ... | @@ -948,21 +1010,18 @@ of a set of typically orthogonal axes. |
948 | 1010 | </xs:element> |
949 | 1011 | <xs:element name="userID" type="xs:string" minOccurs="0" maxOccurs="1"> |
950 | 1012 | <xs:annotation> |
951 | - <xs:documentation>ID of AMDA user storing in the 3DView. Must TBD For | |
952 | - public data is optional. </xs:documentation> | |
1013 | + <xs:documentation>ID of AMDA user. If no user ID, user is IMPEX</xs:documentation> | |
953 | 1014 | </xs:annotation> |
954 | 1015 | </xs:element> |
955 | 1016 | <xs:element name="password" type="xs:string" minOccurs="0" maxOccurs="1"> |
956 | 1017 | <xs:annotation> |
957 | - <xs:documentation>Crypt Password of AMDA user storing in the 3DView. | |
958 | - Must TBD encryption types Required for predefined parameters. | |
959 | - </xs:documentation> | |
1018 | + <xs:documentation>Crypt Password of AMDA user </xs:documentation> | |
960 | 1019 | </xs:annotation> |
961 | 1020 | </xs:element> |
962 | 1021 | <xs:element name="outputFormat" minOccurs="0" maxOccurs="1"> |
963 | 1022 | <xs:annotation> |
964 | - <xs:documentation> Choice is possible between the two formats: netCDF, | |
965 | - ASCII and VOTable. If the format is not specified it will be netCDF | |
1023 | + <xs:documentation> Choice is possible between the four formats: netCDF, CDF, | |
1024 | + ASCII and VOTable. If the format is not specified it will be ASCII | |
966 | 1025 | by default</xs:documentation> |
967 | 1026 | </xs:annotation> |
968 | 1027 | <xs:simpleType> |
... | ... | @@ -970,6 +1029,7 @@ of a set of typically orthogonal axes. |
970 | 1029 | <xs:enumeration value="netCDF"/> |
971 | 1030 | <xs:enumeration value="VOTable"/> |
972 | 1031 | <xs:enumeration value="ASCII"/> |
1032 | + <xs:enumeration value="CDF"/> | |
973 | 1033 | </xs:restriction> |
974 | 1034 | </xs:simpleType> |
975 | 1035 | </xs:element> |
... | ... | @@ -999,8 +1059,7 @@ of a set of typically orthogonal axes. |
999 | 1059 | <xs:sequence> |
1000 | 1060 | <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> |
1001 | 1061 | <xs:annotation> |
1002 | - <xs:documentation>Url of TimeTables storage file with TimeTables | |
1003 | - ID's.</xs:documentation> | |
1062 | + <xs:documentation></xs:documentation> | |
1004 | 1063 | </xs:annotation> |
1005 | 1064 | </xs:element> |
1006 | 1065 | <xs:element maxOccurs="unbounded" minOccurs="0" name="dataFileURLs" |
... | ... | @@ -1010,6 +1069,22 @@ of a set of typically orthogonal axes. |
1010 | 1069 | required parameters</xs:documentation> |
1011 | 1070 | </xs:annotation> |
1012 | 1071 | </xs:element> |
1072 | + <xs:element maxOccurs="1" minOccurs="0" name="status"> | |
1073 | + <xs:annotation> | |
1074 | + <xs:documentation></xs:documentation> | |
1075 | + </xs:annotation> | |
1076 | + <xs:simpleType> | |
1077 | + <xs:restriction base="xs:string"> | |
1078 | + <xs:enumeration value="in progress"/> | |
1079 | + <xs:enumeration value="error"/> | |
1080 | + </xs:restriction> | |
1081 | + </xs:simpleType> | |
1082 | + </xs:element> | |
1083 | + <xs:element maxOccurs="1" minOccurs="0" name="id" type="xs:string"> | |
1084 | + <xs:annotation> | |
1085 | + <xs:documentation>process ID</xs:documentation> | |
1086 | + </xs:annotation> | |
1087 | + </xs:element> | |
1013 | 1088 | </xs:sequence> |
1014 | 1089 | </xs:complexType> |
1015 | 1090 | |
... | ... | @@ -1017,21 +1092,17 @@ of a set of typically orthogonal axes. |
1017 | 1092 | <xs:sequence> |
1018 | 1093 | <xs:element name="userID" type="xs:string" minOccurs="0" maxOccurs="1"> |
1019 | 1094 | <xs:annotation> |
1020 | - <xs:documentation>ID of AMDA user storing in the 3DView. Must | |
1021 | - TBD</xs:documentation> | |
1095 | + <xs:documentation>ID of AMDA user. If no user ID, user is IMPEX</xs:documentation> | |
1022 | 1096 | </xs:annotation> |
1023 | 1097 | </xs:element> |
1024 | 1098 | <xs:element name="password" type="xs:string" minOccurs="0" maxOccurs="1"> |
1025 | 1099 | <xs:annotation> |
1026 | - <xs:documentation>Crypt Password of AMDA user storing in the 3DView. | |
1027 | - Must TBD encryption types Required for predefined parameters. | |
1028 | - </xs:documentation> | |
1100 | + <xs:documentation>Crypt Password of AMDA user </xs:documentation> | |
1029 | 1101 | </xs:annotation> |
1030 | 1102 | </xs:element> |
1031 | 1103 | <xs:element name="ttID" type="xs:string" minOccurs="1" maxOccurs="1"> |
1032 | 1104 | <xs:annotation> |
1033 | - <xs:documentation>Id of time tables(TT) defined in | |
1034 | - AmdaUserTree.xml</xs:documentation> | |
1105 | + <xs:documentation>Id of time table</xs:documentation> | |
1035 | 1106 | </xs:annotation> |
1036 | 1107 | </xs:element> |
1037 | 1108 | </xs:sequence> |
... | ... | @@ -1040,8 +1111,7 @@ of a set of typically orthogonal axes. |
1040 | 1111 | <xs:sequence> |
1041 | 1112 | <xs:element name="success" minOccurs="0" maxOccurs="1" type="xs:boolean"> |
1042 | 1113 | <xs:annotation> |
1043 | - <xs:documentation>Url of TimeTables storage file with TimeTables | |
1044 | - ID's.</xs:documentation> | |
1114 | + <xs:documentation></xs:documentation> | |
1045 | 1115 | </xs:annotation> |
1046 | 1116 | </xs:element> |
1047 | 1117 | <xs:element name="ttFileURL" type="xs:anyURI" minOccurs="1" maxOccurs="1"> |
... | ... | @@ -1071,7 +1141,7 @@ of a set of typically orthogonal axes. |
1071 | 1141 | </wsdl:message> |
1072 | 1142 | |
1073 | 1143 | <wsdl:message name="getObsDataTree"> |
1074 | - <wsdl:part name="parameters" element="tns:emptyElement"> </wsdl:part> | |
1144 | + <wsdl:part name="parameters" element="tns:emptyElement"></wsdl:part> | |
1075 | 1145 | </wsdl:message> |
1076 | 1146 | |
1077 | 1147 | <wsdl:message name="getObsDataTreeResponse"> |
... | ... | @@ -1103,7 +1173,7 @@ of a set of typically orthogonal axes. |
1103 | 1173 | </wsdl:message> |
1104 | 1174 | |
1105 | 1175 | <wsdl:message name="getDataset"> |
1106 | - <wsdl:part name="parameters" element="tns:getDataset"> </wsdl:part> | |
1176 | + <wsdl:part name="parameters" element="tns:getDataset"></wsdl:part> | |
1107 | 1177 | </wsdl:message> |
1108 | 1178 | |
1109 | 1179 | <wsdl:message name="getDatasetResponse"> |
... | ... | @@ -1118,15 +1188,14 @@ of a set of typically orthogonal axes. |
1118 | 1188 | <wsdl:part name="parameters" element="tns:getPlotResponse"> </wsdl:part> |
1119 | 1189 | </wsdl:message> |
1120 | 1190 | |
1121 | - <wsdl:message name="getResultPlot"> | |
1122 | - <wsdl:part name="parameters" element="tns:getResultPlot"> </wsdl:part> | |
1191 | + <wsdl:message name="getStatus"> | |
1192 | + <wsdl:part name="parameters" element="tns:getStatus"></wsdl:part> | |
1123 | 1193 | </wsdl:message> |
1124 | 1194 | |
1125 | - <wsdl:message name="getResultPlotResponse"> | |
1126 | - <wsdl:part name="parameters" element="tns:getResultPlotResponse"> </wsdl:part> | |
1195 | + <wsdl:message name="getStatusResponse"> | |
1196 | + <wsdl:part name="parameters" element="tns:getStatusResponse"> </wsdl:part> | |
1127 | 1197 | </wsdl:message> |
1128 | - | |
1129 | - | |
1198 | + | |
1130 | 1199 | <wsdl:message name="getOrbites"> |
1131 | 1200 | <wsdl:part name="parameters" element="tns:getOrbites"> </wsdl:part> |
1132 | 1201 | </wsdl:message> |
... | ... | @@ -1171,7 +1240,12 @@ of a set of typically orthogonal axes. |
1171 | 1240 | <wsdl:input message="tns:getParameter"> </wsdl:input> |
1172 | 1241 | <wsdl:output message="tns:getParameterResponse"> </wsdl:output> |
1173 | 1242 | </wsdl:operation> |
1174 | - | |
1243 | + | |
1244 | + <wsdl:operation name="getStatus"> | |
1245 | + <wsdl:input message="tns:getStatus"> </wsdl:input> | |
1246 | + <wsdl:output message="tns:getStatusResponse"> </wsdl:output> | |
1247 | + </wsdl:operation> | |
1248 | + | |
1175 | 1249 | <wsdl:operation name="getDataset"> |
1176 | 1250 | <wsdl:input message="tns:getDataset"> </wsdl:input> |
1177 | 1251 | <wsdl:output message="tns:getDatasetResponse"> </wsdl:output> |
... | ... | @@ -1182,11 +1256,6 @@ of a set of typically orthogonal axes. |
1182 | 1256 | <wsdl:output message="tns:getPlotResponse"> </wsdl:output> |
1183 | 1257 | </wsdl:operation> |
1184 | 1258 | |
1185 | - <wsdl:operation name="getResultPlot"> | |
1186 | - <wsdl:input message="tns:getResultPlot"> </wsdl:input> | |
1187 | - <wsdl:output message="tns:getResultPlotResponse"> </wsdl:output> | |
1188 | - </wsdl:operation> | |
1189 | - | |
1190 | 1259 | <wsdl:operation name="getOrbites"> |
1191 | 1260 | <wsdl:input message="tns:getOrbites"> </wsdl:input> |
1192 | 1261 | <wsdl:output message="tns:getOrbitesResponse"> </wsdl:output> |
... | ... | @@ -1253,8 +1322,8 @@ of a set of typically orthogonal axes. |
1253 | 1322 | <soap:body use="literal"/> |
1254 | 1323 | </wsdl:output> |
1255 | 1324 | </wsdl:operation> |
1256 | - | |
1257 | - <wsdl:operation name="getDataset"> | |
1325 | + | |
1326 | + <wsdl:operation name="getStatus"> | |
1258 | 1327 | <soap:operation soapAction="" style="document"/> |
1259 | 1328 | <wsdl:input> |
1260 | 1329 | <soap:body use="literal"/> |
... | ... | @@ -1263,8 +1332,8 @@ of a set of typically orthogonal axes. |
1263 | 1332 | <soap:body use="literal"/> |
1264 | 1333 | </wsdl:output> |
1265 | 1334 | </wsdl:operation> |
1266 | - | |
1267 | - <wsdl:operation name="getPlot"> | |
1335 | + | |
1336 | + <wsdl:operation name="getDataset"> | |
1268 | 1337 | <soap:operation soapAction="" style="document"/> |
1269 | 1338 | <wsdl:input> |
1270 | 1339 | <soap:body use="literal"/> |
... | ... | @@ -1274,7 +1343,7 @@ of a set of typically orthogonal axes. |
1274 | 1343 | </wsdl:output> |
1275 | 1344 | </wsdl:operation> |
1276 | 1345 | |
1277 | - <wsdl:operation name="getResultPlot"> | |
1346 | + <wsdl:operation name="getPlot"> | |
1278 | 1347 | <soap:operation soapAction="" style="document"/> |
1279 | 1348 | <wsdl:input> |
1280 | 1349 | <soap:body use="literal"/> |
... | ... | @@ -1309,7 +1378,7 @@ of a set of typically orthogonal axes. |
1309 | 1378 | |
1310 | 1379 | <wsdl:service name="Methods_AMDA"> |
1311 | 1380 | <wsdl:port name="Methods_AMDAPort" binding="tns:Methods_AMDASoapBinding"> |
1312 | - <soap:address location="http://apus.cesr.fr/AMDA-TEST/php/AMDA_METHODS_WSDL.php"/> | |
1381 | + <soap:address location="http://amdadev.irap.omp.eu/FEATURES/php/AMDA_METHODS_WSDL.php"/> | |
1313 | 1382 | </wsdl:port> |
1314 | 1383 | </wsdl:service> |
1315 | 1384 | </wsdl:definitions> |
... | ... |