-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e69df8c
commit 9dc473c
Showing
19 changed files
with
613 additions
and
811 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ommon/polaris-config/src/main/java/com/tencent/polaris/api/config/global/AdminConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making Polaris available. | ||
* | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* Licensed under the BSD 3-Clause License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
* | ||
* 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.tencent.polaris.api.config.global; | ||
|
||
import com.tencent.polaris.api.config.verify.Verifier; | ||
|
||
/** | ||
* Admin Config. | ||
* | ||
* @author Haotian Zhang | ||
*/ | ||
public interface AdminConfig extends Verifier { | ||
|
||
/** | ||
* Admin的监听IP | ||
* | ||
* @return host | ||
*/ | ||
String getHost(); | ||
|
||
/** | ||
* Admin的监听端口 | ||
* | ||
* @return port | ||
*/ | ||
int getPort(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...laris-config/src/main/java/com/tencent/polaris/factory/config/global/AdminConfigImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making Polaris available. | ||
* | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* Licensed under the BSD 3-Clause License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
* | ||
* 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.tencent.polaris.factory.config.global; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.tencent.polaris.api.config.global.AdminConfig; | ||
import com.tencent.polaris.api.utils.StringUtils; | ||
import com.tencent.polaris.factory.util.ConfigUtils; | ||
|
||
public class AdminConfigImpl implements AdminConfig { | ||
|
||
@JsonProperty | ||
private String host; | ||
|
||
@JsonProperty | ||
private Integer port; | ||
|
||
@Override | ||
public String getHost() { | ||
return host; | ||
} | ||
|
||
public void setHost(String host) { | ||
this.host = host; | ||
} | ||
|
||
@Override | ||
public int getPort() { | ||
return port; | ||
} | ||
|
||
public void setPort(Integer port) { | ||
this.port = port; | ||
} | ||
|
||
@Override | ||
public void verify() { | ||
ConfigUtils.validateString(host, "global.admin.host"); | ||
ConfigUtils.validatePositiveInteger(port, "global.admin.port"); | ||
} | ||
|
||
@Override | ||
public void setDefault(Object defaultObject) { | ||
if (null != defaultObject) { | ||
AdminConfig adminConfig = (AdminConfig) defaultObject; | ||
if (null == port || 0 == port) { | ||
setPort(adminConfig.getPort()); | ||
} | ||
if (StringUtils.isBlank(host)) { | ||
setHost(adminConfig.getHost()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.