diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/_index.cn.md index 71d8a5cc5718c..3f3b58f7a9a6f 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/_index.cn.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/_index.cn.md @@ -21,7 +21,6 @@ ShardingSphere-JDBC 提供了 JDBC 驱动,可以仅通过配置变更即可使 - 配置文件加载规则: - `absolutepath:` 前缀表示从绝对路径中加载配置文件 - `classpath:` 前缀表示从类路径中加载配置文件 - - `apollo:` 前缀表示从 apollo 中加载配置文件 ## 操作步骤 @@ -35,16 +34,6 @@ ShardingSphere-JDBC 提供了 JDBC 驱动,可以仅通过配置变更即可使 ``` -如果使用 apollo 配置方式,还需要引入 `apollo-client` 依赖: - -```xml - - com.ctrip.framework.apollo - apollo-client - ${apollo-client.version} - -``` - 2. 使用驱动 * 使用原生驱动: @@ -103,8 +92,3 @@ jdbc:shardingsphere:classpath:config.yaml ``` jdbc:shardingsphere:absolutepath:/path/to/config.yaml ``` - -加载 apollo 指定 namespace 中的 yaml 配置文件的 JDBC URL: -``` -jdbc:shardingsphere:apollo:TEST.test_namespace -``` diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/_index.en.md index 1cf11a2dc5cb2..cc72a35f61d27 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/_index.en.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/_index.en.md @@ -21,7 +21,6 @@ ShardingSphere-JDBC provides a JDBC Driver, which can be used only through confi - Configuration file loading rule: - `absolutepath:` prefix means to load the configuration file from the absolute path - `classpath:` prefix indicates that the configuration file is loaded from the classpath - - `apollo:` prefix means to load the configuration file from apollo ## Procedure @@ -35,16 +34,6 @@ ShardingSphere-JDBC provides a JDBC Driver, which can be used only through confi ``` -If you use the apollo configuration method, you also need to introduce the `apollo-client` dependency: - -```xml - - com.ctrip.framework.apollo - apollo-client - ${apollo-client.version} - -``` - 2. Use drive * Use native drivers: @@ -103,8 +92,3 @@ Load JDBC URL of config.yaml profile in absolute path ``` jdbc:shardingsphere:absolutepath:/path/to/config.yaml ``` - -Load JDBC URL of the yaml configuration file in the specified namespace of apollo: -``` -jdbc:shardingsphere:apollo:TEST.test_namespace -``` diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/_index.cn.md index d3e5fd7e12cb2..d88b9e8fc9af9 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/_index.cn.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/_index.cn.md @@ -29,7 +29,7 @@ spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSph spring.datasource.url=jdbc:shardingsphere:classpath:xxx.yaml ``` -`spring.datasource.url` 中的 YAML 配置文件当前支持通过三种方式获取,绝对路径 `absolutepath:`、Apollo 配置中心 `apollo:` 以及 CLASSPATH `classpath:`,具体可参考 `org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider` 的实现。 +`spring.datasource.url` 中的 YAML 配置文件当前支持通过两种方式获取,绝对路径 `absolutepath:` 以及 CLASSPATH `classpath:`,具体可参考 `org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider` 的实现。 ### 使用数据源 diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/_index.en.md index 30c796166788e..1e57790429afe 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/_index.en.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/_index.en.md @@ -29,7 +29,7 @@ spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSph spring.datasource.url=jdbc:shardingsphere:classpath:xxx.yaml ``` -The YAML configuration file in 'spring.datasource.url' currently support in three ways, the absolute path 'absolutepath:', Apollo configuration center 'apollo:', and CLASSPATH 'classpath:', which can be referred to `org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider`'s implementation for details. +The YAML configuration file in 'spring.datasource.url' currently support in two ways, the absolute path 'absolutepath:' and CLASSPATH 'classpath:', which can be referred to `org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider`'s implementation for details. ### Use Data Source diff --git a/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/resources/registry.ftl b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/resources/registry.ftl index 95ef824f7b5e4..2ed8a6903a08b 100644 --- a/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/resources/registry.ftl +++ b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/resources/registry.ftl @@ -40,13 +40,9 @@ registry { } config { - # file、apollo、zk + # file、zk type = "file" - apollo { - app.id = "fescar-server" - apollo.meta = "http://192.168.1.204:8801" - } zk { serverAddr = "127.0.0.1:2181" session.timeout = 6000 diff --git a/jdbc/core/pom.xml b/jdbc/core/pom.xml index bae493cf8ccf2..c1a55e0360823 100644 --- a/jdbc/core/pom.xml +++ b/jdbc/core/pom.xml @@ -200,11 +200,5 @@ com.zaxxer HikariCP - - - com.ctrip.framework.apollo - apollo-client - - diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ApolloURLProvider.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ApolloURLProvider.java deleted file mode 100644 index f267cf12f72a7..0000000000000 --- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/spi/ApolloURLProvider.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.driver.jdbc.core.driver.spi; - -import com.ctrip.framework.apollo.ConfigFile; -import com.ctrip.framework.apollo.ConfigService; -import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; -import com.google.common.base.Preconditions; -import com.google.common.base.Strings; -import org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider; - -import java.nio.charset.StandardCharsets; - -/** - * Apollo URL provider. - */ -public final class ApolloURLProvider implements ShardingSphereURLProvider { - - private static final String APOLLO_TYPE = "apollo:"; - - @Override - public boolean accept(final String url) { - return !Strings.isNullOrEmpty(url) && url.contains(APOLLO_TYPE); - } - - @Override - public byte[] getContent(final String url, final String urlPrefix) { - String configPath = url.substring(urlPrefix.length(), url.contains("?") ? url.indexOf('?') : url.length()); - String namespace = configPath.substring(APOLLO_TYPE.length()); - Preconditions.checkArgument(!namespace.isEmpty(), "Apollo namespace is required in ShardingSphere URL."); - ConfigFile configFile = ConfigService.getConfigFile(namespace, ConfigFileFormat.YAML); - return configFile.getContent().getBytes(StandardCharsets.UTF_8); - } -} diff --git a/jdbc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider b/jdbc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider index 5ccd96e77e8cd..df99d5c8e8e50 100644 --- a/jdbc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider +++ b/jdbc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.driver.jdbc.core.driver.ShardingSphereURLProvider @@ -17,4 +17,3 @@ org.apache.shardingsphere.driver.jdbc.core.driver.spi.AbsolutePathURLProvider org.apache.shardingsphere.driver.jdbc.core.driver.spi.ClasspathURLProvider -org.apache.shardingsphere.driver.jdbc.core.driver.spi.ApolloURLProvider diff --git a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereURLManagerTest.java b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereURLManagerTest.java index ce12dec26a0b5..6e27d45c13007 100644 --- a/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereURLManagerTest.java +++ b/jdbc/core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereURLManagerTest.java @@ -17,28 +17,18 @@ package org.apache.shardingsphere.driver.jdbc.core.driver; -import com.ctrip.framework.apollo.ConfigFile; -import com.ctrip.framework.apollo.ConfigService; -import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import org.apache.shardingsphere.driver.jdbc.exception.syntax.URLProviderNotFoundException; import org.apache.shardingsphere.test.mock.AutoMockExtension; -import org.apache.shardingsphere.test.mock.StaticMockSettings; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import java.nio.charset.StandardCharsets; import java.util.Objects; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; @ExtendWith(AutoMockExtension.class) -@StaticMockSettings(ConfigService.class) class ShardingSphereURLManagerTest { private final int fooDriverConfigLength = 999; @@ -62,14 +52,4 @@ void assertToAbsolutePathConfigurationFile() { byte[] actual = ShardingSphereURLManager.getContent("jdbc:shardingsphere:absolutepath:" + absolutePath, urlPrefix); assertThat(actual.length, is(fooDriverConfigLength)); } - - @Test - void assertToApolloConfigurationFile() { - ConfigFile configFile = mock(ConfigFile.class); - when(configFile.getContent()).thenReturn("config content"); - when(ConfigService.getConfigFile(anyString(), any(ConfigFileFormat.class))).thenReturn(configFile); - String url = "jdbc:shardingsphere:apollo:namespace"; - byte[] content = ShardingSphereURLManager.getContent(url, urlPrefix); - assertThat("config content".getBytes(StandardCharsets.UTF_8), is(content)); - } } diff --git a/kernel/transaction/type/base/seata-at/src/test/resources/registry.conf b/kernel/transaction/type/base/seata-at/src/test/resources/registry.conf index 95ef824f7b5e4..2ed8a6903a08b 100644 --- a/kernel/transaction/type/base/seata-at/src/test/resources/registry.conf +++ b/kernel/transaction/type/base/seata-at/src/test/resources/registry.conf @@ -40,13 +40,9 @@ registry { } config { - # file、apollo、zk + # file、zk type = "file" - apollo { - app.id = "fescar-server" - apollo.meta = "http://192.168.1.204:8801" - } zk { serverAddr = "127.0.0.1:2181" session.timeout = 6000 diff --git a/pom.xml b/pom.xml index 616c5b4dd9a43..d12fd0bdb7cc9 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,6 @@ 5.4.0 0.7.5 1.51.0 - 1.9.0 3.0.3 @@ -412,12 +411,6 @@ grpc-all ${grpc.version} - - com.ctrip.framework.apollo - apollo-client - ${apollo-client.version} - provided - org.apache.shardingsphere.elasticjob