Commit 787485aa12231433b538f6e812f5138ad87e8322
1 parent
fe9b171e
Exists in
master
remove old EPN-TAP model files, the model classes generated by XJC should be used instead.
Showing
4 changed files
with
0 additions
and
399 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/model/EpnTapModel.java deleted
... | ... | @@ -1,102 +0,0 @@ |
1 | -/** | |
2 | - * This file is a part of EpnTAPClient. | |
3 | - * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | |
4 | - * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | |
5 | - * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | |
6 | - * | |
7 | - * This program is free software: you can | |
8 | - * redistribute it and/or modify it under the terms of the GNU General Public License as published | |
9 | - * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | |
10 | - * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY | |
11 | - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
12 | - * PURPOSE. See the GNU General Public License for more details. You should have received a copy of | |
13 | - * the GNU General Public License along with this program. If not, see | |
14 | - * <http://www.gnu.org/licenses/>. | |
15 | - */ | |
16 | - | |
17 | -package eu.omp.irap.vespa.epntapclient.model; | |
18 | - | |
19 | -import java.net.URLEncoder; | |
20 | -import java.util.logging.Level; | |
21 | - | |
22 | -import eu.omp.irap.vespa.epntapclient.controller.HTTPConnection; | |
23 | -import eu.omp.irap.vespa.epntapclient.controller.TAPServices; | |
24 | -import eu.omp.irap.vespa.epntapclient.utils.Const; | |
25 | -import eu.omp.irap.vespa.epntapclient.utils.Err; | |
26 | -import eu.omp.irap.vespa.epntapclient.utils.Log; | |
27 | - | |
28 | -// TODO: Tests other queries to get more columns. | |
29 | -/** | |
30 | - * The main class of the EPN-TAP model. | |
31 | - * | |
32 | - * @author N. Jourdane | |
33 | - */ | |
34 | -public class EpnTapModel { | |
35 | - | |
36 | - /** The parameters sent to the HTTP request, except type and query. */ | |
37 | - private static final String QUERY_PARAMETERS = "REQUEST=doQuery&LANG=ADQL"; //$NON-NLS-1$ | |
38 | - | |
39 | - /** The type of service to get. */ | |
40 | - private static final String TYPE = "tap"; //$NON-NLS-1$ | |
41 | - | |
42 | - /** The name of the XML file returned by the request. */ | |
43 | - private static String xmlFileName = Const.TMP_DIR + "/job.xml"; //$NON-NLS-1$ | |
44 | - | |
45 | - /** A list of available registry URLs. */ | |
46 | - @SuppressWarnings("nls") | |
47 | - private static String[] AVAILABLE_REGISTRIES = { "http://dc.zah.uni-heidelberg.de", | |
48 | - "http://reg.g-vo.org", | |
49 | - "http://gavo.aip.de" }; | |
50 | - | |
51 | - /** The query used to get the list of EPN services. */ | |
52 | - @SuppressWarnings("nls") | |
53 | - private static String QUERY = "SELECT ivoid, short_name, res_title, reference_url, base_role, role_name, " | |
54 | - + "email, intf_index, access_url, standard_id, cap_type, cap_description, " | |
55 | - + "std_version, res_subjects " | |
56 | - + "FROM rr.resource AS res " | |
57 | - + "NATURAL JOIN rr.interface " | |
58 | - + "NATURAL JOIN rr.capability " | |
59 | - + "NATURAL LEFT OUTER JOIN rr.res_role " | |
60 | - + "NATURAL LEFT OUTER JOIN (SELECT ivoid, ivo_string_agg(res_subject, ', ') " | |
61 | - + "AS res_subjects " | |
62 | - + "FROM rr.res_subject GROUP BY ivoid) AS sbj " | |
63 | - + "WHERE (base_role='contact' OR base_role='publisher' OR base_role IS NULL) " | |
64 | - + "AND standard_id='ivo://ivoa.net/std/tap' AND intf_type='vs:paramhttp' " | |
65 | - + "AND ((1=ivo_nocasematch(short_name, '%epn%') " | |
66 | - + "OR 1=ivo_hasword(res_title, 'epn') OR 1=ivo_hasword(res_subjects, 'epn') " | |
67 | - + "OR 1=ivo_nocasematch(ivoid, '%epn%') OR (base_role='publisher' " | |
68 | - + "AND 1=ivo_nocasematch(role_name, '%epn%'))))"; | |
69 | - | |
70 | - /** | |
71 | - * Method constructor | |
72 | - */ | |
73 | - public EpnTapModel() { | |
74 | - | |
75 | - } | |
76 | - | |
77 | - /** | |
78 | - * @return the TAP services corresponding to the query response. | |
79 | - */ | |
80 | - public static TAPServices getEPNTAPServices() { | |
81 | - String url = AVAILABLE_REGISTRIES[0]; | |
82 | - | |
83 | - try { | |
84 | - @SuppressWarnings("nls") | |
85 | - int responseCode = HTTPConnection.sendGet(url + "/" + TYPE + "/sync", | |
86 | - QUERY_PARAMETERS + "&QUERY=" | |
87 | - + URLEncoder.encode(QUERY, Const.CHARACTER_SET).replace("+", "%20"), | |
88 | - xmlFileName); | |
89 | - if (responseCode != 200) { | |
90 | - Log.LOGGER.log(Level.SEVERE, Err.BAD_HTTP_RESPONSE_CODE); | |
91 | - throw new Exception(Err.BAD_HTTP_RESPONSE_CODE); | |
92 | - } | |
93 | - } catch (Exception e1) { | |
94 | - Log.LOGGER.log(Level.SEVERE, Err.BAD_REQUEST, e1); | |
95 | - } | |
96 | - | |
97 | - TAPServices services = new TAPServices(xmlFileName); | |
98 | - services.fillServices(); | |
99 | - return services; | |
100 | - // services.printToFile(servicesFileName); | |
101 | - } | |
102 | -} |
src/main/java/eu/omp/irap/vespa/epntapclient/model/TAPField.java deleted
... | ... | @@ -1,153 +0,0 @@ |
1 | -/** | |
2 | - * This file is a part of EpnTAPClient. | |
3 | - * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | |
4 | - * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | |
5 | - * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | |
6 | - * | |
7 | - * This program is free software: you can | |
8 | - * redistribute it and/or modify it under the terms of the GNU General Public License as published | |
9 | - * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | |
10 | - * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY | |
11 | - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
12 | - * PURPOSE. See the GNU General Public License for more details. You should have received a copy of | |
13 | - * the GNU General Public License along with this program. If not, see | |
14 | - * <http://www.gnu.org/licenses/>. | |
15 | - */ | |
16 | - | |
17 | -package eu.omp.irap.vespa.epntapclient.model; | |
18 | - | |
19 | -import org.w3c.dom.Element; | |
20 | -import org.w3c.dom.Node; | |
21 | - | |
22 | -/** | |
23 | - * An object representing a VOTable column. | |
24 | - * | |
25 | - * @author N. Jourdane | |
26 | - */ | |
27 | -public class TAPField { | |
28 | - | |
29 | - /** The ID property of the VOTable column. */ | |
30 | - private String id; | |
31 | - | |
32 | - /** The arraySize property of the VOTable column. */ | |
33 | - private String arraySize; | |
34 | - | |
35 | - /** The datatype property of the VOTable column. */ | |
36 | - private String datatype; | |
37 | - | |
38 | - /** The name property of the VOTable column. */ | |
39 | - private String name; | |
40 | - | |
41 | - /** The ucd property of the VOTable column. */ | |
42 | - private String ucd; | |
43 | - | |
44 | - /** The utype property of the VOTable column. */ | |
45 | - private String utype; | |
46 | - | |
47 | - /** The description of the VOTable column. */ | |
48 | - private String description; | |
49 | - | |
50 | - /** | |
51 | - * Method constructor | |
52 | - * | |
53 | - * @param id The ID property of the VOTable column. | |
54 | - * @param arraySize The arraySize property of the VOTable column. | |
55 | - * @param datatype The datatype property of the VOTable column. | |
56 | - * @param name The name property of the VOTable column. | |
57 | - * @param ucd The ucd property of the VOTable column. | |
58 | - * @param utype The utype property of the VOTable column. | |
59 | - * @param description The description of the VOTable column. | |
60 | - */ | |
61 | - public TAPField(String id, String arraySize, String datatype, String name, String ucd, | |
62 | - String utype, String description) { | |
63 | - this.id = id; | |
64 | - this.arraySize = arraySize; | |
65 | - this.datatype = datatype; | |
66 | - this.name = name; | |
67 | - this.ucd = ucd; | |
68 | - this.utype = utype; | |
69 | - this.description = description; | |
70 | - } | |
71 | - | |
72 | - /** | |
73 | - * Method constructor | |
74 | - * | |
75 | - * @param node The XML node of the column. | |
76 | - */ | |
77 | - public TAPField(Node node) { | |
78 | - id = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_ID); | |
79 | - arraySize = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_ARRAYSIZE); | |
80 | - datatype = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_DATATYPE); | |
81 | - name = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_NAME); | |
82 | - ucd = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_UCD); | |
83 | - utype = ((Element) node).getAttribute(VOTableTags.DOM_ATTR_UTYPE); | |
84 | - try { | |
85 | - description = ((Element) node).getElementsByTagName(VOTableTags.DOM_TAG_DESCRIPTION) | |
86 | - .item(0) | |
87 | - .getTextContent(); | |
88 | - } catch (@SuppressWarnings("unused") NullPointerException e) { | |
89 | - description = new String(); | |
90 | - } | |
91 | - } | |
92 | - | |
93 | - @SuppressWarnings("nls") | |
94 | - @Override | |
95 | - public String toString() { | |
96 | - return VOTableTags.DOM_ATTR_ID + ": " + id + "\n\t" + | |
97 | - VOTableTags.DOM_ATTR_ARRAYSIZE + ": " + arraySize + "\n\t" + | |
98 | - VOTableTags.DOM_ATTR_DATATYPE + ": " + datatype + "\n\t" + | |
99 | - VOTableTags.DOM_ATTR_NAME + ": " + name + "\n\t" + | |
100 | - VOTableTags.DOM_ATTR_UCD + ": " + ucd + "\n\t" + | |
101 | - VOTableTags.DOM_ATTR_UTYPE + ": " + utype + "\n\t" + | |
102 | - VOTableTags.DOM_TAG_DESCRIPTION + ": " + description + "\n"; | |
103 | - } | |
104 | - | |
105 | - /** | |
106 | - * @return The ID of the column. | |
107 | - */ | |
108 | - public String getId() { | |
109 | - return id; | |
110 | - } | |
111 | - | |
112 | - /** | |
113 | - * @return The arraySize of the column. | |
114 | - */ | |
115 | - public String getArraySize() { | |
116 | - return arraySize; | |
117 | - } | |
118 | - | |
119 | - /** | |
120 | - * @return The dataType of the column. | |
121 | - */ | |
122 | - public String getDatatype() { | |
123 | - return datatype; | |
124 | - } | |
125 | - | |
126 | - /** | |
127 | - * @return The name of the column. | |
128 | - */ | |
129 | - public String getName() { | |
130 | - return name; | |
131 | - } | |
132 | - | |
133 | - /** | |
134 | - * @return The UCD of the column. | |
135 | - */ | |
136 | - public String getUcd() { | |
137 | - return ucd; | |
138 | - } | |
139 | - | |
140 | - /** | |
141 | - * @return The UType of the column. | |
142 | - */ | |
143 | - public String getUtype() { | |
144 | - return utype; | |
145 | - } | |
146 | - | |
147 | - /** | |
148 | - * @return The description of the column. | |
149 | - */ | |
150 | - public String getDescription() { | |
151 | - return description; | |
152 | - } | |
153 | -} |
src/main/java/eu/omp/irap/vespa/epntapclient/model/TAPService.java deleted
... | ... | @@ -1,81 +0,0 @@ |
1 | -/** | |
2 | - * This file is a part of EpnTAPClient. | |
3 | - * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | |
4 | - * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | |
5 | - * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | |
6 | - * | |
7 | - * This program is free software: you can | |
8 | - * redistribute it and/or modify it under the terms of the GNU General Public License as published | |
9 | - * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | |
10 | - * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY | |
11 | - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
12 | - * PURPOSE. See the GNU General Public License for more details. You should have received a copy of | |
13 | - * the GNU General Public License along with this program. If not, see | |
14 | - * <http://www.gnu.org/licenses/>. | |
15 | - */ | |
16 | - | |
17 | -package eu.omp.irap.vespa.epntapclient.model; | |
18 | - | |
19 | -import java.util.HashMap; | |
20 | -import java.util.Map; | |
21 | -import java.util.StringJoiner; | |
22 | - | |
23 | -/** | |
24 | - * An object representing a TAP service, extracted from a VOTable. | |
25 | - * | |
26 | - * @author N. Jourdane | |
27 | - */ | |
28 | -public class TAPService { | |
29 | - /** The map containing the services properties, as (key, value). */ | |
30 | - private Map<String, Object> map = new HashMap<>(); | |
31 | - | |
32 | - /** | |
33 | - * Method constructor | |
34 | - */ | |
35 | - public TAPService() { | |
36 | - map = new HashMap<>(); | |
37 | - } | |
38 | - | |
39 | - /** | |
40 | - * @param key The key of the property to set. | |
41 | - * @param value The value of the property to set. | |
42 | - */ | |
43 | - public void setProperty(String key, Object value) { | |
44 | - map.put(key, value); | |
45 | - } | |
46 | - | |
47 | - /** | |
48 | - * @param key The key of the property to get. | |
49 | - */ | |
50 | - public void getProperty(String key) { | |
51 | - map.get(key); | |
52 | - } | |
53 | - | |
54 | - /** | |
55 | - * @return The list of all the keys for this service. | |
56 | - */ | |
57 | - public String[] getKeys() { | |
58 | - return map.keySet().toArray(new String[0]); | |
59 | - } | |
60 | - | |
61 | - /** | |
62 | - * @return An array containing all the values, sorted as the same order as the values were | |
63 | - * inserted. | |
64 | - */ | |
65 | - public Object[] getValuesArray() { | |
66 | - return map.values().toArray(); | |
67 | - } | |
68 | - | |
69 | - @Override | |
70 | - public String toString() { | |
71 | - StringJoiner joiner = new StringJoiner("\n"); //$NON-NLS-1$ | |
72 | - if (map.size() == 0) { | |
73 | - return new String(); | |
74 | - } | |
75 | - | |
76 | - for (Map.Entry<String, Object> entry : map.entrySet()) { | |
77 | - joiner.add(entry.getKey() + ": " + entry.getValue()); //$NON-NLS-1$ | |
78 | - } | |
79 | - return joiner.toString(); | |
80 | - } | |
81 | -} |
src/main/java/eu/omp/irap/vespa/epntapclient/model/VOTableTags.java deleted
... | ... | @@ -1,63 +0,0 @@ |
1 | -/** | |
2 | - * This file is a part of EpnTAPClient. | |
3 | - * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | |
4 | - * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | |
5 | - * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | |
6 | - * | |
7 | - * This program is free software: you can | |
8 | - * redistribute it and/or modify it under the terms of the GNU General Public License as published | |
9 | - * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | |
10 | - * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY | |
11 | - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
12 | - * PURPOSE. See the GNU General Public License for more details. You should have received a copy of | |
13 | - * the GNU General Public License along with this program. If not, see | |
14 | - * <http://www.gnu.org/licenses/>. | |
15 | - */ | |
16 | -package eu.omp.irap.vespa.epntapclient.model; | |
17 | - | |
18 | -/** | |
19 | - * This class define all string literals used to parse and analyze the VOTable XML document, such as | |
20 | - * tag and attribute names. | |
21 | - * | |
22 | - * @author N. Jourdane | |
23 | - */ | |
24 | -@SuppressWarnings("nls") | |
25 | -public class VOTableTags { | |
26 | - /** | |
27 | - * The keyword used to define unicode strings type as `datatype` attribute in the `FIELD` node. | |
28 | - */ | |
29 | - public static final String UNICODE_CHAR_TYPE = "unicodeChar"; | |
30 | - | |
31 | - /** | |
32 | - * The keyword used to define short numbers type as `datatype` attribute in the `FIELD` node. | |
33 | - */ | |
34 | - public static final String SHORT_TYPE = "short"; | |
35 | - | |
36 | - /** Name of the `FIELD` node, containing columns informations. */ | |
37 | - public static final String TAG_NAME_FIELD = "FIELD"; | |
38 | - | |
39 | - /** Name of the `STREAM` node, containing services informations. */ | |
40 | - public static final String TAG_NAME_STREAM = "STREAM"; | |
41 | - | |
42 | - /** Name of the `ID` attribute of the `FIELD` node. */ | |
43 | - public static final String DOM_ATTR_ID = "ID"; | |
44 | - | |
45 | - /** Name of the `arraysize` attribute of the `FIELD` node. */ | |
46 | - public static final String DOM_ATTR_ARRAYSIZE = "arraysize"; | |
47 | - | |
48 | - /** Name of the `datatype` attribute of the `FIELD` node. */ | |
49 | - public static final String DOM_ATTR_DATATYPE = "datatype"; | |
50 | - | |
51 | - /** Name of the `name` attribute of the `FIELD` node. */ | |
52 | - public static final String DOM_ATTR_NAME = "name"; | |
53 | - | |
54 | - /** Name of the `ucd` attribute of the `FIELD` node. */ | |
55 | - public static final String DOM_ATTR_UCD = "ucd"; | |
56 | - | |
57 | - /** Name of the `utype` attribute of the `FIELD` node. */ | |
58 | - public static final String DOM_ATTR_UTYPE = "utype"; | |
59 | - | |
60 | - /** Name of the `DESCRIPTION` node. */ | |
61 | - public static final String DOM_TAG_DESCRIPTION = "DESCRIPTION"; | |
62 | - | |
63 | -} |