-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#575] feat(jdbc): Support for DataSource and schema operations in JD…
…BC catalog. (#703) ### What changes were proposed in this pull request? We need to add management functionalities for data sources and operations on schemas in jdbc-common. ### Why are the changes needed? Fix: #575 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? UT --------- Co-authored-by: Clearvive <clearvive@datastrato.com>
- Loading branch information
Showing
19 changed files
with
778 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...og-jdbc-common/src/main/java/com/datastrato/gravitino/catalog/jdbc/config/JdbcConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright 2023 Datastrato. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
|
||
package com.datastrato.gravitino.catalog.jdbc.config; | ||
|
||
import com.datastrato.gravitino.Config; | ||
import com.datastrato.gravitino.config.ConfigBuilder; | ||
import com.datastrato.gravitino.config.ConfigEntry; | ||
import java.util.Map; | ||
|
||
public class JdbcConfig extends Config { | ||
|
||
public static final ConfigEntry<String> JDBC_URL = | ||
new ConfigBuilder("jdbc-url") | ||
.doc("The url of the Jdbc connection") | ||
.version("0.3.0") | ||
.stringConf() | ||
.createWithDefault(null); | ||
|
||
public static final ConfigEntry<String> USERNAME = | ||
new ConfigBuilder("jdbc-user") | ||
.doc("The username of the Jdbc connection") | ||
.version("0.3.0") | ||
.stringConf() | ||
.createWithDefault(null); | ||
|
||
public static final ConfigEntry<String> PASSWORD = | ||
new ConfigBuilder("jdbc-password") | ||
.doc("The password of the Jdbc connection") | ||
.version("0.3.0") | ||
.stringConf() | ||
.createWithDefault(null); | ||
|
||
public static final ConfigEntry<Integer> POOL_MIN_SIZE = | ||
new ConfigBuilder("jdbc.pool.min-size") | ||
.doc("The minimum number of connections in the pool") | ||
.version("0.3.0") | ||
.intConf() | ||
.createWithDefault(2); | ||
|
||
public static final ConfigEntry<Integer> POOL_MAX_SIZE = | ||
new ConfigBuilder("jdbc.pool.max-size") | ||
.doc("The maximum number of connections in the pool") | ||
.version("0.3.0") | ||
.intConf() | ||
.createWithDefault(10); | ||
|
||
public String getJdbcUrl() { | ||
return get(JDBC_URL); | ||
} | ||
|
||
public String getUsername() { | ||
return get(USERNAME); | ||
} | ||
|
||
public String getPassword() { | ||
return get(PASSWORD); | ||
} | ||
|
||
public int getPoolMinSize() { | ||
return get(POOL_MIN_SIZE); | ||
} | ||
|
||
public int getPoolMaxSize() { | ||
return get(POOL_MAX_SIZE); | ||
} | ||
|
||
public JdbcConfig(Map<String, String> properties) { | ||
super(false); | ||
loadFromMap(properties, k -> true); | ||
assert null != getJdbcUrl(); | ||
} | ||
} |
Oops, something went wrong.