forked from trpc-group/trpc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicationConfigOverview.java
More file actions
102 lines (87 loc) · 2.99 KB
/
Copy pathApplicationConfigOverview.java
File metadata and controls
102 lines (87 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* Tencent is pleased to support the open source community by making tRPC available.
*
* Copyright (C) 2023 Tencent.
* All rights reserved.
*
* If you have downloaded a copy of the tRPC source code from Tencent,
* please note that tRPC source code is licensed under the Apache 2.0 License,
* A copy of the Apache 2.0 License can be found in the LICENSE file.
*/
package com.tencent.trpc.admin;
import com.tencent.trpc.core.common.ConfigManager;
import com.tencent.trpc.core.common.config.GlobalConfig;
import com.tencent.trpc.core.common.config.ServerConfig;
import java.util.List;
/**
* Application configuration view
*/
public class ApplicationConfigOverview {
/**
* Application configuration view
*/
private static ApplicationConfigOverview instance = new ApplicationConfigOverview();
/**
* Application configuration view object
*/
private GlobalConfigOverview global;
/**
* Server configuration view object
*/
private ServerConfigOverview server;
/**
* Protocol configuration view object
*/
private List<ProtocolConfigOverview> protocols;
private ApplicationConfigOverview() {
}
public static ApplicationConfigOverview getInstance() {
return instance;
}
/**
* Init config
*
* @param applicationConfig application configuration
*/
public static void init(ConfigManager applicationConfig) {
GlobalConfig globalConfig = applicationConfig.getGlobalConfig();
GlobalConfigOverview globalConfigOverview = new GlobalConfigOverview();
if (globalConfig != null) {
globalConfigOverview.setNamespace(globalConfig.getNamespace());
globalConfigOverview.setEnvName(globalConfig.getEnvName());
globalConfigOverview.setContainerName(globalConfig.getContainerName());
}
instance.setGlobal(globalConfigOverview);
ServerConfig serverConfig = applicationConfig.getServerConfig();
ServerConfigOverview serverConfigOverview = new ServerConfigOverview();
if (serverConfig != null) {
serverConfigOverview.setApp(serverConfig.getApp());
serverConfigOverview.setServerName(serverConfig.getServer());
}
instance.setServer(serverConfigOverview);
}
public GlobalConfigOverview getGlobal() {
return global;
}
public void setGlobal(GlobalConfigOverview global) {
this.global = global;
}
public ServerConfigOverview getServer() {
return server;
}
public void setServer(ServerConfigOverview server) {
this.server = server;
}
public List<ProtocolConfigOverview> getProtocols() {
return protocols;
}
public void setProtocols(List<ProtocolConfigOverview> protocols) {
this.protocols = protocols;
}
@Override
public String toString() {
return "ApplicationConfigOverview{" + "global=" + global + ", server=" + server
+ ", protocols="
+ protocols + '}';
}
}