Commit 6415d90847425cde3bcedd046941b6ba9f268a72

Authored by Nathanael Jourdane
1 parent e1222bd6
Exists in master

Get all tap services with table_name.

src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java
... ... @@ -42,8 +42,11 @@ public class EpnTapController {
42 42 /** The controller of the VOTable displaying the query results. */
43 43 VOTableController resultsController;
44 44  
45   - /** The URL of the service selected by the user on the services list panel. */
46   - String selectedServiceURL;
  45 + /** The name of the table selected by the user on the table list panel. */
  46 + String selectedTableName;
  47 +
  48 + /** The URL of the service corresponding to the selected table. */
  49 + String selectedTableServiceURL;
47 50  
48 51 /**
49 52 * Method constructor
... ... @@ -59,7 +62,7 @@ public class EpnTapController {
59 62 VOTableView serviceView = servicesController.getView();
60 63 VOTableView resultsView = resultsController.getView();
61 64 view = new EpnTapMainView(this, serviceView, resultsView);
62   - setSelectedService(0);
  65 + updateSelected(0);
63 66 }
64 67  
65 68 /**
... ... @@ -86,20 +89,27 @@ public class EpnTapController {
86 89 /**
87 90 * @param row The row selected by the user on the Jtable.
88 91 */
89   - public void setSelectedService(int row) {
90   - String serviceURL = (String) view.getServices().getValueAt(1, row);
91   - if (!serviceURL.equals(selectedServiceURL)) {
92   - selectedServiceURL = serviceURL;
93   - logger.info("Selected service URL: " + selectedServiceURL);
  92 + public void updateSelected(int row) {
  93 + String serviceURL = (String) view.getServicesView().getValueAt(5, row);
  94 + String tableName = (String) view.getServicesView().getValueAt(2, row);
  95 + if (!tableName.equals(selectedTableName)) {
  96 + selectedTableServiceURL = serviceURL;
  97 + selectedTableName = tableName;
  98 + logger.info("Selected table: " + selectedTableName + " - service: "
  99 + + selectedTableServiceURL);
94 100 }
95 101 }
96 102  
  103 + public String getSelectedTable() {
  104 + return selectedTableName;
  105 + }
  106 +
97 107 /**
98 108 * @param query The query to send to the selected service.
99 109 * @throws VOTableException Can not fill the Table
100 110 */
101 111 public void sendQuery(String query) throws VOTableException {
102   - logger.info("Sending query: " + query + " on " + selectedServiceURL);
103   - resultsController.fillTable(selectedServiceURL, "ADQL", query);
  112 + logger.info("Sending query: " + query + " on " + selectedTableServiceURL);
  113 + resultsController.fillTable(selectedTableServiceURL, "ADQL", query);
104 114 }
105 115 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Const.java
... ... @@ -28,8 +28,12 @@ public class Const {
28 28 /** The temporary directory path. */
29 29 public static final String TMP_DIR = System.getProperty("java.io.tmpdir");
30 30  
31   - /** The URL of the registry used by default. */
  31 + /** The URL of the registry used by default to get the services. */
32 32 public static final String DEFAULT_REGISTRY_URL = "http://dc.zah.uni-heidelberg.de/tap";
  33 + // http://reg.g-vo.org/tap
  34 + // http://dc.zah.uni-heidelberg.de/tap
  35 + // http://gavo.aip.de/tap
  36 + // http://voparis-cdpp.obspm.fr/tap
33 37  
34 38 /** Constructor to hide the implicit public one. */
35 39 private Const() {
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Queries.java
... ... @@ -22,32 +22,19 @@ package eu.omp.irap.vespa.epntapclient.utils;
22 22 public final class Queries {
23 23  
24 24 /** Query to get all EPN-TAP services. */
25   - public static final String GET_EPN_TAP_SERVICES = "SELECT short_name, access_url FROM "
26   - + "rr.resource "
27   - + "NATURAL JOIN rr.interface "
28   - + "NATURAL JOIN rr.res_detail "
29   - + "NATURAL JOIN rr.capability "
  25 + public static final String GET_EPN_TAP_SERVICES = "SELECT short_name, res_title AS schema_title, table_name, schema_name, ivoid, access_url "
  26 + + "FROM rr.resource NATURAL JOIN rr.res_schema NATURAL JOIN rr.res_table NATURAL JOIN rr.interface NATURAL JOIN rr.res_detail NATURAL JOIN rr.capability "
30 27 + "WHERE standard_id='ivo://ivoa.net/std/tap' AND "
31 28 + "intf_type='vs:paramhttp' AND "
32 29 + "detail_xpath='/capability/dataModel/@ivo-id' AND "
33   - + "1=ivo_nocasematch(detail_value, 'ivo://vopdc.obspm/std/EpnCore%')";
34   -
35   - /** Query to get all services of the registry. */
36   - public static final String GET_ALL_SERVICES = "SELECT ivoid, short_name, res_title, res_description, accessurl, ntable "
37   - + "FROM (SELECT ivoid, accessurl, COUNT ( ivoid ) AS ntable FROM glots.services "
38   - + "JOIN glots.tables USING ( ivoid ) GROUP BY ivoid) AS t "
39   - + "JOIN rr.resource USING ( ivoid )";
40   -
41   - // TODO: Get the services names to display them in the GUI more user-friendly.
42   - /** Minimal query to get TAP all services of the registry, using GloTS. */
43   - public static final String GET_TAP_SERVICES = "SELECT ivoid, accessurl FROM glots.services";
44   -
  30 + + "1=ivo_nocasematch(detail_value, 'ivo://vopdc.obspm/std/EpnCore%') "
  31 + + "ORDER BY short_name, table_name";
45 32 /**
46 33 * The default query, with these parameters, respectively: max_rows, target_name, time_min,
47 34 * time_max, dataproduct_type, spectral_range_min, spectral_range_max.
48 35 */
49   - public static final String SAMPLE_AMDA_QUERY = "SELECT TOP %s index, target_name, target_class "
50   - + "FROM amdadb.epn_core WHERE target_name LIKE '%%%s%%'";
  36 + public static final String SAMPLE_AMDA_QUERY = "SELECT TOP %d index, target_name, target_class "
  37 + + "FROM %s WHERE target_name LIKE '%%%s%%'";
51 38 // + "WHERE target_name = '%s' AND time_min=%f AND time_max=%f AND dataproduct_type='%s' AND "
52 39 // + "spectral_range_min=%f AND spectral_range_max=%f";
53 40  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java
... ... @@ -53,7 +53,7 @@ public class EpnTapMainView extends JPanel {
53 53 private EpnTapController controller;
54 54  
55 55 /** The width of the left panel (services view). */
56   - static final int LEFT_PANEL_WIDTH = 300;
  56 + static final int LEFT_PANEL_WIDTH = 400;
57 57 /** The minimum width of the left panel (services view). */
58 58 static final int LEFT_PANEL_MIN_WIDTH = 100;
59 59 /** The width of the right panel (request view). */
... ... @@ -89,7 +89,7 @@ public class EpnTapMainView extends JPanel {
89 89  
90 90 // TODO: Support multi-selection
91 91 servicesView.getTable().getSelectionModel().addListSelectionListener(
92   - e -> controller.setSelectedService(servicesView.getTable().getSelectedRow()));
  92 + e -> controller.updateSelected(servicesView.getTable().getSelectedRow()));
93 93 }
94 94  
95 95 /**
... ... @@ -102,14 +102,14 @@ public class EpnTapMainView extends JPanel {
102 102 /**
103 103 * @return The JPanel where the VOTable results is displayed.
104 104 */
105   - public VOTableView getResults() {
  105 + public VOTableView getResultsView() {
106 106 return resultsView;
107 107 }
108 108  
109 109 /**
110 110 * @return The JPanel where the list of services is displayed.
111 111 */
112   - public VOTableView getServices() {
  112 + public VOTableView getServicesView() {
113 113 return servicesView;
114 114 }
115 115  
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/view/RequestView.java
... ... @@ -191,18 +191,18 @@ public class RequestView extends JPanel implements ActionListener {
191 191 }
192 192  
193 193 /**
194   - * @param max_rows
195   - * @param target_name
196   - * @param time_min
197   - * @param time_max
198   - * @param dataproduct_type
199   - * @param spectral_range_min
200   - * @param spectral_range_max
  194 + * @param maxRows
  195 + * @param targetName
  196 + * @param timeMin
  197 + * @param timeMax
  198 + * @param dataproductType
  199 + * @param spectralRangeMin
  200 + * @param spectralRangeMax
201 201 */
202   - private void updateQueryArea(int max_rows, String target_name, float time_min, float time_max,
203   - String dataproduct_type, float spectral_range_min, float spectral_range_max) {
204   - queryArea.setText(
205   - String.format(Queries.SAMPLE_AMDA_QUERY, max_rows, target_name));
  202 + private void updateQueryArea(int maxRows, String targetName, float timeMin, float timeMax,
  203 + String dataproductType, float spectralRangeMin, float spectralRangeMax) {
  204 + String tableName = mainView.getController().getSelectedTable();
  205 + queryArea.setText(String.format(Queries.SAMPLE_AMDA_QUERY, maxRows, tableName, targetName));
206 206 // queryArea.setText(String.format(Queries.SAMPLE_AMDA_QUERY, max_rows, target_name,
207 207 // time_min,
208 208 // time_max, dataproduct_type, spectral_range_min, spectral_range_max));
... ...