author | František Kučera <franta-hg@frantovo.cz> |
Tue, 26 Feb 2019 18:19:49 +0100 | |
branch | v_0 |
changeset 236 | a3ec71fa8e17 |
parent 203 | 504c4ba56d1c |
permissions | -rw-r--r-- |
203
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
/** |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
* SQL-DK |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
* Copyright © 2015 František Kučera (frantovo.cz) |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
* |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
* This program is free software: you can redistribute it and/or modify |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
* the Free Software Foundation, either version 3 of the License, or |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
* (at your option) any later version. |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
* |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
* |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
*/ |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
package info.globalcode.sql.dk.configuration; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
import javax.xml.bind.annotation.XmlAttribute; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
21 |
import javax.xml.bind.annotation.XmlEnum; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
22 |
import javax.xml.bind.annotation.XmlEnumValue; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
23 |
import javax.xml.bind.annotation.XmlValue; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
24 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
25 |
/** |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
26 |
* |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
27 |
* @author Ing. František Kučera (frantovo.cz) |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
28 |
*/ |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
29 |
public class CommandArgument { |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
30 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
31 |
private String value; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
32 |
private TYPE type; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
33 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
34 |
@XmlEnum |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
35 |
public static enum TYPE { |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
36 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
37 |
/** |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
38 |
* value = literal (text) argument |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
39 |
*/ |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
40 |
@XmlEnumValue("literal") |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
41 |
LITERAL, |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
42 |
/** |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
43 |
* value will be substituted by hostname or IP address of the DB server |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
44 |
*/ |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
45 |
@XmlEnumValue("host") |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
46 |
HOST, |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
47 |
/** |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
48 |
* value will be substituted by the port of the DB server |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
49 |
*/ |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
50 |
@XmlEnumValue("port") |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
51 |
PORT, |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
52 |
/** |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
53 |
* value will be substituted by environmental variable of given name |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
54 |
*/ |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
55 |
@XmlEnumValue("env") |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
56 |
ENVIRONMENT_VARIABLE, |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
57 |
/** |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
58 |
* value will be substituted by database property of given name |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
59 |
*/ |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
60 |
@XmlEnumValue("dbProperty") |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
61 |
DB_PROPERTY; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
62 |
} |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
63 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
64 |
@XmlValue |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
65 |
public String getValue() { |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
66 |
return value; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
67 |
} |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
68 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
69 |
public void setValue(String value) { |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
70 |
this.value = value; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
71 |
} |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
72 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
73 |
@XmlAttribute(name = "type") |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
74 |
public TYPE getType() { |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
75 |
return type; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
76 |
} |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
77 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
78 |
public void setType(TYPE type) { |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
79 |
this.type = type; |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
80 |
} |
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
81 |
|
504c4ba56d1c
connection tunnelling: configuration and logging
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
82 |
} |