This is an automated email from the ASF dual-hosted git repository. zhangliang 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 385f4783f74 Split GlobalNodePath to GlobalRuleNodePath and GlobalPropsNodePath (#34324) 385f4783f74 is described below commit 385f4783f74f8863e721686356ab4e536736ead7 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Sun Jan 12 19:09:27 2025 +0800 Split GlobalNodePath to GlobalRuleNodePath and GlobalPropsNodePath (#34324) --- .../mode/path/GlobalPropertiesNodePath.java | 86 ++++++++++++++++++++++ ...GlobalNodePath.java => GlobalRuleNodePath.java} | 79 ++++---------------- .../mode/tuple/RepositoryTupleSwapperEngine.java | 4 +- .../mode/path/GlobalPropertiesNodePathTest.java | 52 +++++++++++++ ...dePathTest.java => GlobalRuleNodePathTest.java} | 47 +++--------- .../config/global/GlobalRulePersistService.java | 14 ++-- .../config/global/PropertiesPersistService.java | 14 ++-- .../handler/global/GlobalRuleChangedHandler.java | 6 +- .../handler/global/PropertiesChangedHandler.java | 6 +- 9 files changed, 185 insertions(+), 123 deletions(-) diff --git a/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePath.java b/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePath.java new file mode 100644 index 00000000000..5ca76b82721 --- /dev/null +++ b/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePath.java @@ -0,0 +1,86 @@ +/* + * 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.mode.path; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Global properties node path. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class GlobalPropertiesNodePath { + + private static final String ROOT_NODE = "/props"; + + private static final String VERSIONS_NODE = "versions"; + + private static final String ACTIVE_VERSION_NODE = "active_version"; + + /** + * Get properties path. + * + * @return properties path + */ + public static String getRootPath() { + return ROOT_NODE; + } + + /** + * Get properties version root path. + * + * @return properties version root path + */ + public static String getVersionRootPath() { + return String.join("/", getRootPath(), VERSIONS_NODE); + } + + /** + * Get properties version path. + * + * @param version version + * @return properties version path + */ + public static String getVersionPath(final String version) { + return String.join("/", getVersionRootPath(), version); + } + + /** + * Get properties active version path. + * + * @return properties active version path + */ + public static String getActiveVersionPath() { + return String.join("/", getRootPath(), ACTIVE_VERSION_NODE); + } + + /** + * Is properties active version path. + * + * @param path path + * @return true or false + */ + public static boolean issActiveVersionPath(final String path) { + Pattern pattern = Pattern.compile(getActiveVersionPath() + "$", Pattern.CASE_INSENSITIVE); + Matcher matcher = pattern.matcher(path); + return matcher.find(); + } +} diff --git a/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalNodePath.java b/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalRuleNodePath.java similarity index 56% rename from mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalNodePath.java rename to mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalRuleNodePath.java index c5ecff6e188..13a32d157c5 100644 --- a/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalNodePath.java +++ b/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalRuleNodePath.java @@ -25,14 +25,12 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * Global node path. + * Global props node path. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class GlobalNodePath { +public final class GlobalRuleNodePath { - private static final String RULES_NODE = "/rules"; - - private static final String PROPS_NODE = "/props"; + private static final String ROOT_NODE = "/rules"; private static final String VERSIONS_NODE = "versions"; @@ -47,8 +45,8 @@ public final class GlobalNodePath { * * @return global rule root path */ - public static String getRuleRootPath() { - return RULES_NODE; + public static String getRootPath() { + return ROOT_NODE; } /** @@ -58,16 +56,16 @@ public final class GlobalNodePath { * @return global rule path */ public static String getRulePath(final String ruleTypeName) { - return String.join("/", getRuleRootPath(), ruleTypeName); + return String.join("/", getRootPath(), ruleTypeName); } /** - * Get global rule versions path. + * Get global rule version root path. * * @param ruleTypeName rule type name - * @return global rule versions path + * @return global rule version root path */ - public static String getRuleVersionsPath(final String ruleTypeName) { + public static String getVersionRootPath(final String ruleTypeName) { return String.join("/", getRulePath(ruleTypeName), VERSIONS_NODE); } @@ -78,8 +76,8 @@ public final class GlobalNodePath { * @param version version * @return global rule version path */ - public static String getRuleVersionPath(final String ruleTypeName, final String version) { - return String.join("/", getRuleVersionsPath(ruleTypeName), version); + public static String getVersionPath(final String ruleTypeName, final String version) { + return String.join("/", getVersionRootPath(ruleTypeName), version); } /** @@ -88,47 +86,10 @@ public final class GlobalNodePath { * @param ruleTypeName rule type name * @return global rule active version path */ - public static String getRuleActiveVersionPath(final String ruleTypeName) { + public static String getActiveVersionPath(final String ruleTypeName) { return String.join("/", getRulePath(ruleTypeName), ACTIVE_VERSION_NODE); } - /** - * Get properties path. - * - * @return properties path - */ - public static String getPropsRootPath() { - return PROPS_NODE; - } - - /** - * Get properties versions path. - * - * @return properties versions path - */ - public static String getPropsVersionsPath() { - return String.join("/", getPropsRootPath(), VERSIONS_NODE); - } - - /** - * Get properties version path. - * - * @param version version - * @return properties version path - */ - public static String getPropsVersionPath(final String version) { - return String.join("/", getPropsVersionsPath(), version); - } - - /** - * Get properties active version path. - * - * @return properties active version path - */ - public static String getPropsActiveVersionPath() { - return String.join("/", getPropsRootPath(), ACTIVE_VERSION_NODE); - } - /** * Find rule type name from active version. * @@ -136,7 +97,7 @@ public final class GlobalNodePath { * @return found rule type name */ public static Optional<String> findRuleTypeNameFromActiveVersion(final String path) { - Pattern pattern = Pattern.compile(getRuleActiveVersionPath(IDENTIFIER_PATTERN) + "$", Pattern.CASE_INSENSITIVE); + Pattern pattern = Pattern.compile(getActiveVersionPath(IDENTIFIER_PATTERN) + "$", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(path); return matcher.find() ? Optional.of(matcher.group(1)) : Optional.empty(); } @@ -149,20 +110,8 @@ public final class GlobalNodePath { * @return found version */ public static Optional<String> findVersion(final String ruleTypeName, final String path) { - Pattern pattern = Pattern.compile(getRuleVersionPath(ruleTypeName, VERSION_PATTERN) + "$", Pattern.CASE_INSENSITIVE); + Pattern pattern = Pattern.compile(getVersionPath(ruleTypeName, VERSION_PATTERN) + "$", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(path); return matcher.find() ? Optional.of(matcher.group(1)) : Optional.empty(); } - - /** - * Is props active version path. - * - * @param propsPath props path - * @return true or false - */ - public static boolean isPropsActiveVersionPath(final String propsPath) { - Pattern pattern = Pattern.compile(getPropsActiveVersionPath() + "$", Pattern.CASE_INSENSITIVE); - Matcher matcher = pattern.matcher(propsPath); - return matcher.find(); - } } diff --git a/mode/api/src/main/java/org/apache/shardingsphere/mode/tuple/RepositoryTupleSwapperEngine.java b/mode/api/src/main/java/org/apache/shardingsphere/mode/tuple/RepositoryTupleSwapperEngine.java index 76370ed36e5..a8087d5bebf 100644 --- a/mode/api/src/main/java/org/apache/shardingsphere/mode/tuple/RepositoryTupleSwapperEngine.java +++ b/mode/api/src/main/java/org/apache/shardingsphere/mode/tuple/RepositoryTupleSwapperEngine.java @@ -29,7 +29,7 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlGlobalRuleConfi import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration; import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper; import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapperEngine; -import org.apache.shardingsphere.mode.path.GlobalNodePath; +import org.apache.shardingsphere.mode.path.GlobalRuleNodePath; import org.apache.shardingsphere.mode.path.rule.RuleNodePath; import org.apache.shardingsphere.mode.spi.RuleNodePathProvider; import org.apache.shardingsphere.mode.tuple.annotation.RepositoryTupleEntity; @@ -153,7 +153,7 @@ public final class RepositoryTupleSwapperEngine { final Class<? extends YamlRuleConfiguration> toBeSwappedType, final RepositoryTupleEntity tupleEntity) { if (YamlGlobalRuleConfiguration.class.isAssignableFrom(toBeSwappedType)) { for (RepositoryTuple each : repositoryTuples) { - if (GlobalNodePath.findVersion(tupleEntity.value(), each.getKey()).isPresent()) { + if (GlobalRuleNodePath.findVersion(tupleEntity.value(), each.getKey()).isPresent()) { return Optional.of(YamlEngine.unmarshal(each.getValue(), toBeSwappedType)); } } diff --git a/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePathTest.java b/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePathTest.java new file mode 100644 index 00000000000..8717bd5ed25 --- /dev/null +++ b/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePathTest.java @@ -0,0 +1,52 @@ +/* + * 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.mode.path; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class GlobalPropertiesNodePathTest { + + @Test + void assertGetRootPath() { + assertThat(GlobalPropertiesNodePath.getRootPath(), is("/props")); + } + + @Test + void assertGetVersionRootPath() { + assertThat(GlobalPropertiesNodePath.getVersionRootPath(), is("/props/versions")); + } + + @Test + void assertGetVersionPath() { + assertThat(GlobalPropertiesNodePath.getVersionPath("0"), is("/props/versions/0")); + } + + @Test + void assertGetActiveVersionPath() { + assertThat(GlobalPropertiesNodePath.getActiveVersionPath(), is("/props/active_version")); + } + + @Test + void assertIssActiveVersionPath() { + assertTrue(GlobalPropertiesNodePath.issActiveVersionPath("/props/active_version")); + } +} diff --git a/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalNodePathTest.java b/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalRuleNodePathTest.java similarity index 50% rename from mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalNodePathTest.java rename to mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalRuleNodePathTest.java index 7baba815841..ee31d4f798c 100644 --- a/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalNodePathTest.java +++ b/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalRuleNodePathTest.java @@ -25,62 +25,37 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue; -class GlobalNodePathTest { +class GlobalRuleNodePathTest { @Test - void assertGetRuleRootPath() { - assertThat(GlobalNodePath.getRuleRootPath(), is("/rules")); + void assertGetRootPath() { + assertThat(GlobalRuleNodePath.getRootPath(), is("/rules")); } @Test void assertGetRulePath() { - assertThat(GlobalNodePath.getRulePath("foo_rule"), is("/rules/foo_rule")); + assertThat(GlobalRuleNodePath.getRulePath("foo_rule"), is("/rules/foo_rule")); } @Test - void assertGetRuleVersionsPath() { - assertThat(GlobalNodePath.getRuleVersionsPath("foo_rule"), is("/rules/foo_rule/versions")); + void assertGetVersionRootPath() { + assertThat(GlobalRuleNodePath.getVersionRootPath("foo_rule"), is("/rules/foo_rule/versions")); } @Test - void assertGetRuleVersionPath() { - assertThat(GlobalNodePath.getRuleVersionPath("foo_rule", "0"), is("/rules/foo_rule/versions/0")); + void assertGetVersionPath() { + assertThat(GlobalRuleNodePath.getVersionPath("foo_rule", "0"), is("/rules/foo_rule/versions/0")); } @Test - void assertGetRuleActiveVersionPath() { - assertThat(GlobalNodePath.getRuleActiveVersionPath("foo_rule"), is("/rules/foo_rule/active_version")); - } - - @Test - void assertGetPropsRootPath() { - assertThat(GlobalNodePath.getPropsRootPath(), is("/props")); - } - - @Test - void assertGetPropsVersionsPath() { - assertThat(GlobalNodePath.getPropsVersionsPath(), is("/props/versions")); - } - - @Test - void assertGetPropsVersionPath() { - assertThat(GlobalNodePath.getPropsVersionPath("0"), is("/props/versions/0")); - } - - @Test - void assertGetPropsActiveVersionPath() { - assertThat(GlobalNodePath.getPropsActiveVersionPath(), is("/props/active_version")); + void assertGetActiveVersionPath() { + assertThat(GlobalRuleNodePath.getActiveVersionPath("foo_rule"), is("/rules/foo_rule/active_version")); } @Test void assertFindVersion() { - Optional<String> actual = GlobalNodePath.findVersion("foo_rule", "/rules/foo_rule/versions/0"); + Optional<String> actual = GlobalRuleNodePath.findVersion("foo_rule", "/rules/foo_rule/versions/0"); assertTrue(actual.isPresent()); assertThat(actual.get(), is("0")); } - - @Test - void assertIsPropsActiveVersionPath() { - assertTrue(GlobalNodePath.isPropsActiveVersionPath("/props/active_version")); - } } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/config/global/GlobalRulePersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/config/global/GlobalRulePersistService.java index d32be53a40c..ad371eece79 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/config/global/GlobalRulePersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/config/global/GlobalRulePersistService.java @@ -22,9 +22,9 @@ import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.metadata.version.MetaDataVersion; import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration; import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapperEngine; -import org.apache.shardingsphere.mode.path.GlobalNodePath; import org.apache.shardingsphere.mode.metadata.persist.service.config.RepositoryTuplePersistService; import org.apache.shardingsphere.mode.metadata.persist.service.version.MetaDataVersionPersistService; +import org.apache.shardingsphere.mode.path.GlobalRuleNodePath; import org.apache.shardingsphere.mode.spi.PersistRepository; import org.apache.shardingsphere.mode.tuple.RepositoryTuple; import org.apache.shardingsphere.mode.tuple.RepositoryTupleSwapperEngine; @@ -57,7 +57,7 @@ public final class GlobalRulePersistService { * @return global rule configurations */ public Collection<RuleConfiguration> load() { - return new RepositoryTupleSwapperEngine().swapToRuleConfigurations(repositoryTuplePersistService.load(GlobalNodePath.getRuleRootPath())); + return new RepositoryTupleSwapperEngine().swapToRuleConfigurations(repositoryTuplePersistService.load(GlobalRuleNodePath.getRootPath())); } /** @@ -67,7 +67,7 @@ public final class GlobalRulePersistService { * @return global rule configuration */ public Optional<RuleConfiguration> load(final String ruleTypeName) { - return new RepositoryTupleSwapperEngine().swapToRuleConfiguration(ruleTypeName, repositoryTuplePersistService.load(GlobalNodePath.getRulePath(ruleTypeName))); + return new RepositoryTupleSwapperEngine().swapToRuleConfiguration(ruleTypeName, repositoryTuplePersistService.load(GlobalRuleNodePath.getRulePath(ruleTypeName))); } /** @@ -87,14 +87,14 @@ public final class GlobalRulePersistService { private Collection<MetaDataVersion> persistTuples(final Collection<RepositoryTuple> repositoryTuples) { Collection<MetaDataVersion> result = new LinkedList<>(); for (RepositoryTuple each : repositoryTuples) { - List<String> versions = metaDataVersionPersistService.getVersions(GlobalNodePath.getRuleVersionsPath(each.getKey())); + List<String> versions = metaDataVersionPersistService.getVersions(GlobalRuleNodePath.getVersionRootPath(each.getKey())); String nextActiveVersion = versions.isEmpty() ? MetaDataVersion.DEFAULT_VERSION : String.valueOf(Integer.parseInt(versions.get(0)) + 1); - repository.persist(GlobalNodePath.getRuleVersionPath(each.getKey(), nextActiveVersion), each.getValue()); - String ruleActiveVersionPath = GlobalNodePath.getRuleActiveVersionPath(each.getKey()); + repository.persist(GlobalRuleNodePath.getVersionPath(each.getKey(), nextActiveVersion), each.getValue()); + String ruleActiveVersionPath = GlobalRuleNodePath.getActiveVersionPath(each.getKey()); if (Strings.isNullOrEmpty(repository.query(ruleActiveVersionPath))) { repository.persist(ruleActiveVersionPath, MetaDataVersion.DEFAULT_VERSION); } - result.add(new MetaDataVersion(GlobalNodePath.getRulePath(each.getKey()), repository.query(ruleActiveVersionPath), nextActiveVersion)); + result.add(new MetaDataVersion(GlobalRuleNodePath.getRulePath(each.getKey()), repository.query(ruleActiveVersionPath), nextActiveVersion)); } return result; } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/config/global/PropertiesPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/config/global/PropertiesPersistService.java index 71f8911d51b..7c982dfd363 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/config/global/PropertiesPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/config/global/PropertiesPersistService.java @@ -21,7 +21,7 @@ import com.google.common.base.Strings; import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.infra.metadata.version.MetaDataVersion; import org.apache.shardingsphere.infra.util.yaml.YamlEngine; -import org.apache.shardingsphere.mode.path.GlobalNodePath; +import org.apache.shardingsphere.mode.path.GlobalPropertiesNodePath; import org.apache.shardingsphere.mode.metadata.persist.service.version.MetaDataVersionPersistService; import org.apache.shardingsphere.mode.spi.PersistRepository; @@ -45,7 +45,7 @@ public final class PropertiesPersistService { * @return properties */ public Properties load() { - String yamlContent = repository.query(GlobalNodePath.getPropsVersionPath(getActiveVersion())); + String yamlContent = repository.query(GlobalPropertiesNodePath.getVersionPath(getActiveVersion())); return Strings.isNullOrEmpty(yamlContent) ? new Properties() : YamlEngine.unmarshal(yamlContent, Properties.class); } @@ -55,16 +55,16 @@ public final class PropertiesPersistService { * @param props properties */ public void persist(final Properties props) { - List<String> versions = metaDataVersionPersistService.getVersions(GlobalNodePath.getPropsVersionsPath()); + List<String> versions = metaDataVersionPersistService.getVersions(GlobalPropertiesNodePath.getVersionRootPath()); String nextActiveVersion = versions.isEmpty() ? MetaDataVersion.DEFAULT_VERSION : String.valueOf(Integer.parseInt(versions.get(0)) + 1); - repository.persist(GlobalNodePath.getPropsVersionPath(nextActiveVersion), YamlEngine.marshal(props)); + repository.persist(GlobalPropertiesNodePath.getVersionPath(nextActiveVersion), YamlEngine.marshal(props)); if (Strings.isNullOrEmpty(getActiveVersion())) { - repository.persist(GlobalNodePath.getPropsActiveVersionPath(), MetaDataVersion.DEFAULT_VERSION); + repository.persist(GlobalPropertiesNodePath.getActiveVersionPath(), MetaDataVersion.DEFAULT_VERSION); } - metaDataVersionPersistService.switchActiveVersion(Collections.singleton(new MetaDataVersion(GlobalNodePath.getPropsRootPath(), getActiveVersion(), nextActiveVersion))); + metaDataVersionPersistService.switchActiveVersion(Collections.singleton(new MetaDataVersion(GlobalPropertiesNodePath.getRootPath(), getActiveVersion(), nextActiveVersion))); } private String getActiveVersion() { - return repository.query(GlobalNodePath.getPropsActiveVersionPath()); + return repository.query(GlobalPropertiesNodePath.getActiveVersionPath()); } } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/GlobalRuleChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/GlobalRuleChangedHandler.java index e2139608c6d..1e939d93bde 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/GlobalRuleChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/GlobalRuleChangedHandler.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.mode.event.DataChangedEvent.Type; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.manager.cluster.dispatch.checker.ActiveVersionChecker; import org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.DataChangedEventHandler; -import org.apache.shardingsphere.mode.path.GlobalNodePath; +import org.apache.shardingsphere.mode.path.GlobalRuleNodePath; import java.util.Arrays; import java.util.Collection; @@ -37,7 +37,7 @@ public final class GlobalRuleChangedHandler implements DataChangedEventHandler { @Override public String getSubscribedKey() { - return GlobalNodePath.getRuleRootPath(); + return GlobalRuleNodePath.getRootPath(); } @Override @@ -47,7 +47,7 @@ public final class GlobalRuleChangedHandler implements DataChangedEventHandler { @Override public void handle(final ContextManager contextManager, final DataChangedEvent event) { - Optional<String> ruleTypeName = GlobalNodePath.findRuleTypeNameFromActiveVersion(event.getKey()); + Optional<String> ruleTypeName = GlobalRuleNodePath.findRuleTypeNameFromActiveVersion(event.getKey()); if (!ruleTypeName.isPresent()) { return; } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java index 15c32961b1d..3fa9687a1c7 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.mode.event.DataChangedEvent.Type; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.manager.cluster.dispatch.checker.ActiveVersionChecker; import org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.DataChangedEventHandler; -import org.apache.shardingsphere.mode.path.GlobalNodePath; +import org.apache.shardingsphere.mode.path.GlobalPropertiesNodePath; import java.util.Arrays; import java.util.Collection; @@ -34,7 +34,7 @@ public final class PropertiesChangedHandler implements DataChangedEventHandler { @Override public String getSubscribedKey() { - return GlobalNodePath.getPropsRootPath(); + return GlobalPropertiesNodePath.getRootPath(); } @Override @@ -44,7 +44,7 @@ public final class PropertiesChangedHandler implements DataChangedEventHandler { @Override public void handle(final ContextManager contextManager, final DataChangedEvent event) { - if (!GlobalNodePath.isPropsActiveVersionPath(event.getKey())) { + if (!GlobalPropertiesNodePath.issActiveVersionPath(event.getKey())) { return; } ActiveVersionChecker.checkActiveVersion(contextManager, event);