This is an automated email from the ASF dual-hosted git repository.

wuweijie 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 b1876fc9a29 Refactor GlobalRuleChangedType (#30531)
b1876fc9a29 is described below

commit b1876fc9a29ab4f7fc40063e5484f75585aef48a
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Mar 18 19:15:55 2024 +0800

    Refactor GlobalRuleChangedType (#30531)
---
 .../infra/metadata/ShardingSphereMetaData.java     |  2 +-
 .../infra/rule/scope/GlobalRule.java               |  8 ++++++
 .../infra/rule/scope/GlobalRuleChangedType.java    | 31 ----------------------
 .../infra/metadata/ShardingSphereMetaDataTest.java |  2 +-
 .../sqlfederation/rule/SQLFederationRule.java      |  1 -
 .../transaction/rule/TransactionRule.java          |  1 -
 .../transaction/rule/TransactionRuleTest.java      |  2 +-
 .../context/ResourceMetaDataContextManager.java    |  2 +-
 .../standalone/StandaloneModeContextManager.java   |  2 +-
 9 files changed, 13 insertions(+), 38 deletions(-)

diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
index 36dff4d2206..c8e9ec52c10 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaData.java
@@ -29,7 +29,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import 
org.apache.shardingsphere.infra.rule.attribute.datasource.StaticDataSourceRuleAttribute;
 import org.apache.shardingsphere.infra.rule.scope.GlobalRule;
-import org.apache.shardingsphere.infra.rule.scope.GlobalRuleChangedType;
+import 
org.apache.shardingsphere.infra.rule.scope.GlobalRule.GlobalRuleChangedType;
 
 import java.util.Collections;
 import java.util.HashMap;
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/scope/GlobalRule.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/scope/GlobalRule.java
index d490f568480..9dcef66b737 100644
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/scope/GlobalRule.java
+++ 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/scope/GlobalRule.java
@@ -35,4 +35,12 @@ public interface GlobalRule extends ShardingSphereRule {
      */
     default void refresh(final Map<String, ShardingSphereDatabase> databases, 
GlobalRuleChangedType changedType) {
     }
+    
+    /**
+     * Global rule changed type enum.
+     */
+    enum GlobalRuleChangedType {
+        
+        DATABASE_CHANGED, SCHEMA_CHANGED
+    }
 }
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/scope/GlobalRuleChangedType.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/scope/GlobalRuleChangedType.java
deleted file mode 100644
index 7e71f1472d6..00000000000
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/scope/GlobalRuleChangedType.java
+++ /dev/null
@@ -1,31 +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.rule.scope;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Global rule changed type enum.
- */
-@RequiredArgsConstructor
-@Getter
-public enum GlobalRuleChangedType {
-    
-    DATABASE_CHANGED, SCHEMA_CHANGED
-}
diff --git 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java
 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java
index 232dadf005b..04add774472 100644
--- 
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java
+++ 
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/ShardingSphereMetaDataTest.java
@@ -28,7 +28,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.attribute.RuleAttributes;
 import org.apache.shardingsphere.infra.rule.scope.GlobalRule;
-import org.apache.shardingsphere.infra.rule.scope.GlobalRuleChangedType;
+import 
org.apache.shardingsphere.infra.rule.scope.GlobalRule.GlobalRuleChangedType;
 import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource;
 import org.apache.shardingsphere.test.mock.AutoMockExtension;
 import org.apache.shardingsphere.test.mock.StaticMockSettings;
diff --git 
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/rule/SQLFederationRule.java
 
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/rule/SQLFederationRule.java
index 9c53a2de294..5a88053057d 100644
--- 
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/rule/SQLFederationRule.java
+++ 
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/rule/SQLFederationRule.java
@@ -21,7 +21,6 @@ import lombok.Getter;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.rule.attribute.RuleAttributes;
 import org.apache.shardingsphere.infra.rule.scope.GlobalRule;
-import org.apache.shardingsphere.infra.rule.scope.GlobalRuleChangedType;
 import 
org.apache.shardingsphere.sqlfederation.api.config.SQLFederationRuleConfiguration;
 import 
org.apache.shardingsphere.sqlfederation.optimizer.context.OptimizerContext;
 import 
org.apache.shardingsphere.sqlfederation.optimizer.context.OptimizerContextFactory;
diff --git 
a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
 
b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
index ae637971fe3..ef479b77bb2 100644
--- 
a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
+++ 
b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
@@ -23,7 +23,6 @@ import 
org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.rule.attribute.RuleAttributes;
 import org.apache.shardingsphere.infra.rule.scope.GlobalRule;
-import org.apache.shardingsphere.infra.rule.scope.GlobalRuleChangedType;
 import 
org.apache.shardingsphere.transaction.ShardingSphereTransactionManagerEngine;
 import org.apache.shardingsphere.transaction.api.TransactionType;
 import 
org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
diff --git 
a/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/TransactionRuleTest.java
 
b/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/TransactionRuleTest.java
index c35783c4bf0..a606ef9cbd3 100644
--- 
a/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/TransactionRuleTest.java
+++ 
b/kernel/transaction/core/src/test/java/org/apache/shardingsphere/transaction/rule/TransactionRuleTest.java
@@ -22,7 +22,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode;
 import 
org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit;
-import org.apache.shardingsphere.infra.rule.scope.GlobalRuleChangedType;
+import 
org.apache.shardingsphere.infra.rule.scope.GlobalRule.GlobalRuleChangedType;
 import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource;
 import org.apache.shardingsphere.transaction.api.TransactionType;
 import 
org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
diff --git 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ResourceMetaDataContextManager.java
 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ResourceMetaDataContextManager.java
index e176a027a71..d4ca38f4f47 100644
--- 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ResourceMetaDataContextManager.java
+++ 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ResourceMetaDataContextManager.java
@@ -29,7 +29,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereView;
 import 
org.apache.shardingsphere.infra.rule.attribute.datanode.MutableDataNodeRuleAttribute;
 import org.apache.shardingsphere.infra.rule.scope.GlobalRule;
-import org.apache.shardingsphere.infra.rule.scope.GlobalRuleChangedType;
+import 
org.apache.shardingsphere.infra.rule.scope.GlobalRule.GlobalRuleChangedType;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 
 import java.util.Collections;
diff --git 
a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneModeContextManager.java
 
b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneModeContextManager.java
index 6ae3895e59f..0ea6ebda8f6 100644
--- 
a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneModeContextManager.java
+++ 
b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneModeContextManager.java
@@ -32,7 +32,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.schema.pojo.AlterSchema
 import org.apache.shardingsphere.infra.metadata.version.MetaDataVersion;
 import 
org.apache.shardingsphere.infra.rule.attribute.datanode.MutableDataNodeRuleAttribute;
 import org.apache.shardingsphere.infra.rule.scope.GlobalRule;
-import org.apache.shardingsphere.infra.rule.scope.GlobalRuleChangedType;
+import 
org.apache.shardingsphere.infra.rule.scope.GlobalRule.GlobalRuleChangedType;
 import 
org.apache.shardingsphere.infra.spi.type.ordered.cache.OrderedServicesCache;
 import 
org.apache.shardingsphere.metadata.persist.service.config.global.GlobalPersistService;
 import 
org.apache.shardingsphere.metadata.persist.service.database.DatabaseMetaDataBasedPersistService;

Reply via email to