You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/08/21 10:20:47 UTC
[shardingsphere] branch master updated: Refactor gov spring
namespace to cluster (#11935)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 6613f9f Refactor gov spring namespace to cluster (#11935)
6613f9f is described below
commit 6613f9f9ae3b63d611aa417ab61ff8be3cc05051
Author: Liang Zhang <te...@163.com>
AuthorDate: Sat Aug 21 18:20:18 2021 +0800
Refactor gov spring namespace to cluster (#11935)
* Rename ClusterPersistRepositoryConfiguration
* Refactor gov spring namespace
* Refactor standalone spring name space
* Refactor cluster spring name space
* Remove useless codes
* Move cluster repository.xsd
* Move standalone repository.xsd
* Rename test cases
---
.../shardingsphere-jdbc/java-api.en.md | 2 +-
.../configuration/java-api/governance.cn.md | 2 +-
.../configuration/java-api/governance.en.md | 2 +-
.../jdbc/config/ClusterModeConfigurationUtil.java | 20 ++---
.../zookeeper/cloud/application-encrypt.xml | 6 +-
.../cloud/application-readwrite-splitting.xml | 6 +-
.../zookeeper/cloud/application-shadow.xml | 6 +-
.../application-sharding-databases-tables.xml | 6 +-
.../zookeeper/local/application-encrypt.xml | 6 +-
.../local/application-readwrite-splitting.xml | 6 +-
.../zookeeper/local/application-shadow.xml | 6 +-
.../application-sharding-databases-tables.xml | 6 +-
.../META-INF/zookeeper/registry-center.xml | 6 +-
.../governance/core/mode/ClusterModeBuilder.java | 14 +--
.../registry/RegistryCenterRepositoryFactory.java | 4 +-
...rPersistRepositoryConfigurationYamlSwapper.java | 10 +--
.../RegistryCenterRepositoryFactoryTest.java | 4 +-
.../fixture/RegistryCenterRepositoryFixture.java | 4 +-
...ProcessListRegistryCenterRepositoryFixture.java | 9 +-
... => ClusterPersistRepositoryConfiguration.java} | 4 +-
.../repository/spi/RegistryCenterRepository.java | 4 +-
.../governance/repository/etcd/EtcdRepository.java | 4 +-
.../zookeeper/CuratorZookeeperRepository.java | 6 +-
.../zookeeper/CuratorZookeeperRepositoryTest.java | 12 +--
.../fixture/TestRegistryCenterRepository.java | 4 +-
.../handler/DataSourceNamespaceHandler.java | 3 -
... StandaloneModeRepositoryNamespaceHandler.java} | 10 +--
.../StandaloneModeRepositoryBeanDefinitionTag.java | 2 +-
.../resources/META-INF/namespace/datasource.xsd | 10 ---
.../namespace/mode/standalone/repository.xsd} | 23 +----
.../src/main/resources/META-INF/spring.handlers | 1 +
.../src/main/resources/META-INF/spring.schemas | 1 +
.../spring/standalone-application-context.xml | 5 +-
.../GovernanceSpringBootRegistryEncryptTest.java | 4 +-
...ceSpringBootRegistryReadwriteSplittingTest.java | 4 +-
.../GovernanceSpringBootRegistryShardingTest.java | 4 +-
...tRepositoryConfigurationBeanDefinitionTag.java} | 6 +-
.../constants/DataSourceBeanDefinitionTag.java | 42 ---------
... ClusterPersistRepositoryNamespaceHandler.java} | 13 ++-
...positoryConfigurationBeanDefinitionParser.java} | 18 ++--
.../parser/DataSourceBeanDefinitionParser.java | 99 ----------------------
.../cluster/repository.xsd} | 21 +----
.../src/main/resources/META-INF/spring.handlers | 2 +-
.../src/main/resources/META-INF/spring.schemas | 2 +-
...eTest.java => ClusterEncryptNamespaceTest.java} | 4 +-
...=> ClusterReadwriteSplittingNamespaceTest.java} | 4 +-
...Test.java => ClusterShardingNamespaceTest.java} | 4 +-
...erShardingReadwriteSplittingNamespaceTest.java} | 4 +-
.../registry/TestRegistryCenterRepository.java | 4 +-
...{encrypt-governance.xml => encrypt-cluster.xml} | 22 +++--
.../META-INF/rdb/readwrite-splitting-cluster.xml | 59 +++++++++++++
.../rdb/readwrite-splitting-governance.xml | 46 ----------
.../resources/META-INF/rdb/sharding-cluster.xml | 88 +++++++++++++++++++
.../resources/META-INF/rdb/sharding-governance.xml | 59 -------------
...ml => sharding-readwrite-splitting-cluster.xml} | 23 +++--
.../fixture/FixtureRegistryCenterRepository.java | 4 +-
.../scaling/web/HttpServerInitializerTest.java | 4 +-
.../scaling/core/api/ScalingAPIFactory.java | 8 +-
.../api/impl/GovernanceRepositoryAPIImplTest.java | 4 +-
.../scaling/core/api/impl/ScalingAPIImplTest.java | 4 +-
.../yaml/ServerConfigurationYamlSwapperTest.java | 4 +-
.../scaling/core/job/FinishedCheckJobTest.java | 4 +-
.../scaling/core/job/ScalingJobTest.java | 4 +-
63 files changed, 324 insertions(+), 458 deletions(-)
diff --git a/docs/document/content/others/api-change-history/shardingsphere-jdbc/java-api.en.md b/docs/document/content/others/api-change-history/shardingsphere-jdbc/java-api.en.md
index c6a669f..4e20e04 100644
--- a/docs/document/content/others/api-change-history/shardingsphere-jdbc/java-api.en.md
+++ b/docs/document/content/others/api-change-history/shardingsphere-jdbc/java-api.en.md
@@ -223,7 +223,7 @@ The type of registryCenter could be Zookeeper or Etcd.
*Governance Instance Configuration*
-Class name: org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration
+Class name: org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration
Attributes:
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/governance.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/governance.cn.md
index 825cc03..2733bde 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/governance.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/governance.cn.md
@@ -23,7 +23,7 @@ weight = 5
*治理实例配置*
-类名称:org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration
+类名称:org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration
可配置属性:
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/governance.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/governance.en.md
index 75934aa..390ed97 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/governance.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/governance.en.md
@@ -22,7 +22,7 @@ The type of registryCenter could be Zookeeper or Etcd.
*Governance Instance Configuration*
-Class name: org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration
+Class name: org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration
Attributes:
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/config/ClusterModeConfigurationUtil.java b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/config/ClusterModeConfigurationUtil.java
index 99b707e..e378e63 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/config/ClusterModeConfigurationUtil.java
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/governance/raw/jdbc/config/ClusterModeConfigurationUtil.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.example.governance.raw.jdbc.config;
import org.apache.shardingsphere.example.type.ShardingType;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import java.util.Properties;
@@ -28,20 +28,20 @@ public final class ClusterModeConfigurationUtil {
private static final String ZOOKEEPER_CONNECTION_STRING = "localhost:2181";
public static ModeConfiguration getZooKeeperConfiguration(final boolean overwrite, final ShardingType shardingType) {
- RegistryCenterConfiguration registryCenterConfig;
+ ClusterPersistRepositoryConfiguration clusterRepositoryConfig;
switch (shardingType) {
case SHARDING_DATABASES_AND_TABLES:
- registryCenterConfig = new RegistryCenterConfiguration("ZooKeeper", "governance-sharding-data-source", ZOOKEEPER_CONNECTION_STRING, new Properties());
- return new ModeConfiguration("Cluster", registryCenterConfig, overwrite);
+ clusterRepositoryConfig = new ClusterPersistRepositoryConfiguration("ZooKeeper", "governance-sharding-data-source", ZOOKEEPER_CONNECTION_STRING, new Properties());
+ return new ModeConfiguration("Cluster", clusterRepositoryConfig, overwrite);
case READWRITE_SPLITTING:
- registryCenterConfig = new RegistryCenterConfiguration("ZooKeeper", "governance-readwrite-splitting-data-source", ZOOKEEPER_CONNECTION_STRING, new Properties());
- return new ModeConfiguration("Cluster", registryCenterConfig, overwrite);
+ clusterRepositoryConfig = new ClusterPersistRepositoryConfiguration("ZooKeeper", "governance-readwrite-splitting-data-source", ZOOKEEPER_CONNECTION_STRING, new Properties());
+ return new ModeConfiguration("Cluster", clusterRepositoryConfig, overwrite);
case ENCRYPT:
- registryCenterConfig = new RegistryCenterConfiguration("ZooKeeper", "governance-encrypt-data-source", ZOOKEEPER_CONNECTION_STRING, new Properties());
- return new ModeConfiguration("Cluster", registryCenterConfig, overwrite);
+ clusterRepositoryConfig = new ClusterPersistRepositoryConfiguration("ZooKeeper", "governance-encrypt-data-source", ZOOKEEPER_CONNECTION_STRING, new Properties());
+ return new ModeConfiguration("Cluster", clusterRepositoryConfig, overwrite);
case SHADOW:
- registryCenterConfig = new RegistryCenterConfiguration("ZooKeeper", "governance-shadow-data-source", ZOOKEEPER_CONNECTION_STRING, new Properties());
- return new ModeConfiguration("Cluster", registryCenterConfig, overwrite);
+ clusterRepositoryConfig = new ClusterPersistRepositoryConfiguration("ZooKeeper", "governance-shadow-data-source", ZOOKEEPER_CONNECTION_STRING, new Properties());
+ return new ModeConfiguration("Cluster", clusterRepositoryConfig, overwrite);
default:
throw new UnsupportedOperationException(shardingType.toString());
}
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-encrypt.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-encrypt.xml
index 2d53a1e..f553b2c 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-encrypt.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-encrypt.xml
@@ -20,15 +20,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd">
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd">
<import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-readwrite-splitting.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-readwrite-splitting.xml
index 1fc5830..7ed45d8 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-readwrite-splitting.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-readwrite-splitting.xml
@@ -20,15 +20,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd">
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd">
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
<import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-shadow.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-shadow.xml
index f416a8f..cd5b30e 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-shadow.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-shadow.xml
@@ -20,15 +20,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd">
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd">
<import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-sharding-databases-tables.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-sharding-databases-tables.xml
index a0e0619..558e654 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-sharding-databases-tables.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/cloud/application-sharding-databases-tables.xml
@@ -20,15 +20,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd">
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd">
<import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml
index be22e19..81336bc 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-encrypt.xml
@@ -21,7 +21,7 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:encrypt="http://shardingsphere.apache.org/schema/shardingsphere/encrypt"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
@@ -30,8 +30,8 @@
http://www.springframework.org/schema/tx/spring-tx.xsd
http://shardingsphere.apache.org/schema/shardingsphere/encrypt
http://shardingsphere.apache.org/schema/shardingsphere/encrypt/encrypt.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd
">
<import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-readwrite-splitting.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-readwrite-splitting.xml
index 1393f84..ae53e31 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-readwrite-splitting.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-readwrite-splitting.xml
@@ -21,7 +21,7 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:readwrite-splitting="http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
@@ -30,8 +30,8 @@
http://www.springframework.org/schema/tx/spring-tx.xsd
http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting
http://shardingsphere.apache.org/schema/shardingsphere/readwrite-splitting/readwrite-splitting.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd
">
<import resource="classpath*:META-INF/zookeeper/registry-center.xml"/>
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis"/>
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-shadow.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-shadow.xml
index eec606b..e92821f 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-shadow.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-shadow.xml
@@ -21,7 +21,7 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:shadow="http://shardingsphere.apache.org/schema/shardingsphere/shadow"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
@@ -30,8 +30,8 @@
http://www.springframework.org/schema/tx/spring-tx.xsd
http://shardingsphere.apache.org/schema/shardingsphere/shadow
http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd
">
<import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-sharding-databases-tables.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-sharding-databases-tables.xml
index 373fbba..e127410 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-sharding-databases-tables.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/local/application-sharding-databases-tables.xml
@@ -21,7 +21,7 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:sharding="http://shardingsphere.apache.org/schema/shardingsphere/sharding"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
@@ -30,8 +30,8 @@
http://www.springframework.org/schema/context/spring-context.xsd
http://shardingsphere.apache.org/schema/shardingsphere/sharding
http://shardingsphere.apache.org/schema/shardingsphere/sharding/sharding.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd
">
<import resource="classpath*:META-INF/zookeeper/registry-center.xml" />
<context:component-scan base-package="org.apache.shardingsphere.example.core.mybatis" />
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/registry-center.xml b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/registry-center.xml
index f81f3c4..7495025 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/registry-center.xml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-spring-namespace-mybatis-example/src/main/resources/META-INF/zookeeper/registry-center.xml
@@ -17,12 +17,12 @@
-->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:governance="cluster-mode-repository.xsd"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
+ cluster-mode-repository.xsd
+ cluster-mode-repository.xsd
">
<governance:reg-center id="regCenter" type="ZooKeeper" namespace="regCenter" server-lists="localhost:2181">
<props>
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterModeBuilder.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterModeBuilder.java
index 22ac24c..d46ffcc 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterModeBuilder.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/mode/ClusterModeBuilder.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.governance.core.mode;
import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.mode.ShardingSphereMode;
import org.apache.shardingsphere.infra.mode.builder.ModeBuilder;
@@ -37,14 +37,14 @@ public final class ClusterModeBuilder implements ModeBuilder {
@Override
public ShardingSphereMode build(final ModeConfiguration config) {
- RegistryCenterConfiguration repositoryConfig = (RegistryCenterConfiguration) config.getRepository();
- return new ClusterMode(createRegistryCenterRepository(repositoryConfig));
+ ClusterPersistRepositoryConfiguration clusterRepositoryConfig = (ClusterPersistRepositoryConfiguration) config.getRepository();
+ return new ClusterMode(createRegistryCenterRepository(clusterRepositoryConfig));
}
- private RegistryCenterRepository createRegistryCenterRepository(final RegistryCenterConfiguration repositoryConfig) {
- Preconditions.checkNotNull(repositoryConfig, "Registry center configuration cannot be null.");
- RegistryCenterRepository result = TypedSPIRegistry.getRegisteredService(RegistryCenterRepository.class, repositoryConfig.getType(), repositoryConfig.getProps());
- result.init(repositoryConfig);
+ private RegistryCenterRepository createRegistryCenterRepository(final ClusterPersistRepositoryConfiguration clusterRepositoryConfig) {
+ Preconditions.checkNotNull(clusterRepositoryConfig, "Registry center configuration cannot be null.");
+ RegistryCenterRepository result = TypedSPIRegistry.getRegisteredService(RegistryCenterRepository.class, clusterRepositoryConfig.getType(), clusterRepositoryConfig.getProps());
+ result.init(clusterRepositoryConfig);
return result;
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactory.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactory.java
index 7c96ae8..75ac756 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactory.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactory.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.governance.core.registry;
import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
@@ -41,7 +41,7 @@ public final class RegistryCenterRepositoryFactory {
* @param config registry center configuration
* @return new instance of registry center repository
*/
- public static RegistryCenterRepository newInstance(final RegistryCenterConfiguration config) {
+ public static RegistryCenterRepository newInstance(final ClusterPersistRepositoryConfiguration config) {
Preconditions.checkNotNull(config, "Registry center configuration cannot be null.");
RegistryCenterRepository result = TypedSPIRegistry.getRegisteredService(RegistryCenterRepository.class, config.getType(), config.getProps());
result.init(config);
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/ClusterPersistRepositoryConfigurationYamlSwapper.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/ClusterPersistRepositoryConfigurationYamlSwapper.java
index 988e63c..eded94f 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/ClusterPersistRepositoryConfigurationYamlSwapper.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/ClusterPersistRepositoryConfigurationYamlSwapper.java
@@ -17,17 +17,17 @@
package org.apache.shardingsphere.governance.core.yaml.swapper;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapper;
/**
* Cluster persist repository configuration YAML swapper.
*/
-public final class ClusterPersistRepositoryConfigurationYamlSwapper implements PersistRepositoryConfigurationYamlSwapper<RegistryCenterConfiguration> {
+public final class ClusterPersistRepositoryConfigurationYamlSwapper implements PersistRepositoryConfigurationYamlSwapper<ClusterPersistRepositoryConfiguration> {
@Override
- public YamlPersistRepositoryConfiguration swapToYamlConfiguration(final RegistryCenterConfiguration data) {
+ public YamlPersistRepositoryConfiguration swapToYamlConfiguration(final ClusterPersistRepositoryConfiguration data) {
YamlPersistRepositoryConfiguration result = new YamlPersistRepositoryConfiguration();
result.setType(data.getType());
result.setProps(data.getProps());
@@ -37,8 +37,8 @@ public final class ClusterPersistRepositoryConfigurationYamlSwapper implements P
}
@Override
- public RegistryCenterConfiguration swapToObject(final YamlPersistRepositoryConfiguration yamlConfig) {
- return new RegistryCenterConfiguration(yamlConfig.getType(), yamlConfig.getProps().getProperty("namespace"), yamlConfig.getProps().getProperty("serverLists"), yamlConfig.getProps());
+ public ClusterPersistRepositoryConfiguration swapToObject(final YamlPersistRepositoryConfiguration yamlConfig) {
+ return new ClusterPersistRepositoryConfiguration(yamlConfig.getType(), yamlConfig.getProps().getProperty("namespace"), yamlConfig.getProps().getProperty("serverLists"), yamlConfig.getProps());
}
@Override
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactoryTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactoryTest.java
index cc17bdc..f45e6d9 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactoryTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/RegistryCenterRepositoryFactoryTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.governance.core.registry;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.junit.Test;
import java.util.Properties;
@@ -29,7 +29,7 @@ public final class RegistryCenterRepositoryFactoryTest {
@Test
public void assertNewInstance() {
- RegistryCenterConfiguration config = new RegistryCenterConfiguration("TEST", "test_name", "127.0.0.1", new Properties());
+ ClusterPersistRepositoryConfiguration config = new ClusterPersistRepositoryConfiguration("TEST", "test_name", "127.0.0.1", new Properties());
assertThat(RegistryCenterRepositoryFactory.newInstance(config).getType(), is("TEST"));
}
}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/RegistryCenterRepositoryFixture.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/RegistryCenterRepositoryFixture.java
index 974932a..5e1fb26 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/RegistryCenterRepositoryFixture.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/fixture/RegistryCenterRepositoryFixture.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.governance.core.registry.fixture;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
import java.util.Collections;
@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
public final class RegistryCenterRepositoryFixture implements RegistryCenterRepository {
@Override
- public void init(final RegistryCenterConfiguration config) {
+ public void init(final ClusterPersistRepositoryConfiguration config) {
}
@Override
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListRegistryCenterRepositoryFixture.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListRegistryCenterRepositoryFixture.java
index 7bf7486..7d869e8 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListRegistryCenterRepositoryFixture.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/process/ProcessListRegistryCenterRepositoryFixture.java
@@ -17,21 +17,22 @@
package org.apache.shardingsphere.governance.core.registry.process;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
+import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
+import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
-import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
-import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
public final class ProcessListRegistryCenterRepositoryFixture implements RegistryCenterRepository {
private static final Map<String, String> REGISTRY_DATA = new LinkedHashMap<>();
@Override
- public void init(final RegistryCenterConfiguration config) {
+ public void init(final ClusterPersistRepositoryConfiguration config) {
}
@Override
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/ClusterPersistRepositoryConfiguration.java
similarity index 89%
rename from shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java
rename to shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/ClusterPersistRepositoryConfiguration.java
index 6cb7fe9..4e8d27c 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/RegistryCenterConfiguration.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/ClusterPersistRepositoryConfiguration.java
@@ -24,11 +24,11 @@ import org.apache.shardingsphere.infra.mode.config.PersistRepositoryConfiguratio
import java.util.Properties;
/**
- * Registry center configuration.
+ * Cluster persist repository configuration.
*/
@RequiredArgsConstructor
@Getter
-public final class RegistryCenterConfiguration implements PersistRepositoryConfiguration {
+public final class ClusterPersistRepositoryConfiguration implements PersistRepositoryConfiguration {
private final String type;
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/RegistryCenterRepository.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/RegistryCenterRepository.java
index 56b507c..a78120b 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/RegistryCenterRepository.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/spi/RegistryCenterRepository.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.governance.repository.spi;
import org.apache.shardingsphere.infra.mode.repository.PersistRepository;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
import java.util.concurrent.TimeUnit;
@@ -33,7 +33,7 @@ public interface RegistryCenterRepository extends PersistRepository {
*
* @param config registry center configuration
*/
- void init(RegistryCenterConfiguration config);
+ void init(ClusterPersistRepositoryConfiguration config);
/**
* Persist ephemeral data.
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java
index bc044a1..50ccea5 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-etcd/src/main/java/org/apache/shardingsphere/governance/repository/etcd/EtcdRepository.java
@@ -33,10 +33,10 @@ import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.etcd.props.EtcdProperties;
import org.apache.shardingsphere.governance.repository.etcd.props.EtcdPropertyKey;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
@@ -63,7 +63,7 @@ public final class EtcdRepository implements RegistryCenterRepository {
private EtcdProperties etcdProperties;
@Override
- public void init(final RegistryCenterConfiguration config) {
+ public void init(final ClusterPersistRepositoryConfiguration config) {
etcdProperties = new EtcdProperties(props);
client = Client.builder().endpoints(
Util.toURIs(Splitter.on(",").trimResults().splitToList(config.getServerLists()))).namespace(ByteSequence.from(config.getNamespace(), StandardCharsets.UTF_8)).build();
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepository.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/govern [...]
index 24125dd..1b25657 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepository.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepository.java
@@ -32,7 +32,7 @@ import org.apache.curator.framework.recipes.locks.InterProcessLock;
import org.apache.curator.framework.recipes.locks.InterProcessMutex;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.utils.CloseableUtils;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
@@ -76,13 +76,13 @@ public final class CuratorZookeeperRepository implements RegistryCenterRepositor
private Properties props = new Properties();
@Override
- public void init(final RegistryCenterConfiguration config) {
+ public void init(final ClusterPersistRepositoryConfiguration config) {
ZookeeperProperties zookeeperProps = new ZookeeperProperties(props);
client = buildCuratorClient(config, zookeeperProps);
initCuratorClient(zookeeperProps);
}
- private CuratorFramework buildCuratorClient(final RegistryCenterConfiguration config, final ZookeeperProperties zookeeperProps) {
+ private CuratorFramework buildCuratorClient(final ClusterPersistRepositoryConfiguration config, final ZookeeperProperties zookeeperProps) {
int retryIntervalMilliseconds = zookeeperProps.getValue(ZookeeperPropertyKey.RETRY_INTERVAL_MILLISECONDS);
int maxRetries = zookeeperProps.getValue(ZookeeperPropertyKey.MAX_RETRIES);
int timeToLiveSeconds = zookeeperProps.getValue(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS);
diff --git a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/test/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepositoryTest.java b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/test/java/org/apache/shardingsphere/go [...]
index a31a3e5..07a9810 100644
--- a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/test/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepositoryTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-zookeeper-curator/src/test/java/org/apache/shardingsphere/governance/repository/zookeeper/CuratorZookeeperRepositoryTest.java
@@ -37,7 +37,7 @@ import org.apache.curator.framework.recipes.cache.CuratorCache;
import org.apache.curator.framework.recipes.cache.CuratorCacheListener;
import org.apache.curator.framework.recipes.locks.InterProcessLock;
import org.apache.curator.framework.state.ConnectionStateListener;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
import org.apache.shardingsphere.governance.repository.zookeeper.props.ZookeeperPropertyKey;
@@ -133,7 +133,7 @@ public final class CuratorZookeeperRepositoryTest {
mockClient();
mockField();
mockBuilder();
- RegistryCenterConfiguration config = new RegistryCenterConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
+ ClusterPersistRepositoryConfiguration config = new ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
REPOSITORY.init(config);
}
@@ -284,7 +284,7 @@ public final class CuratorZookeeperRepositoryTest {
props.setProperty(ZookeeperPropertyKey.MAX_RETRIES.getKey(), "1");
props.setProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey(), "1000");
props.setProperty(ZookeeperPropertyKey.OPERATION_TIMEOUT_MILLISECONDS.getKey(), "2000");
- RegistryCenterConfiguration config = new RegistryCenterConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
+ ClusterPersistRepositoryConfiguration config = new ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
REPOSITORY.setProps(props);
REPOSITORY.init(config);
assertThat(REPOSITORY.getProps().getProperty(ZookeeperPropertyKey.RETRY_INTERVAL_MILLISECONDS.getKey()), is("1000"));
@@ -297,7 +297,7 @@ public final class CuratorZookeeperRepositoryTest {
public void assertBuildCuratorClientWithTimeToLiveSecondsEqualsZero() {
Properties props = new Properties();
props.setProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey(), "0");
- RegistryCenterConfiguration config = new RegistryCenterConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
+ ClusterPersistRepositoryConfiguration config = new ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
REPOSITORY.setProps(props);
REPOSITORY.init(config);
assertThat(REPOSITORY.getProps().getProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey()), is("0"));
@@ -307,7 +307,7 @@ public final class CuratorZookeeperRepositoryTest {
public void assertBuildCuratorClientWithOperationTimeoutMillisecondsEqualsZero() {
Properties props = new Properties();
props.setProperty(ZookeeperPropertyKey.OPERATION_TIMEOUT_MILLISECONDS.getKey(), "0");
- RegistryCenterConfiguration config = new RegistryCenterConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
+ ClusterPersistRepositoryConfiguration config = new ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
REPOSITORY.setProps(props);
REPOSITORY.init(config);
assertThat(REPOSITORY.getProps().getProperty(ZookeeperPropertyKey.OPERATION_TIMEOUT_MILLISECONDS.getKey()), is("0"));
@@ -317,7 +317,7 @@ public final class CuratorZookeeperRepositoryTest {
public void assertBuildCuratorClientWithDigest() {
Properties props = new Properties();
props.setProperty(ZookeeperPropertyKey.DIGEST.getKey(), "any");
- RegistryCenterConfiguration config = new RegistryCenterConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
+ ClusterPersistRepositoryConfiguration config = new ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", SERVER_LISTS, new Properties());
REPOSITORY.setProps(props);
REPOSITORY.init(config);
assertThat(REPOSITORY.getProps().getProperty(ZookeeperPropertyKey.DIGEST.getKey()), is("any"));
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRegistryCenterRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRegistryCenterRepository.java
index be4ab46..66f5005 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRegistryCenterRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/fixture/TestRegistryCenterRepository.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.driver.governance.fixture;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.database.DefaultSchema;
@@ -33,7 +33,7 @@ public final class TestRegistryCenterRepository implements RegistryCenterReposit
private final Map<String, String> registryData = new LinkedHashMap<>();
@Override
- public void init(final RegistryCenterConfiguration config) {
+ public void init(final ClusterPersistRepositoryConfiguration config) {
registryData.put("/metadata", DefaultSchema.LOGIC_NAME);
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/DataSourceNamespaceHandler.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/DataSourceNamespaceHandler.java
index 5f92b8a..1595fab 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/DataSourceNamespaceHandler.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/DataSourceNamespaceHandler.java
@@ -18,10 +18,8 @@
package org.apache.shardingsphere.spring.namespace.handler;
import org.apache.shardingsphere.spring.namespace.parser.DataSourceBeanDefinitionParser;
-import org.apache.shardingsphere.spring.namespace.parser.StandaloneModeRepositoryConfigurationBeanDefinitionParser;
import org.apache.shardingsphere.spring.namespace.parser.TransactionTypeScannerBeanDefinitionParser;
import org.apache.shardingsphere.spring.namespace.tag.DataSourceBeanDefinitionTag;
-import org.apache.shardingsphere.spring.namespace.tag.StandaloneModeRepositoryBeanDefinitionTag;
import org.apache.shardingsphere.spring.namespace.tag.TransactionTypeScannerBeanDefinitionTag;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
@@ -33,7 +31,6 @@ public final class DataSourceNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
registerBeanDefinitionParser(DataSourceBeanDefinitionTag.ROOT_TAG, new DataSourceBeanDefinitionParser());
- registerBeanDefinitionParser(StandaloneModeRepositoryBeanDefinitionTag.ROOT_TAG, new StandaloneModeRepositoryConfigurationBeanDefinitionParser());
registerBeanDefinitionParser(TransactionTypeScannerBeanDefinitionTag.ROOT_TAG, new TransactionTypeScannerBeanDefinitionParser());
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/DataSourceNamespaceHandler.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/StandaloneModeRepositoryNamespaceHandler.java
similarity index 64%
copy from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/DataSourceNamespaceHandler.java
copy to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/StandaloneModeRepositoryNamespaceHandler.java
index 5f92b8a..3c472ca 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/DataSourceNamespaceHandler.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/handler/StandaloneModeRepositoryNamespaceHandler.java
@@ -17,23 +17,17 @@
package org.apache.shardingsphere.spring.namespace.handler;
-import org.apache.shardingsphere.spring.namespace.parser.DataSourceBeanDefinitionParser;
import org.apache.shardingsphere.spring.namespace.parser.StandaloneModeRepositoryConfigurationBeanDefinitionParser;
-import org.apache.shardingsphere.spring.namespace.parser.TransactionTypeScannerBeanDefinitionParser;
-import org.apache.shardingsphere.spring.namespace.tag.DataSourceBeanDefinitionTag;
import org.apache.shardingsphere.spring.namespace.tag.StandaloneModeRepositoryBeanDefinitionTag;
-import org.apache.shardingsphere.spring.namespace.tag.TransactionTypeScannerBeanDefinitionTag;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
- * Spring namespace handler for data source.
+ * Spring namespace handler for standalone mode repository.
*/
-public final class DataSourceNamespaceHandler extends NamespaceHandlerSupport {
+public final class StandaloneModeRepositoryNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
- registerBeanDefinitionParser(DataSourceBeanDefinitionTag.ROOT_TAG, new DataSourceBeanDefinitionParser());
registerBeanDefinitionParser(StandaloneModeRepositoryBeanDefinitionTag.ROOT_TAG, new StandaloneModeRepositoryConfigurationBeanDefinitionParser());
- registerBeanDefinitionParser(TransactionTypeScannerBeanDefinitionTag.ROOT_TAG, new TransactionTypeScannerBeanDefinitionParser());
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/tag/StandaloneModeRepositoryBeanDefinitionTag.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/tag/StandaloneModeRepositoryBeanDefinitionTag.java
index c098a31..5867d6d 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/tag/StandaloneModeRepositoryBeanDefinitionTag.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/tag/StandaloneModeRepositoryBeanDefinitionTag.java
@@ -26,7 +26,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class StandaloneModeRepositoryBeanDefinitionTag {
- public static final String ROOT_TAG = "standalone-mode-repository";
+ public static final String ROOT_TAG = "repository";
public static final String TYPE_ATTRIBUTE = "type";
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/datasource.xsd b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/datasource.xsd
index 9646932..58f0f87 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/datasource.xsd
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/datasource.xsd
@@ -44,15 +44,5 @@
</xsd:complexType>
</xsd:element>
- <xsd:element name="standalone-mode-repository">
- <xsd:complexType>
- <xsd:all>
- <xsd:element ref="beans:props" minOccurs="0" />
- </xsd:all>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="type" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
-
<xsd:element name="tx-type-annotation-driven" />
</xsd:schema>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/mode/standalone/repository.xsd
similarity index 62%
copy from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd
copy to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/mode/standalone/repository.xsd
index bbecd23..7c9be08 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/mode/standalone/repository.xsd
@@ -18,35 +18,18 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- targetNamespace="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone"
+ targetNamespace="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone"
elementFormDefault="qualified">
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
- <xsd:element name="data-source">
- <xsd:complexType>
- <xsd:all>
- <xsd:element ref="beans:props" minOccurs="0" />
- </xsd:all>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="schema-name" type="xsd:string" default="logic_db" />
- <xsd:attribute name="reg-center-ref" type="xsd:string" use="required" />
- <xsd:attribute name="data-source-names" type="xsd:string" />
- <xsd:attribute name="rule-refs" type="xsd:string" />
- <xsd:attribute name="config-center-ref" type="xsd:string" />
- <xsd:attribute name="overwrite" type="xsd:string" default="false" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="reg-center">
+ <xsd:element name="repository">
<xsd:complexType>
<xsd:all>
<xsd:element ref="beans:props" minOccurs="0" />
</xsd:all>
<xsd:attribute name="id" type="xsd:string" use="required" />
<xsd:attribute name="type" type="xsd:string" use="required" />
- <xsd:attribute name="namespace" type="xsd:string" use="required" />
- <xsd:attribute name="server-lists" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:schema>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/spring.handlers b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/spring.handlers
index 509d8ce..5f79f1d 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/spring.handlers
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/spring.handlers
@@ -16,3 +16,4 @@
#
http\://shardingsphere.apache.org/schema/shardingsphere/datasource=org.apache.shardingsphere.spring.namespace.handler.DataSourceNamespaceHandler
+http\://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone=org.apache.shardingsphere.spring.namespace.handler.StandaloneModeRepositoryNamespaceHandler
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/spring.schemas b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/spring.schemas
index 3ed8e95..7183f93 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/spring.schemas
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/spring.schemas
@@ -16,3 +16,4 @@
#
http\://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd=META-INF/namespace/datasource.xsd
+http\://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone/repository.xsd=META-INF/namespace/mode/standalone/repository.xsd
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/resources/META-INF/spring/standalone-application-context.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/resources/META-INF/spring/standalone-application-context.xml
index 887f243..70fcd3c 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/resources/META-INF/spring/standalone-application-context.xml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/resources/META-INF/spring/standalone-application-context.xml
@@ -20,19 +20,22 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
+ xmlns:standalone="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://shardingsphere.apache.org/schema/shardingsphere/datasource
http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/standalone/repository.xsd
">
<context:property-placeholder location="classpath:conf/conf.properties" />
<import resource="included/data-sources-context.xml" />
<import resource="included/rules-context.xml" />
- <shardingsphere:standalone-mode-repository id="local" type="Local" />
+ <standalone:repository id="local" type="Local" />
<shardingsphere:data-source id="dataSource" data-source-names="ds_0_write,ds_0_read_0,ds_0_read_1,ds_1_write,ds_1_read_0,ds_1_read_1" rule-refs="shardingRule, readWriteSplittingRule, encryptRule">
<shardingsphere:mode type="Standalone" repository-ref="local" overwrite="true" />
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryEncryptTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegis [...]
index cf4bf74..1268e46 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryEncryptTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryEncryptTest.java
@@ -21,7 +21,7 @@ import lombok.SneakyThrows;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.zookeeper.CuratorZookeeperRepository;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
@@ -70,7 +70,7 @@ public class GovernanceSpringBootRegistryEncryptTest {
String dataSource = readYAML(DATA_SOURCE_FILE);
String encryptRule = readYAML(ENCRYPT_RULE_FILE);
CuratorZookeeperRepository repository = new CuratorZookeeperRepository();
- repository.init(new RegistryCenterConfiguration("ZooKeeper", "governance-spring-boot-test", "localhost:3183", new Properties()));
+ repository.init(new ClusterPersistRepositoryConfiguration("ZooKeeper", "governance-spring-boot-test", "localhost:3183", new Properties()));
repository.persist("/metadata/logic_db/dataSources", dataSource);
repository.persist("/metadata/logic_db/rules", encryptRule);
repository.persist("/props", ConfigurationPropertyKey.SQL_SHOW.getKey() + ": 'true'\n");
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryReadwriteSplittingTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpri [...]
index 13d90fb..9a0f452 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryReadwriteSplittingTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryReadwriteSplittingTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.spring.boot.governance.type;
import lombok.SneakyThrows;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.zookeeper.CuratorZookeeperRepository;
import org.apache.shardingsphere.infra.context.manager.ContextManager;
import org.apache.shardingsphere.infra.database.DefaultSchema;
@@ -64,7 +64,7 @@ public class GovernanceSpringBootRegistryReadwriteSplittingTest {
public static void init() {
EmbedTestingServer.start();
CuratorZookeeperRepository repository = new CuratorZookeeperRepository();
- repository.init(new RegistryCenterConfiguration("ZooKeeper", "governance-spring-boot-registry-readwrite-splitting-test", "localhost:3183", new Properties()));
+ repository.init(new ClusterPersistRepositoryConfiguration("ZooKeeper", "governance-spring-boot-registry-readwrite-splitting-test", "localhost:3183", new Properties()));
repository.persist("/metadata/logic_db/dataSources", readYAML(DATA_SOURCE_FILE));
repository.persist("/metadata/logic_db/rules", readYAML(RULE_FILE));
repository.persist("/props", "{}\n");
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryShardingTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegi [...]
index afc2dbd..e4c6d52 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryShardingTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRegistryShardingTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.spring.boot.governance.type;
import lombok.SneakyThrows;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.zookeeper.CuratorZookeeperRepository;
import org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.context.manager.ContextManager;
@@ -72,7 +72,7 @@ public class GovernanceSpringBootRegistryShardingTest {
String shardingDatabases = readYAML(SHARDING_DATABASES_FILE);
String shardingRule = readYAML(SHARDING_RULE_FILE);
CuratorZookeeperRepository repository = new CuratorZookeeperRepository();
- repository.init(new RegistryCenterConfiguration("ZooKeeper", "governance-spring-boot-test", "localhost:3183", new Properties()));
+ repository.init(new ClusterPersistRepositoryConfiguration("ZooKeeper", "governance-spring-boot-test", "localhost:3183", new Properties()));
repository.persist("/metadata/logic_db/dataSources", shardingDatabases);
repository.persist("/metadata/logic_db/rules", shardingRule);
repository.persist("/props", ConfigurationPropertyKey.EXECUTOR_SIZE.getKey() + ": '100'\n" + ConfigurationPropertyKey.SQL_SHOW.getKey() + ": 'true'\n");
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/RegistryCenterConfigurationBeanDefinitionTag.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/Cluste [...]
similarity index 86%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/RegistryCenterConfigurationBeanDefinitionTag.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/ClusterPersistRepositoryConfigurationBeanDefinitionTag.java
index 2e343bc..444a8fc 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/RegistryCenterConfigurationBeanDefinitionTag.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/ClusterPersistRepositoryConfigurationBeanDefinitionTag.java
@@ -21,12 +21,12 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
- * Registry center configuration bean definition tag.
+ * Cluster persist repository configuration bean definition tag.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class RegistryCenterConfigurationBeanDefinitionTag {
+public final class ClusterPersistRepositoryConfigurationBeanDefinitionTag {
- public static final String REG_CENTER_ROOT_TAG = "reg-center";
+ public static final String ROOT_TAG = "repository";
public static final String TYPE_ATTRIBUTE = "type";
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/DataSourceBeanDefinitionTag.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/DataSourceBeanDefinitio [...]
deleted file mode 100644
index 989c349..0000000
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/DataSourceBeanDefinitionTag.java
+++ /dev/null
@@ -1,42 +0,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.
- */
-
-package org.apache.shardingsphere.spring.namespace.governance.constants;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-/**
- * Data source bean definition tag.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class DataSourceBeanDefinitionTag {
-
- public static final String ROOT_TAG = "data-source";
-
- public static final String DATA_SOURCE_NAMES_TAG = "data-source-names";
-
- public static final String RULE_REFS_TAG = "rule-refs";
-
- public static final String PROPS_TAG = "props";
-
- public static final String REG_CENTER_REF_ATTRIBUTE = "reg-center-ref";
-
- public static final String OVERWRITE_ATTRIBUTE = "overwrite";
-
- public static final String SCHEMA_NAME_TAG = "schema-name";
-}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/GovernanceNamespaceHandler.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/ClusterPersistRepositoryName [...]
similarity index 61%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/GovernanceNamespaceHandler.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/ClusterPersistRepositoryNamespaceHandler.java
index f89c059..bc6b5a5 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/GovernanceNamespaceHandler.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/ClusterPersistRepositoryNamespaceHandler.java
@@ -17,20 +17,17 @@
package org.apache.shardingsphere.spring.namespace.governance.handler;
-import org.apache.shardingsphere.spring.namespace.governance.constants.DataSourceBeanDefinitionTag;
-import org.apache.shardingsphere.spring.namespace.governance.constants.RegistryCenterConfigurationBeanDefinitionTag;
-import org.apache.shardingsphere.spring.namespace.governance.parser.DataSourceBeanDefinitionParser;
-import org.apache.shardingsphere.spring.namespace.governance.parser.RegistryCenterConfigurationBeanDefinitionParser;
+import org.apache.shardingsphere.spring.namespace.governance.constants.ClusterPersistRepositoryConfigurationBeanDefinitionTag;
+import org.apache.shardingsphere.spring.namespace.governance.parser.ClusterPersistRepositoryConfigurationBeanDefinitionParser;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
- * Governance spring namespace handler for sharding.
+ * Cluster persist repository namespace handler.
*/
-public final class GovernanceNamespaceHandler extends NamespaceHandlerSupport {
+public final class ClusterPersistRepositoryNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
- registerBeanDefinitionParser(RegistryCenterConfigurationBeanDefinitionTag.REG_CENTER_ROOT_TAG, new RegistryCenterConfigurationBeanDefinitionParser());
- registerBeanDefinitionParser(DataSourceBeanDefinitionTag.ROOT_TAG, new DataSourceBeanDefinitionParser());
+ registerBeanDefinitionParser(ClusterPersistRepositoryConfigurationBeanDefinitionTag.ROOT_TAG, new ClusterPersistRepositoryConfigurationBeanDefinitionParser());
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/RegistryCenterConfigurationBeanDefinitionParser.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/ClusterPe [...]
similarity index 70%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/RegistryCenterConfigurationBeanDefinitionParser.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/ClusterPersistRepositoryConfigurationBeanDefinitionParser.java
index 9e7968a..a321191 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/RegistryCenterConfigurationBeanDefinitionParser.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/ClusterPersistRepositoryConfigurationBeanDefinitionParser.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.spring.namespace.governance.parser;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
-import org.apache.shardingsphere.spring.namespace.governance.constants.RegistryCenterConfigurationBeanDefinitionTag;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
+import org.apache.shardingsphere.spring.namespace.governance.constants.ClusterPersistRepositoryConfigurationBeanDefinitionTag;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
@@ -29,22 +29,22 @@ import org.w3c.dom.Element;
import java.util.Properties;
/**
- * Registry center configuration parser for spring namespace.
+ * Cluster mode repository configuration parser for spring namespace.
*/
-public final class RegistryCenterConfigurationBeanDefinitionParser extends AbstractBeanDefinitionParser {
+public final class ClusterPersistRepositoryConfigurationBeanDefinitionParser extends AbstractBeanDefinitionParser {
@Override
protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
- BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(RegistryCenterConfiguration.class);
- factory.addConstructorArgValue(element.getAttribute(RegistryCenterConfigurationBeanDefinitionTag.TYPE_ATTRIBUTE));
- factory.addConstructorArgValue(element.getAttribute(RegistryCenterConfigurationBeanDefinitionTag.NAMESPACE_ATTRIBUTE));
- factory.addConstructorArgValue(element.getAttribute(RegistryCenterConfigurationBeanDefinitionTag.SERVER_LISTS_ATTRIBUTE));
+ BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(ClusterPersistRepositoryConfiguration.class);
+ factory.addConstructorArgValue(element.getAttribute(ClusterPersistRepositoryConfigurationBeanDefinitionTag.TYPE_ATTRIBUTE));
+ factory.addConstructorArgValue(element.getAttribute(ClusterPersistRepositoryConfigurationBeanDefinitionTag.NAMESPACE_ATTRIBUTE));
+ factory.addConstructorArgValue(element.getAttribute(ClusterPersistRepositoryConfigurationBeanDefinitionTag.SERVER_LISTS_ATTRIBUTE));
factory.addConstructorArgValue(parseProperties(element, parserContext));
return factory.getBeanDefinition();
}
private Properties parseProperties(final Element element, final ParserContext parserContext) {
- Element propsElement = DomUtils.getChildElementByTagName(element, RegistryCenterConfigurationBeanDefinitionTag.PROPS_TAG);
+ Element propsElement = DomUtils.getChildElementByTagName(element, ClusterPersistRepositoryConfigurationBeanDefinitionTag.PROPS_TAG);
return null == propsElement ? new Properties() : parserContext.getDelegate().parsePropsElement(propsElement);
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/DataSourceBeanDefinitionParser.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/DataSourceBeanDefinitionPa [...]
deleted file mode 100644
index 2b1244e..0000000
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/DataSourceBeanDefinitionParser.java
+++ /dev/null
@@ -1,99 +0,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.
- */
-
-package org.apache.shardingsphere.spring.namespace.governance.parser;
-
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
-import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
-import org.apache.shardingsphere.spring.namespace.governance.constants.DataSourceBeanDefinitionTag;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.support.ManagedMap;
-import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.util.xml.DomUtils;
-import org.w3c.dom.Element;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Data source parser for spring namespace.
- */
-public final class DataSourceBeanDefinitionParser extends AbstractBeanDefinitionParser {
-
- @Override
- protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
- BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(ShardingSphereDataSource.class);
- configureFactory(element, parserContext, factory);
- return factory.getBeanDefinition();
- }
-
- private void configureFactory(final Element element, final ParserContext parserContext, final BeanDefinitionBuilder factory) {
- factory.addConstructorArgValue(parseSchemaName(element));
- String dataSourceNames = element.getAttribute(DataSourceBeanDefinitionTag.DATA_SOURCE_NAMES_TAG);
- factory.addConstructorArgValue(parseModeConfiguration(element));
- if (!Strings.isNullOrEmpty(dataSourceNames)) {
- factory.addConstructorArgValue(parseDataSources(element));
- factory.addConstructorArgValue(parseRuleConfigurations(element));
- factory.addConstructorArgValue(parseProperties(element, parserContext));
- }
- factory.setDestroyMethodName("close");
- }
-
- private String parseSchemaName(final Element element) {
- return element.getAttribute(DataSourceBeanDefinitionTag.SCHEMA_NAME_TAG);
- }
-
- private BeanDefinition parseModeConfiguration(final Element element) {
- BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(ModeConfiguration.class);
- factory.addConstructorArgValue("Cluster");
- factory.addConstructorArgReference(element.getAttribute(DataSourceBeanDefinitionTag.REG_CENTER_REF_ATTRIBUTE));
- factory.addConstructorArgValue(element.getAttribute(DataSourceBeanDefinitionTag.OVERWRITE_ATTRIBUTE));
- return factory.getBeanDefinition();
- }
-
- private Map<String, RuntimeBeanReference> parseDataSources(final Element element) {
- List<String> dataSources = Splitter.on(",").trimResults().splitToList(element.getAttribute(DataSourceBeanDefinitionTag.DATA_SOURCE_NAMES_TAG));
- Map<String, RuntimeBeanReference> result = new ManagedMap<>(dataSources.size());
- for (String each : dataSources) {
- result.put(each, new RuntimeBeanReference(each));
- }
- return result;
- }
-
- private Collection<RuntimeBeanReference> parseRuleConfigurations(final Element element) {
- List<String> ruleIdList = Splitter.on(",").trimResults().splitToList(element.getAttribute(DataSourceBeanDefinitionTag.RULE_REFS_TAG));
- Collection<RuntimeBeanReference> result = new ManagedList<>(ruleIdList.size());
- for (String each : ruleIdList) {
- result.add(new RuntimeBeanReference(each));
- }
- return result;
- }
-
- private Properties parseProperties(final Element element, final ParserContext parserContext) {
- Element propsElement = DomUtils.getChildElementByTagName(element, DataSourceBeanDefinitionTag.PROPS_TAG);
- return null == propsElement ? new Properties() : parserContext.getDelegate().parsePropsElement(propsElement);
- }
-}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/mode/cluster/repository.xsd
similarity index 68%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/mode/cluster/repository.xsd
index bbecd23..b384fb2 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/mode/cluster/repository.xsd
@@ -18,27 +18,12 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- targetNamespace="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster"
+ targetNamespace="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster"
elementFormDefault="qualified">
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
- <xsd:element name="data-source">
- <xsd:complexType>
- <xsd:all>
- <xsd:element ref="beans:props" minOccurs="0" />
- </xsd:all>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="schema-name" type="xsd:string" default="logic_db" />
- <xsd:attribute name="reg-center-ref" type="xsd:string" use="required" />
- <xsd:attribute name="data-source-names" type="xsd:string" />
- <xsd:attribute name="rule-refs" type="xsd:string" />
- <xsd:attribute name="config-center-ref" type="xsd:string" />
- <xsd:attribute name="overwrite" type="xsd:string" default="false" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="reg-center">
+ <xsd:element name="repository">
<xsd:complexType>
<xsd:all>
<xsd:element ref="beans:props" minOccurs="0" />
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/spring.handlers b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/spring.handlers
index 8c43e3c..d7a6382 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/spring.handlers
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/spring.handlers
@@ -15,4 +15,4 @@
# limitations under the License.
#
-http\://shardingsphere.apache.org/schema/shardingsphere/governance=org.apache.shardingsphere.spring.namespace.governance.handler.GovernanceNamespaceHandler
+http\://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster=org.apache.shardingsphere.spring.namespace.governance.handler.ClusterPersistRepositoryNamespaceHandler
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/spring.schemas b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/spring.schemas
index f45bec9..c707bb2 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/spring.schemas
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/spring.schemas
@@ -15,4 +15,4 @@
# limitations under the License.
#
-http\://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd=META-INF/namespace/governance.xsd
+http\://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster/repository.xsd=META-INF/namespace/mode/cluster/repository.xsd
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceEncryptNamespaceTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterEncryptNamespaceTest.java
similarity index 97%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceEncryptNamespaceTest.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterEncryptNamespaceTest.java
index 27ae30b..6e52331 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceEncryptNamespaceTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterEncryptNamespaceTest.java
@@ -41,8 +41,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-@ContextConfiguration(locations = "classpath:META-INF/rdb/encrypt-governance.xml")
-public final class GovernanceEncryptNamespaceTest extends AbstractJUnit4SpringContextTests {
+@ContextConfiguration(locations = "classpath:META-INF/rdb/encrypt-cluster.xml")
+public final class ClusterEncryptNamespaceTest extends AbstractJUnit4SpringContextTests {
@BeforeClass
public static void init() {
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceReadwriteSplittingNamespaceTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterReadwriteSplittingName [...]
similarity index 97%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceReadwriteSplittingNamespaceTest.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterReadwriteSplittingNamespaceTest.java
index 660db36..188224f 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceReadwriteSplittingNamespaceTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterReadwriteSplittingNamespaceTest.java
@@ -42,8 +42,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-@ContextConfiguration(locations = "classpath:META-INF/rdb/readwrite-splitting-governance.xml")
-public class GovernanceReadwriteSplittingNamespaceTest extends AbstractJUnit4SpringContextTests {
+@ContextConfiguration(locations = "classpath:META-INF/rdb/readwrite-splitting-cluster.xml")
+public class ClusterReadwriteSplittingNamespaceTest extends AbstractJUnit4SpringContextTests {
@BeforeClass
public static void init() {
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingNamespaceTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterShardingNamespaceTest.java
similarity index 99%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingNamespaceTest.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterShardingNamespaceTest.java
index 20b64dc..4363fed 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingNamespaceTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterShardingNamespaceTest.java
@@ -44,8 +44,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-@ContextConfiguration(locations = "classpath:META-INF/rdb/sharding-governance.xml")
-public class GovernanceShardingNamespaceTest extends AbstractJUnit4SpringContextTests {
+@ContextConfiguration(locations = "classpath:META-INF/rdb/sharding-cluster.xml")
+public class ClusterShardingNamespaceTest extends AbstractJUnit4SpringContextTests {
@BeforeClass
public static void init() {
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingReadwriteSplittingNamespaceTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterShardingReadwr [...]
similarity index 96%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingReadwriteSplittingNamespaceTest.java
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterShardingReadwriteSplittingNamespaceTest.java
index a14151a..0839273 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingReadwriteSplittingNamespaceTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/ClusterShardingReadwriteSplittingNamespaceTest.java
@@ -37,8 +37,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-@ContextConfiguration(locations = "classpath:META-INF/rdb/sharding-readwrite-splitting-governance.xml")
-public class GovernanceShardingReadwriteSplittingNamespaceTest extends AbstractJUnit4SpringContextTests {
+@ContextConfiguration(locations = "classpath:META-INF/rdb/sharding-readwrite-splitting-cluster.xml")
+public class ClusterShardingReadwriteSplittingNamespaceTest extends AbstractJUnit4SpringContextTests {
@BeforeClass
public static void init() {
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestRegistryCenterRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestRegistryCenterReposi [...]
index 2d09139..e7e3858 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestRegistryCenterRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/registry/TestRegistryCenterRepository.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.spring.namespace.governance.registry;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
import java.util.Collections;
@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
public final class TestRegistryCenterRepository implements RegistryCenterRepository {
@Override
- public void init(final RegistryCenterConfiguration config) {
+ public void init(final ClusterPersistRepositoryConfiguration config) {
}
@Override
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/encrypt-governance.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/encrypt-cluster.xml
similarity index 59%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/encrypt-governance.xml
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/encrypt-cluster.xml
index dedf313..ecc0d81 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/encrypt-governance.xml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/encrypt-cluster.xml
@@ -15,26 +15,30 @@
~ limitations under the License.
-->
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- xmlns="http://www.springframework.org/schema/beans"
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
+ xmlns:cluster="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/datasource
+ http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster/repository.xsd
">
<import resource="namespace/encrypt-data-source-namespace.xml" />
- <governance:reg-center id="regCenter" type="TestRegistry" namespace="regCenter" server-lists="localhost:3182">
+ <cluster:repository id="clusterRepository" type="TestRegistry" namespace="regCenter" server-lists="localhost:3182">
<props>
<prop key="max-retries">3</prop>
<prop key="operation-timeout-milliseconds">1000</prop>
</props>
- </governance:reg-center>
+ </cluster:repository>
- <governance:data-source id="encryptDataSourceGovernance" data-source-names="dbtbl_0" rule-refs="encryptRule" reg-center-ref="regCenter">
+ <shardingsphere:data-source id="encryptDataSourceGovernance" data-source-names="dbtbl_0" rule-refs="encryptRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
<props>
<prop key="sql-show">${sql_show}</prop>
</props>
- </governance:data-source>
+ </shardingsphere:data-source>
</beans>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/readwrite-splitting-cluster.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/readwrite-splitting-cluster.xml
new file mode 100644
index 0000000..9c86ac2
--- /dev/null
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/readwrite-splitting-cluster.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
+ xmlns:cluster="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/datasource
+ http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster/repository.xsd
+ ">
+ <import resource="namespace/readwrite-splitting-data-source-namespace.xml" />
+
+ <cluster:repository id="clusterRepository" type="TestRegistry" namespace="regCenter" server-lists="localhost:3182">
+ <props>
+ <prop key="max-retries">3</prop>
+ <prop key="operation-timeout-milliseconds">1000</prop>
+ </props>
+ </cluster:repository>
+
+ <shardingsphere:data-source id="defaultGovernanceDataSource" data-source-names="dbtbl_write_0, dbtbl_0_read_0, dbtbl_0_read_1" rule-refs="defaultreadQueryRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ <props>
+ <prop key="sql-show">${sql_show}</prop>
+ <prop key="executor-size">10</prop>
+ <prop key="foo">bar</prop>
+ </props>
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="randomGovernanceDataSource" data-source-names="dbtbl_write_0, dbtbl_0_read_0, dbtbl_0_read_1" rule-refs="randomreadQueryRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="roundRobinGovernanceDataSource" data-source-names="dbtbl_write_0, dbtbl_0_read_0, dbtbl_0_read_1" rule-refs="roundRobinreadQueryRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="refGovernanceDataSource" data-source-names="dbtbl_write_1, dbtbl_1_read_0, dbtbl_1_read_1" rule-refs="refreadQueryRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+</beans>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/readwrite-splitting-governance.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/readwrite-splitting-governance.xml
deleted file mode 100644
index 31ca43a..0000000
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/readwrite-splitting-governance.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- xmlns="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
- ">
- <import resource="namespace/readwrite-splitting-data-source-namespace.xml" />
-
- <governance:reg-center id="regCenter" type="TestRegistry" namespace="regCenter" server-lists="localhost:3182">
- <props>
- <prop key="max-retries">3</prop>
- <prop key="operation-timeout-milliseconds">1000</prop>
- </props>
- </governance:reg-center>
-
- <governance:data-source id="defaultGovernanceDataSource" data-source-names="dbtbl_write_0, dbtbl_0_read_0, dbtbl_0_read_1" rule-refs="defaultreadQueryRule" reg-center-ref="regCenter">
- <props>
- <prop key="sql-show">${sql_show}</prop>
- <prop key="executor-size">10</prop>
- <prop key="foo">bar</prop>
- </props>
- </governance:data-source>
- <governance:data-source id="randomGovernanceDataSource" data-source-names="dbtbl_write_0, dbtbl_0_read_0, dbtbl_0_read_1" rule-refs="randomreadQueryRule" reg-center-ref="regCenter" />
- <governance:data-source id="roundRobinGovernanceDataSource" data-source-names="dbtbl_write_0, dbtbl_0_read_0, dbtbl_0_read_1" rule-refs="roundRobinreadQueryRule" reg-center-ref="regCenter" />
- <governance:data-source id="refGovernanceDataSource" data-source-names="dbtbl_write_1, dbtbl_1_read_0, dbtbl_1_read_1" rule-refs="refreadQueryRule" reg-center-ref="regCenter" />
-</beans>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-cluster.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-cluster.xml
new file mode 100644
index 0000000..17fea54
--- /dev/null
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-cluster.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
+ xmlns:cluster="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ https://www.springframework.org/schema/util/spring-util.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/datasource
+ http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster/repository.xsd
+ ">
+
+ <import resource="namespace/sharding-data-source-namespace.xml" />
+
+ <util:properties id="instance-props">
+ <prop key="max-retries">3</prop>
+ <prop key="operation-timeout-milliseconds">1000</prop>
+ </util:properties>
+
+ <cluster:repository id="clusterRepository" type="TestRegistry" namespace="registryCenterRepository" server-lists="localhost:3182">
+ <props>
+ <prop key="max-retries">3</prop>
+ <prop key="operation-timeout-milliseconds">1000</prop>
+ </props>
+ </cluster:repository>
+
+ <shardingsphere:data-source id="simpleShardingGovernance" data-source-names="dbtbl_0" rule-refs="simpleShardingDataSourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="shardingRuleWithAttributesDataSourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="shardingRuleWithAttributesDataSourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="multiTableRulesDataSourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="multiTableRulesDataSourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="tableRuleWithAttributesDataSourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="tableRuleWithAttributesDataSourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="bindingTableRuleDatasourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="bindingTableRuleDatasourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="multiBindingTableRulesDatasourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="multiBindingTableRulesDatasourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="broadcastTableRuleDatasourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="broadcastTableRuleDatasourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="multiBroadcastTableRulesDatasourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="multiBroadcastTableRulesDatasourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="propsDataSourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="propsDataSourceShardingRule">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ <props>
+ <prop key="sql-show">${sql_show}</prop>
+ <prop key="executor-size">10</prop>
+ <prop key="foo">bar</prop>
+ </props>
+ </shardingsphere:data-source>
+</beans>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-governance.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-governance.xml
deleted file mode 100644
index 05fcd77..0000000
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-governance.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
- xmlns="http://www.springframework.org/schema/beans"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
- http://www.springframework.org/schema/util
- https://www.springframework.org/schema/util/spring-util.xsd
- ">
- <import resource="namespace/sharding-data-source-namespace.xml" />
-
- <util:properties id="instance-props">
- <prop key="max-retries">3</prop>
- <prop key="operation-timeout-milliseconds">1000</prop>
- </util:properties>
-
- <governance:reg-center id="registryCenterRepository" type="TestRegistry" namespace="registryCenterRepository" server-lists="localhost:3182">
- <props>
- <prop key="max-retries">3</prop>
- <prop key="operation-timeout-milliseconds">1000</prop>
- </props>
- </governance:reg-center>
-
- <governance:data-source id="simpleShardingGovernance" data-source-names="dbtbl_0" rule-refs="simpleShardingDataSourceShardingRule" reg-center-ref="registryCenterRepository" />
- <governance:data-source id="shardingRuleWithAttributesDataSourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="shardingRuleWithAttributesDataSourceShardingRule" reg-center-ref="registryCenterRepository" />
- <governance:data-source id="multiTableRulesDataSourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="multiTableRulesDataSourceShardingRule" reg-center-ref="registryCenterRepository" />
- <governance:data-source id="tableRuleWithAttributesDataSourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="tableRuleWithAttributesDataSourceShardingRule" reg-center-ref="registryCenterRepository" />
- <governance:data-source id="bindingTableRuleDatasourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="bindingTableRuleDatasourceShardingRule" reg-center-ref="registryCenterRepository" />
- <governance:data-source id="multiBindingTableRulesDatasourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="multiBindingTableRulesDatasourceShardingRule" reg-center-ref="registryCenterRepository" />
- <governance:data-source id="broadcastTableRuleDatasourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="broadcastTableRuleDatasourceShardingRule" reg-center-ref="registryCenterRepository" />
- <governance:data-source id="multiBroadcastTableRulesDatasourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="multiBroadcastTableRulesDatasourceShardingRule" reg-center-ref="registryCenterRepository" />
- <governance:data-source id="propsDataSourceGovernance" data-source-names="dbtbl_0,dbtbl_1" rule-refs="propsDataSourceShardingRule" reg-center-ref="registryCenterRepository">
- <props>
- <prop key="sql-show">${sql_show}</prop>
- <prop key="executor-size">10</prop>
- <prop key="foo">bar</prop>
- </props>
- </governance:data-source>
-</beans>
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-readwrite-splitting-governance.xml b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-readwrite-splitting-cluster.xml
similarity index 50%
rename from shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-readwrite-splitting-governance.xml
rename to shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-readwrite-splitting-cluster.xml
index 47f46fa..fb7be71 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-readwrite-splitting-governance.xml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/resources/META-INF/rdb/sharding-readwrite-splitting-cluster.xml
@@ -18,20 +18,29 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:governance="http://shardingsphere.apache.org/schema/shardingsphere/governance"
+ xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource"
+ xmlns:cluster="http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
- http://shardingsphere.apache.org/schema/shardingsphere/governance
- http://shardingsphere.apache.org/schema/shardingsphere/governance/governance.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/datasource
+ http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster
+ http://shardingsphere.apache.org/schema/shardingsphere/mode-repository/cluster/repository.xsd
">
<import resource="namespace/sharding-readwrite-splitting-namespace.xml" />
- <governance:reg-center id="regCenter" type="TestRegistry" namespace="regCenter" server-lists="localhost:3182">
+ <cluster:repository id="clusterRepository" type="TestRegistry" namespace="regCenter" server-lists="localhost:3182">
<props>
<prop key="max-retries">3</prop>
<prop key="operation-timeout-milliseconds">1000</prop>
</props>
- </governance:reg-center>
- <governance:data-source id="dataSourceByDefaultStrategyGovernance" data-source-names="dbtbl_write_0,dbtbl_0_read_0,dbtbl_0_read_1,dbtbl_write_1,dbtbl_1_read_0,dbtbl_1_read_1" rule-refs="readWriteSplittingShardingDataSourceByDefaultStrategyShardingRule, readWriteSplittingShardingDataSourceByDefaultStrategy" reg-center-ref="regCenter" />
- <governance:data-source id="dataSourceByUserStrategyGovernance" data-source-names="dbtbl_write_0,dbtbl_0_read_0,dbtbl_0_read_1,dbtbl_write_1,dbtbl_1_read_0,dbtbl_1_read_1" rule-refs="readWriteSplittingShardingDataSourceByDefaultStrategyShardingRule, readWriteSplittingShardingDataSourceByUserStrategy" reg-center-ref="regCenter" />
+ </cluster:repository>
+
+ <shardingsphere:data-source id="dataSourceByDefaultStrategyGovernance" data-source-names="dbtbl_write_0,dbtbl_0_read_0,dbtbl_0_read_1,dbtbl_write_1,dbtbl_1_read_0,dbtbl_1_read_1" rule-refs="readWriteSplittingShardingDataSourceByDefaultStrategyShardingRule, readWriteSplittingShardingDataSourceByDefaultStrategy">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
+
+ <shardingsphere:data-source id="dataSourceByUserStrategyGovernance" data-source-names="dbtbl_write_0,dbtbl_0_read_0,dbtbl_0_read_1,dbtbl_write_1,dbtbl_1_read_0,dbtbl_1_read_1" rule-refs="readWriteSplittingShardingDataSourceByDefaultStrategyShardingRule, readWriteSplittingShardingDataSourceByUserStrategy">
+ <shardingsphere:mode type="Cluster" repository-ref="clusterRepository" />
+ </shardingsphere:data-source>
</beans>
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureRegistryCenterRepository.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureRegistryCenterRepository.java
index 4d4b134..02f9323 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureRegistryCenterRepository.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/FixtureRegistryCenterRepository.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.proxy.fixture;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
import java.util.Collections;
@@ -32,7 +32,7 @@ public final class FixtureRegistryCenterRepository implements RegistryCenterRepo
private static final Map<String, String> REGISTRY_DATA = new LinkedHashMap<>();
@Override
- public void init(final RegistryCenterConfiguration config) {
+ public void init(final ClusterPersistRepositoryConfiguration config) {
}
@Override
diff --git a/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerInitializerTest.java b/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerInitializerTest.java
index 7be905d..8016415 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerInitializerTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/test/java/org/apache/shardingsphere/scaling/web/HttpServerInitializerTest.java
@@ -21,7 +21,7 @@ import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import lombok.SneakyThrows;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import org.apache.shardingsphere.scaling.core.config.ScalingContext;
import org.apache.shardingsphere.scaling.core.config.ServerConfiguration;
@@ -62,7 +62,7 @@ public final class HttpServerInitializerTest {
private ServerConfiguration mockServerConfig() {
ServerConfiguration result = new ServerConfiguration();
- result.setModeConfiguration(new ModeConfiguration("Cluster", new RegistryCenterConfiguration("Zookeeper", "test", "localhost:2181", null), false));
+ result.setModeConfiguration(new ModeConfiguration("Cluster", new ClusterPersistRepositoryConfiguration("Zookeeper", "test", "localhost:2181", null), false));
return result;
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPIFactory.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPIFactory.java
index d4d1437..5eb502c 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPIFactory.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/api/ScalingAPIFactory.java
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.elasticjob.lite.lifecycle.api.JobStatisticsAPI;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.typed.TypedSPIRegistry;
@@ -146,7 +146,7 @@ public final class ScalingAPIFactory {
private static GovernanceRepositoryAPI createGovernanceRepositoryAPI() {
checkServerConfig();
- RegistryCenterConfiguration repositoryConfig = (RegistryCenterConfiguration) ScalingContext.getInstance().getServerConfig().getModeConfiguration().getRepository();
+ ClusterPersistRepositoryConfiguration repositoryConfig = (ClusterPersistRepositoryConfiguration) ScalingContext.getInstance().getServerConfig().getModeConfiguration().getRepository();
RegistryCenterRepository registryCenterRepository = TypedSPIRegistry.getRegisteredService(RegistryCenterRepository.class, repositoryConfig.getType(), repositoryConfig.getProps());
registryCenterRepository.init(repositoryConfig);
return new GovernanceRepositoryAPIImpl(registryCenterRepository);
@@ -166,7 +166,7 @@ public final class ScalingAPIFactory {
private ElasticJobAPIHolder() {
checkServerConfig();
- RegistryCenterConfiguration repositoryConfig = (RegistryCenterConfiguration) ScalingContext.getInstance().getServerConfig().getModeConfiguration().getRepository();
+ ClusterPersistRepositoryConfiguration repositoryConfig = (ClusterPersistRepositoryConfiguration) ScalingContext.getInstance().getServerConfig().getModeConfiguration().getRepository();
String namespace = repositoryConfig.getNamespace() + ScalingConstant.SCALING_ROOT;
jobStatisticsAPI = JobAPIFactory.createJobStatisticsAPI(repositoryConfig.getServerLists(), namespace, null);
jobConfigurationAPI = JobAPIFactory.createJobConfigurationAPI(repositoryConfig.getServerLists(), namespace, null);
@@ -208,7 +208,7 @@ public final class ScalingAPIFactory {
private static ZookeeperConfiguration getZookeeperConfig() {
checkServerConfig();
- RegistryCenterConfiguration repositoryConfig = (RegistryCenterConfiguration) ScalingContext.getInstance().getServerConfig().getModeConfiguration().getRepository();
+ ClusterPersistRepositoryConfiguration repositoryConfig = (ClusterPersistRepositoryConfiguration) ScalingContext.getInstance().getServerConfig().getModeConfiguration().getRepository();
ZookeeperConfiguration result = new ZookeeperConfiguration(repositoryConfig.getServerLists(), repositoryConfig.getNamespace() + ScalingConstant.SCALING_ROOT);
Properties props = repositoryConfig.getProps();
result.setMaxSleepTimeMilliseconds(getProperty(props, "max.sleep.time.milliseconds", result.getMaxSleepTimeMilliseconds()));
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/GovernanceRepositoryAPIImplTest.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/GovernanceRepositoryAPIImplTest.java
index e32d205..64a67bc 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/GovernanceRepositoryAPIImplTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/GovernanceRepositoryAPIImplTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.scaling.core.api.impl;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import org.apache.shardingsphere.scaling.core.api.GovernanceRepositoryAPI;
@@ -101,7 +101,7 @@ public final class GovernanceRepositoryAPIImplTest {
private static ServerConfiguration mockServerConfig() {
ServerConfiguration result = new ServerConfiguration();
- result.setModeConfiguration(new ModeConfiguration("Cluster", new RegistryCenterConfiguration("Zookeeper", "test", EmbedTestingServer.getConnectionString(), null), true));
+ result.setModeConfiguration(new ModeConfiguration("Cluster", new ClusterPersistRepositoryConfiguration("Zookeeper", "test", EmbedTestingServer.getConnectionString(), null), true));
return result;
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImplTest.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImplTest.java
index e0cd7bf..54fe707 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImplTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/api/impl/ScalingAPIImplTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.scaling.core.api.impl;
import lombok.SneakyThrows;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import org.apache.shardingsphere.scaling.core.api.JobInfo;
import org.apache.shardingsphere.scaling.core.api.ScalingAPI;
@@ -141,7 +141,7 @@ public final class ScalingAPIImplTest {
private static ServerConfiguration mockServerConfig() {
ServerConfiguration result = new ServerConfiguration();
- result.setModeConfiguration(new ModeConfiguration("Cluster", new RegistryCenterConfiguration("Zookeeper", "test", EmbedTestingServer.getConnectionString(), new Properties()), true));
+ result.setModeConfiguration(new ModeConfiguration("Cluster", new ClusterPersistRepositoryConfiguration("Zookeeper", "test", EmbedTestingServer.getConnectionString(), new Properties()), true));
return result;
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/config/yaml/ServerConfigurationYamlSwapperTest.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/config/yaml/ServerConfigurationYamlSwapperTest.java
index 04857cb..fd6f060 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/config/yaml/ServerConfigurationYamlSwapperTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/config/yaml/ServerConfigurationYamlSwapperTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.scaling.core.config.yaml;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration;
@@ -57,7 +57,7 @@ public final class ServerConfigurationYamlSwapperTest {
private ServerConfiguration mockServerConfig() {
ServerConfiguration result = new ServerConfiguration();
result.setWorkerThread(10);
- result.setModeConfiguration(new ModeConfiguration("Cluster", new RegistryCenterConfiguration("Zookeeper", "test", "localhost:2181", new Properties()), false));
+ result.setModeConfiguration(new ModeConfiguration("Cluster", new ClusterPersistRepositoryConfiguration("Zookeeper", "test", "localhost:2181", new Properties()), false));
return result;
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/FinishedCheckJobTest.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/FinishedCheckJobTest.java
index dc0b453..016e83a 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/FinishedCheckJobTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/FinishedCheckJobTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.scaling.core.job;
import lombok.SneakyThrows;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import org.apache.shardingsphere.scaling.core.api.GovernanceRepositoryAPI;
import org.apache.shardingsphere.scaling.core.api.ScalingAPI;
@@ -101,7 +101,7 @@ public final class FinishedCheckJobTest {
private static ServerConfiguration mockServerConfig() {
ServerConfiguration result = new ServerConfiguration();
- result.setModeConfiguration(new ModeConfiguration("Cluster", new RegistryCenterConfiguration("Zookeeper", "test", EmbedTestingServer.getConnectionString(), null), true));
+ result.setModeConfiguration(new ModeConfiguration("Cluster", new ClusterPersistRepositoryConfiguration("Zookeeper", "test", EmbedTestingServer.getConnectionString(), null), true));
return result;
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/ScalingJobTest.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/ScalingJobTest.java
index bd6e584..37bc13a 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/ScalingJobTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/ScalingJobTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.scaling.core.job;
import lombok.SneakyThrows;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import org.apache.shardingsphere.governance.repository.api.config.RegistryCenterConfiguration;
+import org.apache.shardingsphere.governance.repository.api.config.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
import org.apache.shardingsphere.scaling.core.config.ScalingContext;
@@ -66,7 +66,7 @@ public final class ScalingJobTest {
private static ServerConfiguration mockServerConfig() {
ServerConfiguration result = new ServerConfiguration();
- result.setModeConfiguration(new ModeConfiguration("Cluster", new RegistryCenterConfiguration("Zookeeper", "test", EmbedTestingServer.getConnectionString(), null), true));
+ result.setModeConfiguration(new ModeConfiguration("Cluster", new ClusterPersistRepositoryConfiguration("Zookeeper", "test", EmbedTestingServer.getConnectionString(), null), true));
return result;
}