This is an automated email from the ASF dual-hosted git repository. chengzhang 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 685b346b497 Rename RuleConfigurationCheckEngine to DatabaseRuleConfigurationCheckEngine, RuleConfigurationChecker to DatabaseRuleConfigurationChecker (#34985) 685b346b497 is described below commit 685b346b497315ca09c0edb4f6fb5aa5d8f02eaf Author: Zhengqiang Duan <duanzhengqi...@apache.org> AuthorDate: Fri Mar 14 09:07:17 2025 +0800 Rename RuleConfigurationCheckEngine to DatabaseRuleConfigurationCheckEngine, RuleConfigurationChecker to DatabaseRuleConfigurationChecker (#34985) --- .../checker/BroadcastRuleConfigurationEmptyChecker.java | 2 +- ...g.rule.checker.DatabaseRuleConfigurationEmptyChecker} | 0 .../BroadcastRuleConfigurationEmptyCheckerTest.java | 2 +- .../checker/config/EncryptRuleConfigurationChecker.java | 4 ++-- .../config/EncryptRuleConfigurationEmptyChecker.java | 2 +- ...config.rule.checker.DatabaseRuleConfigurationChecker} | 0 ...g.rule.checker.DatabaseRuleConfigurationEmptyChecker} | 0 .../config/EncryptRuleConfigurationCheckerTest.java | 6 +++--- .../config/EncryptRuleConfigurationEmptyCheckerTest.java | 2 +- .../mask/checker/MaskRuleConfigurationChecker.java | 4 ++-- .../mask/checker/MaskRuleConfigurationEmptyChecker.java | 2 +- ...config.rule.checker.DatabaseRuleConfigurationChecker} | 0 ...g.rule.checker.DatabaseRuleConfigurationEmptyChecker} | 0 .../mask/checker/MaskRuleConfigurationCheckerTest.java | 6 +++--- .../checker/MaskRuleConfigurationEmptyCheckerTest.java | 2 +- .../ReadwriteSplittingRuleConfigurationChecker.java | 4 ++-- .../ReadwriteSplittingRuleConfigurationEmptyChecker.java | 2 +- ...config.rule.checker.DatabaseRuleConfigurationChecker} | 0 ...g.rule.checker.DatabaseRuleConfigurationEmptyChecker} | 0 .../ReadwriteSplittingRuleConfigurationCheckerTest.java | 16 ++++++++-------- ...dwriteSplittingRuleConfigurationEmptyCheckerTest.java | 2 +- .../shadow/checker/ShadowRuleConfigurationChecker.java | 4 ++-- .../checker/ShadowRuleConfigurationEmptyChecker.java | 2 +- ...config.rule.checker.DatabaseRuleConfigurationChecker} | 0 ...g.rule.checker.DatabaseRuleConfigurationEmptyChecker} | 0 .../checker/ShadowRuleConfigurationCheckerTest.java | 4 ++-- .../checker/ShadowRuleConfigurationEmptyCheckerTest.java | 2 +- .../checker/config/ShardingRuleConfigurationChecker.java | 4 ++-- .../config/ShardingRuleConfigurationEmptyChecker.java | 2 +- ...config.rule.checker.DatabaseRuleConfigurationChecker} | 0 ...g.rule.checker.DatabaseRuleConfigurationEmptyChecker} | 0 .../config/ShardingRuleConfigurationCheckerTest.java | 4 ++-- .../ShardingRuleConfigurationEmptyCheckerTest.java | 2 +- ...ne.java => DatabaseRuleConfigurationCheckEngine.java} | 8 ++++---- ...hecker.java => DatabaseRuleConfigurationChecker.java} | 4 ++-- .../DatabaseRuleConfigurationEmptyChecker.java | 3 ++- .../rule/builder/database/DatabaseRulesBuilder.java | 9 +++++---- .../engine/database/type/DropDatabaseRuleOperator.java | 2 +- .../config/SingleRuleConfigurationEmptyChecker.java | 2 +- ...g.rule.checker.DatabaseRuleConfigurationEmptyChecker} | 0 .../config/SingleRuleConfigurationEmptyCheckerTest.java | 2 +- .../metadata/manager/rule/DatabaseRuleItemManager.java | 2 +- .../backend/util/DatabaseExportMetaDataGenerator.java | 2 +- .../util/YamlDatabaseConfigurationImportExecutor.java | 4 ++-- .../proxy/fixture/RuleConfigurationFixtureChecker.java | 4 ++-- ...config.rule.checker.DatabaseRuleConfigurationChecker} | 0 46 files changed, 62 insertions(+), 60 deletions(-) diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/checker/BroadcastRuleConfigurationEmptyChecker.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/checker/BroadcastRuleConfigurationEmptyChecker.java index ecfbeeb7e45..7c182bee053 100644 --- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/checker/BroadcastRuleConfigurationEmptyChecker.java +++ b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/checker/BroadcastRuleConfigurationEmptyChecker.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.broadcast.checker; import org.apache.shardingsphere.broadcast.config.BroadcastRuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; /** * Broadcast rule configuration empty checker. diff --git a/features/broadcast/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker b/features/broadcast/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker similarity index 100% rename from features/broadcast/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker rename to features/broadcast/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker diff --git a/features/broadcast/core/src/test/java/org/apache/shardingsphere/broadcast/checker/BroadcastRuleConfigurationEmptyCheckerTest.java b/features/broadcast/core/src/test/java/org/apache/shardingsphere/broadcast/checker/BroadcastRuleConfigurationEmptyCheckerTest.java index af423c98eaf..72bdd1b7055 100644 --- a/features/broadcast/core/src/test/java/org/apache/shardingsphere/broadcast/checker/BroadcastRuleConfigurationEmptyCheckerTest.java +++ b/features/broadcast/core/src/test/java/org/apache/shardingsphere/broadcast/checker/BroadcastRuleConfigurationEmptyCheckerTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.broadcast.checker; import org.apache.shardingsphere.broadcast.config.BroadcastRuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationChecker.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationChecker.java index 1a3956b8cb1..e6a4fcf7705 100644 --- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationChecker.java +++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationChecker.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm; import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.MissingRequiredAlgorithmException; import org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; @@ -41,7 +41,7 @@ import java.util.stream.Collectors; /** * Encrypt rule configuration checker. */ -public final class EncryptRuleConfigurationChecker implements RuleConfigurationChecker<EncryptRuleConfiguration> { +public final class EncryptRuleConfigurationChecker implements DatabaseRuleConfigurationChecker<EncryptRuleConfiguration> { @Override public void check(final String databaseName, final EncryptRuleConfiguration ruleConfig, final Map<String, DataSource> dataSourceMap, final Collection<ShardingSphereRule> builtRules) { diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationEmptyChecker.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationEmptyChecker.java index c898c62f98c..6ce4e8d5928 100644 --- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationEmptyChecker.java +++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationEmptyChecker.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.encrypt.checker.config; import org.apache.shardingsphere.encrypt.config.EncryptRuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; /** * Encrypt rule configuration empty checker. diff --git a/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker b/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker similarity index 100% rename from features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker rename to features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker diff --git a/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker b/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker similarity index 100% rename from features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker rename to features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationCheckerTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationCheckerTest.java index 555e4c50cd1..db51bb60860 100644 --- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationCheckerTest.java +++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationCheckerTest.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.encrypt.exception.metadata.MissingRequiredEncry import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.MissingRequiredAlgorithmException; import org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -42,11 +42,11 @@ import static org.junit.jupiter.api.Assertions.assertThrows; class EncryptRuleConfigurationCheckerTest { @SuppressWarnings("rawtypes") - private RuleConfigurationChecker checker; + private DatabaseRuleConfigurationChecker checker; @BeforeEach void setUp() { - checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(EncryptRuleConfiguration.class)).get(EncryptRuleConfiguration.class); + checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(EncryptRuleConfiguration.class)).get(EncryptRuleConfiguration.class); } @SuppressWarnings("unchecked") diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationEmptyCheckerTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationEmptyCheckerTest.java index 406e9b87134..fe31ff723c7 100644 --- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationEmptyCheckerTest.java +++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/config/EncryptRuleConfigurationEmptyCheckerTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.encrypt.checker.config; import org.apache.shardingsphere.encrypt.config.EncryptRuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationChecker.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationChecker.java index a49d7bbd6a7..796fb7f4119 100644 --- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationChecker.java +++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationChecker.java @@ -19,7 +19,7 @@ package org.apache.shardingsphere.mask.checker; import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; @@ -38,7 +38,7 @@ import java.util.stream.Collectors; /** * Mask rule configuration checker. */ -public final class MaskRuleConfigurationChecker implements RuleConfigurationChecker<MaskRuleConfiguration> { +public final class MaskRuleConfigurationChecker implements DatabaseRuleConfigurationChecker<MaskRuleConfiguration> { @Override public void check(final String databaseName, final MaskRuleConfiguration ruleConfig, final Map<String, DataSource> dataSourceMap, final Collection<ShardingSphereRule> builtRules) { diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationEmptyChecker.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationEmptyChecker.java index 5f81ce10433..f0d245dbe1c 100644 --- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationEmptyChecker.java +++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationEmptyChecker.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.mask.checker; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.mask.config.MaskRuleConfiguration; /** diff --git a/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker b/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker similarity index 100% rename from features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker rename to features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker diff --git a/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker b/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker similarity index 100% rename from features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker rename to features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker diff --git a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationCheckerTest.java b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationCheckerTest.java index b420f9c98f3..de98951db4d 100644 --- a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationCheckerTest.java +++ b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationCheckerTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.mask.checker; import org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; import org.apache.shardingsphere.mask.config.MaskRuleConfiguration; import org.apache.shardingsphere.mask.config.rule.MaskColumnRuleConfiguration; @@ -37,11 +37,11 @@ import static org.mockito.Mockito.when; class MaskRuleConfigurationCheckerTest { @SuppressWarnings("rawtypes") - private RuleConfigurationChecker checker; + private DatabaseRuleConfigurationChecker checker; @BeforeEach void setUp() { - checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(MaskRuleConfiguration.class)).get(MaskRuleConfiguration.class); + checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(MaskRuleConfiguration.class)).get(MaskRuleConfiguration.class); } @SuppressWarnings("unchecked") diff --git a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationEmptyCheckerTest.java b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationEmptyCheckerTest.java index 4d5a5cd2a18..9fc29cc0c78 100644 --- a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationEmptyCheckerTest.java +++ b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationEmptyCheckerTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.mask.checker; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.mask.config.MaskRuleConfiguration; import org.junit.jupiter.api.BeforeEach; diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java index 84318fc2096..9a9fdd8ef65 100644 --- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java +++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java @@ -20,7 +20,7 @@ package org.apache.shardingsphere.readwritesplitting.checker; import com.google.common.base.Strings; import org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException; import org.apache.shardingsphere.infra.algorithm.loadbalancer.core.LoadBalanceAlgorithm; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; @@ -40,7 +40,7 @@ import java.util.stream.Collectors; /** * Readwrite-splitting rule configuration checker. */ -public final class ReadwriteSplittingRuleConfigurationChecker implements RuleConfigurationChecker<ReadwriteSplittingRuleConfiguration> { +public final class ReadwriteSplittingRuleConfigurationChecker implements DatabaseRuleConfigurationChecker<ReadwriteSplittingRuleConfiguration> { @Override public void check(final String databaseName, final ReadwriteSplittingRuleConfiguration ruleConfig, final Map<String, DataSource> dataSourceMap, final Collection<ShardingSphereRule> builtRules) { diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationEmptyChecker.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationEmptyChecker.java index 5990b7a46bc..b678a4c605f 100644 --- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationEmptyChecker.java +++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationEmptyChecker.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.readwritesplitting.checker; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.readwritesplitting.config.ReadwriteSplittingRuleConfiguration; /** diff --git a/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker b/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker similarity index 100% rename from features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker rename to features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker diff --git a/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker b/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker similarity index 100% rename from features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker rename to features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker diff --git a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationCheckerTest.java b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationCheckerTest.java index 7f4e6ae96de..6de639df160 100644 --- a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationCheckerTest.java +++ b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationCheckerTest.java @@ -19,7 +19,7 @@ package org.apache.shardingsphere.readwritesplitting.checker; import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.infra.rule.attribute.RuleAttributes; import org.apache.shardingsphere.infra.rule.attribute.datasource.DataSourceMapperRuleAttribute; @@ -57,7 +57,7 @@ class ReadwriteSplittingRuleConfigurationCheckerTest { @Test void assertInvalidCheck() { ReadwriteSplittingRuleConfiguration ruleConfig = createInvalidRuleConfiguration(); - RuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); assertThrows(MissingRequiredReadwriteSplittingActualDataSourceException.class, () -> checker.check("test", ruleConfig, Collections.emptyMap(), Collections.emptyList())); } @@ -75,7 +75,7 @@ class ReadwriteSplittingRuleConfigurationCheckerTest { List<ReadwriteSplittingDataSourceGroupRuleConfiguration> configs = Arrays.asList(createDataSourceGroupRuleConfiguration( "write_ds_0", Arrays.asList("read_ds_0", "read_ds_1")), createDataSourceGroupRuleConfiguration("write_ds_2", Arrays.asList("read_ds_0", "read_ds_1"))); when(ruleConfig.getDataSourceGroups()).thenReturn(configs); - RuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); assertThrows(ReadwriteSplittingActualDataSourceNotFoundException.class, () -> checker.check("test", ruleConfig, mockDataSources(), Collections.emptyList())); } @@ -85,7 +85,7 @@ class ReadwriteSplittingRuleConfigurationCheckerTest { List<ReadwriteSplittingDataSourceGroupRuleConfiguration> configs = Arrays.asList(createDataSourceGroupRuleConfiguration( "write_ds_0", Arrays.asList("read_ds_0", "read_ds_0")), createDataSourceGroupRuleConfiguration("write_ds_1", Arrays.asList("read_ds_0", "read_ds_0"))); when(ruleConfig.getDataSourceGroups()).thenReturn(configs); - RuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); assertThrows(DuplicateReadwriteSplittingActualDataSourceException.class, () -> checker.check("test", ruleConfig, mockDataSources(), Collections.emptyList())); } @@ -96,14 +96,14 @@ class ReadwriteSplittingRuleConfigurationCheckerTest { when(ruleConfig.getDataSourceGroups()).thenReturn(configs); AlgorithmConfiguration algorithm = new AlgorithmConfiguration("WEIGHT", PropertiesBuilder.build(new Property("read_ds_2", "1"), new Property("read_ds_1", "2"))); when(ruleConfig.getLoadBalancers()).thenReturn(Collections.singletonMap("weight_ds", algorithm)); - RuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); assertThrows(AlgorithmInitializationException.class, () -> checker.check("test", ruleConfig, mockDataSources(), Collections.emptyList())); } @Test void assertCheckWhenConfigOtherRulesDatasource() { ReadwriteSplittingRuleConfiguration ruleConfig = createContainsOtherRulesDatasourceConfiguration(); - RuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); ShardingSphereRule rule = mock(ShardingSphereRule.class); DataSourceMapperRuleAttribute ruleAttribute = mock(DataSourceMapperRuleAttribute.class, RETURNS_DEEP_STUBS); when(ruleAttribute.getDataSourceMapper().containsKey("otherDatasourceName")).thenReturn(true); @@ -144,7 +144,7 @@ class ReadwriteSplittingRuleConfigurationCheckerTest { ReadwriteSplittingDataSourceGroupRuleConfiguration dataSourceGroupConfig = new ReadwriteSplittingDataSourceGroupRuleConfiguration( "foo_group", "write_ds", Arrays.asList("read_ds0", "read_ds1"), "foo_algo"); ReadwriteSplittingRuleConfiguration ruleConfig = new ReadwriteSplittingRuleConfiguration(Collections.singleton(dataSourceGroupConfig), Collections.emptyMap()); - RuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); assertThat(checker.getRequiredDataSourceNames(ruleConfig), is(new LinkedHashSet<>(Arrays.asList("write_ds", "read_ds0", "read_ds1")))); } @@ -153,7 +153,7 @@ class ReadwriteSplittingRuleConfigurationCheckerTest { ReadwriteSplittingDataSourceGroupRuleConfiguration dataSourceGroupConfig = new ReadwriteSplittingDataSourceGroupRuleConfiguration( "foo_group", null, Collections.emptyList(), "foo_algo"); ReadwriteSplittingRuleConfiguration ruleConfig = new ReadwriteSplittingRuleConfiguration(Collections.singleton(dataSourceGroupConfig), Collections.emptyMap()); - RuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); assertTrue(checker.getRequiredDataSourceNames(ruleConfig).isEmpty()); } } diff --git a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationEmptyCheckerTest.java b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationEmptyCheckerTest.java index 29815f93408..6cb1c63b8ee 100644 --- a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationEmptyCheckerTest.java +++ b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationEmptyCheckerTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.readwritesplitting.checker; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.readwritesplitting.config.ReadwriteSplittingRuleConfiguration; import org.junit.jupiter.api.BeforeEach; diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationChecker.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationChecker.java index 8bb90cb1b14..db3cfce131c 100644 --- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationChecker.java +++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationChecker.java @@ -19,7 +19,7 @@ package org.apache.shardingsphere.shadow.checker; import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.MissingRequiredAlgorithmException; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; @@ -44,7 +44,7 @@ import java.util.stream.Collectors; /** * Shadow rule configuration checker. */ -public final class ShadowRuleConfigurationChecker implements RuleConfigurationChecker<ShadowRuleConfiguration> { +public final class ShadowRuleConfigurationChecker implements DatabaseRuleConfigurationChecker<ShadowRuleConfiguration> { @Override public void check(final String databaseName, final ShadowRuleConfiguration ruleConfig, final Map<String, DataSource> dataSourceMap, final Collection<ShardingSphereRule> builtRules) { diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationEmptyChecker.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationEmptyChecker.java index 5a28aac84b4..047bbf6bf55 100644 --- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationEmptyChecker.java +++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationEmptyChecker.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.shadow.checker; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.shadow.config.ShadowRuleConfiguration; /** diff --git a/features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker b/features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker similarity index 100% rename from features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker rename to features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker diff --git a/features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker b/features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker similarity index 100% rename from features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker rename to features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker diff --git a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationCheckerTest.java b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationCheckerTest.java index fca4809e4ee..6b4c5140cbb 100644 --- a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationCheckerTest.java +++ b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationCheckerTest.java @@ -19,7 +19,7 @@ package org.apache.shardingsphere.shadow.checker; import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.MissingRequiredAlgorithmException; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; import org.apache.shardingsphere.shadow.config.ShadowRuleConfiguration; import org.apache.shardingsphere.shadow.config.datasource.ShadowDataSourceConfiguration; @@ -55,7 +55,7 @@ class ShadowRuleConfigurationCheckerTest { @BeforeEach void setUp() { ruleConfigChecker = (ShadowRuleConfigurationChecker) OrderedSPILoader.getServicesByClass( - RuleConfigurationChecker.class, Collections.singleton(ShadowRuleConfiguration.class)).get(ShadowRuleConfiguration.class); + DatabaseRuleConfigurationChecker.class, Collections.singleton(ShadowRuleConfiguration.class)).get(ShadowRuleConfiguration.class); } @Test diff --git a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationEmptyCheckerTest.java b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationEmptyCheckerTest.java index 92da725efe3..ba797c1584f 100644 --- a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationEmptyCheckerTest.java +++ b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationEmptyCheckerTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.shadow.checker; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.shadow.config.ShadowRuleConfiguration; import org.apache.shardingsphere.shadow.config.datasource.ShadowDataSourceConfiguration; diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationChecker.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationChecker.java index 6a30a74b40c..01006a87342 100644 --- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationChecker.java +++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationChecker.java @@ -21,7 +21,7 @@ import com.google.common.base.Joiner; import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException; import org.apache.shardingsphere.infra.algorithm.keygen.core.KeyGenerateAlgorithm; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.datanode.DataNode; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier; @@ -51,7 +51,7 @@ import java.util.stream.Collectors; /** * Sharding rule configuration checker. */ -public final class ShardingRuleConfigurationChecker implements RuleConfigurationChecker<ShardingRuleConfiguration> { +public final class ShardingRuleConfigurationChecker implements DatabaseRuleConfigurationChecker<ShardingRuleConfiguration> { @Override public void check(final String databaseName, final ShardingRuleConfiguration ruleConfig, final Map<String, DataSource> dataSourceMap, final Collection<ShardingSphereRule> builtRules) { diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationEmptyChecker.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationEmptyChecker.java index b86024d739c..0f4d34508f8 100644 --- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationEmptyChecker.java +++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationEmptyChecker.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.sharding.checker.config; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; /** diff --git a/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker b/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker similarity index 100% rename from features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker rename to features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker diff --git a/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker b/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker similarity index 100% rename from features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker rename to features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationCheckerTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationCheckerTest.java index a821436f35d..d1d9a67576f 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationCheckerTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationCheckerTest.java @@ -19,7 +19,7 @@ package org.apache.shardingsphere.sharding.checker.config; import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration; import org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration; @@ -54,7 +54,7 @@ class ShardingRuleConfigurationCheckerTest { @BeforeEach void setUp() { checker = (ShardingRuleConfigurationChecker) OrderedSPILoader.getServicesByClass( - RuleConfigurationChecker.class, Collections.singleton(ShardingRuleConfiguration.class)).get(ShardingRuleConfiguration.class); + DatabaseRuleConfigurationChecker.class, Collections.singleton(ShardingRuleConfiguration.class)).get(ShardingRuleConfiguration.class); } @Test diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationEmptyCheckerTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationEmptyCheckerTest.java index a8602fb23b5..62d4f359269 100644 --- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationEmptyCheckerTest.java +++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/config/ShardingRuleConfigurationEmptyCheckerTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.sharding.checker.config; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration; import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationCheckEngine.java similarity index 93% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationCheckEngine.java index f64807b541a..0a97f59a6a8 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationCheckEngine.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationCheckEngine.java @@ -21,8 +21,8 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; -import org.apache.shardingsphere.infra.exception.kernel.metadata.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.MissingRequiredStorageUnitsException; +import org.apache.shardingsphere.infra.exception.kernel.metadata.rule.DuplicateRuleException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.rule.attribute.datasource.DataSourceMapperRuleAttribute; import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; @@ -35,10 +35,10 @@ import java.util.Map.Entry; import java.util.stream.Collectors; /** - * Rule configuration check engine. + * Database rule configuration check engine. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class RuleConfigurationCheckEngine { +public final class DatabaseRuleConfigurationCheckEngine { /** * Check rule configuration. @@ -48,7 +48,7 @@ public final class RuleConfigurationCheckEngine { */ @SuppressWarnings({"unchecked", "rawtypes"}) public static void check(final RuleConfiguration ruleConfig, final ShardingSphereDatabase database) { - RuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker checker = OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); if (null == checker) { // TODO Remove after implementing the checker of BroadcastRuleConfiguration and SingleRuleConfiguration return; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationChecker.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationChecker.java similarity index 93% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationChecker.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationChecker.java index 846eac153e7..a366f72ea71 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/RuleConfigurationChecker.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationChecker.java @@ -28,12 +28,12 @@ import java.util.Collections; import java.util.Map; /** - * Rule configuration checker. + * Database rule configuration checker. * * @param <T> type of rule configuration */ @SingletonSPI -public interface RuleConfigurationChecker<T extends RuleConfiguration> extends OrderedSPI<T> { +public interface DatabaseRuleConfigurationChecker<T extends RuleConfiguration> extends OrderedSPI<T> { /** * Check rule configuration. diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/scope/DatabaseRuleConfigurationEmptyChecker.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationEmptyChecker.java similarity index 90% rename from infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/scope/DatabaseRuleConfigurationEmptyChecker.java rename to infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationEmptyChecker.java index 6f11544d0e2..d9a6c6d309c 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/scope/DatabaseRuleConfigurationEmptyChecker.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/config/rule/checker/DatabaseRuleConfigurationEmptyChecker.java @@ -15,8 +15,9 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.config.rule.scope; +package org.apache.shardingsphere.infra.config.rule.checker; +import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration; import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI; diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilder.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilder.java index 8a614a452f0..93bdb1ff4eb 100644 --- a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilder.java +++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/builder/database/DatabaseRulesBuilder.java @@ -21,7 +21,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.config.rule.function.DistributedRuleConfiguration; import org.apache.shardingsphere.infra.config.rule.function.EnhancedRuleConfiguration; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; @@ -61,8 +61,8 @@ public final class DatabaseRulesBuilder { final ComputeNodeInstanceContext computeNodeInstanceContext, final ResourceMetaData resourceMetaData) { Collection<ShardingSphereRule> result = new LinkedList<>(); for (Entry<RuleConfiguration, DatabaseRuleBuilder> entry : getRuleBuilderMap(databaseConfig).entrySet()) { - RuleConfigurationChecker configChecker = OrderedSPILoader.getServicesByClass( - RuleConfigurationChecker.class, Collections.singleton(entry.getKey().getClass())).get(entry.getKey().getClass()); + DatabaseRuleConfigurationChecker configChecker = OrderedSPILoader.getServicesByClass( + DatabaseRuleConfigurationChecker.class, Collections.singleton(entry.getKey().getClass())).get(entry.getKey().getClass()); if (null != configChecker) { configChecker.check(databaseName, entry.getKey(), resourceMetaData.getDataSourceMap(), result); } @@ -86,7 +86,8 @@ public final class DatabaseRulesBuilder { public static ShardingSphereRule build(final String databaseName, final DatabaseType protocolType, final Collection<ShardingSphereRule> rules, final RuleConfiguration ruleConfig, final ComputeNodeInstanceContext computeNodeInstanceContext, final ResourceMetaData resourceMetaData) { DatabaseRuleBuilder databaseRuleBuilder = OrderedSPILoader.getServices(DatabaseRuleBuilder.class, Collections.singleton(ruleConfig)).get(ruleConfig); - RuleConfigurationChecker configChecker = OrderedSPILoader.getServicesByClass(RuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); + DatabaseRuleConfigurationChecker configChecker = + OrderedSPILoader.getServicesByClass(DatabaseRuleConfigurationChecker.class, Collections.singleton(ruleConfig.getClass())).get(ruleConfig.getClass()); if (null != configChecker) { configChecker.check(databaseName, ruleConfig, resourceMetaData.getDataSourceMap(), rules); } diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/rdl/rule/engine/database/type/DropDatabaseRuleOperator.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/rdl/rule/engine/database/type/DropDatabaseRuleOperator.java index d03f052b3e8..33752187dd5 100644 --- a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/rdl/rule/engine/database/type/DropDatabaseRuleOperator.java +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/rdl/rule/engine/database/type/DropDatabaseRuleOperator.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.distsql.statement.rdl.rule.aware.StaticDataSour import org.apache.shardingsphere.distsql.statement.rdl.rule.database.DatabaseRuleDefinitionStatement; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.rule.attribute.datasource.StaticDataSourceRuleAttribute; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/checker/config/SingleRuleConfigurationEmptyChecker.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/checker/config/SingleRuleConfigurationEmptyChecker.java index f738a29ea21..be29c8ce76c 100644 --- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/checker/config/SingleRuleConfigurationEmptyChecker.java +++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/checker/config/SingleRuleConfigurationEmptyChecker.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.single.checker.config; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.single.config.SingleRuleConfiguration; /** diff --git a/kernel/single/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker b/kernel/single/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker similarity index 100% rename from kernel/single/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker rename to kernel/single/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker diff --git a/kernel/single/core/src/test/java/org/apache/shardingsphere/single/checker/config/SingleRuleConfigurationEmptyCheckerTest.java b/kernel/single/core/src/test/java/org/apache/shardingsphere/single/checker/config/SingleRuleConfigurationEmptyCheckerTest.java index b37f4dfc6f0..6fa5ebd614d 100644 --- a/kernel/single/core/src/test/java/org/apache/shardingsphere/single/checker/config/SingleRuleConfigurationEmptyCheckerTest.java +++ b/kernel/single/core/src/test/java/org/apache/shardingsphere/single/checker/config/SingleRuleConfigurationEmptyCheckerTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.single.checker.config; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.single.config.SingleRuleConfiguration; import org.junit.jupiter.api.BeforeEach; diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/manager/rule/DatabaseRuleItemManager.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/manager/rule/DatabaseRuleItemManager.java index 4827252be9d..af5049ed9bf 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/manager/rule/DatabaseRuleItemManager.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/manager/rule/DatabaseRuleItemManager.java @@ -22,7 +22,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.mode.metadata.MetaDataContexts; import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistFacade; diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/DatabaseExportMetaDataGenerator.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/DatabaseExportMetaDataGenerator.java index c0eb39fc3bc..996c20ff6cb 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/DatabaseExportMetaDataGenerator.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/DatabaseExportMetaDataGenerator.java @@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.backend.util; import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.scope.DatabaseRuleConfigurationEmptyChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationEmptyChecker; import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit; diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java index a662ae2d8bb..dcc5a5042b6 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/YamlDatabaseConfigurationImportExecutor.java @@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.backend.util; import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.distsql.handler.validate.DistSQLDataSourcePoolPropertiesValidator; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationCheckEngine; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationCheckEngine; import org.apache.shardingsphere.infra.database.DatabaseTypeEngine; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; import org.apache.shardingsphere.infra.datasource.pool.config.DataSourceConfiguration; @@ -130,7 +130,7 @@ public final class YamlDatabaseConfigurationImportExecutor { } private void addRule(final Collection<RuleConfiguration> ruleConfigs, final RuleConfiguration ruleConfig, final ShardingSphereDatabase database) { - RuleConfigurationCheckEngine.check(ruleConfig, database); + DatabaseRuleConfigurationCheckEngine.check(ruleConfig, database); ruleConfigs.add(ruleConfig); database.getRuleMetaData().getRules().add(buildRule(ruleConfig, database)); } diff --git a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/RuleConfigurationFixtureChecker.java b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/RuleConfigurationFixtureChecker.java index 9e2cf433981..e2bd8ac31e4 100644 --- a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/RuleConfigurationFixtureChecker.java +++ b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/RuleConfigurationFixtureChecker.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.proxy.fixture; -import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker; +import org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import org.apache.shardingsphere.test.fixture.infra.rule.MockedRuleConfiguration; @@ -25,7 +25,7 @@ import javax.sql.DataSource; import java.util.Collection; import java.util.Map; -public final class RuleConfigurationFixtureChecker implements RuleConfigurationChecker<MockedRuleConfiguration> { +public final class RuleConfigurationFixtureChecker implements DatabaseRuleConfigurationChecker<MockedRuleConfiguration> { @Override public void check(final String databaseName, final MockedRuleConfiguration ruleConfig, final Map<String, DataSource> dataSourceMap, final Collection<ShardingSphereRule> builtRules) { diff --git a/proxy/bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker b/proxy/bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker similarity index 100% rename from proxy/bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker rename to proxy/bootstrap/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.config.rule.checker.DatabaseRuleConfigurationChecker