Commit 8b66e0876cb91338ea22a39a48fdd04c2bab3f2f

Authored by Nathanael Jourdane
1 parent 2e76fb04
Exists in master

Make readTable() private and use newVOTable() and appendVOTable() instead, to avoid confusions.

src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapConnection.java
@@ -123,8 +123,8 @@ public class EpnTapConnection implements EpnTapInterface { @@ -123,8 +123,8 @@ public class EpnTapConnection implements EpnTapInterface {
123 123
124 @Override 124 @Override
125 public List<Granule> sendADQLQuery(String tapURL, String adqlQuery) throws VOTableException { 125 public List<Granule> sendADQLQuery(String tapURL, String adqlQuery) throws VOTableException {
126 - VOTableController voTableCtrl = new VOTableController(tapURL, adqlQuery);  
127 - voTableCtrl.readTable(); 126 + VOTableController voTableCtrl = new VOTableController();
  127 + voTableCtrl.newVOTable(tapURL, adqlQuery);
128 VOTableData data = voTableCtrl.getVOTableData(); 128 VOTableData data = voTableCtrl.getVOTableData();
129 129
130 List<Granule> granules; 130 List<Granule> granules;
@@ -137,8 +137,8 @@ public class EpnTapConnection implements EpnTapInterface { @@ -137,8 +137,8 @@ public class EpnTapConnection implements EpnTapInterface {
137 public List<Granule> sendQuery(String tapURL, String schemaName, Query enumeratedQuery) 137 public List<Granule> sendQuery(String tapURL, String schemaName, Query enumeratedQuery)
138 throws VOTableException { 138 throws VOTableException {
139 String query = String.format(enumeratedQuery.toString(), schemaName); 139 String query = String.format(enumeratedQuery.toString(), schemaName);
140 - VOTableController voTableCtrl = new VOTableController(tapURL, query);  
141 - voTableCtrl.readTable(); 140 + VOTableController voTableCtrl = new VOTableController();
  141 + voTableCtrl.newVOTable(tapURL, query);
142 VOTableData data = voTableCtrl.getVOTableData(); 142 VOTableData data = voTableCtrl.getVOTableData();
143 Debug.writeObject("data", data); 143 Debug.writeObject("data", data);
144 144
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java
@@ -53,15 +53,6 @@ public abstract class EpnTapController { @@ -53,15 +53,6 @@ public abstract class EpnTapController {
53 53
54 54
55 /** 55 /**
56 - * Method constructor, which initialize servicesController, resultsController and mainView.  
57 - */  
58 - public EpnTapController() {  
59 - String query = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE,  
60 - ServiceCore.EPNCORE);  
61 - servicesCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL, query);  
62 - }  
63 -  
64 - /**  
65 * @return The request controller. 56 * @return The request controller.
66 */ 57 */
67 public RequestCtrl getRequestCtrl() { 58 public RequestCtrl getRequestCtrl() {
@@ -97,7 +88,9 @@ public abstract class EpnTapController { @@ -97,7 +88,9 @@ public abstract class EpnTapController {
97 public void readServices() throws VOTableException { 88 public void readServices() throws VOTableException {
98 // Here getServicesCtrl() is used instead of class field servicesCtrl to get the 89 // Here getServicesCtrl() is used instead of class field servicesCtrl to get the
99 // subclass field, since subclasses overrides getServicesCtrl(). 90 // subclass field, since subclasses overrides getServicesCtrl().
100 - getServicesCtrl().readTable(); 91 + String query = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_CORE,
  92 + ServiceCore.EPNCORE);
  93 + getServicesCtrl().newVOTable(Consts.DEFAULT_REGISTRY_URL, query);
101 } 94 }
102 95
103 /** 96 /**
@@ -114,7 +107,7 @@ public abstract class EpnTapController { @@ -114,7 +107,7 @@ public abstract class EpnTapController {
114 LOGGER.info("Sending query(ies) on " + StringJoiner.join(servicesUrls)); 107 LOGGER.info("Sending query(ies) on " + StringJoiner.join(servicesUrls));
115 for (int i = 0; i < servicesUrls.size(); i++) { 108 for (int i = 0; i < servicesUrls.size(); i++) {
116 String query = getRequestCtrl().getQuery(services.getTableNames().get(i)); 109 String query = getRequestCtrl().getQuery(services.getTableNames().get(i));
117 - getResultsCtrl().updateVOTable(servicesUrls.get(i), query); 110 + getResultsCtrl().appendVOTable(servicesUrls.get(i), query);
118 } 111 }
119 112
120 } 113 }
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java
@@ -80,9 +80,9 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis @@ -80,9 +80,9 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis
80 } 80 }
81 81
82 @Override 82 @Override
83 - public void updateVOTable(String newTargetURL, String newQuery) { 83 + public void appendVOTable(String newTargetURL, String newQuery) {
84 try { 84 try {
85 - super.updateVOTable(newTargetURL, newQuery); 85 + super.appendVOTable(newTargetURL, newQuery);
86 } catch (VOTableException e) { 86 } catch (VOTableException e) {
87 listener.displayError("Can not update the VOTable.", e); 87 listener.displayError("Can not update the VOTable.", e);
88 } 88 }
src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCtrl.java
@@ -151,8 +151,8 @@ public class ServiceCtrl { @@ -151,8 +151,8 @@ public class ServiceCtrl {
151 * @throws VOTableException Can not get the VOTable. 151 * @throws VOTableException Can not get the VOTable.
152 */ 152 */
153 public static VOTABLE getVoTable(String query) throws VOTableException { 153 public static VOTABLE getVoTable(String query) throws VOTableException {
154 - VOTableController voTableCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL, query);  
155 - voTableCtrl.readTable(); 154 + VOTableController voTableCtrl = new VOTableController();
  155 + voTableCtrl.newVOTable(Consts.DEFAULT_REGISTRY_URL, query);
156 return voTableCtrl.getVOTable(); 156 return voTableCtrl.getVOTable();
157 } 157 }
158 158