This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 770a1c68e5b Fix sonar issue and remove
NewDatabaseRuleBasedPersistService (#26413)
770a1c68e5b is described below
commit 770a1c68e5bb47eee1d89dd55345813f12a68071
Author: zhaojinchao <[email protected]>
AuthorDate: Sun Jun 18 17:41:40 2023 +0800
Fix sonar issue and remove NewDatabaseRuleBasedPersistService (#26413)
---
.../NewDatabaseRuleBasedPersistService.java | 43 ----------------------
.../database/NewDatabaseRulePersistService.java | 15 +++-----
2 files changed, 6 insertions(+), 52 deletions(-)
diff --git
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/NewDatabaseRuleBasedPersistService.java
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/NewDatabaseRuleBasedPersistService.java
deleted file mode 100644
index 7e6ffce1e80..00000000000
---
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/NewDatabaseRuleBasedPersistService.java
+++ /dev/null
@@ -1,43 +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.metadata.persist.service.config.database;
-
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-
-import javax.sql.DataSource;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * TODO Rename DatabaseRuleBasedPersistService when metadata structure
adjustment completed. #25485
- * Database rule based persist service.
- *
- * @param <T> type of configuration
- */
-public interface NewDatabaseRuleBasedPersistService<T> extends
DatabaseBasedPersistService<T> {
-
- /**
- * Persist configurations.
- *
- * @param databaseName database name
- * @param dataSources data sources
- * @param rules rules
- * @param configs configurations
- */
- void persist(String databaseName, Map<String, DataSource> dataSources,
Collection<ShardingSphereRule> rules, T configs);
-}
diff --git
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/NewDatabaseRulePersistService.java
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/NewDatabaseRulePersistService.java
index c5a4e391385..6245ed2723c 100644
---
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/NewDatabaseRulePersistService.java
+++
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/database/NewDatabaseRulePersistService.java
@@ -19,7 +19,6 @@ package
org.apache.shardingsphere.metadata.persist.service.config.database;
import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.util.yaml.datanode.YamlDataNode;
import
org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlRuleConfigurationSwapper;
import
org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlRuleConfigurationSwapperEngine;
@@ -27,7 +26,6 @@ import
org.apache.shardingsphere.metadata.persist.node.NewDatabaseMetaDataNode;
import
org.apache.shardingsphere.metadata.persist.service.config.AbstractPersistService;
import org.apache.shardingsphere.mode.spi.PersistRepository;
-import javax.sql.DataSource;
import java.util.Collections;
import java.util.Collection;
import java.util.Map;
@@ -38,7 +36,7 @@ import java.util.List;
* TODO Rename DatabaseRulePersistService when metadata structure adjustment
completed. #25485
* Database rule persist service.
*/
-public final class NewDatabaseRulePersistService extends
AbstractPersistService implements
NewDatabaseRuleBasedPersistService<Collection<RuleConfiguration>> {
+public final class NewDatabaseRulePersistService extends
AbstractPersistService implements
DatabaseBasedPersistService<Collection<RuleConfiguration>> {
private static final String DEFAULT_VERSION = "0";
@@ -49,12 +47,6 @@ public final class NewDatabaseRulePersistService extends
AbstractPersistService
this.repository = repository;
}
- @Override
- public void persist(final String databaseName, final Map<String,
DataSource> dataSources,
- final Collection<ShardingSphereRule> rules, final
Collection<RuleConfiguration> configs) {
- // TODO Load single table refer to #22887
- }
-
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void persist(final String databaseName, final
Collection<RuleConfiguration> configs) {
@@ -106,6 +98,11 @@ public final class NewDatabaseRulePersistService extends
AbstractPersistService
return dataNodes.isEmpty() ? Collections.emptyList() : new
NewYamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(dataNodes);
}
+ /**
+ * Load rule configuration.
+ *
+ * @deprecated Remove this method when metadata structure adjustment
completed. #25485
+ */
@Deprecated
@Override
public Collection<RuleConfiguration> load(final String databaseName, final
String version) {