Commit 15ee6c97ac581e48d2fb550c00a247230d4eaa73
1 parent
6d5a8ab0
Exists in
master
and in
1 other branch
Add getVIInfo
Showing
2 changed files
with
74 additions
and
67 deletions
Show diff stats
src/DDSERVICES/SOAP/DDserverWeb.php
... | ... | @@ -105,64 +105,75 @@ |
105 | 105 | /** |
106 | 106 | * Returns list of datasets with TimeRestriction |
107 | 107 | */ |
108 | -function getDatasetsModificationDates() | |
108 | +function getVIInfo($viId) | |
109 | 109 | { |
110 | - $result = array( | |
111 | - ); | |
112 | - $referXML = baseDir."/DDsys.xml"; | |
113 | - $DDsys = new DOMDocument("1.0"); | |
114 | - @$DDsys->load($referXML); | |
115 | - $xp = new domxpath($DDsys); | |
116 | - $VINodes = $xp->query("//VI"); | |
117 | - if ($VINodes->length == 0) { | |
118 | - return $result; | |
119 | - } | |
120 | - | |
121 | - foreach ($VINodes as $VINode) | |
122 | - { | |
123 | - $locationNode = $VINode->getElementsByTagName("LOCATION"); | |
124 | - $nameNode = $VINode->getElementsByTagName("NAME"); | |
125 | - $timesNode = $VINode->getElementsByTagName("TIMES"); | |
126 | - if (($locationNode->length > 0) && ($nameNode->length > 0) && ($timesNode->length > 0)) | |
127 | - { | |
128 | - $locationNode = $locationNode->item(0); | |
129 | - $nameNode = $nameNode->item(0); | |
130 | - $location = $locationNode->nodeValue; | |
131 | - $viName = $nameNode->nodeValue; | |
132 | - $timesNode = $timesNode->item(0); | |
133 | - $timesFile = $location.$timesNode->nodeValue; | |
134 | - if (!empty($location) && !empty($viName)) { | |
135 | - | |
136 | - // Release date | |
137 | - $releaseDate = NULL; | |
138 | - $find = 'find '.$location.' -name \'*.nc.gz\' -type f -printf \'%T@ %p\n\' | sort -n | tail -1 | cut -f2- -d" "'; | |
139 | - $lastFile = exec($find); | |
140 | - if (file_exists($lastFile)) { | |
141 | - $cmd = 'date "+%Y-%m-%dT%H:%M:%SZ" -u -r '.$lastFile; // for NFS | |
110 | + $result = array( | |
111 | + ); | |
112 | + $referXML = baseDir."/DDsys.xml"; | |
113 | + $DDsys = new DOMDocument("1.0"); | |
114 | + @$DDsys->load($referXML); | |
115 | + $xp = new domxpath($DDsys); | |
116 | + $VINodes = $xp->query("//NAME[.='".str_replace(":", "_",$viId)."']"); | |
117 | + $result = array( | |
118 | + 'success' => FALSE | |
119 | + ); | |
120 | + | |
121 | + if ($VINodes->length == 0) { | |
122 | + return $result; | |
123 | + } | |
124 | + | |
125 | + $VINode = $VINodes->item(0)->parentNode; | |
126 | + | |
127 | + $locationNode = $VINode->getElementsByTagName("LOCATION"); | |
128 | + $nameNode = $VINode->getElementsByTagName("NAME"); | |
129 | + $timesNode = $VINode->getElementsByTagName("TIMES"); | |
130 | + if (($locationNode->length > 0) && ($nameNode->length > 0) && ($timesNode->length > 0)) | |
131 | + { | |
132 | + | |
142 | 133 | |
143 | - $releaseDate = exec($cmd); | |
144 | - } | |
134 | + $locationNode = $locationNode->item(0); | |
135 | + $nameNode = $nameNode->item(0); | |
136 | + $location = $locationNode->nodeValue; | |
137 | + $viName = $nameNode->nodeValue; | |
138 | + $timesNode = $timesNode->item(0); | |
139 | + $timesFile = $location.$timesNode->nodeValue; | |
140 | + if (!empty($location) && !empty($viName)) { | |
141 | + | |
142 | + // Start / Stop Date | |
143 | + $referFile = baseDir."/refer.nc"; | |
144 | + $cmd = DDBASEBIN."/StartStop ".$referFile." ".$viId; | |
145 | + $startStopDate = system($cmd); | |
146 | + | |
147 | + // Release date | |
148 | + $releaseDate = NULL; | |
149 | + $find = 'find '.$location.' -name \'*.nc.gz\' -type f -printf \'%T@ %p\n\' | sort -n | tail -1 | cut -f2- -d" "'; | |
150 | + $lastFile = exec($find); | |
151 | + if (file_exists($lastFile)) { | |
152 | + $cmd = 'date "+%Y-%m-%dT%H:%M:%SZ" -u -r '.$lastFile; // for NFS | |
153 | + $releaseDate = exec($cmd); | |
154 | + } | |
145 | 155 | |
146 | - // Modification date | |
147 | - $cmd = "/opt/tools/DDServer/bin/GetModificationDate ".$timesFile; | |
148 | - $output = array(); | |
149 | - exec($cmd, $output, $result_code); | |
150 | - if ($result_code == 0) | |
156 | + // Modification date | |
157 | + $cmd = "/opt/tools/DDServer/bin/GetModificationDate ".$timesFile; | |
158 | + $output = array(); | |
159 | + exec($cmd, $output, $result_code); | |
160 | + if ($result_code == 0) | |
151 | 161 | $modificationDate = $output[0]; |
152 | - if (!isset($releaseDate)) | |
162 | + if (!isset($releaseDate)) | |
153 | 163 | $releaseDate = $modificationDate; |
154 | 164 | |
155 | 165 | |
156 | - $result[] = array( | |
157 | - 'vi' => $viName, | |
166 | + $result = array( | |
167 | + 'success' => TRUE, | |
168 | + 'viName' => $viName, | |
158 | 169 | 'releaseDate' => $releaseDate, |
159 | 170 | 'modificationDate' => $modificationDate, |
160 | - ); | |
161 | - } | |
162 | - } | |
163 | - } | |
164 | - | |
165 | - return $result; | |
171 | + 'startStopDate' => $startStopDate | |
172 | + ); | |
173 | + } | |
174 | + } | |
175 | + | |
176 | + return $result; | |
166 | 177 | } |
167 | 178 | |
168 | 179 | /** | ... | ... |
src/DDSERVICES/SOAP/dd.wsdl.in
... | ... | @@ -47,17 +47,12 @@ |
47 | 47 | </tns:element> |
48 | 48 | </tns:sequence> |
49 | 49 | </tns:complexType> |
50 | - <tns:complexType name="ListOfDatasetModificationDate"> | |
50 | + <tns:complexType name="VIInfo"> | |
51 | 51 | <tns:sequence> |
52 | - <tns:element minOccurs="0" maxOccurs="unbounded" name="DatasetModificationDate"> | |
53 | - <tns:complexType> | |
54 | - <tns:sequence> | |
55 | - <tns:element minOccurs="1" maxOccurs="1" name="vi" type="xsd:string"/> | |
56 | - <tns:element minOccurs="1" maxOccurs="1" name="releaseDate" type="xsd:string"/> | |
57 | - <tns:element minOccurs="1" maxOccurs="1" name="modificationDate" type="xsd:string"/> | |
58 | - </tns:sequence> | |
59 | - </tns:complexType> | |
60 | - </tns:element> | |
52 | + <tns:element minOccurs="1" maxOccurs="1" name="vi" type="xsd:string"/> | |
53 | + <tns:element minOccurs="1" maxOccurs="1" name="releaseDate" type="xsd:string"/> | |
54 | + <tns:element minOccurs="1" maxOccurs="1" name="modificationDate" type="xsd:string"/> | |
55 | + <tns:element minOccurs="1" maxOccurs="1" name="startStopDate" type="xsd:string"/> | |
61 | 56 | </tns:sequence> |
62 | 57 | </tns:complexType> |
63 | 58 | </types> |
... | ... | @@ -187,10 +182,11 @@ |
187 | 182 | <message name='getDatasetsWithTimeRestrictionResponse'> |
188 | 183 | <part name='Result' type='tns:ListOfDatasetTimeRestrictionData'/> |
189 | 184 | </message> |
190 | -<message name='getDatasetsModificationDatesRequest'> | |
185 | +<message name='getVIInfoRequest'> | |
186 | + <part name='viId' type='xsd:string'/> | |
191 | 187 | </message> |
192 | -<message name='getDatasetsModificationDatesResponse'> | |
193 | - <part name='Result' type='tns:ListOfDatasetModificationDate'/> | |
188 | +<message name='getVIInfoResponse'> | |
189 | + <part name='Result' type='tns:VIInfo'/> | |
194 | 190 | </message> |
195 | 191 | |
196 | 192 | <portType name='AmdaPortType'> |
... | ... | @@ -274,9 +270,9 @@ |
274 | 270 | <input message='tns:getDatasetsWithTimeRestrictionRequest'/> |
275 | 271 | <output message='tns:getDatasetsWithTimeRestrictionResponse'/> |
276 | 272 | </operation> |
277 | - <operation name='getDatasetsModificationDates'> | |
278 | - <input message='tns:getDatasetsModificationDatesRequest'/> | |
279 | - <output message='tns:getDatasetsModificationDatesResponse'/> | |
273 | + <operation name='getVIInfo'> | |
274 | + <input message='tns:getVIInfoRequest'/> | |
275 | + <output message='tns:getVIInfoResponse'/> | |
280 | 276 | </operation> |
281 | 277 | |
282 | 278 | |
... | ... | @@ -505,8 +501,8 @@ |
505 | 501 | encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> |
506 | 502 | </output> |
507 | 503 | </operation> |
508 | - <operation name='getDatasetsModificationDates'> | |
509 | - <soap:operation soapAction='getDatasetsModificationDates'/> | |
504 | + <operation name='getVIInfo'> | |
505 | + <soap:operation soapAction='getVIInfo'/> | |
510 | 506 | <input> |
511 | 507 | <soap:body use='encoded' |
512 | 508 | encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> | ... | ... |