You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/09/02 03:04:38 UTC
[shardingsphere] branch master updated: Add JDBCParameterDecorator
to decouple ProxyGovernanceSchemaContexts.createDataSources (#7211)
This is an automated email from the ASF dual-hosted git repository.
zhangyonglun 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 e1ff06a Add JDBCParameterDecorator to decouple ProxyGovernanceSchemaContexts.createDataSources (#7211)
e1ff06a is described below
commit e1ff06a897aa8c9f4c130c36fe6bb017284811c3
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Sep 2 11:04:18 2020 +0800
Add JDBCParameterDecorator to decouple ProxyGovernanceSchemaContexts.createDataSources (#7211)
* Add JDBCParameterDecorator
* Add HikariJDBCParameterDecorator
* fix check style
* Move DataSourceConverter
* Add org.apache.shardingsphere.infra.config.datasource package
* Merge createDataSourcesMap
* Fix compile error
* Fix compile error
---
.../event/datasource/DataSourceChangedEvent.java | 2 +-
.../core/common/event/schema/SchemaAddedEvent.java | 2 +-
.../DataSourceConfigurationYamlSwapper.java | 2 +-
.../DataSourceConfigurationYamlSwapperTest.java | 2 +-
.../governance/core/config/ConfigCenter.java | 8 +--
.../governance/core/config/ConfigCenterTest.java | 2 +-
.../governance/core/facade/GovernanceFacade.java | 2 +-
.../core/facade/GovernanceFacadeTest.java | 2 +-
.../core/schema/GovernanceSchemaContexts.java | 11 ++-
.../core/schema/GovernanceSchemaContextsTest.java | 2 +-
.../fixture/GovernanceSchemaContextsFixture.java | 12 +---
.../src/test/resources/logback-test.xml | 34 +++++++++
.../{ => datasource}/DataSourceConfiguration.java | 12 +++-
.../config/datasource}/DataSourceConverter.java | 3 +-
.../datasource/JDBCParameterDecorator.java} | 75 ++++++++++---------
.../infra/eventbus/ShardingSphereEventBus.java | 84 +++++++++++-----------
.../infra/eventbus/event/DataSourceEvent.java | 72 +++++++++----------
.../infra/eventbus/event/MetaDataEvent.java | 68 +++++++++---------
.../infra/eventbus/event/RuleEvent.java | 72 +++++++++----------
.../infra/eventbus/event/SchemaNameEvent.java | 66 ++++++++---------
.../infra/config/DataSourceConfigurationTest.java | 1 +
.../infra/config}/DataSourceConverterTest.java | 5 +-
.../infra/eventbus/ShardingSphereEventBusTest.java | 62 ++++++++--------
.../GovernanceShardingSphereDataSource.java | 4 +-
.../schema/JDBCGovernanceSchemaContexts.java | 13 +---
.../GovernanceShardingSphereDataSourceTest.java | 2 +-
.../schema/JDBCGovernanceSchemaContextsTest.java | 4 +-
.../backend/text/admin/RDLBackendHandler.java | 2 +-
.../proxy/governance/GovernanceBootstrap.java | 2 +-
.../proxy/governance/GovernanceBootstrapTest.java | 2 +-
.../proxy/config/util/DataSourceConverter.java | 2 +-
.../proxy/config/util/DataSourceConverterTest.java | 2 +-
.../shardingsphere-proxy-governance/pom.xml | 6 ++
.../schema/HikariJDBCParameterDecorator.java | 48 +++++++++++++
.../schema/ProxyGovernanceSchemaContexts.java | 19 +----
....infra.config.datasource.JDBCParameterDecorator | 18 +++++
.../core/utils/ConfigurationYamlConverter.java | 2 +-
.../scaling/core/utils/SyncConfigurationUtil.java | 2 +-
38 files changed, 413 insertions(+), 316 deletions(-)
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/event/datasource/DataSourceChangedEvent.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/event/datasource/DataSourceChangedEvent.java
index f2ea5e5..b494c85 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/event/datasource/DataSourceChangedEvent.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/event/datasource/DataSourceChangedEvent.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.governance.core.common.event.datasource;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.governance.core.common.event.GovernanceEvent;
import java.util.Map;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/event/schema/SchemaAddedEvent.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/event/schema/SchemaAddedEvent.java
index 0593f98..8393031 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/event/schema/SchemaAddedEvent.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/event/schema/SchemaAddedEvent.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.governance.core.common.event.schema;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.governance.core.common.event.GovernanceEvent;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/yaml/swapper/DataSourceConfigurationYamlSwapper.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/yaml/swapper/DataSourceConfigurationYamlSwapper.java
index 51aa54b..ae073c8 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/yaml/swapper/DataSourceConfigurationYamlSwapper.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/common/yaml/swapper/DataSourceConfigurationYamlSwapper.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.common.yaml.swapper;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
import org.apache.shardingsphere.governance.core.common.yaml.config.YamlDataSourceConfiguration;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/common/yaml/swapper/DataSourceConfigurationYamlSwapperTest.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/common/yaml/swapper/DataSourceConfigurationYamlSwapperTest.java
index 2fee888..dbe23ac 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/common/yaml/swapper/DataSourceConfigurationYamlSwapperTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/common/yaml/swapper/DataSourceConfigurationYamlSwapperTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.common.yaml.swapper;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.governance.core.common.yaml.config.YamlDataSourceConfiguration;
import org.junit.Test;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
index 3b7b6ff..aa9b67e 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
@@ -24,11 +24,14 @@ import com.google.common.base.Strings;
import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
+import org.apache.shardingsphere.governance.core.common.yaml.config.YamlDataSourceConfiguration;
+import org.apache.shardingsphere.governance.core.common.yaml.swapper.DataSourceConfigurationYamlSwapper;
+import org.apache.shardingsphere.governance.repository.api.ConfigurationRepository;
import org.apache.shardingsphere.infra.auth.Authentication;
import org.apache.shardingsphere.infra.auth.yaml.config.YamlAuthenticationConfiguration;
import org.apache.shardingsphere.infra.auth.yaml.swapper.AuthenticationYamlSwapper;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
import org.apache.shardingsphere.infra.eventbus.event.DataSourceEvent;
import org.apache.shardingsphere.infra.eventbus.event.RuleEvent;
@@ -38,9 +41,6 @@ import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
import org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.masterslave.algorithm.config.AlgorithmProvidedMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.masterslave.api.config.MasterSlaveRuleConfiguration;
-import org.apache.shardingsphere.governance.core.common.yaml.config.YamlDataSourceConfiguration;
-import org.apache.shardingsphere.governance.core.common.yaml.swapper.DataSourceConfigurationYamlSwapper;
-import org.apache.shardingsphere.governance.repository.api.ConfigurationRepository;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.sharding.algorithm.config.AlgorithmProvidedShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/test/java/org/apache/shardingsphere/governance/core/config/ConfigCenterTest.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/test/java/org/apache/shardingsphere/governance/core/config/ConfigCenterTest.java
index febe474..3ebb20c 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/test/java/org/apache/shardingsphere/governance/core/config/ConfigCenterTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-config/src/test/java/org/apache/shardingsphere/governance/core/config/ConfigCenterTest.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import org.apache.shardingsphere.infra.auth.Authentication;
import org.apache.shardingsphere.infra.auth.yaml.config.YamlAuthenticationConfiguration;
import org.apache.shardingsphere.infra.auth.yaml.swapper.AuthenticationYamlSwapper;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-facade/src/main/java/org/apache/shardingsphere/governance/core/facade/GovernanceFacade.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-facade/src/main/java/org/apache/shardingsphere/governance/core/facade/GovernanceFacade.java
index 0ef6f3e..0b0b33f 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-facade/src/main/java/org/apache/shardingsphere/governance/core/facade/GovernanceFacade.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-facade/src/main/java/org/apache/shardingsphere/governance/core/facade/GovernanceFacade.java
@@ -21,7 +21,7 @@ import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.auth.Authentication;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.governance.core.config.ConfigCenter;
import org.apache.shardingsphere.governance.core.facade.listener.GovernanceListenerManager;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-facade/src/test/java/org/apache/shardingsphere/governance/core/facade/GovernanceFacadeTest.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-facade/src/test/java/org/apache/shardingsphere/governance/core/facade/GovernanceFacadeTest.java
index 44bb10a..5ab5217 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-facade/src/test/java/org/apache/shardingsphere/governance/core/facade/GovernanceFacadeTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-facade/src/test/java/org/apache/shardingsphere/governance/core/facade/GovernanceFacadeTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.governance.core.facade;
import org.apache.shardingsphere.infra.auth.Authentication;
import org.apache.shardingsphere.infra.auth.ProxyUser;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.governance.core.config.ConfigCenter;
import org.apache.shardingsphere.governance.core.facade.listener.GovernanceListenerManager;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/main/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContexts.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/main/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContexts.java
index 1bf51bb..fdd7315 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/main/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContexts.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/main/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContexts.java
@@ -32,8 +32,9 @@ import org.apache.shardingsphere.governance.core.registry.event.CircuitStateChan
import org.apache.shardingsphere.governance.core.registry.event.DisabledStateChangedEvent;
import org.apache.shardingsphere.governance.core.registry.schema.GovernanceSchema;
import org.apache.shardingsphere.infra.auth.Authentication;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.context.SchemaContext;
@@ -335,5 +336,11 @@ public abstract class GovernanceSchemaContexts implements SchemaContexts {
protected abstract Map<String, DataSource> getModifiedDataSources(SchemaContext oldSchemaContext, Map<String, DataSourceConfiguration> newDataSourceConfigs);
- protected abstract Map<String, Map<String, DataSource>> createDataSourcesMap(Map<String, Map<String, DataSourceConfiguration>> dataSourcesConfigs);
+ private Map<String, Map<String, DataSource>> createDataSourcesMap(final Map<String, Map<String, DataSourceConfiguration>> dataSourcesConfigs) {
+ Map<String, Map<String, DataSource>> result = new LinkedHashMap<>(dataSourcesConfigs.size(), 1);
+ for (Entry<String, Map<String, DataSourceConfiguration>> entry : dataSourcesConfigs.entrySet()) {
+ result.put(entry.getKey(), DataSourceConverter.getDataSourceMap(entry.getValue()));
+ }
+ return result;
+ }
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContextsTest.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContextsTest.java
index 530f77e..aeaa3f2 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContextsTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/java/org/apache/shardingsphere/governance/core/schema/GovernanceSchemaContextsTest.java
@@ -34,7 +34,7 @@ import org.apache.shardingsphere.governance.core.registry.event.DisabledStateCha
import org.apache.shardingsphere.governance.core.registry.schema.GovernanceSchema;
import org.apache.shardingsphere.governance.core.schema.fixture.GovernanceSchemaContextsFixture;
import org.apache.shardingsphere.infra.auth.Authentication;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.apache.shardingsphere.infra.context.SchemaContext;
import org.apache.shardingsphere.infra.context.impl.StandardSchemaContexts;
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/java/org/apache/shardingsphere/governance/core/schema/fixture/GovernanceSchemaContextsFixture.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/java/org/apache/shardingsphere/governance/core/schema/fixture/GovernanceSchemaContextsFixture.java
index 0f329bb..c59992f 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/java/org/apache/shardingsphere/governance/core/schema/fixture/GovernanceSchemaContextsFixture.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/java/org/apache/shardingsphere/governance/core/schema/fixture/GovernanceSchemaContextsFixture.java
@@ -21,7 +21,7 @@ import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
import org.apache.shardingsphere.governance.core.schema.GovernanceSchemaContexts;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.context.SchemaContext;
import org.apache.shardingsphere.infra.context.SchemaContexts;
import org.apache.shardingsphere.infra.context.schema.DataSourceParameter;
@@ -58,16 +58,6 @@ public final class GovernanceSchemaContextsFixture extends GovernanceSchemaConte
return result;
}
- @Override
- protected Map<String, Map<String, DataSource>> createDataSourcesMap(final Map<String, Map<String, DataSourceConfiguration>> dataSourcesConfigs) {
- Map<String, Map<String, DataSourceParameter>> dataSourceParametersMap = createDataSourceParametersMap(dataSourcesConfigs);
- Map<String, Map<String, DataSource>> result = new LinkedHashMap<>(dataSourceParametersMap.size(), 1);
- for (Entry<String, Map<String, DataSourceParameter>> entry : dataSourceParametersMap.entrySet()) {
- result.put(entry.getKey(), createDataSources(entry.getValue()));
- }
- return result;
- }
-
private Map<String, DataSource> createDataSources(final Map<String, DataSourceParameter> dataSourceParameters) {
Map<String, DataSource> result = new LinkedHashMap<>(dataSourceParameters.size(), 1);
for (Entry<String, DataSourceParameter> entry: dataSourceParameters.entrySet()) {
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/resources/logback-test.xml b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..1af4509
--- /dev/null
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-schema/src/test/resources/logback-test.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration>
+ <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>[%-5level] %d{HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <logger name="org.apache.shardingsphere" level="warn" additivity="false">
+ <appender-ref ref="console"/>
+ </logger>
+ <logger name="org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.executor.ExecutorExceptionHandler" level="off" />
+
+ <root>
+ <level value="error" />
+ <appender-ref ref="console" />
+ </root>
+</configuration>
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/DataSourceConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConfiguration.java
similarity index 90%
rename from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/DataSourceConfiguration.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConfiguration.java
index 709fbcb..6bc0d73 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/DataSourceConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConfiguration.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.config;
+package org.apache.shardingsphere.infra.config.datasource;
import com.google.common.base.CaseFormat;
import com.google.common.base.Joiner;
@@ -24,6 +24,7 @@ import com.google.common.collect.Sets;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import javax.sql.DataSource;
import java.lang.reflect.Method;
@@ -51,6 +52,7 @@ public final class DataSourceConfiguration {
private static final Collection<String> SKIPPED_PROPERTY_NAMES;
static {
+ ShardingSphereServiceLoader.register(JDBCParameterDecorator.class);
GENERAL_CLASS_TYPE = Sets.newHashSet(boolean.class, Boolean.class, int.class, Integer.class, long.class, Long.class, String.class, Collection.class, List.class);
SKIPPED_PROPERTY_NAMES = Sets.newHashSet("loginTimeout");
}
@@ -100,6 +102,7 @@ public final class DataSourceConfiguration {
*
* @return data source
*/
+ @SuppressWarnings("unchecked")
@SneakyThrows(ReflectiveOperationException.class)
public DataSource createDataSource() {
DataSource result = (DataSource) Class.forName(dataSourceClassName).getConstructor().newInstance();
@@ -113,9 +116,16 @@ public final class DataSourceConfiguration {
setterMethod.get().invoke(result, entry.getValue());
}
}
+ findJDBCParameterDecorator(result).ifPresent(decorator -> decorator.decorate(result));
return result;
}
+ @SuppressWarnings("rawtypes")
+ private Optional<JDBCParameterDecorator> findJDBCParameterDecorator(final DataSource dataSource) {
+ return ShardingSphereServiceLoader.newServiceInstances(JDBCParameterDecorator.class).stream().filter(each -> each.getType() == dataSource.getClass()).findFirst();
+
+ }
+
private Optional<Method> findSetterMethod(final Method[] methods, final String property) {
String setterMethodName = Joiner.on("").join(SETTER_PREFIX, CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, property));
for (Method each : methods) {
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/util/DataSourceConverter.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConverter.java
similarity index 93%
rename from shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/util/DataSourceConverter.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConverter.java
index f253161..f50ba22 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/util/DataSourceConverter.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/DataSourceConverter.java
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.driver.governance.internal.util;
+package org.apache.shardingsphere.infra.config.datasource;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
import javax.sql.DataSource;
import java.util.LinkedHashMap;
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/SchemaNameEvent.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/JDBCParameterDecorator.java
similarity index 63%
copy from shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/SchemaNameEvent.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/JDBCParameterDecorator.java
index 11164e3..f6f26a8 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/SchemaNameEvent.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/datasource/JDBCParameterDecorator.java
@@ -1,33 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.eventbus.event;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Schema name event.
- */
-@RequiredArgsConstructor
-@Getter
-public class SchemaNameEvent {
-
- private final String schemaName;
-
- private final boolean overwrite;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.config.datasource;
+
+import javax.sql.DataSource;
+
+/**
+ * JDBC parameter decorator.
+ *
+ * @param <T> type of data source
+ */
+public interface JDBCParameterDecorator<T extends DataSource> {
+
+ /**
+ * Decorate data source.
+ *
+ * @param dataSource data source to be decorated
+ */
+ void decorate(T dataSource);
+
+ /**
+ * Get data source type.
+ *
+ * @return data source type
+ */
+ Class<T> getType();
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBus.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBus.java
index 9e131eb..4e37ba5 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBus.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBus.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.eventbus;
-
-import com.google.common.eventbus.EventBus;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-/**
- * ShardingSphere event bus.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ShardingSphereEventBus {
-
- /**
- * Get instance of ShardingSphere event bus.
- *
- * @return instance of ShardingSphere event bus
- */
- public static EventBus getInstance() {
- return ShardingSphereEventBusHolder.INSTANCE;
- }
-
- private static final class ShardingSphereEventBusHolder {
- private static final EventBus INSTANCE = new EventBus();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.eventbus;
+
+import com.google.common.eventbus.EventBus;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+/**
+ * ShardingSphere event bus.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ShardingSphereEventBus {
+
+ /**
+ * Get instance of ShardingSphere event bus.
+ *
+ * @return instance of ShardingSphere event bus
+ */
+ public static EventBus getInstance() {
+ return ShardingSphereEventBusHolder.INSTANCE;
+ }
+
+ private static final class ShardingSphereEventBusHolder {
+ private static final EventBus INSTANCE = new EventBus();
+ }
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/DataSourceEvent.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/DataSourceEvent.java
index 9c38d33..9e505b2 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/DataSourceEvent.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/DataSourceEvent.java
@@ -1,36 +1,36 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.eventbus.event;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
-
-import java.util.Map;
-
-/**
- * Data source event.
- */
-@RequiredArgsConstructor
-@Getter
-public class DataSourceEvent {
-
- private final String schemaName;
-
- private final Map<String, DataSourceConfiguration> dataSourceConfigurations;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.eventbus.event;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
+
+import java.util.Map;
+
+/**
+ * Data source event.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class DataSourceEvent {
+
+ private final String schemaName;
+
+ private final Map<String, DataSourceConfiguration> dataSourceConfigurations;
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/MetaDataEvent.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/MetaDataEvent.java
index c7078b8..b68f2e4 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/MetaDataEvent.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/MetaDataEvent.java
@@ -1,34 +1,34 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.eventbus.event;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.metadata.schema.RuleSchemaMetaData;
-
-/**
- * Meta data event.
- */
-@RequiredArgsConstructor
-@Getter
-public class MetaDataEvent {
-
- private final String schemaName;
-
- private final RuleSchemaMetaData metaData;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.eventbus.event;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.metadata.schema.RuleSchemaMetaData;
+
+/**
+ * Meta data event.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class MetaDataEvent {
+
+ private final String schemaName;
+
+ private final RuleSchemaMetaData metaData;
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/RuleEvent.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/RuleEvent.java
index 11c178d..2a09e5f 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/RuleEvent.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/RuleEvent.java
@@ -1,36 +1,36 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.eventbus.event;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
-
-import java.util.Collection;
-
-/**
- * Rule event.
- */
-@RequiredArgsConstructor
-@Getter
-public class RuleEvent {
-
- private final String schemaName;
-
- private final Collection<RuleConfiguration> ruleConfigurations;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.eventbus.event;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+
+import java.util.Collection;
+
+/**
+ * Rule event.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class RuleEvent {
+
+ private final String schemaName;
+
+ private final Collection<RuleConfiguration> ruleConfigurations;
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/SchemaNameEvent.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/SchemaNameEvent.java
index 11164e3..3a63d37 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/SchemaNameEvent.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/event/SchemaNameEvent.java
@@ -1,33 +1,33 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.eventbus.event;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Schema name event.
- */
-@RequiredArgsConstructor
-@Getter
-public class SchemaNameEvent {
-
- private final String schemaName;
-
- private final boolean overwrite;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.eventbus.event;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * Schema name event.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class SchemaNameEvent {
+
+ private final String schemaName;
+
+ private final boolean overwrite;
+}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConfigurationTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConfigurationTest.java
index a86ccb3..b0d0672 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConfigurationTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConfigurationTest.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.infra.config;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.commons.dbcp2.BasicDataSource;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.junit.Test;
import java.sql.SQLException;
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/util/DataSourceConverterTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConverterTest.java
similarity index 93%
rename from shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/util/DataSourceConverterTest.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConverterTest.java
index b202c18..7042594 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/util/DataSourceConverterTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConverterTest.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.driver.governance.internal.util;
+package org.apache.shardingsphere.infra.config;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
import org.junit.Test;
import javax.sql.DataSource;
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBusTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBusTest.java
index ed48825..4320dca 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBusTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBusTest.java
@@ -1,31 +1,31 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.eventbus;
-
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class ShardingSphereEventBusTest {
-
- @Test
- public void assertInstance() {
- assertThat(ShardingSphereEventBus.getInstance(), is(ShardingSphereEventBus.getInstance()));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.eventbus;
+
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class ShardingSphereEventBusTest {
+
+ @Test
+ public void assertInstance() {
+ assertThat(ShardingSphereEventBus.getInstance(), is(ShardingSphereEventBus.getInstance()));
+ }
+}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSource.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSource.java
index dcc4e21..61a4c25 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSource.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSource.java
@@ -22,14 +22,14 @@ import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.driver.governance.internal.circuit.datasource.CircuitBreakerDataSource;
import org.apache.shardingsphere.driver.governance.internal.schema.JDBCGovernanceSchemaContexts;
-import org.apache.shardingsphere.driver.governance.internal.util.DataSourceConverter;
import org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
import org.apache.shardingsphere.driver.jdbc.unsupported.AbstractUnsupportedOperationDataSource;
import org.apache.shardingsphere.governance.core.config.ConfigCenter;
import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
import org.apache.shardingsphere.governance.repository.api.config.GovernanceConfiguration;
import org.apache.shardingsphere.infra.auth.Authentication;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.context.SchemaContexts;
import org.apache.shardingsphere.infra.context.SchemaContextsBuilder;
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContexts.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContexts.java
index 1a19622..92e557c 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContexts.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContexts.java
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.driver.governance.internal.schema;
import com.google.common.collect.Maps;
-import org.apache.shardingsphere.driver.governance.internal.util.DataSourceConverter;
import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
import org.apache.shardingsphere.governance.core.schema.GovernanceSchemaContexts;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
import org.apache.shardingsphere.infra.context.SchemaContext;
import org.apache.shardingsphere.infra.context.SchemaContexts;
import org.apache.shardingsphere.infra.database.DefaultSchema;
@@ -58,13 +58,4 @@ public final class JDBCGovernanceSchemaContexts extends GovernanceSchemaContexts
Map<String, DataSourceConfiguration> oldDataSourceConfigs = DataSourceConverter.getDataSourceConfigurationMap(getSchemaContexts().get(DefaultSchema.LOGIC_NAME).getSchema().getDataSources());
return oldDataSourceConfigs.containsKey(dataSourceConfigs.getKey()) && !oldDataSourceConfigs.get(dataSourceConfigs.getKey()).equals(dataSourceConfigs.getValue());
}
-
- @Override
- protected Map<String, Map<String, DataSource>> createDataSourcesMap(final Map<String, Map<String, DataSourceConfiguration>> dataSourcesConfigs) {
- Map<String, Map<String, DataSource>> result = new LinkedHashMap<>(dataSourcesConfigs.size(), 1);
- for (Entry<String, Map<String, DataSourceConfiguration>> entry : dataSourcesConfigs.entrySet()) {
- result.put(entry.getKey(), DataSourceConverter.getDataSourceMap(entry.getValue()));
- }
- return result;
- }
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
index 5bac954..11bf542 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.governance.core.registry.event.DisabledStateCha
import org.apache.shardingsphere.governance.core.registry.schema.GovernanceSchema;
import org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
import org.apache.shardingsphere.governance.repository.api.config.GovernanceConfiguration;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.context.SchemaContexts;
import org.apache.shardingsphere.infra.database.DefaultSchema;
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContextsTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContextsTest.java
index 51286ae..bb76ed0 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContextsTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/schema/JDBCGovernanceSchemaContextsTest.java
@@ -18,11 +18,11 @@
package org.apache.shardingsphere.driver.governance.internal.schema;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.apache.shardingsphere.driver.governance.internal.util.DataSourceConverter;
import org.apache.shardingsphere.governance.core.common.event.datasource.DataSourceChangedEvent;
import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
import org.apache.shardingsphere.infra.auth.Authentication;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
import org.apache.shardingsphere.infra.context.SchemaContext;
import org.apache.shardingsphere.infra.context.impl.StandardSchemaContexts;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/RDLBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/RDLBackendHandler.java
index 77f3448..07e12c1 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/RDLBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/RDLBackendHandler.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.proxy.backend.text.admin;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.context.impl.StandardSchemaContexts;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/governance/GovernanceBootstrap.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/governance/GovernanceBootstrap.java
index f1e005a..90a4d79 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/governance/GovernanceBootstrap.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/governance/GovernanceBootstrap.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.governance;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.auth.Authentication;
import org.apache.shardingsphere.infra.auth.yaml.swapper.AuthenticationYamlSwapper;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.yaml.swapper.YamlRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.infra.context.schema.DataSourceParameter;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/governance/GovernanceBootstrapTest.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/governance/GovernanceBootstrapTest.java
index addc378..b84aeab 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/governance/GovernanceBootstrapTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/governance/GovernanceBootstrapTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.governance;
import com.zaxxer.hikari.HikariDataSource;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
import org.apache.shardingsphere.proxy.config.ProxyConfiguration;
import org.apache.shardingsphere.proxy.config.ProxyConfigurationLoader;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/util/DataSourceConverter.java b/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/util/DataSourceConverter.java
index 5a3b6ce..59bd960 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/util/DataSourceConverter.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/main/java/org/apache/shardingsphere/proxy/config/util/DataSourceConverter.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.config.util;
import com.zaxxer.hikari.HikariDataSource;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.context.schema.DataSourceParameter;
import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/util/DataSourceConverterTest.java b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/util/DataSourceConverterTest.java
index d17277b..38d6d41 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/util/DataSourceConverterTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/util/DataSourceConverterTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.config.util;
import com.zaxxer.hikari.HikariDataSource;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.context.schema.DataSourceParameter;
import org.junit.Test;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-governance/pom.xml b/shardingsphere-proxy/shardingsphere-proxy-governance/pom.xml
index 7a0859d..9927316 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-governance/pom.xml
+++ b/shardingsphere-proxy/shardingsphere-proxy-governance/pom.xml
@@ -54,5 +54,11 @@
<artifactId>shardingsphere-governance-core-schema</artifactId>
<version>${project.parent.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/HikariJDBCParameterDecorator.java b/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/HikariJDBCParameterDecorator.java
new file mode 100644
index 0000000..c6af5ff
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/HikariJDBCParameterDecorator.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.governance.schema;
+
+import com.zaxxer.hikari.HikariDataSource;
+import org.apache.shardingsphere.infra.config.datasource.JDBCParameterDecorator;
+
+/**
+ * JDBC parameter decorator for HikariCP.
+ */
+public final class HikariJDBCParameterDecorator implements JDBCParameterDecorator<HikariDataSource> {
+
+ @Override
+ public void decorate(final HikariDataSource dataSource) {
+ dataSource.getDataSourceProperties().setProperty("useServerPrepStmts", Boolean.TRUE.toString());
+ dataSource.getDataSourceProperties().setProperty("cachePrepStmts", "true");
+ dataSource.getDataSourceProperties().setProperty("prepStmtCacheSize", "250");
+ dataSource.getDataSourceProperties().setProperty("prepStmtCacheSqlLimit", "2048");
+ dataSource.getDataSourceProperties().setProperty("useLocalSessionState", Boolean.TRUE.toString());
+ dataSource.getDataSourceProperties().setProperty("rewriteBatchedStatements", Boolean.TRUE.toString());
+ dataSource.getDataSourceProperties().setProperty("cacheResultSetMetadata", Boolean.FALSE.toString());
+ dataSource.getDataSourceProperties().setProperty("cacheServerConfiguration", Boolean.TRUE.toString());
+ dataSource.getDataSourceProperties().setProperty("elideSetAutoCommits", Boolean.TRUE.toString());
+ dataSource.getDataSourceProperties().setProperty("maintainTimeStats", Boolean.FALSE.toString());
+ dataSource.getDataSourceProperties().setProperty("netTimeoutForStreamingResults", "0");
+ dataSource.getDataSourceProperties().setProperty("tinyInt1isBit", Boolean.FALSE.toString());
+ }
+
+ @Override
+ public Class<HikariDataSource> getType() {
+ return HikariDataSource.class;
+ }
+}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/ProxyGovernanceSchemaContexts.java b/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/ProxyGovernanceSchemaContexts.java
index 6ade69c..77ba834 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/ProxyGovernanceSchemaContexts.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/java/org/apache/shardingsphere/proxy/governance/schema/ProxyGovernanceSchemaContexts.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.governance.schema;
import com.google.common.collect.Maps;
import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
import org.apache.shardingsphere.governance.core.schema.GovernanceSchemaContexts;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.context.SchemaContext;
import org.apache.shardingsphere.infra.context.SchemaContexts;
import org.apache.shardingsphere.infra.context.schema.DataSourceParameter;
@@ -67,23 +67,6 @@ public final class ProxyGovernanceSchemaContexts extends GovernanceSchemaContext
return oldDataSources.containsKey(newDataSourceName) && !DataSourceConverter.getDataSourceParameter(oldDataSources.get(newDataSourceName)).equals(newDataSourceParameter);
}
- @Override
- protected Map<String, Map<String, DataSource>> createDataSourcesMap(final Map<String, Map<String, DataSourceConfiguration>> dataSourcesConfigs) {
- Map<String, Map<String, DataSource>> result = new LinkedHashMap<>(dataSourcesConfigs.size(), 1);
- for (Entry<String, Map<String, DataSourceParameter>> entry : createDataSourceParametersMap(dataSourcesConfigs).entrySet()) {
- result.put(entry.getKey(), createDataSources(entry.getValue()));
- }
- return result;
- }
-
- private Map<String, Map<String, DataSourceParameter>> createDataSourceParametersMap(final Map<String, Map<String, DataSourceConfiguration>> dataSourcesConfigs) {
- Map<String, Map<String, DataSourceParameter>> result = new LinkedHashMap<>(dataSourcesConfigs.size(), 1);
- for (Entry<String, Map<String, DataSourceConfiguration>> entry : dataSourcesConfigs.entrySet()) {
- result.put(entry.getKey(), DataSourceConverter.getDataSourceParameterMap(entry.getValue()));
- }
- return result;
- }
-
private Map<String, DataSource> createDataSources(final Map<String, DataSourceParameter> dataSourceParameters) {
Map<String, DataSource> result = new LinkedHashMap<>(dataSourceParameters.size(), 1);
for (Entry<String, DataSourceParameter> entry: dataSourceParameters.entrySet()) {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.JDBCParameterDecorator b/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.JDBCParameterDecorator
new file mode 100644
index 0000000..bb4db52
--- /dev/null
+++ b/shardingsphere-proxy/shardingsphere-proxy-governance/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.datasource.JDBCParameterDecorator
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.proxy.governance.schema.HikariJDBCParameterDecorator
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/utils/ConfigurationYamlConverter.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/utils/ConfigurationYamlConverter.java
index f8034d9..e7d22da 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/utils/ConfigurationYamlConverter.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/utils/ConfigurationYamlConverter.java
@@ -21,7 +21,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
import org.apache.shardingsphere.governance.core.common.yaml.config.YamlDataSourceConfiguration;
import org.apache.shardingsphere.governance.core.common.yaml.swapper.DataSourceConfigurationYamlSwapper;
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/utils/SyncConfigurationUtil.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/utils/SyncConfigurationUtil.java
index 3c2d804..51eae0d 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/utils/SyncConfigurationUtil.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/utils/SyncConfigurationUtil.java
@@ -21,7 +21,7 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
import org.apache.shardingsphere.scaling.core.config.ImporterConfiguration;
import org.apache.shardingsphere.scaling.core.config.JDBCDataSourceConfiguration;