Skip to content

Commit

Permalink
Dubbo cloud native (#4904)
Browse files Browse the repository at this point in the history
* Polish #4542 : [Enhancement] Adapt the Java standard Event/Listener mechanism

* Polish #4541 : [Feature] Add local File System DynamicConfigurationFactory‘s extension

* Polish #4541 : Bugfix

* Polish #4541 : Optimization

* Polish #4541 : Add the compatibility for PollingWatchService on the some platforms

* Polish #4541 : Add delay publish without ThreadPoolExecutor

* Polish #4541 : Refactor the extension name

* Polish #4541 : Add remove ops

* Polish #4541 : Add testable constructor

* Polish #4541 : Add getConfigGroups method

* Polish #4610 : [Refactor] Refactor the bootstrap module

* Polish #4541 : Fix the nulling URL issue

* Polish #4622 : [Refactor] Refactor ConfigManager

* Polish #4622 : [Refactor] Refactor ConfigManager

* Polish #4622 : Support multiple configcenters

* Polish #4671 : ServiceNameMapping will not map the group, version and protocol

* update referenceCount log (#4683)

Add comments to support multiple shared connections

* Polish /#4687 : Remove the duplicated test code in dubbo-config-spring (#4688)

* #4685  修改代码if判断false问题 if (hasException == false)修改成if (!hasException) (#4695)

* Fixed Service annotation method parameters are not in effect (#4598)

* keep demo simple, and switch to use zookeeper as registry center (#4705)

* keep demo simple, and switch to use zookeeper as registry center

* remove comment

* @reference auto-wires the instance of generic interface #4594 (#4677)

* try to shorten maven output to make travis build pass (#4710)

* use CountDownLatch to check zk registry if establish connection (#4589)

* Minor change

* Rename the extension name of WritableMetadataService

* Polish #4759 : [Refactor] Change the signature of methods of MetadataService #4759

* Merge remote-tracking branch 'upstream/master' into dubbo-cloud-native

# Conflicts:
#	dubbo-all/pom.xml
#	dubbo-bom/pom.xml
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ConfigCenterConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java
#	dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
#	dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java
#	dubbo-configcenter/dubbo-configcenter-api/src/main/java/org/apache/dubbo/configcenter/DynamicConfiguration.java
#	dubbo-configcenter/dubbo-configcenter-api/src/test/java/org/apache/dubbo/configcenter/mock/MockDynamicConfiguration.java
#	dubbo-configcenter/dubbo-configcenter-consul/src/main/java/org/apache/dubbo/configcenter/consul/ConsulDynamicConfiguration.java
#	dubbo-configcenter/dubbo-configcenter-etcd/src/test/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfigurationTest.java
#	dubbo-configcenter/dubbo-configcenter-nacos/src/main/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfiguration.java
#	dubbo-configcenter/dubbo-configcenter-nacos/src/test/java/org/apache/dubbo/configcenter/support/nacos/NacosDynamicConfigurationTest.java
#	dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java
#	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/definition/model/MethodDefinition.java
#	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifier.java
#	dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReport.java
#	dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java
#	dubbo-metadata/dubbo-metadata-definition-protobuf/src/main/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilder.java
#	dubbo-metadata/dubbo-metadata-definition-protobuf/src/test/java/org/apache/dubbo/metadata/definition/protobuf/ProtobufTypeBuilderTest.java
#	dubbo-metadata/pom.xml
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
#	dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java
#	dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistryFactory.java
#	dubbo-rpc/dubbo-rpc-xml/src/main/java/org/apache/dubbo/xml/rpc/protocol/xmlrpc/XmlRpcProtocol.java

* Polish #3984 : Add the implementation of Page<ServiceInstance> getInstances(String serviceName, int offset, int pageSize, boolean healthyOnly)

* Code merge

* Fix the cases

* Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native

# Conflicts:
#	dubbo-bootstrap/src/test/java/org/apache/dubbo/bootstrap/DubboServiceProviderBootstrap.java
#	dubbo-metadata/dubbo-metadata-definition-protobuf/pom.xml
#	dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/ServiceOrientedRegistryTest.java
#	dubbo-registry/dubbo-registry-consul/src/main/java/org/apache/dubbo/registry/consul/ConsulServiceDiscoveryFactory.java
#	dubbo-registry/dubbo-registry-etcd3/src/main/java/org/apache/dubbo/registry/etcd/EtcdServiceDiscovery.java

* Refactor ConfigManager

* Refactor ConfigManager

* Resolve the issues on ConfigManager

* Refactor and add test-cases for ConfigManager

* Polish #4774 : [Feature] Dubbo Cloud Native - To Support in Spring

* Polish #4808 : [Feature] Add the registered/unregistered event mechanism ShutdownHook

* Polish #4807 : [Feature] Add the callback mechanism ShutdownHook #4807

* Polish #4813 : [Feature] add Prioritized implementation for ServiceInstanceCustomizer

* Polish #4815 : [Feature] Add the ServiceLoader for Dubbo's services or components

* Polish #4815 : [Feature] Add the ServiceLoader for Dubbo's services or components

* Polish #4813 : [Feature] add Prioritized implementation for ServiceInstanceCustomizer

* Polish #4807 : Add sort implementation

* Refactor

* Refactor

* Polish #4845 : [Feature] Enhance the Event-Publishing feature to original ServiceDiscovery

* Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native

# Conflicts:
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceDiscoveryFactory.java
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java

* Merge remote-tracking branch 'upstream/cloud-native' into dubbo-cloud-native

# Conflicts:
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceDiscoveryFactory.java
#	dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java

* Polish #4854 : [Feature] MetadataService supports the Dubbo protocol under auto-increased port

* Polish #4857 : [Enhancement] Sync the Metadata storage type into ApplicationConfig

* Polish #4868 : [Enhancement] Refactor ConfigChangeEvent

* Polish #4868 : [Enhancement] Refactor ConfigChangeEvent

* Polish #4873 : [Feature] Add a conditional EventListener into Event Module

* Polish #4875 : [Feature] Refactor ServiceInstancesChangedListener

* Remove the cycle dependencies

* Remove the cycle dependencies

* Polish #4903 : [Feature] Set source into the BeanDefinition of Dubbo Config

* Polish #4902 : [Feature] Dubbo Cloud Native to Spring XML scenario
  • Loading branch information
mercyblitz committed Aug 21, 2019
1 parent e7c93e5 commit 346e744
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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.dubbo.config.spring.beans.factory.config;

import org.springframework.beans.BeanMetadataAttributeAccessor;
import org.springframework.beans.BeanMetadataElement;

/**
* Configurable the {@link BeanMetadataAttributeAccessor#setSource(Object) source} for {@link BeanMetadataElement}
*
* @since 2.7.4
*/
public interface ConfigurableSourceBeanMetadataElement {

/**
* Set the source into the specified {@link BeanMetadataElement}
*
* @param beanMetadataElement {@link BeanMetadataElement} instance
*/
default void setSource(BeanMetadataElement beanMetadataElement) {
if (beanMetadataElement instanceof BeanMetadataAttributeAccessor) {
BeanMetadataAttributeAccessor.class.cast(beanMetadataElement).setSource(this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.apache.dubbo.config.AbstractConfig;
import org.apache.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor;
import org.apache.dubbo.config.spring.beans.factory.config.ConfigurableSourceBeanMetadataElement;
import org.apache.dubbo.config.spring.context.config.NamePropertyDefaultValueDubboConfigBeanCustomizer;

import org.apache.commons.logging.Log;
Expand Down Expand Up @@ -56,7 +57,8 @@
* @see DubboConfigBindingBeanPostProcessor
* @since 2.5.8
*/
public class DubboConfigBindingRegistrar implements ImportBeanDefinitionRegistrar, EnvironmentAware {
public class DubboConfigBindingRegistrar implements ImportBeanDefinitionRegistrar, EnvironmentAware,
ConfigurableSourceBeanMetadataElement {

private final Log log = LogFactory.getLog(getClass());

Expand Down Expand Up @@ -121,6 +123,11 @@ private void registerDubboConfigBean(String beanName, Class<? extends AbstractCo

AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();

/**
* @since 2.7.4
*/
setSource(beanDefinition);

registry.registerBeanDefinition(beanName, beanDefinition);

if (log.isInfoEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@
import org.apache.dubbo.config.spring.ConfigCenterBean;
import org.apache.dubbo.config.spring.ReferenceBean;
import org.apache.dubbo.config.spring.ServiceBean;
import org.apache.dubbo.config.spring.beans.factory.config.ConfigurableSourceBeanMetadataElement;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.context.annotation.AnnotationConfigUtils;
import org.w3c.dom.Element;

/**
* DubboNamespaceHandler
*
* @export
*/
public class DubboNamespaceHandler extends NamespaceHandlerSupport {
public class DubboNamespaceHandler extends NamespaceHandlerSupport implements ConfigurableSourceBeanMetadataElement {

static {
Version.checkDuplicate(DubboNamespaceHandler.class);
Expand All @@ -60,4 +66,28 @@ public void init() {
registerBeanDefinitionParser("annotation", new AnnotationBeanDefinitionParser());
}

/**
* Override {@link NamespaceHandlerSupport#parse(Element, ParserContext)} method
*
* @param element {@link Element}
* @param parserContext {@link ParserContext}
* @return
* @since 2.7.4
*/
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
registerAnnotationConfigProcessors(parserContext);
BeanDefinition beanDefinition = super.parse(element, parserContext);
setSource(beanDefinition);
return beanDefinition;
}

/**
* @param parserContext {@link ParserContext}
* @since 2.7.4
*/
private void registerAnnotationConfigProcessors(ParserContext parserContext) {
BeanDefinitionRegistry registry = parserContext.getRegistry();
AnnotationConfigUtils.registerAnnotationConfigProcessors(registry);
}
}

0 comments on commit 346e744

Please sign in to comment.