Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into feature_support_…
Browse files Browse the repository at this point in the history
…grpc_core

# Conflicts:
#	NOTICE
#	api/pom.xml
#	common/src/main/java/com/alibaba/nacos/common/notify/DefaultPublisher.java
#	config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java
#	naming/src/test/java/com/alibaba/nacos/naming/consistency/persistent/impl/NamingSnapshotOperationTest.java
#	naming/src/test/java/com/alibaba/nacos/naming/core/DomainsManagerTest.java
#	naming/src/test/java/com/alibaba/nacos/naming/healthcheck/ClientBeatCheckTaskTest.java
#	pom.xml
#	test/src/test/java/com/alibaba/nacos/test/core/JacksonUtils.java
  • Loading branch information
KomachiSion committed May 14, 2021
2 parents 98aae39 + 4ecf293 commit cf5a171
Show file tree
Hide file tree
Showing 64 changed files with 1,810 additions and 423 deletions.
16 changes: 0 additions & 16 deletions .editorconfig

This file was deleted.

28 changes: 25 additions & 3 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,30 @@ Also, please refer to each LICENSE.<component>.txt file, which is located in
the 'license' directory of the distribution file, for the license terms of the
components that this product depends on.


------
com.alibaba.nacos.common.utils.InetAddressValidator.java in this product is
copied from com.dynatrace.openkit.core.util.InetAddressValidator.java of openkit-java project.
https://github.com/Dynatrace/openkit-java
openkit-java
======================

Copyright 2018-2021 Dynatrace LLC

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.

------
This product has a bundle Protocol Buffers��
This product has a bundle Protocol Buffers��
Protocol Buffers
=======================
Protocol Buffers for Go with Gadgets
Expand All @@ -41,7 +63,7 @@ Copyright (c) 2013, The GoGo Authors. All rights reserved.
http://github.com/gogo/protobuf

------
This product has a bundle Istio��
This product has a bundle Istio��
Istio
=======================

Expand All @@ -57,4 +79,4 @@ This product has a bundle Istio
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.
limitations under the License.
5 changes: 0 additions & 5 deletions address/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>nacos-naming</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/alibaba/nacos/api/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public class Constants {

public static final String GLOBAL_ADMIN = "globalAdmin";

public static final String USERNAME = "username";

public static final String TOKEN_REFRESH_WINDOW = "tokenRefreshWindow";

/**
Expand Down
11 changes: 0 additions & 11 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,10 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* 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.nacos.client.config.common;

/**
* config common constants.
*
* @author Nacos
*/
public class ConfigConstants {

public static final String TENANT = "tenant";

public static final String DATA_ID = "dataId";

public static final String GROUP = "group";

public static final String CONTENT = "content";

public static final String CONFIG_TYPE = "configType";

public static final String ENCRYPTED_DATA_KEY = "encryptedDataKey";
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
import java.util.HashMap;
import java.util.Map;

import static com.alibaba.nacos.client.config.common.ConfigConstants.CONTENT;
import static com.alibaba.nacos.client.config.common.ConfigConstants.DATA_ID;
import static com.alibaba.nacos.client.config.common.ConfigConstants.GROUP;
import static com.alibaba.nacos.client.config.common.ConfigConstants.TENANT;

/**
* Config Request.
*
Expand All @@ -34,35 +39,35 @@ public class ConfigRequest implements IConfigRequest {
private final IConfigContext configContext = new ConfigContext();

public String getTenant() {
return (String) param.get("tenant");
return (String) param.get(TENANT);
}

public void setTenant(String tenant) {
param.put("tenant", tenant);
param.put(TENANT, tenant);
}

public String getDataId() {
return (String) param.get("dataId");
return (String) param.get(DATA_ID);
}

public void setDataId(String dataId) {
param.put("dataId", dataId);
param.put(DATA_ID, dataId);
}

public String getGroup() {
return (String) param.get("group");
return (String) param.get(GROUP);
}

public void setGroup(String group) {
param.put("group", group);
param.put(GROUP, group);
}

public String getContent() {
return (String) param.get("content");
return (String) param.get(CONTENT);
}

public void setContent(String content) {
param.put("content", content);
param.put(CONTENT, content);
}

public void getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
import java.util.HashMap;
import java.util.Map;

import static com.alibaba.nacos.client.config.common.ConfigConstants.CONFIG_TYPE;
import static com.alibaba.nacos.client.config.common.ConfigConstants.CONTENT;
import static com.alibaba.nacos.client.config.common.ConfigConstants.DATA_ID;
import static com.alibaba.nacos.client.config.common.ConfigConstants.ENCRYPTED_DATA_KEY;
import static com.alibaba.nacos.client.config.common.ConfigConstants.GROUP;
import static com.alibaba.nacos.client.config.common.ConfigConstants.TENANT;

/**
* Config Response.
*
Expand All @@ -34,51 +41,51 @@ public class ConfigResponse implements IConfigResponse {
private final IConfigContext configContext = new ConfigContext();

public String getTenant() {
return (String) param.get("tenant");
return (String) param.get(TENANT);
}

public void setTenant(String tenant) {
param.put("tenant", tenant);
param.put(TENANT, tenant);
}

public String getDataId() {
return (String) param.get("dataId");
return (String) param.get(DATA_ID);
}

public void setDataId(String dataId) {
param.put("dataId", dataId);
param.put(DATA_ID, dataId);
}

public String getGroup() {
return (String) param.get("group");
return (String) param.get(GROUP);
}

public void setGroup(String group) {
param.put("group", group);
param.put(GROUP, group);
}

public String getContent() {
return (String) param.get("content");
return (String) param.get(CONTENT);
}

public void setContent(String content) {
param.put("content", content);
param.put(CONTENT, content);
}

public String getConfigType() {
return (String) param.get("configType");
return (String) param.get(CONFIG_TYPE);
}

public void setConfigType(String configType) {
param.put("configType", configType);
param.put(CONFIG_TYPE, configType);
}

public String getEncryptedDataKey() {
return (String) param.get("encryptedDataKey");
return (String) param.get(ENCRYPTED_DATA_KEY);
}

public void setEncryptedDataKey(String encryptedDataKey) {
param.put("encryptedDataKey", encryptedDataKey);
param.put(ENCRYPTED_DATA_KEY, encryptedDataKey);
}

@Override
Expand Down
43 changes: 31 additions & 12 deletions client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,48 @@ public class ParamUtil {

private static String appName;

private static final String DEFAULT_SERVER_PORT;
private static final String DEFAULT_SERVER_PORT = "8848";

private static String serverPort;

private static String clientVersion = "unknown";

private static int connectTimeout;

private static double perTaskConfigSize = 3000;

private static final String NACOS_CLIENT_APP_KEY = "nacos.client.appKey";

private static final String BLANK_STR = "";

private static final String NACOS_CLIENT_CONTEXTPATH_KEY = "nacos.client.contextPath";

private static final String DEFAULT_NACOS_CLIENT_CONTEXTPATH = "nacos";

private static final String NACOS_SERVER_PORT_KEY = "nacos.server.port";

private static final String NACOS_CONNECT_TIMEOUT_KEY = "NACOS.CONNECT.TIMEOUT";

private static final String DEFAULT_NACOS_CONNECT_TIMEOUT = "1000";

private static final String PER_TASK_CONFIG_SIZE_KEY = "PER_TASK_CONFIG_SIZE";

private static final String DEFAULT_PER_TASK_CONFIG_SIZE_KEY = "3000";

static {
// 客户端身份信息
appKey = System.getProperty("nacos.client.appKey", "");
// Client identity information
appKey = System.getProperty(NACOS_CLIENT_APP_KEY, BLANK_STR);

defaultContextPath = System.getProperty("nacos.client.contextPath", "nacos");
defaultContextPath = System.getProperty(NACOS_CLIENT_CONTEXTPATH_KEY, DEFAULT_NACOS_CLIENT_CONTEXTPATH);

appName = AppNameUtils.getAppName();

String defaultServerPortTmp = "8848";

DEFAULT_SERVER_PORT = System.getProperty("nacos.server.port", defaultServerPortTmp);
LOGGER.info("[settings] [req-serv] nacos-server port:{}", DEFAULT_SERVER_PORT);
serverPort = System.getProperty(NACOS_SERVER_PORT_KEY, DEFAULT_SERVER_PORT);
LOGGER.info("[settings] [req-serv] nacos-server port:{}", serverPort);

String tmp = "1000";
try {
tmp = System.getProperty("NACOS.CONNECT.TIMEOUT", "1000");
tmp = System.getProperty(NACOS_CONNECT_TIMEOUT_KEY, DEFAULT_NACOS_CONNECT_TIMEOUT);
connectTimeout = Integer.parseInt(tmp);
} catch (NumberFormatException e) {
final String msg = "[http-client] invalid connect timeout:" + tmp;
Expand All @@ -83,7 +101,8 @@ public class ParamUtil {
clientVersion = VersionUtils.version;

try {
perTaskConfigSize = Double.valueOf(System.getProperty("PER_TASK_CONFIG_SIZE", "3000"));
perTaskConfigSize = Double
.valueOf(System.getProperty(PER_TASK_CONFIG_SIZE_KEY, DEFAULT_PER_TASK_CONFIG_SIZE_KEY));
LOGGER.info("PER_TASK_CONFIG_SIZE: {}", perTaskConfigSize);
} catch (Throwable t) {
LOGGER.error("[PER_TASK_CONFIG_SIZE] PER_TASK_CONFIG_SIZE invalid", t);
Expand Down Expand Up @@ -139,7 +158,7 @@ public static void setPerTaskConfigSize(double perTaskConfigSize) {
}

public static String getDefaultServerPort() {
return DEFAULT_SERVER_PORT;
return serverPort;
}

public static String getDefaultNodesPath() {
Expand Down Expand Up @@ -188,7 +207,7 @@ public String call() {
* @return end point rule
*/
public static String parsingEndpointRule(String endpointUrl) {
// 配置文件中输入的话,以 ENV 中的优先,
// If entered in the configuration file, the priority in ENV will be given priority.
if (endpointUrl == null || !PATTERN.matcher(endpointUrl).find()) {
// skip retrieve from system property and retrieve directly from system env
String endpointUrlSource = System.getenv(PropertyKeyConst.SystemEnv.ALIBABA_ALIWARE_ENDPOINT_URL);
Expand Down
Loading

0 comments on commit cf5a171

Please sign in to comment.