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 87e6b7b optimize schema rule init logic (#11553)
87e6b7b is described below
commit 87e6b7badaea7beeea805aa5965ddd664457d1a6
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Thu Jul 29 16:04:51 2021 +0800
optimize schema rule init logic (#11553)
* optimize rule load logic
* modify test case
* fix checkstyle
* rename param
* rename param
---
.../constant/DatabaseDiscoveryOrder.java | 2 +-
...orithmProvidedDatabaseDiscoveryRuleBuilder.java | 4 ++--
.../rule/builder/DatabaseDiscoveryRuleBuilder.java | 4 ++--
...ule.builder.scope.DistributedSchemaRuleBuilder} | 0
...hmProvidedDatabaseDiscoveryRuleBuilderTest.java | 8 +++++---
.../builder/DatabaseDiscoveryRuleBuilderTest.java | 5 +++--
.../encrypt/constant/EncryptOrder.java | 2 +-
.../AlgorithmProvidedEncryptRuleBuilder.java | 4 ++--
.../encrypt/rule/builder/EncryptRuleBuilder.java | 4 ++--
...a.rule.builder.scope.EnhancedSchemaRuleBuilder} | 0
.../AlgorithmProvidedEncryptRuleBuilderTest.java | 5 +++--
.../rule/builder/EncryptRuleBuilderTest.java | 5 +++--
.../constant/ReadwriteSplittingOrder.java | 2 +-
...rithmProvidedReadwriteSplittingRuleBuilder.java | 4 ++--
.../builder/ReadwriteSplittingRuleBuilder.java | 4 ++--
...ule.builder.scope.DistributedSchemaRuleBuilder} | 0
...mProvidedReadwriteSplittingRuleBuilderTest.java | 6 ++++--
.../builder/ReadwriteSplittingRuleBuilderTest.java | 5 +++--
.../shadow/constant/ShadowOrder.java | 2 +-
.../shadow/rule/builder/ShadowRuleBuilder.java | 4 ++--
...ule.builder.scope.DistributedSchemaRuleBuilder} | 0
.../ShadowSQLRewriteContextDecoratorTest.java | 2 +-
.../shadow/rule/builder/ShadowRuleBuilderTest.java | 5 +++--
.../AlgorithmProvidedShardingRuleBuilder.java | 4 ++--
.../sharding/rule/builder/ShardingRuleBuilder.java | 4 ++--
...a.rule.builder.scope.EnhancedSchemaRuleBuilder} | 0
.../AlgorithmProvidedShardingRuleBuilderTest.java | 5 +++--
.../rule/builder/ShardingRuleBuilderTest.java | 5 +++--
.../infra/constant/SingleTableOrder.java | 5 -----
.../rule/builder/ShardingSphereRulesBuilder.java | 22 +++++++++++++++-------
.../scope/DistributedSchemaRuleBuilder.java | 17 ++++++-----------
.../builder/scope/EnhancedSchemaRuleBuilder.java | 17 ++++++-----------
.../rule/builder/scope/SchemaRuleBuilder.java | 3 +--
.../builder/single/SingleTableRuleBuilder.java | 6 +++---
.../SingleTableRuleConfigurationChecker.java | 2 +-
...a.rule.builder.scope.EnhancedSchemaRuleBuilder} | 0
.../fixture/TestShardingSphereRuleBuilder.java | 4 ++--
...a.rule.builder.scope.EnhancedSchemaRuleBuilder} | 0
.../infra/context/fixture/FixtureRuleBuilder.java | 4 ++--
...a.rule.builder.scope.EnhancedSchemaRuleBuilder} | 0
40 files changed, 89 insertions(+), 86 deletions(-)
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/constant/DatabaseDiscoveryOrder.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/constant/DatabaseDiscoveryOrder.java
index b97c9fb..5ae5fe2 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/constant/DatabaseDiscoveryOrder.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/constant/DatabaseDiscoveryOrder.java
@@ -29,7 +29,7 @@ public final class DatabaseDiscoveryOrder {
/**
* Database discovery order.
*/
- public static final int ORDER = 30;
+ public static final int ORDER = 40;
/**
* Algorithm provider database discovery order.
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java
index a553861..aa5fa3d 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import javax.sql.DataSource;
import java.util.Collection;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Algorithm provided data base discovery rule builder.
*/
-public final class AlgorithmProvidedDatabaseDiscoveryRuleBuilder implements
FeatureRuleBuilder,
SchemaRuleBuilder<AlgorithmProvidedDatabaseDiscoveryRuleConfiguration> {
+public final class AlgorithmProvidedDatabaseDiscoveryRuleBuilder implements
FeatureRuleBuilder,
DistributedSchemaRuleBuilder<AlgorithmProvidedDatabaseDiscoveryRuleConfiguration>
{
@Override
public DatabaseDiscoveryRule build(final String schemaName, final
Map<String, DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilder.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilder.java
index e0d95db..2314531 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilder.java
@@ -24,7 +24,7 @@ import
org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import javax.sql.DataSource;
import java.util.Collection;
@@ -34,7 +34,7 @@ import java.util.Map;
/**
* Database discovery rule builder.
*/
-public final class DatabaseDiscoveryRuleBuilder implements FeatureRuleBuilder,
SchemaRuleBuilder<DatabaseDiscoveryRuleConfiguration> {
+public final class DatabaseDiscoveryRuleBuilder implements FeatureRuleBuilder,
DistributedSchemaRuleBuilder<DatabaseDiscoveryRuleConfiguration> {
@Override
public DatabaseDiscoveryRule build(final String schemaName, final
Map<String, DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder
similarity index 100%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest.java
index 5e67a86..30910d9 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.dbdiscovery.algorithm.config.AlgorithmProvidedD
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -36,7 +37,7 @@ import static org.mockito.Mockito.when;
public final class AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+
ShardingSphereServiceLoader.register(DistributedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@@ -45,7 +46,8 @@ public final class
AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest {
AlgorithmProvidedDatabaseDiscoveryRuleConfiguration
algorithmProvidedRuleConfig =
mock(AlgorithmProvidedDatabaseDiscoveryRuleConfiguration.class);
DatabaseDiscoveryDataSourceRuleConfiguration ruleConfig = new
DatabaseDiscoveryDataSourceRuleConfiguration("name",
Collections.singletonList("name"), "discoveryTypeName");
when(algorithmProvidedRuleConfig.getDataSources()).thenReturn(Collections.singletonList(ruleConfig));
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(algorithmProvidedRuleConfig),
SchemaRuleBuilder.class).get(algorithmProvidedRuleConfig);
- assertThat(builder.build("", Collections.emptyMap(),
mock(DatabaseType.class), algorithmProvidedRuleConfig, Collections.emptySet()),
instanceOf(DatabaseDiscoveryRule.class));
+ SchemaRuleBuilder builder = OrderedSPIRegistry.getRegisteredServices(
+ Collections.singletonList(algorithmProvidedRuleConfig),
DistributedSchemaRuleBuilder.class).get(algorithmProvidedRuleConfig);
+ assertThat(builder.build("", Collections.emptyMap(),
mock(DatabaseType.class), algorithmProvidedRuleConfig,
Collections.emptyList()), instanceOf(DatabaseDiscoveryRule.class));
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilderTest.java
index 5615ebf..4effbd5 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilderTest.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.dbdiscovery.api.config.DatabaseDiscoveryRuleCon
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
import org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -39,7 +40,7 @@ import static org.mockito.Mockito.when;
public final class DatabaseDiscoveryRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+
ShardingSphereServiceLoader.register(DistributedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@@ -48,7 +49,7 @@ public final class DatabaseDiscoveryRuleBuilderTest {
DatabaseDiscoveryRuleConfiguration ruleConfig =
mock(DatabaseDiscoveryRuleConfiguration.class);
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig =
new DatabaseDiscoveryDataSourceRuleConfiguration("name",
Collections.singletonList("name"), "discoveryTypeName");
when(ruleConfig.getDataSources()).thenReturn(Collections.singletonList(dataSourceRuleConfig));
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
SchemaRuleBuilder.class).get(ruleConfig);
+ SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
DistributedSchemaRuleBuilder.class).get(ruleConfig);
Map<String, DataSource> dataSourceMap = new HashMap<>(1, 1);
dataSourceMap.put("primaryDataSourceName", mock(DataSource.class));
assertThat(builder.build("test_schema", dataSourceMap,
mock(DatabaseType.class), ruleConfig, Collections.emptyList()),
instanceOf(DatabaseDiscoveryRule.class));
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/constant/EncryptOrder.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/constant/EncryptOrder.java
index da93e4d..c0567b5 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/constant/EncryptOrder.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/constant/EncryptOrder.java
@@ -29,7 +29,7 @@ public final class EncryptOrder {
/**
* Encrypt order.
*/
- public static final int ORDER = 50;
+ public static final int ORDER = 20;
/**
* Algorithm provider encrypt order.
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
index 0a8a365..f3907ca 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import javax.sql.DataSource;
import java.util.Collection;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Algorithm provided encrypt rule builder.
*/
-public final class AlgorithmProvidedEncryptRuleBuilder implements
FeatureRuleBuilder,
SchemaRuleBuilder<AlgorithmProvidedEncryptRuleConfiguration> {
+public final class AlgorithmProvidedEncryptRuleBuilder implements
FeatureRuleBuilder,
EnhancedSchemaRuleBuilder<AlgorithmProvidedEncryptRuleConfiguration> {
@Override
public EncryptRule build(final String schemaName, final Map<String,
DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
index 07ce5c6..e3044b7 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import javax.sql.DataSource;
import java.util.Collection;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Encrypt rule builder.
*/
-public final class EncryptRuleBuilder implements FeatureRuleBuilder,
SchemaRuleBuilder<EncryptRuleConfiguration> {
+public final class EncryptRuleBuilder implements FeatureRuleBuilder,
EnhancedSchemaRuleBuilder<EncryptRuleConfiguration> {
@Override
public EncryptRule build(final String schemaName, final Map<String,
DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
similarity index 100%
rename from
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
rename to
shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilderTest.java
index e1955d5..9ad715f 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilderTest.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.encrypt.rule.builder;
import
org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -34,14 +35,14 @@ import static org.mockito.Mockito.mock;
public final class AlgorithmProvidedEncryptRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+ ShardingSphereServiceLoader.register(EnhancedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void assertBuild() {
AlgorithmProvidedEncryptRuleConfiguration ruleConfig =
mock(AlgorithmProvidedEncryptRuleConfiguration.class);
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
SchemaRuleBuilder.class).get(ruleConfig);
+ SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
EnhancedSchemaRuleBuilder.class).get(ruleConfig);
assertThat(builder.build("", Collections.emptyMap(),
mock(DatabaseType.class), ruleConfig, Collections.emptyList()),
instanceOf(EncryptRule.class));
}
}
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilderTest.java
index 30241a0..7d24036 100644
---
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilderTest.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.encrypt.rule.builder;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -34,14 +35,14 @@ import static org.mockito.Mockito.mock;
public final class EncryptRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+ ShardingSphereServiceLoader.register(EnhancedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void assertBuild() {
EncryptRuleConfiguration ruleConfig =
mock(EncryptRuleConfiguration.class);
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
SchemaRuleBuilder.class).get(ruleConfig);
+ SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
EnhancedSchemaRuleBuilder.class).get(ruleConfig);
assertThat(builder.build("", Collections.emptyMap(),
mock(DatabaseType.class), ruleConfig, Collections.emptyList()),
instanceOf(EncryptRule.class));
}
}
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/constant/ReadwriteSplittingOrder.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/constant/ReadwriteSplittingOrder.java
index 0a7ff12..dc0916b 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/constant/ReadwriteSplittingOrder.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/constant/ReadwriteSplittingOrder.java
@@ -29,7 +29,7 @@ public final class ReadwriteSplittingOrder {
/**
* Readwrite-splitting order.
*/
- public static final int ORDER = 20;
+ public static final int ORDER = 30;
/**
* Algorithm provider readwrite-splitting order.
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilder.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilder.java
index 954b079..9d9ed26 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilder.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.readwritesplitting.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import
org.apache.shardingsphere.readwritesplitting.algorithm.config.AlgorithmProvidedReadwriteSplittingRuleConfiguration;
import
org.apache.shardingsphere.readwritesplitting.constant.ReadwriteSplittingOrder;
import
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Algorithm provided readwrite-splitting rule builder.
*/
-public final class AlgorithmProvidedReadwriteSplittingRuleBuilder implements
FeatureRuleBuilder,
SchemaRuleBuilder<AlgorithmProvidedReadwriteSplittingRuleConfiguration> {
+public final class AlgorithmProvidedReadwriteSplittingRuleBuilder implements
FeatureRuleBuilder,
DistributedSchemaRuleBuilder<AlgorithmProvidedReadwriteSplittingRuleConfiguration>
{
@Override
public ReadwriteSplittingRule build(final String schemaName, final
Map<String, DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilder.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilder.java
index 6921e0d..0fc9bf8 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilder.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.readwritesplitting.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import
org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
import
org.apache.shardingsphere.readwritesplitting.constant.ReadwriteSplittingOrder;
import
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Readwrite-splitting rule builder.
*/
-public final class ReadwriteSplittingRuleBuilder implements
FeatureRuleBuilder, SchemaRuleBuilder<ReadwriteSplittingRuleConfiguration> {
+public final class ReadwriteSplittingRuleBuilder implements
FeatureRuleBuilder,
DistributedSchemaRuleBuilder<ReadwriteSplittingRuleConfiguration> {
@Override
public ReadwriteSplittingRule build(final String schemaName, final
Map<String, DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder
similarity index 100%
rename from
shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
rename to
shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilderTest.java
index ac9121c..41e6ce8 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilderTest.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.readwritesplitting.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -36,7 +37,7 @@ import static org.mockito.Mockito.when;
public final class AlgorithmProvidedReadwriteSplittingRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+
ShardingSphereServiceLoader.register(DistributedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@@ -46,7 +47,8 @@ public final class
AlgorithmProvidedReadwriteSplittingRuleBuilderTest {
ReadwriteSplittingDataSourceRuleConfiguration ruleConfig = new
ReadwriteSplittingDataSourceRuleConfiguration(
"name", "pr_ds", "writeDataSourceName",
Collections.singletonList("name"), "loadBalancerName");
when(algorithmProvidedRuleConfig.getDataSources()).thenReturn(Collections.singletonList(ruleConfig));
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(algorithmProvidedRuleConfig),
SchemaRuleBuilder.class).get(algorithmProvidedRuleConfig);
+ SchemaRuleBuilder builder = OrderedSPIRegistry.getRegisteredServices(
+ Collections.singletonList(algorithmProvidedRuleConfig),
DistributedSchemaRuleBuilder.class).get(algorithmProvidedRuleConfig);
assertThat(builder.build("", Collections.emptyMap(),
mock(DatabaseType.class), algorithmProvidedRuleConfig,
Collections.emptyList()), instanceOf(ReadwriteSplittingRule.class));
}
}
diff --git
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilderTest.java
index 00ed125..6acc275 100644
---
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/test/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilderTest.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.readwritesplitting.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -36,7 +37,7 @@ import static org.mockito.Mockito.when;
public final class ReadwriteSplittingRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+
ShardingSphereServiceLoader.register(DistributedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@@ -46,7 +47,7 @@ public final class ReadwriteSplittingRuleBuilderTest {
ReadwriteSplittingDataSourceRuleConfiguration dataSourceRuleConfig =
new ReadwriteSplittingDataSourceRuleConfiguration(
"name", "pr_ds", "writeDataSourceName",
Collections.singletonList("name"), "loadBalancerName");
when(ruleConfig.getDataSources()).thenReturn(Collections.singletonList(dataSourceRuleConfig));
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
SchemaRuleBuilder.class).get(ruleConfig);
+ SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
DistributedSchemaRuleBuilder.class).get(ruleConfig);
assertThat(builder.build("", Collections.emptyMap(),
mock(DatabaseType.class), ruleConfig, Collections.emptyList()),
instanceOf(ReadwriteSplittingRule.class));
}
}
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
index 8fd9d61..3541d47 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
@@ -29,5 +29,5 @@ public final class ShadowOrder {
/**
* Shadow order.
*/
- public static final int ORDER = 60;
+ public static final int ORDER = 50;
}
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilder.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilder.java
index ef02355..7e873ab 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilder.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.shadow.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.shadow.constant.ShadowOrder;
import org.apache.shardingsphere.shadow.rule.ShadowRule;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Shadow rule builder.
*/
-public final class ShadowRuleBuilder implements FeatureRuleBuilder,
SchemaRuleBuilder<ShadowRuleConfiguration> {
+public final class ShadowRuleBuilder implements FeatureRuleBuilder,
DistributedSchemaRuleBuilder<ShadowRuleConfiguration> {
@Override
public ShadowRule build(final String schemaName, final Map<String,
DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder
similarity index 100%
rename from
shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
rename to
shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/rewrite/context/ShadowSQLRewriteContextDecoratorTest.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/rewrite/context/ShadowSQLRewriteContextDecoratorTest.java
index e59e82b..e9f6085 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/rewrite/context/ShadowSQLRewriteContextDecoratorTest.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/rewrite/context/ShadowSQLRewriteContextDecoratorTest.java
@@ -35,7 +35,7 @@ public final class ShadowSQLRewriteContextDecoratorTest {
@Test
public void assertGetOrder() {
- assertThat(shadowSQLRewriteContextDecorator.getOrder(), is(60));
+ assertThat(shadowSQLRewriteContextDecorator.getOrder(), is(50));
}
@Test
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilderTest.java
index b5fa07d..b6d9316 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/test/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilderTest.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.shadow.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -34,14 +35,14 @@ import static org.mockito.Mockito.mock;
public final class ShadowRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+
ShardingSphereServiceLoader.register(DistributedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void assertBuild() {
ShadowRuleConfiguration ruleConfig =
mock(ShadowRuleConfiguration.class);
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
SchemaRuleBuilder.class).get(ruleConfig);
+ SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
DistributedSchemaRuleBuilder.class).get(ruleConfig);
assertThat(builder.build("", Collections.emptyMap(),
mock(DatabaseType.class), ruleConfig, Collections.emptyList()),
instanceOf(ShadowRule.class));
}
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilder.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilder.java
index 4cfa610..50de1e5 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilder.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.sharding.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import
org.apache.shardingsphere.sharding.algorithm.config.AlgorithmProvidedShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.constant.ShardingOrder;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Algorithm provided sharding rule builder.
*/
-public final class AlgorithmProvidedShardingRuleBuilder implements
FeatureRuleBuilder,
SchemaRuleBuilder<AlgorithmProvidedShardingRuleConfiguration> {
+public final class AlgorithmProvidedShardingRuleBuilder implements
FeatureRuleBuilder,
EnhancedSchemaRuleBuilder<AlgorithmProvidedShardingRuleConfiguration> {
@Override
public ShardingRule build(final String schemaName, final Map<String,
DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilder.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilder.java
index 5549c74..e241317 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilder.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilder.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.sharding.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.constant.ShardingOrder;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Sharding rule builder.
*/
-public final class ShardingRuleBuilder implements FeatureRuleBuilder,
SchemaRuleBuilder<ShardingRuleConfiguration> {
+public final class ShardingRuleBuilder implements FeatureRuleBuilder,
EnhancedSchemaRuleBuilder<ShardingRuleConfiguration> {
@Override
public ShardingRule build(final String schemaName, final Map<String,
DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
similarity index 100%
rename from
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
rename to
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilderTest.java
index cc1e56f..8b081ca 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilderTest.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.sharding.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -36,14 +37,14 @@ import static org.mockito.Mockito.mock;
public final class AlgorithmProvidedShardingRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+ ShardingSphereServiceLoader.register(EnhancedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void assertBuild() {
AlgorithmProvidedShardingRuleConfiguration ruleConfig =
mock(AlgorithmProvidedShardingRuleConfiguration.class);
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
SchemaRuleBuilder.class).get(ruleConfig);
+ SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
EnhancedSchemaRuleBuilder.class).get(ruleConfig);
assertThat(builder.build("test_schema",
Collections.singletonMap("name", mock(DataSource.class, RETURNS_DEEP_STUBS)),
mock(DatabaseType.class), ruleConfig,
Collections.emptyList()), instanceOf(ShardingRule.class));
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilderTest.java
index e61b765..e247ed4 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilderTest.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.sharding.rule.builder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
@@ -36,14 +37,14 @@ import static org.mockito.Mockito.mock;
public final class ShardingRuleBuilderTest {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+ ShardingSphereServiceLoader.register(EnhancedSchemaRuleBuilder.class);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void assertBuild() {
ShardingRuleConfiguration ruleConfig =
mock(ShardingRuleConfiguration.class);
- SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
SchemaRuleBuilder.class).get(ruleConfig);
+ SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(Collections.singletonList(ruleConfig),
EnhancedSchemaRuleBuilder.class).get(ruleConfig);
assertThat(builder.build("test_schema",
Collections.singletonMap("name", mock(DataSource.class, RETURNS_DEEP_STUBS)),
mock(DatabaseType.class), ruleConfig,
Collections.emptyList()), instanceOf(ShardingRule.class));
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/constant/SingleTableOrder.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/constant/SingleTableOrder.java
index 7d11210..cf91c6f 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/constant/SingleTableOrder.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/constant/SingleTableOrder.java
@@ -30,9 +30,4 @@ public final class SingleTableOrder {
* Single table order.
*/
public static final int ORDER = 10;
-
- /**
- * Rule builder single table order.
- */
- public static final int RULE_BUILDER_ORDER = -ORDER;
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
index e976da7..f41af84 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
@@ -26,6 +26,8 @@ import
org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import
org.apache.shardingsphere.infra.rule.builder.level.DefaultKernelRuleConfigurationBuilder;
import org.apache.shardingsphere.infra.rule.builder.level.KernelRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.DistributedSchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.GlobalRuleBuilder;
import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
@@ -35,6 +37,7 @@ import javax.sql.DataSource;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
@@ -47,7 +50,8 @@ import java.util.stream.Collectors;
public final class ShardingSphereRulesBuilder {
static {
- ShardingSphereServiceLoader.register(SchemaRuleBuilder.class);
+
ShardingSphereServiceLoader.register(DistributedSchemaRuleBuilder.class);
+ ShardingSphereServiceLoader.register(EnhancedSchemaRuleBuilder.class);
ShardingSphereServiceLoader.register(GlobalRuleBuilder.class);
ShardingSphereServiceLoader.register(DefaultKernelRuleConfigurationBuilder.class);
}
@@ -64,8 +68,7 @@ public final class ShardingSphereRulesBuilder {
@SuppressWarnings({"unchecked", "rawtypes"})
public static Collection<ShardingSphereRule> buildSchemaRules(final String
schemaName, final Collection<RuleConfiguration> schemaRuleConfigs,
final
DatabaseType databaseType, final Map<String, DataSource> dataSourceMap) {
- Map<RuleConfiguration, SchemaRuleBuilder> builders =
OrderedSPIRegistry.getRegisteredServices(
- getAllSchemaRuleConfigurations(schemaRuleConfigs),
SchemaRuleBuilder.class, Comparator.reverseOrder());
+ Map<RuleConfiguration, SchemaRuleBuilder> builders =
getSchemaRuleBuilders(getAllSchemaRuleConfigurations(schemaRuleConfigs));
appendDefaultKernelSchemaRuleConfigurationBuilder(builders);
Collection<ShardingSphereRule> result = new LinkedList<>();
for (Entry<RuleConfiguration, SchemaRuleBuilder> entry :
builders.entrySet()) {
@@ -74,12 +77,17 @@ public final class ShardingSphereRulesBuilder {
return result;
}
+ @SuppressWarnings("rawtypes")
+ private static Map<RuleConfiguration, SchemaRuleBuilder>
getSchemaRuleBuilders(final Collection<RuleConfiguration> schemaRuleConfigs) {
+ Map<RuleConfiguration, SchemaRuleBuilder> result = new
LinkedHashMap<>();
+
result.putAll(OrderedSPIRegistry.getRegisteredServices(schemaRuleConfigs,
DistributedSchemaRuleBuilder.class, Comparator.reverseOrder()));
+
result.putAll(OrderedSPIRegistry.getRegisteredServices(schemaRuleConfigs,
EnhancedSchemaRuleBuilder.class));
+ return result;
+ }
+
private static Collection<RuleConfiguration>
getAllSchemaRuleConfigurations(final Collection<RuleConfiguration>
schemaRuleConfigs) {
- Collection<RuleConfiguration> result = new LinkedList<>();
+ Collection<RuleConfiguration> result = new
LinkedList<>(schemaRuleConfigs);
result.add(new SingleTableRuleConfiguration());
- if (!schemaRuleConfigs.isEmpty()) {
- result.addAll(schemaRuleConfigs);
- }
return result;
}
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/DistributedSchemaRuleBuilder.java
similarity index 72%
copy from
shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
copy to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/DistributedSchemaRuleBuilder.java
index 8fd9d61..e3028a9 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/DistributedSchemaRuleBuilder.java
@@ -15,19 +15,14 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.shadow.constant;
+package org.apache.shardingsphere.infra.rule.builder.scope;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
/**
- * Shadow order.
+ * Distributed schema rule builder.
+ *
+ * @param <T> type of rule configuration
*/
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ShadowOrder {
-
- /**
- * Shadow order.
- */
- public static final int ORDER = 60;
+public interface DistributedSchemaRuleBuilder<T extends RuleConfiguration>
extends SchemaRuleBuilder<T> {
}
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/EnhancedSchemaRuleBuilder.java
similarity index 72%
copy from
shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
copy to
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/EnhancedSchemaRuleBuilder.java
index 8fd9d61..0bb7745 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/constant/ShadowOrder.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/EnhancedSchemaRuleBuilder.java
@@ -15,19 +15,14 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.shadow.constant;
+package org.apache.shardingsphere.infra.rule.builder.scope;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
/**
- * Shadow order.
+ * Enhanced schema rule builder.
+ *
+ * @param <T> type of rule configuration
*/
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ShadowOrder {
-
- /**
- * Shadow order.
- */
- public static final int ORDER = 60;
+public interface EnhancedSchemaRuleBuilder<T extends RuleConfiguration>
extends SchemaRuleBuilder<T> {
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/SchemaRuleBuilder.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/SchemaRuleBuilder.java
index 5550966..53ae4ee 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/SchemaRuleBuilder.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/SchemaRuleBuilder.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.rule.builder.scope;
-import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.scope.SchemaRule;
@@ -31,7 +30,7 @@ import java.util.Map;
*
* @param <T> type of rule configuration
*/
-public interface SchemaRuleBuilder<T extends RuleConfiguration> extends
RuleBuilder<T> {
+public interface SchemaRuleBuilder<T> extends RuleBuilder<T> {
/**
* Build schema rule.
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/single/SingleTableRuleBuilder.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/single/SingleTableRuleBuilder.java
index 665b840..a043776 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/single/SingleTableRuleBuilder.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/single/SingleTableRuleBuilder.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.infra.constant.SingleTableOrder;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.single.SingleTableRule;
import javax.sql.DataSource;
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Single table rule builder.
*/
-public final class SingleTableRuleBuilder implements FeatureRuleBuilder,
SchemaRuleBuilder<SingleTableRuleConfiguration> {
+public final class SingleTableRuleBuilder implements FeatureRuleBuilder,
EnhancedSchemaRuleBuilder<SingleTableRuleConfiguration> {
@Override
public SingleTableRule build(final String schemaName, final Map<String,
DataSource> dataSourceMap, final DatabaseType databaseType,
@@ -42,7 +42,7 @@ public final class SingleTableRuleBuilder implements
FeatureRuleBuilder, SchemaR
@Override
public int getOrder() {
- return SingleTableOrder.RULE_BUILDER_ORDER;
+ return SingleTableOrder.ORDER;
}
@Override
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/single/SingleTableRuleConfigurationChecker.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/single/SingleTableRuleConfigurationChecker.java
index e82d89c..044da2c 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/single/SingleTableRuleConfigurationChecker.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/single/SingleTableRuleConfigurationChecker.java
@@ -32,7 +32,7 @@ public final class SingleTableRuleConfigurationChecker
implements RuleConfigurat
@Override
public int getOrder() {
- return SingleTableOrder.RULE_BUILDER_ORDER;
+ return SingleTableOrder.ORDER;
}
@Override
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
b/shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
similarity index 100%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
rename to
shardingsphere-infra/shardingsphere-infra-common/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/TestShardingSphereRuleBuilder.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/TestShardingSphereRuleBuilder.java
index 17398ef..44c3a87 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/TestShardingSphereRuleBuilder.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/TestShardingSphereRuleBuilder.java
@@ -20,14 +20,14 @@ package org.apache.shardingsphere.infra.rule.fixture;
import lombok.Getter;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import org.apache.shardingsphere.infra.rule.scope.SchemaRule;
import javax.sql.DataSource;
import java.util.Collection;
import java.util.Map;
-public final class TestShardingSphereRuleBuilder implements
SchemaRuleBuilder<TestRuleConfiguration> {
+public final class TestShardingSphereRuleBuilder implements
EnhancedSchemaRuleBuilder<TestRuleConfiguration> {
@Getter
private static final SchemaRule RULE = new TestShardingSphereRule();
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
similarity index 100%
rename from
shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
rename to
shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
diff --git
a/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/fixture/FixtureRuleBuilder.java
b/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/fixture/FixtureRuleBuilder.java
index db535f2..9e256f9 100644
---
a/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/fixture/FixtureRuleBuilder.java
+++
b/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/fixture/FixtureRuleBuilder.java
@@ -19,13 +19,13 @@ package org.apache.shardingsphere.infra.context.fixture;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
+import
org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder;
import javax.sql.DataSource;
import java.util.Collection;
import java.util.Map;
-public final class FixtureRuleBuilder implements
SchemaRuleBuilder<FixtureRuleConfiguration> {
+public final class FixtureRuleBuilder implements
EnhancedSchemaRuleBuilder<FixtureRuleConfiguration> {
@Override
public FixtureRule build(final String schemaName, final Map<String,
DataSource> dataSourceMap, final DatabaseType databaseType,
diff --git
a/shardingsphere-infra/shardingsphere-infra-context/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
b/shardingsphere-infra/shardingsphere-infra-context/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder
similarity index 100%
rename from
shardingsphere-infra/shardingsphere-infra-context/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder
rename to
shardingsphere-infra/shardingsphere-infra-context/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.scope.EnhancedSchemaRuleBuilder