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 2cf3b47faa1 Add NodePathParser (#34748)
2cf3b47faa1 is described below

commit 2cf3b47faa1cdc704f06760b923b79196b2629d6
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Feb 22 15:34:48 2025 +0800

    Add NodePathParser (#34748)
    
    * Add NodePathParser
    
    * Add NodePathParser
    
    * Add NodePathParser
    
    * Add NodePathParser
    
    * Add NodePathParser
    
    * Add NodePathParser
    
    * Add NodePathParser
---
 .../mode/node/path/NodePathParser.java             | 76 ++++++++++++++++++++++
 .../node/path/metadata/DatabaseNodePathParser.java | 49 --------------
 .../database/SchemaMetaDataNodePathParser.java     | 49 --------------
 .../database/TableMetaDataNodePathParser.java      | 71 --------------------
 .../database/ViewMetaDataNodePathParser.java       | 71 --------------------
 .../path/metadata/DatabaseNodePathParserTest.java  | 41 ------------
 .../database/SchemaMetaDataNodePathParserTest.java | 56 ----------------
 .../database/TableMetaDataNodePathParserTest.java  | 47 -------------
 .../database/TableMetadataNodePathTest.java        | 29 +++++++++
 .../database/ViewMetaDataNodePathParserTest.java   | 47 -------------
 .../database/ViewMetadataNodePathTest.java         | 20 ++++++
 .../database/metadata/MetaDataChangedHandler.java  | 29 +++++----
 .../metadata/type/TableChangedHandler.java         | 11 ++--
 .../database/metadata/type/ViewChangedHandler.java | 12 ++--
 .../type/DatabaseMetaDataChangedListener.java      |  6 +-
 15 files changed, 162 insertions(+), 452 deletions(-)

diff --git 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/NodePathParser.java
 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/NodePathParser.java
new file mode 100644
index 00000000000..afe1b522af5
--- /dev/null
+++ 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/NodePathParser.java
@@ -0,0 +1,76 @@
+/*
+ * 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.node.path;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser;
+
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Node path parser.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class NodePathParser {
+    
+    /**
+     * Find node segment.
+     *
+     * @param path to be searched path
+     * @param nodePathCriteria node path criteria
+     * @param trimEmptyNode null variable should trim parent node if true
+     * @param containsChildPath whether contains child path
+     * @param searchSegmentIndex search segment index, start from 1
+     * @return found node segment
+     */
+    public static Optional<String> find(final String path, final NodePath 
nodePathCriteria, final boolean trimEmptyNode, final boolean containsChildPath, 
final int searchSegmentIndex) {
+        Matcher matcher = createPattern(nodePathCriteria, trimEmptyNode, 
containsChildPath).matcher(path);
+        return matcher.find() ? Optional.of(matcher.group(searchSegmentIndex)) 
: Optional.empty();
+    }
+    
+    /**
+     * Whether to matched path.
+     *
+     * @param path to be searched path
+     * @param nodePathCriteria node path criteria
+     * @param trimEmptyNode null variable should trim parent node if true
+     * @param containsChildPath whether contains child path
+     * @return is matched path or not
+     */
+    public static boolean isMatchedPath(final String path, final NodePath 
nodePathCriteria, final boolean trimEmptyNode, final boolean containsChildPath) 
{
+        return createPattern(nodePathCriteria, trimEmptyNode, 
containsChildPath).matcher(path).find();
+    }
+    
+    private static Pattern createPattern(final NodePath nodePathCriteria, 
final boolean trimEmptyNode, final boolean containsChildPath) {
+        String endPattern = containsChildPath ? "?" : "$";
+        return Pattern.compile(NodePathGenerator.toPath(nodePathCriteria, 
trimEmptyNode) + endPattern, Pattern.CASE_INSENSITIVE);
+    }
+    
+    /**
+     * Get version node path parser.
+     *
+     * @param nodePathCriteria node path criteria
+     * @return version node path parser
+     */
+    public static VersionNodePathParser getVersion(final NodePath 
nodePathCriteria) {
+        return new 
VersionNodePathParser(NodePathGenerator.toPath(nodePathCriteria, false));
+    }
+}
diff --git 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseNodePathParser.java
 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseNodePathParser.java
deleted file mode 100644
index 58e8477721c..00000000000
--- 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseNodePathParser.java
+++ /dev/null
@@ -1,49 +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.mode.node.path.metadata;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
-import org.apache.shardingsphere.mode.node.path.NodePathPattern;
-import 
org.apache.shardingsphere.mode.node.path.metadata.database.TableMetadataNodePath;
-
-import java.util.Optional;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Database node path parser.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class DatabaseNodePathParser {
-    
-    private static final Pattern DATABASE_PATTERN = Pattern.compile(
-            NodePathGenerator.toPath(new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, null, null), true) + "?", 
Pattern.CASE_INSENSITIVE);
-    
-    /**
-     * Find database name.
-     *
-     * @param path path
-     * @return found database name
-     */
-    public static Optional<String> findDatabaseName(final String path) {
-        Matcher matcher = DATABASE_PATTERN.matcher(path);
-        return matcher.find() ? Optional.of(matcher.group(1)) : 
Optional.empty();
-    }
-}
diff --git 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/SchemaMetaDataNodePathParser.java
 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/SchemaMetaDataNodePathParser.java
deleted file mode 100644
index 77dcaaf721a..00000000000
--- 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/SchemaMetaDataNodePathParser.java
+++ /dev/null
@@ -1,49 +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.mode.node.path.metadata.database;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
-import org.apache.shardingsphere.mode.node.path.NodePathPattern;
-
-import java.util.Optional;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Schema meta data node path parser.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class SchemaMetaDataNodePathParser {
-    
-    /**
-     * Find schema name.
-     *
-     * @param path path
-     * @param containsChildPath whether contains child path
-     * @return found schema name
-     */
-    public static Optional<String> findSchemaName(final String path, final 
boolean containsChildPath) {
-        String endPattern = containsChildPath ? "?" : "$";
-        Pattern pattern = Pattern.compile(
-                NodePathGenerator.toPath(new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
null), true) + endPattern, Pattern.CASE_INSENSITIVE);
-        Matcher matcher = pattern.matcher(path);
-        return matcher.find() ? Optional.of(matcher.group(2)) : 
Optional.empty();
-    }
-}
diff --git 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetaDataNodePathParser.java
 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetaDataNodePathParser.java
deleted file mode 100644
index d25090ff72d..00000000000
--- 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetaDataNodePathParser.java
+++ /dev/null
@@ -1,71 +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.mode.node.path.metadata.database;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
-import org.apache.shardingsphere.mode.node.path.NodePathPattern;
-import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser;
-
-import java.util.Optional;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Table meta data node path parser.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class TableMetaDataNodePathParser {
-    
-    private static final Pattern PATTERN = 
Pattern.compile(NodePathGenerator.toPath(
-            new TableMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER), false) + "$", 
Pattern.CASE_INSENSITIVE);
-    
-    private static final VersionNodePathParser VERSION_PARSER = new 
VersionNodePathParser(
-            NodePathGenerator.toPath(new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false));
-    
-    /**
-     * Find table name.
-     *
-     * @param path path
-     * @return found table name
-     */
-    public static Optional<String> findTableName(final String path) {
-        Matcher matcher = PATTERN.matcher(path);
-        return matcher.find() ? Optional.of(matcher.group(3)) : 
Optional.empty();
-    }
-    
-    /**
-     * Is table path.
-     *
-     * @param path path
-     * @return is table path or not
-     */
-    public static boolean isTablePath(final String path) {
-        return findTableName(path).isPresent();
-    }
-    
-    /**
-     * Get table version pattern node path parser.
-     *
-     * @return table version node path parser
-     */
-    public static VersionNodePathParser getVersion() {
-        return VERSION_PARSER;
-    }
-}
diff --git 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetaDataNodePathParser.java
 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetaDataNodePathParser.java
deleted file mode 100644
index 8c46468ecd2..00000000000
--- 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetaDataNodePathParser.java
+++ /dev/null
@@ -1,71 +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.mode.node.path.metadata.database;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
-import org.apache.shardingsphere.mode.node.path.NodePathPattern;
-import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser;
-
-import java.util.Optional;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * View meta data path parser.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ViewMetaDataNodePathParser {
-    
-    private static final Pattern PATTERN = Pattern.compile(
-            NodePathGenerator.toPath(new 
ViewMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false) + "$", Pattern.CASE_INSENSITIVE);
-    
-    private static final VersionNodePathParser VERSION_PARSER = new 
VersionNodePathParser(
-            NodePathGenerator.toPath(new 
ViewMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false));
-    
-    /**
-     * Get view name.
-     *
-     * @param path path
-     * @return view name
-     */
-    public static Optional<String> findViewName(final String path) {
-        Matcher matcher = PATTERN.matcher(path);
-        return matcher.find() ? Optional.of(matcher.group(3)) : 
Optional.empty();
-    }
-    
-    /**
-     * Is view path.
-     *
-     * @param path path
-     * @return is view path or not
-     */
-    public static boolean isViewPath(final String path) {
-        return findViewName(path).isPresent();
-    }
-    
-    /**
-     * Get view version pattern node path parser.
-     *
-     * @return view version node path parser
-     */
-    public static VersionNodePathParser getVersion() {
-        return VERSION_PARSER;
-    }
-}
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseNodePathParserTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseNodePathParserTest.java
deleted file mode 100644
index 64ed7184db7..00000000000
--- 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/DatabaseNodePathParserTest.java
+++ /dev/null
@@ -1,41 +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.mode.node.path.metadata;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-
-class DatabaseNodePathParserTest {
-    
-    @Test
-    void assertFindDatabaseName() {
-        Optional<String> actual = 
DatabaseNodePathParser.findDatabaseName("/metadata/foo_db/schemas/foo_schema");
-        assertThat(actual, is(Optional.of("foo_db")));
-    }
-    
-    @Test
-    void assertNotFindDatabaseName() {
-        Optional<String> actual = 
DatabaseNodePathParser.findDatabaseName("/xxx/foo_db/schemas/foo_schema");
-        assertFalse(actual.isPresent());
-    }
-}
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/SchemaMetaDataNodePathParserTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/SchemaMetaDataNodePathParserTest.java
deleted file mode 100644
index d776e1653cf..00000000000
--- 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/SchemaMetaDataNodePathParserTest.java
+++ /dev/null
@@ -1,56 +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.mode.node.path.metadata.database;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class SchemaMetaDataNodePathParserTest {
-    
-    @Test
-    void assertFindSchemaNameWithNotContainsChildPath() {
-        Optional<String> actual = 
SchemaMetaDataNodePathParser.findSchemaName("/metadata/foo_db/schemas/foo_schema",
 false);
-        assertTrue(actual.isPresent());
-        assertThat(actual.get(), is("foo_schema"));
-    }
-    
-    @Test
-    void assertNotFindSchemaNameWithNotContainsChildPath() {
-        Optional<String> actual = 
SchemaMetaDataNodePathParser.findSchemaName("/metadata/foo_db/schemas/foo_schema/tables",
 false);
-        assertFalse(actual.isPresent());
-    }
-    
-    @Test
-    void assertFindSchemaNameWithContainsChildPath() {
-        Optional<String> actual = 
SchemaMetaDataNodePathParser.findSchemaName("/metadata/foo_db/schemas/foo_schema/tables",
 true);
-        assertTrue(actual.isPresent());
-        assertThat(actual.get(), is("foo_schema"));
-    }
-    
-    @Test
-    void assertNotFindSchemaNameWithContainsChildPath() {
-        Optional<String> actual = 
SchemaMetaDataNodePathParser.findSchemaName("/xxx/foo_db/schemas/foo_schema/tables",
 true);
-        assertFalse(actual.isPresent());
-    }
-}
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetaDataNodePathParserTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetaDataNodePathParserTest.java
deleted file mode 100644
index 9883ea3e554..00000000000
--- 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetaDataNodePathParserTest.java
+++ /dev/null
@@ -1,47 +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.mode.node.path.metadata.database;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class TableMetaDataNodePathParserTest {
-    
-    @Test
-    void assertFindTableName() {
-        Optional<String> actual = 
TableMetaDataNodePathParser.findTableName("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl");
-        assertTrue(actual.isPresent());
-        assertThat(actual.get(), is("foo_tbl"));
-    }
-    
-    @Test
-    void assertFindTableNameIfNotFound() {
-        
assertFalse(TableMetaDataNodePathParser.findTableName("/xxx/foo_db/schemas/foo_schema/tables/foo_tbl").isPresent());
-    }
-    
-    @Test
-    void assertIsTablePath() {
-        
assertTrue(TableMetaDataNodePathParser.isTablePath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl"));
-    }
-}
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetadataNodePathTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetadataNodePathTest.java
index 63c71605b33..be8c8094138 100644
--- 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetadataNodePathTest.java
+++ 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/TableMetadataNodePathTest.java
@@ -18,11 +18,17 @@
 package org.apache.shardingsphere.mode.node.path.metadata.database;
 
 import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
+import org.apache.shardingsphere.mode.node.path.NodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathPattern;
 import org.apache.shardingsphere.mode.node.path.version.VersionNodePath;
 import org.junit.jupiter.api.Test;
 
+import java.util.Optional;
+
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class TableMetadataNodePathTest {
     
@@ -41,4 +47,27 @@ class TableMetadataNodePathTest {
         assertThat(versionNodePath.getVersionsPath(), 
is("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/versions"));
         assertThat(versionNodePath.getVersionPath(0), 
is("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/versions/0"));
     }
+    
+    @Test
+    void assertFind() {
+        assertThat(NodePathParser.find("/metadata/foo_db/schemas/foo_schema", 
new TableMetadataNodePath(NodePathPattern.IDENTIFIER, null, null), true, true, 
1), is(Optional.of("foo_db")));
+        assertFalse(NodePathParser.find("/xxx/foo_db/schemas/foo_schema", new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, null, null), true, true, 
1).isPresent());
+        assertThat(NodePathParser.find("/metadata/foo_db/schemas/foo_schema", 
new TableMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, null), true, false, 2),
+                is(Optional.of("foo_schema")));
+        assertFalse(
+                
NodePathParser.find("/metadata/foo_db/schemas/foo_schema/tables", new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
null), true, false, 2).isPresent());
+        
assertThat(NodePathParser.find("/metadata/foo_db/schemas/foo_schema/tables", 
new TableMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, null), true, true, 2),
+                is(Optional.of("foo_schema")));
+        
assertFalse(NodePathParser.find("/xxx/foo_db/schemas/foo_schema/tables", new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
null), true, true, 2).isPresent());
+        
assertThat(NodePathParser.find("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl",
+                new TableMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER), false, false, 3), 
is(Optional.of("foo_tbl")));
+        
assertFalse(NodePathParser.find("/xxx/foo_db/schemas/foo_schema/tables/foo_tbl",
+                new TableMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER), false, false, 
3).isPresent());
+    }
+    
+    @Test
+    void assertIsTablePath() {
+        
assertTrue(NodePathParser.isMatchedPath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl",
+                new TableMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER), false, false));
+    }
 }
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetaDataNodePathParserTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetaDataNodePathParserTest.java
deleted file mode 100644
index c5c67869210..00000000000
--- 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetaDataNodePathParserTest.java
+++ /dev/null
@@ -1,47 +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.mode.node.path.metadata.database;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-class ViewMetaDataNodePathParserTest {
-    
-    @Test
-    void assertFindViewName() {
-        Optional<String> actual = 
ViewMetaDataNodePathParser.findViewName("/metadata/foo_db/schemas/foo_schema/views/foo_view");
-        assertTrue(actual.isPresent());
-        assertThat(actual.get(), is("foo_view"));
-    }
-    
-    @Test
-    void assertFindViewNameIfNotFound() {
-        
assertFalse(ViewMetaDataNodePathParser.findViewName("/xxx/foo_db/schemas/foo_schema/views/foo_view").isPresent());
-    }
-    
-    @Test
-    void assertIsViewPath() {
-        
assertTrue(ViewMetaDataNodePathParser.isViewPath("/metadata/foo_db/schemas/foo_schema/views/foo_view"));
-    }
-}
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetadataNodePathTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetadataNodePathTest.java
index 475aecaaaee..fd358c39445 100644
--- 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetadataNodePathTest.java
+++ 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/metadata/database/ViewMetadataNodePathTest.java
@@ -18,11 +18,17 @@
 package org.apache.shardingsphere.mode.node.path.metadata.database;
 
 import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
+import org.apache.shardingsphere.mode.node.path.NodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathPattern;
 import org.apache.shardingsphere.mode.node.path.version.VersionNodePath;
 import org.junit.jupiter.api.Test;
 
+import java.util.Optional;
+
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class ViewMetadataNodePathTest {
     
@@ -41,4 +47,18 @@ class ViewMetadataNodePathTest {
         assertThat(versionNodePath.getVersionsPath(), 
is("/metadata/foo_db/schemas/foo_schema/views/foo_view/versions"));
         assertThat(versionNodePath.getVersionPath(0), 
is("/metadata/foo_db/schemas/foo_schema/views/foo_view/versions/0"));
     }
+    
+    @Test
+    void assertFind() {
+        
assertThat(NodePathParser.find("/metadata/foo_db/schemas/foo_schema/views/foo_view",
+                new ViewMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER), false, true, 3), 
is(Optional.of("foo_view")));
+        
assertFalse(NodePathParser.find("/xxx/foo_db/schemas/foo_schema/views/foo_view",
+                new ViewMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER), false, true, 
3).isPresent());
+    }
+    
+    @Test
+    void assertIsMatchedPath() {
+        
assertTrue(NodePathParser.isMatchedPath("/metadata/foo_db/schemas/foo_schema/views/foo_view",
+                new ViewMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER), false, true));
+    }
 }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/MetaDataChangedHandler.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/MetaDataChangedHandler.java
index e16b7b13446..0ffa37ab0fb 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/MetaDataChangedHandler.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/MetaDataChangedHandler.java
@@ -25,9 +25,10 @@ import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.database.
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.database.metadata.type.StorageUnitChangedHandler;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.database.metadata.type.TableChangedHandler;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.database.metadata.type.ViewChangedHandler;
-import 
org.apache.shardingsphere.mode.node.path.metadata.database.SchemaMetaDataNodePathParser;
-import 
org.apache.shardingsphere.mode.node.path.metadata.database.TableMetaDataNodePathParser;
-import 
org.apache.shardingsphere.mode.node.path.metadata.database.ViewMetaDataNodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathPattern;
+import 
org.apache.shardingsphere.mode.node.path.metadata.database.TableMetadataNodePath;
+import 
org.apache.shardingsphere.mode.node.path.metadata.database.ViewMetadataNodePath;
 import 
org.apache.shardingsphere.mode.node.path.metadata.storage.DataSourceNodePathParser;
 import 
org.apache.shardingsphere.mode.node.path.metadata.storage.StorageNodeNodePathParser;
 import 
org.apache.shardingsphere.mode.node.path.metadata.storage.StorageUnitNodePathParser;
@@ -66,12 +67,12 @@ public final class MetaDataChangedHandler {
      */
     public boolean handle(final String databaseName, final DataChangedEvent 
event) {
         String eventKey = event.getKey();
-        Optional<String> schemaName = 
SchemaMetaDataNodePathParser.findSchemaName(eventKey, false);
+        Optional<String> schemaName = NodePathParser.find(eventKey, new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
null), true, false, 2);
         if (schemaName.isPresent()) {
             handleSchemaChanged(databaseName, schemaName.get(), event);
             return true;
         }
-        schemaName = SchemaMetaDataNodePathParser.findSchemaName(eventKey, 
true);
+        schemaName = NodePathParser.find(eventKey, new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
null), true, true, 2);
         if (schemaName.isPresent() && isTableMetaDataChanged(eventKey)) {
             handleTableChanged(databaseName, schemaName.get(), event);
             return true;
@@ -96,25 +97,31 @@ public final class MetaDataChangedHandler {
     }
     
     private boolean isTableMetaDataChanged(final String key) {
-        return TableMetaDataNodePathParser.isTablePath(key) || 
TableMetaDataNodePathParser.getVersion().isActiveVersionPath(key);
+        return NodePathParser.isMatchedPath(key, new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false, false)
+                || NodePathParser.getVersion(new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER)).isActiveVersionPath(key);
     }
     
     private void handleTableChanged(final String databaseName, final String 
schemaName, final DataChangedEvent event) {
-        if ((Type.ADDED == event.getType() || Type.UPDATED == event.getType()) 
&& 
TableMetaDataNodePathParser.getVersion().isActiveVersionPath(event.getKey())) {
+        if ((Type.ADDED == event.getType() || Type.UPDATED == event.getType())
+                && NodePathParser.getVersion(new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER)).isActiveVersionPath(event.getKey())) {
             tableChangedHandler.handleCreatedOrAltered(databaseName, 
schemaName, event);
-        } else if (Type.DELETED == event.getType() && 
TableMetaDataNodePathParser.isTablePath(event.getKey())) {
+        } else if (Type.DELETED == event.getType()
+                && NodePathParser.isMatchedPath(event.getKey(), new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false, false)) {
             tableChangedHandler.handleDropped(databaseName, schemaName, event);
         }
     }
     
     private boolean isViewMetaDataChanged(final String key) {
-        return 
ViewMetaDataNodePathParser.getVersion().isActiveVersionPath(key) || 
ViewMetaDataNodePathParser.isViewPath(key);
+        return NodePathParser.getVersion(new 
ViewMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER)).isActiveVersionPath(key)
+                || NodePathParser.isMatchedPath(key, new 
ViewMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false, true);
     }
     
     private void handleViewChanged(final String databaseName, final String 
schemaName, final DataChangedEvent event) {
-        if ((Type.ADDED == event.getType() || Type.UPDATED == event.getType()) 
&& ViewMetaDataNodePathParser.getVersion().isActiveVersionPath(event.getKey())) 
{
+        if ((Type.ADDED == event.getType() || Type.UPDATED == event.getType())
+                && NodePathParser.getVersion(new 
ViewMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER)).isActiveVersionPath(event.getKey())) {
             viewChangedHandler.handleCreatedOrAltered(databaseName, 
schemaName, event);
-        } else if (Type.DELETED == event.getType() && 
ViewMetaDataNodePathParser.isViewPath(event.getKey())) {
+        } else if (Type.DELETED == event.getType()
+                && NodePathParser.isMatchedPath(event.getKey(), new 
ViewMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false, true)) {
             viewChangedHandler.handleDropped(databaseName, schemaName, event);
         }
     }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/type/TableChangedHandler.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/type/TableChangedHandler.java
index 3b309b2f745..32e004af733 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/type/TableChangedHandler.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/type/TableChangedHandler.java
@@ -22,7 +22,9 @@ import org.apache.shardingsphere.mode.event.DataChangedEvent;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.checker.ActiveVersionChecker;
 import 
org.apache.shardingsphere.mode.metadata.refresher.statistics.StatisticsRefreshEngine;
-import 
org.apache.shardingsphere.mode.node.path.metadata.database.TableMetaDataNodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathPattern;
+import 
org.apache.shardingsphere.mode.node.path.metadata.database.TableMetadataNodePath;
 
 /**
  * Table changed handler.
@@ -46,8 +48,8 @@ public final class TableChangedHandler {
      * @param event data changed event
      */
     public void handleCreatedOrAltered(final String databaseName, final String 
schemaName, final DataChangedEvent event) {
-        String tableName = 
TableMetaDataNodePathParser.getVersion().findIdentifierByActiveVersionPath(event.getKey(),
 3)
-                .orElseThrow(() -> new IllegalStateException("Table name not 
found."));
+        String tableName = NodePathParser.getVersion(new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER))
+                .findIdentifierByActiveVersionPath(event.getKey(), 
3).orElseThrow(() -> new IllegalStateException("Table name not found."));
         ActiveVersionChecker.checkActiveVersion(contextManager, event);
         ShardingSphereTable table = 
contextManager.getPersistServiceFacade().getMetaDataPersistFacade().getDatabaseMetaDataFacade().getTable().load(databaseName,
 schemaName, tableName);
         
contextManager.getMetaDataContextManager().getDatabaseMetaDataManager().alterTable(databaseName,
 schemaName, table);
@@ -62,7 +64,8 @@ public final class TableChangedHandler {
      * @param event data changed event
      */
     public void handleDropped(final String databaseName, final String 
schemaName, final DataChangedEvent event) {
-        String tableName = 
TableMetaDataNodePathParser.findTableName(event.getKey()).orElseThrow(() -> new 
IllegalStateException("Table name not found."));
+        String tableName = NodePathParser.find(event.getKey(), new 
TableMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false, false, 3)
+                .orElseThrow(() -> new IllegalStateException("Table name not 
found."));
         
contextManager.getMetaDataContextManager().getDatabaseMetaDataManager().dropTable(databaseName,
 schemaName, tableName);
         statisticsRefreshEngine.asyncRefresh();
     }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/type/ViewChangedHandler.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/type/ViewChangedHandler.java
index 63861195225..65d07321fca 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/type/ViewChangedHandler.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/type/ViewChangedHandler.java
@@ -22,7 +22,9 @@ import org.apache.shardingsphere.mode.event.DataChangedEvent;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.checker.ActiveVersionChecker;
 import 
org.apache.shardingsphere.mode.metadata.refresher.statistics.StatisticsRefreshEngine;
-import 
org.apache.shardingsphere.mode.node.path.metadata.database.ViewMetaDataNodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathPattern;
+import 
org.apache.shardingsphere.mode.node.path.metadata.database.ViewMetadataNodePath;
 
 /**
  * View changed handler.
@@ -46,8 +48,9 @@ public final class ViewChangedHandler {
      * @param event data changed event
      */
     public void handleCreatedOrAltered(final String databaseName, final String 
schemaName, final DataChangedEvent event) {
-        String viewName =
-                
ViewMetaDataNodePathParser.getVersion().findIdentifierByActiveVersionPath(event.getKey(),
 3).orElseThrow(() -> new IllegalStateException("View name not found."));
+        String viewName = NodePathParser.getVersion(
+                new ViewMetadataNodePath(NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER)).findIdentifierByActiveVersionPath(event.getKey(), 
3)
+                .orElseThrow(() -> new IllegalStateException("View name not 
found."));
         ActiveVersionChecker.checkActiveVersion(contextManager, event);
         ShardingSphereView view = 
contextManager.getPersistServiceFacade().getMetaDataPersistFacade().getDatabaseMetaDataFacade().getView().load(databaseName,
 schemaName, viewName);
         
contextManager.getMetaDataContextManager().getDatabaseMetaDataManager().alterView(databaseName,
 schemaName, view);
@@ -62,7 +65,8 @@ public final class ViewChangedHandler {
      * @param event data changed event
      */
     public void handleDropped(final String databaseName, final String 
schemaName, final DataChangedEvent event) {
-        String viewName = 
ViewMetaDataNodePathParser.findViewName(event.getKey()).orElseThrow(() -> new 
IllegalStateException("View name not found."));
+        String viewName = NodePathParser.find(event.getKey(), new 
ViewMetadataNodePath(NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER, 
NodePathPattern.IDENTIFIER), false, true, 3)
+                .orElseThrow(() -> new IllegalStateException("View name not 
found."));
         
contextManager.getMetaDataContextManager().getDatabaseMetaDataManager().dropView(databaseName,
 schemaName, viewName);
         statisticsRefreshEngine.asyncRefresh();
     }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/listener/type/DatabaseMetaDataChangedListener.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/listener/type/DatabaseMetaDataChangedListener.java
index 0dd037cf2b2..13087eb691b 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/listener/type/DatabaseMetaDataChangedListener.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/listener/type/DatabaseMetaDataChangedListener.java
@@ -24,7 +24,9 @@ import org.apache.shardingsphere.mode.event.DataChangedEvent;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.database.metadata.MetaDataChangedHandler;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.database.rule.RuleConfigurationChangedHandler;
-import 
org.apache.shardingsphere.mode.node.path.metadata.DatabaseNodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathParser;
+import org.apache.shardingsphere.mode.node.path.NodePathPattern;
+import 
org.apache.shardingsphere.mode.node.path.metadata.database.TableMetadataNodePath;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;
 
 import java.sql.SQLException;
@@ -40,7 +42,7 @@ public final class DatabaseMetaDataChangedListener implements 
DataChangedEventLi
     
     @Override
     public void onChange(final DataChangedEvent event) {
-        Optional<String> databaseName = 
DatabaseNodePathParser.findDatabaseName(event.getKey());
+        Optional<String> databaseName = NodePathParser.find(event.getKey(), 
new TableMetadataNodePath(NodePathPattern.IDENTIFIER, null, null), true, true, 
1);
         if (!databaseName.isPresent()) {
             return;
         }


Reply via email to