This commit is contained in:
Rinjae
2025-09-05 17:16:26 +09:00
commit c54ef1903f
4947 changed files with 817291 additions and 0 deletions
@@ -0,0 +1,286 @@
package com.eactive.eai.rms.common.context;
import java.util.Map;
import java.util.Properties;
public interface MonitoringContext {
/** The Constant LOCAL_HOST_IP. */
public static final String LOCAL_HOST_IP = "LOCAL_HOST_IP";
/** The Constant RMS_LOGON_ERR_TITLE. 로그온 에러 메시지 타이틀 */
public static final String RMS_LOGON_ERR_TITLE = "rms.LOGON_ERR_TITLE";
/** The Constant RMS_LOGON_ERR_BODY. 로그온 에러 메시지 내용 */
public static final String RMS_LOGON_ERR_BODY = "rms.LOGON_ERR_BODY";
/** The Constant RMS_ULOG_SEARCH_LIMIT. 통합로그 조회시간 범위 제한(단위 Hour) */
// public static final String RMS_ULOG_SEARCH_LIMIT = "rms.ULOG_SEARCH_LIMIT";
/** The Constant RMS_TRANSACTION_LOG_PATH. 거래처리로그 파일 경로 */
public static final String RMS_TRANSACTION_LOG_PATH = "rms.TR_LOG_PATH";
/** The Constant RMS_TRANSACTION_LOG_TIME. 거래처리로그 남기는 시간 (ex. 18,24) */
public static final String RMS_TRANSACTION_LOG_TIME = "rms.TR_LOG_TIME";
/** The Constant RMS_TRANSACTION_LOG_REMAIN. 거래처리로그 남겨둘 파일 기준일 (ex. 7) */
public static final String RMS_TRANSACTION_LOG_REMAIN = "rms.TR_LOG_REMAIN";
/** The Constant RMS_TRADE_COUNT_TARGET. RMS 대시보드에서 집계처리할 대상 DB */
public static final String RMS_TRADE_COUNT_TARGET = "rms.TRADE_COUNT_TARGET";
/**
* The Constant RMS_PEAK_TPS. Peak TPS 정보(service,date,count,tps) 를 파이프로 구분하여
* 대외|내부|공동|dmz 순으로 저장한다.
*/
public static final String RMS_PEAK_TPS = "rms.PEAK_TPS";
/**
* The Constant RMS_PEAK_TPS. Peak TRADE 정보(service,date,count,tps) 를 파이프로 구분하여
* 대외|내부|공동|dmz 순으로 저장한다.
*/
public static final String RMS_PEAK_TRADE = "rms.PEAK_TRADE";
/** The Constant RMS_LAYOUT_VERSION_INFO. 레이아웃 엑셀파일 버전정보 */
// public static final String RMS_LAYOUT_VERSION_INFO = "rms.LAYOUT_VERSION_INFO";
/** The Constants NEW_DASHBOARD_TITLE. 신 대시보드 타이틀(온라인/테스트 구분위함) */
public static final String NEW_DASHBOARD_TITLE = "rms.NEW_DASHBOARD_TITLE";
/** The Constant TRANSACTION_REPOSITORY_PATH. */
public static final String TRANSACTION_REPOSITORY_PATH = "TRANSACTION_REPOSITORY_PATH";
/** The Constant RMS_PREFIX. */
public static final String RMS_PREFIX = "rms.";
/** The Constant SNA_STATUS_PATH. */
public static final String SNA_STATUS_PATH = "snaStatusPath";
/** The Constant DEFAULT_LOG_PATH. */
public static final String DEFAULT_LOG_PATH = "DEFAULT_LOG_PATH";
/** The Constant SNA_WCA_LOG_FILE. */
public static final String SNA_WCA_LOG_FILE = "snaWCALogFile";
/** The Constant SNA_LU_LOG_PATH. */
// public static final String SNA_LU_LOG_PATH = "snaLuLogPath";
/** The Constant ADAPTER_COMMON_LOG_PATH. */
public static final String ADAPTER_COMMON_LOG_PATH = "adapterCommonLogPath";
/** The Constant SOCKET_ERROR_LOG_FILE. */
public static final String SOCKET_ERROR_LOG_FILE = "socketErrorLogFile";
/** The Constant SOCKET_LOG_FILE. */
public static final String SOCKET_LOG_FILE = "socketLogFile";
// public static final String META_SYNC_YN = "meta.sync.yn";
public static final String IOMAP_DOWNLOAD_PATH = "iomap.download.path";
public static final String IOMAP_UPLOAD_PATH = "iomap.upload.path";
public static final String IOMAP_UPLOAD_AIO_PATH = "iomap.upload.aio.path";
public static final String IOMAP_AFTER_UPLOAD_PATH = "iomap.afterupload.path";
public static final String IOMAP_LISTFILE_PATH = "iomap.listfile.path";
public static final String IOMAP_DEPLOY_YN_BY_RMS = "iomap.deploy.by.rms.yn";
public static final String IOMAP_DEPLOY_YN_BY_ADMIN_ONLY = "iomap.deploy.by.adminOnly.yn";
public static final String IOMAP_DEPLOY_TARGET_NAME = "iomap.deploy.target.name";
public static final String IOMAP_DEPLOY_TARGET_URL = "iomap.deploy.target.url";
public static final String RMS_NOCHECK_ROLEID = "rms.nocheck.roleid";
public static final String RMS_ADAPTER_STATUS_SEND_YN = "rms.adapter.status.send.yn";
public static final String RMS_ADAPTER_STATUS_SEND_URL = "rms.adapter.status.send.url";
public static final String RMS_FLOWCONTROL_B2BFC = "rms.flowcontrol.b2bfc";
public static final String RMS_FLOWCONTROL_QUEUE = "rms.flowcontrol.queue";
public static final String RMS_FAILOVER_TARGET = "rms.failover.target";
public static final String RMS_QUEUE_COUNT = "rms.queue.cnt";
/** 로그보기(상세) xml보기 버튼 보여주기 여부 (2013-10-08 YYJ) */
public static final String RMS_DBTRACKING_XML_YN = "rms.dbtracking.xml.yn";
public static final String RMS_ALL_ROLE_ID = "rms.ALL.ROLE_ID";
// public static final String LAYOUT_UPLOAD_PATH = "layout.upload.path";
public static final String RMS_ADAPTER_REFCLSNAME = "rms.ADAPTER_REFCLSNAME"; // 어댑터 참조클래스.
// spublic static final String RMS_TRACKING_LIMIT_COUNT = "rms.TRACKING_LIMIT_COUNT"; // 로그검색(DB) 최대 List Size.
/* JSP 조회 화면 */
public static final String RMS_JSP_SELECT_USE = "rms.JSP_SELECT_USE";
/**
* 인터페이스관련 추가 삭제 를 화면에서 처리하기 위한 셋팅값
*/
public static final String INTERFACE_HEADER = "interface.header";
public static final String INTERFACE_HEADER_LIST = "interface.header.list";
public static final String INTERFACE_HEADER_PREFIX = "interface.header.prefix";
public static final String INTERFACE_HEADER_DA = "DA";
public static final String INTERFACE_HEADER_AD = "AD";
public static final String MMI_SYNC_SERVERTYPE = "mmi.sync.servertype";
public static final String MMI_SYNC_BAP_SERVERTYPE = "mmi.sync.bap.servertype";
public static final String MMI_SYNC_BAT_SERVERTYPE = "mmi.sync.bat.servertype";
public static final String EIMS_SYNC_SERVERTYPE = "eims.sync.servertype";
/* softCamp 문서 복호화 프로퍼티 */
public static final String SOFTCAMP_PROP = "softCamp_PropPath";
public static final String SOFTCAMP_DFPATH = "softCamp_dstFilePath";
public static final String SOFTCAMP_SFPATH = "softCamp_srcFilePath";
public static final String SOFTCAMP_KEY = "softCamp_keyFilePath";
/* HRMS 연동정보 */
// public static final String HRMS_PATH = "HRMS_FilePath";
// public static final String HRMS_FILE = "HRMS_FileName";
// public static final String HRMS_ORG_FILE = "HRMS_org_FileName";
/* IQMS 연동URL 정보 */
public static final String IQMS_APP_URL = "IQMS_app_url";
public static final String IQMS_EAI_URL = "IQMS_eai_url";
/* ASIS 어댑터 전환테스트 URL */
// public static final String ASIS_ADPT_URI = "asis_adpt_uri";
// public static final String ADPT_CHG_INST = "adpt_chg_inst";
// public static final String ADPT_CHG_INSTNAME = "adpt_chg_instname";
// public static final String ADPT_INST_USEYN = "adpt_inst_useyn";
/* TEST 어댑터 전환 Command 전송용 URL */
public static final String ADPT_CHG_TEST_URL = "adpt_chg_test_url";
// public static final String ADPT_CHG_TEST_STATUS_IP = "adpt_chg_test_status_ip";
/* TOBE 어댑터전환 INST */
// public static final String TOBE_ADPT_CHG_INST = "tobe_adpt_chg_inst";
// public static final String TOBE_ADPT_CHG_INSTNAME = "tobe_adpt_chg_instname";
/* 사용자 Default 관련 정보 */
public static final String USER_DEFAULT_RULE = "user_default_rule";
/* CM 관련 정보 */
public static final String CM_AURORA_INI_PATH = "cm.aurora.ini.path";
public static final String CM_AURORA_TMP_PATH = "cm.aurora.tmp.path";
public static final String CM_TEMP_PATH = "cm.temp.path";
public static final String CM_AFTER_PATH = "cm.after.path";
public static final String CM_UPLOAD_PATH = "cm.upload.path";
public static final String CM_DOWNLOAD_PATH = "cm.download.path";
public static final String CM_BACKUP_PATH = "cm.backup.path";
public static final String CM_TARGET_BASEURL = "cm.target.baseurl";
public static final String CM_STAGE_BASEURL = "cm.stage.baseurl";
public static final String CM_PROD_BASEURL = "cm.prod.baseurl";
public static final String CM_RESTORE_PATH = "cm.restore.path";
public static final String CM_FAIL_PATH = "cm.fail.path";
public static final String CM_IOMAP_PATH = "cm.iomap.path";
public static final String CM_DEVELOPER_AFTER_PATH = "cm.developer.after.path";
public static final String CM_DEVELOPER_UPLOAD_PATH = "cm.developer.upload.path";
public static final String CM_DEVELOPER_BACKUP_PATH = "cm.developer.backup.path";
public static final String JMX_SERVER_DSG = "JMX.SERVER.DSG";
public static final String JMX_SERVER_GSG = "JMX.SERVER.GSG";
public static final String JMX_SERVER_NSG = "JMX.SERVER.NSG";
public static final String JMX_SERVER_ZSG = "JMX.SERVER.ZSG";
public static final String JMX_SERVER_ASG = "JMX.SERVER.ASG";
// 선착준 집중계좌
public static final String FIRSTACCOUNT_IP = "firstAccount_ip";
public static final String FIRSTACCOUNT_PORT = "firstAccount_port";
public static final String FIRSTACCOUNT_PATH = "firstAccount_path";
public static final String FIRSTACCOUNT_FILENM = "firstAccount_fileNm";
public static final String FIRSTACCOUNT_INST = "firstAccount_inst";
public static final String ITSMPERM_IP = "ItsmPermIP";
public static final String ITSMPERM_PORT = "ItsmPermPORT";
public static final String ITSMCHECKLIST_IP = "ItsmCheckListIP";
public static final String ITSMCHECKLIST_PORT = "ItsmCheckListPORT";
// Queue 모니터링을 위한 각종설정값
public static final String QUEUEHOSTCOUNT = "queue.host.count";
public static final String QUEUEHOSTPORT = "queue.host.port";
public static final String QUEUESMSCOUNT = "queue.sms.count";
// 소켓 포트관리
public static final String ADPT_PORT_INST = "adpt_port_inst";
// 타임아웃 에러코드 최대 저장건수
public static final String TIMEOUT_ERROR_CODES = "timeout_error_codes";
public static final String BIZ_ERROR_CODES = "biz_error_codes";
// 에러건수 문자발송 건수 지정
public static final String SMS_ERROR_COUNT = "sms_error_count";
// 스테이지 EMS IP
public static final String STAGE_EMS_IP = "stage_ems_ip";
// public static final String EMS_PROD_IP = "ems_prod_ip";
// 어댑터 닉네임 동기화 URL
public static final String RMS_ADAPTER_NICKNAME_SYNC_URL = "rms_adapter_nickname_sync_url";
// PU정보조회 Command
public static final String SNA_PU_INFO_CMD = "snaPuInfoCmd";
// 통계 월간보고서 다운로드 경로
public static final String MONTHLY_REPORT_DOWN_PATH = "monthly_report_down_path";
// JMS 모니터링 타임아웃
public static final String JMX_SET_TIMEOUT = "JMX_SET_TIMEOUT";
// 거래 실적 추출
public static final String FILE_PATH_KEY = "tran.result.file.path";
public static final String SEND_IF_KEY = "tran.result.send.if";
// 통합관제 제공용 에러추출 간격
public static final String ITSM_ERROR_INTERVAL = "itsm.error.interval";
// Login시 userServiceType에 따라서 메뉴 분기 할지 YN
public static final String USER_SERVICETYPE_VALIDATION = "user.servicetype.validation";
public static final String AWS_S3_CM_BUCKET_NAME = "aws.s3.cm.bucket.name";
public static final String MENU_RENDER_ADDITIONAL_SERVICES = "menu.render.additional.services";
public static final String KEYSTORE_UPLOAD_PATH = "keystore.upload.path";
public abstract String getStringProperty(String propertyName);
public abstract String getStringProperty(String propertyName, String defaultString);
public abstract int getIntProperty(String propertyName);
public abstract int getIntProperty(String propertyName, int defaultInt);
public abstract long getLongProperty(String propertyName);
public abstract long getLongProperty(String propertyName, long defaultLong);
public abstract boolean getBooleanProperty(String propertyName);
public abstract boolean getBooleanProperty(String propertyName, boolean defaultBoolean);
public abstract void init();
public abstract void refresh();
public abstract Properties getProperties();
public abstract String getProperty(String keyVal);
public abstract String getProperty(String keyVal, String defaultString);
public abstract void refresh(String key);
public abstract Map<String, String> getPortMapper();
}
@@ -0,0 +1,14 @@
package com.eactive.eai.rms.common.context;
import java.util.Map;
import java.util.Properties;
public interface MonitoringContextDAO {
public abstract String getProperty(String key, String hostIp);
public abstract Map<String, String> getPortMap();
public abstract Properties getProperties(String hostIp);
}
@@ -0,0 +1,98 @@
package com.eactive.eai.rms.common.context;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.eactive.eai.rms.common.base.SqlMapClientForMonitoringTemplateDao;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.MonitoringPropertyId;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyGroupService;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService;
@Repository("monitoringContextDAO")
@Transactional(transactionManager = "transactionManagerForEMS")
class MonitoringContextDAOImpl extends SqlMapClientForMonitoringTemplateDao implements MonitoringContextDAO {
@Autowired
private MonitoringPropertyGroupService monitoringPropertyGroupService;
@Autowired
private MonitoringPropertyService monitoringPropertyService;
@Cacheable("monitoringContextProperties")
@Override
public String getProperty(String key, String instancePropertyGroupName) {
MonitoringPropertyId instancePropertyId = new MonitoringPropertyId();
instancePropertyId.setPrptyGroupName(instancePropertyGroupName);
instancePropertyId.setPrptyName(key);
if (monitoringPropertyService.existsById(instancePropertyId)) {
// 인스턴스별 프로퍼티 조회
return monitoringPropertyService.getById(instancePropertyId).getPrpty2Val();
}
MonitoringPropertyId commonPropertyId = new MonitoringPropertyId(
MonitoringPropertyGroupService.MONITORING_PROPERTY_KEY, key);
if (monitoringPropertyService.existsById(commonPropertyId)) {
// 공통 프로퍼티 조회
return monitoringPropertyService.getById(commonPropertyId).getPrpty2Val();
}
return null;
}
private Optional<String> extractTextInsideBraces(String text) {
Pattern pattern = Pattern.compile("\\{(.*?)\\}");
Matcher matcher = pattern.matcher(text);
return matcher.find() ? Optional.of(matcher.group(1)) : Optional.empty();
}
@Override
public Map<String, String> getPortMap() {
Map<String, String> portMap = new HashMap<>();
monitoringPropertyService.findAllByIdPrptyName("WEBSERVERPORT").forEach(prop -> {
String groupName = prop.getId().getPrptyGroupName();
extractTextInsideBraces(groupName)
.ifPresent(instanceName -> portMap.put(instanceName, prop.getPrpty2Val()));
});
return portMap;
}
@Override
public Properties getProperties(String instancePropertyGroupName) {
final Properties properties = new Properties();
properties.putAll(System.getProperties());
loadMonitoringProperties(properties, MonitoringPropertyGroupService.MONITORING_PROPERTY_KEY);
loadInstanceSpecificMonitoringProperties(properties, instancePropertyGroupName);
return properties;
}
private void loadMonitoringProperties(Properties properties, String propertyKey) {
monitoringPropertyGroupService
.getById(propertyKey)
.getMonitoringProperties()
.forEach(p -> properties.put(p.getId().getPrptyName(), p.getPrpty2Val()));
}
private void loadInstanceSpecificMonitoringProperties(Properties properties, String instancePropertyGroupName) {
monitoringPropertyGroupService
.findById(instancePropertyGroupName)
.ifPresent(g -> g
.getMonitoringProperties()
.forEach(p -> properties.put(p.getId().getPrptyName(), p.getPrpty2Val())));
}
}
@@ -0,0 +1,202 @@
package com.eactive.eai.rms.common.context;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.annotation.PostConstruct;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.eactive.eai.rms.common.Version;
import com.eactive.eai.rms.common.util.ContainerUtil;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.MonitoringPropertyId;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyGroupService;
import com.eactive.eai.rms.data.entity.man.monitoringProperty.service.MonitoringPropertyService;
@Service("monitoringContext")
@Transactional(transactionManager = "transactionManagerForEMS")
class MonitoringContextImpl implements MonitoringContext {
/** The Constant logger. */
private static final Logger logger = Logger.getLogger(MonitoringContextImpl.class);
private static final String EAI_AGENTID = "eai.agentid";
@Autowired
private MonitoringContextDAO monitoringContextDAO;
private Properties properties = null;
private String instancePropertyGroupName;
@Autowired
private MonitoringPropertyService monitoringPropertyService;
public void refresh() {
init();
}
public void refresh(String propName) {
try {
monitoringPropertyService
.findById(
new MonitoringPropertyId(MonitoringPropertyGroupService.MONITORING_PROPERTY_KEY, propName))
.ifPresent(p -> {
monitoringPropertyService.refresh(p);
logger.info(propName + "=" + p.getPrpty2Val());
this.properties.put(propName, p.getPrpty2Val());
});
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
public Properties getProperties() {
return this.properties;
}
@PostConstruct
public void init() {
try {
String hostIp = InetAddress.getLocalHost().getHostAddress();
this.instancePropertyGroupName = String
.format(MonitoringPropertyGroupService.MONITORING_PROPERTY_KEY_FORMAT, hostIp);
this.properties = monitoringContextDAO.getProperties(instancePropertyGroupName);
String eaiAgentId = System.getProperty(EAI_AGENTID);
if (StringUtils.isBlank(eaiAgentId)) {
eaiAgentId = properties.getProperty("ems_agent_id");
if (StringUtils.isNotBlank(eaiAgentId)) {
System.setProperty(EAI_AGENTID, eaiAgentId);
}
}
setPortMapper(monitoringContextDAO.getPortMap());
logger.info("SSO AgentId : " + System.getProperty(EAI_AGENTID));
} catch (Exception e) {
logger.fatal("MonitoringContext 를 초기화 할 수 없습니다.", e);
}
printProperties();
}
private void addAgentInfomationForPrint(StringBuilder sb, String text) {
sb.append("# ").append(text).append("\n");
}
private void addAgentInfomationForPrint(StringBuilder sb, String id, String value) {
sb.append("# ").append(id).append("\t: ").append(value).append("\n");
}
private void addLineForPrint(StringBuilder sb) {
sb
.append("###################################")
.append("############################################")
.append("\n");
}
private void printProperties() {
String javaVersion = System.getProperty("java.version");
String javaVender = System.getProperty("java.vendor");
String was = ContainerUtil.getString();
if (logger.isInfoEnabled()) {
StringBuilder sb = new StringBuilder(1024);
addLineForPrint(sb.append("\n"));
addAgentInfomationForPrint(sb, Version.getVersionInfomation());
addAgentInfomationForPrint(sb, "WAS", was);
addAgentInfomationForPrint(sb, "JDK VENDER", javaVender);
addAgentInfomationForPrint(sb, "JDK VERSION", javaVersion);
addAgentInfomationForPrint(sb, "SERVER IP", instancePropertyGroupName);
addLineForPrint(sb);
logger.info(sb.toString());
}
try {
Enumeration<Object> keysEnum = properties.keys();
List<String> keyList = new ArrayList<>();
while (keysEnum.hasMoreElements()) {
keyList.add((String) keysEnum.nextElement());
}
Collections.sort(keyList);
for (String key : keyList) {
logger.info(key + "=" + properties.getProperty(key));
}
} catch (Exception e) {
logger.warn("monitoringContext properties is null " + e.getMessage());
}
}
private Map<String, String> portMapper = null;
@Override
public Map<String, String> getPortMapper() {
return portMapper;
}
public void setPortMapper(Map<String, String> portMapper) {
this.portMapper = portMapper;
}
public String getStringProperty(String propertyName) {
return properties.getProperty(propertyName);
}
public String getStringProperty(String propertyName, String defaultString) {
String value = getStringProperty(propertyName);
return value != null ? value : defaultString;
}
public int getIntProperty(String key) {
return getIntProperty(key, 0);
}
public int getIntProperty(String propertyName, int defaultInt) {
String prop = properties.getProperty(propertyName);
return prop == null ? defaultInt : Integer.parseInt(prop.trim());
}
public long getLongProperty(String propertyName) {
String prop = properties.getProperty(propertyName);
return prop == null ? 0 : Long.parseLong(prop.trim());
}
public long getLongProperty(String propertyName, long defaultLong) {
String prop = properties.getProperty(propertyName);
return prop == null ? defaultLong : Long.parseLong(prop.trim());
}
public boolean getBooleanProperty(String propertyName) {
String prop = properties.getProperty(propertyName);
return Boolean.parseBoolean(prop.trim());
}
public boolean getBooleanProperty(String propertyName, boolean defaultBoolean) {
String prop = properties.getProperty(propertyName);
return prop == null ? defaultBoolean : Boolean.parseBoolean(prop.trim());
}
@Override
public String getProperty(String keyVal) {
return getStringProperty(keyVal);
}
@Override
public String getProperty(String keyVal, String defaultString) {
return getStringProperty(keyVal, defaultString);
}
}