zoukankan      html  css  js  c++  java
  • 【DUBBO】dobbo的application的配置项

    Dubbo:application的配置项
    【一】:配置项

    <dubbo:application name="服务名字" owner="拥有者" organization="组织名(BU或部门)"/>
    View Code


    【二】:配置解析器
    -->具体解析器为com.alibaba.dubbo.config.spring.schema.DubboNamespaceHandler配置的com.alibaba.dubbo.config.spring.schema.DubboBeanDefinitionParser、


    【三】:配置目标
    --->这个配置会向IOC容器中注册一个bean,该class为com.alibaba.dubbo.config.ApplicationConfig
    --->这个bean描述当前项目向注册中心注册的信息的。
    --->描述的属性:id,name(应用名字),version(模块版本),owner(应用负责人),organization(组织名和部门),architecture(分层),environment(运行环境),compiler(java编译器),logger(日志输出方式),registries(注册中心),monitor(服务监控),isDefault(是否缺省)

    【四】:类

    /*
     * Copyright 1999-2011 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.config;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import com.alibaba.dubbo.common.Constants;
    import com.alibaba.dubbo.common.compiler.support.AdaptiveCompiler;
    import com.alibaba.dubbo.common.logger.LoggerFactory;
    import com.alibaba.dubbo.config.support.Parameter;
    
    
    /**
     * ApplicationConfig
     * 
     * @author william.liangf
     * @export
     */
    public class ApplicationConfig extends AbstractConfig {
    
        private static final long    serialVersionUID = 5508512956753757169L;
    
        // 应用名称
        private String               name;
    
        // 模块版本
        private String               version;
    
        // 应用负责人
        private String               owner;
    
        // 组织名(BU或部门)
        private String               organization;
    
        // 分层
        private String               architecture;
    
        // 环境,如:dev/test/run
        private String               environment;
    
        // Java代码编译器
        private String               compiler;
    
        // 日志输出方式
        private String               logger;
    
        // 注册中心
        private List<RegistryConfig> registries;
    
        // 服务监控
        private MonitorConfig        monitor;
    
        // 是否为缺省
        private Boolean              isDefault;
    
        public ApplicationConfig() {
        }
        
        public ApplicationConfig(String name) {
            setName(name);
        }
        
        @Parameter(key = Constants.APPLICATION_KEY, required = true)
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            checkName("name", name);
            this.name = name;
            if (id == null || id.length() == 0) {
                id = name;
            }
        }
    
        @Parameter(key = "application.version")
        public String getVersion() {
            return version;
        }
    
        public void setVersion(String version) {
            this.version = version;
        }
    
        public String getOwner() {
            return owner;
        }
    
        public void setOwner(String owner) {
            checkMultiName("owner", owner);
            this.owner = owner;
        }
    
        public String getOrganization() {
            return organization;
        }
    
        public void setOrganization(String organization) {
            checkName("organization", organization);
            this.organization = organization;
        }
    
        public String getArchitecture() {
            return architecture;
        }
    
        public void setArchitecture(String architecture) {
            checkName("architecture", architecture);
            this.architecture = architecture;
        }
    
        public String getEnvironment() {
            return environment;
        }
    
        public void setEnvironment(String environment) {
            checkName("environment", environment);
            if(environment != null) {
                if (! ("develop".equals(environment) || "test".equals(environment) || "product".equals(environment))) {
                    throw new IllegalStateException("Unsupported environment: " + environment + ", only support develop/test/product, default is product.");
                }
            }
            this.environment = environment;
        }
    
        public RegistryConfig getRegistry() {
            return registries == null || registries.size() == 0 ? null : registries.get(0);
        }
    
        public void setRegistry(RegistryConfig registry) {
            List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
            registries.add(registry);
            this.registries = registries;
        }
    
        public List<RegistryConfig> getRegistries() {
            return registries;
        }
    
        @SuppressWarnings({ "unchecked" })
        public void setRegistries(List<? extends RegistryConfig> registries) {
            this.registries = (List<RegistryConfig>)registries;
        }
    
        public MonitorConfig getMonitor() {
            return monitor;
        }
    
        public void setMonitor(MonitorConfig monitor) {
            this.monitor = monitor;
        }
    
        public void setMonitor(String monitor) {
            this.monitor = new MonitorConfig(monitor);
        }
    
        public String getCompiler() {
            return compiler;
        }
    
        public void setCompiler(String compiler) {
            this.compiler = compiler;
            AdaptiveCompiler.setDefaultCompiler(compiler);
        }
    
        public String getLogger() {
            return logger;
        }
    
        public void setLogger(String logger) {
            this.logger = logger;
            LoggerFactory.setLoggerAdapter(logger);
        }
    
        public Boolean isDefault() {
            return isDefault;
        }
    
        public void setDefault(Boolean isDefault) {
            this.isDefault = isDefault;
        }
    
    }
    View Code
  • 相关阅读:
    Spyder的汉化
    Python,Pycharm,Anaconda等的关系与安装过程~为初学者跳过各种坑
    好了,我的第一篇博客!
    Xcode 最低要求和支持的 SDK
    python连接hive (安装impyla)的采坑之旅
    java泛型(泛型接口、泛型类、泛型方法)
    oracle命令查看表结构及表索引
    Linux环境下安装、配置Nginx1.14.2(CentOS Linux release 7.6.1810)
    Caffe入门随笔
    Gradient Boosting算法简介
  • 原文地址:https://www.cnblogs.com/shangxiaofei/p/7803441.html
Copyright © 2011-2022 走看看