|
21 | 21 | import org.apache.seatunnel.api.configuration.Options;
|
22 | 22 | import org.apache.seatunnel.api.configuration.util.OptionRule;
|
23 | 23 |
|
24 |
| -public interface JdbcCatalogOptions { |
25 |
| - Option<String> BASE_URL = |
| 24 | +public class JdbcCatalogOptions { |
| 25 | + public static final Option<String> BASE_URL = |
26 | 26 | Options.key("base-url")
|
27 | 27 | .stringType()
|
28 | 28 | .noDefaultValue()
|
29 | 29 | .withDescription(
|
30 | 30 | "URL has to be with database, like \"jdbc:mysql://localhost:5432/db\" or"
|
31 | 31 | + "\"jdbc:mysql://localhost:5432/db?useSSL=true\".");
|
32 | 32 |
|
33 |
| - Option<String> USERNAME = |
| 33 | + public static final Option<String> USERNAME = |
34 | 34 | Options.key("username")
|
35 | 35 | .stringType()
|
36 | 36 | .noDefaultValue()
|
37 | 37 | .withDescription(
|
38 | 38 | "Name of the database to use when connecting to the database server.");
|
39 | 39 |
|
40 |
| - Option<String> PASSWORD = |
| 40 | + public static final Option<String> PASSWORD = |
41 | 41 | Options.key("password")
|
42 | 42 | .stringType()
|
43 | 43 | .noDefaultValue()
|
44 | 44 | .withDescription("Password to use when connecting to the database server.");
|
45 | 45 |
|
46 |
| - Option<String> SCHEMA = |
| 46 | + public static final Option<String> SCHEMA = |
47 | 47 | Options.key("schema")
|
48 | 48 | .stringType()
|
49 | 49 | .noDefaultValue()
|
50 | 50 | .withDescription(
|
51 | 51 | "for databases that support the schema parameter, give it priority.");
|
52 | 52 |
|
53 |
| - Option<String> COMPATIBLE_MODE = |
| 53 | + public static final Option<String> COMPATIBLE_MODE = |
54 | 54 | Options.key("compatibleMode")
|
55 | 55 | .stringType()
|
56 | 56 | .noDefaultValue()
|
57 | 57 | .withDescription(
|
58 | 58 | "The compatible mode of database, required when the database supports multiple compatible modes. "
|
59 | 59 | + "For example, when using OceanBase database, you need to set it to 'mysql' or 'oracle'.");
|
60 | 60 |
|
61 |
| - OptionRule.Builder BASE_RULE = |
62 |
| - OptionRule.builder().required(BASE_URL).required(USERNAME, PASSWORD).optional(SCHEMA); |
63 |
| - |
64 |
| - Option<String> TABLE_PREFIX = |
| 61 | + public static final Option<String> TABLE_PREFIX = |
65 | 62 | Options.key("tablePrefix")
|
66 | 63 | .stringType()
|
67 | 64 | .noDefaultValue()
|
68 | 65 | .withDescription(
|
69 | 66 | "The table prefix name added when the table is automatically created");
|
70 | 67 |
|
71 |
| - Option<String> TABLE_SUFFIX = |
| 68 | + public static final Option<String> TABLE_SUFFIX = |
72 | 69 | Options.key("tableSuffix")
|
73 | 70 | .stringType()
|
74 | 71 | .noDefaultValue()
|
75 | 72 | .withDescription(
|
76 | 73 | "The table suffix name added when the table is automatically created");
|
| 74 | + |
| 75 | + public static OptionRule.Builder base() { |
| 76 | + return OptionRule.builder() |
| 77 | + .required(BASE_URL) |
| 78 | + .required(USERNAME, PASSWORD) |
| 79 | + .optional(SCHEMA); |
| 80 | + } |
77 | 81 | }
|
0 commit comments