This is an automated email from the ASF dual-hosted git repository.
jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 9c6d5e59026 Proxy support more data source connection pool (#27894)
9c6d5e59026 is described below
commit 9c6d5e590267a35ceac17ee498856934e4981de9
Author: ChenJiaHao <[email protected]>
AuthorDate: Fri Aug 4 16:15:19 2023 +0800
Proxy support more data source connection pool (#27894)
* Support more data source connection pool
* Fix CI
* Add java doc for public method
* Remove useless dependency
* Revert change in pipeline
* Revert change in pipeline
---
infra/common/pom.xml | 24 ++++++++--
.../YamlDataSourceConfigurationSwapper.java | 4 +-
...taSourceGeneratedDatabaseConfigurationTest.java | 6 ++-
.../YamlDataSourcePropertiesSwapperTest.java | 3 +-
infra/{ => datasource/core}/pom.xml | 51 +++++++++++++---------
.../ShardingSphereStorageDataSourceWrapper.java | 0
.../datasource/config/ConnectionConfiguration.java | 2 +
.../datasource/config/DataSourceConfiguration.java | 0
.../infra/datasource/config/PoolConfiguration.java | 0
.../pool/creator/DataSourcePoolCreator.java | 0
.../pool/creator/DataSourceReflection.java | 2 +-
.../pool/destroyer/DataSourcePoolDestroyer.java | 0
.../detector/DataSourcePoolActiveDetector.java | 0
.../DefaultDataSourcePoolActiveDetector.java | 4 +-
.../pool/metadata/DataSourcePoolFieldMetaData.java | 0
.../pool/metadata/DataSourcePoolMetaData.java | 0
.../metadata/DataSourcePoolMetaDataReflection.java | 0
.../DataSourcePoolPropertiesValidator.java | 0
.../DefaultDataSourcePoolFieldMetaData.java | 4 +-
.../DefaultDataSourcePoolPropertiesValidator.java | 0
.../datasource/props/DataSourceProperties.java | 11 +++++
.../props/DataSourcePropertiesCreator.java | 11 ++---
.../props/DataSourcePropertiesValidator.java | 0
.../InvalidDataSourcePropertiesException.java | 0
.../props/custom/CustomDataSourceProperties.java | 0
.../props/synonym/ConnectionPropertySynonyms.java | 1 +
.../props/synonym/PoolPropertySynonyms.java | 0
.../datasource/props/synonym/PropertySynonyms.java | 0
.../datasource/storage/StorageNodeProperties.java | 0
.../infra/datasource/storage/StorageResource.java | 0
.../storage/StorageResourceWithProperties.java | 0
.../infra/datasource/storage/StorageUnit.java | 0
.../infra/datasource/storage/StorageUtils.java | 0
...destroyer.detector.DataSourcePoolActiveDetector | 3 +-
.../destroyer/DataSourcePoolDestroyerTest.java | 0
.../DefaultDataSourcePoolActiveDetectorTest.java | 2 +-
.../MockedDataSourcePoolActiveDetector.java | 0
.../props/DataSourcePropertiesCreatorTest.java | 12 ++---
.../datasource/props/DataSourcePropertiesTest.java | 0
.../props/DataSourcePropertiesValidatorTest.java | 0
.../custom/CustomDataSourcePropertiesTest.java | 0
.../synonym/ConnectionPropertySynonymsTest.java | 18 +++++---
.../props/synonym/PoolPropertySynonymsTest.java | 0
...destroyer.detector.DataSourcePoolActiveDetector | 0
infra/{ => datasource}/pom.xml | 21 ++-------
infra/{ => datasource/type/c3p0}/pom.xml | 47 +++++++++++---------
.../metadata}/C3P0DataSourcePoolFieldMetaData.java | 2 +-
.../c3p0/metadata}/C3P0DataSourcePoolMetaData.java | 2 +-
...datasource.pool.metadata.DataSourcePoolMetaData | 4 +-
infra/{ => datasource/type/dbcp}/pom.xml | 47 +++++++++++---------
.../metadata}/DBCPDataSourcePoolFieldMetaData.java | 2 +-
.../dbcp/metadata}/DBCPDataSourcePoolMetaData.java | 2 +-
...atasource.pool.metadata.DataSourcePoolMetaData} | 2 +-
.../creator}/DBCPDataSourcePoolCreatorTest.java | 2 +-
infra/{ => datasource/type/druid}/pom.xml | 47 +++++++++++---------
.../DruidDataSourcePoolFieldMetaData.java} | 6 +--
.../metadata/DruidDataSourcePoolMetaData.java} | 24 ++++------
...atasource.pool.metadata.DataSourcePoolMetaData} | 2 +-
infra/{ => datasource/type/hikari}/pom.xml | 47 +++++++++++---------
.../HikariDataSourcePoolActiveDetector.java | 2 +-
.../HikariDataSourcePoolFieldMetaData.java | 2 +-
.../metadata}/HikariDataSourcePoolMetaData.java | 7 ++-
.../HikariDataSourcePoolPropertiesValidator.java | 2 +-
...destroyer.detector.DataSourcePoolActiveDetector | 2 +-
...atasource.pool.metadata.DataSourcePoolMetaData} | 2 +-
.../creator}/HikariDataSourcePoolCreatorTest.java | 2 +-
.../HikariDataSourcePoolActiveDetectorTest.java | 2 +-
infra/{ => datasource/type}/pom.xml | 23 +++-------
infra/pom.xml | 1 +
.../config/yaml/YamlJdbcConfiguration.java | 2 +
pom.xml | 14 ++++++
.../yaml/YamlProxyDataSourceConfiguration.java | 2 +
.../YamlProxyDataSourceConfigurationSwapper.java | 2 +-
.../ConvertYamlConfigurationExecutor.java | 5 ++-
.../YamlDatabaseConfigurationImportExecutor.java | 7 +--
proxy/bootstrap/pom.xml | 15 +++++++
76 files changed, 296 insertions(+), 211 deletions(-)
diff --git a/infra/common/pom.xml b/infra/common/pom.xml
index d28d040ca67..1d13c2b5702 100644
--- a/infra/common/pom.xml
+++ b/infra/common/pom.xml
@@ -78,6 +78,26 @@
<artifactId>shardingsphere-infra-database-sql92</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-datasource-c3p0</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-datasource-dbcp</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-datasource-druid</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-datasource-hikari</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
@@ -106,10 +126,6 @@
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-dbcp2</artifactId>
- </dependency>
</dependencies>
<build>
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourceConfigurationSwapper.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourceConfigurationSwapper.java
index ec0f20dcea9..15c110d2b26 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourceConfigurationSwapper.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourceConfigurationSwapper.java
@@ -86,7 +86,9 @@ public final class YamlDataSourceConfigurationSwapper {
@SuppressWarnings({"rawtypes", "unchecked"})
private Map<String, Object> getProperties(final Map<String, Object>
yamlConfig) {
Map<String, Object> result = new HashMap<>(yamlConfig);
- result.remove(DATA_SOURCE_CLASS_NAME_KEY);
+ if
("com.zaxxer.hikari.HikariDataSource".equals(result.get(DATA_SOURCE_CLASS_NAME_KEY).toString()))
{
+ result.remove(DATA_SOURCE_CLASS_NAME_KEY);
+ }
if (null != yamlConfig.get(CUSTOM_POOL_PROPS_KEY)) {
result.putAll((Map) yamlConfig.get(CUSTOM_POOL_PROPS_KEY));
}
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceGeneratedDatabaseConfigurationTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceGeneratedDatabaseConfigurationTest.java
index 4d38c9732e8..d7f01b83e67 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceGeneratedDatabaseConfigurationTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/config/database/impl/DataSourceGeneratedDatabaseConfigurationTest.java
@@ -88,7 +88,8 @@ class DataSourceGeneratedDatabaseConfigurationTest {
assertThat(poolStandardProps.get("minPoolSize"), is(1));
assertFalse((Boolean) poolStandardProps.get("readOnly"));
Map<String, Object> connStandardProps =
props.getConnectionPropertySynonyms().getStandardProperties();
- assertThat(connStandardProps.size(), is(3));
+ assertThat(connStandardProps.size(), is(4));
+ assertThat(connStandardProps.get("dataSourceClassName"),
is("com.zaxxer.hikari.HikariDataSource"));
assertThat(connStandardProps.get("url"),
is("jdbc:mock://127.0.0.1/normal_db"));
assertThat(connStandardProps.get("username"), is("root"));
assertThat(connStandardProps.get("password"), is(""));
@@ -100,7 +101,8 @@ class DataSourceGeneratedDatabaseConfigurationTest {
private Map<String, DataSourceConfiguration> createDataSources() {
PoolConfiguration poolConfig = new PoolConfiguration(2000L, 1000L,
1000L, 2, 1, false, new Properties());
- DataSourceConfiguration dataSourceConfig = new
DataSourceConfiguration(new
ConnectionConfiguration("jdbc:mock://127.0.0.1/normal_db", "root", ""),
poolConfig);
+ DataSourceConfiguration dataSourceConfig = new DataSourceConfiguration(
+ new
ConnectionConfiguration("com.zaxxer.hikari.HikariDataSource",
"jdbc:mock://127.0.0.1/normal_db", "root", ""), poolConfig);
return Collections.singletonMap("normal_db", dataSourceConfig);
}
}
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourcePropertiesSwapperTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourcePropertiesSwapperTest.java
index ec81561831e..81a118f1314 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourcePropertiesSwapperTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/yaml/config/swapper/resource/YamlDataSourcePropertiesSwapperTest.java
@@ -54,7 +54,8 @@ class YamlDataSourcePropertiesSwapperTest {
yamlConfig.put("url", "xx:xxx");
yamlConfig.put("username", "root");
DataSourceProperties actual =
swapper.swapToDataSourceProperties(yamlConfig);
- assertThat(actual.getAllLocalProperties().size(), is(2));
+ assertThat(actual.getAllLocalProperties().size(), is(3));
+
assertThat(actual.getAllLocalProperties().get("dataSourceClassName").toString(),
is("org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource"));
assertThat(actual.getAllLocalProperties().get("url").toString(),
is("xx:xxx"));
assertThat(actual.getAllLocalProperties().get("username").toString(),
is("root"));
}
diff --git a/infra/pom.xml b/infra/datasource/core/pom.xml
similarity index 52%
copy from infra/pom.xml
copy to infra/datasource/core/pom.xml
index 1aea03b1358..cf5f31e5bb8 100644
--- a/infra/pom.xml
+++ b/infra/datasource/core/pom.xml
@@ -20,28 +20,39 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-datasource</artifactId>
<version>5.4.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-datasource-core</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>binder</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>executor</module>
- <module>expr</module>
- <module>merge</module>
- <module>parser</module>
- <module>rewrite</module>
- <module>route</module>
- <module>session</module>
- <module>util</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-database-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture-database</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-util</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/ShardingSphereStorageDataSourceWrapper.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/ShardingSphereStorageDataSourceWrapper.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/ShardingSphereStorageDataSourceWrapper.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/ShardingSphereStorageDataSourceWrapper.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/config/ConnectionConfiguration.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/config/ConnectionConfiguration.java
similarity index 95%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/config/ConnectionConfiguration.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/config/ConnectionConfiguration.java
index 55815a806c6..889f0ee8b8c 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/config/ConnectionConfiguration.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/config/ConnectionConfiguration.java
@@ -27,6 +27,8 @@ import lombok.RequiredArgsConstructor;
@Getter
public final class ConnectionConfiguration {
+ private final String dataSourceClassName;
+
private final String url;
private final String username;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/config/DataSourceConfiguration.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/config/DataSourceConfiguration.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/config/DataSourceConfiguration.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/config/DataSourceConfiguration.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/config/PoolConfiguration.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/config/PoolConfiguration.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/config/PoolConfiguration.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/config/PoolConfiguration.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
similarity index 99%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
index 4f17f50251d..6e7a15fa4e3 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.infra.database.core.connector.ConnectionPropert
import
org.apache.shardingsphere.infra.database.core.connector.ConnectionPropertiesParser;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaDataReflection;
-import
org.apache.shardingsphere.infra.datasource.pool.metadata.type.DefaultDataSourcePoolFieldMetaData;
+import
org.apache.shardingsphere.infra.datasource.pool.metadata.DefaultDataSourcePoolFieldMetaData;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import javax.sql.DataSource;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/DataSourcePoolDestroyer.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/DataSourcePoolDestroyer.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/DataSourcePoolDestroyer.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/DataSourcePoolDestroyer.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DataSourcePoolActiveDetector.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DataSourcePoolActiveDetector.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DataSourcePoolActiveDetector.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DataSourcePoolActiveDetector.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/DefaultDataSourcePoolActiveDetector.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DefaultDataSourcePoolActiveDetector.java
similarity index 91%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/DefaultDataSourcePoolActiveDetector.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DefaultDataSourcePoolActiveDetector.java
index a4f7ff4b9f7..2fff93dcefe 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/DefaultDataSourcePoolActiveDetector.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DefaultDataSourcePoolActiveDetector.java
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.type;
-
-import
org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector;
+package org.apache.shardingsphere.infra.datasource.pool.destroyer.detector;
import javax.sql.DataSource;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolFieldMetaData.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolFieldMetaData.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolFieldMetaData.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolFieldMetaData.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaData.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaData.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaData.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaData.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaDataReflection.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaDataReflection.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaDataReflection.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolMetaDataReflection.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolPropertiesValidator.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolPropertiesValidator.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolPropertiesValidator.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DataSourcePoolPropertiesValidator.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/DefaultDataSourcePoolFieldMetaData.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DefaultDataSourcePoolFieldMetaData.java
similarity index 93%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/DefaultDataSourcePoolFieldMetaData.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DefaultDataSourcePoolFieldMetaData.java
index 7562a3da0a7..08a4fe39ce6 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/DefaultDataSourcePoolFieldMetaData.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DefaultDataSourcePoolFieldMetaData.java
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type;
-
-import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
+package org.apache.shardingsphere.infra.datasource.pool.metadata;
/**
* Default data source pool field meta data.
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DefaultDataSourcePoolPropertiesValidator.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DefaultDataSourcePoolPropertiesValidator.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DefaultDataSourcePoolPropertiesValidator.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/DefaultDataSourcePoolPropertiesValidator.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
similarity index 94%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
index 799f8bf39f7..42319245216 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourceProperties.java
@@ -39,6 +39,8 @@ import java.util.Optional;
@Getter
public final class DataSourceProperties {
+ private static final String DEFAULT_DATA_SOURCE_CLASS =
"com.zaxxer.hikari.HikariDataSource";
+
private final String dataSourceClassName;
private final ConnectionPropertySynonyms connectionPropertySynonyms;
@@ -63,6 +65,15 @@ public final class DataSourceProperties {
return result;
}
+ /**
+ * Get data source class name.
+ *
+ * @return data source class name
+ */
+ public String getDataSourceClassName() {
+ return null == dataSourceClassName ? DEFAULT_DATA_SOURCE_CLASS :
dataSourceClassName;
+ }
+
/**
* Get all standard properties.
*
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreator.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreator.java
similarity index 92%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreator.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreator.java
index e281d0df5c8..3bfcfe1b499 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreator.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreator.java
@@ -51,18 +51,17 @@ public final class DataSourcePropertiesCreator {
*/
public static Map<String, DataSourceProperties>
createFromConfiguration(final Map<String, DataSourceConfiguration>
dataSourceConfigs) {
return dataSourceConfigs.entrySet().stream().collect(Collectors
- .toMap(Entry::getKey, entry ->
create("com.zaxxer.hikari.HikariDataSource", entry.getValue()), (oldValue,
currentValue) -> oldValue, LinkedHashMap::new));
+ .toMap(Entry::getKey, entry -> create(entry.getValue()),
(oldValue, currentValue) -> oldValue, LinkedHashMap::new));
}
/**
* Create data source properties.
*
- * @param dataSourcePoolClassName data source pool class name
* @param dataSourceConfig data source configuration
* @return created data source properties
*/
- public static DataSourceProperties create(final String
dataSourcePoolClassName, final DataSourceConfiguration dataSourceConfig) {
- return new DataSourceProperties(dataSourcePoolClassName,
createProperties(dataSourceConfig));
+ public static DataSourceProperties create(final DataSourceConfiguration
dataSourceConfig) {
+ return new
DataSourceProperties(dataSourceConfig.getConnection().getDataSourceClassName(),
createProperties(dataSourceConfig));
}
/**
@@ -92,6 +91,7 @@ public final class DataSourcePropertiesCreator {
@SuppressWarnings({"unchecked", "rawtypes"})
private static Map<String, Object> createProperties(final
DataSourceConfiguration dataSourceConfig) {
Map<String, Object> result = new LinkedHashMap<>();
+ result.put("dataSourceClassName",
dataSourceConfig.getConnection().getDataSourceClassName());
result.put("url", dataSourceConfig.getConnection().getUrl());
result.put("username", dataSourceConfig.getConnection().getUsername());
result.put("password", dataSourceConfig.getConnection().getPassword());
@@ -137,7 +137,8 @@ public final class DataSourcePropertiesCreator {
private static ConnectionConfiguration getConnectionConfiguration(final
ConnectionPropertySynonyms connectionPropertySynonyms) {
Map<String, Object> standardProperties =
connectionPropertySynonyms.getStandardProperties();
- return new ConnectionConfiguration((String)
standardProperties.get("url"), (String) standardProperties.get("username"),
(String) standardProperties.get("password"));
+ return new ConnectionConfiguration((String)
standardProperties.get("dataSourceClassName"), (String)
standardProperties.get("url"),
+ (String) standardProperties.get("username"), (String)
standardProperties.get("password"));
}
private static PoolConfiguration getPoolConfiguration(final
PoolPropertySynonyms poolPropertySynonyms, final CustomDataSourceProperties
customDataSourceProperties) {
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidator.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidator.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidator.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidator.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/InvalidDataSourcePropertiesException.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/InvalidDataSourcePropertiesException.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/InvalidDataSourcePropertiesException.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/InvalidDataSourcePropertiesException.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/custom/CustomDataSourceProperties.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/custom/CustomDataSourceProperties.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/custom/CustomDataSourceProperties.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/custom/CustomDataSourceProperties.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonyms.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonyms.java
similarity index 96%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonyms.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonyms.java
index 2210efeaa75..30943e6b168 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonyms.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonyms.java
@@ -32,6 +32,7 @@ public final class ConnectionPropertySynonyms extends
PropertySynonyms {
private static final Collection<String> STANDARD_PROPERTY_KEYS = new
HashSet<>();
static {
+ STANDARD_PROPERTY_KEYS.add("dataSourceClassName");
STANDARD_PROPERTY_KEYS.add("url");
STANDARD_PROPERTY_KEYS.add("username");
STANDARD_PROPERTY_KEYS.add("password");
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/PoolPropertySynonyms.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/PoolPropertySynonyms.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/PoolPropertySynonyms.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/PoolPropertySynonyms.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/PropertySynonyms.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/PropertySynonyms.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/PropertySynonyms.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/props/synonym/PropertySynonyms.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageNodeProperties.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageNodeProperties.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageNodeProperties.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageNodeProperties.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageResource.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageResource.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageResource.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageResource.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageResourceWithProperties.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageResourceWithProperties.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageResourceWithProperties.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageResourceWithProperties.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageUnit.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageUnit.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageUnit.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageUnit.java
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageUtils.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageUtils.java
similarity index 100%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageUtils.java
rename to
infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/storage/StorageUtils.java
diff --git
a/infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
b/infra/datasource/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
similarity index 84%
rename from
infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
rename to
infra/datasource/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
index 74d7e985b52..bf5fc8899de 100644
---
a/infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
+++
b/infra/datasource/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
@@ -15,5 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.type.DefaultDataSourcePoolActiveDetector
-org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.type.HikariDataSourcePoolActiveDetector
+org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DefaultDataSourcePoolActiveDetector
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/DataSourcePoolDestroyerTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/DataSourcePoolDestroyerTest.java
similarity index 100%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/DataSourcePoolDestroyerTest.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/DataSourcePoolDestroyerTest.java
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/DefaultDataSourcePoolActiveDetectorTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DefaultDataSourcePoolActiveDetectorTest.java
similarity index 98%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/DefaultDataSourcePoolActiveDetectorTest.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DefaultDataSourcePoolActiveDetectorTest.java
index 59890e38679..f2a8c2f4f39 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/DefaultDataSourcePoolActiveDetectorTest.java
+++
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/DefaultDataSourcePoolActiveDetectorTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.type;
+package org.apache.shardingsphere.infra.datasource.pool.destroyer.detector;
import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource;
import org.junit.jupiter.api.Test;
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/fixture/MockedDataSourcePoolActiveDetector.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/fixture/MockedDataSourcePoolActiveDetector.java
similarity index 100%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/fixture/MockedDataSourcePoolActiveDetector.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/fixture/MockedDataSourcePoolActiveDetector.java
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreatorTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreatorTest.java
similarity index 88%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreatorTest.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreatorTest.java
index 1301dee5f20..24cd7eade57 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreatorTest.java
+++
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesCreatorTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.datasource.props;
-import com.zaxxer.hikari.HikariDataSource;
import
org.apache.shardingsphere.infra.datasource.config.ConnectionConfiguration;
import
org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
import org.apache.shardingsphere.infra.datasource.config.PoolConfiguration;
@@ -29,26 +28,27 @@ import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.jupiter.api.Assertions.assertNull;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNull;
class DataSourcePropertiesCreatorTest {
@Test
void assertCreateWithDataSourceConfiguration() {
-
assertParameter(DataSourcePropertiesCreator.create(HikariDataSource.class.getName(),
createResourceConfiguration()));
+
assertParameter(DataSourcePropertiesCreator.create(createResourceConfiguration()));
}
private DataSourceConfiguration createResourceConfiguration() {
- ConnectionConfiguration connectionConfig = new
ConnectionConfiguration("jdbc:mysql://localhost:3306/demo_ds", "root", "root");
+ ConnectionConfiguration connectionConfig = new
ConnectionConfiguration("com.zaxxer.hikari.HikariDataSource",
"jdbc:mysql://localhost:3306/demo_ds", "root", "root");
PoolConfiguration poolConfig = new PoolConfiguration(null, null, null,
null, null, null, null);
return new DataSourceConfiguration(connectionConfig, poolConfig);
}
private void assertParameter(final DataSourceProperties actual) {
Map<String, Object> props = actual.getAllLocalProperties();
- assertThat(props.size(), is(9));
- assertThat(props.get("jdbcUrl"),
is("jdbc:mysql://localhost:3306/demo_ds"));
+ assertThat(props.size(), is(10));
+ assertThat(props.get("dataSourceClassName"),
is("com.zaxxer.hikari.HikariDataSource"));
+ assertThat(props.get("url"),
is("jdbc:mysql://localhost:3306/demo_ds"));
assertThat(props.get("username"), is("root"));
assertThat(props.get("password"), is("root"));
assertNull(props.get("maximumPoolSize"));
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java
similarity index 100%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidatorTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidatorTest.java
similarity index 100%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidatorTest.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesValidatorTest.java
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/custom/CustomDataSourcePropertiesTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/custom/CustomDataSourcePropertiesTest.java
similarity index 100%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/custom/CustomDataSourcePropertiesTest.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/custom/CustomDataSourcePropertiesTest.java
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonymsTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonymsTest.java
similarity index 78%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonymsTest.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonymsTest.java
index 12d72112951..d1aa4b54005 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonymsTest.java
+++
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/ConnectionPropertySynonymsTest.java
@@ -30,7 +30,8 @@ class ConnectionPropertySynonymsTest {
@Test
void assertGetStandardPropertiesWithStandardProperties() {
ConnectionPropertySynonyms actual = new
ConnectionPropertySynonyms(createStandardProperties(),
createPropertySynonyms());
- assertThat(actual.getStandardProperties().size(), is(3));
+ assertThat(actual.getStandardProperties().size(), is(4));
+ assertThat(actual.getStandardProperties().get("dataSourceClassName"),
is("com.zaxxer.hikari.HikariDataSource"));
assertThat(actual.getStandardProperties().get("url"),
is("jdbc:mock://127.0.0.1/foo_ds"));
assertThat(actual.getStandardProperties().get("username"), is("root"));
assertThat(actual.getStandardProperties().get("password"), is("root"));
@@ -39,7 +40,8 @@ class ConnectionPropertySynonymsTest {
@Test
void assertGetStandardPropertiesWithLocalProperties() {
ConnectionPropertySynonyms actual = new
ConnectionPropertySynonyms(createLocalProperties(), createPropertySynonyms());
- assertThat(actual.getStandardProperties().size(), is(3));
+ assertThat(actual.getStandardProperties().size(), is(4));
+ assertThat(actual.getStandardProperties().get("dataSourceClassName"),
is("com.zaxxer.hikari.HikariDataSource"));
assertThat(actual.getStandardProperties().get("url"),
is("jdbc:mock://127.0.0.1/foo_ds"));
assertThat(actual.getStandardProperties().get("username"), is("root"));
assertThat(actual.getStandardProperties().get("password"), is("root"));
@@ -48,7 +50,8 @@ class ConnectionPropertySynonymsTest {
@Test
void assertGetLocalPropertiesWithStandardProperties() {
ConnectionPropertySynonyms actual = new
ConnectionPropertySynonyms(createStandardProperties(),
createPropertySynonyms());
- assertThat(actual.getLocalProperties().size(), is(3));
+ assertThat(actual.getLocalProperties().size(), is(4));
+ assertThat(actual.getStandardProperties().get("dataSourceClassName"),
is("com.zaxxer.hikari.HikariDataSource"));
assertThat(actual.getLocalProperties().get("jdbcUrl"),
is("jdbc:mock://127.0.0.1/foo_ds"));
assertThat(actual.getLocalProperties().get("user"), is("root"));
assertThat(actual.getLocalProperties().get("password"), is("root"));
@@ -57,14 +60,16 @@ class ConnectionPropertySynonymsTest {
@Test
void assertGetLocalPropertiesWithLocalProperties() {
ConnectionPropertySynonyms actual = new
ConnectionPropertySynonyms(createLocalProperties(), createPropertySynonyms());
- assertThat(actual.getLocalProperties().size(), is(3));
+ assertThat(actual.getLocalProperties().size(), is(4));
+ assertThat(actual.getStandardProperties().get("dataSourceClassName"),
is("com.zaxxer.hikari.HikariDataSource"));
assertThat(actual.getLocalProperties().get("jdbcUrl"),
is("jdbc:mock://127.0.0.1/foo_ds"));
assertThat(actual.getLocalProperties().get("user"), is("root"));
assertThat(actual.getLocalProperties().get("password"), is("root"));
}
private Map<String, Object> createStandardProperties() {
- Map<String, Object> result = new LinkedHashMap<>(3, 1F);
+ Map<String, Object> result = new LinkedHashMap<>(4, 1F);
+ result.put("dataSourceClassName",
"com.zaxxer.hikari.HikariDataSource");
result.put("url", "jdbc:mock://127.0.0.1/foo_ds");
result.put("username", "root");
result.put("password", "root");
@@ -72,7 +77,8 @@ class ConnectionPropertySynonymsTest {
}
private Map<String, Object> createLocalProperties() {
- Map<String, Object> result = new LinkedHashMap<>(3, 1F);
+ Map<String, Object> result = new LinkedHashMap<>(4, 1F);
+ result.put("dataSourceClassName",
"com.zaxxer.hikari.HikariDataSource");
result.put("jdbcUrl", "jdbc:mock://127.0.0.1/foo_ds");
result.put("user", "root");
result.put("password", "root");
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/PoolPropertySynonymsTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/PoolPropertySynonymsTest.java
similarity index 100%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/PoolPropertySynonymsTest.java
rename to
infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/props/synonym/PoolPropertySynonymsTest.java
diff --git
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
b/infra/datasource/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
similarity index 100%
copy from
infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
copy to
infra/datasource/core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
diff --git a/infra/pom.xml b/infra/datasource/pom.xml
similarity index 69%
copy from infra/pom.xml
copy to infra/datasource/pom.xml
index 1aea03b1358..54e09b093d2 100644
--- a/infra/pom.xml
+++ b/infra/datasource/pom.xml
@@ -20,28 +20,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra</artifactId>
<version>5.4.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-datasource</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>binder</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>executor</module>
- <module>expr</module>
- <module>merge</module>
- <module>parser</module>
- <module>rewrite</module>
- <module>route</module>
- <module>session</module>
- <module>util</module>
+ <module>core</module>
+ <module>type</module>
</modules>
</project>
diff --git a/infra/pom.xml b/infra/datasource/type/c3p0/pom.xml
similarity index 55%
copy from infra/pom.xml
copy to infra/datasource/type/c3p0/pom.xml
index 1aea03b1358..a067d1af426 100644
--- a/infra/pom.xml
+++ b/infra/datasource/type/c3p0/pom.xml
@@ -20,28 +20,35 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-datasource-type</artifactId>
<version>5.4.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-datasource-c3p0</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>binder</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>executor</module>
- <module>expr</module>
- <module>merge</module>
- <module>parser</module>
- <module>rewrite</module>
- <module>route</module>
- <module>session</module>
- <module>util</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-datasource-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.mchange</groupId>
+ <artifactId>c3p0</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture-database</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-util</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/c3p0/C3P0DataSourcePoolFieldMetaData.java
b/infra/datasource/type/c3p0/src/main/java/org/apache/shardingsphere/infra/datasource/c3p0/metadata/C3P0DataSourcePoolFieldMetaData.java
similarity index 94%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/c3p0/C3P0DataSourcePoolFieldMetaData.java
rename to
infra/datasource/type/c3p0/src/main/java/org/apache/shardingsphere/infra/datasource/c3p0/metadata/C3P0DataSourcePoolFieldMetaData.java
index 75cdc234953..e75df600e64 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/c3p0/C3P0DataSourcePoolFieldMetaData.java
+++
b/infra/datasource/type/c3p0/src/main/java/org/apache/shardingsphere/infra/datasource/c3p0/metadata/C3P0DataSourcePoolFieldMetaData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.c3p0;
+package org.apache.shardingsphere.infra.datasource.c3p0.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/c3p0/C3P0DataSourcePoolMetaData.java
b/infra/datasource/type/c3p0/src/main/java/org/apache/shardingsphere/infra/datasource/c3p0/metadata/C3P0DataSourcePoolMetaData.java
similarity index 98%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/c3p0/C3P0DataSourcePoolMetaData.java
rename to
infra/datasource/type/c3p0/src/main/java/org/apache/shardingsphere/infra/datasource/c3p0/metadata/C3P0DataSourcePoolMetaData.java
index d1de2d5eea9..b379acfcc57 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/c3p0/C3P0DataSourcePoolMetaData.java
+++
b/infra/datasource/type/c3p0/src/main/java/org/apache/shardingsphere/infra/datasource/c3p0/metadata/C3P0DataSourcePoolMetaData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.c3p0;
+package org.apache.shardingsphere.infra.datasource.c3p0.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolPropertiesValidator;
diff --git
a/infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
b/infra/datasource/type/c3p0/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
similarity index 73%
rename from
infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
rename to
infra/datasource/type/c3p0/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
index bab934fa5f3..aa473c20f9c 100644
---
a/infra/common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
+++
b/infra/datasource/type/c3p0/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
@@ -15,6 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.datasource.pool.metadata.type.hikari.HikariDataSourcePoolMetaData
-org.apache.shardingsphere.infra.datasource.pool.metadata.type.dbcp.DBCPDataSourcePoolMetaData
-org.apache.shardingsphere.infra.datasource.pool.metadata.type.c3p0.C3P0DataSourcePoolMetaData
+org.apache.shardingsphere.infra.datasource.c3p0.metadata.C3P0DataSourcePoolMetaData
diff --git a/infra/pom.xml b/infra/datasource/type/dbcp/pom.xml
similarity index 54%
copy from infra/pom.xml
copy to infra/datasource/type/dbcp/pom.xml
index 1aea03b1358..77c9ebf14c6 100644
--- a/infra/pom.xml
+++ b/infra/datasource/type/dbcp/pom.xml
@@ -20,28 +20,35 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-datasource-type</artifactId>
<version>5.4.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-datasource-dbcp</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>binder</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>executor</module>
- <module>expr</module>
- <module>merge</module>
- <module>parser</module>
- <module>rewrite</module>
- <module>route</module>
- <module>session</module>
- <module>util</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-datasource-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture-database</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-util</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolFieldMetaData.java
b/infra/datasource/type/dbcp/src/main/java/org/apache/shardingsphere/infra/datasource/dbcp/metadata/DBCPDataSourcePoolFieldMetaData.java
similarity index 94%
copy from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolFieldMetaData.java
copy to
infra/datasource/type/dbcp/src/main/java/org/apache/shardingsphere/infra/datasource/dbcp/metadata/DBCPDataSourcePoolFieldMetaData.java
index f149f9c232c..53f5004d8ec 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolFieldMetaData.java
+++
b/infra/datasource/type/dbcp/src/main/java/org/apache/shardingsphere/infra/datasource/dbcp/metadata/DBCPDataSourcePoolFieldMetaData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.dbcp;
+package org.apache.shardingsphere.infra.datasource.dbcp.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolMetaData.java
b/infra/datasource/type/dbcp/src/main/java/org/apache/shardingsphere/infra/datasource/dbcp/metadata/DBCPDataSourcePoolMetaData.java
similarity index 97%
copy from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolMetaData.java
copy to
infra/datasource/type/dbcp/src/main/java/org/apache/shardingsphere/infra/datasource/dbcp/metadata/DBCPDataSourcePoolMetaData.java
index 03d870f2d9c..ecf0987d293 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolMetaData.java
+++
b/infra/datasource/type/dbcp/src/main/java/org/apache/shardingsphere/infra/datasource/dbcp/metadata/DBCPDataSourcePoolMetaData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.dbcp;
+package org.apache.shardingsphere.infra.datasource.dbcp.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolPropertiesValidator;
diff --git
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
b/infra/datasource/type/dbcp/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
similarity index 88%
copy from
infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
copy to
infra/datasource/type/dbcp/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
index 260927a6ce7..0a581c959c6 100644
---
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
+++
b/infra/datasource/type/dbcp/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.datasource.pool.destroyer.fixture.MockedDataSourcePoolActiveDetector
+org.apache.shardingsphere.infra.datasource.dbcp.metadata.DBCPDataSourcePoolMetaData
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/type/DBCPDataSourcePoolCreatorTest.java
b/infra/datasource/type/dbcp/src/test/java/org/apache/shardingsphere/infra/datasource/dbcp/creator/DBCPDataSourcePoolCreatorTest.java
similarity index 97%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/type/DBCPDataSourcePoolCreatorTest.java
rename to
infra/datasource/type/dbcp/src/test/java/org/apache/shardingsphere/infra/datasource/dbcp/creator/DBCPDataSourcePoolCreatorTest.java
index bd22f54417f..c5c34e95455 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/type/DBCPDataSourcePoolCreatorTest.java
+++
b/infra/datasource/type/dbcp/src/test/java/org/apache/shardingsphere/infra/datasource/dbcp/creator/DBCPDataSourcePoolCreatorTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.creator.type;
+package org.apache.shardingsphere.infra.datasource.dbcp.creator;
import lombok.SneakyThrows;
import org.apache.commons.dbcp2.BasicDataSource;
diff --git a/infra/pom.xml b/infra/datasource/type/druid/pom.xml
similarity index 55%
copy from infra/pom.xml
copy to infra/datasource/type/druid/pom.xml
index 1aea03b1358..479e40f1108 100644
--- a/infra/pom.xml
+++ b/infra/datasource/type/druid/pom.xml
@@ -20,28 +20,35 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-datasource-type</artifactId>
<version>5.4.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-datasource-druid</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>binder</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>executor</module>
- <module>expr</module>
- <module>merge</module>
- <module>parser</module>
- <module>rewrite</module>
- <module>route</module>
- <module>session</module>
- <module>util</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-datasource-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>druid</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture-database</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-util</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolFieldMetaData.java
b/infra/datasource/type/druid/src/main/java/org/apache/shardingsphere/infra/datasource/druid/metadata/DruidDataSourcePoolFieldMetaData.java
similarity index 86%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolFieldMetaData.java
rename to
infra/datasource/type/druid/src/main/java/org/apache/shardingsphere/infra/datasource/druid/metadata/DruidDataSourcePoolFieldMetaData.java
index f149f9c232c..41124f6bf30 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolFieldMetaData.java
+++
b/infra/datasource/type/druid/src/main/java/org/apache/shardingsphere/infra/datasource/druid/metadata/DruidDataSourcePoolFieldMetaData.java
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.dbcp;
+package org.apache.shardingsphere.infra.datasource.druid.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
/**
- * DBCP data source pool field meta data.
+ * Druid data source pool field meta data.
*/
-public final class DBCPDataSourcePoolFieldMetaData implements
DataSourcePoolFieldMetaData {
+public final class DruidDataSourcePoolFieldMetaData implements
DataSourcePoolFieldMetaData {
@Override
public String getUsernameFieldName() {
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolMetaData.java
b/infra/datasource/type/druid/src/main/java/org/apache/shardingsphere/infra/datasource/druid/metadata/DruidDataSourcePoolMetaData.java
similarity index 78%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolMetaData.java
rename to
infra/datasource/type/druid/src/main/java/org/apache/shardingsphere/infra/datasource/druid/metadata/DruidDataSourcePoolMetaData.java
index 03d870f2d9c..4ff4697479f 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/dbcp/DBCPDataSourcePoolMetaData.java
+++
b/infra/datasource/type/druid/src/main/java/org/apache/shardingsphere/infra/datasource/druid/metadata/DruidDataSourcePoolMetaData.java
@@ -15,22 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.dbcp;
+package org.apache.shardingsphere.infra.datasource.druid.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolPropertiesValidator;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DefaultDataSourcePoolPropertiesValidator;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Map;
/**
- * DBCP data source pool meta data.
+ * Druid data source pool meta data.
*/
-public final class DBCPDataSourcePoolMetaData implements
DataSourcePoolMetaData {
+public final class DruidDataSourcePoolMetaData implements
DataSourcePoolMetaData {
private static final Collection<String> TRANSIENT_FIELD_NAMES = new
LinkedList<>();
@@ -63,22 +62,17 @@ public final class DBCPDataSourcePoolMetaData implements
DataSourcePoolMetaData
}
@Override
- public DBCPDataSourcePoolFieldMetaData getFieldMetaData() {
- return new DBCPDataSourcePoolFieldMetaData();
+ public DruidDataSourcePoolFieldMetaData getFieldMetaData() {
+ return new DruidDataSourcePoolFieldMetaData();
}
@Override
- public String getType() {
- return "org.apache.commons.dbcp2.BasicDataSource";
- }
-
- @Override
- public Collection<Object> getTypeAliases() {
- return Arrays.asList("org.apache.commons.dbcp.BasicDataSource",
"org.apache.tomcat.dbcp.dbcp2.BasicDataSource");
+ public DataSourcePoolPropertiesValidator
getDataSourcePoolPropertiesValidator() {
+ return new DefaultDataSourcePoolPropertiesValidator();
}
@Override
- public DataSourcePoolPropertiesValidator
getDataSourcePoolPropertiesValidator() {
- return new DefaultDataSourcePoolPropertiesValidator();
+ public String getType() {
+ return "com.alibaba.druid.pool.DruidDataSource";
}
}
diff --git
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
b/infra/datasource/type/druid/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
similarity index 88%
copy from
infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
copy to
infra/datasource/type/druid/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
index 260927a6ce7..bda50be822f 100644
---
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
+++
b/infra/datasource/type/druid/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.datasource.pool.destroyer.fixture.MockedDataSourcePoolActiveDetector
+org.apache.shardingsphere.infra.datasource.druid.metadata.DruidDataSourcePoolMetaData
diff --git a/infra/pom.xml b/infra/datasource/type/hikari/pom.xml
similarity index 54%
copy from infra/pom.xml
copy to infra/datasource/type/hikari/pom.xml
index 1aea03b1358..6a157f59b6d 100644
--- a/infra/pom.xml
+++ b/infra/datasource/type/hikari/pom.xml
@@ -20,28 +20,35 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-datasource-type</artifactId>
<version>5.4.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-datasource-hikari</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>binder</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>executor</module>
- <module>expr</module>
- <module>merge</module>
- <module>parser</module>
- <module>rewrite</module>
- <module>route</module>
- <module>session</module>
- <module>util</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-datasource-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture-database</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-util</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/HikariDataSourcePoolActiveDetector.java
b/infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/detector/HikariDataSourcePoolActiveDetector.java
similarity index 95%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/HikariDataSourcePoolActiveDetector.java
rename to
infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/detector/HikariDataSourcePoolActiveDetector.java
index 7184c0640f8..59834d61271 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/HikariDataSourcePoolActiveDetector.java
+++
b/infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/detector/HikariDataSourcePoolActiveDetector.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.type;
+package org.apache.shardingsphere.infra.datasource.hikari.detector;
import lombok.SneakyThrows;
import
org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolFieldMetaData.java
b/infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolFieldMetaData.java
similarity index 94%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolFieldMetaData.java
rename to
infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolFieldMetaData.java
index fb761b94e15..e53373dd308 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolFieldMetaData.java
+++
b/infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolFieldMetaData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.hikari;
+package org.apache.shardingsphere.infra.datasource.hikari.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolMetaData.java
b/infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolMetaData.java
similarity index 96%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolMetaData.java
rename to
infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolMetaData.java
index 1e0d5c592ac..9afe20a85fb 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolMetaData.java
+++
b/infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolMetaData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.hikari;
+package org.apache.shardingsphere.infra.datasource.hikari.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolPropertiesValidator;
@@ -109,4 +109,9 @@ public final class HikariDataSourcePoolMetaData implements
DataSourcePoolMetaDat
public String getType() {
return "com.zaxxer.hikari.HikariDataSource";
}
+
+ @Override
+ public boolean isDefault() {
+ return true;
+ }
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolPropertiesValidator.java
b/infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolPropertiesValidator.java
similarity index 98%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolPropertiesValidator.java
rename to
infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolPropertiesValidator.java
index ef024dc5da3..d8fb04757e2 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/metadata/type/hikari/HikariDataSourcePoolPropertiesValidator.java
+++
b/infra/datasource/type/hikari/src/main/java/org/apache/shardingsphere/infra/datasource/hikari/metadata/HikariDataSourcePoolPropertiesValidator.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.metadata.type.hikari;
+package org.apache.shardingsphere.infra.datasource.hikari.metadata;
import
org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolPropertiesValidator;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
diff --git
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
b/infra/datasource/type/hikari/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
similarity index 88%
copy from
infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
copy to
infra/datasource/type/hikari/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
index 260927a6ce7..26580fd1777 100644
---
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
+++
b/infra/datasource/type/hikari/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.datasource.pool.destroyer.fixture.MockedDataSourcePoolActiveDetector
+org.apache.shardingsphere.infra.datasource.hikari.detector.HikariDataSourcePoolActiveDetector
diff --git
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
b/infra/datasource/type/hikari/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
similarity index 88%
rename from
infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
rename to
infra/datasource/type/hikari/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
index 260927a6ce7..6b4afcf4e3a 100644
---
a/infra/common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.DataSourcePoolActiveDetector
+++
b/infra/datasource/type/hikari/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.datasource.pool.destroyer.fixture.MockedDataSourcePoolActiveDetector
+org.apache.shardingsphere.infra.datasource.hikari.metadata.HikariDataSourcePoolMetaData
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/type/HikariDataSourcePoolCreatorTest.java
b/infra/datasource/type/hikari/src/test/java/org/apache/shardingsphere/infra/datasource/hikari/creator/HikariDataSourcePoolCreatorTest.java
similarity index 97%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/type/HikariDataSourcePoolCreatorTest.java
rename to
infra/datasource/type/hikari/src/test/java/org/apache/shardingsphere/infra/datasource/hikari/creator/HikariDataSourcePoolCreatorTest.java
index 97368508d0b..807396d4697 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/type/HikariDataSourcePoolCreatorTest.java
+++
b/infra/datasource/type/hikari/src/test/java/org/apache/shardingsphere/infra/datasource/hikari/creator/HikariDataSourcePoolCreatorTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.datasource.pool.creator.type;
+package org.apache.shardingsphere.infra.datasource.hikari.creator;
import com.zaxxer.hikari.HikariDataSource;
import
org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator;
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/HikariDataSourcePoolActiveDetectorTest.java
b/infra/datasource/type/hikari/src/test/java/org/apache/shardingsphere/infra/datasource/hikari/detector/HikariDataSourcePoolActiveDetectorTest.java
similarity index 96%
rename from
infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/HikariDataSourcePoolActiveDetectorTest.java
rename to
infra/datasource/type/hikari/src/test/java/org/apache/shardingsphere/infra/datasource/hikari/detector/HikariDataSourcePoolActiveDetectorTest.java
index 675ec184c2a..e46812cf6ad 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/pool/destroyer/detector/type/HikariDataSourcePoolActiveDetectorTest.java
+++
b/infra/datasource/type/hikari/src/test/java/org/apache/shardingsphere/infra/datasource/hikari/detector/HikariDataSourcePoolActiveDetectorTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.infra.datasource.pool.destroyer.detector.type;
+package org.apache.shardingsphere.infra.datasource.hikari.detector;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
diff --git a/infra/pom.xml b/infra/datasource/type/pom.xml
similarity index 69%
copy from infra/pom.xml
copy to infra/datasource/type/pom.xml
index 1aea03b1358..7872e3eb04e 100644
--- a/infra/pom.xml
+++ b/infra/datasource/type/pom.xml
@@ -20,28 +20,17 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-datasource</artifactId>
<version>5.4.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-datasource-type</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>binder</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>executor</module>
- <module>expr</module>
- <module>merge</module>
- <module>parser</module>
- <module>rewrite</module>
- <module>route</module>
- <module>session</module>
- <module>util</module>
+ <module>c3p0</module>
+ <module>dbcp</module>
+ <module>druid</module>
+ <module>hikari</module>
</modules>
</project>
diff --git a/infra/pom.xml b/infra/pom.xml
index 1aea03b1358..8641830e9af 100644
--- a/infra/pom.xml
+++ b/infra/pom.xml
@@ -31,6 +31,7 @@
<module>spi</module>
<module>exception</module>
<module>database</module>
+ <module>datasource</module>
<module>binder</module>
<module>common</module>
<module>context</module>
diff --git
a/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/yaml/YamlJdbcConfiguration.java
b/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/yaml/YamlJdbcConfiguration.java
index e20128cbe91..e2746b88e67 100644
---
a/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/yaml/YamlJdbcConfiguration.java
+++
b/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/yaml/YamlJdbcConfiguration.java
@@ -28,6 +28,8 @@ import
org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
@Setter
public final class YamlJdbcConfiguration implements YamlConfiguration {
+ private String dataSourceClassName;
+
private String url;
private String username;
diff --git a/pom.xml b/pom.xml
index 5c9b0c72dc4..88edbae2a85 100644
--- a/pom.xml
+++ b/pom.xml
@@ -113,6 +113,8 @@
<hikari-cp.version>4.0.3</hikari-cp.version>
<commons-dbcp2.version>2.9.0</commons-dbcp2.version>
+ <druid.version>1.2.18</druid.version>
+ <c3p0.version>0.9.5.5</c3p0.version>
<junit.version>5.9.2</junit.version>
<hamcrest.version>2.2</hamcrest.version>
@@ -528,6 +530,18 @@
<version>${commons-dbcp2.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>druid</artifactId>
+ <version>${druid.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.mchange</groupId>
+ <artifactId>c3p0</artifactId>
+ <version>${c3p0.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyDataSourceConfiguration.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyDataSourceConfiguration.java
index 95c90575161..ba8666d480e 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyDataSourceConfiguration.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyDataSourceConfiguration.java
@@ -30,6 +30,8 @@ import java.util.Properties;
@Setter
public final class YamlProxyDataSourceConfiguration implements
YamlConfiguration {
+ private String dataSourceClassName;
+
private String url;
private String username;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapper.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapper.java
index ff12fac2f47..ecca599349a 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapper.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/swapper/YamlProxyDataSourceConfigurationSwapper.java
@@ -38,7 +38,7 @@ public final class YamlProxyDataSourceConfigurationSwapper {
}
private ConnectionConfiguration swapConnectionConfiguration(final
YamlProxyDataSourceConfiguration yamlConfig) {
- return new ConnectionConfiguration(yamlConfig.getUrl(),
yamlConfig.getUsername(), yamlConfig.getPassword());
+ return new
ConnectionConfiguration(yamlConfig.getDataSourceClassName(),
yamlConfig.getUrl(), yamlConfig.getUsername(), yamlConfig.getPassword());
}
private PoolConfiguration swapPoolConfiguration(final
YamlProxyDataSourceConfiguration yamlConfig) {
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
index f9ae730148e..1ca45af1ed3 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
@@ -19,13 +19,13 @@ package
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
-import com.zaxxer.hikari.HikariDataSource;
import
org.apache.shardingsphere.distsql.handler.ral.constant.DistSQLScriptConstants;
import
org.apache.shardingsphere.distsql.handler.ral.query.ConvertRuleConfigurationProvider;
import
org.apache.shardingsphere.distsql.handler.ral.query.QueryableRALExecutor;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ConvertYamlConfigurationStatement;
import
org.apache.shardingsphere.encrypt.api.config.CompatibleEncryptRuleConfiguration;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
+import
org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
import
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
import
org.apache.shardingsphere.infra.datasource.props.custom.CustomDataSourceProperties;
@@ -120,7 +120,8 @@ public final class ConvertYamlConfigurationExecutor
implements QueryableRALExecu
Iterator<Entry<String, YamlProxyDataSourceConfiguration>> iterator =
dataSources.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, YamlProxyDataSourceConfiguration> entry =
iterator.next();
- DataSourceProperties dataSourceProps =
DataSourcePropertiesCreator.create(HikariDataSource.class.getName(),
dataSourceConfigSwapper.swap(entry.getValue()));
+ DataSourceConfiguration dataSourceConfig =
dataSourceConfigSwapper.swap(entry.getValue());
+ DataSourceProperties dataSourceProps =
DataSourcePropertiesCreator.create(dataSourceConfig);
appendResource(entry.getKey(), dataSourceProps, stringBuilder);
if (iterator.hasNext()) {
stringBuilder.append(DistSQLScriptConstants.COMMA);
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java
index 34df57dfcd8..8db5512bd2e 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.proxy.backend.util;
-import com.zaxxer.hikari.HikariDataSource;
import
org.apache.shardingsphere.broadcast.api.config.BroadcastRuleConfiguration;
import org.apache.shardingsphere.broadcast.rule.BroadcastRule;
import
org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration;
@@ -34,8 +33,9 @@ import
org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguratio
import
org.apache.shardingsphere.encrypt.yaml.swapper.YamlCompatibleEncryptRuleConfigurationSwapper;
import
org.apache.shardingsphere.encrypt.yaml.swapper.YamlEncryptRuleConfigurationSwapper;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.database.DatabaseTypeEngine;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
+import
org.apache.shardingsphere.infra.datasource.config.DataSourceConfiguration;
import
org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator;
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
import
org.apache.shardingsphere.infra.datasource.props.DataSourcePropertiesCreator;
@@ -149,7 +149,8 @@ public final class YamlDatabaseConfigurationImportExecutor {
private void addResources(final String databaseName, final Map<String,
YamlProxyDataSourceConfiguration> yamlDataSourceMap) {
Map<String, DataSourceProperties> dataSourcePropsMap = new
LinkedHashMap<>(yamlDataSourceMap.size(), 1F);
for (Entry<String, YamlProxyDataSourceConfiguration> entry :
yamlDataSourceMap.entrySet()) {
- dataSourcePropsMap.put(entry.getKey(),
DataSourcePropertiesCreator.create(HikariDataSource.class.getName(),
dataSourceConfigSwapper.swap(entry.getValue())));
+ DataSourceConfiguration dataSourceConfig =
dataSourceConfigSwapper.swap(entry.getValue());
+ dataSourcePropsMap.put(entry.getKey(),
DataSourcePropertiesCreator.create(dataSourceConfig));
}
validateHandler.validate(dataSourcePropsMap);
try {
diff --git a/proxy/bootstrap/pom.xml b/proxy/bootstrap/pom.xml
index 1f30c4d35b5..75f57b0911c 100644
--- a/proxy/bootstrap/pom.xml
+++ b/proxy/bootstrap/pom.xml
@@ -142,6 +142,21 @@
<artifactId>HikariCP</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>druid</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.mchange</groupId>
+ <artifactId>c3p0</artifactId>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>ch.qos.logback</groupId>