Commit 84dce2440fbf9dc8cf5068b6b8b5b8faf5cd0bdf
1 parent
43ee4026
Exists in
master
Add VOTableApp.java in order to launch VOTable as standalone.
Showing
1 changed file
with
81 additions
and
0 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/votable/VOTableApp.java
0 → 100644
... | ... | @@ -0,0 +1,81 @@ |
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.votable; | |
18 | + | |
19 | +import javax.swing.JFrame; | |
20 | +import javax.swing.SwingUtilities; | |
21 | + | |
22 | +import com.google.gson.Gson; | |
23 | + | |
24 | +import eu.omp.irap.vespa.epntapclient.utils.Log; | |
25 | +import eu.omp.irap.vespa.epntapclient.votable.controller.VOTableController; | |
26 | + | |
27 | +/** | |
28 | + * Simple class to have a main function to display a voTable from a XML file. | |
29 | + * | |
30 | + * @author N. Jourdane | |
31 | + */ | |
32 | +public class VOTableApp { | |
33 | + | |
34 | + /** | |
35 | + * Main function to start the application as standalone. | |
36 | + * | |
37 | + * <pre> | |
38 | + * **Usage 1**: `VOtableApp pathToVOTable` | |
39 | + * Display the VOTable stored in the specified XML file. | |
40 | + * - `pathToVOTable`: The path to an XML file representing a VOtable; | |
41 | + * | |
42 | + * **Usage 2**: `VOtableApp targetURL type language query` | |
43 | + * Display the VOTable resulting the service or registry request. | |
44 | + * - `targetURL`: The URL of the service or registry to ask, ie `http://cdpp-epntap.cesr.fr`; | |
45 | + * - `type`: The service type, ie `tap`; | |
46 | + * - `language`: The language of the query, ie `ADQL`; | |
47 | + * - `query`: The query in the specified language in double quotes, ie. `"SELECT * FROM amdadb.epn_core"` | |
48 | + * </pre> | |
49 | + * | |
50 | + * @param args The program arguments | |
51 | + */ | |
52 | + public static void main(String[] args) { | |
53 | + SwingUtilities.invokeLater(new Runnable() { | |
54 | + @Override | |
55 | + public void run() { | |
56 | + VOTableController voTableControl; | |
57 | + Log.LOGGER | |
58 | + .info("Lauching VOTable app with arguments:\n " + new Gson().toJson(args)); | |
59 | + if (args.length == 1) { | |
60 | + voTableControl = new VOTableController(args[0]); | |
61 | + } else if (args.length == 4) { | |
62 | + voTableControl = new VOTableController(args[0], args[1], args[2], args[3]); | |
63 | + } else { | |
64 | + System.out.println( | |
65 | + "Usage: VOtableApp path/to/VOTable.xml"); | |
66 | + System.out.println( | |
67 | + "OR: VOtableApp http://url.to.service/or/registry type language \"YOUR QUERY\""); | |
68 | + return; | |
69 | + } | |
70 | + | |
71 | + JFrame frame = new JFrame(args[0]); | |
72 | + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
73 | + frame.setContentPane(voTableControl.getView()); | |
74 | + frame.setVisible(true); | |
75 | + // frame.pack(); | |
76 | + frame.setSize(800, 600); | |
77 | + frame.setLocationRelativeTo(null); | |
78 | + } | |
79 | + }); | |
80 | + } | |
81 | +} | |
0 | 82 | \ No newline at end of file | ... | ... |