Commit 18446806b6af93b2d6ef30147e684ea3fd90bb73
1 parent
27fa4198
Exists in
master
add custom EPN TAP service gui interface and TAP and OBSCOR_TAP queries
Showing
4 changed files
with
103 additions
and
4 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/controller/EpnTapController.java
... | ... | @@ -70,7 +70,7 @@ public class EpnTapController implements MainViewListener { |
70 | 70 | |
71 | 71 | mainView = new EpnTapMainView(servicesController.getView(), resultsController.getView()); |
72 | 72 | mainView.addMainViewListener(this); |
73 | - updateSelected(0); | |
73 | +// updateSelected(0); | |
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
... | ... | @@ -102,6 +102,14 @@ public class EpnTapController implements MainViewListener { |
102 | 102 | public void updateSelected(int row) { |
103 | 103 | String serviceURL = mainView.getServicesPanel().getServiceURL(row); |
104 | 104 | String tableName = mainView.getServicesPanel().getTableName(row); |
105 | + serviceSelected(serviceURL, tableName); | |
106 | + } | |
107 | + | |
108 | + /** | |
109 | + * @param serviceURL | |
110 | + * @param tableName | |
111 | + */ | |
112 | + public void serviceSelected(String serviceURL, String tableName) { | |
105 | 113 | if (!tableName.equals(selectedTableName)) { |
106 | 114 | selectedTableServiceURL = serviceURL; |
107 | 115 | selectedTableName = tableName; | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/utils/Queries.java
... | ... | @@ -42,7 +42,27 @@ public final class Queries { |
42 | 42 | + "detail_xpath='/capability/dataModel/@ivo-id' AND " |
43 | 43 | + "1=ivo_nocasematch(detail_value, 'ivo://vopdc.obspm/std/EpnCore%') " |
44 | 44 | + "ORDER BY short_name, table_name"; |
45 | + | |
46 | + /** Query to get all EPN-TAP services. */ | |
47 | + public static final String GET_TAP_OBSCOR_SERVICES = "SELECT short_name, " | |
48 | + + "res_title AS schema_title, table_name, schema_name, ivoid, access_url " | |
49 | + + "FROM rr.resource NATURAL JOIN rr.res_schema NATURAL JOIN rr.res_table " | |
50 | + + "NATURAL JOIN rr.interface NATURAL JOIN rr.res_detail NATURAL JOIN rr.capability " | |
51 | + + "WHERE standard_id='ivo://ivoa.net/std/tap' AND " | |
52 | + + "intf_type='vs:paramhttp' AND " | |
53 | + + "detail_xpath='/capability/dataModel/@ivo-id' AND " | |
54 | + + "1=ivo_nocasematch(detail_value, 'ivo://ivoa.net/std/ObsCore%') " | |
55 | + + "ORDER BY short_name, table_name"; | |
45 | 56 | |
57 | + /** Query to get all EPN-TAP services. */ | |
58 | + public static final String GET_TAP_SERVICES = "SELECT short_name, " | |
59 | + + "res_title AS schema_title, table_name, schema_name, ivoid, access_url " | |
60 | + + "FROM rr.resource NATURAL JOIN rr.res_schema NATURAL JOIN rr.res_table " | |
61 | + + "NATURAL JOIN rr.interface NATURAL JOIN rr.res_detail NATURAL JOIN rr.capability " | |
62 | + + "WHERE standard_id='ivo://ivoa.net/std/tap' AND " | |
63 | + + "intf_type='vs:paramhttp' AND " | |
64 | + + "detail_xpath='/capability/dataModel/@ivo-id' " | |
65 | + + "ORDER BY short_name, table_name"; | |
46 | 66 | |
47 | 67 | /** Constructor to hide the implicit public one. */ |
48 | 68 | private Queries() { | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java
... | ... | @@ -18,8 +18,15 @@ package eu.omp.irap.vespa.epntapclient.view.panels; |
18 | 18 | |
19 | 19 | import java.awt.BorderLayout; |
20 | 20 | import java.awt.Dimension; |
21 | +import java.awt.event.ActionEvent; | |
22 | +import java.awt.event.ActionListener; | |
23 | +import java.util.logging.Logger; | |
21 | 24 | |
25 | +import javax.swing.BorderFactory; | |
26 | +import javax.swing.JButton; | |
27 | +import javax.swing.JLabel; | |
22 | 28 | import javax.swing.JPanel; |
29 | +import javax.swing.JTextField; | |
23 | 30 | import javax.swing.event.ListSelectionEvent; |
24 | 31 | import javax.swing.event.ListSelectionListener; |
25 | 32 | |
... | ... | @@ -40,6 +47,14 @@ public class ServicesPanel extends JPanel { |
40 | 47 | private VOTableView voTableView; |
41 | 48 | |
42 | 49 | |
50 | + private JButton serviceButton; | |
51 | + | |
52 | + private JTextField serviceUrlTextField; | |
53 | + | |
54 | + private JTextField tableNameTextField; | |
55 | + | |
56 | + private EpnTapMainView mainView; | |
57 | + | |
43 | 58 | /** |
44 | 59 | * Method constructor which customize the services panel, but don't build it from scratch since |
45 | 60 | * VOTableView is already created by ServicesController. Add also the JTable listener. |
... | ... | @@ -49,10 +64,20 @@ public class ServicesPanel extends JPanel { |
49 | 64 | */ |
50 | 65 | public ServicesPanel(final EpnTapMainView mainView, final VOTableView voTableView) { |
51 | 66 | super(); |
67 | + this.mainView = mainView; | |
52 | 68 | this.voTableView = voTableView; |
53 | 69 | setLayout(new BorderLayout()); |
54 | - this.add(voTableView); | |
55 | - | |
70 | + this.add(voTableView, BorderLayout.NORTH); | |
71 | + | |
72 | + JPanel testServicePenel = new JPanel(); | |
73 | + testServicePenel.setBorder(BorderFactory.createTitledBorder("Test service")); | |
74 | + JPanel panelTemp = new JPanel(); | |
75 | + panelTemp.add(new JLabel("Service URL")); | |
76 | + panelTemp.add(getServiceUrlTextField()); | |
77 | + panelTemp.add(new JLabel("Table name")); | |
78 | + panelTemp.add(getTableNameTextField()); | |
79 | + panelTemp.add(getServiceButton()); | |
80 | + this.add(panelTemp, BorderLayout.CENTER); | |
56 | 81 | setPreferredSize(new Dimension(GUIDim.LEFT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); |
57 | 82 | setMinimumSize(new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); |
58 | 83 | |
... | ... | @@ -69,10 +94,53 @@ public class ServicesPanel extends JPanel { |
69 | 94 | } |
70 | 95 | |
71 | 96 | /** |
97 | + * | |
98 | + */ | |
99 | + private JTextField getTableNameTextField() { | |
100 | + if (tableNameTextField == null) { | |
101 | + tableNameTextField = new JTextField(20); | |
102 | + } | |
103 | + return tableNameTextField ; | |
104 | + } | |
105 | + | |
106 | + /** | |
107 | + * | |
108 | + */ | |
109 | + private JTextField getServiceUrlTextField() { | |
110 | + if (serviceUrlTextField == null) { | |
111 | + serviceUrlTextField = new JTextField(20); | |
112 | + } | |
113 | + return serviceUrlTextField; | |
114 | + } | |
115 | + | |
116 | + /** | |
117 | + * @return | |
118 | + */ | |
119 | + private JButton getServiceButton() { | |
120 | + if (serviceButton == null) { | |
121 | + serviceButton = new JButton("Set service"); | |
122 | + | |
123 | + serviceButton.addActionListener(new ActionListener() { | |
124 | + | |
125 | + @Override | |
126 | + public void actionPerformed(ActionEvent e) { | |
127 | + mainView.event(Event.SERVICE_SELECTED, | |
128 | + -1); | |
129 | + | |
130 | + } | |
131 | + }); | |
132 | + } | |
133 | + return serviceButton; | |
134 | + } | |
135 | + | |
136 | + /** | |
72 | 137 | * @param row The row index in the JTable element. |
73 | 138 | * @return The URL of the service corresponding to the row. |
74 | 139 | */ |
75 | 140 | public String getServiceURL(int row) { |
141 | + if (row == -1){ | |
142 | + return serviceUrlTextField.getText(); | |
143 | + } | |
76 | 144 | return (String) voTableView.getValueAt(5, row); |
77 | 145 | } |
78 | 146 | |
... | ... | @@ -81,6 +149,9 @@ public class ServicesPanel extends JPanel { |
81 | 149 | * @return The table name of the service corresponding to the row. |
82 | 150 | */ |
83 | 151 | public String getTableName(int row) { |
152 | + if (row == -1){ | |
153 | + return tableNameTextField.getText(); | |
154 | + } | |
84 | 155 | return (String) voTableView.getValueAt(2, row); |
85 | 156 | } |
86 | 157 | } | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/controller/VOTableConnection.java
... | ... | @@ -70,7 +70,7 @@ public final class VOTableConnection { |
70 | 70 | String voTablePath = Const.TMP_DIR + "/votable" + ft.format(new Date()) + ".xml"; |
71 | 71 | |
72 | 72 | String uri = targetURL + "/sync"; |
73 | - String parameters = "REQUEST=doQuery&LANG=" + queryLanguage + "&QUERY="; | |
73 | + String parameters = "REQUEST=doQuery&LANG=" + queryLanguage + "&FORMAT=votable&QUERY="; | |
74 | 74 | try { |
75 | 75 | parameters += URLEncoder.encode(query, Const.ENCODING).replace("+", "%20") |
76 | 76 | .replace(".", "%2E").replace("-", "%2D").replace("*", "%2A") | ... | ... |