Commit b819430315217868e39609f16a805143e569165b
1 parent
2b26bbdd
Exists in
master
and in
110 other branches
getPlot final
Showing
4 changed files
with
54 additions
and
103 deletions
Show diff stats
php/classes/WebServer.php
... | ... | @@ -71,6 +71,11 @@ class WebServer |
71 | 71 | return array("error" => $msg); |
72 | 72 | } |
73 | 73 | |
74 | + private function isGetPlotRequest($name){ | |
75 | + | |
76 | + return (substr($name,0,7) == 'getplot'); | |
77 | + } | |
78 | + | |
74 | 79 | private function xsl2vot($inputName, $outputName) |
75 | 80 | { |
76 | 81 | // Load Time table |
... | ... | @@ -148,20 +153,6 @@ class WebServer |
148 | 153 | |
149 | 154 | return WSConfigClass::getUrl().$ttListResult; |
150 | 155 | } |
151 | - | |
152 | - public function getResultPlot($data) | |
153 | - { | |
154 | - $res = $this->init($data); | |
155 | - $vars = $res['vars']; | |
156 | - $ID = $vars["plotDirectoryURL"]; | |
157 | - $filename = WSRESULT.$ID."/request.list.png"; | |
158 | - if (file_exists($filename)) { | |
159 | - $plotWSresult=WSRESULT.$ID."/request.list.png"; | |
160 | - return array('success' => true, 'plotFileURL' => 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$plotWSresult)); | |
161 | - } | |
162 | - else | |
163 | - return array('success' => false); | |
164 | - } | |
165 | 156 | |
166 | 157 | /* |
167 | 158 | * Get corresponding orbit parameter ID |
... | ... | @@ -537,7 +528,9 @@ class WebServer |
537 | 528 | $this->throwError("processError","Cannot retrieve process $id info"); |
538 | 529 | } |
539 | 530 | |
540 | - return array('success' => true, 'status' => 'done', 'dataFileURLs' => WSConfigClass::getUrl().$res['result']); | |
531 | + $resultTag = $this->isGetPlotRequest($res['result']) ? 'plotURL' : 'dataFileURLs'; | |
532 | + | |
533 | + return array('success' => true, 'status' => 'done', $resultTag => WSConfigClass::getUrl().$res['result']); | |
541 | 534 | } |
542 | 535 | catch (Exception $e) |
543 | 536 | { |
... | ... | @@ -558,7 +551,10 @@ class WebServer |
558 | 551 | } |
559 | 552 | |
560 | 553 | $this->deleteProcess($res['id']); |
561 | - return array('success' => true, 'status' => $res['status'], 'dataFileURLs' => WSConfigClass::getUrl().$res['result']); | |
554 | + | |
555 | + $resultTag = $this->isGetPlotRequest($res['result']) ? 'plotURL' : 'dataFileURLs'; | |
556 | + | |
557 | + return array('success' => true, 'status' => $res['status'], $resultTag => WSConfigClass::getUrl().$res['result']); | |
562 | 558 | } |
563 | 559 | |
564 | 560 | /* |
... | ... | @@ -675,8 +671,11 @@ class WebServer |
675 | 671 | |
676 | 672 | $vars = $res['vars']; |
677 | 673 | $mission = $vars["missionID"]; |
678 | - | |
679 | - $resDirName = WSConfigClass::getWsResultDir(); // Define a temporary directory for results | |
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; | |
680 | 679 | |
681 | 680 | $dom = new DomDocument("1.0"); |
682 | 681 | $dom->load(plotsXml); |
... | ... | @@ -691,51 +690,22 @@ class WebServer |
691 | 690 | $requestObject = (Object) array( |
692 | 691 | "nodeType" => "request", |
693 | 692 | "file-format" => "PNG", |
694 | - "file-output" => "WS", | |
695 | - "ws-result-file" => $resDirName."/request.list.png", | |
696 | - "last-plotted-tab" => 1, | |
693 | + "result-file" => $resultFilePrefix, | |
697 | 694 | "timesrc" => "Interval", |
698 | 695 | "startDate" => $vars["startTime"], |
699 | 696 | "stopDate" => $vars["stopTime"], |
700 | - "tabs" => array() | |
697 | + "parameters" => array() | |
701 | 698 | ); |
702 | 699 | |
703 | - $pageObject = (Object) array( | |
704 | - "panels" => array() | |
705 | - ); | |
706 | - | |
707 | 700 | foreach ($paramsList as $paramToPlot) |
708 | 701 | { |
709 | - $panelObject = (Object) array( | |
710 | - "panel-plot-type" => "timePlot", | |
711 | - "axes" => array(), | |
712 | - "params" => array() | |
713 | - ); | |
714 | - | |
715 | - $timeAxisObject = (Object) array( | |
716 | - ); | |
717 | - $panelObject->{"axes"}[] = $timeAxisObject; | |
718 | - | |
719 | - $yAxisObject = (Object) array( | |
720 | - ); | |
721 | - $panelObject->{"axes"}[] = $yAxisObject; | |
722 | - | |
723 | 702 | $paramObject = (Object) array( |
724 | - "id" => 1, | |
725 | - "paramid" => $paramToPlot, | |
726 | - "param-drawing-type" => "serie", | |
727 | - "param-drawing-object" => (Object) array( | |
728 | - "serie-yaxis" => "y-left", | |
729 | - "serie-lines-activated" => true | |
730 | - ) | |
703 | + "paramid" => $paramToPlot | |
731 | 704 | ); |
732 | - $panelObject->{"params"}[] = $paramObject; | |
733 | 705 | |
734 | - $pageObject->{"panels"}[] = $panelObject; | |
706 | + $requestObject->{"parameters"}[] = $paramObject; | |
735 | 707 | } |
736 | - | |
737 | - $requestObject->{"tabs"}[] = $pageObject; | |
738 | - | |
708 | + | |
739 | 709 | $this->service = strtolower(__FUNCTION__); |
740 | 710 | |
741 | 711 | if (!isset($this->requestManager)) |
... | ... | @@ -746,8 +716,20 @@ class WebServer |
746 | 716 | } catch (Exception $e) { |
747 | 717 | $this->throwError("plotError", "Exeption detected : ".$e->getMessage()); |
748 | 718 | } |
749 | - | |
750 | - return array('success' => true, 'plotDirectoryURL' => $ID); | |
719 | + | |
720 | + if (!$plotResult['success']) { | |
721 | + $this->throwError("serverError", $plotResult['message']); | |
722 | + } | |
723 | + | |
724 | + if($plotResult['status'] == 'in_progress') { | |
725 | + return ['success' => true, 'status' => 'in progress', 'id' => $plotResult['id']]; | |
726 | + } elseif ($plotResult['status'] == 'done') | |
727 | + { | |
728 | + $this->deleteProcess($plotResult['id']); | |
729 | + return array('success' => true, 'status' => 'done', 'plotFileURL' => WSConfigClass::getUrl().$plotResult['result']); | |
730 | + } else { | |
731 | + return ['success' => false, 'message' => 'Unknown status ' . $plotResult['status']]; | |
732 | + } | |
751 | 733 | } |
752 | 734 | } |
753 | 735 | ?> |
... | ... |
php/rest/getDataset.php
php/rest/getTimeTablesList.php
public/wsdl/Methods_AMDA.wsdl
... | ... | @@ -36,9 +36,6 @@ |
36 | 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 | |
... | ... | @@ -791,6 +788,12 @@ of a set of typically orthogonal axes. |
791 | 788 | required parameters</xs:documentation> |
792 | 789 | </xs:annotation> |
793 | 790 | </xs:element> |
791 | + <xs:element maxOccurs="1" minOccurs="0" name="plotURL" type="xs:anyURI"> | |
792 | + <xs:annotation> | |
793 | + <xs:documentation>URLs of results plot files. If no URLs - no data for | |
794 | + required parameters</xs:documentation> | |
795 | + </xs:annotation> | |
796 | + </xs:element> | |
794 | 797 | <xs:element maxOccurs="1" minOccurs="0" name="status"> |
795 | 798 | <xs:annotation> |
796 | 799 | <xs:documentation></xs:documentation> |
... | ... | @@ -948,32 +951,23 @@ of a set of typically orthogonal axes. |
948 | 951 | <xs:documentation>success or not</xs:documentation> |
949 | 952 | </xs:annotation> |
950 | 953 | </xs:element> |
951 | - <xs:element name="plotDirectoryURL" type="xs:string" minOccurs="1" maxOccurs="1"> | |
952 | - <xs:annotation> | |
953 | - <xs:documentation>URL of directory of png file</xs:documentation> | |
954 | - </xs:annotation> | |
955 | - </xs:element> | |
956 | - </xs:sequence> | |
957 | - </xs:complexType> | |
958 | - | |
959 | - <xs:complexType name="getResultPlot"> | |
960 | - <xs:sequence> | |
961 | - <xs:element name="plotDirectoryURL" type="xs:string" minOccurs="1" maxOccurs="1"> | |
954 | + <xs:element maxOccurs="1" minOccurs="0" name="status"> | |
962 | 955 | <xs:annotation> |
963 | - <xs:documentation>URL of directory of png file</xs:documentation> | |
956 | + <xs:documentation></xs:documentation> | |
964 | 957 | </xs:annotation> |
958 | + <xs:simpleType> | |
959 | + <xs:restriction base="xs:string"> | |
960 | + <xs:enumeration value="in progress"/> | |
961 | + <xs:enumeration value="error"/> | |
962 | + </xs:restriction> | |
963 | + </xs:simpleType> | |
965 | 964 | </xs:element> |
966 | - </xs:sequence> | |
967 | - </xs:complexType> | |
968 | - | |
969 | - <xs:complexType name="getResultPlotResponse"> | |
970 | - <xs:sequence> | |
971 | - <xs:element name="success" minOccurs="1" maxOccurs="1" type="xs:boolean"> | |
965 | + <xs:element maxOccurs="1" minOccurs="0" name="id" type="xs:string"> | |
972 | 966 | <xs:annotation> |
973 | - <xs:documentation>success=true if plot exists and else false </xs:documentation> | |
967 | + <xs:documentation>process ID</xs:documentation> | |
974 | 968 | </xs:annotation> |
975 | 969 | </xs:element> |
976 | - <xs:element name="plotFileURL" type="xs:anyURI" minOccurs="0" maxOccurs="1"> | |
970 | + <xs:element name="plotFileURL" type="xs:string" minOccurs="0" maxOccurs="1"> | |
977 | 971 | <xs:annotation> |
978 | 972 | <xs:documentation>URL of png file</xs:documentation> |
979 | 973 | </xs:annotation> |
... | ... | @@ -1214,14 +1208,6 @@ of a set of typically orthogonal axes. |
1214 | 1208 | <wsdl:part name="parameters" element="tns:getPlotResponse"> </wsdl:part> |
1215 | 1209 | </wsdl:message> |
1216 | 1210 | |
1217 | - <wsdl:message name="getResultPlot"> | |
1218 | - <wsdl:part name="parameters" element="tns:getResultPlot"> </wsdl:part> | |
1219 | - </wsdl:message> | |
1220 | - | |
1221 | - <wsdl:message name="getResultPlotResponse"> | |
1222 | - <wsdl:part name="parameters" element="tns:getResultPlotResponse"></wsdl:part> | |
1223 | - </wsdl:message> | |
1224 | - | |
1225 | 1211 | <wsdl:message name="getStatus"> |
1226 | 1212 | <wsdl:part name="parameters" element="tns:getStatus"></wsdl:part> |
1227 | 1213 | </wsdl:message> |
... | ... | @@ -1290,11 +1276,6 @@ of a set of typically orthogonal axes. |
1290 | 1276 | <wsdl:output message="tns:getPlotResponse"> </wsdl:output> |
1291 | 1277 | </wsdl:operation> |
1292 | 1278 | |
1293 | - <wsdl:operation name="getResultPlot"> | |
1294 | - <wsdl:input message="tns:getResultPlot"> </wsdl:input> | |
1295 | - <wsdl:output message="tns:getResultPlotResponse"> </wsdl:output> | |
1296 | - </wsdl:operation> | |
1297 | - | |
1298 | 1279 | <wsdl:operation name="getOrbites"> |
1299 | 1280 | <wsdl:input message="tns:getOrbites"> </wsdl:input> |
1300 | 1281 | <wsdl:output message="tns:getOrbitesResponse"> </wsdl:output> |
... | ... | @@ -1392,16 +1373,6 @@ of a set of typically orthogonal axes. |
1392 | 1373 | </wsdl:output> |
1393 | 1374 | </wsdl:operation> |
1394 | 1375 | |
1395 | - <wsdl:operation name="getResultPlot"> | |
1396 | - <soap:operation soapAction="" style="document"/> | |
1397 | - <wsdl:input> | |
1398 | - <soap:body use="literal"/> | |
1399 | - </wsdl:input> | |
1400 | - <wsdl:output> | |
1401 | - <soap:body use="literal"/> | |
1402 | - </wsdl:output> | |
1403 | - </wsdl:operation> | |
1404 | - | |
1405 | 1376 | <wsdl:operation name="getOrbites"> |
1406 | 1377 | <soap:operation soapAction="" style="document"/> |
1407 | 1378 | <wsdl:input> |
... | ... |