Commit 45fb45834d8620a93826aa3d7b5df2f83232ae14

Authored by Nathanael Jourdane
1 parent 285505be
Exists in master

Sort methods and fields in each class.

Showing 27 changed files with 972 additions and 971 deletions   Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapConnection.java
... ... @@ -44,28 +44,13 @@ public class EpnTapConnection implements EpnTapInterface {
44 44 // *** Resource ***
45 45  
46 46 @Override
47   - public Resource getEPNVOresource(String ivoid) throws VOResourceException {
48   - return VOResourceCtrl.getVOresource(ivoid);
  47 + public String getEPNCoreTableName(String ivoid) throws VOTableException {
  48 + return (String) ServiceCtrl.getParameter(ivoid, "table_name");
49 49 }
50 50  
51 51 // *** Resources ***
52 52  
53 53 @Override
54   - public List<Resource> getEPNVOResources() throws VOResourceException {
55   - List<String> ivoids = VOResourceCtrl.getIvoidResources(ServiceCore.EPNCORE);
56   - return VOResourceCtrl.getVOResources(ivoids);
57   - }
58   -
59   - @Override
60   - public List<Resource> getEPNVOResources(List<String> keywords)
61   - throws VOResourceException {
62   - List<String> ivoids = VOResourceCtrl.getVOResources(ServiceCore.EPNCORE, keywords);
63   - return VOResourceCtrl.getVOResources(ivoids);
64   - }
65   -
66   - // *** Service ***
67   -
68   - @Override
69 54 public VOTABLE getEPNService(String ivoid) throws VOTableException {
70 55 String query = String.format(Queries.SELECT_ALL_TAP_SERVICES_WHERE_IVOID, ivoid);
71 56 return ServiceCtrl.getVoTable(query);
... ... @@ -79,7 +64,7 @@ public class EpnTapConnection implements EpnTapInterface {
79 64 return ServiceCtrl.getVoTable(query);
80 65 }
81 66  
82   - // *** Services ***
  67 + // *** Service ***
83 68  
84 69 @Override
85 70 public VOTABLE getEPNServices() throws VOTableException {
... ... @@ -95,6 +80,8 @@ public class EpnTapConnection implements EpnTapInterface {
95 80 return ServiceCtrl.getVoTable(query);
96 81 }
97 82  
  83 + // *** Services ***
  84 +
98 85 @Override
99 86 public VOTABLE getEPNServices(List<String> keywords, List<String> attributes)
100 87 throws VOTableException {
... ... @@ -109,11 +96,24 @@ public class EpnTapConnection implements EpnTapInterface {
109 96 return ServiceCtrl.getVoTable(query);
110 97 }
111 98  
  99 + @Override
  100 + public Resource getEPNVOresource(String ivoid) throws VOResourceException {
  101 + return VOResourceCtrl.getVOresource(ivoid);
  102 + }
  103 +
  104 + @Override
  105 + public List<Resource> getEPNVOResources() throws VOResourceException {
  106 + List<String> ivoids = VOResourceCtrl.getIvoidResources(ServiceCore.EPNCORE);
  107 + return VOResourceCtrl.getVOResources(ivoids);
  108 + }
  109 +
112 110 // *** Getters ***
113 111  
114 112 @Override
115   - public String getEPNCoreTableName(String ivoid) throws VOTableException {
116   - return (String) ServiceCtrl.getParameter(ivoid, "table_name");
  113 + public List<Resource> getEPNVOResources(List<String> keywords)
  114 + throws VOResourceException {
  115 + List<String> ivoids = VOResourceCtrl.getVOResources(ServiceCore.EPNCORE, keywords);
  116 + return VOResourceCtrl.getVOResources(ivoids);
117 117 }
118 118  
119 119 @Override
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapController.java
... ... @@ -37,12 +37,6 @@ public abstract class EpnTapController {
37 37 /** The logger for the class EpnTapController. */
38 38 private static final Logger LOGGER = Logger.getLogger(EpnTapController.class.getName());
39 39  
40   - /**
41   - * The path of the VOTable to parse. Will be affected to a temporary folder if not assigned
42   - * through the controller.
43   - */
44   - private String voTablePath;
45   -
46 40 /** The request controller, to manage requests. */
47 41 private RequestCtrl requestCtrl;
48 42  
... ... @@ -52,6 +46,12 @@ public abstract class EpnTapController {
52 46 /** The controller of the VOTable displaying the list of services. */
53 47 private VOTableController servicesCtrl;
54 48  
  49 + /**
  50 + * The path of the VOTable to parse. Will be affected to a temporary folder if not assigned
  51 + * through the controller.
  52 + */
  53 + private String voTablePath;
  54 +
55 55  
56 56 /**
57 57 * Method constructor, which initialize servicesController, resultsController and mainView.
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapInterface.java
... ... @@ -33,42 +33,17 @@ public interface EpnTapInterface {
33 33 // *** Resource ***
34 34  
35 35 /**
36   - * Returns the VOResource element of the service identified by the ivoID.
  36 + * Returns the name of the EPNCore Table related to a service.
37 37 *
38   - * @param ivoid the ivoid of the service.
39   - * @return The Resource of a service corresponding to the ivoid
40   - * @throws VOResourceException Can not get the VOResource.
  38 + * @param ivoid The ivoid of the service.
  39 + * @return The table name of the service, used usually in the 'FROM' keyword in a ADQL query.
  40 + * @throws VOTableException Can not get the VOTable.
41 41 */
42   - public Resource getEPNVOresource(String ivoid) throws VOResourceException;
  42 + public String getEPNCoreTableName(String ivoid) throws VOTableException;
43 43  
44 44 // *** Resources ***
45 45  
46 46 /**
47   - * Returns a set of VOResource elements (one per EPN-TAP service).
48   - *
49   - * @return A list containing the VOResources of all EpnTap services.
50   - * @throws VOResourceException Can not get the VOResource.
51   - */
52   - public List<Resource> getEPNVOResources() throws VOResourceException;
53   -
54   - /**
55   - * Returns a set of VOREsource elements (one per EPN-TAP service corresponding to the keywords).
56   - * The way keywords are defined is still to be defined.
57   - *
58   - * @param keywords A list of keywords, which are the content of the *subject* JSON node in the
59   - * query.
60   - * @see <a href=
61   - * "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources/search?keywords=standardid:%22ivo://ivoa.net/std/TAP%22%20subjects:%22Spectroscopy%22&max=100">
62   - * this example request</a>
63   - * @return A list containing the selected VOResources.
64   - * @throws VOResourceException Can not get the VOResource.
65   - */
66   - public List<Resource> getEPNVOResources(List<String> keywords)
67   - throws VOResourceException;
68   -
69   - // *** Service ***
70   -
71   - /**
72 47 * Returns a VOTable containing the attributes of the corresponding service (from a predefined
73 48 * list).
74 49 *
... ... @@ -91,7 +66,7 @@ public interface EpnTapInterface {
91 66 public VOTABLE getEPNService(String ivoid, List<String> attributes)
92 67 throws VOTableException;
93 68  
94   - // *** Services ***
  69 + // *** Service ***
95 70  
96 71 /**
97 72 * Returns a VOTable containing the list of EPN-TAP services and their attributes (from a
... ... @@ -112,6 +87,8 @@ public interface EpnTapInterface {
112 87 */
113 88 public VOTABLE getEPNServices(List<String> attributes) throws VOTableException;
114 89  
  90 + // *** Services ***
  91 +
115 92 /**
116 93 * Returns a VOTable containing the list of EPN-TAP services corresponding to the keywords and
117 94 * their attributes (from the list of attributes).
... ... @@ -125,16 +102,39 @@ public interface EpnTapInterface {
125 102 public VOTABLE getEPNServices(List<String> keywords, List<String> attributes)
126 103 throws VOTableException;
127 104  
  105 + /**
  106 + * Returns the VOResource element of the service identified by the ivoID.
  107 + *
  108 + * @param ivoid the ivoid of the service.
  109 + * @return The Resource of a service corresponding to the ivoid
  110 + * @throws VOResourceException Can not get the VOResource.
  111 + */
  112 + public Resource getEPNVOresource(String ivoid) throws VOResourceException;
  113 +
  114 + /**
  115 + * Returns a set of VOResource elements (one per EPN-TAP service).
  116 + *
  117 + * @return A list containing the VOResources of all EpnTap services.
  118 + * @throws VOResourceException Can not get the VOResource.
  119 + */
  120 + public List<Resource> getEPNVOResources() throws VOResourceException;
  121 +
128 122 // *** Getters ***
129 123  
130 124 /**
131   - * Returns the name of the EPNCore Table related to a service.
  125 + * Returns a set of VOREsource elements (one per EPN-TAP service corresponding to the keywords).
  126 + * The way keywords are defined is still to be defined.
132 127 *
133   - * @param ivoid The ivoid of the service.
134   - * @return The table name of the service, used usually in the 'FROM' keyword in a ADQL query.
135   - * @throws VOTableException Can not get the VOTable.
  128 + * @param keywords A list of keywords, which are the content of the *subject* JSON node in the
  129 + * query.
  130 + * @see <a href=
  131 + * "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources/search?keywords=standardid:%22ivo://ivoa.net/std/TAP%22%20subjects:%22Spectroscopy%22&max=100">
  132 + * this example request</a>
  133 + * @return A list containing the selected VOResources.
  134 + * @throws VOResourceException Can not get the VOResource.
136 135 */
137   - public String getEPNCoreTableName(String ivoid) throws VOTableException;
  136 + public List<Resource> getEPNVOResources(List<String> keywords)
  137 + throws VOResourceException;
138 138  
139 139 /**
140 140 * Returns the Access URL of an EPN-TAP Service.
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/granule/GranuleCtrl.java
... ... @@ -32,15 +32,15 @@ import eu.omp.irap.vespa.votable.votabledata.VOTableData;
32 32 */
33 33 public class GranuleCtrl {
34 34  
  35 + /** The error message when the specified row is not found. */
  36 + private static final String ERROR_MSG = "%s not found in the rowId %s: return %s.";
  37 +
35 38 /** The logger for the class GranuleCtrl. */
36 39 private static final Logger LOGGER = Logger.getLogger(GranuleCtrl.class.getName());
37 40  
38 41 /** The data to parse */
39 42 private VOTableData data;
40 43  
41   - /** The error message when the specified row is not found. */
42   - private static final String ERROR_MSG = "%s not found in the rowId %s: return %s.";
43   -
44 44  
45 45 /**
46 46 * Constructor of GranuleCtrl
... ... @@ -52,79 +52,6 @@ public class GranuleCtrl {
52 52 }
53 53  
54 54 /**
55   - * Parse a String value in the VOTable data at the specified row and column.
56   - *
57   - * @param rowId The row identifier
58   - * @param granule The Granule enumeration, representing the column name.
59   - * @return The value as String.
60   - * @throws CanNotParseDataException The column name was not found in the list.
61   - */
62   - private String parseString(int rowId, GranuleEnum granule) throws CanNotParseDataException {
63   - String res = "";
64   - try {
65   - res = (String) data.getCell(rowId, granule.toString());
66   - } catch (IllegalArgumentException e) {
67   - LOGGER.log(Level.WARNING, String.format(ERROR_MSG, granule, rowId, "empty string"), e);
68   - }
69   - return res;
70   - }
71   -
72   - /**
73   - * Parse a Date value in the VOTable data at the specified row and column.
74   - *
75   - * @param rowId The row identifier
76   - * @param granule The Granule enumeration, representing the column name.
77   - * @return The value as Date.
78   - * @throws ParseException The date format is not correct.
79   - * @throws CanNotParseDataException The column name was not found in the list.
80   - */
81   - private Date parseDate(int rowId, GranuleEnum granule)
82   - throws ParseException, CanNotParseDataException {
83   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
84   - Date date = new Date();
85   - try {
86   - date = sdf.parse((String) data.getCell(rowId, granule.toString()));
87   - } catch (IllegalArgumentException e) {
88   - LOGGER.log(Level.WARNING, String.format(ERROR_MSG, granule, rowId, "empty date"), e);
89   - }
90   -
91   - return date;
92   - }
93   -
94   - /**
95   - * Parse a Double value in the VOTable data at the specified row and column.
96   - *
97   - * @param rowId The row identifier
98   - * @param granule The Granule enumeration, representing the column name.
99   - * @return The value as Double.
100   - * @throws CanNotParseDataException The column name was not found in the list.
101   - */
102   - private Double parseDouble(int rowId, GranuleEnum granule) throws CanNotParseDataException {
103   - Double d = null;
104   - Object lObj = data.getCell(rowId, granule.toString());
105   - if (lObj instanceof Double) {
106   - d = (Double) lObj;
107   - }
108   - if (lObj instanceof Float) {
109   - d = new Double((Float) lObj);
110   - }
111   -
112   - return d == null ? Double.NaN : d;
113   - }
114   -
115   - /**
116   - * Parse a Double value in the VOTable data at the specified row and column.
117   - *
118   - * @param rowId The row identifier
119   - * @param granule The Granule enumeration, representing the column name.
120   - * @return The value as Double.
121   - * @throws CanNotParseDataException The column name was not found in the list.
122   - */
123   - private Integer parseInteger(int rowId, GranuleEnum granule) throws CanNotParseDataException {
124   - return (Integer) data.getCell(rowId, granule.toString());
125   - }
126   -
127   - /**
128 55 * Get a Granule object from a VOTable data row.
129 56 *
130 57 * @param rowId the row identified
... ... @@ -190,13 +117,6 @@ public class GranuleCtrl {
190 117 }
191 118  
192 119 /**
193   - * @return true if the VOTable data implements the EpnCoreV2.
194   - */
195   - public boolean isV2() {
196   - return !data.isContainingColumnName("index");
197   - }
198   -
199   - /**
200 120 * @return A list of Granules from a VOTable, where each Granule is a row of the VOTable data.
201 121 * @throws ParseException If the granule can not be parsed.
202 122 * @throws CanNotParseDataException The column name was not found in the list.
... ... @@ -216,4 +136,84 @@ public class GranuleCtrl {
216 136 return granules;
217 137 }
218 138  
  139 + /**
  140 + * @return true if the VOTable data implements the EpnCoreV2.
  141 + */
  142 + public boolean isV2() {
  143 + return !data.isContainingColumnName("index");
  144 + }
  145 +
  146 + /**
  147 + * Parse a Date value in the VOTable data at the specified row and column.
  148 + *
  149 + * @param rowId The row identifier
  150 + * @param granule The Granule enumeration, representing the column name.
  151 + * @return The value as Date.
  152 + * @throws ParseException The date format is not correct.
  153 + * @throws CanNotParseDataException The column name was not found in the list.
  154 + */
  155 + private Date parseDate(int rowId, GranuleEnum granule)
  156 + throws ParseException, CanNotParseDataException {
  157 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
  158 + Date date = new Date();
  159 + try {
  160 + date = sdf.parse((String) data.getCell(rowId, granule.toString()));
  161 + } catch (IllegalArgumentException e) {
  162 + LOGGER.log(Level.WARNING, String.format(ERROR_MSG, granule, rowId, "empty date"), e);
  163 + }
  164 +
  165 + return date;
  166 + }
  167 +
  168 + /**
  169 + * Parse a Double value in the VOTable data at the specified row and column.
  170 + *
  171 + * @param rowId The row identifier
  172 + * @param granule The Granule enumeration, representing the column name.
  173 + * @return The value as Double.
  174 + * @throws CanNotParseDataException The column name was not found in the list.
  175 + */
  176 + private Double parseDouble(int rowId, GranuleEnum granule) throws CanNotParseDataException {
  177 + Double d = null;
  178 + Object lObj = data.getCell(rowId, granule.toString());
  179 + if (lObj instanceof Double) {
  180 + d = (Double) lObj;
  181 + }
  182 + if (lObj instanceof Float) {
  183 + d = new Double((Float) lObj);
  184 + }
  185 +
  186 + return d == null ? Double.NaN : d;
  187 + }
  188 +
  189 + /**
  190 + * Parse a Double value in the VOTable data at the specified row and column.
  191 + *
  192 + * @param rowId The row identifier
  193 + * @param granule The Granule enumeration, representing the column name.
  194 + * @return The value as Double.
  195 + * @throws CanNotParseDataException The column name was not found in the list.
  196 + */
  197 + private Integer parseInteger(int rowId, GranuleEnum granule) throws CanNotParseDataException {
  198 + return (Integer) data.getCell(rowId, granule.toString());
  199 + }
  200 +
  201 + /**
  202 + * Parse a String value in the VOTable data at the specified row and column.
  203 + *
  204 + * @param rowId The row identifier
  205 + * @param granule The Granule enumeration, representing the column name.
  206 + * @return The value as String.
  207 + * @throws CanNotParseDataException The column name was not found in the list.
  208 + */
  209 + private String parseString(int rowId, GranuleEnum granule) throws CanNotParseDataException {
  210 + String res = "";
  211 + try {
  212 + res = (String) data.getCell(rowId, granule.toString());
  213 + } catch (IllegalArgumentException e) {
  214 + LOGGER.log(Level.WARNING, String.format(ERROR_MSG, granule, rowId, "empty string"), e);
  215 + }
  216 + return res;
  217 + }
  218 +
219 219 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/granule/GranuleEnum.java
... ... @@ -25,95 +25,93 @@ import java.util.Date;
25 25 */
26 26 @SuppressWarnings("javadoc")
27 27 public enum GranuleEnum {
28   -
29 28 //@noformat
30   - GRANULE_UID("granule_uid", String.class, true, true, "", "meta.id", ""),
31   - GRANULE_GID("granule_gid", String.class, true, true, "", "meta.id", "Common to granules of same type (e.g. same map projection, or geometry data products). Can be alphanum."),
32   - OBS_ID("obs_id", String.class, true, true, "", "meta.id", "Associates granules derived from the same data (e.g. various representations / processing levels). Can be alphanum., may be the ID of original observation."),
33   - DATAPRODUCT_TYPE("dataproduct_type", String.class, true, true, "", "meta.code.class", "Organization of the data product, from enumerated list"),
34   - TARGET_NAME("target_name", String.class, true, true, "", "meta.id;src", "Standard IAU name of target (from a list related to target class), case sensitive"),
35   - TARGET_CLASS("target_class", String.class, true, true, "", "meta.code.class;src", "Type of target, from enumerated list"),
36   - TIME_MIN("time_min", Double.class, true, false, "d (date as JD)", "time.start", ""),
37   - TIME_MAX("time_max", Double.class, true, false, "d (date as JD)", "time.end", ""),
38   - TIME_SAMPLING_STEP_MIN("time_sampling_step_min", Double.class, true, false, "s", "time.interval;stat.min", "Min time sampling step"),
39   - TIME_SAMPLING_STEP_MAX("time_sampling_step_max", Double.class, true, false, "s", "time.interval;stat.max", "Max time sampling step"),
40   - TIME_EXP_MIN("time_exp_min", Double.class, true, false, "s", "", "Min integration time"),
41   - TIME_EXP_MAX("time_exp_max", Double.class, true, false, "s", "time.duration;obs.exposure;stat.max", "Max integration time"),
42   - SPECTRAL_RANGE_MIN("spectral_range_min", Double.class, true, false, "Hz", "em.freq;stat.min", "Min spectral range (frequency)"),
43   - SPECTRAL_RANGE_MAX("spectral_range_max", Double.class, true, false, "Hz", "em.freq;stat.max", "Max spectral range (frequency)"),
44   - SPECTRAL_SAMPLING_STEP_MIN("spectral_sampling_step_min", Double.class, true, false, "Hz", "", "Min spectral sampling step"),
45   - SPECTRAL_SAMPLING_STEP_MAX("spectral_sampling_step_max", Double.class, true, false, "Hz", "", "Max spectral sampling step"),
46   - SPECTRAL_RESOLUTION_MIN("spectral_resolution_min", Double.class, true, false, "Hz", "spect.resolution;stat.min", ""),
47   - SPECTRAL_RESOLUTION_MAX("spectral_resolution_max", Double.class, true, false, "Hz", "spect.resolution;stat.max", "Max spectral resolution"),
48   - C1MIN("c1min", Double.class, true, false, "", "pos;stat.min", "Min of first coordinate"),
49   - C1MAX("c1max", Double.class, true, false, "", "pos;stat.max", "Max of first coordinate"),
50   - C2MIN("c2min", Double.class, true, false, "", "pos;stat.min", "Min of second coordinate"),
51   - C2MAX("c2max", Double.class, true, false, "", "pos;stat.max", "Max of second coordinate"),
52   - C3MIN("c3min", Double.class, true, false, "", "pos;stat.min", "Min of third coordinate"),
53   - C3MAX("c3max", Double.class, true, false, "", "pos;stat.max", "Max of third coordinate"),
54   - S_REGION("s_region", String.class, true, false, "", "instr.fov", "ObsCore-like footprint, assume spatial_coordinate_description"),
55   - C1_RESOL_MIN("c1_resol_min", Double.class, true, false, "", "", "Min resolution in first coordinate"),
  29 +
  30 + ACCESS_ESTSIZE("access_estsize", Integer.class, false, false, "kbyte", "", "Estimate file size in kbyte (with this spelling)"),
  31 + ACCESS_FORMAT("access_format", String.class, false, false, "", "meta.code.mime", ""),
  32 + ACCESS_MD5("access_md5", String.class, false, false, "", "", "MD5 Hash for the file when available (real file)"),
  33 + ACCESS_URL("access_url", String.class, false, false, "", "meta.ref.url;meta.file", ""),
  34 + ALT_TARGET_NAME("alt_target_name", String.class, false, false, "", "meta.id;src", "Provides alternative target name if more common (e.g. comets)"),
  35 + BIB_REFERENCE("bib_reference", String.class, false, false, "", "meta.bib", "Bibcode, doi, or other biblio id, URL"),
56 36 C1_RESOL_MAX("c1_resol_max", Double.class, true, false, "", "pos.resolution;stat.max", "Max resolution in first coordinate"),
57   - C2_RESOL_MIN("c2_resol_min", Double.class, true, false, "", "pos.resolution;stat.min", "Min resolution in second coordinate"),
  37 + C1_RESOL_MIN("c1_resol_min", Double.class, true, false, "", "", "Min resolution in first coordinate"),
  38 + C1MAX("c1max", Double.class, true, false, "", "pos;stat.max", "Max of first coordinate"),
  39 + C1MIN("c1min", Double.class, true, false, "", "pos;stat.min", "Min of first coordinate"),
58 40 C2_RESOL_MAX("c2_resol_max", Double.class, true, false, "", "pos.resolution;stat.max", "Max resolution in second coordinate"),
59   - C3_RESOL_MIN("c3_resol_min", Double.class, true, false, "", "pos.resolution;stat.min", "Min resolution in third coordinate"),
  41 + C2_RESOL_MIN("c2_resol_min", Double.class, true, false, "", "pos.resolution;stat.min", "Min resolution in second coordinate"),
  42 + C2MAX("c2max", Double.class, true, false, "", "pos;stat.max", "Max of second coordinate"),
  43 + C2MIN("c2min", Double.class, true, false, "", "pos;stat.min", "Min of second coordinate"),
60 44 C3_RESOL_MAX("c3_resol_max", Double.class, true, false, "", "pos.resolution;stat.max", "Max resolution in third coordinate"),
61   - SPATIAL_FRAME_TYPE("spatial_frame_type", String.class, true, false, "", "meta.code.class;pos.frame", "Flavor of coordinate system, defines the nature of coordinates. From enumerated list"),
62   - INCIDENCE_MIN("incidence_min", Double.class, true, false, "deg", "pos.posAng;stat.min", "Min incidence angle (solar zenithal angle)"),
63   - INCIDENCE_MAX("incidence_max", Double.class, true, false, "deg", "pos.posAng;stat.max", "Max incidence angle (solar zenithal angle)"),
64   - EMERGENCE_MIN("emergence_min", Double.class, true, false, "deg", "pos.posAng;stat.min", "Min emergence angle"),
  45 + C3_RESOL_MIN("c3_resol_min", Double.class, true, false, "", "pos.resolution;stat.min", "Min resolution in third coordinate"),
  46 + C3MAX("c3max", Double.class, true, false, "", "pos;stat.max", "Max of third coordinate"),
  47 + C3MIN("c3min", Double.class, true, false, "", "pos;stat.min", "Min of third coordinate"),
  48 + CREATION_DATE("creation_date", Date.class, true, true, "", "time.creation", "Date of first entry of this granule"),
  49 + DATA_ACCESS_URL("data_access_url", String.class, false, false, "", "", "If access_format indicates a detached label, this parameter is mandatory and points to the corresponding data file - both will be handled by the client before samping it to tools or downloading"),
  50 + DATAPRODUCT_TYPE("dataproduct_type", String.class, true, true, "", "meta.code.class", "Organization of the data product, from enumerated list"),
  51 + DEC("dec", Double.class, false, false, "deg", "pos.eq.dec;meta.main", "Declination"),
65 52 EMERGENCE_MAX("emergence_max", Double.class, true, false, "deg", "pos.posAng;stat.max", "Max emergence angle"),
66   - PHASE_MIN("phase_min", Double.class, true, false, "deg", "pos.phaseAng;stat.min", "Min phase angle"),
67   - PHASE_MAX("phase_max", Double.class, true, false, "deg", "pos.phaseAng;stat.max", "Max phase angle"),
  53 + EMERGENCE_MIN("emergence_min", Double.class, true, false, "deg", "pos.posAng;stat.min", "Min emergence angle"),
  54 + FEATURE_NAME("feature_name", String.class, false, false, "", "meta.id;pos", ""),
  55 + FILE_NAME("file_name", String.class, false, false, "", "meta.id;meta.file", "Name of the data file only, case sensitive"),
  56 + GRANULE_GID("granule_gid", String.class, true, true, "", "meta.id", "Common to granules of same type (e.g. same map projection, or geometry data products). Can be alphanum."),
  57 + GRANULE_UID("granule_uid", String.class, true, true, "", "meta.id", ""),
  58 + INCIDENCE_MAX("incidence_max", Double.class, true, false, "deg", "pos.posAng;stat.max", "Max incidence angle (solar zenithal angle)"),
  59 + INCIDENCE_MIN("incidence_min", Double.class, true, false, "deg", "pos.posAng;stat.min", "Min incidence angle (solar zenithal angle)"),
68 60 INSTRUMENT_HOST_NAME("instrument_host_name", String.class, true, false, "", "", "Standard name of the observatory or spacecraft"),
69 61 INSTRUMENT_NAME("instrument_name", String.class, true, false, "", "meta.id;instr", "Standard name of instrument"),
  62 + LOCAL_TIME_MAX("local_time_max", Double.class, false, false, "h", "time.phase;stat.max?", "Local time at observed region"),
  63 + LOCAL_TIME_MIN("local_time_min", Double.class, false, false, "h", "time.phase;stat.min?", "Local time at observed region"),
70 64 MEASUREMENT_TYPE("measurement_type", String.class, true, false, "", "meta.ucd", "UCD(s) defining the data"),
71   - PROCESSING_LEVEL("processing_level", Integer.class, true, false, "", "meta.code;obs.calib", "CODMAC calibration level in v1"),
72   - CREATION_DATE("creation_date", Date.class, true, true, "", "time.creation", "Date of first entry of this granule"),
73 65 MODIFICATION_DATE("modification_date", Date.class, true, true, "", "time.update", "Date of last modification (used to handle mirroring)"),
74   - RELEASE_DATE("release_date", Date.class, true, true, "", "time.release", ""),
75   - SERVICE_TITLE("service_title", String.class, true, true, "", "meta.title", ""),
76   - ACCESS_URL("access_url", String.class, false, false, "", "meta.ref.url;meta.file", ""),
77   - ACCESS_FORMAT("access_format", String.class, false, false, "", "meta.code.mime", ""),
78   - ACCESS_ESTSIZE("access_estsize", Integer.class, false, false, "kbyte", "", "Estimate file size in kbyte (with this spelling)"),
79   - DATA_ACCESS_URL("data_access_url", String.class, false, false, "", "", "If access_format indicates a detached label, this parameter is mandatory and points to the corresponding data file - both will be handled by the client before samping it to tools or downloading"),
80   - ACCESS_MD5("access_md5", String.class, false, false, "", "", "MD5 Hash for the file when available (real file)"),
81   - THUMBNAIL_URL("thumbnail_url", String.class, false, false, "", "meta.ref.url;meta.file", "URL of a thumbnail image with predefined size (png ~200 pix, for use in a client only)"),
82   - FILE_NAME("file_name", String.class, false, false, "", "meta.id;meta.file", "Name of the data file only, case sensitive"),
83   - SPECIES("species", String.class, false, false, "", "meta.id;phys.atmol", "Identifies a chemical species, case sensitive"),
84   - ALT_TARGET_NAME("alt_target_name", String.class, false, false, "", "meta.id;src", "Provides alternative target name if more common (e.g. comets)"),
85   - TARGET_REGION("target_region", String.class, false, false, "", "meta.id;class", ""),
86   - FEATURE_NAME("feature_name", String.class, false, false, "", "meta.id;pos", ""),
87   - BIB_REFERENCE("bib_reference", String.class, false, false, "", "meta.bib", "Bibcode, doi, or other biblio id, URL"),
88   - RA("ra", Double.class, false, false, "deg or h:m:s?", "pos.eq.ra;meta.main", ""),
89   - DEC("dec", Double.class, false, false, "deg", "pos.eq.dec;meta.main", "Declination"),
90   - SOLAR_LONGITUDE_MIN("solar_longitude_min", Double.class, false, false, "deg", "pos.posangle (TBC)", "Min Solar longitude Ls (location on orbit / season)"),
91   - SOLAR_LONGITUDE_MAX("solar_longitude_max", Double.class, false, false, "deg", "pos.posangle (TBC)", "Max Solar longitude Ls (location on orbit / season)"),
92   - LOCAL_TIME_MIN("local_time_min", Double.class, false, false, "h", "time.phase;stat.min?", "Local time at observed region"),
93   - LOCAL_TIME_MAX("local_time_max", Double.class, false, false, "h", "time.phase;stat.max?", "Local time at observed region"),
94   - TARGET_DISTANCE_MIN("target_distance_min", Double.class, false, false, "km", "pos.distance;stat.min", "Observer-target distance"),
95   - TARGET_DISTANCE_MAX("target_distance_max", Double.class, false, false, "km", "pos.distance;stat.max", "Observer-target distance"),
96   - TARGET_TIME_MIN("target_time_min", Double.class, false, false, "d", "", ""),
97   - TARGET_TIME_MAX("target_time_max", Double.class, false, false, "d", "", ""),
98   - PARTICLE_SPECTRAL_TYPE("particle_spectral_type", String.class, false, false, "", "", ""),
99   - PARTICLE_SPECTRAL_RANGE_MIN("particle_spectral_range_min", Double.class, false, false, "", "", ""),
  66 + OBS_ID("obs_id", String.class, true, true, "", "meta.id", "Associates granules derived from the same data (e.g. various representations / processing levels). Can be alphanum., may be the ID of original observation."),
100 67 PARTICLE_SPECTRAL_RANGE_MAX("particle_spectral_range_max", Double.class, false, false, "", "", ""),
101   - PARTICLE_SPECTRAL_SAMPLING_STEP_MIN("particle_spectral_sampling_step_min", Double.class, false, false, "", "", ""),
102   - PARTICLE_SPECTRAL_SAMPLING_STEP_MAX("particle_spectral_sampling_step_max", Double.class, false, false, "", "", ""),
103   - PARTICLE_SPECTRAL_RESOLUTION_MIN("particle_spectral_resolution_min", Double.class, false, false, "", "spect.resolution;stat.min", ""),
  68 + PARTICLE_SPECTRAL_RANGE_MIN("particle_spectral_range_min", Double.class, false, false, "", "", ""),
104 69 PARTICLE_SPECTRAL_RESOLUTION_MAX("particle_spectral_resolution_max", Double.class, false, false, "", "spect.resolution;stat.max", ""),
  70 + PARTICLE_SPECTRAL_RESOLUTION_MIN("particle_spectral_resolution_min", Double.class, false, false, "", "spect.resolution;stat.min", ""),
  71 + PARTICLE_SPECTRAL_SAMPLING_STEP_MAX("particle_spectral_sampling_step_max", Double.class, false, false, "", "", ""),
  72 + PARTICLE_SPECTRAL_SAMPLING_STEP_MIN("particle_spectral_sampling_step_min", Double.class, false, false, "", "", ""),
  73 + PARTICLE_SPECTRAL_TYPE("particle_spectral_type", String.class, false, false, "", "", ""),
  74 + PHASE_MAX("phase_max", Double.class, true, false, "deg", "pos.phaseAng;stat.max", "Max phase angle"),
  75 + PHASE_MIN("phase_min", Double.class, true, false, "deg", "pos.phaseAng;stat.min", "Min phase angle"),
  76 + PROCESSING_LEVEL("processing_level", Integer.class, true, false, "", "meta.code;obs.calib", "CODMAC calibration level in v1"),
105 77 PUBLISHER("publisher", String.class, false, false, "", "meta.name", "Resource publisher"),
  78 + RA("ra", Double.class, false, false, "deg or h:m:s?", "pos.eq.ra;meta.main", ""),
  79 + RELEASE_DATE("release_date", Date.class, true, true, "", "time.release", ""),
  80 + S_REGION("s_region", String.class, true, false, "", "instr.fov", "ObsCore-like footprint, assume spatial_coordinate_description"),
  81 + SERVICE_TITLE("service_title", String.class, true, true, "", "meta.title", ""),
  82 + SOLAR_LONGITUDE_MAX("solar_longitude_max", Double.class, false, false, "deg", "pos.posangle (TBC)", "Max Solar longitude Ls (location on orbit / season)"),
  83 + SOLAR_LONGITUDE_MIN("solar_longitude_min", Double.class, false, false, "deg", "pos.posangle (TBC)", "Min Solar longitude Ls (location on orbit / season)"),
106 84 SPATIAL_COORDINATE_DESCRIPTION("spatial_coordinate_description", String.class, false, false, "", "", "ID of specific coordinate system and version"),
  85 + SPATIAL_FRAME_TYPE("spatial_frame_type", String.class, true, false, "", "meta.code.class;pos.frame", "Flavor of coordinate system, defines the nature of coordinates. From enumerated list"),
107 86 SPATIAL_ORIGIN("spatial_origin", String.class, false, false, "", "meta.ref;pos.frame", "Defines the frame origin"),
  87 + SPECIES("species", String.class, false, false, "", "meta.id;phys.atmol", "Identifies a chemical species, case sensitive"),
  88 + SPECTRAL_RANGE_MAX("spectral_range_max", Double.class, true, false, "Hz", "em.freq;stat.max", "Max spectral range (frequency)"),
  89 + SPECTRAL_RANGE_MIN("spectral_range_min", Double.class, true, false, "Hz", "em.freq;stat.min", "Min spectral range (frequency)"),
  90 + SPECTRAL_RESOLUTION_MAX("spectral_resolution_max", Double.class, true, false, "Hz", "spect.resolution;stat.max", "Max spectral resolution"),
  91 + SPECTRAL_RESOLUTION_MIN("spectral_resolution_min", Double.class, true, false, "Hz", "spect.resolution;stat.min", ""),
  92 + SPECTRAL_SAMPLING_STEP_MAX("spectral_sampling_step_max", Double.class, true, false, "Hz", "", "Max spectral sampling step"),
  93 + SPECTRAL_SAMPLING_STEP_MIN("spectral_sampling_step_min", Double.class, true, false, "Hz", "", "Min spectral sampling step"),
  94 + TARGET_CLASS("target_class", String.class, true, true, "", "meta.code.class;src", "Type of target, from enumerated list"),
  95 + TARGET_DISTANCE_MAX("target_distance_max", Double.class, false, false, "km", "pos.distance;stat.max", "Observer-target distance"),
  96 + TARGET_DISTANCE_MIN("target_distance_min", Double.class, false, false, "km", "pos.distance;stat.min", "Observer-target distance"),
  97 + TARGET_NAME("target_name", String.class, true, true, "", "meta.id;src", "Standard IAU name of target (from a list related to target class), case sensitive"),
  98 + TARGET_REGION("target_region", String.class, false, false, "", "meta.id;class", ""),
  99 + TARGET_TIME_MAX("target_time_max", Double.class, false, false, "d", "", ""),
  100 + TARGET_TIME_MIN("target_time_min", Double.class, false, false, "d", "", ""),
  101 + THUMBNAIL_URL("thumbnail_url", String.class, false, false, "", "meta.ref.url;meta.file", "URL of a thumbnail image with predefined size (png ~200 pix, for use in a client only)"),
  102 + TIME_EXP_MAX("time_exp_max", Double.class, true, false, "s", "time.duration;obs.exposure;stat.max", "Max integration time"),
  103 + TIME_EXP_MIN("time_exp_min", Double.class, true, false, "s", "", "Min integration time"),
  104 + TIME_MAX("time_max", Double.class, true, false, "d (date as JD)", "time.end", ""),
  105 + TIME_MIN("time_min", Double.class, true, false, "d (date as JD)", "time.start", ""),
108 106 TIME_ORIGIN("time_origin", String.class, false, false, "", "", ""),
  107 + TIME_SAMPLING_STEP_MAX("time_sampling_step_max", Double.class, true, false, "s", "time.interval;stat.max", "Max time sampling step"),
  108 + TIME_SAMPLING_STEP_MIN("time_sampling_step_min", Double.class, true, false, "s", "time.interval;stat.min", "Min time sampling step"),
109 109 TIME_SCALE("time_scale", String.class, false, false, "", "time.scale", "");
110   - //@format
111 110  
112   - /** The name of the granule parameter. */
113   - private String name;
  111 + //@format
114 112  
115   - /** The type of the granule parameter. */
116   - private Class<?> type;
  113 + /** A short text describing the granule parameter. */
  114 + private String description;
117 115  
118 116 /** true if the granule parameter is mandatory, false if it is optional. */
119 117 private boolean isMandatory;
... ... @@ -121,14 +119,17 @@ public enum GranuleEnum {
121 119 /** true if the granule parameter must be actually filled, false if the value can be null. */
122 120 private boolean mustBeFilled;
123 121  
124   - /** The unit of the granule parameter (ie. degree, km, etc.). */
125   - private String unit;
  122 + /** The name of the granule parameter. */
  123 + private String name;
  124 +
  125 + /** The type of the granule parameter. */
  126 + private Class<?> type;
126 127  
127 128 /** The UCD of the granule parameter. */
128 129 private String ucd;
129 130  
130   - /** A short text describing the granule parameter. */
131   - private String description;
  131 + /** The unit of the granule parameter (ie. degree, km, etc.). */
  132 + private String unit;
132 133  
133 134  
134 135 /**
... ... @@ -153,9 +154,11 @@ public enum GranuleEnum {
153 154 this.description = description;
154 155 }
155 156  
156   - @Override
157   - public String toString() {
158   - return name;
  157 + /**
  158 + * @return A short text describing the granule parameter.
  159 + */
  160 + public String getDescription() {
  161 + return description;
159 162 }
160 163  
161 164 /**
... ... @@ -173,17 +176,10 @@ public enum GranuleEnum {
173 176 }
174 177  
175 178 /**
176   - * @return true if the granule parameter is mandatory, false if it is optional.
177   - */
178   - public boolean isMandatory() {
179   - return isMandatory;
180   - }
181   -
182   - /**
183   - * @return true if the granule parameter must be actually filled false if the value can be null.
  179 + * @return The UCD of the granule parameter.
184 180 */
185   - public boolean isMustBeFilled() {
186   - return mustBeFilled;
  181 + public String getUcd() {
  182 + return ucd;
187 183 }
188 184  
189 185 /**
... ... @@ -194,17 +190,22 @@ public enum GranuleEnum {
194 190 }
195 191  
196 192 /**
197   - * @return The UCD of the granule parameter.
  193 + * @return true if the granule parameter is mandatory, false if it is optional.
198 194 */
199   - public String getUcd() {
200   - return ucd;
  195 + public boolean isMandatory() {
  196 + return isMandatory;
201 197 }
202 198  
203 199 /**
204   - * @return A short text describing the granule parameter.
  200 + * @return true if the granule parameter must be actually filled false if the value can be null.
205 201 */
206   - public String getDescription() {
207   - return description;
  202 + public boolean isMustBeFilled() {
  203 + return mustBeFilled;
  204 + }
  205 +
  206 + @Override
  207 + public String toString() {
  208 + return name;
208 209 }
209 210  
210 211 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/GUIDim.java
... ... @@ -23,30 +23,30 @@ package eu.omp.irap.vespa.epntapclient.gui.mainpanel;
23 23 */
24 24 public class GUIDim {
25 25  
26   - /** The width of the left panel (services view). */
27   - public static final int LEFT_PANEL_WIDTH = 550;
  26 + /** The height of the bottom panel (result view). */
  27 + public static final int BOTTOM_PANEL_HEIGHT = 150;
  28 +
  29 + /** The minimum height of the bottom panel (result view). */
  30 + public static final int BOTTOM_PANEL_MIN_HEIGHT = 100;
28 31  
29 32 /** The minimum width of the left panel (services view). */
30 33 public static final int LEFT_PANEL_MIN_WIDTH = 300;
31 34  
32   - /** The width of the right panel (request view). */
33   - public static final int RIGHT_PANEL_WIDTH = 450;
  35 + /** The width of the left panel (services view). */
  36 + public static final int LEFT_PANEL_WIDTH = 550;
34 37  
35 38 /** The minimum width of the right panel (request view). */
36 39 public static final int RIGHT_PANEL_MIN_WIDTH = 220;
37 40  
  41 + /** The width of the right panel (request view). */
  42 + public static final int RIGHT_PANEL_WIDTH = 450;
  43 +
38 44 /** The height of the top panel (request view and services view). */
39 45 public static final int TOP_PANEL_HEIGHT = 400;
40 46  
41 47 /** The minimum height of the top panel (request view and services view). */
42 48 public static final int TOP_PANEL_MIN_HEIGHT = 100;
43 49  
44   - /** The height of the bottom panel (result view). */
45   - public static final int BOTTOM_PANEL_HEIGHT = 150;
46   -
47   - /** The minimum height of the bottom panel (result view). */
48   - public static final int BOTTOM_PANEL_MIN_HEIGHT = 100;
49   -
50 50  
51 51 /** Private constructor to hide the implicit public one. */
52 52 private GUIDim() {
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelListener.java
... ... @@ -23,11 +23,11 @@ import java.util.List;
23 23 */
24 24 public interface MainPanelListener {
25 25  
  26 + void displayError(String message, Exception e);
  27 +
26 28 List<String> getTableNames();
27 29  
28 30 void sendQuery();
29 31  
30 32 void updateQuery();
31   -
32   - void displayError(String message, Exception e);
33 33 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/mainpanel/MainPanelView.java
... ... @@ -37,15 +37,15 @@ public class MainPanelView extends JPanel {
37 37 /** The serial version UID. */
38 38 private static final long serialVersionUID = 1L;
39 39  
  40 + /** The JPanel where the user build the query. */
  41 + private RequestPanelView requestPanel;
  42 +
40 43 /** The JPanel where the VOTable results is displayed. */
41 44 private ResultPanelView resultPanel;
42 45  
43 46 /** The JPanel where the list of services is displayed. */
44 47 private ServicesPanelView servicesPanel;
45 48  
46   - /** The JPanel where the user build the query. */
47   - private RequestPanelView requestPanel;
48   -
49 49  
50 50 /**
51 51 * The main view constructor, which create all the panels.
... ... @@ -61,6 +61,38 @@ public class MainPanelView extends JPanel {
61 61 }
62 62  
63 63 /**
  64 + * Display an error message. Usually used each time an error happens.
  65 + *
  66 + * @param title The title of the error.
  67 + * @param message The message of the error.
  68 + */
  69 + public void displayError(String title, String message) {
  70 + JOptionPane.showMessageDialog(this, message, title,
  71 + JOptionPane.ERROR_MESSAGE);
  72 + }
  73 +
  74 + /**
  75 + * @return The JPanel containing the GUI elements to build the query.
  76 + */
  77 + public RequestPanelView getRequestPanel() {
  78 + return requestPanel;
  79 + }
  80 +
  81 + /**
  82 + * @return The JPanel where the VOTable result is displayed.
  83 + */
  84 + public ResultPanelView getResultsPanel() {
  85 + return resultPanel;
  86 + }
  87 +
  88 + /**
  89 + * @return The JPanel where the list of services is displayed.
  90 + */
  91 + public ServicesPanelView getServicesPanel() {
  92 + return servicesPanel;
  93 + }
  94 +
  95 + /**
64 96 * Build the panel and add GUI elements on it.
65 97 */
66 98 private void buildMainView() {
... ... @@ -98,36 +130,4 @@ public class MainPanelView extends JPanel {
98 130 GUIDim.BOTTOM_PANEL_MIN_HEIGHT));
99 131 }
100 132  
101   - /**
102   - * @return The JPanel where the VOTable result is displayed.
103   - */
104   - public ResultPanelView getResultsPanel() {
105   - return resultPanel;
106   - }
107   -
108   - /**
109   - * @return The JPanel containing the GUI elements to build the query.
110   - */
111   - public RequestPanelView getRequestPanel() {
112   - return requestPanel;
113   - }
114   -
115   - /**
116   - * @return The JPanel where the list of services is displayed.
117   - */
118   - public ServicesPanelView getServicesPanel() {
119   - return servicesPanel;
120   - }
121   -
122   - /**
123   - * Display an error message. Usually used each time an error happens.
124   - *
125   - * @param title The title of the error.
126   - * @param message The message of the error.
127   - */
128   - public void displayError(String title, String message) {
129   - JOptionPane.showMessageDialog(this, message, title,
130   - JOptionPane.ERROR_MESSAGE);
131   - }
132   -
133 133 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelListener.java
... ... @@ -22,11 +22,6 @@ package eu.omp.irap.vespa.epntapclient.gui.requestpanel;
22 22 public interface RequestPanelListener {
23 23  
24 24 /**
25   - * Method called when the used click on the 'Send query' button.
26   - */
27   - void onSendButtonClicked();
28   -
29   - /**
30 25 * Method called when the user remove a parameter with a parameter field.
31 26 *
32 27 * @param paramName The name of the removed parameter
... ... @@ -40,4 +35,9 @@ public interface RequestPanelListener {
40 35 * @param paramValue The new value of the parameter.
41 36 */
42 37 void onParameterUpdated(String paramName, Object paramValue);
  38 +
  39 + /**
  40 + * Method called when the used click on the 'Send query' button.
  41 + */
  42 + void onSendButtonClicked();
43 43 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/RequestPanelView.java
... ... @@ -42,20 +42,26 @@ import eu.omp.irap.vespa.epntapclient.gui.requestpanel.paramfield.TargetNameFiel
42 42 */
43 43 public class RequestPanelView extends JPanel {
44 44  
  45 + /** The height of the buttons panel. */
  46 + private static final int BUTTON_PANEL_HEIGHT = 20;
  47 +
45 48 /** The serial version UID. */
46 49 private static final long serialVersionUID = 1L;
47 50  
48   - /** The height of the buttons panel. */
49   - private static final int BUTTON_PANEL_HEIGHT = 20;
  51 + /** The GUI element of the button to send the query. */
  52 + private JButton buttonSend;
50 53  
51   - /** The listener for the request panel. */
52   - RequestPanelListener listener;
  54 + /** A field to set the dataproduct_type parameter. */
  55 + private DataProductTypeField dataProductTypeField;
  56 +
  57 + /** The parameters fields for the request. */
  58 + private List<ParamField> paramFields;
53 59  
54 60 /** The text area where the user write the query. */
55 61 private JTextArea queryArea;
56 62  
57   - /** The parameters fields for the request. */
58   - private List<ParamField> paramFields;
  63 + /** A field to set the spectral_range parameter. */
  64 + private FloatRangeField spectralRangeField;
59 65  
60 66 /** A field to set the target_name parameter. */
61 67 private TargetNameField targetNameField;
... ... @@ -63,14 +69,8 @@ public class RequestPanelView extends JPanel {
63 69 /** A field to set the time_range parameter. */
64 70 private DateRangeField timeRangeField;
65 71  
66   - /** A field to set the spectral_range parameter. */
67   - private FloatRangeField spectralRangeField;
68   -
69   - /** A field to set the dataproduct_type parameter. */
70   - private DataProductTypeField dataProductTypeField;
71   -
72   - /** The GUI element of the button to send the query. */
73   - private JButton buttonSend;
  72 + /** The listener for the request panel. */
  73 + RequestPanelListener listener;
74 74  
75 75  
76 76 /**
... ... @@ -84,33 +84,6 @@ public class RequestPanelView extends JPanel {
84 84 }
85 85  
86 86 /**
87   - * Add GUI elements to the request panel.
88   - */
89   - private void buildRequestPanel() {
90   - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
91   -
92   - JPanel queryPanel = new JPanel();
93   - queryPanel.setBorder(BorderFactory.createTitledBorder("Query for the selected service(s)"));
94   - queryPanel.setLayout(new BorderLayout());
95   - queryPanel.add(getQueryArea(), BorderLayout.CENTER);
96   -
97   - JPanel paramPanel = new JPanel();
98   - paramPanel.setLayout(new BoxLayout(paramPanel, BoxLayout.Y_AXIS));
99   - paramPanel.setBorder(BorderFactory.createTitledBorder("Query parameters"));
100   - for (ParamField field : getParamFields()) {
101   - paramPanel.add(field);
102   - }
103   -
104   - JPanel buttonPanel = new JPanel();
105   - buttonPanel.add(getButtonSend());
106   - buttonPanel.setMaximumSize(new Dimension(1000, BUTTON_PANEL_HEIGHT));
107   -
108   - this.add(paramPanel, this);
109   - this.add(queryPanel, this);
110   - this.add(buttonPanel, this);
111   - }
112   -
113   - /**
114 87 * Get the GUI element of the send button. If it doesn't exist, create it.
115 88 *
116 89 * @return The button.
... ... @@ -130,6 +103,20 @@ public class RequestPanelView extends JPanel {
130 103 }
131 104  
132 105 /**
  106 + * Get the GUI element of the data product field. If it doesn't exist, create it.
  107 + *
  108 + * @return The data product field.
  109 + */
  110 + public DataProductTypeField getDataProductTypeField() {
  111 + if (dataProductTypeField == null) {
  112 + dataProductTypeField = new DataProductTypeField(listener,
  113 + "dataproduct_type");
  114 + }
  115 +
  116 + return dataProductTypeField;
  117 + }
  118 +
  119 + /**
133 120 * Get the GUI element of the parameters fields list. If it doesn't exist, create it.
134 121 *
135 122 * @return The parameters fields list.
... ... @@ -146,17 +133,17 @@ public class RequestPanelView extends JPanel {
146 133 }
147 134  
148 135 /**
149   - * Get the GUI element of the data product field. If it doesn't exist, create it.
  136 + * Get the GUI element of the query area. If it doesn't exist, create it.
150 137 *
151   - * @return The data product field.
  138 + * @return The target query area.
152 139 */
153   - public DataProductTypeField getDataProductTypeField() {
154   - if (dataProductTypeField == null) {
155   - dataProductTypeField = new DataProductTypeField(listener,
156   - "dataproduct_type");
  140 + public JTextArea getQueryArea() {
  141 + if (queryArea == null) {
  142 + queryArea = new JTextArea("");
  143 + queryArea.setToolTipText("The query sent to the service(s).");
  144 + queryArea.setLineWrap(true);
157 145 }
158   -
159   - return dataProductTypeField;
  146 + return queryArea;
160 147 }
161 148  
162 149 /**
... ... @@ -173,19 +160,6 @@ public class RequestPanelView extends JPanel {
173 160 }
174 161  
175 162 /**
176   - * Get the GUI element of the time range field. If it doesn't exist, create it.
177   - *
178   - * @return The time range field.
179   - */
180   - public DateRangeField getTimeRangeField() {
181   - if (timeRangeField == null) {
182   - timeRangeField = new DateRangeField(listener, "time_");
183   - }
184   -
185   - return timeRangeField;
186   - }
187   -
188   - /**
189 163 * Get the GUI element of the target name field. If it doesn't exist, create it.
190 164 *
191 165 * @return The target name field.
... ... @@ -199,17 +173,16 @@ public class RequestPanelView extends JPanel {
199 173 }
200 174  
201 175 /**
202   - * Get the GUI element of the query area. If it doesn't exist, create it.
  176 + * Get the GUI element of the time range field. If it doesn't exist, create it.
203 177 *
204   - * @return The target query area.
  178 + * @return The time range field.
205 179 */
206   - public JTextArea getQueryArea() {
207   - if (queryArea == null) {
208   - queryArea = new JTextArea("");
209   - queryArea.setToolTipText("The query sent to the service(s).");
210   - queryArea.setLineWrap(true);
  180 + public DateRangeField getTimeRangeField() {
  181 + if (timeRangeField == null) {
  182 + timeRangeField = new DateRangeField(listener, "time_");
211 183 }
212   - return queryArea;
  184 +
  185 + return timeRangeField;
213 186 }
214 187  
215 188 /**
... ... @@ -220,4 +193,31 @@ public class RequestPanelView extends JPanel {
220 193 public void updateQueryArea(String query) {
221 194 queryArea.setText(query);
222 195 }
  196 +
  197 + /**
  198 + * Add GUI elements to the request panel.
  199 + */
  200 + private void buildRequestPanel() {
  201 + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
  202 +
  203 + JPanel queryPanel = new JPanel();
  204 + queryPanel.setBorder(BorderFactory.createTitledBorder("Query for the selected service(s)"));
  205 + queryPanel.setLayout(new BorderLayout());
  206 + queryPanel.add(getQueryArea(), BorderLayout.CENTER);
  207 +
  208 + JPanel paramPanel = new JPanel();
  209 + paramPanel.setLayout(new BoxLayout(paramPanel, BoxLayout.Y_AXIS));
  210 + paramPanel.setBorder(BorderFactory.createTitledBorder("Query parameters"));
  211 + for (ParamField field : getParamFields()) {
  212 + paramPanel.add(field);
  213 + }
  214 +
  215 + JPanel buttonPanel = new JPanel();
  216 + buttonPanel.add(getButtonSend());
  217 + buttonPanel.setMaximumSize(new Dimension(1000, BUTTON_PANEL_HEIGHT));
  218 +
  219 + this.add(paramPanel, this);
  220 + this.add(queryPanel, this);
  221 + this.add(buttonPanel, this);
  222 + }
223 223 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DataProductTypeField.java
... ... @@ -37,6 +37,59 @@ import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
37 37 */
38 38 public class DataProductTypeField extends ParamField {
39 39  
  40 + /**
  41 + * An enumeration of all available data product types. Each values comes with an id because
  42 + * EPN-TAP table can possibly be filled with the id instead of the name, so the query have to
  43 + * ask for both of them.
  44 + *
  45 + * @author N. Jourdane
  46 + */
  47 + @SuppressWarnings("javadoc")
  48 + public enum DataProductType {
  49 + // @noformat
  50 + ALL("All", "all"), CA("Catalog", "ca"), CU("Cube", "cu"),
  51 + DS("Dynamic spectrum", "ds"), IM("Image", "im"), MO("Movie", "mo"),
  52 + PR("Profile", "pr"), SC("Spectral cube", "sc"), SP("Spectrum", "sp"),
  53 + SV("Spatial vector", "sv"), TS("Time series", "ts"), VO("Volume", "vo");
  54 + // @format
  55 +
  56 + /** The id of the data product type, such as `ds`. */
  57 + private String id = "";
  58 +
  59 + /** The full name of the data product type, such as `Dynamic spectrum`. */
  60 + private String name = "";
  61 +
  62 +
  63 + /**
  64 + * Method constructor for the enumeration.
  65 + *
  66 + * @param name The full name of the data product type, such as `Dynamic spectrum`.
  67 + * @param id The id of the data product type, such as `ds`.
  68 + */
  69 + DataProductType(String name, String id) {
  70 + this.name = name;
  71 + this.id = id;
  72 + }
  73 +
  74 + /**
  75 + * @return A list of two strings, containing the name (formated for the query) and the id,
  76 + * used in the query. A list is used instead of a array because the getQuery
  77 + * function ( @see Queries) needs to know the parameter type.
  78 + */
  79 + public List<String> query() {
  80 + List<String> item = new ArrayList<>();
  81 + item.add(name.replace(" ", "-").toLowerCase());
  82 + item.add(id);
  83 + return item;
  84 + }
  85 +
  86 + @Override
  87 + public String toString() {
  88 + return name;
  89 + }
  90 + }
  91 +
  92 +
40 93 /** The serial version UID. */
41 94 private static final long serialVersionUID = 1L;
42 95  
... ... @@ -89,57 +142,4 @@ public class DataProductTypeField extends ParamField {
89 142 }
90 143 }
91 144  
92   -
93   - /**
94   - * An enumeration of all available data product types. Each values comes with an id because
95   - * EPN-TAP table can possibly be filled with the id instead of the name, so the query have to
96   - * ask for both of them.
97   - *
98   - * @author N. Jourdane
99   - */
100   - @SuppressWarnings("javadoc")
101   - public enum DataProductType {
102   - // @noformat
103   - ALL("All", "all"), IM("Image", "im"), SP("Spectrum", "sp"),
104   - DS("Dynamic spectrum", "ds"), SC("Spectral cube", "sc"), PR("Profile", "pr"),
105   - VO("Volume", "vo"), MO("Movie", "mo"), CU("Cube", "cu"),
106   - TS("Time series", "ts"), CA("Catalog", "ca"), SV("Spatial vector", "sv");
107   - // @format
108   -
109   - /** The full name of the data product type, such as `Dynamic spectrum`. */
110   - private String name = "";
111   -
112   - /** The id of the data product type, such as `ds`. */
113   - private String id = "";
114   -
115   -
116   - /**
117   - * Method constructor for the enumeration.
118   - *
119   - * @param name The full name of the data product type, such as `Dynamic spectrum`.
120   - * @param id The id of the data product type, such as `ds`.
121   - */
122   - DataProductType(String name, String id) {
123   - this.name = name;
124   - this.id = id;
125   - }
126   -
127   - /**
128   - * @return A list of two strings, containing the name (formated for the query) and the id,
129   - * used in the query. A list is used instead of a array because the getQuery
130   - * function ( @see Queries) needs to know the parameter type.
131   - */
132   - public List<String> query() {
133   - List<String> item = new ArrayList<>();
134   - item.add(name.replace(" ", "-").toLowerCase());
135   - item.add(id);
136   - return item;
137   - }
138   -
139   - @Override
140   - public String toString() {
141   - return name;
142   - }
143   - }
144   -
145 145 }
146 146 \ No newline at end of file
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/DateRangeField.java
... ... @@ -38,21 +38,21 @@ import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
38 38 */
39 39 public class DateRangeField extends ParamField implements TextFieldListener {
40 40  
41   - /** The serial version UID. */
42   - private static final long serialVersionUID = 1L;
43   -
44 41 /** The date format used in the DateRange field */
45 42 private static final String DATE_FORMAT = "dd/MM/yyyy";
46 43  
47 44 /** The regex used to validate the Date fields */
48 45 private static final String DATE_REGEX = "(^(((0[1-9]|1[0-9]|2[0-8])[\\/](0[1-9]|1[012]))|((29|30|31)[\\/](0[13578]|1[02]))|((29|30)[\\/](0[4,6,9]|11)))[\\/](19|[2-9][0-9])\\d\\d$)|(^29[\\/]02[\\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)";
49 46  
50   - /** The JTextField used to put the parameter minimum value of the range. */
51   - private JTextField fieldMin;
  47 + /** The serial version UID. */
  48 + private static final long serialVersionUID = 1L;
52 49  
53 50 /** The JTextField used to put the parameter maximum value of the range. */
54 51 private JTextField fieldMax;
55 52  
  53 + /** The JTextField used to put the parameter minimum value of the range. */
  54 + private JTextField fieldMin;
  55 +
56 56  
57 57 /**
58 58 * Method constructor
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/FloatRangeField.java
... ... @@ -34,12 +34,12 @@ public class FloatRangeField extends ParamField implements TextFieldListener {
34 34 /** The serial version UID. */
35 35 private static final long serialVersionUID = 1L;
36 36  
37   - /** The JTextField used to put the parameter minimum value of the range. */
38   - private JTextField fieldMin;
39   -
40 37 /** The JTextField used to put the parameter maximum value of the range. */
41 38 private JTextField fieldMax;
42 39  
  40 + /** The JTextField used to put the parameter minimum value of the range. */
  41 + private JTextField fieldMin;
  42 +
43 43  
44 44 /**
45 45 * Method constructor
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/ParamField.java
... ... @@ -40,30 +40,30 @@ public abstract class ParamField extends JPanel {
40 40 /** The serial version UID. */
41 41 private static final long serialVersionUID = 1L;
42 42  
43   - /** The minimum width of the field. */
44   - protected static final int MIN_FIELD_WIDTH = 30;
45   -
46 43 /** The preferred field height. */
47 44 protected static final int FIELD_HEIGHT = 20;
48 45  
49   - /** The maximum width of the field. */
50   - protected static final int MAX_FIELD_WIDTH = 400;
51   -
52 46 /** The preferred label width. */
53 47 protected static final int LABEL_WIDTH = 140;
54 48  
55   - /** The suffix used in REG-TAP parameters names, indicating that it's a beginning of a range. */
56   - protected static final String MIN_SUFFIX = "min";
  49 + /** The maximum width of the field. */
  50 + protected static final int MAX_FIELD_WIDTH = 400;
57 51  
58 52 /** The suffix used in REG-TAP parameters names, indicating that it is a end of a range. */
59 53 protected static final String MAX_SUFFIX = "max";
60 54  
61   - /** The main view of the application. */
62   - protected RequestPanelListener requestPanelListener;
  55 + /** The minimum width of the field. */
  56 + protected static final int MIN_FIELD_WIDTH = 30;
  57 +
  58 + /** The suffix used in REG-TAP parameters names, indicating that it's a beginning of a range. */
  59 + protected static final String MIN_SUFFIX = "min";
63 60  
64 61 /** The parameter name of the field */
65 62 protected String paramName;
66 63  
  64 + /** The main view of the application. */
  65 + protected RequestPanelListener requestPanelListener;
  66 +
67 67  
68 68 /**
69 69 * Method constructor for the parameter field abstract class, which do all common action for all
... ... @@ -82,21 +82,6 @@ public abstract class ParamField extends JPanel {
82 82 }
83 83  
84 84 /**
85   - * Build the panel and add GUI elements on it.
86   - */
87   - private void buildParamField() {
88   - setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
89   -
90   - setMaximumSize(new Dimension(MAX_FIELD_WIDTH, FIELD_HEIGHT));
91   -
92   - String strLabel = paramName.replaceAll("_", " ").trim();
93   - JLabel label = new JLabel(strLabel.substring(0, 1).toUpperCase() + strLabel.substring(1));
94   - label.setPreferredSize(new Dimension(LABEL_WIDTH, FIELD_HEIGHT));
95   -
96   - this.add(label);
97   - }
98   -
99   - /**
100 85 * To add the listener. @see TextFieldListener
101 86 *
102 87 * @param changeListener The listener of text fields.
... ... @@ -108,7 +93,7 @@ public abstract class ParamField extends JPanel {
108 93 field.getDocument().addDocumentListener(new DocumentListener() {
109 94  
110 95 @Override
111   - public void removeUpdate(DocumentEvent de) {
  96 + public void changedUpdate(DocumentEvent de) {
112 97 changeListener.update(field);
113 98 }
114 99  
... ... @@ -118,10 +103,25 @@ public abstract class ParamField extends JPanel {
118 103 }
119 104  
120 105 @Override
121   - public void changedUpdate(DocumentEvent de) {
  106 + public void removeUpdate(DocumentEvent de) {
122 107 changeListener.update(field);
123 108 }
124 109  
125 110 });
126 111 }
  112 +
  113 + /**
  114 + * Build the panel and add GUI elements on it.
  115 + */
  116 + private void buildParamField() {
  117 + setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  118 +
  119 + setMaximumSize(new Dimension(MAX_FIELD_WIDTH, FIELD_HEIGHT));
  120 +
  121 + String strLabel = paramName.replaceAll("_", " ").trim();
  122 + JLabel label = new JLabel(strLabel.substring(0, 1).toUpperCase() + strLabel.substring(1));
  123 + label.setPreferredSize(new Dimension(LABEL_WIDTH, FIELD_HEIGHT));
  124 +
  125 + this.add(label);
  126 + }
127 127 }
128 128 \ No newline at end of file
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetClassField.java
... ... @@ -35,6 +35,41 @@ import eu.omp.irap.vespa.epntapclient.gui.requestpanel.RequestPanelListener;
35 35 */
36 36 public class TargetClassField extends ParamField {
37 37  
  38 + /**
  39 + * An enumeration of all available target classes.
  40 + *
  41 + * @author N. Jourdane
  42 + */
  43 + @SuppressWarnings("javadoc")
  44 + enum TargetClass {
  45 + // @noformat
  46 + ALL("All"), COMET("Comet"), EXOPLANET("Exoplanet"), INTERPLANETARY_MEDIUM("Interplanetary medium"),
  47 + RING("Ring"), SAMPLE("Sample"), SKY("Sky"), SPACECRAFT("Spacecraft"),
  48 + SPACEJUNK("Spacejunk"), STAR("Star");
  49 + // @format
  50 +
  51 + /** The name of the target class. */
  52 + String name;
  53 +
  54 +
  55 + /**
  56 + * Method constructor for the enumeration.
  57 + *
  58 + * @param name The name of the target class.
  59 + */
  60 + TargetClass(String name) {
  61 + this.name = name;
  62 + }
  63 +
  64 + /**
  65 + * @return The name formated for the query.
  66 + */
  67 + String query() {
  68 + return name.replace(" ", "_").toLowerCase();
  69 + }
  70 + }
  71 +
  72 +
38 73 /** The serial version UID. */
39 74 private static final long serialVersionUID = 1L;
40 75  
... ... @@ -74,39 +109,4 @@ public class TargetClassField extends ParamField {
74 109 }
75 110 }
76 111  
77   -
78   - /**
79   - * An enumeration of all available target classes.
80   - *
81   - * @author N. Jourdane
82   - */
83   - @SuppressWarnings("javadoc")
84   - enum TargetClass {
85   - // @noformat
86   - ALL("All"), COMET("Comet"), EXOPLANET("Exoplanet"), RING("Ring"),
87   - SAMPLE("Sample"), SKY("Sky"), SPACECRAFT("Spacecraft"), SPACEJUNK("Spacejunk"),
88   - STAR("Star"), INTERPLANETARY_MEDIUM("Interplanetary medium");
89   - // @format
90   -
91   - /** The name of the target class. */
92   - String name;
93   -
94   -
95   - /**
96   - * Method constructor for the enumeration.
97   - *
98   - * @param name The name of the target class.
99   - */
100   - TargetClass(String name) {
101   - this.name = name;
102   - }
103   -
104   - /**
105   - * @return The name formated for the query.
106   - */
107   - String query() {
108   - return name.replace(" ", "_").toLowerCase();
109   - }
110   - }
111   -
112 112 }
113 113 \ No newline at end of file
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/requestpanel/paramfield/TargetNameField.java
... ... @@ -83,11 +83,6 @@ public class TargetNameField extends ParamField implements TextFieldListener {
83 83 this(new RequestPanelListener() {
84 84  
85 85 @Override
86   - public void onSendButtonClicked() {
87   - /** No SendButtonClicked event, we just want the field itself. */
88   - }
89   -
90   - @Override
91 86 public void onParameterRemoved(String paramName) {
92 87 /** No ParameterRemoved event, we just want the field itself. */
93 88 }
... ... @@ -96,10 +91,29 @@ public class TargetNameField extends ParamField implements TextFieldListener {
96 91 public void onParameterUpdated(String paramName, Object paramValue) {
97 92 /** No ParameterChanged event, we just want the field itself. */
98 93 }
  94 +
  95 + @Override
  96 + public void onSendButtonClicked() {
  97 + /** No SendButtonClicked event, we just want the field itself. */
  98 + }
99 99 }, paraName);
100 100 }
101 101  
102 102 /**
  103 + * This method is called each time the field is modified.
  104 + */
  105 + @Override
  106 + public void update(JTextField textField) {
  107 + SwingUtilities.invokeLater(new Runnable() {
  108 +
  109 + @Override
  110 + public void run() {
  111 + updateComboBox();
  112 + }
  113 + });
  114 + }
  115 +
  116 + /**
103 117 * This method is called each time the field is modified. A Runnable is used it is impossible to
104 118 * modify the comboBox from a DocumentEvent.
105 119 */
... ... @@ -128,18 +142,4 @@ public class TargetNameField extends ParamField implements TextFieldListener {
128 142 }
129 143 }
130 144  
131   - /**
132   - * This method is called each time the field is modified.
133   - */
134   - @Override
135   - public void update(JTextField textField) {
136   - SwingUtilities.invokeLater(new Runnable() {
137   -
138   - @Override
139   - public void run() {
140   - updateComboBox();
141   - }
142   - });
143   - }
144   -
145 145 }
146 146 \ No newline at end of file
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelCtrl.java
... ... @@ -34,12 +34,12 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis
34 34 /** The logger for the class ResultPanelCtrl. */
35 35 private static final Logger LOGGER = Logger.getLogger(ResultPanelCtrl.class.getName());
36 36  
37   - /** The result panel view. */
38   - private ResultPanelView view;
39   -
40 37 /** The listener of the main panel. */
41 38 private MainPanelListener listener;
42 39  
  40 + /** The result panel view. */
  41 + private ResultPanelView view;
  42 +
43 43  
44 44 /**
45 45 * Constructor of ResultPanelCtrl.
... ... @@ -49,6 +49,13 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis
49 49 view = new ResultPanelView(this);
50 50 }
51 51  
  52 + /**
  53 + * @return The view of the result panel. Used in MainPanelCtrl to add panels in the main window.
  54 + */
  55 + public ResultPanelView getView() {
  56 + return view;
  57 + }
  58 +
52 59 @Override
53 60 public void onDownloadButtonClicked(File file) {
54 61 try {
... ... @@ -58,11 +65,9 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis
58 65 }
59 66 }
60 67  
61   - /**
62   - * @return The view of the result panel. Used in MainPanelCtrl to add panels in the main window.
63   - */
64   - public ResultPanelView getView() {
65   - return view;
  68 + @Override
  69 + public void onRowsSelected() {
  70 + LOGGER.info("Selected row: " + StringJoiner.join(view.getSelectedRows()));
66 71 }
67 72  
68 73 @Override
... ... @@ -70,9 +75,4 @@ public class ResultPanelCtrl extends VOTableController implements ResultPanelLis
70 75 throws eu.omp.irap.vespa.votable.controller.VOTableException {
71 76 view.fillTable(voTableData);
72 77 }
73   -
74   - @Override
75   - public void onRowsSelected() {
76   - LOGGER.info("Selected row: " + StringJoiner.join(view.getSelectedRows()));
77   - }
78 78 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/resultpanel/ResultPanelView.java
... ... @@ -35,14 +35,14 @@ public class ResultPanelView extends VOTableView {
35 35 /** The serial version UID. */
36 36 private static final long serialVersionUID = 1L;
37 37  
38   - /** The listener of the result panel. */
39   - ResultPanelListener listener;
  38 + /** The GUI element of the button to save the result of the query. */
  39 + private JButton fileButton;
40 40  
41 41 /** A label to display several informations (aka. status bar). */
42 42 private JLabel infoLabel;
43 43  
44   - /** The GUI element of the button to save the result of the query. */
45   - private JButton fileButton;
  44 + /** The listener of the result panel. */
  45 + ResultPanelListener listener;
46 46  
47 47  
48 48 /**
... ... @@ -70,22 +70,6 @@ public class ResultPanelView extends VOTableView {
70 70 }
71 71  
72 72 /**
73   - * Returns the info label, create it if doesn't exist.
74   - *
75   - * @return The info label.
76   - */
77   - public JLabel getInfoLabel() {
78   - return infoLabel == null ? new JLabel() : infoLabel;
79   - }
80   -
81   - /**
82   - * @param infoText The text to display in the status-bar, which will override the old one.
83   - */
84   - public void setInfoText(String infoText) {
85   - infoLabel.setText(infoText);
86   - }
87   -
88   - /**
89 73 * Returns the button to save the VOTable, create it if doesn't exist.
90 74 *
91 75 * @return The button to save the VOTable.
... ... @@ -106,4 +90,20 @@ public class ResultPanelView extends VOTableView {
106 90 return fileButton;
107 91 }
108 92  
  93 + /**
  94 + * Returns the info label, create it if doesn't exist.
  95 + *
  96 + * @return The info label.
  97 + */
  98 + public JLabel getInfoLabel() {
  99 + return infoLabel == null ? new JLabel() : infoLabel;
  100 + }
  101 +
  102 + /**
  103 + * @param infoText The text to display in the status-bar, which will override the old one.
  104 + */
  105 + public void setInfoText(String infoText) {
  106 + infoLabel.setText(infoText);
  107 + }
  108 +
109 109 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelCtrl.java
... ... @@ -33,41 +33,41 @@ import eu.omp.irap.vespa.votable.utils.StringJoiner;
33 33 */
34 34 public class ServicesPanelCtrl extends VOTableController implements ServicesPanelListener {
35 35  
  36 + /** The separator used between each services in the custom service text fields. */
  37 + private static final String CUSTOM_SERVICES_SEPARATOR = ";";
  38 +
36 39 /** The logger for the class ServicesPanelCtrl. */
37 40 private static final Logger LOGGER = Logger.getLogger(ServicesPanelCtrl.class.getName());
38 41  
39   - /** The position of the column displaying the table names in the service table. */
40   - private static final int TABLE_NAME_COLUMN_POSITION = 4;
41   -
42 42 /** The position of the column displaying the services target URLs in the service table. */
43 43 private static final int SERVICE_URL_COLUMN_POSITION = 1;
44 44  
45   - /** The separator used between each services in the custom service text fields. */
46   - private static final String CUSTOM_SERVICES_SEPARATOR = ";";
  45 + /** The position of the column displaying the table names in the service table. */
  46 + private static final int TABLE_NAME_COLUMN_POSITION = 4;
47 47  
48   - /** The view of the services panel. */
49   - private ServicesPanelView view;
  48 + /** The list of services target Urls selected by the user on the service panel. */
  49 + private List<String> customServicesUrls;
50 50  
51 51 /** The list of services table names selected by the user on the service panel. */
52   - private List<String> tablesNames;
  52 + private List<String> customTablesNames;
  53 +
  54 + /** The listener of the main panel. */
  55 + private MainPanelListener listener;
53 56  
54 57 /** The list of services target Urls selected by the user on the service panel. */
55   - private List<String> servicesUrls;
  58 + private List<String> selectedServicesUrls;
56 59  
57 60 /** The list of services table names selected by the user on the service panel. */
58 61 private List<String> selectedTablesNames;
59 62  
60 63 /** The list of services target Urls selected by the user on the service panel. */
61   - private List<String> selectedServicesUrls;
  64 + private List<String> servicesUrls;
62 65  
63 66 /** The list of services table names selected by the user on the service panel. */
64   - private List<String> customTablesNames;
65   -
66   - /** The list of services target Urls selected by the user on the service panel. */
67   - private List<String> customServicesUrls;
  67 + private List<String> tablesNames;
68 68  
69   - /** The listener of the main panel. */
70   - private MainPanelListener listener;
  69 + /** The view of the services panel. */
  70 + private ServicesPanelView view;
71 71  
72 72  
73 73 /**
... ... @@ -85,11 +85,10 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane
85 85 }
86 86  
87 87 /**
88   - * @return The view of the services panel. Used in MainPanelCtrl to add panels in the main
89   - * window.
  88 + * @return The list of services target Urls selected by the user on the service panel.
90 89 */
91   - public ServicesPanelView getView() {
92   - return view;
  90 + public List<String> getServicesUrls() {
  91 + return servicesUrls;
93 92 }
94 93  
95 94 /**
... ... @@ -100,33 +99,11 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane
100 99 }
101 100  
102 101 /**
103   - * @return The list of services target Urls selected by the user on the service panel.
  102 + * @return The view of the services panel. Used in MainPanelCtrl to add panels in the main
  103 + * window.
104 104 */
105   - public List<String> getServicesUrls() {
106   - return servicesUrls;
107   - }
108   -
109   - @Override
110   - public void onRowsSelected() {
111   - List<String> newServicesUrls = new ArrayList<>();
112   - List<String> newTablesNames = new ArrayList<>();
113   -
114   - for (int row : view.getSelectedRows()) {
115   - newServicesUrls.add((String) view.getValueAt(SERVICE_URL_COLUMN_POSITION, row));
116   - newTablesNames.add((String) view.getValueAt(TABLE_NAME_COLUMN_POSITION, row));
117   - }
118   -
119   - selectedServicesUrls = newServicesUrls;
120   - selectedTablesNames = newTablesNames;
121   -
122   - servicesUrls = customServicesUrls;
123   - tablesNames = customTablesNames;
124   - servicesUrls.addAll(selectedServicesUrls);
125   - tablesNames.addAll(customTablesNames);
126   -
127   - listener.updateQuery();
128   - LOGGER.info("Updated selected services URLs: " + StringJoiner.join(selectedServicesUrls));
129   - LOGGER.info("Updated selected tables names: " + StringJoiner.join(selectedTablesNames));
  105 + public ServicesPanelView getView() {
  106 + return view;
130 107 }
131 108  
132 109 @Override
... ... @@ -158,4 +135,27 @@ public class ServicesPanelCtrl extends VOTableController implements ServicesPane
158 135 }
159 136 }
160 137 }
  138 +
  139 + @Override
  140 + public void onRowsSelected() {
  141 + List<String> newServicesUrls = new ArrayList<>();
  142 + List<String> newTablesNames = new ArrayList<>();
  143 +
  144 + for (int row : view.getSelectedRows()) {
  145 + newServicesUrls.add((String) view.getValueAt(SERVICE_URL_COLUMN_POSITION, row));
  146 + newTablesNames.add((String) view.getValueAt(TABLE_NAME_COLUMN_POSITION, row));
  147 + }
  148 +
  149 + selectedServicesUrls = newServicesUrls;
  150 + selectedTablesNames = newTablesNames;
  151 +
  152 + servicesUrls = customServicesUrls;
  153 + tablesNames = customTablesNames;
  154 + servicesUrls.addAll(selectedServicesUrls);
  155 + tablesNames.addAll(customTablesNames);
  156 +
  157 + listener.updateQuery();
  158 + LOGGER.info("Updated selected services URLs: " + StringJoiner.join(selectedServicesUrls));
  159 + LOGGER.info("Updated selected tables names: " + StringJoiner.join(selectedTablesNames));
  160 + }
161 161 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/gui/servicespanel/ServicesPanelView.java
... ... @@ -34,15 +34,15 @@ public class ServicesPanelView extends VOTableView {
34 34 /** The serial version UID. */
35 35 private static final long serialVersionUID = 1L;
36 36  
37   - /** The listener of the services panel view. */
38   - ServicesPanelListener listener;
39   -
40 37 /** The text field to manually set the service URL. */
41 38 private JTextField serviceUrlTextField;
42 39  
43 40 /** The text field to manually set the service table name. */
44 41 private JTextField tableNameTextField;
45 42  
  43 + /** The listener of the services panel view. */
  44 + ServicesPanelListener listener;
  45 +
46 46  
47 47 /**
48 48 * Method constructor which customize the services panel, but don't build it from scratch since
... ... @@ -56,22 +56,6 @@ public class ServicesPanelView extends VOTableView {
56 56 buildServicesPanel();
57 57 }
58 58  
59   - /** Build the service panel and add the graphical elements on it. */
60   - private void buildServicesPanel() {
61   - serviceUrlTextField = new JTextField(10);
62   - addEventListener(serviceUrlTextField);
63   - tableNameTextField = new JTextField(10);
64   - addEventListener(tableNameTextField);
65   -
66   - JPanel addServicePanel = new JPanel();
67   - addServicePanel.add(new JLabel("Service URL"));
68   - addServicePanel.add(serviceUrlTextField);
69   - addServicePanel.add(new JLabel("Table name"));
70   - addServicePanel.add(tableNameTextField);
71   -
72   - add(addServicePanel, BorderLayout.SOUTH);
73   - }
74   -
75 59 public void addEventListener(JTextField textField) {
76 60 textField.getDocument().addDocumentListener(new DocumentListener() {
77 61  
... ... @@ -81,18 +65,27 @@ public class ServicesPanelView extends VOTableView {
81 65 }
82 66  
83 67 @Override
84   - public void removeUpdate(DocumentEvent e) {
  68 + public void insertUpdate(DocumentEvent e) {
85 69 listener.onCustomServiceUpdated();
86 70 }
87 71  
88 72 @Override
89   - public void insertUpdate(DocumentEvent e) {
  73 + public void removeUpdate(DocumentEvent e) {
90 74 listener.onCustomServiceUpdated();
91 75 }
92 76 });
93 77 }
94 78  
95 79 /**
  80 + * Returns the field to set a custom service URL. Create it if doesn't exist.
  81 + *
  82 + * @return The service URL JTextField.
  83 + */
  84 + public JTextField getServiceUrlTextField() {
  85 + return serviceUrlTextField;
  86 + }
  87 +
  88 + /**
96 89 * Returns the field to set a custom table name. Create it if doesn't exist.
97 90 *
98 91 * @return The table name JTextField.
... ... @@ -101,13 +94,20 @@ public class ServicesPanelView extends VOTableView {
101 94 return tableNameTextField;
102 95 }
103 96  
104   - /**
105   - * Returns the field to set a custom service URL. Create it if doesn't exist.
106   - *
107   - * @return The service URL JTextField.
108   - */
109   - public JTextField getServiceUrlTextField() {
110   - return serviceUrlTextField;
  97 + /** Build the service panel and add the graphical elements on it. */
  98 + private void buildServicesPanel() {
  99 + serviceUrlTextField = new JTextField(10);
  100 + addEventListener(serviceUrlTextField);
  101 + tableNameTextField = new JTextField(10);
  102 + addEventListener(tableNameTextField);
  103 +
  104 + JPanel addServicePanel = new JPanel();
  105 + addServicePanel.add(new JLabel("Service URL"));
  106 + addServicePanel.add(serviceUrlTextField);
  107 + addServicePanel.add(new JLabel("Table name"));
  108 + addServicePanel.add(tableNameTextField);
  109 +
  110 + add(addServicePanel, BorderLayout.SOUTH);
111 111 }
112 112  
113 113 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/service/Service.java
... ... @@ -22,32 +22,25 @@ package eu.omp.irap.vespa.epntapclient.service;
22 22 public class Service {
23 23  
24 24 /**
25   - * The ivoid of the service: <br/>
26   - * <em>Unambiguous reference to the resource conforming to the IVOA
27   - * standard for identifiers.</em>
28   - */
29   - private String ivoid;
30   -
31   - /**
32   - * The title of the service: <br/>
33   - * <em>The full name given to the resource.</em>
  25 + * The content_level of the service: <br/>
  26 + * <em> A hash-separated list of content levels specifying the intended audience.</em>
34 27 */
35   - private String title;
  28 + private String contentLevel;
36 29  
37 30 /**
38   - * The short_name of the service: <br/>
39   - * <em> A short name or abbreviation given to something. This name will be used where brief
40   - * annotations for the re- source name are required. Applications may use it to refer to the
41   - * resource in a compact display. One word or a few letters is recommended. No more than sixteen
42   - * characters are allowed.</em>
  31 + * The created date of the service, as a string: <br/>
  32 + * <em>The UTC date and time this resource metadata de- scription was created. This timestamp must
  33 + * not be in the future. This time is not required to be accurate; it should be at least
  34 + * accurate to the day. Any insignificant time elds should be set to zero.</em>
43 35 */
44   - private String shortName;
  36 + private String created;
45 37  
46 38 /**
47   - * The type of the service: <br/>
48   - * <em>Resource type (something like vs:datacollection, vs:catalogservice, etc).</em>
  39 + * The creator of the service: <br/>
  40 + * <em>The creator(s) of the resource in the order given by the resource record author, separated by
  41 + * semicolons.</em>
49 42 */
50   - private String type;
  43 + private String creator;
51 44  
52 45 /**
53 46 * The description of the service: <br/>
... ... @@ -56,17 +49,11 @@ public class Service {
56 49 private String description;
57 50  
58 51 /**
59   - * The creator of the service: <br/>
60   - * <em>The creator(s) of the resource in the order given by the resource record author, separated by
61   - * semicolons.</em>
62   - */
63   - private String creator;
64   -
65   - /**
66   - * The content_level of the service: <br/>
67   - * <em> A hash-separated list of content levels specifying the intended audience.</em>
  52 + * The ivoid of the service: <br/>
  53 + * <em>Unambiguous reference to the resource conforming to the IVOA
  54 + * standard for identifiers.</em>
68 55 */
69   - private String contentLevel;
  56 + private String ivoid;
70 57  
71 58 /**
72 59 * The reference_rul of the service: <br/>
... ... @@ -75,12 +62,25 @@ public class Service {
75 62 private String referenceURL;
76 63  
77 64 /**
78   - * The created date of the service, as a string: <br/>
79   - * <em>The UTC date and time this resource metadata de- scription was created. This timestamp must
80   - * not be in the future. This time is not required to be accurate; it should be at least
81   - * accurate to the day. Any insignificant time elds should be set to zero.</em>
  65 + * The short_name of the service: <br/>
  66 + * <em> A short name or abbreviation given to something. This name will be used where brief
  67 + * annotations for the re- source name are required. Applications may use it to refer to the
  68 + * resource in a compact display. One word or a few letters is recommended. No more than sixteen
  69 + * characters are allowed.</em>
82 70 */
83   - private String created;
  71 + private String shortName;
  72 +
  73 + /**
  74 + * The title of the service: <br/>
  75 + * <em>The full name given to the resource.</em>
  76 + */
  77 + private String title;
  78 +
  79 + /**
  80 + * The type of the service: <br/>
  81 + * <em>Resource type (something like vs:datacollection, vs:catalogservice, etc).</em>
  82 + */
  83 + private String type;
84 84  
85 85 /**
86 86 * The updated date of the service, as a string: <br/>
... ... @@ -101,31 +101,57 @@ public class Service {
101 101 }
102 102  
103 103 /**
104   - * @return true if all parameter of the service are not null.
  104 + * Get the service {@link #contentLevel}.
  105 + *
  106 + * @return The service {@link #contentLevel}.
105 107 */
106   - public boolean isValid() {
107   - boolean isValid = ivoid != null && title != null && shortName != null;
108   - isValid = isValid && type != null && description != null && creator != null;
109   - isValid = isValid && contentLevel != null && referenceURL != null && created != null;
110   - return isValid && updated != null;
  108 + public String getContentLevel() {
  109 + return contentLevel;
111 110 }
112 111  
113 112 /**
114   - * Get the service {@link #title}.
  113 + * Get the service {@link #created} date.
115 114 *
116   - * @return The service {@link #title}.
  115 + * @return The service {@link #created} date.
117 116 */
118   - public String getTitle() {
119   - return title;
  117 + public String getCreated() {
  118 + return created;
120 119 }
121 120  
122 121 /**
123   - * Set the service {@link #title}.
  122 + * Get the service {@link #creator}.
124 123 *
125   - * @param title The service {@link #title}
  124 + * @return The service {@link #creator}.
126 125 */
127   - public void setTitle(String title) {
128   - this.title = title;
  126 + public String getCreator() {
  127 + return creator;
  128 + }
  129 +
  130 + /**
  131 + * Get the service {@link #description}.
  132 + *
  133 + * @return The service {@link #description}.
  134 + */
  135 + public String getDescription() {
  136 + return description;
  137 + }
  138 +
  139 + /**
  140 + * Get the service {@link #ivoid}.
  141 + *
  142 + * @return The service {@link #ivoid}.
  143 + */
  144 + public String getIvoid() {
  145 + return ivoid;
  146 + }
  147 +
  148 + /**
  149 + * Get the service {@link #referenceURL}.
  150 + *
  151 + * @return The service {@link #referenceURL}.
  152 + */
  153 + public String getReferenceURL() {
  154 + return referenceURL;
129 155 }
130 156  
131 157 /**
... ... @@ -138,12 +164,12 @@ public class Service {
138 164 }
139 165  
140 166 /**
141   - * Set the service {@link #shortName}.
  167 + * Get the service {@link #title}.
142 168 *
143   - * @param shortName The service {@link #shortName}
  169 + * @return The service {@link #title}.
144 170 */
145   - public void setShortName(String shortName) {
146   - this.shortName = shortName;
  171 + public String getTitle() {
  172 + return title;
147 173 }
148 174  
149 175 /**
... ... @@ -156,39 +182,40 @@ public class Service {
156 182 }
157 183  
158 184 /**
159   - * Set the service {@link #type}.
  185 + * Get the service {@link #updated} date.
160 186 *
161   - * @param type The service {@link #type}
  187 + * @return The service {@link #updated} date.
162 188 */
163   - public void setType(String type) {
164   - this.type = type;
  189 + public String getUpdated() {
  190 + return updated;
165 191 }
166 192  
167 193 /**
168   - * Get the service {@link #description}.
169   - *
170   - * @return The service {@link #description}.
  194 + * @return true if all parameter of the service are not null.
171 195 */
172   - public String getDescription() {
173   - return description;
  196 + public boolean isValid() {
  197 + boolean isValid = ivoid != null && title != null && shortName != null;
  198 + isValid = isValid && type != null && description != null && creator != null;
  199 + isValid = isValid && contentLevel != null && referenceURL != null && created != null;
  200 + return isValid && updated != null;
174 201 }
175 202  
176 203 /**
177   - * Set the service {@link #description}.
  204 + * Set the service {@link #contentLevel}.
178 205 *
179   - * @param description The service {@link #description}
  206 + * @param contentLevel The service {@link #contentLevel}
180 207 */
181   - public void setDescription(String description) {
182   - this.description = description;
  208 + public void setContentLevel(String contentLevel) {
  209 + this.contentLevel = contentLevel;
183 210 }
184 211  
185 212 /**
186   - * Get the service {@link #creator}.
  213 + * Set the service {@link #created}.
187 214 *
188   - * @return The service {@link #creator}.
  215 + * @param created The service {@link #created}
189 216 */
190   - public String getCreator() {
191   - return creator;
  217 + public void setCreated(String created) {
  218 + this.created = created;
192 219 }
193 220  
194 221 /**
... ... @@ -201,30 +228,12 @@ public class Service {
201 228 }
202 229  
203 230 /**
204   - * Get the service {@link #contentLevel}.
205   - *
206   - * @return The service {@link #contentLevel}.
207   - */
208   - public String getContentLevel() {
209   - return contentLevel;
210   - }
211   -
212   - /**
213   - * Set the service {@link #contentLevel}.
214   - *
215   - * @param contentLevel The service {@link #contentLevel}
216   - */
217   - public void setContentLevel(String contentLevel) {
218   - this.contentLevel = contentLevel;
219   - }
220   -
221   - /**
222   - * Get the service {@link #referenceURL}.
  231 + * Set the service {@link #description}.
223 232 *
224   - * @return The service {@link #referenceURL}.
  233 + * @param description The service {@link #description}
225 234 */
226   - public String getReferenceURL() {
227   - return referenceURL;
  235 + public void setDescription(String description) {
  236 + this.description = description;
228 237 }
229 238  
230 239 /**
... ... @@ -237,30 +246,30 @@ public class Service {
237 246 }
238 247  
239 248 /**
240   - * Get the service {@link #created} date.
  249 + * Set the service {@link #shortName}.
241 250 *
242   - * @return The service {@link #created} date.
  251 + * @param shortName The service {@link #shortName}
243 252 */
244   - public String getCreated() {
245   - return created;
  253 + public void setShortName(String shortName) {
  254 + this.shortName = shortName;
246 255 }
247 256  
248 257 /**
249   - * Set the service {@link #created}.
  258 + * Set the service {@link #title}.
250 259 *
251   - * @param created The service {@link #created}
  260 + * @param title The service {@link #title}
252 261 */
253   - public void setCreated(String created) {
254   - this.created = created;
  262 + public void setTitle(String title) {
  263 + this.title = title;
255 264 }
256 265  
257 266 /**
258   - * Get the service {@link #updated} date.
  267 + * Set the service {@link #type}.
259 268 *
260   - * @return The service {@link #updated} date.
  269 + * @param type The service {@link #type}
261 270 */
262   - public String getUpdated() {
263   - return updated;
  271 + public void setType(String type) {
  272 + this.type = type;
264 273 }
265 274  
266 275 /**
... ... @@ -272,13 +281,4 @@ public class Service {
272 281 this.updated = updated;
273 282 }
274 283  
275   - /**
276   - * Get the service {@link #ivoid}.
277   - *
278   - * @return The service {@link #ivoid}.
279   - */
280   - public String getIvoid() {
281   - return ivoid;
282   - }
283   -
284 284 }
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCore.java
... ... @@ -20,10 +20,10 @@ package eu.omp.irap.vespa.epntapclient.service;
20 20 * @author N. Jourdane
21 21 */
22 22 public enum ServiceCore {
23   - /** The ObsCore service appellation, used in several queries. */
24   - OBSCORE("ObsCore"),
25 23 /** The EpnCore service appellation, used in several queries. */
26   - EPNCORE("EpnCore");
  24 + EPNCORE("EpnCore"),
  25 + /** The ObsCore service appellation, used in several queries. */
  26 + OBSCORE("ObsCore");
27 27  
28 28 /** The type of the service (ie. ObsCore, EpnCore, etc.). */
29 29 private String type;
... ... @@ -31,7 +31,7 @@ public enum ServiceCore {
31 31  
32 32 /**
33 33 * Constructor of ServiceCore enumeration.
34   - *
  34 + *
35 35 * @param type The type of the service (ie. ObsCore, EpnCore, etc.).
36 36 */
37 37 ServiceCore(String type) {
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/service/ServiceCtrl.java
... ... @@ -51,6 +51,41 @@ public class ServiceCtrl {
51 51 }
52 52  
53 53 /**
  54 + * @param ivoid The ivoid of the service.
  55 + * @param parameter The unique parameter to get.
  56 + * @return The value of the parameter.
  57 + * @throws VOTableException Can not get the VOTable.
  58 + */
  59 + public static Object getParameter(String ivoid, String parameter)
  60 + throws VOTableException {
  61 + String query = String.format(Queries.SELECT_TAP_SERVICES_WHERE_IVOID, parameter, ivoid);
  62 + return getVoTableData(query).getCell(0, 0);
  63 + }
  64 +
  65 + /**
  66 + * @param ivoid The ivoid of the service.
  67 + * @param parameters A list of parameters to get.
  68 + * @return A map of <parameter name, value> resulting the request.
  69 + * @throws VOTableException Can not get the VOTable.
  70 + */
  71 + public static Map<String, Object> getParameters(String ivoid, List<String> parameters)
  72 + throws VOTableException {
  73 + return getParameters(ivoid, StringJoiner.join(parameters));
  74 + }
  75 +
  76 + /**
  77 + * @param ivoid The ivoid of the service.
  78 + * @param parameters The parameters to get, separated by commas.
  79 + * @return A map of <parameter name, value> resulting the request.
  80 + * @throws VOTableException Can not get the VOTable.
  81 + */
  82 + public static Map<String, Object> getParameters(String ivoid, String parameters)
  83 + throws VOTableException {
  84 + String query = String.format(Queries.SELECT_TAP_SERVICES_WHERE_IVOID, parameters, ivoid);
  85 + return getVoTableData(query).getRowMap(0);
  86 + }
  87 +
  88 + /**
54 89 * Parse a Resource and returns the corresponding Service.
55 90 *
56 91 * @param resource the resource to parse.
... ... @@ -111,6 +146,17 @@ public class ServiceCtrl {
111 146 }
112 147  
113 148 /**
  149 + * @param query The query.
  150 + * @return The VOTable resulting the query.
  151 + * @throws VOTableException Can not get the VOTable.
  152 + */
  153 + public static VOTABLE getVoTable(String query) throws VOTableException {
  154 + VOTableController voTableCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL, query);
  155 + voTableCtrl.readTable();
  156 + return voTableCtrl.getVOTable();
  157 + }
  158 +
  159 + /**
114 160 * @param query The query to get the service.
115 161 * @return The VOTableData
116 162 * @throws VOTableException Can not get the VOTable.
... ... @@ -136,52 +182,6 @@ public class ServiceCtrl {
136 182 }
137 183  
138 184 /**
139   - * @param query The query.
140   - * @return The VOTable resulting the query.
141   - * @throws VOTableException Can not get the VOTable.
142   - */
143   - public static VOTABLE getVoTable(String query) throws VOTableException {
144   - VOTableController voTableCtrl = new VOTableController(Consts.DEFAULT_REGISTRY_URL, query);
145   - voTableCtrl.readTable();
146   - return voTableCtrl.getVOTable();
147   - }
148   -
149   - /**
150   - * @param ivoid The ivoid of the service.
151   - * @param parameters The parameters to get, separated by commas.
152   - * @return A map of <parameter name, value> resulting the request.
153   - * @throws VOTableException Can not get the VOTable.
154   - */
155   - public static Map<String, Object> getParameters(String ivoid, String parameters)
156   - throws VOTableException {
157   - String query = String.format(Queries.SELECT_TAP_SERVICES_WHERE_IVOID, parameters, ivoid);
158   - return getVoTableData(query).getRowMap(0);
159   - }
160   -
161   - /**
162   - * @param ivoid The ivoid of the service.
163   - * @param parameters A list of parameters to get.
164   - * @return A map of <parameter name, value> resulting the request.
165   - * @throws VOTableException Can not get the VOTable.
166   - */
167   - public static Map<String, Object> getParameters(String ivoid, List<String> parameters)
168   - throws VOTableException {
169   - return getParameters(ivoid, StringJoiner.join(parameters));
170   - }
171   -
172   - /**
173   - * @param ivoid The ivoid of the service.
174   - * @param parameter The unique parameter to get.
175   - * @return The value of the parameter.
176   - * @throws VOTableException Can not get the VOTable.
177   - */
178   - public static Object getParameter(String ivoid, String parameter)
179   - throws VOTableException {
180   - String query = String.format(Queries.SELECT_TAP_SERVICES_WHERE_IVOID, parameter, ivoid);
181   - return getVoTableData(query).getCell(0, 0);
182   - }
183   -
184   - /**
185 185 * Convert a date from XMLGregorianCalendar to a string literal.
186 186 *
187 187 * @param date The date to convert
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/voresource/VOResourceCtrl.java
... ... @@ -49,30 +49,30 @@ import eu.omp.irap.vespa.votable.utils.XMLUtils;
49 49 */
50 50 public class VOResourceCtrl {
51 51  
52   - /** The logger for the class VOResourceController. */
53   - private static final Logger LOGGER = Logger.getLogger(VOResourceCtrl.class.getName());
  52 + /** The URL used to get the resources in JSON format. */
  53 + private static final String GET_JSONRESOURCES_URL = "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources/search";
54 54  
55 55 /** The URL used to get the resources in VOResource (XML) format. */
56 56 private static final String GET_VORESOURCE_URL = "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources.xml";
57 57  
58   - /** The URL used to get the resources in JSON format. */
59   - private static final String GET_JSONRESOURCES_URL = "http://voparis-registry.obspm.fr/vo/ivoa/1/voresources/search";
  58 + /** The logger for the class VOResourceController. */
  59 + private static final Logger LOGGER = Logger.getLogger(VOResourceCtrl.class.getName());
60 60  
61 61 /** The maximum number of resulting resources. */
62 62 private static final int MAX_VORESOURCES = 100;
63 63  
  64 + /** The URL of the TR namespace, since it is not present in the dowloaded VOResource. */
  65 + private static final String NAMESPACE_TR = "http://www.ivoa.net/xml/VODataService/v1.1";
  66 +
  67 + /** The URL of the VS namespace, since it is not present in the dowloaded VOResource. */
  68 + private static final String NAMESPACE_VS = "http://www.ivoa.net/xml/TAPRegExt/v1.0";
  69 +
64 70 /** The new schema location, since one in the dowloaded VOResource is not compliant. */
65 71 private static final String SCHEMA_LOCATION = "http://www.ivoa.net/xml/RegistryInterface/v1.0 "
66 72 + "http://www.ivoa.net/xml/RegistryInterface/v1.0 "
67 73 + "http://www.ivoa.net/xml/VODataService/v1.1 "
68 74 + "http://www.ivoa.net/xml/TAPRegExt/v1.0";
69 75  
70   - /** The URL of the VS namespace, since it is not present in the dowloaded VOResource. */
71   - private static final String NAMESPACE_VS = "http://www.ivoa.net/xml/TAPRegExt/v1.0";
72   -
73   - /** The URL of the TR namespace, since it is not present in the dowloaded VOResource. */
74   - private static final String NAMESPACE_TR = "http://www.ivoa.net/xml/VODataService/v1.1";
75   -
76 76  
77 77 /** Private constructor to hide the default public one. */
78 78 private VOResourceCtrl() {
... ... @@ -102,35 +102,6 @@ public class VOResourceCtrl {
102 102 }
103 103  
104 104 /**
105   - * Get the list of ivoIDs of all resources which implements the specified core and match with
106   - * the keywords.
107   - *
108   - * @param core The service core (ie. ObsCore, EpnCore, etc.)
109   - * @param keywords A list of keywords to filter the result. The keywords are the subjects of the
110   - * resources, for example, 'Space plasmas'.
111   - * @return A list of ivoIDs
112   - * @throws CantGetVOResourceException Can not get the VOResource.
113   - */
114   - public static List<String> getVOResources(ServiceCore core, List<String> keywords)
115   - throws CantGetVOResourceException {
116   - List<String> ivoidResources;
117   - Map<String, String> parameters = new HashMap<>();
118   - String subjects = StringJoiner.join(keywords);
119   - parameters.put("keywords",
120   - "datamodel:\"" + core.toString() + "\" subjects:\"" + subjects + "\"");
121   - parameters.put("max", String.valueOf(MAX_VORESOURCES));
122   -
123   - String query = Network.buildGetRequest(GET_JSONRESOURCES_URL, parameters);
124   - try {
125   - ivoidResources = parseIvoidResources(Network.readJson(query));
126   - } catch (CantSendQueryException e) {
127   - throw new CantGetVOResourceException(GET_VORESOURCE_URL, e);
128   - }
129   - LOGGER.info("Got resources: " + StringJoiner.join(ivoidResources));
130   - return ivoidResources;
131   - }
132   -
133   - /**
134 105 * Get a resource from its identifier.
135 106 *
136 107 * @param identifier The resource identifier.
... ... @@ -189,6 +160,35 @@ public class VOResourceCtrl {
189 160 }
190 161  
191 162 /**
  163 + * Get the list of ivoIDs of all resources which implements the specified core and match with
  164 + * the keywords.
  165 + *
  166 + * @param core The service core (ie. ObsCore, EpnCore, etc.)
  167 + * @param keywords A list of keywords to filter the result. The keywords are the subjects of the
  168 + * resources, for example, 'Space plasmas'.
  169 + * @return A list of ivoIDs
  170 + * @throws CantGetVOResourceException Can not get the VOResource.
  171 + */
  172 + public static List<String> getVOResources(ServiceCore core, List<String> keywords)
  173 + throws CantGetVOResourceException {
  174 + List<String> ivoidResources;
  175 + Map<String, String> parameters = new HashMap<>();
  176 + String subjects = StringJoiner.join(keywords);
  177 + parameters.put("keywords",
  178 + "datamodel:\"" + core.toString() + "\" subjects:\"" + subjects + "\"");
  179 + parameters.put("max", String.valueOf(MAX_VORESOURCES));
  180 +
  181 + String query = Network.buildGetRequest(GET_JSONRESOURCES_URL, parameters);
  182 + try {
  183 + ivoidResources = parseIvoidResources(Network.readJson(query));
  184 + } catch (CantSendQueryException e) {
  185 + throw new CantGetVOResourceException(GET_VORESOURCE_URL, e);
  186 + }
  187 + LOGGER.info("Got resources: " + StringJoiner.join(ivoidResources));
  188 + return ivoidResources;
  189 + }
  190 +
  191 + /**
192 192 * Change the namespaces of the VOResource to make the XML file valid against its XSD.
193 193 *
194 194 * @param voResourcePath The file path of the VOResource.
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/voresource/VOResourceException.java
... ... @@ -23,55 +23,35 @@ package eu.omp.irap.vespa.epntapclient.voresource;
23 23 */
24 24 public abstract class VOResourceException extends Exception {
25 25  
26   - /** The serial version UID. */
27   - private static final long serialVersionUID = 1L;
28   -
29   -
30   - /**
31   - * @param message The message describing the exception displayed in the error dialog.
32   - */
33   - public VOResourceException(String message) {
34   - super(message);
35   - }
36   -
37   - /**
38   - * @param message The message describing the exception displayed in the error dialog.
39   - * @param e The exception thrown.
40   - */
41   - public VOResourceException(String message, Exception e) {
42   - super(message, e);
43   - }
44   -
45   -
46   - /** An exception thrown when we can not read the VOResource. */
47   - public static class CantReadVOResourceException extends VOResourceException {
  26 + /** An exception thrown when we can not get the VOResource, ie. an error in the query. */
  27 + public static class CantGetVOResourceException extends VOResourceException {
48 28  
49 29 /** The serial version UID. */
50 30 private static final long serialVersionUID = 1L;
51 31  
52 32  
53 33 /**
54   - * @param voResourcePath The path of the VOResource.
  34 + * @param voResourceRequest The path of the VOResource.
55 35 * @param e The exception thrown.
56 36 */
57   - public CantReadVOResourceException(String voResourcePath, Exception e) {
58   - super("Can not read the VOResource which should be stored in: " + voResourcePath, e);
  37 + public CantGetVOResourceException(String voResourceRequest, Exception e) {
  38 + super("Can not get the remote VOResource with the request: " + voResourceRequest, e);
59 39 }
60 40 }
61 41  
62   - /** An exception thrown when we can not get the VOResource, ie. an error in the query. */
63   - public static class CantGetVOResourceException extends VOResourceException {
  42 + /** An exception thrown when we can not read the VOResource. */
  43 + public static class CantReadVOResourceException extends VOResourceException {
64 44  
65 45 /** The serial version UID. */
66 46 private static final long serialVersionUID = 1L;
67 47  
68 48  
69 49 /**
70   - * @param voResourceRequest The path of the VOResource.
  50 + * @param voResourcePath The path of the VOResource.
71 51 * @param e The exception thrown.
72 52 */
73   - public CantGetVOResourceException(String voResourceRequest, Exception e) {
74   - super("Can not get the remote VOResource with the request: " + voResourceRequest, e);
  53 + public CantReadVOResourceException(String voResourcePath, Exception e) {
  54 + super("Can not read the VOResource which should be stored in: " + voResourcePath, e);
75 55 }
76 56 }
77 57  
... ... @@ -93,4 +73,24 @@ public abstract class VOResourceException extends Exception {
93 73 + "\n See the VOResource file for more details: " + voResourcePath, e);
94 74 }
95 75 }
  76 +
  77 +
  78 + /** The serial version UID. */
  79 + private static final long serialVersionUID = 1L;
  80 +
  81 +
  82 + /**
  83 + * @param message The message describing the exception displayed in the error dialog.
  84 + */
  85 + public VOResourceException(String message) {
  86 + super(message);
  87 + }
  88 +
  89 + /**
  90 + * @param message The message describing the exception displayed in the error dialog.
  91 + * @param e The exception thrown.
  92 + */
  93 + public VOResourceException(String message, Exception e) {
  94 + super(message, e);
  95 + }
96 96 }
... ...
src/test/java/eu/omp/irap/vespa/epntapclient/EpnTapConnectionTest.java
... ... @@ -42,8 +42,8 @@ import eu.omp.irap.vespa.votable.votabledata.VOTableData;
42 42 @SuppressWarnings("static-method")
43 43 public class EpnTapConnectionTest {
44 44  
45   - /** The logger for the class Main. */
46   - private static final Logger LOGGER = Logger.getLogger(EpnTapConnectionTest.class.getName());
  45 + /** The AMDA access URL, for testing purposes. */
  46 + private static final String AMDA_ACCESS_URL = "http://cdpp-epntap.cesr.fr/__system__/tap/run/tap";
47 47  
48 48 /** The AMDA ivoid, for testing purposes. */
49 49 private static final String AMDA_IVOID = "ivo://cdpp/amda";
... ... @@ -51,9 +51,6 @@ public class EpnTapConnectionTest {
51 51 /** The AMDA short name (to compare with the returned value), for testing purposes. */
52 52 private static final String AMDA_SHORT_NAME = "AMDA";
53 53  
54   - /** The AMDA access URL, for testing purposes. */
55   - private static final String AMDA_ACCESS_URL = "http://cdpp-epntap.cesr.fr/__system__/tap/run/tap";
56   -
57 54 /** A subject associated with the AMDA service, for testing purposes. */
58 55 private static final String AMDA_SUBJECT = "Space plasmas";
59 56  
... ... @@ -63,6 +60,9 @@ public class EpnTapConnectionTest {
63 60 /** The APIS short name (to compare with the returned value), for testing purposes. */
64 61 private static final String APIS_SHORT_NAME = "APIS";
65 62  
  63 + /** The logger for the class Main. */
  64 + private static final Logger LOGGER = Logger.getLogger(EpnTapConnectionTest.class.getName());
  65 +
66 66 /** The URL access of a service implementing the EpnCorev2, for testing purposes. */
67 67 private static final String SERVICE_EPNCOREV2_ACCESS_URL = "http://voparis-tap-planeto.obspm.fr/__system__/tap/run/tap";
68 68  
... ... @@ -75,126 +75,18 @@ public class EpnTapConnectionTest {
75 75  
76 76  
77 77 /**
78   - * Unit test for the class {@link EpnTapConnection#getEPNVOresource(String)}.
79   - *
80   - * @throws VOResourceException Can not get the VOresource.
81   - */
82   - @Test
83   - public void getVOResourceTest() throws VOResourceException {
84   - LOGGER.info("getVOResourceTest");
85   - EpnTapConnection facade = new EpnTapConnection();
86   -
87   - Resource resource = facade.getEPNVOresource(AMDA_IVOID);
88   -
89   - assertEquals("AMDA", resource.getShortName());
90   - assertEquals("CDPP AMDA DataBase", resource.getTitle());
91   - assertEquals("Centre de Données de la Physique des Plasmas",
92   - resource.getCuration().getCreator().get(0).getName().getValue());
93   - }
94   -
95   - /**
96   - * Unit test for the class {@link EpnTapConnection#getEPNVOResources()}.
97   - *
98   - * @throws VOResourceException Can not get the VOresource.
99   - */
100   - @Test
101   - public void getEPNVOResourcesTest() throws VOResourceException {
102   - LOGGER.info("getEPNVOResourcesTest");
103   - EpnTapConnection facade = new EpnTapConnection();
104   -
105   - List<Resource> resources = facade.getEPNVOResources();
106   -
107   - int nbResources = resources.size();
108   - assertTrue(nbResources + " ∉ [13;20]", nbResources >= 13 && nbResources <= 20);
109   -
110   - Resource amda = null;
111   - Resource apis = null;
112   - for (Resource resource : resources) {
113   - if (AMDA_IVOID.equals(resource.getIdentifier())) {
114   - amda = resource;
115   - }
116   - if (APIS_IVOID.equals(resource.getIdentifier())) {
117   - apis = resource;
118   - }
119   - }
120   - assertNotNull("AMDA resource should be present.", amda);
121   - assertNotNull("APIS resource should be present.", apis);
122   - assertEquals(AMDA_SHORT_NAME, amda.getShortName());
123   - assertEquals(APIS_SHORT_NAME, apis.getShortName());
124   - }
125   -
126   - /**
127   - * Unit test for the class {@link EpnTapConnection#getEPNVOResources(List)}.
128   - *
129   - * @throws VOResourceException Can not get the VOresource.
130   - */
131   - @Test
132   - public void getEPNVOResourcesWithKeywordsTest() throws VOResourceException {
133   - LOGGER.info("getEPNVOResourcesWithKeywordsTest");
134   - EpnTapConnection facade = new EpnTapConnection();
135   -
136   - final List<String> keywords = new ArrayList<>();
137   - keywords.add(AMDA_SUBJECT);
138   - List<Resource> resources = facade.getEPNVOResources(keywords);
139   -
140   - assertEquals(resources.size(), 1);
141   -
142   - Resource amda = null;
143   - for (Resource resource : resources) {
144   - if (AMDA_IVOID.equals(resource.getIdentifier())) {
145   - amda = resource;
146   - }
147   - }
148   - assertNotNull("AMDA resource should be present.", amda);
149   - }
150   -
151   - // *** Services ***
152   -
153   - /**
154   - * Unit test for the class {@link EpnTapConnection#getEPNService(String)}.
155   - *
156   - * @throws VOTableException Can not get the VOTable corresponding to the service.
157   - */
158   - @Test
159   - public void getEPNServiceTest() throws VOTableException {
160   - LOGGER.info("getEPNServiceTest");
161   - EpnTapConnection facade = new EpnTapConnection();
162   -
163   - VOTABLE voTable = facade.getEPNService(AMDA_IVOID);
164   - VOTableData data = ServiceCtrl.getVoTableData(voTable);
165   -
166   - assertEquals(1, data.getNbRows());
167   - assertTrue("Column name ivoid not found.", data.isContainingColumnName("ivoid"));
168   - assertTrue("Column name short_name not found.", data.isContainingColumnName("access_url"));
169   - assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
170   - assertEquals(AMDA_IVOID, data.getCell(0, "ivoid"));
171   - assertEquals(AMDA_ACCESS_URL, data.getCell(0, "access_url"));
172   - assertEquals(AMDA_SHORT_NAME, data.getCell(0, "short_name"));
173   - }
174   -
175   - /**
176   - * Unit test for the class {@link EpnTapConnection#getEPNService(String, List)}.
  78 + * Unit test for the class {@link EpnTapConnection#getEPNCoreTableName(String)}.
177 79 *
178 80 * @throws VOTableException Can not get the VOTable corresponding to the service.
179 81 */
180 82 @Test
181   - public void getEPNServiceWithAttributesTest() throws VOTableException {
182   - LOGGER.info("getEPNServiceWithAttributesTest");
  83 + public void getEPNCoreTableNameTest() throws VOTableException {
  84 + LOGGER.info("getEPNCoreTableNameTest");
183 85 EpnTapConnection facade = new EpnTapConnection();
184 86  
185   - final List<String> attributes = new ArrayList<>();
186   - attributes.add("access_url");
187   - attributes.add("short_name");
188   -
189   - VOTABLE voTable = facade.getEPNService(AMDA_IVOID, attributes);
190   - VOTableData data = ServiceCtrl.getVoTableData(voTable);
  87 + String epnCoreTableName = facade.getEPNCoreTableName(AMDA_IVOID);
191 88  
192   - assertEquals(1, data.getNbRows());
193   - assertEquals(2, data.getNbColumns());
194   - assertTrue("Column name short_name not found.", data.isContainingColumnName("access_url"));
195   - assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
196   - assertEquals(AMDA_ACCESS_URL, data.getCell(0, "access_url"));
197   - assertEquals(AMDA_SHORT_NAME, data.getCell(0, "short_name"));
  89 + assertEquals("amdadb.epn_core", epnCoreTableName);
198 90 }
199 91  
200 92 /**
... ... @@ -262,6 +154,8 @@ public class EpnTapConnectionTest {
262 154 assertEquals(AMDA_SHORT_NAME, amda.get("short_name"));
263 155 }
264 156  
  157 + // *** Services ***
  158 +
265 159 /**
266 160 * Unit test for the class {@link EpnTapConnection#getEPNServices(List, List)}.
267 161 *
... ... @@ -296,23 +190,111 @@ public class EpnTapConnectionTest {
296 190 assertEquals(AMDA_ACCESS_URL, data.getCell(0, "access_url"));
297 191 }
298 192  
299   - // *** Getters ***
  193 + /**
  194 + * Unit test for the class {@link EpnTapConnection#getEPNService(String)}.
  195 + *
  196 + * @throws VOTableException Can not get the VOTable corresponding to the service.
  197 + */
  198 + @Test
  199 + public void getEPNServiceTest() throws VOTableException {
  200 + LOGGER.info("getEPNServiceTest");
  201 + EpnTapConnection facade = new EpnTapConnection();
  202 +
  203 + VOTABLE voTable = facade.getEPNService(AMDA_IVOID);
  204 + VOTableData data = ServiceCtrl.getVoTableData(voTable);
  205 +
  206 + assertEquals(1, data.getNbRows());
  207 + assertTrue("Column name ivoid not found.", data.isContainingColumnName("ivoid"));
  208 + assertTrue("Column name short_name not found.", data.isContainingColumnName("access_url"));
  209 + assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
  210 + assertEquals(AMDA_IVOID, data.getCell(0, "ivoid"));
  211 + assertEquals(AMDA_ACCESS_URL, data.getCell(0, "access_url"));
  212 + assertEquals(AMDA_SHORT_NAME, data.getCell(0, "short_name"));
  213 + }
300 214  
301 215 /**
302   - * Unit test for the class {@link EpnTapConnection#getEPNCoreTableName(String)}.
  216 + * Unit test for the class {@link EpnTapConnection#getEPNService(String, List)}.
303 217 *
304 218 * @throws VOTableException Can not get the VOTable corresponding to the service.
305 219 */
306 220 @Test
307   - public void getEPNCoreTableNameTest() throws VOTableException {
308   - LOGGER.info("getEPNCoreTableNameTest");
  221 + public void getEPNServiceWithAttributesTest() throws VOTableException {
  222 + LOGGER.info("getEPNServiceWithAttributesTest");
309 223 EpnTapConnection facade = new EpnTapConnection();
310 224  
311   - String epnCoreTableName = facade.getEPNCoreTableName(AMDA_IVOID);
  225 + final List<String> attributes = new ArrayList<>();
  226 + attributes.add("access_url");
  227 + attributes.add("short_name");
312 228  
313   - assertEquals("amdadb.epn_core", epnCoreTableName);
  229 + VOTABLE voTable = facade.getEPNService(AMDA_IVOID, attributes);
  230 + VOTableData data = ServiceCtrl.getVoTableData(voTable);
  231 +
  232 + assertEquals(1, data.getNbRows());
  233 + assertEquals(2, data.getNbColumns());
  234 + assertTrue("Column name short_name not found.", data.isContainingColumnName("access_url"));
  235 + assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
  236 + assertEquals(AMDA_ACCESS_URL, data.getCell(0, "access_url"));
  237 + assertEquals(AMDA_SHORT_NAME, data.getCell(0, "short_name"));
  238 + }
  239 +
  240 + /**
  241 + * Unit test for the class {@link EpnTapConnection#getEPNVOResources()}.
  242 + *
  243 + * @throws VOResourceException Can not get the VOresource.
  244 + */
  245 + @Test
  246 + public void getEPNVOResourcesTest() throws VOResourceException {
  247 + LOGGER.info("getEPNVOResourcesTest");
  248 + EpnTapConnection facade = new EpnTapConnection();
  249 +
  250 + List<Resource> resources = facade.getEPNVOResources();
  251 +
  252 + int nbResources = resources.size();
  253 + assertTrue(nbResources + " ∉ [13;20]", nbResources >= 13 && nbResources <= 20);
  254 +
  255 + Resource amda = null;
  256 + Resource apis = null;
  257 + for (Resource resource : resources) {
  258 + if (AMDA_IVOID.equals(resource.getIdentifier())) {
  259 + amda = resource;
  260 + }
  261 + if (APIS_IVOID.equals(resource.getIdentifier())) {
  262 + apis = resource;
  263 + }
  264 + }
  265 + assertNotNull("AMDA resource should be present.", amda);
  266 + assertNotNull("APIS resource should be present.", apis);
  267 + assertEquals(AMDA_SHORT_NAME, amda.getShortName());
  268 + assertEquals(APIS_SHORT_NAME, apis.getShortName());
  269 + }
  270 +
  271 + /**
  272 + * Unit test for the class {@link EpnTapConnection#getEPNVOResources(List)}.
  273 + *
  274 + * @throws VOResourceException Can not get the VOresource.
  275 + */
  276 + @Test
  277 + public void getEPNVOResourcesWithKeywordsTest() throws VOResourceException {
  278 + LOGGER.info("getEPNVOResourcesWithKeywordsTest");
  279 + EpnTapConnection facade = new EpnTapConnection();
  280 +
  281 + final List<String> keywords = new ArrayList<>();
  282 + keywords.add(AMDA_SUBJECT);
  283 + List<Resource> resources = facade.getEPNVOResources(keywords);
  284 +
  285 + assertEquals(resources.size(), 1);
  286 +
  287 + Resource amda = null;
  288 + for (Resource resource : resources) {
  289 + if (AMDA_IVOID.equals(resource.getIdentifier())) {
  290 + amda = resource;
  291 + }
  292 + }
  293 + assertNotNull("AMDA resource should be present.", amda);
314 294 }
315 295  
  296 + // *** Getters ***
  297 +
316 298 /**
317 299 * Unit test for the class {@link EpnTapConnection#getTAPURL(String)}.
318 300 *
... ... @@ -328,6 +310,24 @@ public class EpnTapConnectionTest {
328 310 assertEquals("http://cdpp-epntap.cesr.fr/__system__/tap/run/tap", tapURL);
329 311 }
330 312  
  313 + /**
  314 + * Unit test for the class {@link EpnTapConnection#getEPNVOresource(String)}.
  315 + *
  316 + * @throws VOResourceException Can not get the VOresource.
  317 + */
  318 + @Test
  319 + public void getVOResourceTest() throws VOResourceException {
  320 + LOGGER.info("getVOResourceTest");
  321 + EpnTapConnection facade = new EpnTapConnection();
  322 +
  323 + Resource resource = facade.getEPNVOresource(AMDA_IVOID);
  324 +
  325 + assertEquals("AMDA", resource.getShortName());
  326 + assertEquals("CDPP AMDA DataBase", resource.getTitle());
  327 + assertEquals("Centre de Données de la Physique des Plasmas",
  328 + resource.getCuration().getCreator().get(0).getName().getValue());
  329 + }
  330 +
331 331 // *** Queries ***
332 332  
333 333 /**
... ...
src/test/java/eu/omp/irap/vespa/epntapclient/granule/GranuleTest.java
... ... @@ -28,12 +28,6 @@ import org.junit.Test;
28 28 */
29 29 public class GranuleTest {
30 30  
31   - public static Granule createIncompleteGranule() {
32   - Granule incompleteGranule = new Granule("Mercury");
33   - incompleteGranule.setGranuleGid("Planet");
34   - return incompleteGranule;
35   - }
36   -
37 31 public static Granule createCompleteGranule() {
38 32 Granule completeGranule = new Granule("Mercury");
39 33 completeGranule.setGranuleGid("Planet");
... ... @@ -82,6 +76,12 @@ public class GranuleTest {
82 76 return completeGranule;
83 77 }
84 78  
  79 + public static Granule createIncompleteGranule() {
  80 + Granule incompleteGranule = new Granule("Mercury");
  81 + incompleteGranule.setGranuleGid("Planet");
  82 + return incompleteGranule;
  83 + }
  84 +
85 85 @Test
86 86 public static void isNotValidTest() {
87 87 assertFalse("The incomplete granule is valid.", createIncompleteGranule().isValid());
... ...