Commit 3df5647afed90b47125a0735010a0937366627ca

Authored by Myriam Bouchemit
2 parents f54b897c 4650dac5

Merge branch 'bugfix-registry-request' into 'master'

Bugfix registry request

fix problems with epntap module

See merge request !28
js/app/views/EpnTapUI.js
... ... @@ -133,7 +133,7 @@ Ext.create('Ext.data.Store', {
133 133 // beforeload: function(s, operation) { console.log(operation); },
134 134 load: function (store, records, successful) {
135 135 if (!successful) {
136   - Ext.Msg.alert('Error', 'Can not get epntap services from registries.')
  136 + store.errorMessage = 'Can not get epntap services from registries.'
137 137 }
138 138 }
139 139 }
... ... @@ -424,7 +424,15 @@ Ext.define('amdaUI.EpnTapUI', {
424 424 this.createServiceFilterPanel(),
425 425 this.createGridsPanel()
426 426 ]
427   - }]
  427 + }],
  428 + listeners: {
  429 + render: function () {
  430 + var service = Ext.data.StoreManager.lookup('servicesStore')
  431 + if (service.errorMessage) {
  432 + Ext.Msg.alert('Error', service.errorMessage)
  433 + }
  434 + }
  435 + }
428 436 }
429 437 Ext.apply(this, Ext.apply(arguments, myConf))
430 438 },
... ...
php/classes/VOTableMgr.php
... ... @@ -32,6 +32,7 @@ class VOTableMgr {
32 32 {
33 33 $this->is_little_endian = array_values(unpack('L1L', pack('V', 1)))[0] == 1;
34 34  
  35 + libxml_set_streams_context(stream_context_create([ 'http' => [ 'method' => 'GET', 'timeout' => '5' ]]));
35 36 // BRE - Add proxy host if exists
36 37 $context = ProxyUtils::getStreamContextWithProxy();
37 38 if (isset($context)) {
... ... @@ -464,7 +465,6 @@ class VOTableMgr {
464 465 }
465 466 $data = Array();
466 467 $fields = $this->xp->query($this->queryFields());
467   - $resource = $this->xp->query($this->queryResource());
468 468 $nb_columns = $fields->length;
469 469 $row = Array();
470 470 $n_value = 0; // index of current value
... ...
php/epntap.php
... ... @@ -87,7 +87,14 @@ function request($access_url, $query) {
87 87  
88 88 /* Return the list of available services by querying some usual registries. */
89 89 function getServices() {
90   - $registriesURL = ["http://registry.euro-vo.org/regtap/tap", "http://dc.zah.uni-heidelberg.de/tap", "http://gavo.aip.de/tap", "http://reg.g-vo.org/tap"];
  90 + $registriesURL = [
  91 + "http://vao.stsci.edu/RegTAP/TapService.aspx",
  92 + "http://voparis-rr.obspm.fr/tap",
  93 + "http://registry.euro-vo.org/regtap/tap",
  94 + "http://dc.zah.uni-heidelberg.de/tap",
  95 + "http://gavo.aip.de/tap",
  96 + "http://reg.g-vo.org/tap",
  97 + ];
91 98 $columns = ['short_name', 'res_title', 'ivoid', 'access_url', 'table_name', 'content_type', 'creator_seq', 'content_level', 'reference_url', 'created', 'updated'];
92 99 $query = "SELECT DISTINCT " . implode(', ', $columns) . " FROM rr.resource
93 100 NATURAL JOIN rr.res_schema NATURAL JOIN rr.res_table NATURAL JOIN rr.interface NATURAL JOIN rr.res_detail NATURAL JOIN rr.capability
... ... @@ -96,8 +103,8 @@ function getServices() {
96 103  
97 104 $regNumber = 0;
98 105 $r = [];
99   - $lastErrorMessage = null;
100   - for(; $regNumber<count($registriesURL) ; $regNumber++) {
  106 + $lastErrorMessage = '';
  107 + for(; $regNumber < count($registriesURL) ; $regNumber++) {
101 108 $r = request($registriesURL[$regNumber], $query);
102 109 if($r['success']) {
103 110 // Add several other parameters and remove AMDA
... ... @@ -115,12 +122,13 @@ function getServices() {
115 122 }
116 123 break;
117 124 } else {
118   - $lastErrorMesage = 'Last tried registry (' . $registriesURL[$regNumber] . ') returned this error: ' . $r['msg'] . '.';
  125 + $lastErrorMesage = 'Error while requesting registry ' . $registriesURL[$regNumber] . ': ' . $r['msg'] . '.';
  126 + error_log($lastErrorMesage);
119 127 }
120 128 }
121 129  
122 130 if(!$r['success']) {
123   - $r['msg'] = 'Can not access any of these registries: ' . implode(', ', $registriesURL) . ', last error message is ' . $lastErrorMessage;
  131 + $r['msg'] = 'Can not access registry: ' . $lastErrorMessage;
124 132 }
125 133 return $r;
126 134 }
... ...