[dubbo] branch 3.0 updated: metadata read & write

2020-06-14 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
 new 6de9634  metadata read & write
6de9634 is described below

commit 6de9634c53452d94fad8b243e57bda6ab1b9593a
Author: ken.lj 
AuthorDate: Mon Jun 15 13:41:07 2020 +0800

metadata read & write
---
 .../dubbo/config/bootstrap/DubboBootstrap.java |   4 +-
 .../metadata/DefaultMetadataParamsFilter.java  |   3 +
 .../org/apache/dubbo/metadata/MetadataInfo.java|  47 +++--
 .../apache/dubbo/metadata/RevisionResolver.java|   2 +
 .../dubbo/metadata/WritableMetadataService.java|   6 +-
 .../org/apache/dubbo/metadata/DemoService.java |  30 ++-
 .../apache/dubbo/metadata/MetadataInfoTest.java|  27 ++-
 .../store/InMemoryWritableMetadataServiceTest.java | 111 ---
 .../store/RemoteWritableMeatadataServiceTest.java  | 190 --
 .../RemoteWritableMetadataServiceDelegateTest.java | 216 -
 .../registry/client/ServiceDiscoveryRegistry.java  |   3 +-
 ...MetadataServiceURLParamsMetadataCustomizer.java |   8 +-
 .../registry/client/metadata/MetadataUtils.java|  16 +-
 .../metadata/ProtocolPortsMetadataCustomizer.java  |   7 +-
 .../metadata/RefreshServiceMetadataCustomizer.java |  47 -
 .../metadata/store/RemoteMetadataServiceImpl.java  |  10 +-
 ...g.apache.dubbo.metadata.WritableMetadataService |   1 +
 ...ient.metadata.proxy.MetadataServiceProxyFactory |   2 -
 .../client/metadata/URLRevisionResolverTest.java   |  47 -
 .../registry/nacos/NacosServiceDiscovery.java  |   3 +-
 20 files changed, 84 insertions(+), 696 deletions(-)

diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
index 3bdffa9..dd28b81 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/DubboBootstrap.java
@@ -97,7 +97,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_METADATA
 import static 
org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE;
 import static org.apache.dubbo.common.function.ThrowableAction.execute;
 import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;
-import static org.apache.dubbo.metadata.WritableMetadataService.getExtension;
+import static 
org.apache.dubbo.metadata.WritableMetadataService.getDefaultExtension;
 import static 
org.apache.dubbo.registry.client.metadata.ServiceInstanceMetadataUtils.setMetadataStorageType;
 import static org.apache.dubbo.remoting.Constants.CLIENT_KEY;
 
@@ -718,7 +718,7 @@ public class DubboBootstrap extends GenericEventListener {
  */
 private void initMetadataService() {
 startMetadataReport();
-this.metadataService = getExtension(getMetadataType());
+this.metadataService = getDefaultExtension();
 this.metadataServiceExporter = new 
ConfigurableMetadataServiceExporter(metadataService);
 }
 
diff --git 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/DefaultMetadataParamsFilter.java
 
b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/DefaultMetadataParamsFilter.java
index 7f4b85c..0563e43 100644
--- 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/DefaultMetadataParamsFilter.java
+++ 
b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/DefaultMetadataParamsFilter.java
@@ -16,6 +16,8 @@
  */
 package org.apache.dubbo.metadata;
 
+import org.apache.dubbo.common.extension.Activate;
+
 import static org.apache.dubbo.common.constants.CommonConstants.CLUSTER_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.DUBBO_VERSION_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
@@ -35,6 +37,7 @@ import static org.apache.dubbo.rpc.Constants.TOKEN_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.WARMUP_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.WEIGHT_KEY;
 
+@Activate
 public class DefaultMetadataParamsFilter implements MetadataParamsFilter {
 @Override
 public String[] include() {
diff --git 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataInfo.java
 
b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataInfo.java
index bf9aa68..01e3c09 100644
--- 
a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataInfo.java
+++ 
b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataInfo.java
@@ -17,15 +17,19 @@
 package org.apache.dubbo.metadata;
 
 import 

[dubbo] branch 3.0 updated: metadata read & write

2020-06-14 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
 new eea2237  metadata read & write
eea2237 is described below

commit eea22371fec47ce948956c541304ac5bd0b72dfa
Author: ken.lj 
AuthorDate: Mon Jun 15 10:21:28 2020 +0800

metadata read & write
---
 .../dubbo/config/AbstractInterfaceConfig.java  |   2 +
 .../apache/dubbo/config/context/ConfigManager.java |   8 +
 .../org/apache/dubbo/config/ReferenceConfig.java   |  17 +-
 .../org/apache/dubbo/config/ServiceConfig.java |  14 +-
 .../dubbo/config/bootstrap/DubboBootstrap.java |  35 +++-
 .../metadata/DefaultMetadataParamsFilter.java  |  47 +
 .../org/apache/dubbo/metadata/MetadataInfo.java| 100 +
 .../dubbo/metadata/MetadataParamsFilter.java}  |  20 +-
 .../org/apache/dubbo/metadata/MetadataService.java |   2 +
 .../org/apache/dubbo/metadata/MetadataUtil.java|  49 -
 .../apache/dubbo/metadata/RevisionResolver.java|  57 +
 .../dubbo/metadata/WritableMetadataService.java|  14 --
 .../dubbo/metadata/report/MetadataReport.java  |  22 +-
 .../metadata/report/MetadataReportInstance.java|  24 ++-
 .../store/BaseWritableMetadataService.java |  73 ---
 .../store/RemoteWritableMetadataService.java   | 233 -
 .../RemoteWritableMetadataServiceDelegate.java | 100 -
 ...g.apache.dubbo.metadata.WritableMetadataService |   2 -
 .../InMemoryWritableMetadataServiceTest.java   | 149 -
 .../RemoteWritableMetadataServiceDelegateTest.java |   2 +-
 .../registry/client/ServiceDiscoveryRegistry.java  |   7 +-
 .../registry/client/ServiceInstanceCustomizer.java |   3 -
 .../CustomizableServiceInstanceListener.java   |  42 
 .../listener/ServiceInstancesChangedListener.java  |  26 ++-
 ...ExportedServicesRevisionMetadataCustomizer.java |  56 -
 .../registry/client/metadata/MetadataUtils.java| 112 ++
 .../metadata/ServiceInstanceMetadataUtils.java |   7 +
 ...bscribedServicesRevisionMetadataCustomizer.java |  57 -
 .../client/metadata/URLRevisionResolver.java   | 111 --
 .../proxy/BaseMetadataServiceProxyFactory.java |  38 
 .../proxy/DefaultMetadataServiceProxyFactory.java  |  85 
 .../proxy/MetadataServiceProxyFactory.java |  57 -
 .../metadata/proxy/RemoteMetadataServiceProxy.java |  95 -
 .../proxy/RemoteMetadataServiceProxyFactory.java   |  34 ---
 .../store/InMemoryWritableMetadataService.java |  18 +-
 .../metadata/store/RemoteMetadataServiceImpl.java  | 126 +++
 .../registry/integration/RegistryDirectory.java|   1 +
 .../internal/org.apache.dubbo.event.EventListener  |   1 -
 .../event/listener/LoggingEventListenerTest.java   |   5 +-
 .../ServiceInstancesChangedListenerTest.java   |  27 ---
 40 files changed, 574 insertions(+), 1304 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
index 82b5636..970a6ae 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
@@ -280,6 +280,8 @@ public abstract class AbstractInterfaceConfig extends 
AbstractMethodConfig {
 RegistryConfig registryConfig = new RegistryConfig();
 registryConfig.refresh();
 registryConfigs.add(registryConfig);
+} else {
+registryConfigs = new ArrayList<>(registryConfigs);
 }
 setRegistries(registryConfigs);
 }
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java 
b/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
index ed0188a..c0e4b8c 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/config/context/ConfigManager.java
@@ -164,6 +164,14 @@ public class ConfigManager extends LifecycleAdapter 
implements FrameworkExt {
 return getConfigs(getTagName(MetadataReportConfig.class));
 }
 
+public Collection getDefaultMetadataConfigs() {
+Collection defaults = 
getDefaultConfigs(getConfigsMap(getTagName(MetadataReportConfig.class)));
+if (CollectionUtils.isEmpty(defaults)) {
+return getMetadataConfigs();
+}
+return defaults;
+}
+
 // MetadataReportConfig correlative methods
 
 public void addProvider(ProviderConfig providerConfig) {
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java