Add compatible module and rename groupId to org.apache.dubbo (#1952)
* remove dubbo-test-examples and dubbo-test-benchmark * rename package to org.apache.dubbo * support old SPI file * remove final for RpcException and URL * add debug sysout in UT * add debug info in UT * ignore 2 cases temporary * add finally clear for SHUTDOWN_WAIT_KEY property * clear SHUTDOWN_WAIT_KEY before test * add dubbo SPI and interface bridge class * support EchoService and GenericService * rename groupId to org.apache.dubbo * add debug info for UT
This commit is contained in:
parent
9ee83e4c8b
commit
c0ca042253
|
|
@ -6,5 +6,5 @@ coverage:
|
|||
threshold: 0.1%
|
||||
ignore:
|
||||
- "dubbo-demo/.*"
|
||||
- "dubbo-common/src/main/java/com/alibaba/dubbo/common/json/*.java" # internal JSON impl is deprecate, ignore test coverage for them
|
||||
- "dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java" # Deprecated
|
||||
- "dubbo-common/src/main/java/org/apache/dubbo/common/json/*.java" # internal JSON impl is deprecate, ignore test coverage for them
|
||||
- "dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/AnnotationBean.java" # Deprecated
|
||||
|
|
@ -5,10 +5,10 @@ Dubbo is released under the non-restrictive Apache 2.0 license, and follows a ve
|
|||
Before we accept a non-trivial patch or pull request we will need you to sign the Contributor License Agreement. Signing the contributor’s agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.
|
||||
### Code Conventions
|
||||
Our code style is almost in line with the standard java conventions(Popular IDE's default setting satisfy this), only changed the following two restricts:
|
||||
1. Classes under 'com.alibaba.*' and 'com.taobao.*' package are grouped separately, and put on top of all other 'imports'.
|
||||
1. Classes under 'org.apache.dubbo.*' and 'com.taobao.*' package are grouped separately, and put on top of all other 'imports'.
|
||||
2. If there are more than 120 characters in current line, start a new line.
|
||||
|
||||
We provide a template file [dubbo_codestyle_for_idea.xml](https://github.com/alibaba/dubbo/tree/master/codestyle/dubbo_codestyle_for_idea.xml) for IntelliJ idea, you can import it to you IDE. If you use Eclipse you can config manually by referencing the same file.
|
||||
We provide a template file [dubbo_codestyle_for_idea.xml](https://github.com/apache/incubator-dubbo/tree/master/codestyle/dubbo_codestyle_for_idea.xml) for IntelliJ idea, you can import it to you IDE. If you use Eclipse you can config manually by referencing the same file.
|
||||
|
||||
* Make sure all new .java files to have a simple Javadoc class comment with at least a @date tag identifying birth, and preferably at least a paragraph on what the class is for.
|
||||
|
||||
|
|
|
|||
48
LICENSE
48
LICENSE
|
|
@ -208,54 +208,6 @@ Apache Dubbo includes a number of submodules with separate copyright notices
|
|||
and license terms. Your use of these submodules is subject to the terms and
|
||||
conditions of the following licenses.
|
||||
|
||||
|
||||
For the hessian-lite submodule:
|
||||
|
||||
The Apache Software License, Version 1.1
|
||||
|
||||
Copyright (c) 2001-2004 Caucho Technology, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
3. The end-user documentation included with the redistribution, if
|
||||
any, must include the following acknowlegement:
|
||||
"This product includes software developed by the
|
||||
Caucho Technology (http://www.caucho.com/)."
|
||||
Alternately, this acknowlegement may appear in the software itself,
|
||||
if and wherever such third-party acknowlegements normally appear.
|
||||
|
||||
4. The names "Hessian", "Resin", and "Caucho" must not be used to
|
||||
endorse or promote products derived from this software without prior
|
||||
written permission. For written permission, please contact
|
||||
info@caucho.com.
|
||||
|
||||
5. Products derived from this software may not be called "Resin"
|
||||
nor may "Resin" appear in their names without prior written
|
||||
permission of Caucho Technology.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL CAUCHO TECHNOLOGY OR ITS CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
For the org.apache.dubbo.common.concurrent package:
|
||||
|
||||
This product bundles and repackages the following code in Google Guava 16.0.1, which is available under a
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ Follow this checklist to help us incorporate your contribution quickly and easil
|
|||
- [x] Make sure there is a [GITHUB_issue](https://github.com/apache/incubator-dubbo/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
|
||||
- [ ] Format the pull request title like `[Dubbo-XXX] Fix UnknownException when host config not exist #XXX`. Each commit in the pull request should have a meaningful subject line and body.
|
||||
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
|
||||
- [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/alibaba/dubbo/tree/master/dubbo-test).
|
||||
- [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/incubator-dubbo/tree/master/dubbo-test).
|
||||
- [ ] Run `mvn clean install -DskipTests` & `mvn clean test-compile failsafe:integration-test` to make sure unit-test and integration-test pass.
|
||||
- [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/incubator-dubbo/wiki/Software-donation-guide).
|
||||
|
|
|
|||
184
all/pom.xml
184
all/pom.xml
|
|
@ -17,7 +17,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-parent</artifactId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
|
|
@ -32,299 +32,306 @@
|
|||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-cluster</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-config-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-config-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-filter-cache</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-filter-validation</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-netty</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-netty4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-mina</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-grizzly</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-p2p</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-dubbo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-injvm</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-rmi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-hessian</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-webservice</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-thrift</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-memcached</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-redis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-rest</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-default</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-multicast</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-zookeeper</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-redis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-default</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-logback</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-qos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-fastjson</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-fst</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-hessian2</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-jdk</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-kryo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-bootstrap</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-compatible</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>hessian-lite</artifactId>
|
||||
|
|
@ -380,50 +387,51 @@
|
|||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.alibaba:hessian-lite</include>
|
||||
<include>com.alibaba:dubbo-common</include>
|
||||
<include>com.alibaba:dubbo-remoting-api</include>
|
||||
<include>com.alibaba:dubbo-remoting-netty</include>
|
||||
<include>com.alibaba:dubbo-remoting-netty4</include>
|
||||
<include>com.alibaba:dubbo-remoting-mina</include>
|
||||
<include>com.alibaba:dubbo-remoting-grizzly</include>
|
||||
<include>com.alibaba:dubbo-remoting-p2p</include>
|
||||
<include>com.alibaba:dubbo-remoting-http</include>
|
||||
<include>com.alibaba:dubbo-remoting-zookeeper</include>
|
||||
<include>com.alibaba:dubbo-rpc-api</include>
|
||||
<include>com.alibaba:dubbo-rpc-dubbo</include>
|
||||
<include>com.alibaba:dubbo-rpc-injvm</include>
|
||||
<include>com.alibaba:dubbo-rpc-rmi</include>
|
||||
<include>com.alibaba:dubbo-rpc-hessian</include>
|
||||
<include>com.alibaba:dubbo-rpc-http</include>
|
||||
<include>com.alibaba:dubbo-rpc-webservice</include>
|
||||
<include>com.alibaba:dubbo-rpc-thrift</include>
|
||||
<include>com.alibaba:dubbo-rpc-memcached</include>
|
||||
<include>com.alibaba:dubbo-rpc-redis</include>
|
||||
<include>com.alibaba:dubbo-rpc-rest</include>
|
||||
<include>com.alibaba:dubbo-filter-validation</include>
|
||||
<include>com.alibaba:dubbo-filter-cache</include>
|
||||
<include>com.alibaba:dubbo-cluster</include>
|
||||
<include>com.alibaba:dubbo-registry-api</include>
|
||||
<include>com.alibaba:dubbo-registry-default</include>
|
||||
<include>com.alibaba:dubbo-registry-multicast</include>
|
||||
<include>com.alibaba:dubbo-registry-zookeeper</include>
|
||||
<include>com.alibaba:dubbo-registry-redis</include>
|
||||
<include>com.alibaba:dubbo-monitor-api</include>
|
||||
<include>com.alibaba:dubbo-monitor-default</include>
|
||||
<include>com.alibaba:dubbo-config-api</include>
|
||||
<include>com.alibaba:dubbo-config-spring</include>
|
||||
<include>com.alibaba:dubbo-container-api</include>
|
||||
<include>com.alibaba:dubbo-container-spring</include>
|
||||
<include>com.alibaba:dubbo-container-log4j</include>
|
||||
<include>com.alibaba:dubbo-container-logback</include>
|
||||
<include>com.alibaba:dubbo-qos</include>
|
||||
<include>com.alibaba:dubbo-serialization-api</include>
|
||||
<include>com.alibaba:dubbo-serialization-fastjson</include>
|
||||
<include>com.alibaba:dubbo-serialization-hessian2</include>
|
||||
<include>com.alibaba:dubbo-serialization-fst</include>
|
||||
<include>com.alibaba:dubbo-serialization-kryo</include>
|
||||
<include>com.alibaba:dubbo-serialization-jdk</include>
|
||||
<include>com.alibaba:dubbo-bootstrap</include>
|
||||
<include>org.apache.dubbo:dubbo-compatible</include>
|
||||
<include>org.apache.dubbo:dubbo-common</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-api</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-netty</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-netty4</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-mina</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-grizzly</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-p2p</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-http</include>
|
||||
<include>org.apache.dubbo:dubbo-remoting-zookeeper</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-api</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-dubbo</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-injvm</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-rmi</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-hessian</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-http</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-webservice</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-thrift</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-memcached</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-redis</include>
|
||||
<include>org.apache.dubbo:dubbo-rpc-rest</include>
|
||||
<include>org.apache.dubbo:dubbo-filter-validation</include>
|
||||
<include>org.apache.dubbo:dubbo-filter-cache</include>
|
||||
<include>org.apache.dubbo:dubbo-cluster</include>
|
||||
<include>org.apache.dubbo:dubbo-registry-api</include>
|
||||
<include>org.apache.dubbo:dubbo-registry-default</include>
|
||||
<include>org.apache.dubbo:dubbo-registry-multicast</include>
|
||||
<include>org.apache.dubbo:dubbo-registry-zookeeper</include>
|
||||
<include>org.apache.dubbo:dubbo-registry-redis</include>
|
||||
<include>org.apache.dubbo:dubbo-monitor-api</include>
|
||||
<include>org.apache.dubbo:dubbo-monitor-default</include>
|
||||
<include>org.apache.dubbo:dubbo-config-api</include>
|
||||
<include>org.apache.dubbo:dubbo-config-spring</include>
|
||||
<include>org.apache.dubbo:dubbo-container-api</include>
|
||||
<include>org.apache.dubbo:dubbo-container-spring</include>
|
||||
<include>org.apache.dubbo:dubbo-container-log4j</include>
|
||||
<include>org.apache.dubbo:dubbo-container-logback</include>
|
||||
<include>org.apache.dubbo:dubbo-qos</include>
|
||||
<include>org.apache.dubbo:dubbo-serialization-api</include>
|
||||
<include>org.apache.dubbo:dubbo-serialization-fastjson</include>
|
||||
<include>org.apache.dubbo:dubbo-serialization-hessian2</include>
|
||||
<include>org.apache.dubbo:dubbo-serialization-fst</include>
|
||||
<include>org.apache.dubbo:dubbo-serialization-kryo</include>
|
||||
<include>org.apache.dubbo:dubbo-serialization-jdk</include>
|
||||
<include>org.apache.dubbo:dubbo-bootstrap</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<transformers>
|
||||
|
|
@ -563,7 +571,7 @@
|
|||
<configuration>
|
||||
<includeDependencySources>true</includeDependencySources>
|
||||
<dependencySourceIncludes>
|
||||
<dependencySourceInclude>com.alibaba:dubbo-*</dependencySourceInclude>
|
||||
<dependencySourceInclude>org.apache.dubbo:dubbo-*</dependencySourceInclude>
|
||||
<dependencySourceExclude>com.alibaba:hessian-*</dependencySourceExclude>
|
||||
</dependencySourceIncludes>
|
||||
<show>public</show>
|
||||
|
|
|
|||
91
bom/pom.xml
91
bom/pom.xml
|
|
@ -9,7 +9,7 @@
|
|||
<version>7</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-bom</artifactId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
|
@ -74,215 +74,220 @@
|
|||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-cluster</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-config-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-config-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-filter-cache</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-filter-validation</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-netty</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-netty4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-mina</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-grizzly</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-p2p</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-dubbo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-injvm</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-rmi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-hessian</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-webservice</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-thrift</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-memcached</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-redis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-rest</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-default</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-multicast</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-zookeeper</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-redis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-default</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-logback</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-qos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-fastjson</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-fst</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-hessian2</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-jdk</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-kryo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-bootstrap</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-compatible</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>hessian-lite</artifactId>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99"/>
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="com.alibaba" withSubpackages="true" static="false"/>
|
||||
<package name="org.apache.dubbo" withSubpackages="true" static="false"/>
|
||||
<emptyLine/>
|
||||
<package name="com.taobao" withSubpackages="true" static="false"/>
|
||||
<emptyLine/>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<version>7</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-dependencies-bom</artifactId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-parent</artifactId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
|
@ -31,215 +31,225 @@
|
|||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-cluster</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-config-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-config-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-filter-cache</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-filter-validation</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-netty</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-netty4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-mina</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-grizzly</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-p2p</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-dubbo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-injvm</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-rmi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-hessian</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-webservice</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-thrift</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-memcached</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-redis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-rest</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-default</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-multicast</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-zookeeper</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-redis</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-monitor-default</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-container-logback</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-qos</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-fastjson</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-fst</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-hessian2</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-jdk</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-kryo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-compatible</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-bootstrap</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>hessian-lite</artifactId>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
<outputDirectory>/libs</outputDirectory>
|
||||
<scope>runtime</scope>
|
||||
<includes>
|
||||
<include>com.alibaba:*</include>
|
||||
<include>org.apache.dubbo:*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>com.alibaba:fastjson</exclude>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>dubbo-parent</artifactId>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -29,17 +29,17 @@
|
|||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-config-api</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-common</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-api</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-parent</artifactId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-api</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-parent</artifactId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-parent</artifactId>
|
||||
<version>2.7.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>dubbo-compatible</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>${project.artifactId}</name>
|
||||
<description>The compatible module of dubbo project</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-filter-cache</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-config-spring</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-qos</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-http</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-p2p</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-remoting-zookeeper</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-rest</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-rpc-thrift</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-serialization-hessian2</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.cache;
|
||||
|
||||
@Deprecated
|
||||
public interface Cache extends org.apache.dubbo.cache.Cache {
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.cache;
|
||||
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
import com.alibaba.dubbo.rpc.Invocation;
|
||||
|
||||
@Deprecated
|
||||
public interface CacheFactory extends org.apache.dubbo.cache.CacheFactory {
|
||||
|
||||
Cache getCache(URL url, Invocation invocation);
|
||||
}
|
||||
52
dubbo-compatible/src/main/java/com/alibaba/dubbo/cache/support/AbstractCacheFactory.java
vendored
Normal file
52
dubbo-compatible/src/main/java/com/alibaba/dubbo/cache/support/AbstractCacheFactory.java
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.cache.support;
|
||||
|
||||
import com.alibaba.dubbo.cache.Cache;
|
||||
import com.alibaba.dubbo.cache.CacheFactory;
|
||||
import com.alibaba.dubbo.common.Constants;
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
import com.alibaba.dubbo.rpc.Invocation;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
@Deprecated
|
||||
public abstract class AbstractCacheFactory implements CacheFactory {
|
||||
|
||||
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
|
||||
|
||||
@Override
|
||||
public Cache getCache(URL url, Invocation invocation) {
|
||||
url = url.addParameter(Constants.METHOD_KEY, invocation.getMethodName());
|
||||
String key = url.toFullString();
|
||||
Cache cache = caches.get(key);
|
||||
if (cache == null) {
|
||||
caches.put(key, createCache(url));
|
||||
cache = caches.get(key);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
protected abstract Cache createCache(URL url);
|
||||
|
||||
@Override
|
||||
public org.apache.dubbo.cache.Cache getCache(org.apache.dubbo.common.URL url, org.apache.dubbo.rpc.Invocation invocation) {
|
||||
return getCache(new URL(url), new Invocation.CompatibleInvocation(invocation));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common;
|
||||
|
||||
@Deprecated
|
||||
public class Constants extends org.apache.dubbo.common.Constants {
|
||||
}
|
||||
|
|
@ -0,0 +1,519 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common;
|
||||
|
||||
import org.apache.dubbo.common.utils.CollectionUtils;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
@Deprecated
|
||||
public class URL extends org.apache.dubbo.common.URL {
|
||||
|
||||
public URL(org.apache.dubbo.common.URL url) {
|
||||
super(url.getProtocol(), url.getUsername(), url.getPassword(), url.getHost(), url.getPort(), url.getPath(), url.getParameters());
|
||||
}
|
||||
|
||||
public URL(String protocol, String host, int port) {
|
||||
super(protocol, null, null, host, port, null, (Map<String, String>) null);
|
||||
}
|
||||
|
||||
public URL(String protocol, String host, int port, String[] pairs) {
|
||||
super(protocol, null, null, host, port, null, CollectionUtils.toStringMap(pairs));
|
||||
}
|
||||
|
||||
public URL(String protocol, String host, int port, Map<String, String> parameters) {
|
||||
super(protocol, null, null, host, port, null, parameters);
|
||||
}
|
||||
|
||||
public URL(String protocol, String host, int port, String path) {
|
||||
super(protocol, null, null, host, port, path, (Map<String, String>) null);
|
||||
}
|
||||
|
||||
public URL(String protocol, String host, int port, String path, String... pairs) {
|
||||
super(protocol, null, null, host, port, path, CollectionUtils.toStringMap(pairs));
|
||||
}
|
||||
|
||||
public URL(String protocol, String host, int port, String path, Map<String, String> parameters) {
|
||||
super(protocol, null, null, host, port, path, parameters);
|
||||
}
|
||||
|
||||
public URL(String protocol, String username, String password, String host, int port, String path) {
|
||||
super(protocol, username, password, host, port, path, (Map<String, String>) null);
|
||||
}
|
||||
|
||||
public URL(String protocol, String username, String password, String host, int port, String path, String... pairs) {
|
||||
super(protocol, username, password, host, port, path, CollectionUtils.toStringMap(pairs));
|
||||
}
|
||||
|
||||
public URL(String protocol, String username, String password, String host, int port, String path, Map<String, String> parameters) {
|
||||
super(protocol, username, password, host, port, path, parameters);
|
||||
}
|
||||
|
||||
public static URL valueOf(String url) {
|
||||
org.apache.dubbo.common.URL result = org.apache.dubbo.common.URL.valueOf(url);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public static String encode(String value) {
|
||||
return org.apache.dubbo.common.URL.encode(value);
|
||||
}
|
||||
|
||||
public static String decode(String value) {
|
||||
return org.apache.dubbo.common.URL.decode(value);
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return super.getProtocol();
|
||||
}
|
||||
|
||||
public URL setProtocol(String protocol) {
|
||||
return new URL(protocol, super.getUsername(), super.getPassword(), super.getHost(), super.getPort(), super.getPath(), super.getParameters());
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return super.getUsername();
|
||||
}
|
||||
|
||||
public URL setUsername(String username) {
|
||||
return new URL(super.getProtocol(), username, super.getPassword(), super.getHost(), super.getPort(), super.getPath(), super.getParameters());
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return super.getPassword();
|
||||
}
|
||||
|
||||
public URL setPassword(String password) {
|
||||
return new URL(super.getProtocol(), super.getUsername(), password, super.getHost(), super.getPort(), super.getPath(), super.getParameters());
|
||||
}
|
||||
|
||||
public String getAuthority() {
|
||||
return super.getAuthority();
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return super.getHost();
|
||||
}
|
||||
|
||||
public URL setHost(String host) {
|
||||
return new URL(super.getProtocol(), super.getUsername(), super.getPassword(), host, super.getPort(), super.getPath(), super.getParameters());
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return super.getIp();
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return super.getPort();
|
||||
}
|
||||
|
||||
public URL setPort(int port) {
|
||||
return new URL(super.getProtocol(), super.getUsername(), super.getPassword(), super.getHost(), port, super.getPath(), super.getParameters());
|
||||
}
|
||||
|
||||
public int getPort(int defaultPort) {
|
||||
return super.getPort();
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return super.getAddress();
|
||||
}
|
||||
|
||||
public URL setAddress(String address) {
|
||||
org.apache.dubbo.common.URL result = super.setAddress(address);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public String getBackupAddress() {
|
||||
return super.getBackupAddress();
|
||||
}
|
||||
|
||||
public String getBackupAddress(int defaultPort) {
|
||||
return super.getBackupAddress(defaultPort);
|
||||
}
|
||||
|
||||
// public List<URL> getBackupUrls() {
|
||||
// List<org.apache.dubbo.common.URL> res = super.getBackupUrls();
|
||||
// return res.stream().map(url -> new URL(url)).collect(Collectors.toList());
|
||||
// }
|
||||
|
||||
public String getPath() {
|
||||
return super.getPath();
|
||||
}
|
||||
|
||||
public URL setPath(String path) {
|
||||
return new URL(super.getProtocol(), super.getUsername(), super.getPassword(), super.getHost(), super.getPort(), path, super.getParameters());
|
||||
}
|
||||
|
||||
public String getAbsolutePath() {
|
||||
return super.getAbsolutePath();
|
||||
}
|
||||
|
||||
public Map<String, String> getParameters() {
|
||||
return super.getParameters();
|
||||
}
|
||||
|
||||
public String getParameterAndDecoded(String key) {
|
||||
return super.getParameterAndDecoded(key);
|
||||
}
|
||||
|
||||
public String getParameterAndDecoded(String key, String defaultValue) {
|
||||
return super.decode(getParameter(key, defaultValue));
|
||||
}
|
||||
|
||||
public String getParameter(String key) {
|
||||
return super.getParameter(key);
|
||||
}
|
||||
|
||||
public String getParameter(String key, String defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public String[] getParameter(String key, String[] defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public URL getUrlParameter(String key) {
|
||||
org.apache.dubbo.common.URL result = super.getUrlParameter(key);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public double getParameter(String key, double defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public float getParameter(String key, float defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public long getParameter(String key, long defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public int getParameter(String key, int defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public short getParameter(String key, short defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public byte getParameter(String key, byte defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public float getPositiveParameter(String key, float defaultValue) {
|
||||
return super.getPositiveParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public double getPositiveParameter(String key, double defaultValue) {
|
||||
return super.getPositiveParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public long getPositiveParameter(String key, long defaultValue) {
|
||||
return super.getPositiveParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public int getPositiveParameter(String key, int defaultValue) {
|
||||
return super.getPositiveParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public short getPositiveParameter(String key, short defaultValue) {
|
||||
return super.getPositiveParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public byte getPositiveParameter(String key, byte defaultValue) {
|
||||
return super.getPositiveParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public char getParameter(String key, char defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public boolean getParameter(String key, boolean defaultValue) {
|
||||
return super.getParameter(key, defaultValue);
|
||||
}
|
||||
|
||||
public boolean hasParameter(String key) {
|
||||
return super.hasParameter(key);
|
||||
}
|
||||
|
||||
public String getMethodParameterAndDecoded(String method, String key) {
|
||||
return super.getMethodParameterAndDecoded(method, key);
|
||||
}
|
||||
|
||||
public String getMethodParameterAndDecoded(String method, String key, String defaultValue) {
|
||||
return super.getMethodParameterAndDecoded(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public String getMethodParameter(String method, String key) {
|
||||
return super.getMethodParameter(method, key);
|
||||
}
|
||||
|
||||
public String getMethodParameter(String method, String key, String defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public double getMethodParameter(String method, String key, double defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public float getMethodParameter(String method, String key, float defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public long getMethodParameter(String method, String key, long defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public int getMethodParameter(String method, String key, int defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public short getMethodParameter(String method, String key, short defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public byte getMethodParameter(String method, String key, byte defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public double getMethodPositiveParameter(String method, String key, double defaultValue) {
|
||||
return super.getMethodPositiveParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public float getMethodPositiveParameter(String method, String key, float defaultValue) {
|
||||
return super.getMethodPositiveParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public long getMethodPositiveParameter(String method, String key, long defaultValue) {
|
||||
return super.getMethodPositiveParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public int getMethodPositiveParameter(String method, String key, int defaultValue) {
|
||||
return super.getMethodPositiveParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public short getMethodPositiveParameter(String method, String key, short defaultValue) {
|
||||
return super.getMethodPositiveParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public byte getMethodPositiveParameter(String method, String key, byte defaultValue) {
|
||||
return super.getMethodPositiveParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public char getMethodParameter(String method, String key, char defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public boolean getMethodParameter(String method, String key, boolean defaultValue) {
|
||||
return super.getMethodParameter(method, key, defaultValue);
|
||||
}
|
||||
|
||||
public boolean hasMethodParameter(String method, String key) {
|
||||
return super.hasMethodParameter(method, key);
|
||||
}
|
||||
|
||||
public boolean isLocalHost() {
|
||||
return super.isLocalHost();
|
||||
}
|
||||
|
||||
public boolean isAnyHost() {
|
||||
return super.isAnyHost();
|
||||
}
|
||||
|
||||
public URL addParameterAndEncoded(String key, String value) {
|
||||
if (value == null || value.length() == 0) {
|
||||
return this;
|
||||
}
|
||||
return addParameter(key, encode(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, boolean value) {
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, char value) {
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, byte value) {
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, short value) {
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, int value) {
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, long value) {
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, float value) {
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, double value) {
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, Enum<?> value) {
|
||||
if (value == null) return this;
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, Number value) {
|
||||
if (value == null) return this;
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, CharSequence value) {
|
||||
if (value == null || value.length() == 0) return this;
|
||||
return addParameter(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
public URL addParameter(String key, String value) {
|
||||
org.apache.dubbo.common.URL result = super.addParameter(key, value);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL addParameterIfAbsent(String key, String value) {
|
||||
org.apache.dubbo.common.URL result = super.addParameterIfAbsent(key, value);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL addParameters(Map<String, String> parameters) {
|
||||
org.apache.dubbo.common.URL result = super.addParameters(parameters);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL addParametersIfAbsent(Map<String, String> parameters) {
|
||||
org.apache.dubbo.common.URL result = super.addParametersIfAbsent(parameters);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL addParameters(String... pairs) {
|
||||
org.apache.dubbo.common.URL result = super.addParameters(pairs);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL addParameterString(String query) {
|
||||
org.apache.dubbo.common.URL result = super.addParameterString(query);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL removeParameter(String key) {
|
||||
org.apache.dubbo.common.URL result = super.removeParameter(key);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL removeParameters(Collection<String> keys) {
|
||||
org.apache.dubbo.common.URL result = super.removeParameters(keys);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL removeParameters(String... keys) {
|
||||
org.apache.dubbo.common.URL result = super.removeParameters(keys);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public URL clearParameters() {
|
||||
org.apache.dubbo.common.URL result = super.clearParameters();
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public String getRawParameter(String key) {
|
||||
return super.getRawParameter(key);
|
||||
}
|
||||
|
||||
public Map<String, String> toMap() {
|
||||
return super.toMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
public String toString(String... parameters) {
|
||||
return super.toString(parameters);
|
||||
}
|
||||
|
||||
public String toIdentityString() {
|
||||
return super.toIdentityString();
|
||||
}
|
||||
|
||||
public String toIdentityString(String... parameters) {
|
||||
return super.toIdentityString(parameters);
|
||||
}
|
||||
|
||||
public String toFullString() {
|
||||
return super.toFullString();
|
||||
}
|
||||
|
||||
public String toFullString(String... parameters) {
|
||||
return super.toFullString(parameters);
|
||||
}
|
||||
|
||||
public String toParameterString() {
|
||||
return super.toParameterString();
|
||||
}
|
||||
|
||||
public String toParameterString(String... parameters) {
|
||||
return super.toParameterString(parameters);
|
||||
}
|
||||
|
||||
public java.net.URL toJavaURL() {
|
||||
return super.toJavaURL();
|
||||
}
|
||||
|
||||
public InetSocketAddress toInetSocketAddress() {
|
||||
return super.toInetSocketAddress();
|
||||
}
|
||||
|
||||
public String getServiceKey() {
|
||||
return super.getServiceKey();
|
||||
}
|
||||
|
||||
public String toServiceStringWithoutResolving() {
|
||||
return super.toServiceStringWithoutResolving();
|
||||
}
|
||||
|
||||
public String toServiceString() {
|
||||
return super.toServiceString();
|
||||
}
|
||||
|
||||
public String getServiceInterface() {
|
||||
return super.getServiceInterface();
|
||||
}
|
||||
|
||||
public URL setServiceInterface(String service) {
|
||||
org.apache.dubbo.common.URL result = super.setServiceInterface(service);
|
||||
return new URL(result);
|
||||
}
|
||||
|
||||
public org.apache.dubbo.common.URL getOriginalURL() {
|
||||
return new org.apache.dubbo.common.URL(super.getProtocol(), super.getUsername(), super.getPassword(),
|
||||
super.getHost(), super.getPort(), super.getPath(), super.getParameters());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.compiler;
|
||||
|
||||
@Deprecated
|
||||
public interface Compiler extends org.apache.dubbo.common.compiler.Compiler {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.extension;
|
||||
|
||||
@Deprecated
|
||||
public interface ExtensionFactory extends org.apache.dubbo.common.extension.ExtensionFactory {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.logger;
|
||||
|
||||
@Deprecated
|
||||
public interface LoggerAdapter extends org.apache.dubbo.common.logger.LoggerAdapter {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.serialize;
|
||||
|
||||
@Deprecated
|
||||
public interface ObjectInput extends org.apache.dubbo.common.serialize.ObjectInput {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.serialize;
|
||||
|
||||
@Deprecated
|
||||
public interface ObjectOutput extends org.apache.dubbo.common.serialize.ObjectOutput {
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.serialize;
|
||||
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
@Deprecated
|
||||
public interface Serialization extends org.apache.dubbo.common.serialize.Serialization {
|
||||
|
||||
ObjectOutput serialize(URL url, OutputStream output) throws IOException;
|
||||
|
||||
ObjectInput deserialize(URL url, InputStream input) throws IOException;
|
||||
|
||||
@Override
|
||||
default org.apache.dubbo.common.serialize.ObjectOutput serialize(org.apache.dubbo.common.URL url, OutputStream output) throws IOException {
|
||||
return this.serialize(new URL(url), output);
|
||||
}
|
||||
|
||||
@Override
|
||||
default org.apache.dubbo.common.serialize.ObjectInput deserialize(org.apache.dubbo.common.URL url, InputStream input) throws IOException {
|
||||
return this.deserialize(new URL(url), input);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.status;
|
||||
|
||||
@Deprecated
|
||||
public class Status extends org.apache.dubbo.common.status.Status {
|
||||
|
||||
public Status(Level level) {
|
||||
super(level);
|
||||
}
|
||||
|
||||
public Status(Level level, String message) {
|
||||
super(level, message);
|
||||
}
|
||||
|
||||
public Status(Level level, String message, String description) {
|
||||
super(level, message, description);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.status;
|
||||
|
||||
@Deprecated
|
||||
public interface StatusChecker extends org.apache.dubbo.common.status.StatusChecker {
|
||||
|
||||
Status check();
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.store;
|
||||
|
||||
@Deprecated
|
||||
public interface DataStore extends org.apache.dubbo.common.store.DataStore {
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.common.threadpool;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@Deprecated
|
||||
public interface ThreadPool extends org.apache.dubbo.common.threadpool.ThreadPool {
|
||||
|
||||
Executor getExecutor(com.alibaba.dubbo.common.URL url);
|
||||
|
||||
@Override
|
||||
default Executor getExecutor(URL url) {
|
||||
return getExecutor(new com.alibaba.dubbo.common.URL(url));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.config;
|
||||
|
||||
@Deprecated
|
||||
public class ProviderConfig extends org.apache.dubbo.config.ProviderConfig {
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.config.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Deprecated
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE})
|
||||
public @interface Reference {
|
||||
|
||||
Class<?> interfaceClass() default void.class;
|
||||
|
||||
String interfaceName() default "";
|
||||
|
||||
String version() default "";
|
||||
|
||||
String group() default "";
|
||||
|
||||
String url() default "";
|
||||
|
||||
String client() default "";
|
||||
|
||||
boolean generic() default false;
|
||||
|
||||
boolean injvm() default false;
|
||||
|
||||
boolean check() default true;
|
||||
|
||||
boolean init() default false;
|
||||
|
||||
boolean lazy() default false;
|
||||
|
||||
boolean stubevent() default false;
|
||||
|
||||
String reconnect() default "";
|
||||
|
||||
boolean sticky() default false;
|
||||
|
||||
String proxy() default "";
|
||||
|
||||
String stub() default "";
|
||||
|
||||
String cluster() default "";
|
||||
|
||||
int connections() default 0;
|
||||
|
||||
int callbacks() default 0;
|
||||
|
||||
String onconnect() default "";
|
||||
|
||||
String ondisconnect() default "";
|
||||
|
||||
String owner() default "";
|
||||
|
||||
String layer() default "";
|
||||
|
||||
int retries() default 0;
|
||||
|
||||
String loadbalance() default "";
|
||||
|
||||
boolean async() default false;
|
||||
|
||||
int actives() default 0;
|
||||
|
||||
boolean sent() default false;
|
||||
|
||||
String mock() default "";
|
||||
|
||||
String validation() default "";
|
||||
|
||||
int timeout() default 0;
|
||||
|
||||
String cache() default "";
|
||||
|
||||
String[] filter() default {};
|
||||
|
||||
String[] listener() default {};
|
||||
|
||||
String[] parameters() default {};
|
||||
|
||||
String application() default "";
|
||||
|
||||
String module() default "";
|
||||
|
||||
String consumer() default "";
|
||||
|
||||
String monitor() default "";
|
||||
|
||||
String[] registry() default {};
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.config.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Deprecated
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
@Inherited
|
||||
public @interface Service {
|
||||
|
||||
Class<?> interfaceClass() default void.class;
|
||||
|
||||
String interfaceName() default "";
|
||||
|
||||
String version() default "";
|
||||
|
||||
String group() default "";
|
||||
|
||||
String path() default "";
|
||||
|
||||
boolean export() default false;
|
||||
|
||||
String token() default "";
|
||||
|
||||
boolean deprecated() default false;
|
||||
|
||||
boolean dynamic() default false;
|
||||
|
||||
String accesslog() default "";
|
||||
|
||||
int executes() default 0;
|
||||
|
||||
boolean register() default false;
|
||||
|
||||
int weight() default 0;
|
||||
|
||||
String document() default "";
|
||||
|
||||
int delay() default 0;
|
||||
|
||||
String local() default "";
|
||||
|
||||
String stub() default "";
|
||||
|
||||
String cluster() default "";
|
||||
|
||||
String proxy() default "";
|
||||
|
||||
int connections() default 0;
|
||||
|
||||
int callbacks() default 0;
|
||||
|
||||
String onconnect() default "";
|
||||
|
||||
String ondisconnect() default "";
|
||||
|
||||
String owner() default "";
|
||||
|
||||
String layer() default "";
|
||||
|
||||
int retries() default 0;
|
||||
|
||||
String loadbalance() default "";
|
||||
|
||||
boolean async() default false;
|
||||
|
||||
int actives() default 0;
|
||||
|
||||
boolean sent() default false;
|
||||
|
||||
String mock() default "";
|
||||
|
||||
String validation() default "";
|
||||
|
||||
int timeout() default 0;
|
||||
|
||||
String cache() default "";
|
||||
|
||||
String[] filter() default {};
|
||||
|
||||
String[] listener() default {};
|
||||
|
||||
String[] parameters() default {};
|
||||
|
||||
String application() default "";
|
||||
|
||||
String module() default "";
|
||||
|
||||
String provider() default "";
|
||||
|
||||
String[] protocol() default {};
|
||||
|
||||
String monitor() default "";
|
||||
|
||||
String[] registry() default {};
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.config.spring.context.annotation;
|
||||
|
||||
import org.apache.dubbo.config.AbstractConfig;
|
||||
import org.apache.dubbo.config.spring.context.annotation.CompatibleDubboComponentScan;
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Deprecated
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
@EnableDubboConfig
|
||||
@CompatibleDubboComponentScan
|
||||
public @interface EnableDubbo {
|
||||
|
||||
/**
|
||||
* Base packages to scan for annotated @Service classes.
|
||||
* <p>
|
||||
* Use {@link #scanBasePackageClasses()} for a type-safe alternative to String-based
|
||||
* package names.
|
||||
*
|
||||
* @return the base packages to scan
|
||||
* @see CompatibleDubboComponentScan#basePackages()
|
||||
*/
|
||||
@AliasFor(annotation = CompatibleDubboComponentScan.class, attribute = "basePackages")
|
||||
String[] scanBasePackages() default {};
|
||||
|
||||
/**
|
||||
* Type-safe alternative to {@link #scanBasePackages()} for specifying the packages to
|
||||
* scan for annotated @Service classes. The package of each class specified will be
|
||||
* scanned.
|
||||
*
|
||||
* @return classes from the base packages to scan
|
||||
* @see CompatibleDubboComponentScan#basePackageClasses
|
||||
*/
|
||||
@AliasFor(annotation = CompatibleDubboComponentScan.class, attribute = "basePackageClasses")
|
||||
Class<?>[] scanBasePackageClasses() default {};
|
||||
|
||||
|
||||
/**
|
||||
* It indicates whether {@link AbstractConfig} binding to multiple Spring Beans.
|
||||
*
|
||||
* @return the default value is <code>false</code>
|
||||
* @see EnableDubboConfig#multiple()
|
||||
*/
|
||||
@AliasFor(annotation = EnableDubboConfig.class, attribute = "multiple")
|
||||
boolean multipleConfig() default false;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.container;
|
||||
|
||||
@Deprecated
|
||||
public interface Container extends org.apache.dubbo.container.Container {
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.monitor;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Deprecated
|
||||
public interface Monitor extends org.apache.dubbo.monitor.Monitor {
|
||||
|
||||
com.alibaba.dubbo.common.URL getUrl();
|
||||
|
||||
void collect(com.alibaba.dubbo.common.URL statistics);
|
||||
|
||||
List<com.alibaba.dubbo.common.URL> lookup(com.alibaba.dubbo.common.URL query);
|
||||
|
||||
@Override
|
||||
default void collect(URL statistics) {
|
||||
this.collect(new com.alibaba.dubbo.common.URL(statistics));
|
||||
}
|
||||
|
||||
@Override
|
||||
default List<URL> lookup(URL query) {
|
||||
return this.lookup(new com.alibaba.dubbo.common.URL(query)).stream().map(url -> url.getOriginalURL()).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.monitor;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.monitor.Monitor;
|
||||
|
||||
@Deprecated
|
||||
public interface MonitorFactory extends org.apache.dubbo.monitor.MonitorFactory {
|
||||
|
||||
Monitor getMonitor(com.alibaba.dubbo.common.URL url);
|
||||
|
||||
@Override
|
||||
default Monitor getMonitor(URL url) {
|
||||
return this.getMonitor(new com.alibaba.dubbo.common.URL(url));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.qos.command;
|
||||
|
||||
import org.apache.dubbo.qos.command.CommandContext;
|
||||
|
||||
@Deprecated
|
||||
public interface BaseCommand extends org.apache.dubbo.qos.command.BaseCommand {
|
||||
|
||||
String execute(com.alibaba.dubbo.qos.command.CommandContext commandContext, String[] args);
|
||||
|
||||
@Override
|
||||
default String execute(CommandContext commandContext, String[] args) {
|
||||
return this.execute(new com.alibaba.dubbo.qos.command.CommandContext(commandContext), args);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.qos.command;
|
||||
|
||||
@Deprecated
|
||||
public class CommandContext extends org.apache.dubbo.qos.command.CommandContext {
|
||||
|
||||
public CommandContext(org.apache.dubbo.qos.command.CommandContext context) {
|
||||
super(context.getCommandName(), context.getArgs(), context.isHttp());
|
||||
setRemote(context.getRemote());
|
||||
setOrginRequest(context.getOrginRequest());
|
||||
}
|
||||
|
||||
public CommandContext(String commandName) {
|
||||
super(commandName);
|
||||
}
|
||||
|
||||
public CommandContext(String commandName, String[] args, boolean isHttp) {
|
||||
super(commandName, args, isHttp);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.registry;
|
||||
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Deprecated
|
||||
public interface NotifyListener {
|
||||
|
||||
void notify(List<URL> urls);
|
||||
|
||||
class CompatibleNotifyListener implements NotifyListener {
|
||||
|
||||
private org.apache.dubbo.registry.NotifyListener listener;
|
||||
|
||||
public CompatibleNotifyListener(org.apache.dubbo.registry.NotifyListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notify(List<URL> urls) {
|
||||
if (listener != null) {
|
||||
listener.notify(urls.stream().map(url -> url.getOriginalURL()).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.registry;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.registry.NotifyListener;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Deprecated
|
||||
public interface Registry extends org.apache.dubbo.registry.Registry {
|
||||
|
||||
com.alibaba.dubbo.common.URL getUrl();
|
||||
|
||||
void register(com.alibaba.dubbo.common.URL url);
|
||||
|
||||
void unregister(com.alibaba.dubbo.common.URL url);
|
||||
|
||||
void subscribe(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener);
|
||||
|
||||
void unsubscribe(com.alibaba.dubbo.common.URL url, com.alibaba.dubbo.registry.NotifyListener listener);
|
||||
|
||||
List<com.alibaba.dubbo.common.URL> lookup(com.alibaba.dubbo.common.URL url);
|
||||
|
||||
@Override
|
||||
default void register(URL url) {
|
||||
this.register(new com.alibaba.dubbo.common.URL(url));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void unregister(URL url) {
|
||||
this.unregister(new com.alibaba.dubbo.common.URL(url));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void subscribe(URL url, NotifyListener listener) {
|
||||
this.subscribe(new com.alibaba.dubbo.common.URL(url),
|
||||
new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void unsubscribe(URL url, NotifyListener listener) {
|
||||
this.unsubscribe(new com.alibaba.dubbo.common.URL(url),
|
||||
new com.alibaba.dubbo.registry.NotifyListener.CompatibleNotifyListener(listener));
|
||||
}
|
||||
|
||||
@Override
|
||||
default List<URL> lookup(URL url) {
|
||||
return this.lookup(new com.alibaba.dubbo.common.URL(url)).stream().map(u -> u.getOriginalURL()).
|
||||
collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.registry;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.registry.Registry;
|
||||
|
||||
@Deprecated
|
||||
public interface RegistryFactory extends org.apache.dubbo.registry.RegistryFactory {
|
||||
|
||||
Registry getRegistry(com.alibaba.dubbo.common.URL url);
|
||||
|
||||
@Override
|
||||
default Registry getRegistry(URL url) {
|
||||
return this.getRegistry(new com.alibaba.dubbo.common.URL(url));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting;
|
||||
|
||||
@Deprecated
|
||||
public interface Channel extends org.apache.dubbo.remoting.Channel {
|
||||
|
||||
com.alibaba.dubbo.common.URL getUrl();
|
||||
|
||||
com.alibaba.dubbo.remoting.ChannelHandler getChannelHandler();
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting;
|
||||
|
||||
import org.apache.dubbo.remoting.Channel;
|
||||
import org.apache.dubbo.remoting.RemotingException;
|
||||
|
||||
@Deprecated
|
||||
public interface ChannelHandler extends org.apache.dubbo.remoting.ChannelHandler {
|
||||
|
||||
void connected(com.alibaba.dubbo.remoting.Channel channel) throws com.alibaba.dubbo.remoting.RemotingException;
|
||||
|
||||
void disconnected(com.alibaba.dubbo.remoting.Channel channel) throws com.alibaba.dubbo.remoting.RemotingException;
|
||||
|
||||
void sent(com.alibaba.dubbo.remoting.Channel channel, Object message) throws com.alibaba.dubbo.remoting.RemotingException;
|
||||
|
||||
void received(com.alibaba.dubbo.remoting.Channel channel, Object message) throws com.alibaba.dubbo.remoting.RemotingException;
|
||||
|
||||
void caught(com.alibaba.dubbo.remoting.Channel channel, Throwable exception) throws com.alibaba.dubbo.remoting.RemotingException;
|
||||
|
||||
@Override
|
||||
default void connected(Channel channel) throws RemotingException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
default void disconnected(Channel channel) throws RemotingException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
default void sent(Channel channel, Object message) throws RemotingException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
default void received(Channel channel, Object message) throws RemotingException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
default void caught(Channel channel, Throwable exception) throws RemotingException {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting;
|
||||
|
||||
@Deprecated
|
||||
public interface Codec extends org.apache.dubbo.remoting.Codec {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting;
|
||||
|
||||
@Deprecated
|
||||
public interface Codec2 extends org.apache.dubbo.remoting.Codec2 {
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.remoting.ChannelHandler;
|
||||
|
||||
@Deprecated
|
||||
public interface Dispatcher extends org.apache.dubbo.remoting.Dispatcher {
|
||||
|
||||
com.alibaba.dubbo.remoting.ChannelHandler dispatch(com.alibaba.dubbo.remoting.ChannelHandler handler,
|
||||
com.alibaba.dubbo.common.URL url);
|
||||
|
||||
@Override
|
||||
default ChannelHandler dispatch(ChannelHandler handler, URL url) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting;
|
||||
|
||||
import org.apache.dubbo.remoting.Channel;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
@Deprecated
|
||||
public class RemotingException extends org.apache.dubbo.remoting.RemotingException {
|
||||
|
||||
public RemotingException(Channel channel, String msg) {
|
||||
super(channel, msg);
|
||||
}
|
||||
|
||||
public RemotingException(InetSocketAddress localAddress, InetSocketAddress remoteAddress, String message) {
|
||||
super(localAddress, remoteAddress, message);
|
||||
}
|
||||
|
||||
public RemotingException(Channel channel, Throwable cause) {
|
||||
super(channel, cause);
|
||||
}
|
||||
|
||||
public RemotingException(InetSocketAddress localAddress, InetSocketAddress remoteAddress, Throwable cause) {
|
||||
super(localAddress, remoteAddress, cause);
|
||||
}
|
||||
|
||||
public RemotingException(Channel channel, String message, Throwable cause) {
|
||||
super(channel, message, cause);
|
||||
}
|
||||
|
||||
public RemotingException(InetSocketAddress localAddress, InetSocketAddress remoteAddress, String message, Throwable cause) {
|
||||
super(localAddress, remoteAddress, message, cause);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting;
|
||||
|
||||
@Deprecated
|
||||
public interface Transporter extends org.apache.dubbo.remoting.Transporter {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting.exchange;
|
||||
|
||||
@Deprecated
|
||||
public interface Exchanger extends org.apache.dubbo.remoting.exchange.Exchanger {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting.http;
|
||||
|
||||
@Deprecated
|
||||
public interface HttpBinder extends org.apache.dubbo.remoting.http.HttpBinder {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting.p2p;
|
||||
|
||||
@Deprecated
|
||||
public interface Networker extends org.apache.dubbo.remoting.p2p.Networker {
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting.telnet;
|
||||
|
||||
import org.apache.dubbo.remoting.Channel;
|
||||
import org.apache.dubbo.remoting.RemotingException;
|
||||
|
||||
@Deprecated
|
||||
public interface TelnetHandler extends org.apache.dubbo.remoting.telnet.TelnetHandler {
|
||||
|
||||
String telnet(com.alibaba.dubbo.remoting.Channel channel, String message) throws com.alibaba.dubbo.remoting.RemotingException;
|
||||
|
||||
@Override
|
||||
default String telnet(Channel channel, String message) throws RemotingException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.remoting.zookeeper;
|
||||
|
||||
@Deprecated
|
||||
public interface ZookeeperTransporter extends org.apache.dubbo.remoting.zookeeper.ZookeeperTransporter {
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
@Deprecated
|
||||
public interface Exporter<T> extends org.apache.dubbo.rpc.Exporter<T> {
|
||||
|
||||
Invoker<T> getInvoker();
|
||||
|
||||
class CompatibleExporter<T> implements Exporter<T> {
|
||||
|
||||
private org.apache.dubbo.rpc.Exporter<T> delegate;
|
||||
|
||||
public CompatibleExporter(org.apache.dubbo.rpc.Exporter<T> delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Invoker<T> getInvoker() {
|
||||
return new Invoker.CompatibleInvoker<>(delegate.getInvoker());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unexport() {
|
||||
delegate.unexport();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
@Deprecated
|
||||
public interface Filter extends org.apache.dubbo.rpc.Filter {
|
||||
|
||||
Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException;
|
||||
|
||||
default org.apache.dubbo.rpc.Result invoke(org.apache.dubbo.rpc.Invoker<?> invoker,
|
||||
org.apache.dubbo.rpc.Invocation invocation)
|
||||
throws org.apache.dubbo.rpc.RpcException {
|
||||
Result.CompatibleResult result = (Result.CompatibleResult) invoke(new Invoker.CompatibleInvoker<>(invoker),
|
||||
new Invocation.CompatibleInvocation(invocation));
|
||||
return result.getDelegate();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Deprecated
|
||||
public interface Invocation extends org.apache.dubbo.rpc.Invocation {
|
||||
|
||||
Invoker<?> getInvoker();
|
||||
|
||||
default org.apache.dubbo.rpc.Invocation getOriginal() {
|
||||
return null;
|
||||
}
|
||||
|
||||
class CompatibleInvocation implements Invocation {
|
||||
|
||||
private org.apache.dubbo.rpc.Invocation delegate;
|
||||
|
||||
public CompatibleInvocation(org.apache.dubbo.rpc.Invocation invocation) {
|
||||
this.delegate = invocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodName() {
|
||||
return delegate.getMethodName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getParameterTypes() {
|
||||
return delegate.getParameterTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getArguments() {
|
||||
return delegate.getArguments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttachments() {
|
||||
return delegate.getAttachments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttachment(String key) {
|
||||
return delegate.getAttachment(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttachment(String key, String defaultValue) {
|
||||
return delegate.getAttachment(key, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Invoker<?> getInvoker() {
|
||||
return new Invoker.CompatibleInvoker(delegate.getInvoker());
|
||||
}
|
||||
|
||||
public org.apache.dubbo.rpc.Invocation getOriginal() {
|
||||
return delegate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
|
||||
@Deprecated
|
||||
public interface Invoker<T> extends org.apache.dubbo.rpc.Invoker<T> {
|
||||
|
||||
Result invoke(Invocation invocation) throws RpcException;
|
||||
|
||||
default org.apache.dubbo.rpc.Invoker<T> getOriginal() {
|
||||
return null;
|
||||
}
|
||||
|
||||
class CompatibleInvoker<T> implements Invoker<T> {
|
||||
|
||||
private org.apache.dubbo.rpc.Invoker<T> invoker;
|
||||
|
||||
public CompatibleInvoker(org.apache.dubbo.rpc.Invoker<T> invoker) {
|
||||
this.invoker = invoker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getInterface() {
|
||||
return invoker.getInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result invoke(Invocation invocation) throws RpcException {
|
||||
return new Result.CompatibleResult(invoker.invoke(invocation));
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getUrl() {
|
||||
return invoker.getUrl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return invoker.isAvailable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
invoker.destroy();
|
||||
}
|
||||
|
||||
public org.apache.dubbo.rpc.Invoker<T> getOriginal() {
|
||||
return invoker;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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 com.alibaba.dubbo.rpc;
|
||||
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
|
||||
@Deprecated
|
||||
public interface InvokerListener extends org.apache.dubbo.rpc.InvokerListener {
|
||||
|
||||
void referred(com.alibaba.dubbo.rpc.Invoker<?> invoker) throws com.alibaba.dubbo.rpc.RpcException;
|
||||
|
||||
void destroyed(com.alibaba.dubbo.rpc.Invoker<?> invoker);
|
||||
|
||||
@Override
|
||||
default void referred(Invoker<?> invoker) throws RpcException {
|
||||
this.referred(new com.alibaba.dubbo.rpc.Invoker.CompatibleInvoker<>(invoker));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void destroyed(Invoker<?> invoker) {
|
||||
this.destroyed(new com.alibaba.dubbo.rpc.Invoker.CompatibleInvoker<>(invoker));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
@Deprecated
|
||||
public interface Protocol extends org.apache.dubbo.rpc.Protocol {
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
|
||||
@Deprecated
|
||||
public interface ProxyFactory extends org.apache.dubbo.rpc.ProxyFactory {
|
||||
|
||||
<T> T getProxy(com.alibaba.dubbo.rpc.Invoker<T> invoker) throws com.alibaba.dubbo.rpc.RpcException;
|
||||
|
||||
<T> T getProxy(com.alibaba.dubbo.rpc.Invoker<T> invoker, boolean generic) throws com.alibaba.dubbo.rpc.RpcException;
|
||||
|
||||
<T> com.alibaba.dubbo.rpc.Invoker<T> getInvoker(T proxy, Class<T> type, com.alibaba.dubbo.common.URL url) throws com.alibaba.dubbo.rpc.RpcException;
|
||||
|
||||
@Override
|
||||
default <T> T getProxy(Invoker<T> invoker) throws RpcException {
|
||||
return getProxy(new com.alibaba.dubbo.rpc.Invoker.CompatibleInvoker<>(invoker));
|
||||
}
|
||||
|
||||
@Override
|
||||
default <T> T getProxy(Invoker<T> invoker, boolean generic) throws RpcException {
|
||||
return getProxy(new com.alibaba.dubbo.rpc.Invoker.CompatibleInvoker<>(invoker), generic);
|
||||
}
|
||||
|
||||
@Override
|
||||
default <T> Invoker<T> getInvoker(T proxy, Class<T> type, URL url) throws RpcException {
|
||||
return getInvoker(proxy, type, new com.alibaba.dubbo.common.URL(url));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Deprecated
|
||||
public interface Result extends org.apache.dubbo.rpc.Result {
|
||||
|
||||
class CompatibleResult implements Result {
|
||||
private org.apache.dubbo.rpc.Result delegate;
|
||||
|
||||
public CompatibleResult(org.apache.dubbo.rpc.Result result) {
|
||||
this.delegate = result;
|
||||
}
|
||||
|
||||
public org.apache.dubbo.rpc.Result getDelegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return delegate.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Throwable getException() {
|
||||
return delegate.getException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasException() {
|
||||
return delegate.hasException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object recreate() throws Throwable {
|
||||
return delegate.recreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResult() {
|
||||
return delegate.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttachments() {
|
||||
return delegate.getAttachments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttachment(String key) {
|
||||
return delegate.getAttachment(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttachment(String key, String defaultValue) {
|
||||
return delegate.getAttachment(key, defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
@Deprecated
|
||||
public class RpcContext extends org.apache.dubbo.rpc.RpcContext {
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc;
|
||||
|
||||
@Deprecated
|
||||
public class RpcException extends org.apache.dubbo.rpc.RpcException {
|
||||
|
||||
public RpcException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public RpcException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public RpcException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public RpcException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public RpcException(int code) {
|
||||
super(code);
|
||||
}
|
||||
|
||||
public RpcException(int code, String message, Throwable cause) {
|
||||
super(code, message, cause);
|
||||
}
|
||||
|
||||
public RpcException(int code, String message) {
|
||||
super(code, message);
|
||||
}
|
||||
|
||||
public RpcException(int code, Throwable cause) {
|
||||
super(code, cause);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster;
|
||||
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
import org.apache.dubbo.rpc.cluster.Directory;
|
||||
|
||||
@Deprecated
|
||||
public interface Cluster extends org.apache.dubbo.rpc.cluster.Cluster {
|
||||
|
||||
<T> com.alibaba.dubbo.rpc.Invoker<T> join(com.alibaba.dubbo.rpc.cluster.Directory<T> directory) throws
|
||||
com.alibaba.dubbo.rpc.RpcException;
|
||||
|
||||
@Override
|
||||
default <T> Invoker<T> join(Directory<T> directory) throws RpcException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster;
|
||||
|
||||
@Deprecated
|
||||
public interface ConfiguratorFactory extends org.apache.dubbo.rpc.cluster.ConfiguratorFactory {
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster;
|
||||
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Deprecated
|
||||
public interface Directory<T> extends org.apache.dubbo.rpc.cluster.Directory<T> {
|
||||
|
||||
URL getUrl();
|
||||
|
||||
List<com.alibaba.dubbo.rpc.Invoker<T>> list(com.alibaba.dubbo.rpc.Invocation invocation) throws com.alibaba.dubbo.rpc.RpcException;
|
||||
|
||||
@Override
|
||||
default List<Invoker<T>> list(Invocation invocation) throws RpcException {
|
||||
List<com.alibaba.dubbo.rpc.Invoker<T>> res = this.list(new com.alibaba.dubbo.rpc.Invocation.CompatibleInvocation(invocation));
|
||||
return res.stream().map(i -> i.getOriginal()).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Deprecated
|
||||
public interface LoadBalance extends org.apache.dubbo.rpc.cluster.LoadBalance {
|
||||
|
||||
<T> com.alibaba.dubbo.rpc.Invoker<T> select(List<com.alibaba.dubbo.rpc.Invoker<T>> invokers,
|
||||
com.alibaba.dubbo.common.URL url,
|
||||
com.alibaba.dubbo.rpc.Invocation invocation) throws RpcException;
|
||||
|
||||
@Override
|
||||
default <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
|
||||
List<com.alibaba.dubbo.rpc.Invoker<T>> invs = invokers.stream().
|
||||
map(invoker -> new com.alibaba.dubbo.rpc.Invoker.CompatibleInvoker<T>(invoker)).
|
||||
collect(Collectors.toList());
|
||||
|
||||
return select(invs, new com.alibaba.dubbo.common.URL(url),
|
||||
new com.alibaba.dubbo.rpc.Invocation.CompatibleInvocation(invocation));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster;
|
||||
|
||||
@Deprecated
|
||||
public interface Merger extends org.apache.dubbo.rpc.cluster.Merger {
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Deprecated
|
||||
public interface Router extends org.apache.dubbo.rpc.cluster.Router {
|
||||
|
||||
com.alibaba.dubbo.common.URL getUrl();
|
||||
|
||||
<T> List<com.alibaba.dubbo.rpc.Invoker<T>> route(List<com.alibaba.dubbo.rpc.Invoker<T>> invokers,
|
||||
com.alibaba.dubbo.common.URL url,
|
||||
com.alibaba.dubbo.rpc.Invocation invocation)
|
||||
throws com.alibaba.dubbo.rpc.RpcException;
|
||||
|
||||
@Override
|
||||
default <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
|
||||
List<com.alibaba.dubbo.rpc.Invoker<T>> invs = invokers.stream().map(invoker ->
|
||||
new com.alibaba.dubbo.rpc.Invoker.CompatibleInvoker<T>(invoker)).
|
||||
collect(Collectors.toList());
|
||||
|
||||
List<com.alibaba.dubbo.rpc.Invoker<T>> res = this.route(invs, new com.alibaba.dubbo.common.URL(url),
|
||||
new com.alibaba.dubbo.rpc.Invocation.CompatibleInvocation(invocation));
|
||||
|
||||
return res.stream().map(inv -> inv.getOriginal()).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.rpc.cluster.Router;
|
||||
|
||||
@Deprecated
|
||||
public interface RouterFactory extends org.apache.dubbo.rpc.cluster.RouterFactory {
|
||||
|
||||
Router getRouter(com.alibaba.dubbo.common.URL url);
|
||||
|
||||
@Override
|
||||
default Router getRouter(URL url) {
|
||||
return this.getRouter(new com.alibaba.dubbo.common.URL(url));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Deprecated
|
||||
public interface RuleConverter extends org.apache.dubbo.rpc.cluster.RuleConverter {
|
||||
|
||||
List<com.alibaba.dubbo.common.URL> convert(com.alibaba.dubbo.common.URL subscribeUrl, Object source);
|
||||
|
||||
@Override
|
||||
default List<URL> convert(URL subscribeUrl, Object source) {
|
||||
return this.convert(new com.alibaba.dubbo.common.URL(subscribeUrl), source).
|
||||
stream().map(url -> url.getOriginalURL()).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.cluster.loadbalance;
|
||||
|
||||
@Deprecated
|
||||
public abstract class AbstractLoadBalance extends org.apache.dubbo.rpc.cluster.loadbalance.AbstractLoadBalance {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.protocol.rest.support;
|
||||
|
||||
@Deprecated
|
||||
public class ContentType extends org.apache.dubbo.rpc.protocol.rest.support.ContentType {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.rpc.protocol.thrift;
|
||||
|
||||
@Deprecated
|
||||
public interface ClassNameGenerator extends org.apache.dubbo.rpc.protocol.thrift.ClassNameGenerator {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.validation;
|
||||
|
||||
@Deprecated
|
||||
public interface Validation extends org.apache.dubbo.validation.Validation {
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 com.alibaba.dubbo.validation;
|
||||
|
||||
@Deprecated
|
||||
public interface Validator extends org.apache.dubbo.validation.Validator {
|
||||
}
|
||||
|
|
@ -0,0 +1,507 @@
|
|||
/*
|
||||
* 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.annotation;
|
||||
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
|
||||
import org.apache.dubbo.config.spring.ReferenceBean;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.PropertyValues;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.annotation.InjectionMetadata;
|
||||
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter;
|
||||
import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.core.PriorityOrdered;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import static org.springframework.core.BridgeMethodResolver.findBridgedMethod;
|
||||
import static org.springframework.core.BridgeMethodResolver.isVisibilityBridgeMethodPair;
|
||||
import static org.springframework.core.annotation.AnnotationUtils.findAnnotation;
|
||||
import static org.springframework.core.annotation.AnnotationUtils.getAnnotation;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.beans.factory.config.BeanPostProcessor} implementation
|
||||
* that Consumer service {@link Reference} annotated fields
|
||||
*
|
||||
* @since 2.5.7 deprecated since 2.7.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class CompatibleReferenceAnnotationBeanPostProcessor extends InstantiationAwareBeanPostProcessorAdapter
|
||||
implements MergedBeanDefinitionPostProcessor, PriorityOrdered, ApplicationContextAware, BeanClassLoaderAware,
|
||||
DisposableBean {
|
||||
|
||||
/**
|
||||
* The bean name of {@link CompatibleReferenceAnnotationBeanPostProcessor}
|
||||
*/
|
||||
public static final String BEAN_NAME = "compatibleReferenceAnnotationBeanPostProcessor";
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private ClassLoader classLoader;
|
||||
|
||||
private final ConcurrentMap<String, ReferenceInjectionMetadata> injectionMetadataCache =
|
||||
new ConcurrentHashMap<String, ReferenceInjectionMetadata>(256);
|
||||
|
||||
private final ConcurrentMap<String, ReferenceBean<?>> referenceBeansCache =
|
||||
new ConcurrentHashMap<String, ReferenceBean<?>>();
|
||||
|
||||
@Override
|
||||
public PropertyValues postProcessPropertyValues(
|
||||
PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeanCreationException {
|
||||
|
||||
InjectionMetadata metadata = findReferenceMetadata(beanName, bean.getClass(), pvs);
|
||||
try {
|
||||
metadata.inject(bean, beanName, pvs);
|
||||
} catch (BeanCreationException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
throw new BeanCreationException(beanName, "Injection of @Reference dependencies failed", ex);
|
||||
}
|
||||
return pvs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds {@link InjectionMetadata.InjectedElement} Metadata from annotated {@link Reference @Reference} fields
|
||||
*
|
||||
* @param beanClass The {@link Class} of Bean
|
||||
* @return non-null {@link List}
|
||||
*/
|
||||
private List<ReferenceFieldElement> findFieldReferenceMetadata(final Class<?> beanClass) {
|
||||
|
||||
final List<ReferenceFieldElement> elements = new LinkedList<ReferenceFieldElement>();
|
||||
|
||||
ReflectionUtils.doWithFields(beanClass, new ReflectionUtils.FieldCallback() {
|
||||
@Override
|
||||
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
|
||||
|
||||
Reference reference = getAnnotation(field, Reference.class);
|
||||
|
||||
if (reference != null) {
|
||||
|
||||
if (Modifier.isStatic(field.getModifiers())) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("@Reference annotation is not supported on static fields: " + field);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
elements.add(new ReferenceFieldElement(field, reference));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return elements;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds {@link InjectionMetadata.InjectedElement} Metadata from annotated {@link Reference @Reference} methods
|
||||
*
|
||||
* @param beanClass The {@link Class} of Bean
|
||||
* @return non-null {@link List}
|
||||
*/
|
||||
private List<ReferenceMethodElement> findMethodReferenceMetadata(final Class<?> beanClass) {
|
||||
|
||||
final List<ReferenceMethodElement> elements = new LinkedList<ReferenceMethodElement>();
|
||||
|
||||
ReflectionUtils.doWithMethods(beanClass, new ReflectionUtils.MethodCallback() {
|
||||
@Override
|
||||
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
|
||||
|
||||
Method bridgedMethod = findBridgedMethod(method);
|
||||
|
||||
if (!isVisibilityBridgeMethodPair(method, bridgedMethod)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference reference = findAnnotation(bridgedMethod, Reference.class);
|
||||
|
||||
if (reference != null && method.equals(ClassUtils.getMostSpecificMethod(method, beanClass))) {
|
||||
if (Modifier.isStatic(method.getModifiers())) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("@Reference annotation is not supported on static methods: " + method);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (method.getParameterTypes().length == 0) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("@Reference annotation should only be used on methods with parameters: " +
|
||||
method);
|
||||
}
|
||||
}
|
||||
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, beanClass);
|
||||
elements.add(new ReferenceMethodElement(method, pd, reference));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return elements;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param beanClass
|
||||
* @return
|
||||
*/
|
||||
private ReferenceInjectionMetadata buildReferenceMetadata(final Class<?> beanClass) {
|
||||
Collection<ReferenceFieldElement> fieldElements = findFieldReferenceMetadata(beanClass);
|
||||
Collection<ReferenceMethodElement> methodElements = findMethodReferenceMetadata(beanClass);
|
||||
return new ReferenceInjectionMetadata(beanClass, fieldElements, methodElements);
|
||||
|
||||
}
|
||||
|
||||
private InjectionMetadata findReferenceMetadata(String beanName, Class<?> clazz, PropertyValues pvs) {
|
||||
// Fall back to class name as cache key, for backwards compatibility with custom callers.
|
||||
String cacheKey = (StringUtils.hasLength(beanName) ? beanName : clazz.getName());
|
||||
// Quick check on the concurrent map first, with minimal locking.
|
||||
ReferenceInjectionMetadata metadata = this.injectionMetadataCache.get(cacheKey);
|
||||
if (InjectionMetadata.needsRefresh(metadata, clazz)) {
|
||||
synchronized (this.injectionMetadataCache) {
|
||||
metadata = this.injectionMetadataCache.get(cacheKey);
|
||||
if (InjectionMetadata.needsRefresh(metadata, clazz)) {
|
||||
if (metadata != null) {
|
||||
metadata.clear(pvs);
|
||||
}
|
||||
try {
|
||||
metadata = buildReferenceMetadata(clazz);
|
||||
this.injectionMetadataCache.put(cacheKey, metadata);
|
||||
} catch (NoClassDefFoundError err) {
|
||||
throw new IllegalStateException("Failed to introspect bean class [" + clazz.getName() +
|
||||
"] for reference metadata: could not find class that it depends on", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
|
||||
if (beanType != null) {
|
||||
InjectionMetadata metadata = findReferenceMetadata(beanName, beanType, null);
|
||||
metadata.checkConfigMembers(beanDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return LOWEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() throws Exception {
|
||||
|
||||
for (ReferenceBean referenceBean : referenceBeansCache.values()) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info(referenceBean + " was destroying!");
|
||||
}
|
||||
referenceBean.destroy();
|
||||
}
|
||||
|
||||
injectionMetadataCache.clear();
|
||||
referenceBeansCache.clear();
|
||||
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info(getClass() + " was destroying!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets all beans of {@link ReferenceBean}
|
||||
*
|
||||
* @return non-null {@link Collection}
|
||||
* @since 2.5.9
|
||||
*/
|
||||
public Collection<ReferenceBean<?>> getReferenceBeans() {
|
||||
return this.referenceBeansCache.values();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@link Reference} {@link InjectionMetadata} implementation
|
||||
*
|
||||
* @since 2.5.11
|
||||
*/
|
||||
private static class ReferenceInjectionMetadata extends InjectionMetadata {
|
||||
|
||||
private final Collection<ReferenceFieldElement> fieldElements;
|
||||
|
||||
private final Collection<ReferenceMethodElement> methodElements;
|
||||
|
||||
|
||||
public ReferenceInjectionMetadata(Class<?> targetClass, Collection<ReferenceFieldElement> fieldElements,
|
||||
Collection<ReferenceMethodElement> methodElements) {
|
||||
super(targetClass, combine(fieldElements, methodElements));
|
||||
this.fieldElements = fieldElements;
|
||||
this.methodElements = methodElements;
|
||||
}
|
||||
|
||||
private static <T> Collection<T> combine(Collection<? extends T>... elements) {
|
||||
List<T> allElements = new ArrayList<T>();
|
||||
for (Collection<? extends T> e : elements) {
|
||||
allElements.addAll(e);
|
||||
}
|
||||
return allElements;
|
||||
}
|
||||
|
||||
public Collection<ReferenceFieldElement> getFieldElements() {
|
||||
return fieldElements;
|
||||
}
|
||||
|
||||
public Collection<ReferenceMethodElement> getMethodElements() {
|
||||
return methodElements;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Reference} {@link Method} {@link InjectionMetadata.InjectedElement}
|
||||
*/
|
||||
private class ReferenceMethodElement extends InjectionMetadata.InjectedElement {
|
||||
|
||||
private final Method method;
|
||||
|
||||
private final Reference reference;
|
||||
|
||||
private volatile ReferenceBean<?> referenceBean;
|
||||
|
||||
protected ReferenceMethodElement(Method method, PropertyDescriptor pd, Reference reference) {
|
||||
super(method, pd);
|
||||
this.method = method;
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void inject(Object bean, String beanName, PropertyValues pvs) throws Throwable {
|
||||
|
||||
Class<?> referenceClass = pd.getPropertyType();
|
||||
|
||||
referenceBean = buildReferenceBean(reference, referenceClass);
|
||||
|
||||
ReflectionUtils.makeAccessible(method);
|
||||
|
||||
method.invoke(bean, referenceBean.getObject());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Reference} {@link Field} {@link InjectionMetadata.InjectedElement}
|
||||
*/
|
||||
private class ReferenceFieldElement extends InjectionMetadata.InjectedElement {
|
||||
|
||||
private final Field field;
|
||||
|
||||
private final Reference reference;
|
||||
|
||||
private volatile ReferenceBean<?> referenceBean;
|
||||
|
||||
protected ReferenceFieldElement(Field field, Reference reference) {
|
||||
super(field, null);
|
||||
this.field = field;
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void inject(Object bean, String beanName, PropertyValues pvs) throws Throwable {
|
||||
|
||||
Class<?> referenceClass = field.getType();
|
||||
|
||||
referenceBean = buildReferenceBean(reference, referenceClass);
|
||||
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
|
||||
field.set(bean, referenceBean.getObject());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ReferenceBean<?> buildReferenceBean(Reference reference, Class<?> referenceClass) throws Exception {
|
||||
|
||||
String referenceBeanCacheKey = generateReferenceBeanCacheKey(reference, referenceClass);
|
||||
|
||||
ReferenceBean<?> referenceBean = referenceBeansCache.get(referenceBeanCacheKey);
|
||||
|
||||
if (referenceBean == null) {
|
||||
|
||||
CompatibleReferenceBeanBuilder beanBuilder = CompatibleReferenceBeanBuilder
|
||||
.create(reference, classLoader, applicationContext)
|
||||
.interfaceClass(referenceClass);
|
||||
|
||||
referenceBean = beanBuilder.build();
|
||||
|
||||
referenceBeansCache.putIfAbsent(referenceBeanCacheKey, referenceBean);
|
||||
|
||||
}
|
||||
|
||||
return referenceBean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a cache key of {@link ReferenceBean}
|
||||
*
|
||||
* @param reference {@link Reference}
|
||||
* @param beanClass {@link Class}
|
||||
* @return
|
||||
*/
|
||||
private String generateReferenceBeanCacheKey(Reference reference, Class<?> beanClass) {
|
||||
|
||||
String interfaceName = resolveInterfaceName(reference, beanClass);
|
||||
|
||||
String key = reference.url() + "/" + interfaceName +
|
||||
"/" + reference.version() +
|
||||
"/" + reference.group();
|
||||
|
||||
Environment environment = applicationContext.getEnvironment();
|
||||
|
||||
key = environment.resolvePlaceholders(key);
|
||||
|
||||
return key;
|
||||
|
||||
}
|
||||
|
||||
private static String resolveInterfaceName(Reference reference, Class<?> beanClass)
|
||||
throws IllegalStateException {
|
||||
|
||||
String interfaceName;
|
||||
if (!"".equals(reference.interfaceName())) {
|
||||
interfaceName = reference.interfaceName();
|
||||
} else if (!void.class.equals(reference.interfaceClass())) {
|
||||
interfaceName = reference.interfaceClass().getName();
|
||||
} else if (beanClass.isInterface()) {
|
||||
interfaceName = beanClass.getName();
|
||||
} else {
|
||||
throw new IllegalStateException(
|
||||
"The @Reference undefined interfaceClass or interfaceName, and the property type "
|
||||
+ beanClass.getName() + " is not a interface.");
|
||||
}
|
||||
|
||||
return interfaceName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get {@link ReferenceBean} {@link Map} in injected field.
|
||||
*
|
||||
* @return non-null {@link Map}
|
||||
* @since 2.5.11
|
||||
*/
|
||||
public Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> getInjectedFieldReferenceBeanMap() {
|
||||
|
||||
Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> injectedElementReferenceBeanMap =
|
||||
new LinkedHashMap<InjectionMetadata.InjectedElement, ReferenceBean<?>>();
|
||||
|
||||
for (ReferenceInjectionMetadata metadata : injectionMetadataCache.values()) {
|
||||
|
||||
Collection<ReferenceFieldElement> fieldElements = metadata.getFieldElements();
|
||||
|
||||
for (ReferenceFieldElement fieldElement : fieldElements) {
|
||||
|
||||
injectedElementReferenceBeanMap.put(fieldElement, fieldElement.referenceBean);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return injectedElementReferenceBeanMap;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get {@link ReferenceBean} {@link Map} in injected method.
|
||||
*
|
||||
* @return non-null {@link Map}
|
||||
* @since 2.5.11
|
||||
*/
|
||||
public Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> getInjectedMethodReferenceBeanMap() {
|
||||
|
||||
Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> injectedElementReferenceBeanMap =
|
||||
new LinkedHashMap<InjectionMetadata.InjectedElement, ReferenceBean<?>>();
|
||||
|
||||
for (ReferenceInjectionMetadata metadata : injectionMetadataCache.values()) {
|
||||
|
||||
Collection<ReferenceMethodElement> methodElements = metadata.getMethodElements();
|
||||
|
||||
for (ReferenceMethodElement methodElement : methodElements) {
|
||||
|
||||
injectedElementReferenceBeanMap.put(methodElement, methodElement.referenceBean);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return injectedElementReferenceBeanMap;
|
||||
|
||||
}
|
||||
|
||||
private <T> T getFieldValue(Object object, String fieldName, Class<T> fieldType) {
|
||||
|
||||
Field field = ReflectionUtils.findField(object.getClass(), fieldName, fieldType);
|
||||
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
|
||||
return (T) ReflectionUtils.getField(field, object);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* 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.annotation;
|
||||
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
|
||||
import org.apache.dubbo.config.ConsumerConfig;
|
||||
import org.apache.dubbo.config.spring.ReferenceBean;
|
||||
import org.apache.dubbo.config.spring.convert.converter.StringArrayToMapConverter;
|
||||
import org.apache.dubbo.config.spring.convert.converter.StringArrayToStringConverter;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.DataBinder;
|
||||
|
||||
import static org.apache.dubbo.config.spring.util.BeanFactoryUtils.getOptionalBean;
|
||||
import static org.apache.dubbo.config.spring.util.ObjectUtils.of;
|
||||
|
||||
/**
|
||||
* {@link ReferenceBean} Builder
|
||||
*
|
||||
* @since 2.5.7 deprecated since 2.7.0
|
||||
*/
|
||||
@Deprecated
|
||||
class CompatibleReferenceBeanBuilder extends AbstractAnnotationConfigBeanBuilder<Reference, ReferenceBean> {
|
||||
|
||||
|
||||
private CompatibleReferenceBeanBuilder(Reference annotation, ClassLoader classLoader, ApplicationContext applicationContext) {
|
||||
super(annotation, classLoader, applicationContext);
|
||||
}
|
||||
|
||||
private void configureInterface(Reference reference, ReferenceBean referenceBean) {
|
||||
|
||||
Class<?> interfaceClass = reference.interfaceClass();
|
||||
|
||||
if (void.class.equals(interfaceClass)) {
|
||||
|
||||
interfaceClass = null;
|
||||
|
||||
String interfaceClassName = reference.interfaceName();
|
||||
|
||||
if (StringUtils.hasText(interfaceClassName)) {
|
||||
if (ClassUtils.isPresent(interfaceClassName, classLoader)) {
|
||||
interfaceClass = ClassUtils.resolveClassName(interfaceClassName, classLoader);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (interfaceClass == null) {
|
||||
interfaceClass = this.interfaceClass;
|
||||
}
|
||||
|
||||
Assert.isTrue(interfaceClass.isInterface(),
|
||||
"The class of field or method that was annotated @Reference is not an interface!");
|
||||
|
||||
referenceBean.setInterface(interfaceClass);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void configureConsumerConfig(Reference reference, ReferenceBean<?> referenceBean) {
|
||||
|
||||
String consumerBeanName = reference.consumer();
|
||||
|
||||
ConsumerConfig consumerConfig = getOptionalBean(applicationContext, consumerBeanName, ConsumerConfig.class);
|
||||
|
||||
referenceBean.setConsumer(consumerConfig);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReferenceBean doBuild() {
|
||||
return new ReferenceBean<Object>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preConfigureBean(Reference reference, ReferenceBean referenceBean) {
|
||||
Assert.notNull(interfaceClass, "The interface class must set first!");
|
||||
DataBinder dataBinder = new DataBinder(referenceBean);
|
||||
// Set ConversionService
|
||||
dataBinder.setConversionService(getConversionService());
|
||||
// Ignore those fields
|
||||
String[] ignoreAttributeNames = of("application", "module", "consumer", "monitor", "registry");
|
||||
// dataBinder.setDisallowedFields(ignoreAttributeNames);
|
||||
// Bind annotation attributes
|
||||
dataBinder.bind(new AnnotationPropertyValuesAdapter(reference, applicationContext.getEnvironment(), ignoreAttributeNames));
|
||||
}
|
||||
|
||||
private ConversionService getConversionService() {
|
||||
DefaultConversionService conversionService = new DefaultConversionService();
|
||||
conversionService.addConverter(new StringArrayToStringConverter());
|
||||
conversionService.addConverter(new StringArrayToMapConverter());
|
||||
return conversionService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String resolveModuleConfigBeanName(Reference annotation) {
|
||||
return annotation.module();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String resolveApplicationConfigBeanName(Reference annotation) {
|
||||
return annotation.application();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] resolveRegistryConfigBeanNames(Reference annotation) {
|
||||
return annotation.registry();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String resolveMonitorConfigBeanName(Reference annotation) {
|
||||
return annotation.monitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postConfigureBean(Reference annotation, ReferenceBean bean) throws Exception {
|
||||
|
||||
bean.setApplicationContext(applicationContext);
|
||||
|
||||
configureInterface(annotation, bean);
|
||||
|
||||
configureConsumerConfig(annotation, bean);
|
||||
|
||||
bean.afterPropertiesSet();
|
||||
|
||||
}
|
||||
|
||||
public static CompatibleReferenceBeanBuilder create(Reference annotation, ClassLoader classLoader,
|
||||
ApplicationContext applicationContext) {
|
||||
return new CompatibleReferenceBeanBuilder(annotation, classLoader, applicationContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,505 @@
|
|||
/*
|
||||
* 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.annotation;
|
||||
|
||||
import com.alibaba.dubbo.config.annotation.Service;
|
||||
|
||||
import org.apache.dubbo.common.logger.Logger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.config.spring.ServiceBean;
|
||||
import org.apache.dubbo.config.spring.context.annotation.DubboClassPathBeanDefinitionScanner;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.config.SingletonBeanRegistry;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
|
||||
import org.springframework.beans.factory.support.BeanNameGenerator;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.context.ResourceLoaderAware;
|
||||
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
|
||||
import org.springframework.context.annotation.AnnotationConfigUtils;
|
||||
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
|
||||
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.apache.dubbo.config.spring.util.ObjectUtils.of;
|
||||
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
|
||||
import static org.springframework.context.annotation.AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR;
|
||||
import static org.springframework.core.annotation.AnnotationUtils.findAnnotation;
|
||||
import static org.springframework.util.ClassUtils.resolveClassName;
|
||||
|
||||
/**
|
||||
* {@link Service} Annotation
|
||||
* {@link BeanDefinitionRegistryPostProcessor Bean Definition Registry Post Processor}
|
||||
*
|
||||
* @since 2.5.8 deprecated since 2.7.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class CompatibleServiceAnnotationBeanPostProcessor implements BeanDefinitionRegistryPostProcessor, EnvironmentAware,
|
||||
ResourceLoaderAware, BeanClassLoaderAware {
|
||||
|
||||
private static final String SEPARATOR = ":";
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final Set<String> packagesToScan;
|
||||
|
||||
private Environment environment;
|
||||
|
||||
private ResourceLoader resourceLoader;
|
||||
|
||||
private ClassLoader classLoader;
|
||||
|
||||
public CompatibleServiceAnnotationBeanPostProcessor(String... packagesToScan) {
|
||||
this(Arrays.asList(packagesToScan));
|
||||
}
|
||||
|
||||
public CompatibleServiceAnnotationBeanPostProcessor(Collection<String> packagesToScan) {
|
||||
this(new LinkedHashSet<String>(packagesToScan));
|
||||
}
|
||||
|
||||
public CompatibleServiceAnnotationBeanPostProcessor(Set<String> packagesToScan) {
|
||||
this.packagesToScan = packagesToScan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
|
||||
|
||||
Set<String> resolvedPackagesToScan = resolvePackagesToScan(packagesToScan);
|
||||
|
||||
if (!CollectionUtils.isEmpty(resolvedPackagesToScan)) {
|
||||
registerServiceBeans(resolvedPackagesToScan, registry);
|
||||
} else {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("packagesToScan is empty , ServiceBean registry will be ignored!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Registers Beans whose classes was annotated {@link Service}
|
||||
*
|
||||
* @param packagesToScan The base packages to scan
|
||||
* @param registry {@link BeanDefinitionRegistry}
|
||||
*/
|
||||
private void registerServiceBeans(Set<String> packagesToScan, BeanDefinitionRegistry registry) {
|
||||
|
||||
DubboClassPathBeanDefinitionScanner scanner =
|
||||
new DubboClassPathBeanDefinitionScanner(registry, environment, resourceLoader);
|
||||
|
||||
BeanNameGenerator beanNameGenerator = resolveBeanNameGenerator(registry);
|
||||
|
||||
scanner.setBeanNameGenerator(beanNameGenerator);
|
||||
|
||||
scanner.addIncludeFilter(new AnnotationTypeFilter(Service.class));
|
||||
|
||||
for (String packageToScan : packagesToScan) {
|
||||
|
||||
// Registers @Service Bean first
|
||||
scanner.scan(packageToScan);
|
||||
|
||||
// Finds all BeanDefinitionHolders of @Service whether @ComponentScan scans or not.
|
||||
Set<BeanDefinitionHolder> beanDefinitionHolders =
|
||||
findServiceBeanDefinitionHolders(scanner, packageToScan, registry, beanNameGenerator);
|
||||
|
||||
if (!CollectionUtils.isEmpty(beanDefinitionHolders)) {
|
||||
|
||||
for (BeanDefinitionHolder beanDefinitionHolder : beanDefinitionHolders) {
|
||||
registerServiceBean(beanDefinitionHolder, registry, scanner);
|
||||
}
|
||||
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info(beanDefinitionHolders.size() + " annotated Dubbo's @Service Components { " +
|
||||
beanDefinitionHolders +
|
||||
" } were scanned under package[" + packageToScan + "]");
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("No Spring Bean annotating Dubbo's @Service was found under package["
|
||||
+ packageToScan + "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* It'd better to use BeanNameGenerator instance that should reference
|
||||
* {@link ConfigurationClassPostProcessor#componentScanBeanNameGenerator},
|
||||
* thus it maybe a potential problem on bean name generation.
|
||||
*
|
||||
* @param registry {@link BeanDefinitionRegistry}
|
||||
* @return {@link BeanNameGenerator} instance
|
||||
* @see SingletonBeanRegistry
|
||||
* @see AnnotationConfigUtils#CONFIGURATION_BEAN_NAME_GENERATOR
|
||||
* @see ConfigurationClassPostProcessor#processConfigBeanDefinitions
|
||||
* @since 2.5.8
|
||||
*/
|
||||
private BeanNameGenerator resolveBeanNameGenerator(BeanDefinitionRegistry registry) {
|
||||
|
||||
BeanNameGenerator beanNameGenerator = null;
|
||||
|
||||
if (registry instanceof SingletonBeanRegistry) {
|
||||
SingletonBeanRegistry singletonBeanRegistry = SingletonBeanRegistry.class.cast(registry);
|
||||
beanNameGenerator = (BeanNameGenerator) singletonBeanRegistry.getSingleton(CONFIGURATION_BEAN_NAME_GENERATOR);
|
||||
}
|
||||
|
||||
if (beanNameGenerator == null) {
|
||||
|
||||
if (logger.isInfoEnabled()) {
|
||||
|
||||
logger.info("BeanNameGenerator bean can't be found in BeanFactory with name ["
|
||||
+ CONFIGURATION_BEAN_NAME_GENERATOR + "]");
|
||||
logger.info("BeanNameGenerator will be a instance of " +
|
||||
AnnotationBeanNameGenerator.class.getName() +
|
||||
" , it maybe a potential problem on bean name generation.");
|
||||
}
|
||||
|
||||
beanNameGenerator = new AnnotationBeanNameGenerator();
|
||||
|
||||
}
|
||||
|
||||
return beanNameGenerator;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a {@link Set} of {@link BeanDefinitionHolder BeanDefinitionHolders} whose bean type annotated
|
||||
* {@link Service} Annotation.
|
||||
*
|
||||
* @param scanner {@link ClassPathBeanDefinitionScanner}
|
||||
* @param packageToScan pachage to scan
|
||||
* @param registry {@link BeanDefinitionRegistry}
|
||||
* @return non-null
|
||||
* @since 2.5.8
|
||||
*/
|
||||
private Set<BeanDefinitionHolder> findServiceBeanDefinitionHolders(
|
||||
ClassPathBeanDefinitionScanner scanner, String packageToScan, BeanDefinitionRegistry registry,
|
||||
BeanNameGenerator beanNameGenerator) {
|
||||
|
||||
Set<BeanDefinition> beanDefinitions = scanner.findCandidateComponents(packageToScan);
|
||||
|
||||
Set<BeanDefinitionHolder> beanDefinitionHolders = new LinkedHashSet<BeanDefinitionHolder>(beanDefinitions.size());
|
||||
|
||||
for (BeanDefinition beanDefinition : beanDefinitions) {
|
||||
|
||||
String beanName = beanNameGenerator.generateBeanName(beanDefinition, registry);
|
||||
BeanDefinitionHolder beanDefinitionHolder = new BeanDefinitionHolder(beanDefinition, beanName);
|
||||
beanDefinitionHolders.add(beanDefinitionHolder);
|
||||
|
||||
}
|
||||
|
||||
return beanDefinitionHolders;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers {@link ServiceBean} from new annotated {@link Service} {@link BeanDefinition}
|
||||
*
|
||||
* @param beanDefinitionHolder
|
||||
* @param registry
|
||||
* @param scanner
|
||||
* @see ServiceBean
|
||||
* @see BeanDefinition
|
||||
*/
|
||||
private void registerServiceBean(BeanDefinitionHolder beanDefinitionHolder, BeanDefinitionRegistry registry,
|
||||
DubboClassPathBeanDefinitionScanner scanner) {
|
||||
|
||||
Class<?> beanClass = resolveClass(beanDefinitionHolder);
|
||||
|
||||
Service service = findAnnotation(beanClass, Service.class);
|
||||
|
||||
Class<?> interfaceClass = resolveServiceInterfaceClass(beanClass, service);
|
||||
|
||||
String annotatedServiceBeanName = beanDefinitionHolder.getBeanName();
|
||||
|
||||
AbstractBeanDefinition serviceBeanDefinition =
|
||||
buildServiceBeanDefinition(service, interfaceClass, annotatedServiceBeanName);
|
||||
|
||||
// ServiceBean Bean name
|
||||
String beanName = generateServiceBeanName(service, interfaceClass, annotatedServiceBeanName);
|
||||
|
||||
if (scanner.checkCandidate(beanName, serviceBeanDefinition)) { // check duplicated candidate bean
|
||||
registry.registerBeanDefinition(beanName, serviceBeanDefinition);
|
||||
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.warn("The BeanDefinition[" + serviceBeanDefinition +
|
||||
"] of ServiceBean has been registered with name : " + beanName);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("The Duplicated BeanDefinition[" + serviceBeanDefinition +
|
||||
"] of ServiceBean[ bean name : " + beanName +
|
||||
"] was be found , Did @CompatibleDubboComponentScan scan to same package in many times?");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the bean name of {@link ServiceBean}
|
||||
*
|
||||
* @param service
|
||||
* @param interfaceClass the class of interface annotated {@link Service}
|
||||
* @param annotatedServiceBeanName the bean name of annotated {@link Service}
|
||||
* @return ServiceBean@interfaceClassName#annotatedServiceBeanName
|
||||
* @since 2.5.9
|
||||
*/
|
||||
private String generateServiceBeanName(Service service, Class<?> interfaceClass, String annotatedServiceBeanName) {
|
||||
|
||||
StringBuilder beanNameBuilder = new StringBuilder(ServiceBean.class.getSimpleName());
|
||||
|
||||
beanNameBuilder.append(SEPARATOR).append(annotatedServiceBeanName);
|
||||
|
||||
String interfaceClassName = interfaceClass.getName();
|
||||
|
||||
beanNameBuilder.append(SEPARATOR).append(interfaceClassName);
|
||||
|
||||
String version = service.version();
|
||||
|
||||
if (StringUtils.hasText(version)) {
|
||||
beanNameBuilder.append(SEPARATOR).append(version);
|
||||
}
|
||||
|
||||
String group = service.group();
|
||||
|
||||
if (StringUtils.hasText(group)) {
|
||||
beanNameBuilder.append(SEPARATOR).append(group);
|
||||
}
|
||||
|
||||
return beanNameBuilder.toString();
|
||||
|
||||
}
|
||||
|
||||
private Class<?> resolveServiceInterfaceClass(Class<?> annotatedServiceBeanClass, Service service) {
|
||||
|
||||
Class<?> interfaceClass = service.interfaceClass();
|
||||
|
||||
if (void.class.equals(interfaceClass)) {
|
||||
|
||||
interfaceClass = null;
|
||||
|
||||
String interfaceClassName = service.interfaceName();
|
||||
|
||||
if (StringUtils.hasText(interfaceClassName)) {
|
||||
if (ClassUtils.isPresent(interfaceClassName, classLoader)) {
|
||||
interfaceClass = resolveClassName(interfaceClassName, classLoader);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (interfaceClass == null) {
|
||||
|
||||
Class<?>[] allInterfaces = annotatedServiceBeanClass.getInterfaces();
|
||||
|
||||
if (allInterfaces.length > 0) {
|
||||
interfaceClass = allInterfaces[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Assert.notNull(interfaceClass,
|
||||
"@Service interfaceClass() or interfaceName() or interface class must be present!");
|
||||
|
||||
Assert.isTrue(interfaceClass.isInterface(),
|
||||
"The type that was annotated @Service is not an interface!");
|
||||
|
||||
return interfaceClass;
|
||||
}
|
||||
|
||||
private Class<?> resolveClass(BeanDefinitionHolder beanDefinitionHolder) {
|
||||
|
||||
BeanDefinition beanDefinition = beanDefinitionHolder.getBeanDefinition();
|
||||
|
||||
return resolveClass(beanDefinition);
|
||||
|
||||
}
|
||||
|
||||
private Class<?> resolveClass(BeanDefinition beanDefinition) {
|
||||
|
||||
String beanClassName = beanDefinition.getBeanClassName();
|
||||
|
||||
return resolveClassName(beanClassName, classLoader);
|
||||
|
||||
}
|
||||
|
||||
private Set<String> resolvePackagesToScan(Set<String> packagesToScan) {
|
||||
Set<String> resolvedPackagesToScan = new LinkedHashSet<String>(packagesToScan.size());
|
||||
for (String packageToScan : packagesToScan) {
|
||||
if (StringUtils.hasText(packageToScan)) {
|
||||
String resolvedPackageToScan = environment.resolvePlaceholders(packageToScan.trim());
|
||||
resolvedPackagesToScan.add(resolvedPackageToScan);
|
||||
}
|
||||
}
|
||||
return resolvedPackagesToScan;
|
||||
}
|
||||
|
||||
private AbstractBeanDefinition buildServiceBeanDefinition(Service service, Class<?> interfaceClass,
|
||||
String annotatedServiceBeanName) {
|
||||
|
||||
BeanDefinitionBuilder builder = rootBeanDefinition(ServiceBean.class);
|
||||
|
||||
AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
|
||||
|
||||
MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
|
||||
|
||||
String[] ignoreAttributeNames = of("provider", "monitor", "application", "module", "registry", "protocol", "interface");
|
||||
|
||||
propertyValues.addPropertyValues(new AnnotationPropertyValuesAdapter(service, environment, ignoreAttributeNames));
|
||||
|
||||
// References "ref" property to annotated-@Service Bean
|
||||
addPropertyReference(builder, "ref", annotatedServiceBeanName);
|
||||
// Set interface
|
||||
builder.addPropertyValue("interface", interfaceClass.getName());
|
||||
|
||||
/**
|
||||
* Add {@link org.apache.dubbo.config.ProviderConfig} Bean reference
|
||||
*/
|
||||
String providerConfigBeanName = service.provider();
|
||||
if (StringUtils.hasText(providerConfigBeanName)) {
|
||||
addPropertyReference(builder, "provider", providerConfigBeanName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add {@link org.apache.dubbo.config.MonitorConfig} Bean reference
|
||||
*/
|
||||
String monitorConfigBeanName = service.monitor();
|
||||
if (StringUtils.hasText(monitorConfigBeanName)) {
|
||||
addPropertyReference(builder, "monitor", monitorConfigBeanName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add {@link org.apache.dubbo.config.ApplicationConfig} Bean reference
|
||||
*/
|
||||
String applicationConfigBeanName = service.application();
|
||||
if (StringUtils.hasText(applicationConfigBeanName)) {
|
||||
addPropertyReference(builder, "application", applicationConfigBeanName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add {@link org.apache.dubbo.config.ModuleConfig} Bean reference
|
||||
*/
|
||||
String moduleConfigBeanName = service.module();
|
||||
if (StringUtils.hasText(moduleConfigBeanName)) {
|
||||
addPropertyReference(builder, "module", moduleConfigBeanName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add {@link org.apache.dubbo.config.RegistryConfig} Bean reference
|
||||
*/
|
||||
String[] registryConfigBeanNames = service.registry();
|
||||
|
||||
List<RuntimeBeanReference> registryRuntimeBeanReferences = toRuntimeBeanReferences(registryConfigBeanNames);
|
||||
|
||||
if (!registryRuntimeBeanReferences.isEmpty()) {
|
||||
builder.addPropertyValue("registries", registryRuntimeBeanReferences);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add {@link org.apache.dubbo.config.ProtocolConfig} Bean reference
|
||||
*/
|
||||
String[] protocolConfigBeanNames = service.protocol();
|
||||
|
||||
List<RuntimeBeanReference> protocolRuntimeBeanReferences = toRuntimeBeanReferences(protocolConfigBeanNames);
|
||||
|
||||
if (!protocolRuntimeBeanReferences.isEmpty()) {
|
||||
builder.addPropertyValue("protocols", protocolRuntimeBeanReferences);
|
||||
}
|
||||
|
||||
return builder.getBeanDefinition();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private ManagedList<RuntimeBeanReference> toRuntimeBeanReferences(String... beanNames) {
|
||||
|
||||
ManagedList<RuntimeBeanReference> runtimeBeanReferences = new ManagedList<RuntimeBeanReference>();
|
||||
|
||||
if (!ObjectUtils.isEmpty(beanNames)) {
|
||||
|
||||
for (String beanName : beanNames) {
|
||||
|
||||
String resolvedBeanName = environment.resolvePlaceholders(beanName);
|
||||
|
||||
runtimeBeanReferences.add(new RuntimeBeanReference(resolvedBeanName));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return runtimeBeanReferences;
|
||||
|
||||
}
|
||||
|
||||
private void addPropertyReference(BeanDefinitionBuilder builder, String propertyName, String beanName) {
|
||||
String resolvedBeanName = environment.resolvePlaceholders(beanName);
|
||||
builder.addPropertyReference(propertyName, resolvedBeanName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceLoader(ResourceLoader resourceLoader) {
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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.context.annotation;
|
||||
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @since 2.5.7 deprecated since 2.7.0
|
||||
*/
|
||||
@Deprecated
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Import(CompatibleDubboComponentScanRegistrar.class)
|
||||
public @interface CompatibleDubboComponentScan {
|
||||
|
||||
/**
|
||||
* Alias for the {@link #basePackages()} attribute. Allows for more concise annotation
|
||||
* declarations e.g.: {@code @CompatibleDubboComponentScan("org.my.pkg")} instead of
|
||||
* {@code @CompatibleDubboComponentScan(basePackages="org.my.pkg")}.
|
||||
*
|
||||
* @return the base packages to scan
|
||||
*/
|
||||
String[] value() default {};
|
||||
|
||||
/**
|
||||
* Base packages to scan for annotated @Service classes. {@link #value()} is an
|
||||
* alias for (and mutually exclusive with) this attribute.
|
||||
* <p>
|
||||
* Use {@link #basePackageClasses()} for a type-safe alternative to String-based
|
||||
* package names.
|
||||
*
|
||||
* @return the base packages to scan
|
||||
*/
|
||||
String[] basePackages() default {};
|
||||
|
||||
/**
|
||||
* Type-safe alternative to {@link #basePackages()} for specifying the packages to
|
||||
* scan for annotated @Service classes. The package of each class specified will be
|
||||
* scanned.
|
||||
*
|
||||
* @return classes from the base packages to scan
|
||||
*/
|
||||
Class<?>[] basePackageClasses() default {};
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* 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.context.annotation;
|
||||
|
||||
import org.apache.dubbo.config.spring.beans.factory.annotation.CompatibleReferenceAnnotationBeanPostProcessor;
|
||||
import org.apache.dubbo.config.spring.beans.factory.annotation.CompatibleServiceAnnotationBeanPostProcessor;
|
||||
import org.apache.dubbo.config.spring.util.BeanRegistrar;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
|
||||
|
||||
/**
|
||||
* Dubbo Bean Registrar
|
||||
* @see ImportBeanDefinitionRegistrar
|
||||
* @see CompatibleServiceAnnotationBeanPostProcessor
|
||||
* @see CompatibleReferenceAnnotationBeanPostProcessor
|
||||
* @since 2.5.7 deprecated since 2.7.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class CompatibleDubboComponentScanRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
||||
|
||||
Set<String> packagesToScan = getPackagesToScan(importingClassMetadata);
|
||||
|
||||
registerServiceAnnotationBeanPostProcessor(packagesToScan, registry);
|
||||
|
||||
registerReferenceAnnotationBeanPostProcessor(registry);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers {@link CompatibleServiceAnnotationBeanPostProcessor}
|
||||
*
|
||||
* @param packagesToScan packages to scan without resolving placeholders
|
||||
* @param registry {@link BeanDefinitionRegistry}
|
||||
* @since 2.5.8 deprecated since 2.7.0
|
||||
*/
|
||||
private void registerServiceAnnotationBeanPostProcessor(Set<String> packagesToScan, BeanDefinitionRegistry registry) {
|
||||
|
||||
BeanDefinitionBuilder builder = rootBeanDefinition(CompatibleServiceAnnotationBeanPostProcessor.class);
|
||||
builder.addConstructorArgValue(packagesToScan);
|
||||
builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
|
||||
BeanDefinitionReaderUtils.registerWithGeneratedName(beanDefinition, registry);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers {@link CompatibleReferenceAnnotationBeanPostProcessor} into {@link BeanFactory}
|
||||
*
|
||||
* @param registry {@link BeanDefinitionRegistry}
|
||||
*/
|
||||
private void registerReferenceAnnotationBeanPostProcessor(BeanDefinitionRegistry registry) {
|
||||
|
||||
// Register @Reference Annotation Bean Processor
|
||||
BeanRegistrar.registerInfrastructureBean(registry,
|
||||
CompatibleReferenceAnnotationBeanPostProcessor.BEAN_NAME, CompatibleReferenceAnnotationBeanPostProcessor.class);
|
||||
|
||||
}
|
||||
|
||||
private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
|
||||
AnnotationAttributes attributes = AnnotationAttributes.fromMap(
|
||||
metadata.getAnnotationAttributes(CompatibleDubboComponentScan.class.getName()));
|
||||
String[] basePackages = attributes.getStringArray("basePackages");
|
||||
Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
|
||||
String[] value = attributes.getStringArray("value");
|
||||
// Appends value array attributes
|
||||
Set<String> packagesToScan = new LinkedHashSet<String>(Arrays.asList(value));
|
||||
packagesToScan.addAll(Arrays.asList(basePackages));
|
||||
for (Class<?> basePackageClass : basePackageClasses) {
|
||||
packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
|
||||
}
|
||||
if (packagesToScan.isEmpty()) {
|
||||
return Collections.singleton(ClassUtils.getPackageName(metadata.getClassName()));
|
||||
}
|
||||
return packagesToScan;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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.schema;
|
||||
|
||||
import org.apache.dubbo.config.spring.AnnotationBean;
|
||||
|
||||
import org.apache.dubbo.config.spring.beans.factory.annotation.CompatibleReferenceAnnotationBeanPostProcessor;
|
||||
import org.apache.dubbo.config.spring.beans.factory.annotation.CompatibleServiceAnnotationBeanPostProcessor;
|
||||
|
||||
import org.apache.dubbo.config.spring.util.BeanRegistrar;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
|
||||
import static org.springframework.util.StringUtils.trimArrayElements;
|
||||
|
||||
/**
|
||||
* {@link AnnotationBean} {@link BeanDefinitionParser}
|
||||
*
|
||||
* @see CompatibleServiceAnnotationBeanPostProcessor
|
||||
* @see CompatibleReferenceAnnotationBeanPostProcessor
|
||||
* @since 2.5.9 deprecated since 2.7.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class CompatibleAnnotationBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
/**
|
||||
* parse
|
||||
* <prev>
|
||||
* <dubbo:annotation package="" />
|
||||
* </prev>
|
||||
*
|
||||
* @param element
|
||||
* @param parserContext
|
||||
* @param builder
|
||||
*/
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
|
||||
String packageToScan = element.getAttribute("package");
|
||||
|
||||
String[] packagesToScan = trimArrayElements(commaDelimitedListToStringArray(packageToScan));
|
||||
|
||||
builder.addConstructorArgValue(packagesToScan);
|
||||
|
||||
builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
|
||||
// Registers CompatibleReferenceAnnotationBeanPostProcessor
|
||||
registerReferenceAnnotationBeanPostProcessor(parserContext.getRegistry());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldGenerateIdAsFallback() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers {@link CompatibleReferenceAnnotationBeanPostProcessor} into {@link BeanFactory}
|
||||
*
|
||||
* @param registry {@link BeanDefinitionRegistry}
|
||||
*/
|
||||
private void registerReferenceAnnotationBeanPostProcessor(BeanDefinitionRegistry registry) {
|
||||
|
||||
// Register @Reference Annotation Bean Processor
|
||||
BeanRegistrar.registerInfrastructureBean(registry,
|
||||
CompatibleReferenceAnnotationBeanPostProcessor.BEAN_NAME, CompatibleReferenceAnnotationBeanPostProcessor.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return CompatibleServiceAnnotationBeanPostProcessor.class;
|
||||
}
|
||||
|
||||
}
|
||||
86
dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/CacheTest.java
vendored
Normal file
86
dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/CacheTest.java
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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.compatible.cache;
|
||||
|
||||
import com.alibaba.dubbo.cache.Cache;
|
||||
import com.alibaba.dubbo.cache.CacheFactory;
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
import com.alibaba.dubbo.rpc.Invocation;
|
||||
import com.alibaba.dubbo.rpc.Invoker;
|
||||
|
||||
import org.apache.dubbo.rpc.RpcInvocation;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CacheTest {
|
||||
|
||||
@Test
|
||||
public void testCacheFactory() {
|
||||
URL url = URL.valueOf("test://test:11/test?cache=jacache&.cache.write.expire=1");
|
||||
CacheFactory cacheFactory = new MyCacheFactory();
|
||||
Invocation invocation = new NullInvocation();
|
||||
Cache cache = cacheFactory.getCache(url, invocation);
|
||||
cache.put("testKey", "testValue");
|
||||
|
||||
org.apache.dubbo.cache.CacheFactory factory = cacheFactory;
|
||||
org.apache.dubbo.common.URL u = org.apache.dubbo.common.URL.valueOf("test://test:11/test?cache=jacache&.cache.write.expire=1");
|
||||
org.apache.dubbo.rpc.Invocation inv = new RpcInvocation();
|
||||
org.apache.dubbo.cache.Cache c = factory.getCache(u, inv);
|
||||
String v = (String) c.get("testKey");
|
||||
Assert.assertEquals("testValue", v);
|
||||
}
|
||||
|
||||
static class NullInvocation implements Invocation {
|
||||
@Override
|
||||
public String getMethodName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getParameterTypes() {
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getArguments() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttachments() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttachment(String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttachment(String key, String defaultValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Invoker<?> getInvoker() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
42
dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCache.java
vendored
Normal file
42
dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCache.java
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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.compatible.cache;
|
||||
|
||||
import com.alibaba.dubbo.cache.Cache;
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MyCache implements Cache {
|
||||
|
||||
private Map<Object, Object> map = new HashMap<Object, Object>();
|
||||
|
||||
public MyCache(URL url) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(Object key, Object value) {
|
||||
map.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(Object key) {
|
||||
return map.get(key);
|
||||
}
|
||||
}
|
||||
30
dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCacheFactory.java
vendored
Normal file
30
dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCacheFactory.java
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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.compatible.cache;
|
||||
|
||||
import com.alibaba.dubbo.cache.Cache;
|
||||
import com.alibaba.dubbo.cache.support.AbstractCacheFactory;
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
|
||||
public class MyCacheFactory extends AbstractCacheFactory {
|
||||
|
||||
@Override
|
||||
protected Cache createCache(URL url) {
|
||||
return new MyCache(url);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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.compatible.common.extension;
|
||||
|
||||
import org.apache.dubbo.common.extension.ExtensionFactory;
|
||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class ExtensionTest {
|
||||
|
||||
@Test
|
||||
public void testExtensionFactory() {
|
||||
try {
|
||||
ExtensionFactory factory = ExtensionLoader.getExtensionLoader(ExtensionFactory.class).getExtension("myfactory");
|
||||
Assert.assertTrue(factory instanceof ExtensionFactory);
|
||||
Assert.assertTrue(factory instanceof com.alibaba.dubbo.common.extension.ExtensionFactory);
|
||||
Assert.assertTrue(factory instanceof MyExtensionFactory);
|
||||
|
||||
ExtensionFactory spring = ExtensionLoader.getExtensionLoader(ExtensionFactory.class).getExtension("spring");
|
||||
Assert.assertTrue(spring instanceof ExtensionFactory);
|
||||
Assert.assertFalse(spring instanceof com.alibaba.dubbo.common.extension.ExtensionFactory);
|
||||
} catch (IllegalArgumentException expected) {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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.compatible.common.extension;
|
||||
|
||||
import com.alibaba.dubbo.common.extension.ExtensionFactory;
|
||||
|
||||
public class MyExtensionFactory implements ExtensionFactory {
|
||||
|
||||
@Override
|
||||
public <T> T getExtension(Class<T> type, String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* 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.compatible.echo;
|
||||
|
||||
import com.alibaba.dubbo.rpc.service.EchoService;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||
import org.apache.dubbo.compatible.service.DemoService;
|
||||
import org.apache.dubbo.compatible.service.DemoServiceImpl;
|
||||
import org.apache.dubbo.rpc.Exporter;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.Protocol;
|
||||
import org.apache.dubbo.rpc.ProxyFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class EchoServiceTest {
|
||||
|
||||
@Test
|
||||
public void testEcho() {
|
||||
DemoService server = new DemoServiceImpl();
|
||||
ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
|
||||
Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
|
||||
URL url = URL.valueOf("dubbo://127.0.0.1:5342/" + DemoService.class.getName() + "?version=1.0.0");
|
||||
Exporter<DemoService> exporter = protocol.export(proxyFactory.getInvoker(server, DemoService.class, url));
|
||||
Invoker<DemoService> invoker = protocol.refer(DemoService.class, url);
|
||||
EchoService client = (EchoService) proxyFactory.getProxy(invoker);
|
||||
Object result = client.$echo("haha");
|
||||
Assert.assertEquals("haha", result);
|
||||
|
||||
org.apache.dubbo.rpc.service.EchoService newClient = (org.apache.dubbo.rpc.service.EchoService) proxyFactory.getProxy(invoker);
|
||||
Object res = newClient.$echo("hehe");
|
||||
Assert.assertEquals("hehe", res);
|
||||
invoker.destroy();
|
||||
exporter.unexport();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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.compatible.filter;
|
||||
|
||||
import org.apache.dubbo.compatible.service.MockInvocation;
|
||||
import org.apache.dubbo.rpc.Filter;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.Result;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class FilterTest {
|
||||
|
||||
Filter myFilter = new MyFilter();
|
||||
|
||||
@Test
|
||||
public void testInvokeException() {
|
||||
try {
|
||||
Invoker<FilterTest> invoker = new MyInvoker<FilterTest>(null);
|
||||
Invocation invocation = new MockInvocation("aa");
|
||||
myFilter.invoke(invoker, invocation);
|
||||
fail();
|
||||
} catch (RpcException e) {
|
||||
Assert.assertTrue(e.getMessage().contains("arg0 illegal"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefault() {
|
||||
Invoker<FilterTest> invoker = new MyInvoker<FilterTest>(null);
|
||||
Invocation invocation = new MockInvocation("bbb");
|
||||
Result res = myFilter.invoke(invoker, invocation);
|
||||
System.out.println(res);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tear() {
|
||||
Assert.assertEquals(2, MyFilter.count);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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.compatible.filter;
|
||||
|
||||
import com.alibaba.dubbo.rpc.Filter;
|
||||
import com.alibaba.dubbo.rpc.Invocation;
|
||||
import com.alibaba.dubbo.rpc.Invoker;
|
||||
import com.alibaba.dubbo.rpc.Result;
|
||||
import com.alibaba.dubbo.rpc.RpcException;
|
||||
|
||||
|
||||
public class MyFilter implements Filter {
|
||||
|
||||
public static int count = 0;
|
||||
|
||||
@Override
|
||||
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
|
||||
count++;
|
||||
|
||||
if (invocation.getArguments()[0].equals("aa")) {
|
||||
throw new RpcException(new IllegalArgumentException("arg0 illegal"));
|
||||
}
|
||||
|
||||
Result tmp = invoker.invoke(invocation);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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.compatible.filter;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.compatible.service.DemoService;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.Result;
|
||||
import org.apache.dubbo.rpc.RpcException;
|
||||
import org.apache.dubbo.rpc.RpcResult;
|
||||
|
||||
public class MyInvoker<T> implements Invoker<T> {
|
||||
|
||||
URL url;
|
||||
Class<T> type;
|
||||
boolean hasException = false;
|
||||
|
||||
public MyInvoker(URL url) {
|
||||
this.url = url;
|
||||
type = (Class<T>) DemoService.class;
|
||||
}
|
||||
|
||||
public MyInvoker(URL url, boolean hasException) {
|
||||
this.url = url;
|
||||
type = (Class<T>) DemoService.class;
|
||||
this.hasException = hasException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<T> getInterface() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public URL getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Result invoke(Invocation invocation) throws RpcException {
|
||||
RpcResult result = new RpcResult();
|
||||
if (hasException == false) {
|
||||
result.setValue("alibaba");
|
||||
return result;
|
||||
} else {
|
||||
result.setException(new RuntimeException("mocked exception"));
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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.compatible.generic;
|
||||
|
||||
import com.alibaba.dubbo.rpc.service.GenericService;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||
import org.apache.dubbo.compatible.service.DemoService;
|
||||
import org.apache.dubbo.compatible.service.DemoServiceImpl;
|
||||
import org.apache.dubbo.rpc.Exporter;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.Protocol;
|
||||
import org.apache.dubbo.rpc.ProxyFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class GenericServiceTest {
|
||||
|
||||
@Test
|
||||
public void testGeneric() {
|
||||
DemoService server = new DemoServiceImpl();
|
||||
ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
|
||||
Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
|
||||
URL url = URL.valueOf("dubbo://127.0.0.1:5342/" + DemoService.class.getName() + "?version=1.0.0");
|
||||
Exporter<DemoService> exporter = protocol.export(proxyFactory.getInvoker(server, DemoService.class, url));
|
||||
Invoker<DemoService> invoker = protocol.refer(DemoService.class, url);
|
||||
|
||||
GenericService client = (GenericService) proxyFactory.getProxy(invoker, true);
|
||||
Object result = client.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"haha"});
|
||||
Assert.assertEquals("hello haha", result);
|
||||
|
||||
org.apache.dubbo.rpc.service.GenericService newClient = (org.apache.dubbo.rpc.service.GenericService) proxyFactory.getProxy(invoker, true);
|
||||
Object res = newClient.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"hehe"});
|
||||
Assert.assertEquals("hello hehe", res);
|
||||
invoker.destroy();
|
||||
exporter.unexport();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGeneric2() {
|
||||
DemoService server = new DemoServiceImpl();
|
||||
ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
|
||||
Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
|
||||
URL url = URL.valueOf("dubbo://127.0.0.1:5342/" + DemoService.class.getName() + "?version=1.0.0&generic=true");
|
||||
Exporter<DemoService> exporter = protocol.export(proxyFactory.getInvoker(server, DemoService.class, url));
|
||||
Invoker<GenericService> invoker = protocol.refer(GenericService.class, url);
|
||||
|
||||
GenericService client = proxyFactory.getProxy(invoker, true);
|
||||
Object result = client.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"haha"});
|
||||
Assert.assertEquals("hello haha", result);
|
||||
|
||||
Invoker<DemoService> invoker2 = protocol.refer(DemoService.class, url);
|
||||
|
||||
GenericService client2 = (GenericService) proxyFactory.getProxy(invoker2, true);
|
||||
Object result2 = client2.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"haha"});
|
||||
Assert.assertEquals("hello haha", result2);
|
||||
|
||||
invoker.destroy();
|
||||
exporter.unexport();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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.compatible.serialization;
|
||||
|
||||
import com.alibaba.dubbo.common.serialize.ObjectInput;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class MyObjectInput implements ObjectInput {
|
||||
|
||||
private final BufferedReader reader;
|
||||
|
||||
public MyObjectInput(InputStream inputStream) {
|
||||
this.reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object readObject() throws IOException, ClassNotFoundException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T readObject(Class<T> cls, Type type) throws IOException, ClassNotFoundException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean readBool() throws IOException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte readByte() throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short readShort() throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int readInt() throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long readLong() throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float readFloat() throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double readDouble() throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String readUTF() throws IOException {
|
||||
return reader.readLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] readBytes() throws IOException {
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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.compatible.serialization;
|
||||
|
||||
import com.alibaba.dubbo.common.serialize.ObjectOutput;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
public class MyObjectOutput implements ObjectOutput {
|
||||
|
||||
private final BufferedWriter writer;
|
||||
|
||||
public MyObjectOutput(OutputStream outputStream) {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(outputStream));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeObject(Object obj) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBool(boolean v) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeByte(byte v) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeShort(short v) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeInt(int v) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeLong(long v) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeFloat(float v) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDouble(double v) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeUTF(String v) throws IOException {
|
||||
writer.write(v);
|
||||
writer.write('\n');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(byte[] v) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(byte[] v, int off, int len) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBuffer() throws IOException {
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.compatible.serialization;
|
||||
|
||||
import com.alibaba.dubbo.common.URL;
|
||||
import com.alibaba.dubbo.common.serialize.ObjectInput;
|
||||
import com.alibaba.dubbo.common.serialize.ObjectOutput;
|
||||
import com.alibaba.dubbo.common.serialize.Serialization;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class MySerialization implements Serialization {
|
||||
|
||||
@Override
|
||||
public ObjectOutput serialize(URL url, OutputStream output) throws IOException {
|
||||
return new MyObjectOutput(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectInput deserialize(URL url, InputStream input) throws IOException {
|
||||
return new MyObjectInput(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getContentTypeId() {
|
||||
return 101;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return "x-application/my";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* 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.compatible.serialization;
|
||||
|
||||
import org.apache.dubbo.common.serialize.ObjectInput;
|
||||
import org.apache.dubbo.common.serialize.ObjectOutput;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class SerializationTest {
|
||||
|
||||
private MySerialization mySerialization;
|
||||
|
||||
private MyObjectOutput myObjectOutput;
|
||||
private MyObjectInput myObjectInput;
|
||||
private ByteArrayOutputStream byteArrayOutputStream;
|
||||
private ByteArrayInputStream byteArrayInputStream;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
this.mySerialization = new MySerialization();
|
||||
|
||||
this.byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
this.myObjectOutput = new MyObjectOutput(byteArrayOutputStream);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContentType() {
|
||||
assertThat(mySerialization.getContentType(), is("x-application/my"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContentTypeId() {
|
||||
assertThat(mySerialization.getContentTypeId(), is((byte) 101));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testObjectOutput() throws IOException {
|
||||
ObjectOutput objectOutput = mySerialization.serialize(null, mock(OutputStream.class));
|
||||
assertThat(objectOutput, Matchers.<ObjectOutput>instanceOf(MyObjectOutput.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testObjectInput() throws IOException {
|
||||
ObjectInput objectInput = mySerialization.deserialize(null, mock(InputStream.class));
|
||||
assertThat(objectInput, Matchers.<ObjectInput>instanceOf(MyObjectInput.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteUTF() throws IOException {
|
||||
myObjectOutput.writeUTF("Pace");
|
||||
myObjectOutput.writeUTF("和平");
|
||||
myObjectOutput.writeUTF(" Мир");
|
||||
flushToInput();
|
||||
|
||||
assertThat(myObjectInput.readUTF(), CoreMatchers.is("Pace"));
|
||||
assertThat(myObjectInput.readUTF(), CoreMatchers.is("和平"));
|
||||
assertThat(myObjectInput.readUTF(), CoreMatchers.is(" Мир"));
|
||||
}
|
||||
|
||||
private void flushToInput() throws IOException {
|
||||
this.myObjectOutput.flushBuffer();
|
||||
this.byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
||||
this.myObjectInput = new MyObjectInput(byteArrayInputStream);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.compatible.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CustomArgument implements Serializable {
|
||||
|
||||
Type type;
|
||||
String name;
|
||||
|
||||
public CustomArgument() {
|
||||
}
|
||||
public CustomArgument(Type type, String name) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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.compatible.service;
|
||||
|
||||
public interface DemoService {
|
||||
String sayHello(String name);
|
||||
|
||||
long timestamp();
|
||||
|
||||
String getThreadName();
|
||||
|
||||
int getSize(String[] strs);
|
||||
|
||||
int getSize(Object[] os);
|
||||
|
||||
Object invoke(String service, String method) throws Exception;
|
||||
|
||||
int stringLength(String str);
|
||||
|
||||
Type enumlength(Type... types);
|
||||
|
||||
// Type enumlength(Type type);
|
||||
|
||||
String get(CustomArgument arg1);
|
||||
|
||||
byte getbyte(byte arg);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* 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.compatible.service;
|
||||
|
||||
import org.apache.dubbo.rpc.RpcContext;
|
||||
|
||||
/**
|
||||
* DemoServiceImpl
|
||||
*/
|
||||
|
||||
public class DemoServiceImpl implements DemoService {
|
||||
public DemoServiceImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String sayHello(String name) {
|
||||
return "hello " + name;
|
||||
}
|
||||
|
||||
public long timestamp() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public String getThreadName() {
|
||||
return Thread.currentThread().getName();
|
||||
}
|
||||
|
||||
public int getSize(String[] strs) {
|
||||
if (strs == null)
|
||||
return -1;
|
||||
return strs.length;
|
||||
}
|
||||
|
||||
public int getSize(Object[] os) {
|
||||
if (os == null)
|
||||
return -1;
|
||||
return os.length;
|
||||
}
|
||||
|
||||
public Object invoke(String service, String method) throws Exception {
|
||||
System.out.println("RpcContext.getContext().getRemoteHost()=" + RpcContext.getContext().getRemoteHost());
|
||||
return service + ":" + method;
|
||||
}
|
||||
|
||||
public Type enumlength(Type... types) {
|
||||
if (types.length == 0)
|
||||
return Type.Lower;
|
||||
return types[0];
|
||||
}
|
||||
|
||||
public Type enumlength(Type type) {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int stringLength(String str) {
|
||||
return str.length();
|
||||
}
|
||||
|
||||
public String get(CustomArgument arg1) {
|
||||
return arg1.toString();
|
||||
}
|
||||
|
||||
public byte getbyte(byte arg) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
public Person gerPerson(Person person) {
|
||||
return person;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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.compatible.service;
|
||||
|
||||
import org.apache.dubbo.common.Constants;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* MockInvocation.java
|
||||
*/
|
||||
public class MockInvocation implements Invocation {
|
||||
|
||||
private String arg0;
|
||||
|
||||
public MockInvocation(String arg0) {
|
||||
this.arg0 = arg0;
|
||||
}
|
||||
|
||||
public String getMethodName() {
|
||||
return "echo";
|
||||
}
|
||||
|
||||
public Class<?>[] getParameterTypes() {
|
||||
return new Class[]{String.class};
|
||||
}
|
||||
|
||||
public Object[] getArguments() {
|
||||
return new Object[]{arg0};
|
||||
}
|
||||
|
||||
public Map<String, String> getAttachments() {
|
||||
Map<String, String> attachments = new HashMap<String, String>();
|
||||
attachments.put(Constants.PATH_KEY, "dubbo");
|
||||
attachments.put(Constants.GROUP_KEY, "dubbo");
|
||||
attachments.put(Constants.VERSION_KEY, "1.0.0");
|
||||
attachments.put(Constants.DUBBO_VERSION_KEY, "1.0.0");
|
||||
attachments.put(Constants.TOKEN_KEY, "sfag");
|
||||
attachments.put(Constants.TIMEOUT_KEY, "1000");
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public Invoker<?> getInvoker() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getAttachment(String key) {
|
||||
return getAttachments().get(key);
|
||||
}
|
||||
|
||||
public String getAttachment(String key, String defaultValue) {
|
||||
return getAttachments().get(key);
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue