22
33import java .io .File ;
44import java .net .URL ;
5- import java .util .ArrayList ;
65import java .util .HashMap ;
7- import java .util .LinkedHashSet ;
86import java .util .List ;
97import java .util .Map ;
108import java .util .Optional ;
119import java .util .ResourceBundle ;
12- import java .util .Set ;
13- import java .util .stream .Collectors ;
1410
1511import org .apache .commons .configuration2 .PropertiesConfiguration ;
1612import org .apache .commons .lang3 .StringUtils ;
3834import javafx .stage .FileChooser .ExtensionFilter ;
3935import javafx .stage .Stage ;
4036import javafx .util .StringConverter ;
41- import root .core .domain .ASMDiskUsage ;
42- import root .core .domain .AlertLog ;
43- import root .core .domain .ArchiveUsage ;
4437import root .core .domain .JdbcConnectionInfo ;
4538import root .core .domain .JschConnectionInfo ;
4639import root .core .domain .MonitoringYN ;
4740import root .core .domain .MonitoringYN .MonitoringTypeAndYN ;
48- import root .core .domain .OSDiskUsage ;
49- import root .core .domain .TableSpaceUsage ;
5041import root .core .domain .enums .MonitoringType ;
5142import root .core .domain .enums .RoundingDigits ;
5243import root .core .domain .enums .UsageUIType ;
@@ -107,16 +98,6 @@ public class SettingMenuController implements Initializable {
10798 JFXComboBox <UsageUIType > usageUICB ;
10899
109100 /* Common Data */
110- private static final Map <Class <?>, String > DB_MONITORING_CONTENTS = new HashMap <>();
111- private static final Map <Class <?>, String > SERVER_MONITORING_CONTENTS = new HashMap <>();
112- static {
113- DB_MONITORING_CONTENTS .put (ArchiveUsage .class , "Archive Usage" );
114- DB_MONITORING_CONTENTS .put (TableSpaceUsage .class , "TableSpace Usage" );
115- DB_MONITORING_CONTENTS .put (ASMDiskUsage .class , "ASM Disk Usage" );
116- SERVER_MONITORING_CONTENTS .put (OSDiskUsage .class , "OS Disk Usage" );
117- SERVER_MONITORING_CONTENTS .put (AlertLog .class , "Alert Log" );
118- }
119-
120101 List <JdbcConnectionInfo > jdbcConnInfoList ;
121102 List <JschConnectionInfo > jschConnInfoList ;
122103
@@ -295,21 +276,21 @@ private void loadSelectedConfigFile(String absoluteFilePath) {
295276 int startIdx = absoluteFilePath .lastIndexOf ("\\ config" );
296277 String filePath = startIdx == -1 ? absoluteFilePath : "." + absoluteFilePath .substring (startIdx );
297278
298- // 2. 파일경로에서 접속정보 프로퍼티파일을 읽는다.
279+ // 2. fileChooserText의 텍스트를 현재 선택된 파일경로로 변경한다.
280+ fileChooserText .setText (filePath );
281+
282+ // 3. 파일경로에서 접속정보 프로퍼티파일을 읽는다.
299283 propRepo .loadConnectionInfoConfig (filePath );
300284
301- // 3 . 프로퍼티파일에 작성된 내용에 따라 동적 요소를 생성한다.
285+ // 4 . 프로퍼티파일에 작성된 내용에 따라 동적 요소를 생성한다.
302286 createSettingDynamicElements ();
303287
304288 // TODO move this logic to PropertyService
305- // 4 . remember.properties 파일에 최근 사용된 설정파일 경로를 저장한다.
289+ // 5 . remember.properties 파일에 최근 사용된 설정파일 경로를 저장한다.
306290 PropertiesConfiguration rememberConfig = propRepo .getConfiguration ("rememberConfig" );
307291 rememberConfig .setProperty ("filepath.config.lastuse" , filePath .replace ("\\ " , "/" ));
308292 propRepo .save (rememberConfig .getString ("filepath.config.remember" ), rememberConfig );
309293
310- // 5. fileChooserText의 텍스트를 현재 선택된 파일경로로 변경한다.
311- fileChooserText .setText (filePath );
312-
313294 } catch (Exception e ) {
314295 e .printStackTrace ();
315296 // 6. 파일 load가 실패 시, Alert 메시지를 띄운다.
@@ -327,12 +308,12 @@ private void loadSelectedConfigFile(String absoluteFilePath) {
327308 private void loadMonitoringConfigFile (String filePath ) {
328309 monitoringElementsVBox .getChildren ().clear ();
329310
330- propRepo . loadMonitoringInfoConfig ( filePath );
311+ String presetConfigFileName = monitoringPresetComboBox . getSelectionModel (). getSelectedItem ( );
331312
332- String [] dbNames = propRepo . getMonitoringDBNames ( );
333- String [] serverNames = propRepo . getMonitoringServerNames ( );
313+ List < MonitoringYN > dbYnList = propService . getDBMonitoringYnList ( presetConfigFileName );
314+ List < MonitoringYN > serverYnList = propService . getServerMonitoringYnList ( presetConfigFileName );
334315
335- createMonitoringElements (monitoringElementsVBox );
316+ createMonitoringElements (monitoringElementsVBox , dbYnList , serverYnList );
336317 }
337318
338319 /**
@@ -396,25 +377,10 @@ public void saveMonitoringSettings(ActionEvent e) {
396377 * 모니터링 여부 설정할 요소들 동적 생성
397378 *
398379 * @param rootVBox
399- * @param monitoringElements
400- * @param monitoringAlias
380+ * @param dbYnList
381+ * @param serverYnList
401382 */
402- private void createMonitoringElements (VBox rootVBox ) {
403-
404- List <MonitoringYN > dbYnList = new ArrayList <>();
405- List <MonitoringTypeAndYN > childList = new ArrayList <>();
406- childList .add (new MonitoringTypeAndYN (MonitoringType .ARCHIVE , false ));
407- childList .add (new MonitoringTypeAndYN (MonitoringType .TABLE_SPACE , true ));
408- childList .add (new MonitoringTypeAndYN (MonitoringType .ASM_DISK , false ));
409- dbYnList .add (new MonitoringYN ("ERP" , childList ));
410- dbYnList .add (new MonitoringYN ("ERP2" , childList ));
411- dbYnList .add (new MonitoringYN ("ERP3" , childList ));
412-
413- List <MonitoringYN > serverYnList = new ArrayList <>();
414- List <MonitoringTypeAndYN > childList2 = new ArrayList <>();
415- childList2 .add (new MonitoringTypeAndYN (MonitoringType .OS_DISK , true ));
416- childList2 .add (new MonitoringTypeAndYN (MonitoringType .ALERT_LOG , true ));
417- serverYnList .add (new MonitoringYN ("DBERP1" , childList2 ));
383+ private void createMonitoringElements (VBox rootVBox , List <MonitoringYN > dbYnList , List <MonitoringYN > serverYnList ) {
418384
419385 MonitoringYNVBox monitoringYNVBox = new MonitoringYNVBox ();
420386 for (MonitoringYN dbYn : dbYnList ) {
@@ -425,7 +391,7 @@ private void createMonitoringElements(VBox rootVBox) {
425391 }
426392 }
427393 monitoringYNVBox .initSelection (dbYnList );
428-
394+
429395 for (MonitoringYN serverYn : serverYnList ) {
430396 for (MonitoringTypeAndYN typeAndYn : serverYn .getMonitoringTypeList ()) {
431397 MonitoringType type = typeAndYn .getMonitoringType ();
0 commit comments