Skip to content

Commit a3c89e2

Browse files
chickenljcvictory
authored andcommitted
delete 'config.' prefix for url generated from ConfigCenterConfig (apache#5078)
1 parent 5842dff commit a3c89e2

File tree

11 files changed

+19
-55
lines changed

11 files changed

+19
-55
lines changed

dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java

+5
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,9 @@ public interface CommonConstants {
184184

185185
String DUBBO_LABELS = "dubbo.labels";
186186
String DUBBO_ENV_KEYS = "dubbo.env.keys";
187+
188+
String CONFIG_CONFIGFILE_KEY = "config-file";
189+
String CONFIG_ENABLE_KEY = "highest-priority";
190+
String CONFIG_NAMESPACE_KEY = "namespace";
191+
String CHECK_KEY = "check";
187192
}

dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public class Constants implements CommonConstants,
3636
org.apache.dubbo.rpc.Constants,
3737
org.apache.dubbo.rpc.protocol.dubbo.Constants,
3838
org.apache.dubbo.common.serialize.Constants,
39-
org.apache.dubbo.configcenter.Constants,
4039
org.apache.dubbo.metadata.support.Constants,
4140
org.apache.dubbo.rpc.protocol.rest.Constants,
4241
org.apache.dubbo.registry.Constants {

dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ConfigCenterConfig.java

+3-13
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,11 @@
2828
import java.util.concurrent.atomic.AtomicBoolean;
2929

3030
import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE;
31+
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_CONFIGFILE_KEY;
32+
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_ENABLE_KEY;
3133
import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY;
3234
import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
33-
import static org.apache.dubbo.config.Constants.CONFIG_CONFIGFILE_KEY;
34-
import static org.apache.dubbo.config.Constants.CONFIG_ENABLE_KEY;
35-
import static org.apache.dubbo.config.Constants.CONFIG_TIMEOUT_KEY;
3635
import static org.apache.dubbo.config.Constants.ZOOKEEPER_PROTOCOL;
37-
import static org.apache.dubbo.configcenter.Constants.CONFIG_CHECK_KEY;
38-
import static org.apache.dubbo.configcenter.Constants.CONFIG_CLUSTER_KEY;
39-
import static org.apache.dubbo.configcenter.Constants.CONFIG_GROUP_KEY;
40-
import static org.apache.dubbo.configcenter.Constants.CONFIG_NAMESPACE_KEY;
4136

4237
/**
4338
* ConfigCenterConfig
@@ -82,7 +77,7 @@ public class ConfigCenterConfig extends AbstractConfig {
8277
/* If the Config Center product you use have some special parameters that is not covered by this class, you can add it to here.
8378
For example, with XML:
8479
<dubbo:config-center>
85-
<dubbo:parameter key="config.{your key}" value="{your value}" />
80+
<dubbo:parameter key="{your key}" value="{your value}" />
8681
</dubbo:config-center>
8782
*/
8883
private Map<String, String> parameters;
@@ -133,7 +128,6 @@ public void setAddress(String address) {
133128
this.address = address;
134129
}
135130

136-
@Parameter(key = CONFIG_CLUSTER_KEY)
137131
public String getCluster() {
138132
return cluster;
139133
}
@@ -142,7 +136,6 @@ public void setCluster(String cluster) {
142136
this.cluster = cluster;
143137
}
144138

145-
@Parameter(key = CONFIG_NAMESPACE_KEY)
146139
public String getNamespace() {
147140
return namespace;
148141
}
@@ -151,7 +144,6 @@ public void setNamespace(String namespace) {
151144
this.namespace = namespace;
152145
}
153146

154-
@Parameter(key = CONFIG_GROUP_KEY)
155147
public String getGroup() {
156148
return group;
157149
}
@@ -160,7 +152,6 @@ public void setGroup(String group) {
160152
this.group = group;
161153
}
162154

163-
@Parameter(key = CONFIG_CHECK_KEY)
164155
public Boolean isCheck() {
165156
return check;
166157
}
@@ -194,7 +185,6 @@ public void setPassword(String password) {
194185
this.password = password;
195186
}
196187

197-
@Parameter(key = CONFIG_TIMEOUT_KEY)
198188
public Long getTimeout() {
199189
return timeout;
200190
}

dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/Constants.java

-5
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ public interface Constants {
7373
*/
7474
String PRODUCTION_ENVIRONMENT = "product";
7575

76-
String CONFIG_CONFIGFILE_KEY = "config.config-file";
77-
String CONFIG_ENABLE_KEY = "config.highest-priority";
78-
String CONFIG_TIMEOUT_KEY = "config.timeout";
79-
String CONFIG_APPNAME_KEY = "config.app-name";
80-
8176
String MULTICAST = "multicast";
8277

8378

dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ConfigCenterConfigTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public void testToUrl() {
3737
config.setGroup("group");
3838
config.setAddress("zookeeper://127.0.0.1:2181");
3939

40-
Assertions.assertEquals("zookeeper://127.0.0.1:2181/ConfigCenterConfig?config.check=true&" +
41-
"config.config-file=dubbo.properties&config.group=group&config.highest-priority=true&" +
42-
"config.namespace=namespace&config.timeout=3000",
40+
Assertions.assertEquals("zookeeper://127.0.0.1:2181/ConfigCenterConfig?check=true&" +
41+
"config-file=dubbo.properties&group=group&highest-priority=true&" +
42+
"namespace=namespace&timeout=3000",
4343
config.toUrl().toFullString()
4444
);
4545
}

dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/Constants.java

-24
This file was deleted.

dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444

4545
import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE;
4646
import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY;
47+
import static org.apache.dubbo.common.constants.CommonConstants.CHECK_KEY;
48+
import static org.apache.dubbo.common.constants.CommonConstants.CLUSTER_KEY;
4749
import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
48-
import static org.apache.dubbo.configcenter.Constants.CONFIG_CHECK_KEY;
49-
import static org.apache.dubbo.configcenter.Constants.CONFIG_CLUSTER_KEY;
50-
import static org.apache.dubbo.configcenter.Constants.CONFIG_NAMESPACE_KEY;
50+
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_NAMESPACE_KEY;
5151

5252
/**
5353
* Apollo implementation, https://github.com/ctripcorp/apollo
@@ -70,7 +70,7 @@ public class ApolloDynamicConfiguration implements DynamicConfiguration {
7070
// Instead of using Dubbo's configuration, I would suggest use the original configuration method Apollo provides.
7171
String configEnv = url.getParameter(APOLLO_ENV_KEY);
7272
String configAddr = getAddressWithProtocolPrefix(url);
73-
String configCluster = url.getParameter(CONFIG_CLUSTER_KEY);
73+
String configCluster = url.getParameter(CLUSTER_KEY);
7474
if (configEnv != null) {
7575
System.setProperty(APOLLO_ENV_KEY, configEnv);
7676
}
@@ -84,7 +84,7 @@ public class ApolloDynamicConfiguration implements DynamicConfiguration {
8484
dubboConfig = ConfigService.getConfig(url.getParameter(CONFIG_NAMESPACE_KEY, DEFAULT_GROUP));
8585
dubboConfigFile = ConfigService.getConfigFile(url.getParameter(CONFIG_NAMESPACE_KEY, DEFAULT_GROUP), ConfigFileFormat.Properties);
8686
// Decide to fail or to continue when failed to connect to remote server.
87-
boolean check = url.getParameter(CONFIG_CHECK_KEY, true);
87+
boolean check = url.getParameter(CHECK_KEY, true);
8888
if (dubboConfig.getSourceType() != ConfigSourceType.REMOTE) {
8989
if (check) {
9090
throw new IllegalStateException("Failed to connect to config center, the config center is Apollo, " +

dubbo-configcenter/dubbo-configcenter-consul/src/main/java/org/apache/dubbo/configcenter/consul/ConsulDynamicConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
import java.util.concurrent.ExecutorService;
4040

4141
import static java.util.concurrent.Executors.newCachedThreadPool;
42+
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_NAMESPACE_KEY;
4243
import static org.apache.dubbo.common.constants.CommonConstants.PATH_SEPARATOR;
4344
import static org.apache.dubbo.configcenter.ConfigChangeType.ADDED;
44-
import static org.apache.dubbo.configcenter.Constants.CONFIG_NAMESPACE_KEY;
4545

4646
/**
4747
* config center implementation for consul

dubbo-configcenter/dubbo-configcenter-etcd/src/main/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
import java.util.concurrent.ConcurrentMap;
4141

4242
import static java.nio.charset.StandardCharsets.UTF_8;
43+
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_NAMESPACE_KEY;
4344
import static org.apache.dubbo.common.constants.CommonConstants.PATH_SEPARATOR;
44-
import static org.apache.dubbo.configcenter.Constants.CONFIG_NAMESPACE_KEY;
4545

4646
/**
4747
* The etcd implementation of {@link DynamicConfiguration}

dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
import java.util.concurrent.Executors;
3333
import java.util.concurrent.TimeUnit;
3434

35+
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_NAMESPACE_KEY;
3536
import static org.apache.dubbo.common.constants.CommonConstants.PATH_SEPARATOR;
36-
import static org.apache.dubbo.configcenter.Constants.CONFIG_NAMESPACE_KEY;
3737

3838
/**
3939
*

dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfigurationFactory.java

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public void setZookeeperTransporter(ZookeeperTransporter zookeeperTransporter) {
3232
this.zookeeperTransporter = zookeeperTransporter;
3333
}
3434

35-
3635
@Override
3736
protected DynamicConfiguration createDynamicConfiguration(URL url) {
3837
return new ZookeeperDynamicConfiguration(url, zookeeperTransporter);

0 commit comments

Comments
 (0)