Skip to content

Commit ca59b6c

Browse files
authored
Merge pull request #173 from Dokyeongyun/ft-220225-runMenu
Ft 220225 run menu
2 parents 9033449 + 9246c08 commit ca59b6c

19 files changed

+1681
-490
lines changed

src/main/java/root/core/repository/constracts/PropertyRepository.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public interface PropertyRepository {
5151

5252
String getLastUseMonitoringPresetName();
5353

54+
String getLastUseMonitoringPresetName(String filePath);
55+
5456
String[] getMonitoringDBNames();
5557

5658
String[] getMonitoringServerNames();
@@ -64,4 +66,6 @@ public interface PropertyRepository {
6466
JschConnectionInfo getJschConnectionInfo(String serverName);
6567

6668
AlertLogCommand getAlertLogCommand(String serverName);
69+
70+
String getMonitoringConfigResource(String key);
6771
}

src/main/java/root/core/repository/implement/PropertyRepositoryImpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,17 @@ public Map<String, String> getMonitoringPresetMap() {
424424
public String getLastUseMonitoringPresetName() {
425425
return connInfoConfig.subset("monitoring.setting.preset.lastuse").getString("");
426426
}
427+
428+
/**
429+
* 최근 사용한 Monitoring Preset 이름을 반환한다. 단, 최근 사용한 Preset이 없을 때, NULL을 반환한다.
430+
*
431+
* @return
432+
*/
433+
@Override
434+
public String getLastUseMonitoringPresetName(String filePath) {
435+
load(filePath);
436+
return connInfoConfig.subset("monitoring.setting.preset.lastuse").getString("");
437+
}
427438

428439
/**
429440
* 모니터링할 DB명 배열을 반환한다.
@@ -535,4 +546,9 @@ public AlertLogCommand getAlertLogCommand(String serverName) {
535546
alertLogDateFormatRegex);
536547
return alc;
537548
}
549+
550+
@Override
551+
public String getMonitoringConfigResource(String key) {
552+
return monitoringConfig.getString(key);
553+
}
538554
}

src/main/java/root/core/service/contracts/PropertyService.java

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,53 @@
88

99
public interface PropertyService {
1010

11+
/**
12+
* 접속정보 설정파일을 Load 한다.
13+
*
14+
* @param filePath
15+
*/
16+
void loadConnectionInfoConfig(String filePath);
17+
18+
/**
19+
* 모니터링 접속정보 설정파일의 경로를 반환한다.
20+
*
21+
* @return
22+
*/
23+
List<String> getConnectionInfoList();
24+
25+
/**
26+
* 최근 사용된 접속정보 설정파일의 경로를 반환한다.
27+
*
28+
* @return
29+
*/
30+
String getLastUseConnectionInfoFilePath();
31+
32+
/**
33+
* 모니터링 여부 설정파일을 Load 한다.
34+
*
35+
* @param filePath
36+
*/
37+
void loadMonitoringInfoConfig(String filePath);
38+
39+
/**
40+
* 최근 사용된 모니터링 여부 Preset 설정파일의 Preset명을 반환한다.
41+
*
42+
* @return
43+
*/
44+
String getLastUsePresetFileName(String filePath);
45+
1146
Map<String, String> getMonitoringPresetMap();
1247

1348
List<String> getMonitoringPresetFilePathList();
1449

1550
List<String> getMonitoringPresetNameList();
1651

1752
String getMonitoringPresetFilePath(String presetName);
18-
53+
1954
List<String> getMonitoringDBNameList();
2055

2156
List<String> getMonitoringServerNameList();
22-
57+
2358
List<JdbcConnectionInfo> getJdbcConnInfoList(List<String> dbNames);
2459

2560
List<JschConnectionInfo> getJschConnInfoList(List<String> serverNames);

src/main/java/root/core/service/implement/FilePropertyService.java

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,43 @@ public FilePropertyService(PropertyRepository propRepo) {
2727
this.propRepo = propRepo;
2828
}
2929

30+
/**
31+
* 접속정보 설정파일을 Load 한다.
32+
*/
33+
@Override
34+
public void loadConnectionInfoConfig(String filePath) {
35+
propRepo.loadConnectionInfoConfig(filePath);
36+
}
37+
38+
/**
39+
* ./config/connectioninfo/ 디렉터리 하위에 있는 접속정보 설정파일 리스트를 반환한다.
40+
*/
41+
@Override
42+
public List<String> getConnectionInfoList() {
43+
return new ArrayList<>(Arrays.asList(propRepo.getConnectionInfoFileNames()));
44+
}
45+
46+
/**
47+
* 최근 사용된 접속정보 설정파일 경로를 반환한다.
48+
*/
49+
@Override
50+
public String getLastUseConnectionInfoFilePath() {
51+
return propRepo.getLastUseConnInfoFilePath();
52+
}
53+
54+
/**
55+
* 모니터링 여부 설정파일을 Load 한다.
56+
*/
57+
@Override
58+
public void loadMonitoringInfoConfig(String filePath) {
59+
propRepo.loadMonitoringInfoConfig(filePath);
60+
}
61+
62+
@Override
63+
public String getLastUsePresetFileName(String filePath) {
64+
return propRepo.getLastUseMonitoringPresetName(filePath);
65+
}
66+
3067
@Override
3168
public Map<String, String> getMonitoringPresetMap() {
3269
return StreamSupport
@@ -35,7 +72,7 @@ public Map<String, String> getMonitoringPresetMap() {
3572
.filter(key -> key.matches(MONITORING_PRESET_KEY)).collect(Collectors.toUnmodifiableMap(key -> {
3673
Matcher m = MONITORING_PRESET_KEY_PATTERN.matcher(key);
3774
return m.matches() ? m.group(1) : null;
38-
}, key -> key));
75+
}, key -> propRepo.getMonitoringConfigResource(key)));
3976
}
4077

4178
@Override
@@ -74,4 +111,5 @@ public List<JschConnectionInfo> getJschConnInfoList(List<String> serverNames) {
74111
return serverNames.stream().sorted().collect(
75112
Collectors.mapping(serverName -> propRepo.getJschConnectionInfo(serverName), Collectors.toList()));
76113
}
114+
77115
}

0 commit comments

Comments
 (0)