EMSADM DDL identity to sequence 대응 완료

This commit is contained in:
Rinjae
2025-11-14 15:01:12 +09:00
parent fa2f64169e
commit c06bbb3168
7 changed files with 328 additions and 109 deletions
@@ -12,6 +12,8 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import com.eactive.eai.rms.common.datasource.DataSourceType;
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
import com.eactive.eai.rms.data.PortalSchemaProviderHolder;
import com.eactive.eai.rms.env.EmsConfig;
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
@@ -22,7 +24,13 @@ public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor
public void postProcessBeanFactory(ConfigurableListableBeanFactory factory)
throws BeansException {
// PortalSchemaProviderHolder 초기화 (Hibernate EntityManagerFactory 생성 전에 필요)
PortalSchemaProviderHolder.setProvider(() -> System.getProperty(EmsConfig.TABLE_OWNER));
if (logger.isDebugEnabled()) {
logger.debug("PortalSchemaProviderHolder initialized with tableOwner: " + System.getProperty(EmsConfig.TABLE_OWNER));
}
List<DataSourceType> dataSourceTypes = new ArrayList<DataSourceType>();
Map maps = factory.getBeansOfType(DataSourceType.class);
@@ -1,8 +1,5 @@
package com.eactive.eai.rms.common.startup;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
@@ -11,115 +8,117 @@ import com.eactive.eai.rms.common.util.CommonConstants;
import com.eactive.eai.rms.env.EmsConfig;
import com.eactive.eai.rms.onl.common.service.AdapterStatusSendThreadPool;
public class AppInitializer implements InitializingBean, DisposableBean {
public class AppInitializer implements InitializingBean, DisposableBean {
final Logger logger = Logger.getLogger(AppInitializer.class);
boolean debug = true;
private String instName;
private String tableOwner;
private String systemMode = "D"; //EAI System Mode : [P/T/D/S]
private String themeColor = "black";
private String drMode = "";
private String eaiDatasourceType = "DEV"; // 데이터 소스 타입 :[DEV:개발/STG:스테이징/PRD:운영] ...NSG:내부서버
public void setInstName(String instName) {
this.instName = instName;
}
public void setTableOwner(String tableOwner) {
this.tableOwner = tableOwner;
}
public void setSystemMode(String systemMode) {
this.systemMode = systemMode;
}
public void setThemeColor(String themeColor) {
this.themeColor = themeColor;
}
public void setDrMode(String drMode) {
this.drMode = drMode;
}
public void setEaiDatasourceType(String eaiDatasourceType) {
this.eaiDatasourceType = eaiDatasourceType;
}
private void init()
{
if (debug) {
logger.debug("applicationInitialized");
}
//MS949로 default encoding 고정
// System.setProperty("file.encoding","MS949");
// Field charset = null;
// try {
// charset = Charset.class.getDeclaredField("defaultCharset");
// charset.setAccessible(true);
// charset.set(null, null);
// } catch (Exception e) {
// e.printStackTrace();
// }
// set default value
String serverName = System.getProperty(EmsConfig.INST_NAME);
if(serverName == null) {
System.setProperty(EmsConfig.INST_NAME, instName);
}
String tOwner = System.getProperty(EmsConfig.TABLE_OWNER);
if(tOwner == null) {
System.setProperty(EmsConfig.TABLE_OWNER, tableOwner);
}
// 서버 구분 설정(개발:D, 테스트:T, 온라인:P)
CommonConstants.SERVER_TYPE = systemMode;
//모니터링 테마 적용
String tColor = System.getProperty(EmsConfig.THEME_COLOR);
if(tColor == null || "".equals(tColor)) {
System.setProperty(EmsConfig.THEME_COLOR, themeColor);
}
if (debug) {
logger.debug(EmsConfig.DR_MODE + " = " + drMode);
}
//env 프라퍼티 파일만 있음 dr 여부 셋팅
System.setProperty(EmsConfig.DR_MODE, drMode);
private String systemMode = "D"; // EAI System Mode : [P/T/D/S]
//데이터 소스타입(DEV:개발 / STG:스테이징 / PRD:운영 ... )
String eDatasourceType = System.getProperty(EmsConfig.DATASOURCE_TYPE);
if(eDatasourceType == null || "".equals(eDatasourceType)) {
System.setProperty(EmsConfig.DATASOURCE_TYPE, eaiDatasourceType);
}
if (debug) {
logger.debug(EmsConfig.DATASOURCE_TYPE + " =" + eaiDatasourceType); //env 프라퍼티
}
if(debug) {
logger.debug("SERVER_TYPE ="+CommonConstants.SERVER_TYPE);
}
}
public void destroy()
{
AdapterStatusSendThreadPool.destroy();
if(debug) {
logger.debug("############ e-link WebApplication stopping... preStop ############");
}
}
private String themeColor = "black";
private String drMode = "";
private String eaiDatasourceType = "DEV"; // 데이터 소스 타입 :[DEV:개발/STG:스테이징/PRD:운영] ...NSG:내부서버
public void setInstName(String instName) {
this.instName = instName;
}
public void setTableOwner(String tableOwner) {
this.tableOwner = tableOwner;
}
public void setSystemMode(String systemMode) {
this.systemMode = systemMode;
}
public void setThemeColor(String themeColor) {
this.themeColor = themeColor;
}
public void setDrMode(String drMode) {
this.drMode = drMode;
}
public void setEaiDatasourceType(String eaiDatasourceType) {
this.eaiDatasourceType = eaiDatasourceType;
}
private void init() {
if (debug) {
logger.debug("applicationInitialized");
}
// MS949로 default encoding 고정
// System.setProperty("file.encoding","MS949");
// Field charset = null;
// try {
// charset = Charset.class.getDeclaredField("defaultCharset");
// charset.setAccessible(true);
// charset.set(null, null);
// } catch (Exception e) {
// e.printStackTrace();
// }
// set default value
String serverName = System.getProperty(EmsConfig.INST_NAME);
if (serverName == null) {
System.setProperty(EmsConfig.INST_NAME, instName);
}
String tOwner = System.getProperty(EmsConfig.TABLE_OWNER);
if (tOwner == null) {
System.setProperty(EmsConfig.TABLE_OWNER, tableOwner);
}
// 서버 구분 설정(개발:D, 테스트:T, 온라인:P)
CommonConstants.SERVER_TYPE = systemMode;
// 모니터링 테마 적용
String tColor = System.getProperty(EmsConfig.THEME_COLOR);
if (tColor == null || "".equals(tColor)) {
System.setProperty(EmsConfig.THEME_COLOR, themeColor);
}
if (debug) {
logger.debug(EmsConfig.DR_MODE + " = " + drMode);
}
// env 프라퍼티 파일만 있음 dr 여부 셋팅
System.setProperty(EmsConfig.DR_MODE, drMode);
// 데이터 소스타입(DEV:개발 / STG:스테이징 / PRD:운영 ... )
String eDatasourceType = System.getProperty(EmsConfig.DATASOURCE_TYPE);
if (eDatasourceType == null || "".equals(eDatasourceType)) {
System.setProperty(EmsConfig.DATASOURCE_TYPE, eaiDatasourceType);
}
if (debug) {
logger.debug(EmsConfig.DATASOURCE_TYPE + " =" + eaiDatasourceType); // env 프라퍼티
}
if (debug) {
logger.debug("SERVER_TYPE =" + CommonConstants.SERVER_TYPE);
}
if (debug) {
logger.debug("PortalSchemaProviderHolder initialized with tableOwner: " + tableOwner);
}
}
public void destroy() {
AdapterStatusSendThreadPool.destroy();
if (debug) {
logger.debug("############ e-link WebApplication stopping... preStop ############");
}
}
@Override
public void afterPropertiesSet() throws Exception {
init();
init();
}
}
}