Refactor YamlDataNodeConfigurationSwapper (#31037)
diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java
index 42e5d80..71d41cc 100644
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java
+++ b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java
@@ -21,10 +21,10 @@
import org.apache.shardingsphere.broadcast.constant.BroadcastOrder;
import org.apache.shardingsphere.broadcast.metadata.nodepath.BroadcastRuleNodePathProvider;
import org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration;
-import org.apache.shardingsphere.mode.path.RuleNodePath;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
+import org.apache.shardingsphere.mode.path.RuleNodePath;
import java.util.Collection;
import java.util.Collections;
@@ -35,7 +35,7 @@
/**
* YAML broadcast data node rule configuration swapper.
*/
-public final class YamlBroadcastDataNodeRuleConfigurationSwapper implements YamlDataNodeRuleConfigurationSwapper<BroadcastRuleConfiguration> {
+public final class YamlBroadcastDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<BroadcastRuleConfiguration> {
private final RuleNodePath broadcastRuleNodePath = new BroadcastRuleNodePathProvider().getRuleNodePath();
diff --git a/features/broadcast/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper b/features/broadcast/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from features/broadcast/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper
rename to features/broadcast/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptDataNodeRuleConfigurationSwapper.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptDataNodeRuleConfigurationSwapper.java
index e17592b..ca371b7 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptDataNodeRuleConfigurationSwapper.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/YamlEncryptDataNodeRuleConfigurationSwapper.java
@@ -24,12 +24,12 @@
import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.yaml.swapper.rule.YamlEncryptTableRuleConfigurationSwapper;
import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import org.apache.shardingsphere.mode.path.RuleNodePath;
-import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
+import org.apache.shardingsphere.mode.path.RuleNodePath;
import java.util.Collection;
import java.util.LinkedHashMap;
@@ -43,7 +43,7 @@
/**
* YAML encrypt data node rule configuration swapper.
*/
-public final class YamlEncryptDataNodeRuleConfigurationSwapper implements YamlDataNodeRuleConfigurationSwapper<EncryptRuleConfiguration> {
+public final class YamlEncryptDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<EncryptRuleConfiguration> {
private final YamlEncryptTableRuleConfigurationSwapper tableSwapper = new YamlEncryptTableRuleConfigurationSwapper();
diff --git a/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper b/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper
rename to features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/yaml/swapper/YamlMaskDataNodeRuleConfigurationSwapper.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/yaml/swapper/YamlMaskDataNodeRuleConfigurationSwapper.java
index a9ca6dd..f508b74 100644
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/yaml/swapper/YamlMaskDataNodeRuleConfigurationSwapper.java
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/yaml/swapper/YamlMaskDataNodeRuleConfigurationSwapper.java
@@ -18,18 +18,18 @@
package org.apache.shardingsphere.mask.yaml.swapper;
import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import org.apache.shardingsphere.mode.path.RuleNodePath;
-import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration;
import org.apache.shardingsphere.mask.api.config.rule.MaskTableRuleConfiguration;
import org.apache.shardingsphere.mask.constant.MaskOrder;
import org.apache.shardingsphere.mask.metadata.nodepath.MaskRuleNodePathProvider;
import org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration;
import org.apache.shardingsphere.mask.yaml.swapper.rule.YamlMaskTableRuleConfigurationSwapper;
+import org.apache.shardingsphere.mode.path.RuleNodePath;
import java.util.Collection;
import java.util.LinkedHashMap;
@@ -43,7 +43,7 @@
/**
* YAML mask data node rule configuration swapper.
*/
-public final class YamlMaskDataNodeRuleConfigurationSwapper implements YamlDataNodeRuleConfigurationSwapper<MaskRuleConfiguration> {
+public final class YamlMaskDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<MaskRuleConfiguration> {
private final YamlMaskTableRuleConfigurationSwapper tableSwapper = new YamlMaskTableRuleConfigurationSwapper();
diff --git a/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper b/features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper
rename to features/mask/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/YamlReadwriteSplittingDataNodeRuleConfigurationSwapper.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/YamlReadwriteSplittingDataNodeRuleConfigurationSwapper.java
index f6455ff..425dc17 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/YamlReadwriteSplittingDataNodeRuleConfigurationSwapper.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/YamlReadwriteSplittingDataNodeRuleConfigurationSwapper.java
@@ -19,12 +19,12 @@
import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import org.apache.shardingsphere.mode.path.RuleNodePath;
-import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
+import org.apache.shardingsphere.mode.path.RuleNodePath;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceGroupRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.api.transaction.TransactionalReadQueryStrategy;
@@ -44,7 +44,7 @@
/**
* YAML readwrite-splitting data node rule configuration swapper.
*/
-public final class YamlReadwriteSplittingDataNodeRuleConfigurationSwapper implements YamlDataNodeRuleConfigurationSwapper<ReadwriteSplittingRuleConfiguration> {
+public final class YamlReadwriteSplittingDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<ReadwriteSplittingRuleConfiguration> {
private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new YamlAlgorithmConfigurationSwapper();
diff --git a/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper b/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper
rename to features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/yaml/swapper/YamlShadowDataNodeRuleConfigurationSwapper.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/yaml/swapper/YamlShadowDataNodeRuleConfigurationSwapper.java
index 7510b36..9aaf703 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/yaml/swapper/YamlShadowDataNodeRuleConfigurationSwapper.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/yaml/swapper/YamlShadowDataNodeRuleConfigurationSwapper.java
@@ -19,12 +19,12 @@
import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import org.apache.shardingsphere.mode.path.RuleNodePath;
-import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
+import org.apache.shardingsphere.mode.path.RuleNodePath;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.shadow.api.config.datasource.ShadowDataSourceConfiguration;
import org.apache.shardingsphere.shadow.api.config.table.ShadowTableConfiguration;
@@ -44,7 +44,7 @@
/**
* YAML shadow data node rule configuration swapper.
*/
-public final class YamlShadowDataNodeRuleConfigurationSwapper implements YamlDataNodeRuleConfigurationSwapper<ShadowRuleConfiguration> {
+public final class YamlShadowDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<ShadowRuleConfiguration> {
private final YamlShadowTableConfigurationSwapper tableSwapper = new YamlShadowTableConfigurationSwapper();
diff --git a/features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper b/features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper
rename to features/shadow/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingDataNodeRuleConfigurationSwapper.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingDataNodeRuleConfigurationSwapper.java
index 3d44648..9130de7 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingDataNodeRuleConfigurationSwapper.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/YamlShardingDataNodeRuleConfigurationSwapper.java
@@ -18,12 +18,12 @@
package org.apache.shardingsphere.sharding.yaml.swapper;
import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import org.apache.shardingsphere.mode.path.RuleNodePath;
-import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
+import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
+import org.apache.shardingsphere.mode.path.RuleNodePath;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
@@ -54,7 +54,7 @@
/**
* YAML sharding data node rule configuration swapper.
*/
-public final class YamlShardingDataNodeRuleConfigurationSwapper implements YamlDataNodeRuleConfigurationSwapper<ShardingRuleConfiguration> {
+public final class YamlShardingDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<ShardingRuleConfiguration> {
private final YamlShardingTableRuleConfigurationSwapper tableSwapper = new YamlShardingTableRuleConfigurationSwapper();
diff --git a/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper b/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper
rename to features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeGlobalRuleConfigurationSwapper.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeGlobalRuleConfigurationSwapper.java
deleted file mode 100644
index 4effbe8..0000000
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeGlobalRuleConfigurationSwapper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.yaml.config.swapper.rule;
-
-import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
-import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPI;
-import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
-
-/**
- * YAML data node rule global configuration swapper.
- *
- * @param <T> type of rule configuration
- */
-@SingletonSPI
-public interface YamlDataNodeGlobalRuleConfigurationSwapper<T extends RuleConfiguration> extends YamlDataNodeConfigurationSwapper<T>, OrderedSPI<T> {
-
- /**
- * Get YAML rule tag name.
- *
- * @return YAML rule tag name
- */
- String getRuleTagName();
-}
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeGlobalRuleConfigurationSwapperEngine.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeGlobalRuleConfigurationSwapperEngine.java
index 24f6b30..c5b6fd3 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeGlobalRuleConfigurationSwapperEngine.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeGlobalRuleConfigurationSwapperEngine.java
@@ -20,6 +20,7 @@
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import java.util.Collection;
import java.util.LinkedList;
@@ -38,8 +39,8 @@
* @return YAML global rule configurations
*/
@SuppressWarnings("rawtypes")
- public Map<RuleConfiguration, YamlDataNodeGlobalRuleConfigurationSwapper> swapToYamlRuleConfigurations(final Collection<RuleConfiguration> ruleConfigs) {
- return OrderedSPILoader.getServices(YamlDataNodeGlobalRuleConfigurationSwapper.class, ruleConfigs);
+ public Map<RuleConfiguration, YamlDataNodeConfigurationSwapper> swapToYamlRuleConfigurations(final Collection<RuleConfiguration> ruleConfigs) {
+ return OrderedSPILoader.getServices(YamlDataNodeConfigurationSwapper.class, ruleConfigs);
}
/**
@@ -51,7 +52,7 @@
@SuppressWarnings({"unchecked", "rawtypes"})
public Collection<RuleConfiguration> swapToRuleConfigurations(final Collection<RepositoryTuple> repositoryTuples) {
Collection<RuleConfiguration> result = new LinkedList<>();
- for (YamlDataNodeGlobalRuleConfigurationSwapper each : OrderedSPILoader.getServices(YamlDataNodeGlobalRuleConfigurationSwapper.class)) {
+ for (YamlDataNodeConfigurationSwapper each : OrderedSPILoader.getServices(YamlDataNodeConfigurationSwapper.class)) {
each.swapToObject(repositoryTuples).ifPresent(optional -> result.add((RuleConfiguration) optional));
}
return result;
@@ -66,7 +67,7 @@
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public Optional<RuleConfiguration> swapSingleRuleToRuleConfiguration(final String ruleName, final Collection<RepositoryTuple> repositoryTuples) {
- for (YamlDataNodeGlobalRuleConfigurationSwapper each : OrderedSPILoader.getServices(YamlDataNodeGlobalRuleConfigurationSwapper.class)) {
+ for (YamlDataNodeConfigurationSwapper each : OrderedSPILoader.getServices(YamlDataNodeConfigurationSwapper.class)) {
if (ruleName.equals(each.getRuleTagName().toLowerCase())) {
return each.swapToObject(repositoryTuples);
}
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeRuleConfigurationSwapper.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeRuleConfigurationSwapper.java
deleted file mode 100644
index f607740..0000000
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeRuleConfigurationSwapper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.yaml.config.swapper.rule;
-
-import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
-import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPI;
-import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
-
-/**
- * YAML data node rule configuration swapper.
- *
- * @param <T> type of rule configuration
- */
-@SingletonSPI
-public interface YamlDataNodeRuleConfigurationSwapper<T extends RuleConfiguration> extends YamlDataNodeConfigurationSwapper<T>, OrderedSPI<T> {
-
- /**
- * Get YAML rule tag name.
- *
- * @return YAML rule tag name
- */
- String getRuleTagName();
-}
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeRuleConfigurationSwapperEngine.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeRuleConfigurationSwapperEngine.java
index f7ded20..08ee2e8 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeRuleConfigurationSwapperEngine.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/config/swapper/rule/YamlDataNodeRuleConfigurationSwapperEngine.java
@@ -20,6 +20,7 @@
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import java.util.Collection;
import java.util.LinkedList;
@@ -37,8 +38,8 @@
* @return YAML rule configurations
*/
@SuppressWarnings("rawtypes")
- public Map<RuleConfiguration, YamlDataNodeRuleConfigurationSwapper> swapToYamlRuleConfigurations(final Collection<RuleConfiguration> ruleConfigs) {
- return OrderedSPILoader.getServices(YamlDataNodeRuleConfigurationSwapper.class, ruleConfigs);
+ public Map<RuleConfiguration, YamlDataNodeConfigurationSwapper> swapToYamlRuleConfigurations(final Collection<RuleConfiguration> ruleConfigs) {
+ return OrderedSPILoader.getServices(YamlDataNodeConfigurationSwapper.class, ruleConfigs);
}
/**
@@ -50,7 +51,7 @@
@SuppressWarnings({"unchecked", "rawtypes"})
public Collection<RuleConfiguration> swapToRuleConfigurations(final Collection<RepositoryTuple> repositoryTuples) {
Collection<RuleConfiguration> result = new LinkedList<>();
- for (YamlDataNodeRuleConfigurationSwapper each : OrderedSPILoader.getServices(YamlDataNodeRuleConfigurationSwapper.class)) {
+ for (YamlDataNodeConfigurationSwapper each : OrderedSPILoader.getServices(YamlDataNodeConfigurationSwapper.class)) {
each.swapToObject(repositoryTuples).ifPresent(optional -> result.add((RuleConfiguration) optional));
}
return result;
diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/yaml/swapper/YamlDataNodeConfigurationSwapper.java b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/yaml/swapper/YamlDataNodeConfigurationSwapper.java
index c16b694..d9a0e52 100644
--- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/yaml/swapper/YamlDataNodeConfigurationSwapper.java
+++ b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/yaml/swapper/YamlDataNodeConfigurationSwapper.java
@@ -17,6 +17,8 @@
package org.apache.shardingsphere.infra.util.yaml.swapper;
+import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
+import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPI;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
import java.util.Collection;
@@ -27,7 +29,8 @@
*
* @param <T> type of swapped object
*/
-public interface YamlDataNodeConfigurationSwapper<T> {
+@SingletonSPI
+public interface YamlDataNodeConfigurationSwapper<T> extends OrderedSPI<T> {
/**
* Swap to repository tuples.
@@ -44,4 +47,11 @@
* @return swapped object
*/
Optional<T> swapToObject(Collection<RepositoryTuple> repositoryTuples);
+
+ /**
+ * Get YAML rule tag name.
+ *
+ * @return YAML rule tag name
+ */
+ String getRuleTagName();
}
diff --git a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/yaml/swapper/YamlAuthorityDataNodeRuleConfigurationSwapper.java b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/yaml/swapper/YamlAuthorityDataNodeRuleConfigurationSwapper.java
index 1337230..1db4c36 100644
--- a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/yaml/swapper/YamlAuthorityDataNodeRuleConfigurationSwapper.java
+++ b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/yaml/swapper/YamlAuthorityDataNodeRuleConfigurationSwapper.java
@@ -22,12 +22,12 @@
import org.apache.shardingsphere.authority.rule.builder.DefaultAuthorityRuleConfigurationBuilder;
import org.apache.shardingsphere.authority.yaml.config.YamlAuthorityRuleConfiguration;
import org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import java.util.Collection;
import java.util.Collections;
@@ -39,7 +39,7 @@
/**
* YAML Authority data node rule configuration swapper.
*/
-public final class YamlAuthorityDataNodeRuleConfigurationSwapper implements YamlDataNodeGlobalRuleConfigurationSwapper<AuthorityRuleConfiguration> {
+public final class YamlAuthorityDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<AuthorityRuleConfiguration> {
private final YamlUserSwapper userSwapper = new YamlUserSwapper();
diff --git a/kernel/authority/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper b/kernel/authority/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/authority/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper
rename to kernel/authority/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/yaml/swapper/YamlGlobalClockDataNodeRuleConfigurationSwapper.java b/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/yaml/swapper/YamlGlobalClockDataNodeRuleConfigurationSwapper.java
index 9f55af5..e8c8f65 100644
--- a/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/yaml/swapper/YamlGlobalClockDataNodeRuleConfigurationSwapper.java
+++ b/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/yaml/swapper/YamlGlobalClockDataNodeRuleConfigurationSwapper.java
@@ -23,7 +23,7 @@
import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import java.util.Collection;
import java.util.Collections;
@@ -33,7 +33,7 @@
/**
* YAML global clock data node rule configuration swapper.
*/
-public final class YamlGlobalClockDataNodeRuleConfigurationSwapper implements YamlDataNodeGlobalRuleConfigurationSwapper<GlobalClockRuleConfiguration> {
+public final class YamlGlobalClockDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<GlobalClockRuleConfiguration> {
@Override
public Collection<RepositoryTuple> swapToRepositoryTuples(final GlobalClockRuleConfiguration data) {
diff --git a/kernel/global-clock/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper b/kernel/global-clock/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/global-clock/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper
rename to kernel/global-clock/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingDataNodeRuleConfigurationSwapper.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingDataNodeRuleConfigurationSwapper.java
index a337a6e..01187d5 100644
--- a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingDataNodeRuleConfigurationSwapper.java
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingDataNodeRuleConfigurationSwapper.java
@@ -20,7 +20,7 @@
import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
import org.apache.shardingsphere.logging.constant.LoggingOrder;
import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
@@ -35,7 +35,7 @@
/**
* YAML logging data node rule configuration swapper.
*/
-public final class YamlLoggingDataNodeRuleConfigurationSwapper implements YamlDataNodeGlobalRuleConfigurationSwapper<LoggingRuleConfiguration> {
+public final class YamlLoggingDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<LoggingRuleConfiguration> {
@Override
public Collection<RepositoryTuple> swapToRepositoryTuples(final LoggingRuleConfiguration data) {
diff --git a/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper b/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper
rename to kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/rule/DatabaseRulePersistService.java b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/rule/DatabaseRulePersistService.java
index 6c97849..6d54596 100644
--- a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/rule/DatabaseRulePersistService.java
+++ b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/rule/DatabaseRulePersistService.java
@@ -21,7 +21,7 @@
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import org.apache.shardingsphere.infra.metadata.version.MetaDataVersion;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.metadata.persist.node.metadata.DatabaseRuleMetaDataNode;
import org.apache.shardingsphere.metadata.persist.service.config.RepositoryTuplePersistService;
@@ -53,7 +53,7 @@
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void persist(final String databaseName, final Collection<RuleConfiguration> configs) {
- for (Entry<RuleConfiguration, YamlDataNodeRuleConfigurationSwapper> entry : new YamlDataNodeRuleConfigurationSwapperEngine().swapToYamlRuleConfigurations(configs).entrySet()) {
+ for (Entry<RuleConfiguration, YamlDataNodeConfigurationSwapper> entry : new YamlDataNodeRuleConfigurationSwapperEngine().swapToYamlRuleConfigurations(configs).entrySet()) {
Collection<RepositoryTuple> repositoryTuples = entry.getValue().swapToRepositoryTuples(entry.getKey());
if (!repositoryTuples.isEmpty()) {
persistDataNodes(databaseName, entry.getValue().getRuleTagName().toLowerCase(), repositoryTuples);
@@ -76,7 +76,7 @@
@Override
public Collection<MetaDataVersion> persistConfigurations(final String databaseName, final Collection<RuleConfiguration> configs) {
Collection<MetaDataVersion> result = new LinkedList<>();
- for (Entry<RuleConfiguration, YamlDataNodeRuleConfigurationSwapper> entry : new YamlDataNodeRuleConfigurationSwapperEngine().swapToYamlRuleConfigurations(configs).entrySet()) {
+ for (Entry<RuleConfiguration, YamlDataNodeConfigurationSwapper> entry : new YamlDataNodeRuleConfigurationSwapperEngine().swapToYamlRuleConfigurations(configs).entrySet()) {
Collection<RepositoryTuple> repositoryTuples = entry.getValue().swapToRepositoryTuples(entry.getKey());
if (!repositoryTuples.isEmpty()) {
result.addAll(persistDataNodes(databaseName, entry.getValue().getRuleTagName().toLowerCase(), repositoryTuples));
@@ -103,7 +103,7 @@
@Override
public Collection<MetaDataVersion> deleteConfigurations(final String databaseName, final Collection<RuleConfiguration> configs) {
Collection<MetaDataVersion> result = new LinkedList<>();
- for (Entry<RuleConfiguration, YamlDataNodeRuleConfigurationSwapper> entry : new YamlDataNodeRuleConfigurationSwapperEngine().swapToYamlRuleConfigurations(configs).entrySet()) {
+ for (Entry<RuleConfiguration, YamlDataNodeConfigurationSwapper> entry : new YamlDataNodeRuleConfigurationSwapperEngine().swapToYamlRuleConfigurations(configs).entrySet()) {
Collection<RepositoryTuple> repositoryTuples = entry.getValue().swapToRepositoryTuples(entry.getKey());
if (repositoryTuples.isEmpty()) {
continue;
diff --git a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistService.java b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistService.java
index aae50b2..02a69bf 100644
--- a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistService.java
+++ b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistService.java
@@ -21,7 +21,7 @@
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import org.apache.shardingsphere.infra.metadata.version.MetaDataVersion;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.metadata.persist.node.GlobalNode;
import org.apache.shardingsphere.metadata.persist.service.config.RepositoryTuplePersistService;
@@ -57,7 +57,7 @@
@Override
public void persist(final Collection<RuleConfiguration> globalRuleConfigs) {
Collection<MetaDataVersion> metaDataVersions = new LinkedList<>();
- for (Entry<RuleConfiguration, YamlDataNodeGlobalRuleConfigurationSwapper> entry : new YamlDataNodeGlobalRuleConfigurationSwapperEngine()
+ for (Entry<RuleConfiguration, YamlDataNodeConfigurationSwapper> entry : new YamlDataNodeGlobalRuleConfigurationSwapperEngine()
.swapToYamlRuleConfigurations(globalRuleConfigs).entrySet()) {
Collection<RepositoryTuple> repositoryTuples = entry.getValue().swapToRepositoryTuples(entry.getKey());
if (!repositoryTuples.isEmpty()) {
diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/yaml/config/swapper/YamlSingleDataNodeRuleConfigurationSwapper.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/yaml/config/swapper/YamlSingleDataNodeRuleConfigurationSwapper.java
index a110ad6..e4d07b6 100644
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/yaml/config/swapper/YamlSingleDataNodeRuleConfigurationSwapper.java
+++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/yaml/config/swapper/YamlSingleDataNodeRuleConfigurationSwapper.java
@@ -19,7 +19,7 @@
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.mode.path.RuleNodePath;
import org.apache.shardingsphere.single.api.config.SingleRuleConfiguration;
import org.apache.shardingsphere.single.constant.SingleOrder;
@@ -34,7 +34,7 @@
/**
* YAML single data node rule configuration swapper.
*/
-public final class YamlSingleDataNodeRuleConfigurationSwapper implements YamlDataNodeRuleConfigurationSwapper<SingleRuleConfiguration> {
+public final class YamlSingleDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<SingleRuleConfiguration> {
private final RuleNodePath singleRuleNodePath = new SingleRuleNodePathProvider().getRuleNodePath();
diff --git a/kernel/single/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper b/kernel/single/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/single/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeRuleConfigurationSwapper
rename to kernel/single/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/yaml/swapper/YamlSQLFederationDataNodeRuleConfigurationSwapper.java b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/yaml/swapper/YamlSQLFederationDataNodeRuleConfigurationSwapper.java
index 3fdaff6..683f95e 100644
--- a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/yaml/swapper/YamlSQLFederationDataNodeRuleConfigurationSwapper.java
+++ b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/yaml/swapper/YamlSQLFederationDataNodeRuleConfigurationSwapper.java
@@ -20,7 +20,7 @@
import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.sql.parser.api.CacheOption;
import org.apache.shardingsphere.sqlfederation.api.config.SQLFederationRuleConfiguration;
import org.apache.shardingsphere.sqlfederation.constant.SQLFederationOrder;
@@ -33,7 +33,7 @@
/**
* YAML SQL federation data node rule configuration swapper.
*/
-public final class YamlSQLFederationDataNodeRuleConfigurationSwapper implements YamlDataNodeGlobalRuleConfigurationSwapper<SQLFederationRuleConfiguration> {
+public final class YamlSQLFederationDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<SQLFederationRuleConfiguration> {
private final YamlSQLFederationExecutionPlanCacheConfigurationSwapper executionPlanCacheConfigSwapper = new YamlSQLFederationExecutionPlanCacheConfigurationSwapper();
diff --git a/kernel/sql-federation/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper b/kernel/sql-federation/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/sql-federation/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper
rename to kernel/sql-federation/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/kernel/sql-parser/core/src/main/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserDataNodeRuleConfigurationSwapper.java b/kernel/sql-parser/core/src/main/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserDataNodeRuleConfigurationSwapper.java
index b0faec9..61486a6 100644
--- a/kernel/sql-parser/core/src/main/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserDataNodeRuleConfigurationSwapper.java
+++ b/kernel/sql-parser/core/src/main/java/org/apache/shardingsphere/parser/yaml/swapper/YamlSQLParserDataNodeRuleConfigurationSwapper.java
@@ -20,7 +20,7 @@
import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration;
import org.apache.shardingsphere.parser.constant.SQLParserOrder;
import org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder;
@@ -34,7 +34,7 @@
/**
* YAML SQL parser data node rule configuration swapper.
*/
-public final class YamlSQLParserDataNodeRuleConfigurationSwapper implements YamlDataNodeGlobalRuleConfigurationSwapper<SQLParserRuleConfiguration> {
+public final class YamlSQLParserDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<SQLParserRuleConfiguration> {
private final YamlSQLParserCacheOptionConfigurationSwapper cacheOptionSwapper = new YamlSQLParserCacheOptionConfigurationSwapper();
diff --git a/kernel/sql-parser/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper b/kernel/sql-parser/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/sql-parser/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper
rename to kernel/sql-parser/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/kernel/sql-translator/core/src/main/java/org/apache/shardingsphere/sqltranslator/yaml/swapper/YamlSQLTranslatorDataNodeRuleConfigurationSwapper.java b/kernel/sql-translator/core/src/main/java/org/apache/shardingsphere/sqltranslator/yaml/swapper/YamlSQLTranslatorDataNodeRuleConfigurationSwapper.java
index e107bc0..52202e8 100644
--- a/kernel/sql-translator/core/src/main/java/org/apache/shardingsphere/sqltranslator/yaml/swapper/YamlSQLTranslatorDataNodeRuleConfigurationSwapper.java
+++ b/kernel/sql-translator/core/src/main/java/org/apache/shardingsphere/sqltranslator/yaml/swapper/YamlSQLTranslatorDataNodeRuleConfigurationSwapper.java
@@ -20,7 +20,7 @@
import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.sqltranslator.api.config.SQLTranslatorRuleConfiguration;
import org.apache.shardingsphere.sqltranslator.constant.SQLTranslatorOrder;
import org.apache.shardingsphere.sqltranslator.yaml.config.YamlSQLTranslatorRuleConfiguration;
@@ -32,7 +32,7 @@
/**
* YAML SQL translator data node rule configuration swapper.
*/
-public final class YamlSQLTranslatorDataNodeRuleConfigurationSwapper implements YamlDataNodeGlobalRuleConfigurationSwapper<SQLTranslatorRuleConfiguration> {
+public final class YamlSQLTranslatorDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<SQLTranslatorRuleConfiguration> {
@Override
public Collection<RepositoryTuple> swapToRepositoryTuples(final SQLTranslatorRuleConfiguration data) {
diff --git a/kernel/sql-translator/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper b/kernel/sql-translator/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/sql-translator/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper
rename to kernel/sql-translator/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/yaml/swapper/YamlTrafficDataNodeRuleConfigurationSwapper.java b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/yaml/swapper/YamlTrafficDataNodeRuleConfigurationSwapper.java
index 8156072..e5ac92d 100644
--- a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/yaml/swapper/YamlTrafficDataNodeRuleConfigurationSwapper.java
+++ b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/yaml/swapper/YamlTrafficDataNodeRuleConfigurationSwapper.java
@@ -17,11 +17,11 @@
package org.apache.shardingsphere.traffic.yaml.swapper;
+import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.traffic.api.config.TrafficRuleConfiguration;
import org.apache.shardingsphere.traffic.constant.TrafficOrder;
import org.apache.shardingsphere.traffic.yaml.config.YamlTrafficRuleConfiguration;
@@ -35,7 +35,7 @@
/**
* YAML traffic data node rule configuration swapper.
*/
-public final class YamlTrafficDataNodeRuleConfigurationSwapper implements YamlDataNodeGlobalRuleConfigurationSwapper<TrafficRuleConfiguration> {
+public final class YamlTrafficDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<TrafficRuleConfiguration> {
private final YamlTrafficStrategyConfigurationSwapper strategySwapper = new YamlTrafficStrategyConfigurationSwapper();
diff --git a/kernel/traffic/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper b/kernel/traffic/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/traffic/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper
rename to kernel/traffic/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/YamlTransactionDataNodeRuleConfigurationSwapper.java b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/YamlTransactionDataNodeRuleConfigurationSwapper.java
index 92c6193..1e4c7210 100644
--- a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/YamlTransactionDataNodeRuleConfigurationSwapper.java
+++ b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/YamlTransactionDataNodeRuleConfigurationSwapper.java
@@ -20,7 +20,7 @@
import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
import org.apache.shardingsphere.transaction.constant.TransactionOrder;
import org.apache.shardingsphere.transaction.yaml.config.YamlTransactionRuleConfiguration;
@@ -33,7 +33,7 @@
/**
* YAML Transaction data node rule configuration swapper.
*/
-public final class YamlTransactionDataNodeRuleConfigurationSwapper implements YamlDataNodeGlobalRuleConfigurationSwapper<TransactionRuleConfiguration> {
+public final class YamlTransactionDataNodeRuleConfigurationSwapper implements YamlDataNodeConfigurationSwapper<TransactionRuleConfiguration> {
@Override
public Collection<RepositoryTuple> swapToRepositoryTuples(final TransactionRuleConfiguration data) {
diff --git a/kernel/transaction/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper b/kernel/transaction/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
similarity index 100%
rename from kernel/transaction/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper
rename to kernel/transaction/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper
diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java
index 55364ba..73831f4 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java
@@ -38,7 +38,7 @@
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.builder.database.DatabaseRulesBuilder;
import org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder;
-import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapper;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlDataNodeConfigurationSwapper;
import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlDataNodeGlobalRuleConfigurationSwapperEngine;
import org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory;
import org.apache.shardingsphere.metadata.factory.InternalMetaDataFactory;
@@ -376,7 +376,7 @@
@SuppressWarnings("rawtypes")
@SneakyThrows(Exception.class)
private void closeStaleTransactionRule(final RuleConfiguration ruleConfig) {
- for (Entry<RuleConfiguration, YamlDataNodeGlobalRuleConfigurationSwapper> entry : new YamlDataNodeGlobalRuleConfigurationSwapperEngine()
+ for (Entry<RuleConfiguration, YamlDataNodeConfigurationSwapper> entry : new YamlDataNodeGlobalRuleConfigurationSwapperEngine()
.swapToYamlRuleConfigurations(Collections.singleton(ruleConfig)).entrySet()) {
if ("transaction".equalsIgnoreCase(entry.getValue().getRuleTagName())) {
Optional<TransactionRule> transactionRule = metaDataContexts.get().getMetaData().getGlobalRuleMetaData().findSingleRule(TransactionRule.class);