diff --git a/java/CONTRIBUTING.md b/java/CONTRIBUTING.md
deleted file mode 100644
index dd9ba965..00000000
--- a/java/CONTRIBUTING.md
+++ /dev/null
@@ -1,25 +0,0 @@
-
-## Contributing to dubbo
-Dubbo is released under the non-restrictive Apache 2.0 license, and follows a very standard Github development process, using Github tracker for issues and merging pull requests into master. If you want to contribute even something trivial please do not hesitate, but follow the guidelines below.
-### Sign the Contributor License Agreement
-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'.
-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.
-
-* Make sure all new .java files to have a simple Javadoc class comment with at least an @author tag identifying you, and a @date tag identifying birth, and preferably at least a paragraph on what the class is for.
-
-* Add the ASF license header comment to all new .java files (copy from existing files in the project)
-
-* Add yourself as an @author to the .java files that you modify substantially (more than cosmetic changes).
-
-* Add some Javadocs and, if you change the namespace, some XSD doc elements.
-
-* A few unit tests should be added for a new feature or an important bugfix.
-
-* If no-one else is using your branch, please rebase it against the current master (or other target branch in the main project).
-
-* When writing a commit message please follow these conventions, if you are fixing an existing issue please add Fixes #XXX at the end of the commit message (where XXX is the issue number).
diff --git a/java/LICENSE b/java/LICENSE
deleted file mode 100644
index 5471dc10..00000000
--- a/java/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
diff --git a/java/NOTICE b/java/NOTICE
deleted file mode 100644
index 43342a61..00000000
--- a/java/NOTICE
+++ /dev/null
@@ -1,170 +0,0 @@
-Copyright 1999-2012 Alibaba Group.
-
-Licensed 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.
-
-================================================================
-Dependencies:
-
-Spring:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://www.springsource.org
-
-Javassist:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://www.jboss.org/javassist
-
-Netty:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://netty.io
-
-Mina:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://mina.apache.org
-
-Grizzly:
-
- * LICENSE:
- * http://www.gnu.org/licenses/gpl-2.0.html (General Public License 2.0)
- * HOMEPAGE:
- * http://grizzly.java.net
-
-HttpClient:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://hc.apache.org
-
-Hessian:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://hessian.caucho.com
-
-XStream:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://xstream.codehaus.org
-
-FastJson:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://code.alibabatech.com/wiki/fastjson
-
-Zookeeper:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://zookeeper.apache.org
-
-Jedis:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://code.google.com/p/jedis
-
-XMemcached:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://code.google.com/p/xmemcached
-
-Jetty:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://jetty.mortbay.org
-
-Thrift:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://thrift.apache.org
-
-CXF:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://cxf.apache.org
-
-ZKClient:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * https://github.com/sgroschupf/zkclient
-
-Curator
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * https://github.com/Netflix/curator
-
-JFreeChart:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://www.jfree.org
-
-HibernateValidator:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://www.hibernate.org/subprojects/validator.html
-
-CommonsLogging:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://commons.apache.org/logging
-
-SLF4J:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://www.slf4j.org
-
-Log4j:
-
- * LICENSE:
- * http://www.apache.org/licenses/LICENSE-2.0 (Apache License 2.0)
- * HOMEPAGE:
- * http://log4j.apache.org
diff --git a/java/README.md b/java/README.md
deleted file mode 100644
index 19486cbd..00000000
--- a/java/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-[![Build Status](https://travis-ci.org/alibaba/dubbo.svg?branch=master)](https://travis-ci.org/alibaba/dubbo)
-[![Gitter](https://badges.gitter.im/alibaba/dubbo.svg)](https://gitter.im/alibaba/dubbo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
-![](https://img.shields.io/github/license/alibaba/dubbo.svg)
-![](https://img.shields.io/maven-central/v/com.alibaba/dubbo.svg)
-
-Pls. visit [dubbo.io](http://dubbo.io) for more information.
diff --git a/java/codestyle/dubbo_codestyle_for_idea.xml b/java/codestyle/dubbo_codestyle_for_idea.xml
deleted file mode 100644
index 2ecc06d6..00000000
--- a/java/codestyle/dubbo_codestyle_for_idea.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/java/dubbo-admin/pom.xml b/java/dubbo-admin/pom.xml
deleted file mode 100644
index 0222ff79..00000000
--- a/java/dubbo-admin/pom.xml
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
- 4.0.0
-
- com.alibaba
- dubbo-parent
- 2.5.7
-
- dubbo-admin
- war
- ${project.artifactId}
- The admin module of dubbo project
-
- 1.5
- /
- false
- false
-
-
-
- com.alibaba
- dubbo
- ${project.parent.version}
-
-
- org.springframework
- spring-context
-
-
- org.springframework
- spring-beans
-
-
- org.springframework
- spring-web
-
-
-
-
-
- org.springframework
- spring-context
- 3.2.16.RELEASE
-
-
- org.springframework
- spring-beans
- 3.2.16.RELEASE
-
-
- org.springframework
- spring-web
- 3.2.16.RELEASE
-
-
- org.springframework
- spring-core
- 3.2.16.RELEASE
-
-
- org.springframework
- spring-aop
- 3.2.16.RELEASE
-
-
- com.alibaba.citrus
- citrus-webx-all
-
-
- org.javassist
- javassist
-
-
- org.jboss.netty
- netty
-
-
- org.apache.mina
- mina-core
-
-
- org.glassfish.grizzly
- grizzly-core
-
-
- org.apache.httpcomponents
- httpclient
-
-
- com.alibaba
- fastjson
-
-
- com.thoughtworks.xstream
- xstream
-
-
- org.apache.bsf
- bsf-api
-
-
- org.apache.zookeeper
- zookeeper
-
-
- com.101tec
- zkclient
-
-
- org.apache.curator
- curator-framework
-
-
- com.googlecode.xmemcached
- xmemcached
-
-
- org.apache.thrift
- libthrift
-
-
- com.caucho
- hessian
-
-
- javax.servlet
- servlet-api
- provided
-
-
- log4j
- log4j
-
-
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-log4j12
-
-
- redis.clients
- jedis
-
-
- javax.validation
- validation-api
-
-
- org.hibernate
- hibernate-validator
-
-
- javax.cache
- cache-api
-
-
- org.apache.velocity
- velocity
-
-
-
-
-
- org.mortbay.jetty
- maven-jetty-plugin
- ${jetty_version}
-
- /
- 10
-
-
- 8080
- 60000
-
-
-
-
-
-
-
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/PageContext.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/PageContext.java
deleted file mode 100644
index 6327e866..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/PageContext.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Project: dubbo.registry-1.1.0-SNAPSHOT
- *
- * File Created at 2010-5-26
- *
- * Copyright 1999-2010 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance;
-
-import com.alibaba.dubbo.registry.common.domain.User;
-
-import java.util.Map;
-
-/**
- * Context
- *
- * @author william.liangf
- */
-public interface PageContext {
-
- public String get(String key);
-
- public String[] gets(String key);
-
- public Map getAll();
-
- public void put(String key, Object value);
-
- public String getMessage(String key, Object... args);
-
- public String getClientAddress();
-
- public String getOperateAddress();
-
- public String getRegistryAddress();
-
- public String getURI();
-
- public String getURL();
-
- public String getReferer();
-
- public User getLoginUser();
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/biz/common/i18n/MessageResourceService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/biz/common/i18n/MessageResourceService.java
deleted file mode 100644
index 58ad168b..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/biz/common/i18n/MessageResourceService.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.alibaba.dubbo.governance.biz.common.i18n;
-
-public interface MessageResourceService {
-
- public String get(String key, Object... args);
-
- public String getMessage(String key, Object... args);
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/biz/common/i18n/impl/MessageResourceServiceImpl.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/biz/common/i18n/impl/MessageResourceServiceImpl.java
deleted file mode 100644
index 1355baf9..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/biz/common/i18n/impl/MessageResourceServiceImpl.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.alibaba.dubbo.governance.biz.common.i18n.impl;
-
-import com.alibaba.dubbo.governance.biz.common.i18n.MessageResourceService;
-import com.alibaba.dubbo.governance.web.common.i18n.LocaleUtil;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.MessageSource;
-import org.springframework.context.NoSuchMessageException;
-
-public class MessageResourceServiceImpl implements MessageResourceService {
-
- @Autowired
- private MessageSource messageSource;
-
- public void setMessageSource(MessageSource messageSource) {
- this.messageSource = messageSource;
- }
-
- public String get(String key, Object... args) {
- try {
- if (messageSource != null) {
- return messageSource.getMessage(key, args, key, LocaleUtil.getLocale());
- }
- return key;
- } catch (NoSuchMessageException e) {
- return key;
- }
- }
-
- public String getMessage(String key, Object... args) {
- return get(key, args);
- }
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ConfigService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ConfigService.java
deleted file mode 100644
index aace66ff..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ConfigService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Project: dubbo.registry.server-1.1.0-SNAPSHOT
- *
- * File Created at 2010-6-30
- * $Id: ConfigService.java 181723 2012-06-26 01:56:06Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service;
-
-import com.alibaba.dubbo.registry.common.domain.Config;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * TODO Comment of ConfigDAO
- *
- * @author rain.chenjr
- *
- */
-public interface ConfigService {
-
- void update(List configs);
-
- Map findAllConfigsMap();
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ConsumerService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ConsumerService.java
deleted file mode 100644
index ba7ad09f..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ConsumerService.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Project: dubbo.registry-1.1.0-SNAPSHOT
- *
- * File Created at 2010-4-15
- * $Id: ConsumerService.java 182013 2012-06-26 10:32:43Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service;
-
-import com.alibaba.dubbo.registry.common.domain.Consumer;
-
-import java.util.List;
-
-/**
- * 消费者数据访问对象
- *
- * @author william.liangf
- */
-public interface ConsumerService {
-
- List findByService(String serviceName);
-
- Consumer findConsumer(Long id);
-
- List findAll();
-
- /**
- * 查询所有的消费者地址
- */
- List findAddresses();
-
- List findAddressesByApplication(String application);
-
- List findAddressesByService(String serviceName);
-
- List findByAddress(String consumerAddress);
-
- List findServicesByAddress(String consumerAddress);
-
- List findApplications();
-
- List findApplicationsByServiceName(String serviceName);
-
- List findByApplication(String application);
-
- List findServicesByApplication(String application);
-
- List findServices();
-
-}
\ No newline at end of file
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/OverrideService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/OverrideService.java
deleted file mode 100644
index e823b967..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/OverrideService.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 1999-2101 Alibaba Group.
- *
- * Licensed 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.governance.service;
-
-import com.alibaba.dubbo.registry.common.domain.Override;
-
-import java.util.List;
-
-/**
- * @author tony.chenl
- */
-public interface OverrideService {
-
- void saveOverride(Override override);
-
- void updateOverride(Override override);
-
- void deleteOverride(Long id);
-
- void enableOverride(Long id);
-
- void disableOverride(Long id);
-
- List findByService(String service);
-
- List findByAddress(String address);
-
- List findByServiceAndAddress(String service, String address);
-
- List findByApplication(String application);
-
- List findByServiceAndApplication(String service, String application);
-
- List findAll();
-
- Override findById(Long id);
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/OwnerService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/OwnerService.java
deleted file mode 100644
index a645b15b..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/OwnerService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.alibaba.dubbo.governance.service;
-
-import com.alibaba.dubbo.registry.common.domain.Owner;
-
-import java.util.List;
-
-public interface OwnerService {
-
- List findAllServiceNames();
-
- List findServiceNamesByUsername(String username);
-
- List findUsernamesByServiceName(String serviceName);
-
- List findByService(String serviceName);
-
- List findAll();
-
- Owner findById(Long id);
-
- void saveOwner(Owner owner);
-
- void deleteOwner(Owner owner);
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ProviderService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ProviderService.java
deleted file mode 100644
index f5e77ba1..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/ProviderService.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Project: dubbo.registry-1.1.0-SNAPSHOT
- *
- * File Created at 2010-4-15
- * $Id: ProviderService.java 182143 2012-06-27 03:25:50Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service;
-
-import com.alibaba.dubbo.registry.common.domain.Provider;
-
-import java.util.List;
-
-/**
- * ProviderService
- *
- * @author william.liangf
- */
-public interface ProviderService {
-
- void create(Provider provider);
-
- void enableProvider(Long id);
-
- void disableProvider(Long id);
-
- void doublingProvider(Long id);
-
- void halvingProvider(Long id);
-
- void deleteStaticProvider(Long id);
-
- void updateProvider(Provider provider);
-
- Provider findProvider(Long id);
-
- List findServices();
-
- List findAddresses();
-
- List findAddressesByApplication(String application);
-
- List findAddressesByService(String serviceName);
-
- List findApplicationsByServiceName(String serviceName);
-
- List findByService(String serviceName);
-
- List findAll();
-
- List findByAddress(String providerAddress);
-
- List findServicesByAddress(String providerAddress);
-
- List findApplications();
-
- List findByApplication(String application);
-
- List findServicesByApplication(String application);
-
- List findMethodsByService(String serviceName);
-
- Provider findByServiceAndAddress(String service, String address);
-
-}
\ No newline at end of file
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/RouteService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/RouteService.java
deleted file mode 100644
index bd5a2922..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/RouteService.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Project: dubbo.registry-1.1.0-SNAPSHOT
- *
- * File Created at 2010-4-15
- * $Id: RouteService.java 182337 2012-06-27 09:04:15Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service;
-
-import com.alibaba.dubbo.registry.common.domain.Route;
-
-import java.util.List;
-
-/**
- * RouteService
- *
- * @author william.liangf
- */
-public interface RouteService {
-
- void createRoute(Route route);
-
- void updateRoute(Route route);
-
- void deleteRoute(Long id);
-
- void enableRoute(Long id);
-
- void disableRoute(Long id);
-
- Route findRoute(Long id);
-
- List findAll();
-
- List findByService(String serviceName);
-
- List findByAddress(String address);
-
- List findByServiceAndAddress(String service, String address);
-
- List findForceRouteByService(String service);
-
- List findForceRouteByAddress(String address);
-
- List findForceRouteByServiceAndAddress(String service, String address);
-
- List findAllForceRoute();
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/UserService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/UserService.java
deleted file mode 100644
index 77d7383f..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/UserService.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Project: dubbo.registry-1.1.0-SNAPSHOT
- *
- * File Created at 2010-4-15
- * $Id: UserService.java 182013 2012-06-26 10:32:43Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service;
-
-import com.alibaba.dubbo.registry.common.domain.User;
-
-import java.util.List;
-
-/**
- * UserService
- *
- * @author william.liangf
- */
-public interface UserService {
-
- List findAllUsers();
-
- User findUser(String username);
-
- User findById(Long id);
-
- void createUser(User user);
-
- void updateUser(User user);
-
- void modifyUser(User user);
-
- boolean updatePassword(User user, String oldPassword);
-
- void resetPassword(User user);
-
- void enableUser(User user);
-
- void disableUser(User user);
-
- void deleteUser(User user);
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/AbstractService.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/AbstractService.java
deleted file mode 100644
index 61ebf20c..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/AbstractService.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Project: dubbo.registry.server-1.1.0-SNAPSHOT
- *
- * File Created at 2010-6-28
- *
- * Copyright 1999-2010 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service.impl;
-
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.common.logger.Logger;
-import com.alibaba.dubbo.common.logger.LoggerFactory;
-import com.alibaba.dubbo.governance.sync.RegistryServerSync;
-import com.alibaba.dubbo.registry.RegistryService;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * IbatisDAO
- *
- * @author william.liangf
- */
-public class AbstractService {
-
- protected static final Logger logger = LoggerFactory.getLogger(AbstractService.class);
- @Autowired
- protected RegistryService registryService;
- @Autowired
- private RegistryServerSync sync;
-
- public ConcurrentMap>> getRegistryCache() {
- return sync.getRegistryCache();
- }
-
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ConfigServiceImpl.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ConfigServiceImpl.java
deleted file mode 100644
index 561e646a..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ConfigServiceImpl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Project: dubbo.registry.server-1.1.0-SNAPSHOT
- *
- * File Created at 2010-6-30
- * $Id: ConfigServiceImpl.java 181735 2012-06-26 02:31:34Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service.impl;
-
-import com.alibaba.dubbo.governance.service.ConfigService;
-import com.alibaba.dubbo.registry.common.domain.Config;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * TODO Comment of IbatisConfigDAO
- * @author rain.chenjr
- *
- */
-public class ConfigServiceImpl extends AbstractService implements ConfigService {
-
- /* (non-Javadoc)
- * @see com.alibaba.dubbo.governance.service.ConfigService#update(java.util.List)
- */
- public void update(List configs) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see com.alibaba.dubbo.governance.service.ConfigService#findAllConfigsMap()
- */
- public Map findAllConfigsMap() {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ConsumerServiceImpl.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ConsumerServiceImpl.java
deleted file mode 100644
index c8388952..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ConsumerServiceImpl.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/**
- * Project: dubbo.registry-1.1.0-SNAPSHOT
- *
- * File Created at 2010-4-15
- * $Id: ConsumerServiceImpl.java 184666 2012-07-05 11:13:17Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service.impl;
-
-import com.alibaba.dubbo.common.Constants;
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.governance.service.ConsumerService;
-import com.alibaba.dubbo.governance.sync.util.Pair;
-import com.alibaba.dubbo.governance.sync.util.SyncUtils;
-import com.alibaba.dubbo.registry.common.domain.Consumer;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- *
- * @author william.liangf
- */
-public class ConsumerServiceImpl extends AbstractService implements ConsumerService {
-
- public List findByService(String service) {
- return SyncUtils.url2ConsumerList(findConsumerUrlByService(service));
- }
-
- public Consumer findConsumer(Long id) {
- return SyncUtils.url2Consumer(findConsumerUrl(id));
- }
-
- private Pair findConsumerUrl(Long id) {
- return SyncUtils.filterFromCategory(getRegistryCache(), Constants.CONSUMERS_CATEGORY, id);
- }
-
- public List findAll() {
- return SyncUtils.url2ConsumerList(findAllConsumerUrl());
- }
-
- private Map findAllConsumerUrl() {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findAddresses() {
- List ret = new ArrayList();
- ConcurrentMap> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
- if (null == consumerUrls) return ret;
-
- for (Map.Entry> e1 : consumerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- String app = u.getAddress();
- if (app != null) ret.add(app);
- }
- }
-
- return ret;
- }
-
- public List findAddressesByApplication(String application) {
- List ret = new ArrayList();
- ConcurrentMap> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
-
- if(consumerUrls == null)
- return ret;
-
- for (Map.Entry> e1 : consumerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- if (application.equals(u.getParameter(Constants.APPLICATION_KEY))) {
- String addr = u.getAddress();
- if (addr != null) ret.add(addr);
- }
- }
- }
-
- return ret;
- }
-
- public List findAddressesByService(String service) {
- List ret = new ArrayList();
- ConcurrentMap> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
- if (null == consumerUrls) return ret;
-
- for (Map.Entry e2 : consumerUrls.get(service).entrySet()) {
- URL u = e2.getValue();
- String app = u.getAddress();
- if (app != null) ret.add(app);
- }
-
- return ret;
- }
-
- public List findByAddress(String consumerAddress) {
- return SyncUtils.url2ConsumerList(findConsumerUrlByAddress(consumerAddress));
- }
-
- public List findServicesByAddress(String address) {
- List ret = new ArrayList();
- ConcurrentMap> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
- if (consumerUrls == null || address == null || address.length() == 0) return ret;
-
- for (Map.Entry> e1 : consumerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- if (address.equals(u.getAddress())) {
- ret.add(e1.getKey());
- break;
- }
- }
- }
-
- return ret;
- }
-
- private Map findConsumerUrlByAddress(String address) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
- filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
-
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findApplications() {
- List ret = new ArrayList();
- ConcurrentMap> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
- if (consumerUrls == null) return ret;
-
- for (Map.Entry> e1 : consumerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- String app = u.getParameter(Constants.APPLICATION_KEY);
- if (app != null) ret.add(app);
- }
- }
-
- return ret;
- }
-
- public List findApplicationsByServiceName(String service) {
- List ret = new ArrayList();
- ConcurrentMap> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
- if (consumerUrls == null) return ret;
-
- Map value = consumerUrls.get(service);
- if (value == null) {
- return ret;
- }
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- String app = u.getParameter(Constants.APPLICATION_KEY);
- if (app != null) ret.add(app);
- }
-
- return ret;
- }
-
- public List findByApplication(String application) {
- return SyncUtils.url2ConsumerList(findConsumerUrlByApplication(application));
- }
-
- private Map findConsumerUrlByApplication(String application) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
- filter.put(Constants.APPLICATION_KEY, application);
-
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findServicesByApplication(String application) {
- List ret = new ArrayList();
- ConcurrentMap> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
- if (consumerUrls == null || application == null || application.length() == 0) return ret;
-
- for (Map.Entry> e1 : consumerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- if (application.equals(u.getParameter(Constants.APPLICATION_KEY))) {
- ret.add(e1.getKey());
- break;
- }
- }
- }
-
- return ret;
- }
-
- public List findServices() {
- List ret = new ArrayList();
- ConcurrentMap> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
- if (consumerUrls != null) ret.addAll(consumerUrls.keySet());
- return ret;
- }
-
- public Map findConsumerUrlByService(String service) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.CONSUMERS_CATEGORY);
- filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
-
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/OverrideServiceImpl.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/OverrideServiceImpl.java
deleted file mode 100644
index 6140d52d..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/OverrideServiceImpl.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright 1999-2101 Alibaba Group.
- *
- * Licensed 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.governance.service.impl;
-
-import com.alibaba.dubbo.common.Constants;
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.governance.service.OverrideService;
-import com.alibaba.dubbo.governance.sync.util.Pair;
-import com.alibaba.dubbo.governance.sync.util.SyncUtils;
-import com.alibaba.dubbo.registry.common.domain.Override;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * IbatisOverrideDAO.java
- *
- * @author tony.chenl
- */
-public class OverrideServiceImpl extends AbstractService implements OverrideService {
-
- public void saveOverride(Override override) {
- URL url = getUrlFromOverride(override);
- registryService.register(url);
- }
-
- public void updateOverride(Override override) {
- Long id = override.getId();
- if (id == null) {
- throw new IllegalStateException("no override id");
- }
- URL oldOverride = findOverrideUrl(id);
- if (oldOverride == null) {
- throw new IllegalStateException("Route was changed!");
- }
- URL newOverride = getUrlFromOverride(override);
-
- registryService.unregister(oldOverride);
- registryService.register(newOverride);
-
- }
-
- public void deleteOverride(Long id) {
- URL oldOverride = findOverrideUrl(id);
- if (oldOverride == null) {
- throw new IllegalStateException("Route was changed!");
- }
- registryService.unregister(oldOverride);
- }
-
- public void enableOverride(Long id) {
- if (id == null) {
- throw new IllegalStateException("no override id");
- }
-
- URL oldOverride = findOverrideUrl(id);
- if (oldOverride == null) {
- throw new IllegalStateException("Override was changed!");
- }
- if (oldOverride.getParameter("enabled", true)) {
- return;
- }
-
- URL newOverride = oldOverride.addParameter("enabled", true);
- registryService.unregister(oldOverride);
- registryService.register(newOverride);
-
- }
-
- public void disableOverride(Long id) {
- if (id == null) {
- throw new IllegalStateException("no override id");
- }
-
- URL oldProvider = findOverrideUrl(id);
- if (oldProvider == null) {
- throw new IllegalStateException("Override was changed!");
- }
- if (!oldProvider.getParameter("enabled", true)) {
- return;
- }
-
- URL newProvider = oldProvider.addParameter("enabled", false);
- registryService.unregister(oldProvider);
- registryService.register(newProvider);
-
- }
-
- private Map findOverrideUrl(String service, String address, String application) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.CONFIGURATORS_CATEGORY);
- if (service != null && service.length() > 0) {
- filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
- }
- if (address != null && address.length() > 0) {
- filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
- }
- if (application != null && application.length() > 0) {
- filter.put(Constants.APPLICATION_KEY, application);
- }
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findByAddress(String address) {
- return SyncUtils.url2OverrideList(findOverrideUrl(null, address, null));
- }
-
- public List findByServiceAndAddress(String service, String address) {
- return SyncUtils.url2OverrideList(findOverrideUrl(service, address, null));
- }
-
- public List findByApplication(String application) {
- return SyncUtils.url2OverrideList(findOverrideUrl(null, null, application));
- }
-
- public List findByService(String service) {
- return SyncUtils.url2OverrideList(findOverrideUrl(service, null, null));
- }
-
- public List findByServiceAndApplication(String service, String application) {
- return SyncUtils.url2OverrideList(findOverrideUrl(service, null, application));
- }
-
- public List findAll() {
- return SyncUtils.url2OverrideList(findOverrideUrl(null, null, null));
- }
-
- private Pair findOverrideUrlPair(Long id) {
- return SyncUtils.filterFromCategory(getRegistryCache(), Constants.CONFIGURATORS_CATEGORY, id);
- }
-
- public Override findById(Long id) {
- return SyncUtils.url2Override(findOverrideUrlPair(id));
- }
-
- private URL getUrlFromOverride(Override override) {
- return override.toUrl();
- /*Map params = ConvertUtil.serviceName2Map(override.getService());
- if(!params.containsKey(Constants.INTERFACE_KEY)) {
- throw new IllegalArgumentException("No interface info");
- }
- if(!params.containsKey(Constants.VERSION_KEY)) {
- throw new IllegalArgumentException("No version info");
- }
-
- boolean enabled = override.isEnabled();
- if(!enabled) {
- params.put("enabled", "false");
- }
- String application = override.getApplication();
- if(!StringUtils.isEmpty(application)) {
- params.put("application", application);
- }
- String address = override.getAddress();
- if(!StringUtils.isEmpty(address)) {
- params.put("address", address);
- }
-
- String overrideAddress = override.getOverrideAddress();
- if(StringUtils.isEmpty(overrideAddress)) {
- overrideAddress = "0.0.0.0";
- }
- params.put(Constants.CATEGORY_KEY, Constants.CONFIGURATORS_CATEGORY);
-
- URL url = new URL("override", overrideAddress, -1, params);
- url = url.addParameterString(override.getParams());
- return url;*/
- }
-
- URL findOverrideUrl(Long id) {
- return getUrlFromOverride(findById(id));
- }
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/OwnerServiceImpl.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/OwnerServiceImpl.java
deleted file mode 100644
index d49f8033..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/OwnerServiceImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.alibaba.dubbo.governance.service.impl;
-
-import com.alibaba.dubbo.common.Constants;
-import com.alibaba.dubbo.common.utils.StringUtils;
-import com.alibaba.dubbo.governance.service.OverrideService;
-import com.alibaba.dubbo.governance.service.OwnerService;
-import com.alibaba.dubbo.governance.service.ProviderService;
-import com.alibaba.dubbo.registry.common.domain.Override;
-import com.alibaba.dubbo.registry.common.domain.Owner;
-import com.alibaba.dubbo.registry.common.domain.Provider;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class OwnerServiceImpl extends AbstractService implements OwnerService {
-
- @Autowired
- ProviderService providerService;
-
- @Autowired
- OverrideService overrideService;
-
- public List findAllServiceNames() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List findServiceNamesByUsername(String username) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List findUsernamesByServiceName(String serviceName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List findByService(String serviceName) {
- List pList = providerService.findByService(serviceName);
- List cList = overrideService.findByServiceAndAddress(serviceName, Constants.ANYHOST_VALUE);
- return toOverrideLiset(pList, cList);
- }
-
- public List findAll() {
- List pList = providerService.findAll();
- List cList = overrideService.findAll();
- return toOverrideLiset(pList, cList);
- }
-
- public Owner findById(Long id) {
-
- return null;
- }
-
- private List toOverrideLiset(List pList, List cList) {
- Map oList = new HashMap();
- for (Provider p : pList) {
- if (p.getUsername() != null) {
- for (String username : Constants.COMMA_SPLIT_PATTERN.split(p.getUsername())) {
- Owner o = new Owner();
- o.setService(p.getService());
- o.setUsername(username);
- oList.put(o.getService() + "/" + o.getUsername(), o);
- }
- }
- }
- for (Override c : cList) {
- Map params = StringUtils.parseQueryString(c.getParams());
- String usernames = params.get("owner");
- if (usernames != null && usernames.length() > 0) {
- for (String username : Constants.COMMA_SPLIT_PATTERN.split(usernames)) {
- Owner o = new Owner();
- o.setService(c.getService());
- o.setUsername(username);
- oList.put(o.getService() + "/" + o.getUsername(), o);
- }
- }
- }
- return new ArrayList(oList.values());
- }
-
- public void saveOwner(Owner owner) {
- List overrides = overrideService.findByServiceAndAddress(owner.getService(), Constants.ANYHOST_VALUE);
- if (overrides == null || overrides.size() == 0) {
- Override override = new Override();
- override.setAddress(Constants.ANYHOST_VALUE);
- override.setService(owner.getService());
- override.setEnabled(true);
- override.setParams("owner=" + owner.getUsername());
- overrideService.saveOverride(override);
- } else {
- for (Override override : overrides) {
- Map params = StringUtils.parseQueryString(override.getParams());
- String usernames = params.get("owner");
- if (usernames == null || usernames.length() == 0) {
- usernames = owner.getUsername();
- } else {
- usernames = usernames + "," + owner.getUsername();
- }
- params.put("owner", usernames);
- override.setParams(StringUtils.toQueryString(params));
- overrideService.updateOverride(override);
- }
- }
- }
-
- public void deleteOwner(Owner owner) {
- List overrides = overrideService.findByServiceAndAddress(owner.getService(), Constants.ANYHOST_VALUE);
- if (overrides == null || overrides.size() == 0) {
- Override override = new Override();
- override.setAddress(Constants.ANYHOST_VALUE);
- override.setService(owner.getService());
- override.setEnabled(true);
- override.setParams("owner=" + owner.getUsername());
- overrideService.saveOverride(override);
- } else {
- for (Override override : overrides) {
- Map params = StringUtils.parseQueryString(override.getParams());
- String usernames = params.get("owner");
- if (usernames != null && usernames.length() > 0) {
- if (usernames.equals(owner.getUsername())) {
- params.remove("owner");
- } else {
- usernames = usernames.replace(owner.getUsername() + ",", "").replace("," + owner.getUsername(), "");
- params.put("owner", usernames);
- }
- if (params.size() > 0) {
- override.setParams(StringUtils.toQueryString(params));
- overrideService.updateOverride(override);
- } else {
- overrideService.deleteOverride(override.getId());
- }
- }
- }
- }
- }
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ProviderServiceImpl.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ProviderServiceImpl.java
deleted file mode 100644
index 5db1f79b..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/ProviderServiceImpl.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/**
- * Project: dubbo.registry-1.1.0-SNAPSHOT
- *
- * File Created at 2010-4-15
- * $Id: ProviderServiceImpl.java 185206 2012-07-09 03:06:37Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service.impl;
-
-import com.alibaba.dubbo.common.Constants;
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.common.utils.StringUtils;
-import com.alibaba.dubbo.governance.service.OverrideService;
-import com.alibaba.dubbo.governance.service.ProviderService;
-import com.alibaba.dubbo.governance.sync.util.Pair;
-import com.alibaba.dubbo.governance.sync.util.SyncUtils;
-import com.alibaba.dubbo.registry.common.domain.Override;
-import com.alibaba.dubbo.registry.common.domain.Provider;
-import com.alibaba.dubbo.registry.common.route.ParseUtils;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * IbatisProviderService
- *
- * @author tony.chenl
- */
-public class ProviderServiceImpl extends AbstractService implements ProviderService {
-
- @Autowired
- OverrideService overrideService;
-
- public void create(Provider provider) {
- URL url = provider.toUrl();
- registryService.register(url);
- }
-
- public void enableProvider(Long id) {
- if (id == null) {
- throw new IllegalStateException("no provider id");
- }
-
- Provider oldProvider = findProvider(id);
-
- if (oldProvider == null) {
- throw new IllegalStateException("Provider was changed!");
- }
- if (oldProvider.isDynamic()) {
- //保证disable的override唯一
- if (!oldProvider.isEnabled()) {
- Override override = new Override();
- override.setAddress(oldProvider.getAddress());
- override.setService(oldProvider.getService());
- override.setEnabled(true);
- override.setParams(Constants.DISABLED_KEY + "=false");
- overrideService.saveOverride(override);
- return;
- }
- List oList = overrideService.findByServiceAndAddress(oldProvider.getService(), oldProvider.getAddress());
-
- for (Override o : oList) {
- Map params = StringUtils.parseQueryString(o.getParams());
- if (params.containsKey(Constants.DISABLED_KEY)) {
- if (params.get(Constants.DISABLED_KEY).equals("true")) {
- overrideService.deleteOverride(o.getId());
- }
- }
- }
- } else {
- oldProvider.setEnabled(true);
- updateProvider(oldProvider);
- }
- }
-
- public void disableProvider(Long id) {
- if (id == null) {
- throw new IllegalStateException("no provider id");
- }
-
- Provider oldProvider = findProvider(id);
- if (oldProvider == null) {
- throw new IllegalStateException("Provider was changed!");
- }
-
- if (oldProvider.isDynamic()) {
- //保证disable的override唯一
- if (oldProvider.isEnabled()) {
- Override override = new Override();
- override.setAddress(oldProvider.getAddress());
- override.setService(oldProvider.getService());
- override.setEnabled(true);
- override.setParams(Constants.DISABLED_KEY + "=true");
- overrideService.saveOverride(override);
- return;
- }
- List oList = overrideService.findByServiceAndAddress(oldProvider.getService(), oldProvider.getAddress());
-
- for (Override o : oList) {
- Map params = StringUtils.parseQueryString(o.getParams());
- if (params.containsKey(Constants.DISABLED_KEY)) {
- if (params.get(Constants.DISABLED_KEY).equals("false")) {
- overrideService.deleteOverride(o.getId());
- }
- }
- }
- } else {
- oldProvider.setEnabled(false);
- updateProvider(oldProvider);
- }
-
- }
-
- public void doublingProvider(Long id) {
- setWeight(id, 2F);
- }
-
- public void halvingProvider(Long id) {
- setWeight(id, 0.5F);
- }
-
- public void setWeight(Long id, float factor) {
- if (id == null) {
- throw new IllegalStateException("no provider id");
- }
- Provider oldProvider = findProvider(id);
- if (oldProvider == null) {
- throw new IllegalStateException("Provider was changed!");
- }
- Map map = StringUtils.parseQueryString(oldProvider.getParameters());
- String weight = map.get(Constants.WEIGHT_KEY);
- if (oldProvider.isDynamic()) {
- //保证disable的override唯一
- List overrides = overrideService.findByServiceAndAddress(oldProvider.getService(), oldProvider.getAddress());
- if (overrides == null || overrides.size() == 0) {
- int value = getWeight(weight, factor);
- if (value != Constants.DEFAULT_WEIGHT) {
- Override override = new Override();
- override.setAddress(oldProvider.getAddress());
- override.setService(oldProvider.getService());
- override.setEnabled(true);
- override.setParams(Constants.WEIGHT_KEY + "=" + String.valueOf(value));
- overrideService.saveOverride(override);
- }
- } else {
- for (Override override : overrides) {
- Map params = StringUtils.parseQueryString(override.getParams());
- String overrideWeight = params.get(Constants.WEIGHT_KEY);
- if (overrideWeight == null || overrideWeight.length() == 0) {
- overrideWeight = weight;
- }
- int value = getWeight(overrideWeight, factor);
- if (value == getWeight(weight, 1)) {
- params.remove(Constants.WEIGHT_KEY);
- } else {
- params.put(Constants.WEIGHT_KEY, String.valueOf(value));
- }
- if (params.size() > 0) {
- override.setParams(StringUtils.toQueryString(params));
- overrideService.updateOverride(override);
- } else {
- overrideService.deleteOverride(override.getId());
- }
- }
- }
- } else {
- int value = getWeight(weight, factor);
- if (value == Constants.DEFAULT_WEIGHT) {
- map.remove(Constants.WEIGHT_KEY);
- } else {
- map.put(Constants.WEIGHT_KEY, String.valueOf(value));
- }
- oldProvider.setParameters(StringUtils.toQueryString(map));
- updateProvider(oldProvider);
- }
- }
-
- private int getWeight(String value, float factor) {
- int weight = 100;
- if (value != null && value.length() > 0) {
- weight = Integer.parseInt(value);
- }
- weight = (int) (weight * factor);
- if (weight < 1) weight = 1;
- if (weight == 2) weight = 3;
- if (weight == 24) weight = 25;
- return weight;
- }
-
- public void deleteStaticProvider(Long id) {
- URL oldProvider = findProviderUrl(id);
- if (oldProvider == null) {
- throw new IllegalStateException("Provider was changed!");
- }
- registryService.unregister(oldProvider);
- }
-
- public void updateProvider(Provider provider) {
- Long id = provider.getId();
- if (id == null) {
- throw new IllegalStateException("no provider id");
- }
-
- URL oldProvider = findProviderUrl(id);
- if (oldProvider == null) {
- throw new IllegalStateException("Provider was changed!");
- }
- URL newProvider = provider.toUrl();
-
- registryService.unregister(oldProvider);
- registryService.register(newProvider);
- }
-
- public Provider findProvider(Long id) {
- return SyncUtils.url2Provider(findProviderUrlPair(id));
- }
-
- public Pair findProviderUrlPair(Long id) {
- return SyncUtils.filterFromCategory(getRegistryCache(), Constants.PROVIDERS_CATEGORY, id);
- }
-
- public List findServices() {
- List ret = new ArrayList();
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- if (providerUrls != null) ret.addAll(providerUrls.keySet());
- return ret;
- }
-
- public List findAddresses() {
- List ret = new ArrayList();
-
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- if (null == providerUrls) return ret;
-
- for (Map.Entry> e1 : providerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- String app = u.getAddress();
- if (app != null) ret.add(app);
- }
- }
-
- return ret;
- }
-
- public List findAddressesByApplication(String application) {
- List ret = new ArrayList();
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- for (Map.Entry> e1 : providerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- if (application.equals(u.getParameter(Constants.APPLICATION_KEY))) {
- String addr = u.getAddress();
- if (addr != null) ret.add(addr);
- }
- }
- }
-
- return ret;
- }
-
- public List findAddressesByService(String service) {
- List ret = new ArrayList();
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- if (null == providerUrls) return ret;
-
- for (Map.Entry e2 : providerUrls.get(service).entrySet()) {
- URL u = e2.getValue();
- String app = u.getAddress();
- if (app != null) ret.add(app);
- }
-
- return ret;
- }
-
- public List findApplicationsByServiceName(String service) {
- List ret = new ArrayList();
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- if (null == providerUrls) return ret;
-
- Map value = providerUrls.get(service);
- if (value == null) {
- return ret;
- }
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- String app = u.getParameter(Constants.APPLICATION_KEY);
- if (app != null) ret.add(app);
- }
-
- return ret;
- }
-
- public List findByService(String serviceName) {
- return SyncUtils.url2ProviderList(findProviderUrlByService(serviceName));
- }
-
- private Map findProviderUrlByService(String service) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
- filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
-
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findAll() {
- return SyncUtils.url2ProviderList(findAllProviderUrl());
- }
-
- private Map findAllProviderUrl() {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findByAddress(String providerAddress) {
- return SyncUtils.url2ProviderList(findProviderUrlByAddress(providerAddress));
- }
-
- public Map findProviderUrlByAddress(String address) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
- filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
-
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findServicesByAddress(String address) {
- List ret = new ArrayList();
-
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- if (providerUrls == null || address == null || address.length() == 0) return ret;
-
- for (Map.Entry> e1 : providerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- if (address.equals(u.getAddress())) {
- ret.add(e1.getKey());
- break;
- }
- }
- }
-
- return ret;
- }
-
- public List findApplications() {
- List ret = new ArrayList();
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- if (providerUrls == null) return ret;
-
- for (Map.Entry> e1 : providerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- String app = u.getParameter(Constants.APPLICATION_KEY);
- if (app != null) ret.add(app);
- }
- }
-
- return ret;
- }
-
- public List findByApplication(String application) {
- return SyncUtils.url2ProviderList(findProviderUrlByApplication(application));
- }
-
- private Map findProviderUrlByApplication(String application) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
- filter.put(Constants.APPLICATION_KEY, application);
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findServicesByApplication(String application) {
- List ret = new ArrayList();
-
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- if (providerUrls == null || application == null || application.length() == 0) return ret;
-
- for (Map.Entry> e1 : providerUrls.entrySet()) {
- Map value = e1.getValue();
- for (Map.Entry e2 : value.entrySet()) {
- URL u = e2.getValue();
- if (application.equals(u.getParameter(Constants.APPLICATION_KEY))) {
- ret.add(e1.getKey());
- break;
- }
- }
- }
-
- return ret;
- }
-
- public List findMethodsByService(String service) {
- List ret = new ArrayList();
-
- ConcurrentMap> providerUrls = getRegistryCache().get(Constants.PROVIDERS_CATEGORY);
- if (providerUrls == null || service == null || service.length() == 0) return ret;
-
- Map providers = providerUrls.get(service);
- if (null == providers || providers.isEmpty()) return ret;
-
- Entry p = providers.entrySet().iterator().next();
- String value = p.getValue().getParameter("methods");
- if (value == null || value.length() == 0) {
- return ret;
- }
- String[] methods = value.split(ParseUtils.METHOD_SPLIT);
- if (methods == null || methods.length == 0) {
- return ret;
- }
-
- for (String m : methods) {
- ret.add(m);
- }
- return ret;
- }
-
- private URL findProviderUrl(Long id) {
- return findProvider(id).toUrl();
- }
-
- public Provider findByServiceAndAddress(String service, String address) {
- return SyncUtils.url2Provider(findProviderUrl(service, address));
- }
-
- private Pair findProviderUrl(String service, String address) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.PROVIDERS_CATEGORY);
- filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
-
- Map ret = SyncUtils.filterFromCategory(getRegistryCache(), filter);
- if (ret.isEmpty()) {
- return null;
- } else {
- Long key = ret.entrySet().iterator().next().getKey();
- return new Pair(key, ret.get(key));
- }
- }
-
-}
diff --git a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/RouteServiceImpl.java b/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/RouteServiceImpl.java
deleted file mode 100644
index 3ed1f54f..00000000
--- a/java/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/service/impl/RouteServiceImpl.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Project: dubbo.registry-1.1.0-SNAPSHOT
- *
- * File Created at 2010-4-15
- * $Id: RouteServiceImpl.java 182851 2012-06-28 09:39:16Z tony.chenl $
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.governance.service.impl;
-
-import com.alibaba.dubbo.common.Constants;
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.governance.service.RouteService;
-import com.alibaba.dubbo.governance.sync.util.Pair;
-import com.alibaba.dubbo.governance.sync.util.SyncUtils;
-import com.alibaba.dubbo.registry.common.domain.Route;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * IbatisRouteService
- *
- * @author william.liangf
- */
-public class RouteServiceImpl extends AbstractService implements RouteService {
-
- public void createRoute(Route route) {
- registryService.register(route.toUrl());
- }
-
- public void updateRoute(Route route) {
- Long id = route.getId();
- if (id == null) {
- throw new IllegalStateException("no route id");
- }
- URL oldRoute = findRouteUrl(id);
- if (oldRoute == null) {
- throw new IllegalStateException("Route was changed!");
- }
-
- registryService.unregister(oldRoute);
- registryService.register(route.toUrl());
- }
-
- public void deleteRoute(Long id) {
- URL oldRoute = findRouteUrl(id);
- if (oldRoute == null) {
- throw new IllegalStateException("Route was changed!");
- }
- registryService.unregister(oldRoute);
- }
-
- public void enableRoute(Long id) {
- if (id == null) {
- throw new IllegalStateException("no route id");
- }
-
- URL oldRoute = findRouteUrl(id);
- if (oldRoute == null) {
- throw new IllegalStateException("Route was changed!");
- }
- if (oldRoute.getParameter("enabled", true)) {
- return;
- }
-
- registryService.unregister(oldRoute);
- URL newRoute = oldRoute.addParameter("enabled", true);
- registryService.register(newRoute);
-
- }
-
- public void disableRoute(Long id) {
- if (id == null) {
- throw new IllegalStateException("no route id");
- }
-
- URL oldRoute = findRouteUrl(id);
- if (oldRoute == null) {
- throw new IllegalStateException("Route was changed!");
- }
- if (!oldRoute.getParameter("enabled", true)) {
- return;
- }
-
- URL newRoute = oldRoute.addParameter("enabled", false);
- registryService.unregister(oldRoute);
- registryService.register(newRoute);
-
- }
-
- public List findAll() {
- return SyncUtils.url2RouteList(findAllUrl());
- }
-
- private Map findAllUrl() {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.ROUTERS_CATEGORY);
-
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public Route findRoute(Long id) {
- return SyncUtils.url2Route(findRouteUrlPair(id));
- }
-
- public Pair findRouteUrlPair(Long id) {
- return SyncUtils.filterFromCategory(getRegistryCache(), Constants.ROUTERS_CATEGORY, id);
- }
-
- private URL findRouteUrl(Long id) {
- return findRoute(id).toUrl();
- }
-
- private Map findRouteUrl(String service, String address, boolean force) {
- Map filter = new HashMap();
- filter.put(Constants.CATEGORY_KEY, Constants.ROUTERS_CATEGORY);
- if (service != null && service.length() > 0) {
- filter.put(SyncUtils.SERVICE_FILTER_KEY, service);
- }
- if (address != null && address.length() > 0) {
- filter.put(SyncUtils.ADDRESS_FILTER_KEY, address);
- }
- if (force) {
- filter.put("force", "true");
- }
- return SyncUtils.filterFromCategory(getRegistryCache(), filter);
- }
-
- public List findByService(String serviceName) {
- return SyncUtils.url2RouteList(findRouteUrl(serviceName, null, false));
- }
-
- public List findByAddress(String address) {
- return SyncUtils.url2RouteList(findRouteUrl(null, address, false));
- }
-
- public List