Skip to content

Commit ab82359

Browse files
committed
Refactoring: Remove @depreciated method in PropertyRepository
1 parent 01268f1 commit ab82359

File tree

4 files changed

+19
-77
lines changed

4 files changed

+19
-77
lines changed

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,4 @@ public interface PropertyRepository {
6464
JschConnectionInfo getJschConnectionInfo(String serverName);
6565

6666
AlertLogCommand getAlertLogCommand(String serverName);
67-
68-
@Deprecated
69-
List<JdbcConnectionInfo> getJdbcConnectionMap();
70-
71-
@Deprecated
72-
List<JschConnectionInfo> getJschConnectionMap();
73-
74-
@Deprecated
75-
Map<String, AlertLogCommand> getAlertLogCommandMap();
7667
}

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

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.io.FileWriter;
66
import java.io.IOException;
77
import java.util.ArrayList;
8-
import java.util.Collections;
9-
import java.util.HashMap;
108
import java.util.LinkedHashMap;
119
import java.util.List;
1210
import java.util.Map;
@@ -486,25 +484,6 @@ public void createNewPropertiesFile(String filePath, String type) {
486484
}
487485
}
488486

489-
/**
490-
* Properties 파일에서 모니터링할 DB명을 읽어온 후, 각 DB별 JDBC Connection 정보 가지는 객체 생성
491-
*
492-
* @return 각 DB별 JdbcConnectionInfo 객체를 담은 후 DB Name 순으로 정렬한 리스트
493-
*/
494-
@Deprecated
495-
@Override
496-
public List<JdbcConnectionInfo> getJdbcConnectionMap() {
497-
String[] dbNames = connInfoConfig.getStringArray("dbnames");
498-
if (dbNames == null || dbNames.length == 0) {
499-
return new ArrayList<>();
500-
}
501-
List<JdbcConnectionInfo> jdbcList = new ArrayList<>();
502-
for (String dbName : dbNames)
503-
jdbcList.add(getJdbcConnectionInfo(dbName));
504-
Collections.sort(jdbcList, (o1, o2) -> o1.getJdbcDBName().compareTo(o2.getJdbcDBName()) < 0 ? -1 : 1);
505-
return jdbcList;
506-
}
507-
508487
/**
509488
* Properties 파일에서 DB별 JdbcConnectionInfo를 읽어와 객체를 생성
510489
*
@@ -523,25 +502,6 @@ public JdbcConnectionInfo getJdbcConnectionInfo(String dbName) {
523502
return new JdbcConnectionInfo(jdbcAlias, jdbcDriver, jdbcUrl, jdbcId, jdbcPw, jdbcValidation, jdbcConnections);
524503
}
525504

526-
/**
527-
* Properties 파일에서 모니터링할 Server명을 읽어온 후, 각 DB별 JSchConnection 정보 가지는 객체 생성
528-
*
529-
* @return 각 DB별 JdbcConnectionInfo 객체를 담은 후 Server Name 순으로 정렬한 리스트
530-
*/
531-
@Deprecated
532-
@Override
533-
public List<JschConnectionInfo> getJschConnectionMap() {
534-
String[] serverNames = connInfoConfig.getStringArray("servernames");
535-
if (serverNames == null || serverNames.length == 0) {
536-
return new ArrayList<>();
537-
}
538-
List<JschConnectionInfo> jschList = new ArrayList<>();
539-
for (String serverName : serverNames)
540-
jschList.add(getJschConnectionInfo(serverName));
541-
Collections.sort(jschList, (o1, o2) -> o1.getServerName().compareTo(o2.getServerName()) < 0 ? -1 : 1);
542-
return jschList;
543-
}
544-
545505
/**
546506
* Properties 파일에서 Server별 JschConnectionInfo를 읽어와 객체를 생성
547507
*
@@ -575,19 +535,4 @@ public AlertLogCommand getAlertLogCommand(String serverName) {
575535
alertLogDateFormatRegex);
576536
return alc;
577537
}
578-
579-
/**
580-
* Properties 파일에서 모니터링할 서버명을 읽어온 후, 각 서버별 AlertLogCommand 객체를 생성한다.
581-
*
582-
* @return 각 DB별 JdbcConnectionInfo 객체를 담은 후 DB Name 순으로 정렬한 리스트
583-
*/
584-
@Deprecated
585-
@Override
586-
public Map<String, AlertLogCommand> getAlertLogCommandMap() {
587-
String[] serverNames = connInfoConfig.getStringArray("servernames");
588-
Map<String, AlertLogCommand> alcMap = new HashMap<>();
589-
for (String serverName : serverNames)
590-
alcMap.put(serverName, getAlertLogCommand(serverName));
591-
return alcMap;
592-
}
593538
}

src/main/java/root/javafx/Controller/RunMenuController.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
import root.core.repository.implement.PropertyRepositoryImpl;
4141
import root.core.repository.implement.ReportFileRepo;
4242
import root.core.repository.implement.ServerCheckRepositoryImpl;
43+
import root.core.service.contracts.PropertyService;
44+
import root.core.service.implement.FilePropertyService;
4345
import root.core.usecase.constracts.DBCheckUsecase;
4446
import root.core.usecase.constracts.ServerCheckUsecase;
4547
import root.core.usecase.implement.DBCheckUsecaseImpl;
@@ -50,10 +52,12 @@
5052
import root.utils.AlertUtils;
5153

5254
public class RunMenuController implements Initializable {
53-
55+
56+
5457
/* Dependency Injection */
5558
PropertyRepository propRepo = PropertyRepositoryImpl.getInstance();
5659
ReportRepository reportRepository = ReportFileRepo.getInstance();
60+
PropertyService propService = new FilePropertyService(propRepo);
5761

5862
/* View Binding */
5963
@FXML JFXComboBox<String> runConnInfoFileComboBox;
@@ -280,9 +284,10 @@ private void loadConnectionInfoProperties(String connInfoConfigFilePath) {
280284
public void runMonitoring(ActionEvent e) {
281285
if(!validateInput()) return;
282286

283-
// DB Usage Check
284-
List<JdbcConnectionInfo> jdbcConnectionList = propRepo.getJdbcConnectionMap();
285-
for(JdbcConnectionInfo jdbc : jdbcConnectionList) {
287+
// DB Usage Check
288+
List<JdbcConnectionInfo> jdbcConnectionList = propService
289+
.getJdbcConnInfoList(propService.getMonitoringDBNameList());
290+
for (JdbcConnectionInfo jdbc : jdbcConnectionList) {
286291
System.out.println("■ [ " + jdbc.getJdbcDBName() + " Monitoring Start ]\n");
287292
JdbcDatabase db = new JdbcDatabase(jdbc);
288293
db.init();
@@ -292,12 +297,13 @@ public void runMonitoring(ActionEvent e) {
292297
tableSpaceUsageMAP.addTableData(jdbc.getJdbcDBName(), usecase.getCurrentTableSpaceUsage());
293298
asmDiskUsageMAP.addTableData(jdbc.getJdbcDBName(), usecase.getCurrentASMDiskUsage());
294299
db.uninit();
295-
}
296-
300+
}
301+
297302
String alertLogStartDay = alertLogStartDayDP.getValue().toString();
298303
String alertLogEndDay = alertLogEndDayDP.getValue().toString();
299-
List<JschConnectionInfo> jschConnectionList = propRepo.getJschConnectionMap();
300-
for(JschConnectionInfo jsch : jschConnectionList) {
304+
List<JschConnectionInfo> jschConnectionList = propService
305+
.getJschConnInfoList(propService.getMonitoringServerNameList());
306+
for (JschConnectionInfo jsch : jschConnectionList) {
301307
System.out.println("■ [ " + jsch.getServerName() + " Monitoring Start ]\n");
302308
JschServer server = new JschServer(jsch);
303309
server.init();

src/main/java/root/javafx/Controller/SettingMenuController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@
4242
import javafx.stage.FileChooser.ExtensionFilter;
4343
import javafx.stage.Stage;
4444
import javafx.util.StringConverter;
45-
import root.core.domain.AlertLogCommand;
4645
import root.core.domain.JdbcConnectionInfo;
4746
import root.core.domain.JschConnectionInfo;
4847
import root.core.domain.enums.UsageUIType;
4948
import root.core.repository.constracts.PropertyRepository;
5049
import root.core.repository.implement.PropertyRepositoryImpl;
50+
import root.core.service.contracts.PropertyService;
51+
import root.core.service.implement.FilePropertyService;
5152
import root.javafx.CustomView.ConnectionInfoVBox;
5253
import root.javafx.CustomView.DBConnInfoControl;
5354
import root.javafx.CustomView.ServerConnInfoControl;
@@ -65,6 +66,7 @@ public class SettingMenuController implements Initializable {
6566

6667
/* Dependency Injection */
6768
PropertyRepository propRepo = PropertyRepositoryImpl.getInstance();
69+
PropertyService propService = new FilePropertyService(propRepo);
6870

6971
/* View Binding */
7072
@FXML
@@ -106,7 +108,6 @@ public class SettingMenuController implements Initializable {
106108

107109
List<JdbcConnectionInfo> jdbcConnInfoList;
108110
List<JschConnectionInfo> jschConnInfoList;
109-
Map<String, AlertLogCommand> alcMap;
110111

111112
Map<String, String> monitoringPresetMap = new HashMap<>();
112113

@@ -519,9 +520,8 @@ private void createMonitoringElements(VBox rootVBox, String[] monitoringElements
519520
@SuppressWarnings("unchecked")
520521
private void createSettingDynamicElements() {
521522

522-
jdbcConnInfoList = propRepo.getJdbcConnectionMap();
523-
jschConnInfoList = propRepo.getJschConnectionMap();
524-
alcMap = propRepo.getAlertLogCommandMap();
523+
jdbcConnInfoList = propService.getJdbcConnInfoList(propService.getMonitoringDBNameList());
524+
jschConnInfoList = propService.getJschConnInfoList(propService.getMonitoringServerNameList());
525525

526526
ConnectionInfoVBox<JdbcConnectionInfo> dbConnVBox = null;
527527
if (connInfoVBox.lookup("#dbConnVBox") != null) {

0 commit comments

Comments
 (0)