Mercurial > hg > monetdb-java
annotate src/main/java/org/monetdb/mcl/net/Parameter.java @ 939:fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Not just user, password, tls and cert.
author | Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> |
---|---|
date | Wed, 08 Jan 2025 15:41:48 +0100 (3 months ago) |
parents | 64ea9d5fbf87 |
children | c5e47b8a509c |
rev | line source |
---|---|
864
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
1 /* |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
2 * SPDX-License-Identifier: MPL-2.0 |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
3 * |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
4 * This Source Code Form is subject to the terms of the Mozilla Public |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
7 * |
937
d416e9b6b3d0
Update Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
931
diff
changeset
|
8 * Copyright 2024, 2025 MonetDB Foundation; |
864
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
9 * Copyright August 2008 - 2023 MonetDB B.V.; |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
10 * Copyright 1997 - July 2008 CWI. |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
11 */ |
b80758ef25db
Add missing license headers
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
847
diff
changeset
|
12 |
789
88c5b678e974
URL parser passes the tests.
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
diff
changeset
|
13 package org.monetdb.mcl.net; |
88c5b678e974
URL parser passes the tests.
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
diff
changeset
|
14 |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
15 import java.sql.DriverPropertyInfo; |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
16 import java.util.ArrayList; |
791
4de810c22328
Refactor
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
789
diff
changeset
|
17 import java.util.Calendar; |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
18 import java.util.Properties; |
791
4de810c22328
Refactor
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
789
diff
changeset
|
19 |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
20 /** |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
21 * Enumerates things that can be configured on a connection to MonetDB. |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
22 */ |
789
88c5b678e974
URL parser passes the tests.
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
diff
changeset
|
23 public enum Parameter { |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
24 // String name, ParameterType type, Object defaultValue, String description, boolean isCore |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
25 TLS("tls", ParameterType.Bool, false, "secure the connection using TLS", true, true), |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
26 HOST("host", ParameterType.Str, "", "IP number, domain name or one of the special values `localhost` and `localhost.`", true), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
27 PORT("port", ParameterType.Int, -1, "Port to connect to, 1..65535 or -1 for 'not set'", true), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
28 DATABASE("database", ParameterType.Str, "", "name of database to connect to", true), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
29 TABLESCHEMA("tableschema", ParameterType.Str, "", "only used for REMOTE TABLE, otherwise unused", true), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
30 TABLE("table", ParameterType.Str, "", "only used for REMOTE TABLE, otherwise unused", true), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
31 SOCK("sock", ParameterType.Path, "", "path to Unix domain socket to connect to", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
32 SOCKDIR("sockdir", ParameterType.Path, "/tmp", "Directory for implicit Unix domain sockets (.s.monetdb.PORT)", false), |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
33 CERT("cert", ParameterType.Path, "", "path to TLS certificate to authenticate server with", false, true), |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
34 CERTHASH("certhash", ParameterType.Str, "", "hash of server TLS certificate must start with these hex digits; overrides cert", false, true), |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
35 CLIENTKEY("clientkey", ParameterType.Path, "", "path to TLS key (+certs) to authenticate with as client", false, true), |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
36 CLIENTCERT("clientcert", ParameterType.Path, "", "path to TLS certs for 'clientkey', if not included there", false, true), |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
37 USER("user", ParameterType.Str, "", "user name to authenticate as", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
38 PASSWORD("password", ParameterType.Str, "", "password to authenticate with", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
39 LANGUAGE("language", ParameterType.Str, "sql", "for example, \"sql\", \"mal\", \"msql\", \"profiler\"", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
40 AUTOCOMMIT("autocommit", ParameterType.Bool, true, "initial value of autocommit", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
41 SCHEMA("schema", ParameterType.Str, "", "initial schema", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
42 TIMEZONE("timezone", ParameterType.Int, null, "client time zone as minutes east of UTC", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
43 BINARY("binary", ParameterType.Str, "on", "whether to use binary result set format (number or bool)", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
44 REPLYSIZE("replysize", ParameterType.Int, 250, "rows beyond this limit are retrieved on demand, <1 means unlimited", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
45 FETCHSIZE("fetchsize", ParameterType.Int, null, "alias for replysize, specific to jdbc", false), |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
46 HASH("hash", ParameterType.Str, "", "specific to jdbc", false), |
868
a227deba0e26
Improve the code, layout, order of variables and setting, and text.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
867
diff
changeset
|
47 DEBUG("debug", ParameterType.Bool, false, "enable tracing of socket communication for debugging", false), |
a227deba0e26
Improve the code, layout, order of variables and setting, and text.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
867
diff
changeset
|
48 LOGFILE("logfile", ParameterType.Str, "", "when debug is enabled its output will be written to this logfile", false), |
a227deba0e26
Improve the code, layout, order of variables and setting, and text.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
867
diff
changeset
|
49 SO_TIMEOUT("so_timeout", ParameterType.Int, 0, "abort if network I/O does not complete in this many milliseconds, 0 means no timeout", false), |
916
2ec67179aa32
correct some Parameter descriptions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
903
diff
changeset
|
50 CLOB_AS_VARCHAR("treat_clob_as_varchar", ParameterType.Bool, true, "map CLOB/TEXT data to type VARCHAR instead of type CLOB", false), |
2ec67179aa32
correct some Parameter descriptions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
903
diff
changeset
|
51 BLOB_AS_BINARY("treat_blob_as_binary", ParameterType.Bool, true, "map BLOB data to type BINARY instead of type BLOB", false), |
903
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
52 |
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
53 CLIENT_INFO("client_info", ParameterType.Bool, true, "whether to send ClientInfo when connecting", false), |
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
54 CLIENT_APPLICATION("client_application", ParameterType.Str, "", "application name to send in ClientInfo", false), |
916
2ec67179aa32
correct some Parameter descriptions
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
903
diff
changeset
|
55 CLIENT_REMARK("client_remark", ParameterType.Str, "", "any client remark to send in ClientInfo", false), |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
56 ; |
789
88c5b678e974
URL parser passes the tests.
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
diff
changeset
|
57 |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
58 public final String name; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
59 public final ParameterType type; |
868
a227deba0e26
Improve the code, layout, order of variables and setting, and text.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
867
diff
changeset
|
60 private final Object defaultValue; |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
61 public final String description; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
62 public final boolean isCore; |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
63 public final boolean isTlsRelated; |
789
88c5b678e974
URL parser passes the tests.
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
diff
changeset
|
64 |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
65 Parameter(String name, ParameterType type, Object defaultValue, String description, boolean isCore, boolean isTlsRelated) { |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
66 this.name = name; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
67 this.type = type; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
68 this.defaultValue = defaultValue; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
69 this.description = description; |
868
a227deba0e26
Improve the code, layout, order of variables and setting, and text.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
867
diff
changeset
|
70 this.isCore = isCore; |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
71 this.isTlsRelated = isTlsRelated; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
72 } |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
73 |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
74 Parameter(String name, ParameterType type, Object defaultValue, String description, boolean isCore) { |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
75 this(name, type, defaultValue, description, isCore, false); |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
76 } |
789
88c5b678e974
URL parser passes the tests.
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
diff
changeset
|
77 |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
78 public static Parameter forName(String name) { |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
79 switch (name) { |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
80 case "tls": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
81 return TLS; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
82 case "host": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
83 return HOST; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
84 case "port": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
85 return PORT; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
86 case "database": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
87 return DATABASE; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
88 case "tableschema": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
89 return TABLESCHEMA; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
90 case "table": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
91 return TABLE; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
92 case "sock": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
93 return SOCK; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
94 case "sockdir": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
95 return SOCKDIR; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
96 case "cert": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
97 return CERT; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
98 case "certhash": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
99 return CERTHASH; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
100 case "clientkey": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
101 return CLIENTKEY; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
102 case "clientcert": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
103 return CLIENTCERT; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
104 case "user": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
105 return USER; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
106 case "password": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
107 return PASSWORD; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
108 case "language": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
109 return LANGUAGE; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
110 case "autocommit": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
111 return AUTOCOMMIT; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
112 case "schema": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
113 return SCHEMA; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
114 case "timezone": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
115 return TIMEZONE; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
116 case "binary": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
117 return BINARY; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
118 case "replysize": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
119 return REPLYSIZE; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
120 case "fetchsize": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
121 return FETCHSIZE; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
122 case "hash": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
123 return HASH; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
124 case "debug": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
125 return DEBUG; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
126 case "logfile": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
127 return LOGFILE; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
128 case "so_timeout": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
129 return SO_TIMEOUT; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
130 case "treat_clob_as_varchar": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
131 return CLOB_AS_VARCHAR; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
132 case "treat_blob_as_binary": |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
133 return BLOB_AS_BINARY; |
903
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
134 case "client_info": |
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
135 return CLIENT_INFO; |
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
136 case "client_application": |
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
137 return CLIENT_APPLICATION; |
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
138 case "client_remark": |
778959b2e0a4
Send ClientInfo on startup
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
878
diff
changeset
|
139 return CLIENT_REMARK; |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
140 default: |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
141 return null; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
142 } |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
143 } |
789
88c5b678e974
URL parser passes the tests.
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
diff
changeset
|
144 |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
145 /** |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
146 * Determine if a given setting can safely be ignored. |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
147 * The ground rule is that if we encounter an unknown setting |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
148 * without an underscore in the name, it is an error. If it has |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
149 * an underscore in its name, it can be ignored. |
847
4d80fd66541d
formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
834
diff
changeset
|
150 * |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
151 * @param name the name of the setting to check |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
152 * @return true if it can safely be ignored |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
153 */ |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
154 public static boolean isIgnored(String name) { |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
155 if (Parameter.forName(name) != null) |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
156 return false; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
157 return name.contains("_"); |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
158 } |
791
4de810c22328
Refactor
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
789
diff
changeset
|
159 |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
160 /** |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
161 * Return a default value for the given setting, as an Object of the appropriate type. |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
162 * Note that the value returned for TIMEZONE may change if the system time zone |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
163 * is changed or if Daylight Saving Time starts or ends. |
847
4d80fd66541d
formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
834
diff
changeset
|
164 * |
867
5a59910e8f87
Resolve some javadoc errors and warnings
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
864
diff
changeset
|
165 * @return default value for the given setting, as an Object of the appropriate type |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
166 */ |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
167 public Object getDefault() { |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
168 switch (this) { |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
169 case TIMEZONE: |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
170 Calendar cal = Calendar.getInstance(); |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
171 int offsetMillis = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET); |
878
dc33533e6468
Target timezone is in minutes, setTimeZone is in seconds
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
876
diff
changeset
|
172 int offsetMinutes = offsetMillis / 60000; |
dc33533e6468
Target timezone is in minutes, setTimeZone is in seconds
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
876
diff
changeset
|
173 return offsetMinutes; |
834
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
174 default: |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
175 return defaultValue; |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
176 } |
5aa19bbed0d6
Comments and formatting
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
806
diff
changeset
|
177 } |
876
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
178 |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
179 /** |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
180 * Determine if this Parameter is only relevant when TlS is enabled. |
876
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
181 * |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
182 * Such parameters need not be shown to the user unless the URL starts with <code>monetdbs://</code>. |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
183 * |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
184 * @return true if this Parameter is only relevant when TLS is enabled |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
185 */ |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
186 public boolean isTlsOnly() { |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
187 switch (this) { |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
188 case CERT: |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
189 case CERTHASH: |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
190 case CLIENTCERT: |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
191 case CLIENTKEY: |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
192 return true; |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
193 default: |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
194 return false; |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
195 } |
e2e7f0d72c95
Add Parameter#isTlsOnly method
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
868
diff
changeset
|
196 } |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
197 |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
198 /** |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
199 * Gets information about the possible properties for this driver. |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
200 * |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
201 * The getPropertyInfo method is intended to allow a generic GUI tool to |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
202 * discover what properties it should prompt a human for in order to get |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
203 * enough information to connect to a database. Note that depending on the |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
204 * values the human has supplied so far, additional values may become |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
205 * necessary, so it may be necessary to iterate through several calls to the |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
206 * getPropertyInfo method. |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
207 * |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
208 * Note: This method is called from jdbc.MonetDriver.getPropertyInfo() |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
209 * |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
210 * @param info a proposed list of tag/value pairs that will be sent on |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
211 * connect open |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
212 * @param includeTls include TLS related properties. |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
213 * @return an array of DriverPropertyInfo objects describing possible |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
214 * properties. This array may be an empty array if no properties |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
215 * are required. |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
216 */ |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
217 public static DriverPropertyInfo[] getPropertyInfo(final Properties info, boolean includeTls) { |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
218 final String[] booleanChoices = new String[] { "true", "false" }; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
219 final ArrayList<DriverPropertyInfo> mandatory = new ArrayList<>(Parameter.values().length); |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
220 final ArrayList<DriverPropertyInfo> optional = new ArrayList<>(Parameter.values().length); |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
221 |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
222 for (Parameter parm: Parameter.values()) { |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
223 if (!includeTls && parm.isTlsRelated) |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
224 continue; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
225 if (parm == Parameter.FETCHSIZE) // alias of REPLYSIZE |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
226 continue; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
227 String value = info == null ? null : info.getProperty(parm.name); |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
228 if (value == null) { |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
229 Object defaultValue = parm.getDefault(); |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
230 if (defaultValue != null) |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
231 value = defaultValue.toString(); |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
232 } |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
233 DriverPropertyInfo propInfo = new DriverPropertyInfo(parm.name, value); |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
234 propInfo.description = parm.description; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
235 if (parm.type == ParameterType.Bool) |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
236 propInfo.choices = booleanChoices; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
237 propInfo.required = (parm == Parameter.USER || parm == Parameter.PASSWORD); |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
238 if (propInfo.required) |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
239 mandatory.add(propInfo); |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
240 else |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
241 optional.add(propInfo); |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
242 } |
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
243 |
939
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
244 final DriverPropertyInfo[] result = new DriverPropertyInfo[mandatory.size() + optional.size()]; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
245 int i = 0; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
246 for (DriverPropertyInfo propInfo: mandatory) |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
247 result[i++] = propInfo; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
248 for (DriverPropertyInfo propInfo: optional) |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
249 result[i++] = propInfo; |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
250 |
fd938d0a2b3a
Include all Parameters in GetPropertyInfo
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
938
diff
changeset
|
251 return result; |
931
df18aa5c8a61
Add test for MonetDriver.getPropertyInfo(url, props).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
916
diff
changeset
|
252 } |
789
88c5b678e974
URL parser passes the tests.
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents:
diff
changeset
|
253 } |