Skip to content

Commit

Permalink
apache#1087: I18N effort for dubbo code base - dubbo-config
Browse files Browse the repository at this point in the history
  • Loading branch information
beiwei30 committed Dec 22, 2017
1 parent e86c2f0 commit d917744
Show file tree
Hide file tree
Showing 57 changed files with 821 additions and 771 deletions.
27 changes: 14 additions & 13 deletions dubbo-config/dubbo-config-api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<!--
- 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.
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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* 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
*
* 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.
Expand Down Expand Up @@ -35,9 +36,8 @@
import java.util.regex.Pattern;

/**
* 配置解析的工具方法、公共方法
* Utility methods and public methods for parsing configuration
*
* @author william.liangf
* @export
*/
public abstract class AbstractConfig implements Serializable {
Expand Down Expand Up @@ -485,7 +485,7 @@ && isPrimitive(method.getReturnType())) {
}
buf.append(" />");
return buf.toString();
} catch (Throwable t) { // 防御性容错
} catch (Throwable t) {
logger.warn(t.getMessage(), t);
return super.toString();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* 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
*
* 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.
Expand Down Expand Up @@ -43,62 +44,66 @@
/**
* AbstractDefaultConfig
*
* @author william.liangf
* @export
*/
public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {

private static final long serialVersionUID = -1559314110797223229L;

// 服务接口的本地实现类名
// local impl class name for the service interface
protected String local;

// 服务接口的本地实现类名
// local stub class name for the service interface
protected String stub;

// 服务监控
// service monitor
protected MonitorConfig monitor;

// 代理类型
// proxy type
protected String proxy;

// 集群方式
// cluster type
protected String cluster;

// 过滤器
// filter
protected String filter;

// 监听器
// listener
protected String listener;

// 负责人
// owner
protected String owner;

// 连接数限制,0表示共享连接,否则为该服务独享连接数
// connection limits, 0 means shared connection, otherwise it defines the connections delegated to the
// current service
protected Integer connections;

// 连接数限制
// layer
protected String layer;

// 应用信息
// application info
protected ApplicationConfig application;

// 模块信息
// module info
protected ModuleConfig module;

// 注册中心
// registry centers
protected List<RegistryConfig> registries;
// 连接事件

// connection events
protected String onconnect;
// 断开事件

// disconnection events
protected String ondisconnect;
// callback实例个数限制

// callback limits
private Integer callbacks;
// 服务暴露或引用的scope,如果为local,则表示只在当前JVM内查找.

// the scope for referring/exporting a service, if it's local, it means searching in current JVM only.
private String scope;

protected void checkRegistry() {
// 兼容旧版本
// for backward compatibility
if (registries == null || registries.size() == 0) {
String address = ConfigUtils.getProperty("dubbo.registry.address");
if (address != null && address.length() > 0) {
Expand Down Expand Up @@ -127,7 +132,7 @@ protected void checkRegistry() {

@SuppressWarnings("deprecation")
protected void checkApplication() {
// 兼容旧版本
// for backward compatibility
if (application == null) {
String applicationName = ConfigUtils.getProperty("dubbo.application.name");
if (applicationName != null && applicationName.length() > 0) {
Expand Down Expand Up @@ -243,11 +248,11 @@ protected URL loadMonitor(URL registryURL) {
}

protected void checkInterfaceAndMethods(Class<?> interfaceClass, List<MethodConfig> methods) {
// 接口不能为空
// interface cannot be null
if (interfaceClass == null) {
throw new IllegalStateException("interface not allow null!");
}
// 检查接口类型必需为接口
// to verify interfaceClass is an interface
if (!interfaceClass.isInterface()) {
throw new IllegalStateException("The interface class " + interfaceClass + " is not a interface!");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* 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
*
* 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.
Expand All @@ -24,44 +25,43 @@
/**
* AbstractMethodConfig
*
* @author william.liangf
* @export
*/
public abstract class AbstractMethodConfig extends AbstractConfig {

private static final long serialVersionUID = 1L;

// 远程调用超时时间(毫秒)
// timeout for remote invocation in milliseconds
protected Integer timeout;

// 重试次数
// retry times
protected Integer retries;

// 最大并发调用
// max concurrent invocations
protected Integer actives;

// 负载均衡
// load balance
protected String loadbalance;

// 是否异步
// whether to async
protected Boolean async;

// 异步发送是否等待发送成功
// whether to ack async-sent
protected Boolean sent;

// 服务接口的失败mock实现类名
// the name of mock class which gets called when a service fails to execute
protected String mock;

// 合并器
// merger
protected String merger;

// 服务接口的失败mock实现类名
// cache
protected String cache;

// 服务接口的失败mock实现类名
// validation
protected String validation;

// 自定义参数
// customized parameters
protected Map<String, String> parameters;

public Integer getTimeout() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* 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
*
* 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.
Expand All @@ -20,30 +21,28 @@
import com.alibaba.dubbo.rpc.InvokerListener;
import com.alibaba.dubbo.rpc.support.ProtocolUtils;


/**
* AbstractConsumerConfig
*
* @author william.liangf
* @export
* @see com.alibaba.dubbo.config.ReferenceConfig
*/
public abstract class AbstractReferenceConfig extends AbstractInterfaceConfig {

private static final long serialVersionUID = -2786526984373031126L;

// ======== 引用缺省值,当引用属性未设置时使用该缺省值替代 ========
// ======== Reference config default values, will take effect if reference's attribute is not set ========

// 检查服务提供者是否存在
// check if service provider exists
protected Boolean check;

// 是否加载时即刻初始化
// whether to eagle-init
protected Boolean init;

// 是否使用泛接口
// whether to use generic interface
protected String generic;

// 优先从JVM内获取引用实例
// whether to find reference's instance from the current JVM
protected Boolean injvm;

// lazy create connection
Expand All @@ -53,13 +52,13 @@ public abstract class AbstractReferenceConfig extends AbstractInterfaceConfig {

protected Boolean sticky;

//stub是否支持event事件. //TODO slove merge problem
// whether to support event in stub. //TODO solve merge problem
protected Boolean stubevent;//= Constants.DEFAULT_STUB_EVENT;

// 版本
// version
protected String version;

// 服务分组
// group
protected String group;

public Boolean isCheck() {
Expand Down Expand Up @@ -99,7 +98,7 @@ public void setGeneric(String generic) {

/**
* @return
* @deprecated 通过scope进行判断,scope=local
* @deprecated instead, use scope to judge if it's in jvm, scope=local
*/
@Deprecated
public Boolean isInjvm() {
Expand All @@ -108,7 +107,7 @@ public Boolean isInjvm() {

/**
* @param injvm
* @deprecated 通过scope设置,scope=local表示使用injvm协议.
* @deprecated instead, use scope to judge if it's in jvm, scope=local
*/
@Deprecated
public void setInjvm(Boolean injvm) {
Expand Down
Loading

0 comments on commit d917744

Please sign in to comment.