This commit is contained in:
Rinjae
2025-10-23 13:21:43 +09:00
commit d6bf8e1943
1004 changed files with 192647 additions and 0 deletions
@@ -0,0 +1,121 @@
package com.eactive.eai.batch.rule.dirInfo;
import java.io.Serializable;
public class BatchJobInfoVO implements Serializable
{
private static final long serialVersionUID = 1L;
private String batchCode;
private String msgDstCode;
private String msgDstName;
private String sndrcvFileName;
private String jobTranDstcd;
private String sendUseYN;
private String recvUseYN;
private long fileHeaderLogSize;
private long fileRecSize;
private long fileTrailerLogSize;
private int priority = 999;
private String uapplCd = "";
private String[] chrgIDs = {""};
private String recvNotiUseYn = "";
private String intfID = "";
private String sysCd = "";
public String getBatchCode() {
return batchCode;
}
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
public String getMsgDstCode() {
return msgDstCode;
}
public void setMsgDstCode(String msgDstCode) {
this.msgDstCode = msgDstCode;
}
public String getMsgDstName() {
return msgDstName;
}
public void setMsgDstName(String msgDstName) {
this.msgDstName = msgDstName;
}
public String getSndrcvFileName() {
return sndrcvFileName;
}
public void setSndrcvFileName(String sndrcvFileName) {
this.sndrcvFileName = sndrcvFileName;
}
public String getJobTranDstcd() {
return jobTranDstcd;
}
public void setJobTranDstcd(String jobTranDstcd) {
this.jobTranDstcd = jobTranDstcd;
}
public String getSendUseYN() {
return sendUseYN;
}
public void setSendUseYN(String sendUseYN) {
this.sendUseYN = sendUseYN;
}
public String getRecvUseYN() {
return recvUseYN;
}
public void setRecvUseYN(String recvUseYN) {
this.recvUseYN = recvUseYN;
}
public long getFileHeaderLogSize() {
return fileHeaderLogSize;
}
public void setFileHeaderLogSize(long fileHeaderLogSize) {
this.fileHeaderLogSize = fileHeaderLogSize;
}
public long getFileRecSize() {
return fileRecSize;
}
public void setFileRecSize(long fileRecSize) {
this.fileRecSize = fileRecSize;
}
public long getFileTrailerLogSize() {
return fileTrailerLogSize;
}
public void setFileTrailerLogSize(long fileTrailerLogSize) {
this.fileTrailerLogSize = fileTrailerLogSize;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public String getUapplCd() {
return uapplCd;
}
public void setUapplCd(String uapplCd) {
this.uapplCd = uapplCd;
}
public String[] getChrgIDs() {
return chrgIDs;
}
public void setChrgIDs(String[] chrgIDs) {
this.chrgIDs = chrgIDs;
}
public String getRecvNotiUseYn() {
return recvNotiUseYn;
}
public void setRecvNotiUseYn(String recvNotiUseYn) {
this.recvNotiUseYn = recvNotiUseYn;
}
public String getIntfID() {
return intfID;
}
public void setIntfID(String intfID) {
this.intfID = intfID;
}
public String getSysCd() {
return sysCd;
}
public void setSysCd(String sysCd) {
this.sysCd = sysCd;
}
}
@@ -0,0 +1,179 @@
package com.eactive.eai.batch.rule.dirInfo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import com.eactive.eai.common.util.Logger;
public class BatchJobPriorityManager implements Serializable
{
private static final long serialVersionUID = 1L;
// 파일로거
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
private static BatchJobPriorityManager instance = new BatchJobPriorityManager();
private HashMap<String, ArrayList<BatchJobPriorityVO>> hmPrioritys;
private HashMap<String, Long> hmDelays;
private BatchJobPriorityManager() {
hmPrioritys = new HashMap<String, ArrayList<BatchJobPriorityVO>>();
hmDelays = new HashMap<String, Long>();
}
public static BatchJobPriorityManager getInstance() {
return instance;
}
public synchronized void addJobPriorityData(String key, ArrayList<BatchJobPriorityVO> list)
{
Object obj = hmPrioritys.get(key);
if (obj != null) {
logger.warn("[ BatchJobPriorityManager ] addJobPriorityData >> UUID["+key+"] 에 이미 데이터가 있습니다." + obj);
hmPrioritys.remove(key);
}
hmPrioritys.put(key, list);
}
public synchronized ArrayList<BatchJobPriorityVO> getPriorityData(String key)
{
return hmPrioritys.get(key);
}
public synchronized void setPriorityData(String key, ArrayList<BatchJobPriorityVO> hm)
{
hmPrioritys.remove(key);
hmPrioritys.put(key, hm);
}
public synchronized void delPriorityData(String key)
{
this.hmPrioritys.remove(key);
}
public synchronized int getPriorityDataCount() {
return hmPrioritys.size();
}
public synchronized boolean isExecutePrePriority (String key, String bizCode) throws Exception{
try {
ArrayList<BatchJobPriorityVO> list = getPriorityData(key);
if (list != null && list.size() > 0){
for (int i=0; i < list.size(); i++){
BatchJobPriorityVO bjpvo = (BatchJobPriorityVO)list.get(i);
if (bizCode.equals(bjpvo.getBizCode())){
if (i == 0){//첫번째 우선순위 목록에 있으면 무조건 선순위 작업 실행 여부는 true.
return true;
}else {
BatchJobPriorityVO pjpvo = (BatchJobPriorityVO)list.get(i-1);
if (pjpvo !=null){
return pjpvo.isExecuted();
}
}
}
}
}else {
return false;
}
}catch (Exception e){
logger.error("[ BatchJobPriorityManager ] 배치우선작업 처리 여부 확인 시 에러가 발생했습니다. - "+e.getMessage());
throw new Exception ("[ BatchJobPriorityManager ] 배치우선작업 처리 여부 확인 시 에러가 발생했습니다. - "+e.getMessage());
}
return false;
}
public synchronized void updateExecuteJobList(String key, String bizCode, String uuid, String fileName)throws Exception{
try{
ArrayList<BatchJobPriorityVO> list = getPriorityData(key);
if (list != null && list.size() > 0){
for (int i=0; i < list.size(); i++){
BatchJobPriorityVO bjpvo = (BatchJobPriorityVO)list.get(i);
if (bizCode.equals(bjpvo.getBizCode())){
bjpvo.setUUID(uuid);
bjpvo.setFileName(fileName);
bjpvo.setExecutedFlag(true);
}
}
}
}catch (Exception e){
logger.error("[ BatchJobPriorityManager] 배치우선작업 처리 결과 변경시 에러가 발생했습니다. - "+e.getMessage());
throw new Exception ("[ BatchJobPriorityManager] 배치우선작업 처리처리 결과 변경시 에러가 발생했습니다. - "+e.getMessage());
}
}
public synchronized BatchJobPriorityVO getPriorityDatabyBizCode(String key, String bizCode)throws Exception{
try {
ArrayList<BatchJobPriorityVO> list = getPriorityData(key);
BatchJobPriorityVO bjpvo = null;
if (list != null && list.size() > 0){
for (int i=0; i < list.size(); i++){
bjpvo = (BatchJobPriorityVO)list.get(i);
if (bizCode.equals(bjpvo.getBizCode())){
break;
}
}
}
return bjpvo;
}catch (Exception e){
logger.error("[ BatchJobPriorityManager ] 배치우선작업 처리 여부 확인 시 에러가 발생했습니다. - "+e.getMessage());
throw new Exception ("[ BatchJobPriorityManager ] 배치우선작업 처리 여부 확인 시 에러가 발생했습니다. - "+e.getMessage());
}
}
public synchronized HashMap<String, ArrayList<BatchJobPriorityVO>> getPriorityDatas() {
return hmPrioritys;
}
public String[] getPriorityKeys() {
Iterator<String> it = this.hmPrioritys.keySet().iterator();
String[] key = new String[this.hmPrioritys.size()];
for(int i=0;it.hasNext();i++) {
key[i] = (String)it.next();
}
Arrays.sort(key);
return key;
}
public synchronized void setDelaySec(String uuid, long sec){
hmDelays.put(uuid, new Long(sec));
}
public synchronized boolean hasDelaySec(String uuid){
return hmDelays.containsKey(uuid);
}
public synchronized long getDelaySec(String uuid){
long delay = 0;
try {
delay = (hmDelays.get(uuid)).longValue();
}catch (Exception e){
logger.error("[ BatchJobPriorityManager ] Delay seconds 를 가져오는데 실패했습니다.- " + e.getMessage());
delay = -1;
//값변환시 에러이면 -1을 반환..
}
return delay;
}
public synchronized void removeDelaySec(String uuid){
try{
hmDelays.remove(uuid);
}catch (Exception e){
logger.error("[ BatchJobPriorityManager ] removeDelaySec - Delay seconds 를 초기화 하는데 실패했습니다.- "+e.getMessage());
}
}
}
@@ -0,0 +1,116 @@
package com.eactive.eai.batch.rule.dirInfo;
import java.io.Serializable;
public class BatchJobPriorityVO implements Serializable
{
private static final long serialVersionUID = 1L;
private String uuid = "";
private String bizCode = "";
private String processCd = "";
private String processName = "";
private String osdCd = "";
private String osdName = "";
private String fileName = "";
private long firstCallForDelayTime= 0; //마지막 우선순위 작업의 시작시각
private int dataCount = 0;
private int dataCountInfo = 1; //기본값 1
private boolean isexe = false;
public String getBizCode() {
return this.bizCode;
}
public void setBizCode(String bizCode) {
this.bizCode = bizCode;
}
public String getProcessCd() {
return this.processCd;
}
public void setProcessCd(String processCd) {
this.processCd = processCd;
}
public String getProcessName() {
return this.processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getOsdCd() {
return this.osdCd;
}
public void setOsdCd(String osdCd) {
this.osdCd = osdCd;
}
public String getOsdName() {
return this.osdName;
}
public void setOsdName(String osdName) {
this.osdName = osdName;
}
public String getFileName() {
return this.fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getUUID(){
return uuid;
}
public void setUUID(String id){
uuid = id;
}
public long getFirstCallForDelayTime(){
return firstCallForDelayTime;
}
public void setFirstCallForDelayTime(long ms){
firstCallForDelayTime = ms;
}
public boolean isExecuted(){
return isexe;
}
public void setExecutedFlag(boolean flag){
isexe = flag;
}
public void setDataCountInfo(int count){
this.dataCountInfo = count;
}
public int getDataCountInfo(){
return dataCountInfo;
}
public void setDataCount(int count){
this.dataCount = count;
}
public int getDataCount(){
return dataCount;
}
}
@@ -0,0 +1,55 @@
package com.eactive.eai.batch.rule.dirInfo;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
import java.sql.ResultSet;
import java.util.ArrayList;
public class DirInfoDAO extends BaseDAO implements DirInfoQuery
{
public ArrayList<BatchJobInfoVO> getAllFileInfo() throws DAOException
{
ArrayList<BatchJobInfoVO> al = new ArrayList<BatchJobInfoVO>();
ResultSet rs = null;
BatchJobInfoVO vo = null;
try
{
this.connect(GET_BIZ_CODE_INFO);
rs = this.executeQuery();
while(rs.next()) {
vo = new BatchJobInfoVO();
vo.setMsgDstCode (rs.getString("BjobMsgDstcd" ));
vo.setMsgDstName (rs.getString("BjobMsgDsticName" ));
vo.setBatchCode (rs.getString("BjobBzwkDstcd" ));
vo.setJobTranDstcd (rs.getString("BjobTranDstcdName" ));
vo.setSendUseYN (rs.getString("EAIFileSendUseYn" ));
vo.setRecvUseYN (rs.getString("EAIFileRecvUseYn" ));
vo.setFileHeaderLogSize (rs.getLong ("BjobTelgmHdrSize" ));
vo.setFileRecSize (rs.getLong ("BjobTelgmRecSize" ));
vo.setFileTrailerLogSize(rs.getLong ("BjobTelgmTrailSize" ));
vo.setPriority (rs.getInt ("MsgPrcssPrity" ));
vo.setSysCd (rs.getString("SysCd" ));
vo.setUapplCd (rs.getString("UapplCd" ));
vo.setSndrcvFileName (rs.getString("SndrcvFileName" ));
vo.setIntfID (rs.getString("IntfID" ));
String chrgIDs = rs.getString("ThisMsgChrgIDs");
if ( chrgIDs != null ){
String[] arr = chrgIDs.split(",");
vo.setChrgIDs(arr);
}
vo.setRecvNotiUseYn (rs.getString("RecvNotiUseYn" ));
al.add(vo);
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR012"));
} finally {
this.disconnect();
}
return al;
}
}
@@ -0,0 +1,229 @@
package com.eactive.eai.batch.rule.dirInfo;
import java.util.ArrayList;
import com.eactive.eai.common.dao.DAOFactory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.Logger;
public class DirInfoManager implements Lifecycle
{
//파일로거
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
/**
* TelegramInfoManager Single Instance
*/
private static DirInfoManager instance = new DirInfoManager();
/**
* LifeccyleSupport object
*/
private LifecycleSupport lifecycle = new LifecycleSupport(this);
/**
* 기동 여부
*/
private boolean started;
/**
* 전문 정보를 저장하는 collection
*/
private ArrayList<BatchJobInfoVO> fileinfos;
/**
* 1. 기능 : Default Constructor
* 2. 처리 개요 : 전문(Telegram) 정보를 저장하기 위한 HashMap을 초기화한다.
* 3. 주의사항
*
**/
private DirInfoManager() {
fileinfos = new ArrayList<BatchJobInfoVO>();
}
/**
* 1. 기능 : TelegramManager Singleton Object를 반환하는 getter method
* 2. 처리 개요 : TelegramManager Singleton Object를 반환한다.
* 3. 주의사항
*
* @return TelegramManager Singleton object
**/
public static DirInfoManager getInstance() {
return instance;
}
/* ****************************************************************** */
/* Web Agent 호출을 위한 메소드 정의 */
/* ****************************************************************** */
// /**
// * 1.기능: 전문 Key에 해당하는 전문 객체를 삭제한다.
// */
// public boolean removeDirInfo(DirInfoVO vo) throws Exception
// {
// return false;
// }
//
// /**
// * 1.기능: 전문 Key에 해당하는 전문 객체를 다시 읽어온다.
// */
// public boolean updateDirInfo(DirInfoVO vo) throws Exception
// {
// return false;
// }
//
// /**
// * 1.기능: 전문 Key에 해당하는 전문 객체를 전체 HashMap에 추가한다.
// */
// public boolean addDirInfo(DirInfoVO vo) throws Exception
// {
// return false;
// }
/**
* Telegram Mapping 정보 조회 : --> 텔레그램 클래스, 메시지 메타코드
*/
public BatchJobInfoVO getFileInfoByDstcd(String strBatchCode, String strJobTranDstcd)
{
if (this.fileinfos.size() == 0) return null;
for (int i=0; i<this.fileinfos.size(); i++) {
BatchJobInfoVO vo = this.fileinfos.get(i);
if ( vo.getBatchCode().trim().equalsIgnoreCase(strBatchCode.trim()) &&
vo.getJobTranDstcd().trim().equalsIgnoreCase(strJobTranDstcd.trim()) ){
return vo;
}
}
return null;
}
public BatchJobInfoVO getFileInfo(String strBatchCode) {
if (strBatchCode == null ||
strBatchCode.trim().equals("") ||
this.fileinfos.size() == 0) return null;
for (int i=0; i<this.fileinfos.size(); i++) {
BatchJobInfoVO vo = this.fileinfos.get(i);
if (vo.getMsgDstCode().trim().equalsIgnoreCase(strBatchCode.trim())) {
return vo;
}
}
return null;
}
//전체 거래구분 정보 조회 후 메모리 설정
public void loadAllFileInfo() throws Exception {
DirInfoDAO dao = (DirInfoDAO)DAOFactory.newInstance().create(DirInfoDAO.class);
this.fileinfos = dao.getAllFileInfo();
logger.info(" - 전체 거래구분 정보 메모리 로딩됨 >> " + this.fileinfos.size());
}
/* ****************************************************************** */
/* Lifecycle 인터페이스에 정의된 메소드 */
/* ****************************************************************** */
/**
* 1. 기능 : Lifecycle의 start 메서드로 TelegramManager를 초기화하는 메서드
* 2. 처리 개요 : TelegramDAO를 이용해 추출 전문 정보 모두를 가져와 초기화한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 시작되었거나,
* EAIServerDAO를 통해 Rule 정보를 가져온다.
* DAOExcepiton이 발생될 경우
**/
public void start() throws LifecycleException
{
if (started) throw new LifecycleException("BECEAIMFR013");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
try {
loadAllFileInfo();
} catch (Exception e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e,"BECEAIMFR014"));
}
started = true;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
/**
* 1. 기능 : Lifecycle의 stop 메서드로 EAIServerManager를 종료하는 메서드
* 2. 처리 개요 : 멤버에 캐싱항 EAIServer Rule 정보를 clear한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 종료된 경우 발생
**/
public void stop() throws LifecycleException {
// Validate and update our current component state
if (!started) throw new LifecycleException("BECEAIMFR015");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
this.fileinfos.clear();
started = false;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
/**
* 1. 기능 : LifecycleListener를 등록하는 메서드
* 2. 처리 개요 : LifecycleListener를 등록한다.
* 3. 주의사항
*
* @param listener LifecycleEvent를 수신한 LifecycleListener
**/
public void addLifecycleListener(LifecycleListener listener)
{
lifecycle.addLifecycleListener(listener);
}
/**
* 1. 기능 : 등록된 LifecycleListener 리스트를 반환하는 메서드
* 2. 처리 개요 : 등록된 LifecycleListener 리스트를 반환하다.
* 3. 주의사항
*
* @return 등록된 LifecycleListener 리스트
**/
public LifecycleListener[] findLifecycleListeners()
{
return lifecycle.findLifecycleListeners();
}
/**
* 1. 기능 : 등록된 LifecycleListener를 삭제하는 메서드
* 2. 처리 개요 : 파라미터의 LifecycleListener를 삭제한다.
* 3. 주의사항
*
* @param listener 삭제할 LifecycleListener
**/
public void removeLifecycleListener(LifecycleListener listener)
{
lifecycle.removeLifecycleListener(listener);
}
/**
* 1. 기능 : FlowRuleManager의 초기화 여부를 반환하는 getter 메서드
* 2. 처리 개요 : FlowRuleManager의 초기화 여부를 반환한다.
* 3. 주의사항
*
* @return 초기화 여부
**/
public boolean isStarted() {
return this.started;
}
}
@@ -0,0 +1,28 @@
package com.eactive.eai.batch.rule.dirInfo;
import com.eactive.eai.common.dao.Keys;
public interface DirInfoQuery
{
public static final String GET_BIZ_CODE_INFO =
"SELECT \n" +
"BjobMsgDstcd , \n" +
"BjobMsgDsticName , \n" +
"BjobBzwkDstcd , \n" +
"BjobTranDstcdName , \n" +
"EAIFileSendUseYn , \n" +
"EAIFileRecvUseYn , \n" +
"BjobTelgmHdrSize , \n" +
"BjobTelgmRecSize , \n" +
"BjobTelgmTrailSize, \n" +
"MsgPrcssPrity , \n" +
"SysCd , \n" +
"UapplCd , \n" +
"SndrcvFileName , \n" +
"ThisMsgChrgIDs , \n" +
"RecvNotiUseYn , \n" +
"IntfID \n" +
"FROM " + Keys.TABLE_OWNER + "TSEAIBJ01 \n" +
"WHERE ThisMsgUseYn = '1'";
}
@@ -0,0 +1,68 @@
package com.eactive.eai.batch.rule.kikwanInfo;
import java.sql.ResultSet;
import java.util.HashMap;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
public class KikwanInfoDAO extends BaseDAO implements KikwanInfoQuery
{
public HashMap<String, KikwanInfoVO> getAllKikwanInfos() throws DAOException
{
HashMap<String, KikwanInfoVO> map = new HashMap<String, KikwanInfoVO>();
ResultSet rs = null;
KikwanInfoVO vo = null;
try
{
this.connect(GET_ALL_KIKWANCODES);
rs = this.executeQuery();
while(rs.next())
{
vo = new KikwanInfoVO();
vo.setKikwanCd ( rs.getString("KikwanCd").trim());
vo.setKikwanName( rs.getString("KikwanName").trim());
vo.setSysIp ( rs.getString("SysIp").trim());
vo.setEncIp ( rs.getString("EncIp").trim());
map.put(vo.getKikwanCd(), vo);
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR016"));
} finally {
this.disconnect();
}
return map;
}
/**
* 지정된 RuleCode와 PhaseCode에 해당 NodeInfo 리스트를 리턴한다.
*/
public KikwanInfoVO getKikwanInfo(String kikwanCd ) throws DAOException
{
KikwanInfoVO vo = null;
ResultSet rs = null;
try {
this.connect(GET_KIKWANCODE);
this.preparedStatement.setString(1, kikwanCd);
rs = executeQuery();
vo = new KikwanInfoVO();
if (rs.next())
{
vo.setKikwanCd ( rs.getString("KikwanCd").trim());
vo.setKikwanName( rs.getString("KikwanName").trim());
vo.setSysIp ( rs.getString("SysIp").trim());
vo.setEncIp ( rs.getString("EncIp").trim());
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR017", new String[] {kikwanCd, kikwanCd}));
} finally {
this.disconnect();
}
return vo;
}
}
@@ -0,0 +1,210 @@
package com.eactive.eai.batch.rule.kikwanInfo;
import java.util.HashMap;
import java.util.Iterator;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.dao.DAOFactory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.Logger;
public class KikwanInfoManager implements Lifecycle
{
//파일로거
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
/**
* TelegramInfoManager Single Instance
*/
private static KikwanInfoManager instance = new KikwanInfoManager();
/**
* LifeccyleSupport object
*/
private LifecycleSupport lifecycle = new LifecycleSupport(this);
/**
* 기동 여부
*/
private boolean started;
/**
* 전문 정보를 저장하는 collection
*/
private HashMap<String, KikwanInfoVO> kikwanInfos;
/**
* 1. 기능 : Default Constructor
* 2. 처리 개요 : 전문(Telegram) 정보를 저장하기 위한 HashMap을 초기화한다.
* 3. 주의사항
*
**/
private KikwanInfoManager() {
kikwanInfos = new HashMap<String, KikwanInfoVO>();
}
/**
* 1. 기능 : TelegramManager Singleton Object를 반환하는 getter method
* 2. 처리 개요 : TelegramManager Singleton Object를 반환한다.
* 3. 주의사항
*
* @return TelegramManager Singleton object
**/
public static KikwanInfoManager getInstance() {
return instance;
}
/* ****************************************************************** */
/* Web Agent 호출을 위한 메소드 정의 */
/* ****************************************************************** */
public synchronized void setKikwanInfo(String kikwanCd)
{
try {
DAOFactory daoFactory = DAOFactory.newInstance();
KikwanInfoDAO dao = (KikwanInfoDAO)daoFactory.create(KikwanInfoDAO.class);
KikwanInfoVO vo = dao.getKikwanInfo(kikwanCd);
this.kikwanInfos.put(kikwanCd, vo);
} catch(DAOException e) {
logger.warn(e.getMessage(), e);
}
}
public synchronized void removeKikwanInfo(String kikwanCd)
{
this.kikwanInfos.remove(kikwanCd);
}
public KikwanInfoVO getKikwanInfo(String kikwanCd)
{
return this.kikwanInfos.get(kikwanCd);
}
public HashMap<String, KikwanInfoVO> getAllKikwanInfos(){
return this.kikwanInfos;
}
public String[] getAllKikwanCodes() {
String[] kikwancodes = new String[kikwanInfos.size()];
Iterator<String> it = kikwanInfos.keySet().iterator();
for(int i=0;it.hasNext();i++) {
kikwancodes[i] = it.next();
}
return kikwancodes;
}
/* ****************************************************************** */
/* Lifecycle 인터페이스에 정의된 메소드 */
/* ****************************************************************** */
/**
* 1. 기능 : Lifecycle의 start 메서드로 TelegramManager를 초기화하는 메서드
* 2. 처리 개요 : TelegramDAO를 이용해 추출 전문 정보 모두를 가져와 초기화한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 시작되었거나,
* EAIServerDAO를 통해 Rule 정보를 가져온다.
* DAOExcepiton이 발생될 경우
**/
public void start() throws LifecycleException
{
if (started)
throw new LifecycleException("BECEAIMFR019");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
DAOFactory daoFactory = DAOFactory.newInstance();
KikwanInfoDAO dao = null;
try {
dao = (KikwanInfoDAO)daoFactory.create(KikwanInfoDAO.class);
this.kikwanInfos = dao.getAllKikwanInfos();
logger.info("[kikwanInfoManager]: FTManager 기관 information loaded >> " + this.kikwanInfos.size());
} catch(DAOException e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e,"BECEAIMFR020"));
}
started = true;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
/**
* 1. 기능 : Lifecycle의 stop 메서드로 EAIServerManager를 종료하는 메서드
* 2. 처리 개요 : 멤버에 캐싱항 EAIServer Rule 정보를 clear한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 종료된 경우 발생
**/
public void stop() throws LifecycleException {
// Validate and update our current component state
if (!started)
throw new LifecycleException("BECEAIMFR021");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
this.kikwanInfos.clear();
started = false;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
/**
* 1. 기능 : LifecycleListener를 등록하는 메서드
* 2. 처리 개요 : LifecycleListener를 등록한다.
* 3. 주의사항
*
* @param listener LifecycleEvent를 수신한 LifecycleListener
**/
public void addLifecycleListener(LifecycleListener listener)
{
lifecycle.addLifecycleListener(listener);
}
/**
* 1. 기능 : 등록된 LifecycleListener 리스트를 반환하는 메서드
* 2. 처리 개요 : 등록된 LifecycleListener 리스트를 반환하다.
* 3. 주의사항
*
* @return 등록된 LifecycleListener 리스트
**/
public LifecycleListener[] findLifecycleListeners()
{
return lifecycle.findLifecycleListeners();
}
/**
* 1. 기능 : 등록된 LifecycleListener를 삭제하는 메서드
* 2. 처리 개요 : 파라미터의 LifecycleListener를 삭제한다.
* 3. 주의사항
*
* @param listener 삭제할 LifecycleListener
**/
public void removeLifecycleListener(LifecycleListener listener)
{
lifecycle.removeLifecycleListener(listener);
}
/**
* 1. 기능 : FlowRuleManager의 초기화 여부를 반환하는 getter 메서드
* 2. 처리 개요 : FlowRuleManager의 초기화 여부를 반환한다.
* 3. 주의사항
*
* @return 초기화 여부
**/
public boolean isStarted() {
return this.started;
}
}
@@ -0,0 +1,24 @@
package com.eactive.eai.batch.rule.kikwanInfo;
import com.eactive.eai.common.dao.Keys;
public interface KikwanInfoQuery
{
public static final String GET_ALL_KIKWANCODES =
" SELECT KikwanCd , \n" +
" KikwanName , \n" +
" SysIp , \n" +
" EncIp \n" +
" FROM " + Keys.TABLE_OWNER + "TSEAIBJ21 \n" +
" WHERE ThisMsgUseYn = '1' " ;
public static final String GET_KIKWANCODE =
" SELECT KikwanCd , \n" +
" KikwanName , \n" +
" SysIp , \n" +
" EncIp \n" +
" FROM " + Keys.TABLE_OWNER + "TSEAIBJ21 \n" +
" WHERE KikwanCd = ? " ;
}
@@ -0,0 +1,41 @@
package com.eactive.eai.batch.rule.kikwanInfo;
import java.io.Serializable;
public class KikwanInfoVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String kikwanCd = "";
private String kikwanName = "";
private String sysIp = "";
private String encIp = "";
public String getKikwanCd() {
return kikwanCd;
}
public void setKikwanCd(String kikwanCd) {
this.kikwanCd = kikwanCd;
}
public String getKikwanName() {
return kikwanName;
}
public void setKikwanName(String kikwanName) {
this.kikwanName = kikwanName;
}
public String getSysIp() {
return sysIp;
}
public void setSysIp(String sysIp) {
this.sysIp = sysIp;
}
public String getEncIp() {
return encIp;
}
public void setEncIp(String encIp) {
this.encIp = encIp;
}
}
@@ -0,0 +1,121 @@
package com.eactive.eai.batch.rule.nodeinfo;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
public class NodeInfoDAO extends BaseDAO implements NodeInfoQuery
{
public HashMap<String, ArrayList<NodeInfoVO>> getAllNodeInfo() throws DAOException
{
HashMap<String, ArrayList<NodeInfoVO>> all = new HashMap<String, ArrayList<NodeInfoVO>>();
ResultSet rs = null;
NodeInfoVO vo = null;
try
{
this.connect(GET_ALL_NODES);
rs = this.executeQuery();
while(rs.next())
{
vo = new NodeInfoVO();
vo.setRuleCode(rs.getString(1).trim());
vo.setPhaseCode(rs.getString(2).trim());
vo.setPhaseType(rs.getString(3).trim());
vo.setFlowComp(rs.getString(4).trim());
vo.setTelegramID(rs.getString(5).trim());
vo.setLengthField(rs.getInt(6));
vo.setDesc(rs.getString(7).trim());
ArrayList<NodeInfoVO> al = all.get(rs.getString(1).trim());
if (al == null) {
al = new ArrayList<NodeInfoVO>();
al.add(vo);
all.put(rs.getString(1).trim(), al);
} else {
all.remove(rs.getString(1).trim());
al.add(vo);
all.put(rs.getString(1).trim(), al);
}
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR016"));
} finally {
this.disconnect();
}
return all;
}
/**
* 지정된 RuleCode와 PhaseCode에 해당 NodeInfo 리스트를 리턴한다.
*/
public NodeInfoVO getNodeInfo(String strRuleCode, String strPhaseCode) throws DAOException
{
NodeInfoVO vo = null;
ResultSet rs = null;
try {
this.connect(GET_PHASE_NODEINFO);
this.preparedStatement.setString(1, strRuleCode);
this.preparedStatement.setString(2, strPhaseCode);
rs = executeQuery();
vo = new NodeInfoVO();
while (rs.next())
{
vo.setRuleCode(rs.getString(1).trim());
vo.setPhaseCode(rs.getString(2).trim());
vo.setPhaseType(rs.getString(3).trim());
vo.setFlowComp(rs.getString(4).trim());
vo.setTelegramID(rs.getString(5).trim());
vo.setLengthField(rs.getInt(6));
vo.setDesc(rs.getString(7).trim());
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR017", new String[] {strRuleCode, strPhaseCode}));
} finally {
this.disconnect();
}
return vo;
}
/**
* 지정된 노드 인포를 읽어 들이는 함수
*/
public ArrayList<NodeInfoVO> getRuleNodeList(String strRuleCode) throws DAOException
{
ArrayList<NodeInfoVO> al = new ArrayList<NodeInfoVO>();
ResultSet rs = null;
try
{
this.connect(GET_NODEINFO_LIST);
this.preparedStatement.setString(1, strRuleCode);
rs = executeQuery();
NodeInfoVO vo = null;
while(rs.next())
{
vo = new NodeInfoVO();
vo.setRuleCode(rs.getString(1).trim());
vo.setPhaseCode(rs.getString(2).trim());
vo.setPhaseType(rs.getString(3).trim());
vo.setFlowComp(rs.getString(4).trim());
vo.setTelegramID(rs.getString(5).trim());
vo.setLengthField(rs.getInt(6));
vo.setDesc(rs.getString(7).trim());
al.add(vo);
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR018", new String[] {strRuleCode}));
} finally {
this.disconnect();
}
return al;
}
}
@@ -0,0 +1,247 @@
package com.eactive.eai.batch.rule.nodeinfo;
import java.util.ArrayList;
import java.util.HashMap;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.dao.DAOFactory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.Logger;
public class NodeInfoManager implements Lifecycle
{
//파일로거
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
/**
* TelegramInfoManager Single Instance
*/
private static NodeInfoManager instance = new NodeInfoManager();
/**
* LifeccyleSupport object
*/
private LifecycleSupport lifecycle = new LifecycleSupport(this);
/**
* 기동 여부
*/
private boolean started;
/**
* 전문 정보를 저장하는 collection
*/
private HashMap<String, ArrayList<NodeInfoVO>> nodeInfos;
/**
* 1. 기능 : Default Constructor
* 2. 처리 개요 : 전문(Telegram) 정보를 저장하기 위한 HashMap을 초기화한다.
* 3. 주의사항
*
**/
private NodeInfoManager() {
nodeInfos = new HashMap<String, ArrayList<NodeInfoVO>>();
}
/**
* 1. 기능 : TelegramManager Singleton Object를 반환하는 getter method
* 2. 처리 개요 : TelegramManager Singleton Object를 반환한다.
* 3. 주의사항
*
* @return TelegramManager Singleton object
**/
public static NodeInfoManager getInstance() {
return instance;
}
/* ****************************************************************** */
/* Web Agent 호출을 위한 메소드 정의 */
/* ****************************************************************** */
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 삭제한다.
*/
public boolean removeTelegramInfo(NodeInfoVO telegramInfoVO) throws Exception
{
return false;
}
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 다시 읽어온다.
*/
public boolean updateTelegramInfo(NodeInfoVO telegramInfoVO) throws Exception
{
return false;
}
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 전체 HashMap에 추가한다.
*/
public boolean addTelegramInfo(NodeInfoVO telegramInfoVO) throws Exception
{
return false;
}
/**
* Telegram Mapping 정보 조회 : --> 텔레그램 클래스, 메시지 메타코드
*/
public HashMap<String, ArrayList<NodeInfoVO>> getAllData() throws Exception
{
return this.nodeInfos;
}
public synchronized void setRuleCodeArray(String strRuleCode, ArrayList<NodeInfoVO> al)
{
this.nodeInfos.put(strRuleCode, al);
}
public synchronized void removeRuleCodeArray(String strRuleCode)
{
this.nodeInfos.remove(strRuleCode);
}
public NodeInfoVO getNodeInfo(String strRuleCode, String strPhaseCode)
{
ArrayList<NodeInfoVO> al = (ArrayList<NodeInfoVO>) this.nodeInfos.get(strRuleCode);
if (al == null) {
return null;
} else {
for (int i=0; i<al.size(); i++) {
NodeInfoVO nvo = (NodeInfoVO)al.get(i);
if (nvo.getPhaseCode().trim().equalsIgnoreCase(strPhaseCode.trim())) {
return nvo;
}
}
}
return null;
}
public ArrayList<NodeInfoVO> getRuleNodeList(String strRuleCode) throws Exception
{
ArrayList<NodeInfoVO> al = this.nodeInfos.get(strRuleCode);
ArrayList<NodeInfoVO> al_target = new ArrayList<NodeInfoVO>();
if (al != null) {
for (int i=0; i<al.size(); i++) {
NodeInfoVO vo = (NodeInfoVO) al.get(i);
al_target.add(vo);
}
}
return al_target;
}
/* ****************************************************************** */
/* Lifecycle 인터페이스에 정의된 메소드 */
/* ****************************************************************** */
/**
* 1. 기능 : Lifecycle의 start 메서드로 TelegramManager를 초기화하는 메서드
* 2. 처리 개요 : TelegramDAO를 이용해 추출 전문 정보 모두를 가져와 초기화한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 시작되었거나,
* EAIServerDAO를 통해 Rule 정보를 가져온다.
* DAOExcepiton이 발생될 경우
**/
public void start() throws LifecycleException
{
if (started)
throw new LifecycleException("BECEAIMFR019");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
DAOFactory daoFactory = DAOFactory.newInstance();
NodeInfoDAO dao = null;
try {
dao = (NodeInfoDAO)daoFactory.create(NodeInfoDAO.class);
this.nodeInfos = dao.getAllNodeInfo();
logger.info("[NodeInfoManager]: node information loaded >> " + this.nodeInfos.size());
} catch(DAOException e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e,"BECEAIMFR020"));
}
started = true;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
/**
* 1. 기능 : Lifecycle의 stop 메서드로 EAIServerManager를 종료하는 메서드
* 2. 처리 개요 : 멤버에 캐싱항 EAIServer Rule 정보를 clear한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 종료된 경우 발생
**/
public void stop() throws LifecycleException {
// Validate and update our current component state
if (!started)
throw new LifecycleException("BECEAIMFR021");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
this.nodeInfos.clear();
started = false;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
/**
* 1. 기능 : LifecycleListener를 등록하는 메서드
* 2. 처리 개요 : LifecycleListener를 등록한다.
* 3. 주의사항
*
* @param listener LifecycleEvent를 수신한 LifecycleListener
**/
public void addLifecycleListener(LifecycleListener listener)
{
lifecycle.addLifecycleListener(listener);
}
/**
* 1. 기능 : 등록된 LifecycleListener 리스트를 반환하는 메서드
* 2. 처리 개요 : 등록된 LifecycleListener 리스트를 반환하다.
* 3. 주의사항
*
* @return 등록된 LifecycleListener 리스트
**/
public LifecycleListener[] findLifecycleListeners()
{
return lifecycle.findLifecycleListeners();
}
/**
* 1. 기능 : 등록된 LifecycleListener를 삭제하는 메서드
* 2. 처리 개요 : 파라미터의 LifecycleListener를 삭제한다.
* 3. 주의사항
*
* @param listener 삭제할 LifecycleListener
**/
public void removeLifecycleListener(LifecycleListener listener)
{
lifecycle.removeLifecycleListener(listener);
}
/**
* 1. 기능 : FlowRuleManager의 초기화 여부를 반환하는 getter 메서드
* 2. 처리 개요 : FlowRuleManager의 초기화 여부를 반환한다.
* 3. 주의사항
*
* @return 초기화 여부
**/
public boolean isStarted() {
return this.started;
}
}
@@ -0,0 +1,64 @@
package com.eactive.eai.batch.rule.nodeinfo;
import com.eactive.eai.common.dao.Keys;
public interface NodeInfoQuery
{
/* DB컬럼명 변경으로 인한 수정 - by kscheon
public static final String GET_ALL_NODES =
" select " +
" RuleCode, PhaseCode, " +
" PhaseType, FlowComp, " +
" TelegramID, LengthField, Desc " +
" from " + Keys.TABLE_OWNER + "tseaibr03 " ;
*/
public static final String GET_ALL_NODES =
" select " +
" BjobBzwkPrcssDstcd, BjobStgeDstcd, " +
" BjobStgePtrnName, BjobFlowCmpoName, " +
" TelgmClsID, UnitTelgmLen, BjobNodeDesc " +
" from " + Keys.TABLE_OWNER + "tseaibr03 " ;
/**
* 지정된 RuleCode에 해당 하는 노드를 리턴해 준다.
*/
/* DB컬럼명 변경으로 인한 수정 - by kscheon
public static final String GET_PHASE_NODEINFO =
" select " +
" RuleCode, PhaseCode, " +
" PhaseType, FlowComp, " +
" TelegramID, LengthField, Desc " +
" from " + Keys.TABLE_OWNER + "tseaibr03 " +
" where RuleCode = ? " +
" and UPPER(PhaseCode) = ? ";
*/
public static final String GET_PHASE_NODEINFO =
" select " +
" BjobBzwkPrcssDstcd, BjobStgeDstcd, " +
" BjobStgePtrnName, BjobFlowCmpoName, " +
" TelgmClsID, UnitTelgmLen, BjobNodeDesc " +
" from " + Keys.TABLE_OWNER + "tseaibr03 " +
" where BjobBzwkPrcssDstcd = ? " +
" and UPPER(BjobStgeDstcd) = ? ";
/**
* 지정된 RuleCode 를 가지고 NodeInfo 리스트를 리턴해준다.
*/
/* DB컬럼명 변경으로 인한 수정 - by kscheon
public static final String GET_NODEINFO_LIST =
" select " +
" RuleCode, PhaseCode, " +
" PhaseType, FlowComp, " +
" TelegramID, LengthField, Desc " +
" from " + Keys.TABLE_OWNER + "tseaibr03 " +
" where UPPER(RuleCode) = ? " ;
*/
public static final String GET_NODEINFO_LIST =
" select " +
" BjobBzwkPrcssDstcd, BjobStgeDstcd, " +
" BjobStgePtrnName, BjobFlowCmpoName, " +
" TelgmClsID, UnitTelgmLen, BjobNodeDesc " +
" from " + Keys.TABLE_OWNER + "tseaibr03 " +
" where UPPER(BjobBzwkPrcssDstcd) = ? " ;
}
@@ -0,0 +1,61 @@
package com.eactive.eai.batch.rule.nodeinfo;
import java.io.Serializable;
public class NodeInfoVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String RuleCode = ""; //CHAR(20)
private String PhaseCode ; //CHAR(10)
private String PhaseType ; //VARCHAR2(10)
private String FlowComp ; //VARCHAR2(100)
private String TelegramID; //VARCHAR2(100)
private int LengthField; //Number
private String Desc ; //VARCHAR2(100)
public String getDesc() {
return Desc;
}
public void setDesc(String desc) {
Desc = desc;
}
public String getFlowComp() {
return FlowComp;
}
public void setFlowComp(String flowComp) {
FlowComp = flowComp;
}
public String getPhaseCode() {
return PhaseCode;
}
public void setPhaseCode(String phaseCode) {
PhaseCode = phaseCode;
}
public String getPhaseType() {
return PhaseType;
}
public void setPhaseType(String phaseType) {
PhaseType = phaseType;
}
public String getRuleCode() {
return RuleCode;
}
public void setRuleCode(String ruleCode) {
RuleCode = ruleCode;
}
public String getTelegramID() {
return TelegramID;
}
public void setTelegramID(String telegramID) {
TelegramID = telegramID;
}
public int getLengthField() {
return LengthField;
}
public void setLengthField(int lengthField) {
LengthField = lengthField;
}
}
@@ -0,0 +1,68 @@
package com.eactive.eai.batch.rule.phaseinfo;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
public class PhaseInfoDAO extends BaseDAO implements PhaseInfoQuery
{
/**
* 각 흐름규칙의 첫번째 노드를 읽어들인다.
*/
public HashMap<String, ArrayList<PhaseInfoVO>> getAllPhaseInfos() throws DAOException
{
HashMap<String, ArrayList<PhaseInfoVO>> all = new HashMap<String, ArrayList<PhaseInfoVO>>();
ResultSet rs = null;
PhaseInfoVO vo = null;
try
{
this.connect(GET_ALL_PHASES);
rs = this.executeQuery();
while(rs.next())
{
vo = new PhaseInfoVO();
vo.setRuleCode(rs.getString(1).trim());
vo.setPhaseSeq(rs.getString(2).trim());
vo.setPhaseCode(rs.getString(3).trim());
vo.setPhaseType(rs.getString(4).trim());
vo.setDesc(rs.getString(5).trim());
vo.setTelegramType(rs.getString(6).trim());
vo.setOpCode(rs.getString(7).trim());
vo.setTrClass(rs.getString(8).trim());
vo.setTOVal(rs.getInt(9));
vo.setRepeat(rs.getInt(10));
vo.setConditionTxt(rs.getString(11).trim());
vo.setPriority(rs.getInt(12));
vo.setCTelegramType(rs.getString(13).trim());
vo.setCOpCode(rs.getString(14).trim());
vo.setCTrClass(rs.getString(15).trim());
vo.setCResCode(rs.getString(16).trim());
vo.setTelegramID(rs.getString(17).trim());
vo.setNextPhaseCode(rs.getString(18).trim());
ArrayList<PhaseInfoVO> al = all.get(vo.getRuleCode());
if (al == null) {
al = new ArrayList<PhaseInfoVO>();
al.add(vo);
all.put(vo.getRuleCode(), al);
} else {
all.remove(vo.getRuleCode());
al.add(vo);
all.put(vo.getRuleCode(), al);
}
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR024"));
} finally {
this.disconnect();
}
return all;
}
}
@@ -0,0 +1,224 @@
package com.eactive.eai.batch.rule.phaseinfo;
import java.util.ArrayList;
import java.util.HashMap;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.dao.DAOFactory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.Logger;
/**
* PhaseInfo 관련한 DB Table " + Keys.TABLE_OWNER + "tseaibr02 조회를 위한 모든 함수를 정의하는 클래스
*/
public class PhaseInfoManager implements Lifecycle
{
//파일로거
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
/**
* TelegramInfoManager Single Instance
*/
private static PhaseInfoManager instance = new PhaseInfoManager();
/**
* LifeccyleSupport object
*/
private LifecycleSupport lifecycle = new LifecycleSupport(this);
/**
* 기동 여부
*/
private boolean started;
/**
* 전문 정보를 저장하는 collection
*/
private HashMap<String, ArrayList<PhaseInfoVO>> phaseInfos;
/**
* 1. 기능 : Default Constructor
* 2. 처리 개요 : 전문(Telegram) 정보를 저장하기 위한 HashMap을 초기화한다.
* 3. 주의사항
*
**/
private PhaseInfoManager() {
phaseInfos = new HashMap<String, ArrayList<PhaseInfoVO>>();
}
/**
* 1. 기능 : TelegramManager Singleton Object를 반환하는 getter method
* 2. 처리 개요 : TelegramManager Singleton Object를 반환한다.
* 3. 주의사항
*
* @return TelegramManager Singleton object
**/
public static PhaseInfoManager getInstance() {
return instance;
}
public synchronized void setRuleCodeArray(String strRuleCode, ArrayList<PhaseInfoVO> al) throws Exception
{
this.phaseInfos.put(strRuleCode, al);
}
public synchronized void removeRuleCodeArray(String strRuleCode) throws Exception
{
this.phaseInfos.remove(strRuleCode);
}
/**
* Telegram Mapping 정보 조회 : --> 텔레그램 클래스, 메시지 메타코드
*/
public ArrayList<PhaseInfoVO> getPhaseInfo(String strRuleCode, String strCurrPhaseCode) throws Exception
{
ArrayList<PhaseInfoVO> al = new ArrayList<PhaseInfoVO>();
ArrayList<PhaseInfoVO> al_target = new ArrayList<PhaseInfoVO>();
al = this.phaseInfos.get(strRuleCode);
if (al != null) {
for (int i=0; i<al.size(); i++) {
PhaseInfoVO vo = (PhaseInfoVO) al.get(i);
if (vo.getPhaseCode().trim().equalsIgnoreCase(strCurrPhaseCode.trim())) {
al_target.add(vo);
}
}
}
return al_target;
}
public HashMap<String, ArrayList<PhaseInfoVO>> getAllData() throws Exception
{
return this.phaseInfos;
}
/* ****************************************************************** */
/* Lifecycle 인터페이스에 정의된 메소드 */
/* ****************************************************************** */
/**
* 1. 기능 : Lifecycle의 start 메서드로 TelegramManager를 초기화하는 메서드
* 2. 처리 개요 : TelegramDAO를 이용해 추출 전문 정보 모두를 가져와 초기화한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 시작되었거나,
* EAIServerDAO를 통해 Rule 정보를 가져온다.
* DAOExcepiton이 발생될 경우
**/
public void start() throws LifecycleException
{
if (started)
throw new LifecycleException("BECEAIMFR025");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
DAOFactory daoFactory = DAOFactory.newInstance();
PhaseInfoDAO dao = null;
try {
dao = (PhaseInfoDAO)daoFactory.create(PhaseInfoDAO.class);
this.phaseInfos = dao.getAllPhaseInfos();
logger.info("[PhaseInfoManager] : phase information loaded >> " + this.phaseInfos.size());
Object[] objs = this.phaseInfos.keySet().toArray();
for(int i=0; i<objs.length; i++)
{
ArrayList<PhaseInfoVO> arr = this.phaseInfos.get((String)objs[i]);
if (arr!=null) {
for (int z=0; z<arr.size(); z++) {
PhaseInfoVO vo = (PhaseInfoVO) arr.get(z);
if (z==0) {
logger.debug("RULE >> phase changing rule : " + vo.getRuleCode());
}
logger.debug(" - ["+vo.getRuleCode()+"] ["+vo.getPhaseCode()+"] ["+vo.getTelegramType()+"] ["+vo.getConditionTxt()+"] ["+vo.getCTelegramType()+"] ["+vo.getNextPhaseCode()+"]");
}
}
}
} catch(DAOException e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e,"BECEAIMFR026"));
}
started = true;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
/**
* 1. 기능 : Lifecycle의 stop 메서드로 EAIServerManager를 종료하는 메서드
* 2. 처리 개요 : 멤버에 캐싱항 EAIServer Rule 정보를 clear한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 종료된 경우 발생
**/
public void stop() throws LifecycleException {
// Validate and update our current component state
if (!started)
throw new LifecycleException("BECEAIMFR027");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
this.phaseInfos.clear();
started = false;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
/**
* 1. 기능 : LifecycleListener를 등록하는 메서드
* 2. 처리 개요 : LifecycleListener를 등록한다.
* 3. 주의사항
*
* @param listener LifecycleEvent를 수신한 LifecycleListener
**/
public void addLifecycleListener(LifecycleListener listener)
{
lifecycle.addLifecycleListener(listener);
}
/**
* 1. 기능 : 등록된 LifecycleListener 리스트를 반환하는 메서드
* 2. 처리 개요 : 등록된 LifecycleListener 리스트를 반환하다.
* 3. 주의사항
*
* @return 등록된 LifecycleListener 리스트
**/
public LifecycleListener[] findLifecycleListeners()
{
return lifecycle.findLifecycleListeners();
}
/**
* 1. 기능 : 등록된 LifecycleListener를 삭제하는 메서드
* 2. 처리 개요 : 파라미터의 LifecycleListener를 삭제한다.
* 3. 주의사항
*
* @param listener 삭제할 LifecycleListener
**/
public void removeLifecycleListener(LifecycleListener listener)
{
lifecycle.removeLifecycleListener(listener);
}
/**
* 1. 기능 : FlowRuleManager의 초기화 여부를 반환하는 getter 메서드
* 2. 처리 개요 : FlowRuleManager의 초기화 여부를 반환한다.
* 3. 주의사항
*
* @return 초기화 여부
**/
public boolean isStarted() {
return this.started;
}
}
@@ -0,0 +1,31 @@
package com.eactive.eai.batch.rule.phaseinfo;
import com.eactive.eai.common.dao.Keys;
public interface PhaseInfoQuery
{
public static final String GET_ALL_PHASES =
"SELECT BjobBzwkPrcssDstcd ," +
" BjobStgeSerno ," +
" BjobStgeDstcd ," +
" BjobStgePtrnName ," +
" BjobStgeFlxblCndnDesc ," +
" TelgmPtrnDstcd ," +
" TelgmDtalsOperCd ," +
" BjobCmnTelgmTranCd ," +
" ToutVal ," +
" BjobIterNotms ," +
" CndnItemDcsnCtnt ," +
" TranPrcssPrity ," +
" CndnTelgmPtrnCd ," +
" CndnTelgmMgtCd ," +
" CndnTranClsfiCd ," +
" CndnRspnsCd ," +
" TelgmClsID ," +
" NextStgeDstcdName " +
"FROM " + Keys.TABLE_OWNER + "TSEAIBR02 " +
"ORDER BY BjobBzwkPrcssDstcd," +
" BjobStgeSerno ";
}
@@ -0,0 +1,150 @@
package com.eactive.eai.batch.rule.phaseinfo;
import java.io.Serializable;
public class PhaseInfoVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String RuleCode = ""; //CHAR(20)
private String PhaseSeq ; //CHAR(3)
private String PhaseCode ; //CHAR(10)
private String PhaseType ; //VARCHAR2(10)
private String Desc ; //VARCHAR2(100)
private String TelegramType ; //CHAR(4)
private String OpCode ; //CHAR(3)
private String TrClass ; //VARCHAR2(10)
private int TOVal ; //NUMBER(15)
private int Repeat ; //NUMBER(3)
private String ConditionTxt ; //VARCHAR2(10)
private int Priority ; //NUMBER(3)
private String CTelegramType ; //CHAR(4)
private String COpCode ; //CHAR(3)
private String CTrClass ; //VARCHAR2(10)
private String CResCode ; //CHAR(3)
private String TelegramID;
private String NextPhaseCode ; //CHAR(10)
public String getConditionTxt() {
return ConditionTxt;
}
public void setConditionTxt(String conditionTxt) {
ConditionTxt = conditionTxt;
}
public String getCOpCode() {
return COpCode;
}
public void setCOpCode(String opCode) {
COpCode = opCode;
}
public String getCResCode() {
return CResCode;
}
public void setCResCode(String resCode) {
CResCode = resCode;
}
public String getCTelegramType() {
return CTelegramType;
}
public void setCTelegramType(String telegramType) {
CTelegramType = telegramType;
}
public String getCTrClass() {
return CTrClass;
}
public void setCTrClass(String trClass) {
CTrClass = trClass;
}
public String getDesc() {
return Desc;
}
public void setDesc(String desc) {
Desc = desc;
}
public String getNextPhaseCode() {
return NextPhaseCode;
}
public void setNextPhaseCode(String nextPhaseCode) {
NextPhaseCode = nextPhaseCode;
}
public String getOpCode() {
return OpCode;
}
public void setOpCode(String opCode) {
OpCode = opCode;
}
public String getPhaseCode() {
return PhaseCode;
}
public void setPhaseCode(String phaseCode) {
PhaseCode = phaseCode;
}
public String getPhaseSeq() {
return PhaseSeq;
}
public void setPhaseSeq(String phaseSeq) {
PhaseSeq = phaseSeq;
}
public String getPhaseType() {
return PhaseType;
}
public void setPhaseType(String phaseType) {
PhaseType = phaseType;
}
public int getPriority() {
return Priority;
}
public void setPriority(int priority) {
Priority = priority;
}
public int getRepeat() {
return Repeat;
}
public void setRepeat(int repeat) {
Repeat = repeat;
}
public String getRuleCode() {
return RuleCode;
}
public void setRuleCode(String ruleCode) {
RuleCode = ruleCode;
}
public String getTelegramType() {
return TelegramType;
}
public void setTelegramType(String telegramType) {
TelegramType = telegramType;
}
public int getTOVal() {
return TOVal;
}
public void setTOVal(int val) {
TOVal = val;
}
public String getTrClass() {
return TrClass;
}
public void setTrClass(String trClass) {
TrClass = trClass;
}
public String getTelegramID() {
return TelegramID;
}
public void setTelegramID(String telegramID) {
TelegramID = telegramID;
}
@Override
public String toString() {
return "PhaseInfoVO [RuleCode=" + RuleCode + ", PhaseSeq=" + PhaseSeq
+ ", PhaseCode=" + PhaseCode + ", PhaseType=" + PhaseType
+ ", Desc=" + Desc + ", TelegramType=" + TelegramType
+ ", OpCode=" + OpCode + ", TrClass=" + TrClass + ", TOVal="
+ TOVal + ", Repeat=" + Repeat + ", ConditionTxt="
+ ConditionTxt + ", Priority=" + Priority + ", CTelegramType="
+ CTelegramType + ", COpCode=" + COpCode + ", CTrClass="
+ CTrClass + ", CResCode=" + CResCode + ", TelegramID="
+ TelegramID + ", NextPhaseCode=" + NextPhaseCode + "]";
}
}
@@ -0,0 +1,61 @@
package com.eactive.eai.batch.rule.ruleinfo;
import java.sql.ResultSet;
import java.util.HashMap;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
public class RuleInfoDAO extends BaseDAO implements RuleInfoQuery
{
public HashMap<String, RuleInfoVO> getAllRuleInfo() throws DAOException
{
HashMap<String, RuleInfoVO> all = new HashMap<String, RuleInfoVO>();
ResultSet rs = null;
RuleInfoVO vo = null;
try
{
this.connect(GET_ALL_RULEINFO);
rs = this.executeQuery();
while(rs.next())
{
vo = new RuleInfoVO();
vo.setRuleCode(rs.getString(1).trim());
vo.setDesc(rs.getString(2).trim());
all.put(vo.getRuleCode(), vo);
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR028"));
} finally {
this.disconnect();
}
return all;
}
/**
* Rule 정보를 읽어 낸다.
*/
public RuleInfoVO getRuleInfo(String strRuleCode) throws DAOException
{
RuleInfoVO vo = new RuleInfoVO();
ResultSet rs = null;
try {
this.connect(GET_RULEINFO_BYCODE);
this.preparedStatement.setString(1, strRuleCode);
rs = executeQuery();
vo = new RuleInfoVO();
while (rs.next())
{
vo.setRuleCode(rs.getString(1));
vo.setDesc(rs.getString(2));
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR029", new String[] {strRuleCode}));
} finally {
this.disconnect();
}
return vo;
}
}
@@ -0,0 +1,226 @@
package com.eactive.eai.batch.rule.ruleinfo;
import java.util.HashMap;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.dao.DAOFactory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.Logger;
public class RuleInfoManager implements Lifecycle
{
//파일로거
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
/**
* TelegramInfoManager Single Instance
*/
private static RuleInfoManager instance = new RuleInfoManager();
/**
* LifeccyleSupport object
*/
private LifecycleSupport lifecycle = new LifecycleSupport(this);
/**
* 기동 여부
*/
private boolean started;
/**
* 전문 정보를 저장하는 collection
*/
private HashMap<String, RuleInfoVO> ruleInfos;
/**
* 1. 기능 : Default Constructor
* 2. 처리 개요 : 전문(Telegram) 정보를 저장하기 위한 HashMap을 초기화한다.
* 3. 주의사항
*
**/
private RuleInfoManager() {
ruleInfos = new HashMap<String, RuleInfoVO>();
}
/**
* 1. 기능 : TelegramManager Singleton Object를 반환하는 getter method
* 2. 처리 개요 : TelegramManager Singleton Object를 반환한다.
* 3. 주의사항
*
* @return TelegramManager Singleton object
**/
public static RuleInfoManager getInstance() {
return instance;
}
/* ****************************************************************** */
/* Web Agent 호출을 위한 메소드 정의 */
/* ****************************************************************** */
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 삭제한다.
*/
public boolean removeRuleInfo(RuleInfoVO telegramInfoVO) throws Exception
{
return false;
}
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 다시 읽어온다.
*/
public boolean updateRuleInfo(RuleInfoVO telegramInfoVO) throws Exception
{
return false;
}
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 전체 HashMap에 추가한다.
*/
public boolean addRuleInfo(RuleInfoVO telegramInfoVO) throws Exception
{
return false;
}
public synchronized void setRuleCodeArray(String strRuleCode, RuleInfoVO vo) throws Exception
{
this.ruleInfos.put(strRuleCode, vo);
}
public synchronized void removeRuleCodeArray(String strRuleCode) throws Exception
{
this.ruleInfos.remove(strRuleCode);
}
/**
* Telegram Mapping 정보 조회 : --> 텔레그램 클래스, 메시지 메타코드
*/
public RuleInfoVO getRuleInfo(String strRuleCode)
{
RuleInfoVO vo = this.ruleInfos.get(strRuleCode);
if (vo != null) {
return vo;
}
return new RuleInfoVO();
}
public HashMap<String, RuleInfoVO> getAllData() throws Exception
{
return this.ruleInfos;
}
/* ****************************************************************** */
/* Lifecycle 인터페이스에 정의된 메소드 */
/* ****************************************************************** */
/**
* 1. 기능 : Lifecycle의 start 메서드로 TelegramManager를 초기화하는 메서드
* 2. 처리 개요 : TelegramDAO를 이용해 추출 전문 정보 모두를 가져와 초기화한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 시작되었거나,
* EAIServerDAO를 통해 Rule 정보를 가져온다.
* DAOExcepiton이 발생될 경우
**/
public void start() throws LifecycleException
{
if (started)
throw new LifecycleException("BECEAIMFR030");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
DAOFactory daoFactory = DAOFactory.newInstance();
RuleInfoDAO dao = null;
try {
dao = (RuleInfoDAO)daoFactory.create(RuleInfoDAO.class);
this.ruleInfos = dao.getAllRuleInfo();
logger.info("RuleInfoManager: phase information loaded >> " + this.ruleInfos.size());
} catch(DAOException e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e,"BECEAIMFR031"));
}
started = true;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
/**
* 1. 기능 : Lifecycle의 stop 메서드로 EAIServerManager를 종료하는 메서드
* 2. 처리 개요 : 멤버에 캐싱항 EAIServer Rule 정보를 clear한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 종료된 경우 발생
**/
public void stop() throws LifecycleException {
// Validate and update our current component state
if (!started)
throw new LifecycleException("BECEAIMFR032");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
this.ruleInfos.clear();
started = false;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
/**
* 1. 기능 : LifecycleListener를 등록하는 메서드
* 2. 처리 개요 : LifecycleListener를 등록한다.
* 3. 주의사항
*
* @param listener LifecycleEvent를 수신한 LifecycleListener
**/
public void addLifecycleListener(LifecycleListener listener)
{
lifecycle.addLifecycleListener(listener);
}
/**
* 1. 기능 : 등록된 LifecycleListener 리스트를 반환하는 메서드
* 2. 처리 개요 : 등록된 LifecycleListener 리스트를 반환하다.
* 3. 주의사항
*
* @return 등록된 LifecycleListener 리스트
**/
public LifecycleListener[] findLifecycleListeners()
{
return lifecycle.findLifecycleListeners();
}
/**
* 1. 기능 : 등록된 LifecycleListener를 삭제하는 메서드
* 2. 처리 개요 : 파라미터의 LifecycleListener를 삭제한다.
* 3. 주의사항
*
* @param listener 삭제할 LifecycleListener
**/
public void removeLifecycleListener(LifecycleListener listener)
{
lifecycle.removeLifecycleListener(listener);
}
/**
* 1. 기능 : FlowRuleManager의 초기화 여부를 반환하는 getter 메서드
* 2. 처리 개요 : FlowRuleManager의 초기화 여부를 반환한다.
* 3. 주의사항
*
* @return 초기화 여부
**/
public boolean isStarted() {
return this.started;
}
}
@@ -0,0 +1,34 @@
package com.eactive.eai.batch.rule.ruleinfo;
import com.eactive.eai.common.dao.Keys;
public interface RuleInfoQuery
{
/* DB컬럼명 변경으로 인한 수정 - by kscheon
public static final String GET_ALL_RULEINFO =
" select " +
" RuleCode, Desc " +
" from " + Keys.TABLE_OWNER + "tseaibr04 ";
*/
public static final String GET_ALL_RULEINFO =
" select " +
" BjobBzwkPrcssDstcd, FlowRulePtrnDesc " +
" from " + Keys.TABLE_OWNER + "tseaibr04 ";
/**
* 주어진 RULE CODE를 가지고 RuleInfo DB (" + Keys.TABLE_OWNER + "TSEAIBR04)에서 해당 RULE정보를 읽어낸다.
*/
/* DB컬럼명 변경으로 인한 수정 - by kscheon
public static final String GET_RULEINFO_BYCODE =
" select " +
" RuleCode, Desc " +
" from " + Keys.TABLE_OWNER + "tseaibr04 " +
" where RuleCode = ? " ;
*/
public static final String GET_RULEINFO_BYCODE =
" select " +
" BjobBzwkPrcssDstcd, FlowRulePtrnDesc " +
" from " + Keys.TABLE_OWNER + "tseaibr04 " +
" where BjobBzwkPrcssDstcd = ? " ;
}
@@ -0,0 +1,26 @@
package com.eactive.eai.batch.rule.ruleinfo;
import java.io.Serializable;
public class RuleInfoVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String RuleCode = "" ; //CHAR(20)
private String Desc = ""; //VARCHAR2(100)
public String getDesc() {
return Desc;
}
public void setDesc(String desc) {
Desc = desc;
}
public String getRuleCode() {
return RuleCode;
}
public void setRuleCode(String ruleCode) {
RuleCode = ruleCode;
}
}
@@ -0,0 +1,80 @@
package com.eactive.eai.batch.rule.sysInfo;
import java.sql.ResultSet;
import java.util.HashMap;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Seed;
public class SysInfoDAO extends BaseDAO implements SysInfoQuery
{
public HashMap<String, SysInfoVO> getAllSysInfos() throws DAOException
{
HashMap<String, SysInfoVO> map = new HashMap<String, SysInfoVO>();
ResultSet rs = null;
SysInfoVO vo = null;
try
{
this.connect(GET_ALL_SYSCODES);
rs = this.executeQuery();
while(rs.next())
{
vo = new SysInfoVO();
vo.setSysCd ( rs.getString("sysCd").trim());
vo.setSysName ( rs.getString("sysName").trim());
vo.setSysIp ( rs.getString("sysIp").trim());
vo.setSysPort ( rs.getShort("sysPort"));
vo.setUserId ( rs.getString("userId").trim());
vo.setUserPassword( Seed.decrypt(rs.getString("userPassword")));
vo.setSendDir ( rs.getString("sendDir").trim());
vo.setRecvDir ( rs.getString("recvDir").trim());
vo.setSftpYn ( rs.getString("sftpYn").trim());
map.put(vo.getSysCd(), vo);
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR016"));
} finally {
this.disconnect();
}
return map;
}
/**
* 지정된 RuleCode와 PhaseCode에 해당 NodeInfo 리스트를 리턴한다.
*/
public SysInfoVO getSysInfo(String sysCd ) throws DAOException
{
SysInfoVO vo = null;
ResultSet rs = null;
try {
this.connect(GET_SYSCODE);
this.preparedStatement.setString(1, sysCd);
rs = executeQuery();
vo = new SysInfoVO();
if (rs.next())
{
vo.setSysCd ( rs.getString("sysCd").trim());
vo.setSysName ( rs.getString("sysName").trim());
vo.setSysIp ( rs.getString("sysIp").trim());
vo.setSysPort ( rs.getShort("sysPort"));
vo.setUserId ( rs.getString("userId").trim());
vo.setUserPassword( Seed.decrypt(rs.getString("userPassword")));
vo.setSendDir ( rs.getString("sendDir").trim());
vo.setRecvDir ( rs.getString("recvDir").trim());
vo.setSftpYn ( rs.getString("sftpYn").trim());
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR017", new String[] {sysCd, sysCd}));
} finally {
this.disconnect();
}
return vo;
}
}
@@ -0,0 +1,209 @@
package com.eactive.eai.batch.rule.sysInfo;
import java.util.HashMap;
import java.util.Iterator;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.dao.DAOFactory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.Logger;
public class SysInfoManager implements Lifecycle
{
//파일로거
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
/**
* TelegramInfoManager Single Instance
*/
private static SysInfoManager instance = new SysInfoManager();
/**
* LifeccyleSupport object
*/
private LifecycleSupport lifecycle = new LifecycleSupport(this);
/**
* 기동 여부
*/
private boolean started;
/**
* 전문 정보를 저장하는 collection
*/
private HashMap<String, SysInfoVO> sysInfos;
/**
* 1. 기능 : Default Constructor
* 2. 처리 개요 : 전문(Telegram) 정보를 저장하기 위한 HashMap을 초기화한다.
* 3. 주의사항
*
**/
private SysInfoManager() {
sysInfos = new HashMap<String, SysInfoVO>();
}
/**
* 1. 기능 : TelegramManager Singleton Object를 반환하는 getter method
* 2. 처리 개요 : TelegramManager Singleton Object를 반환한다.
* 3. 주의사항
*
* @return TelegramManager Singleton object
**/
public static SysInfoManager getInstance() {
return instance;
}
/* ****************************************************************** */
/* Web Agent 호출을 위한 메소드 정의 */
/* ****************************************************************** */
public synchronized void setSysInfo(String sysCd)
{
try {
DAOFactory daoFactory = DAOFactory.newInstance();
SysInfoDAO dao = (SysInfoDAO)daoFactory.create(SysInfoDAO.class);
SysInfoVO vo = dao.getSysInfo(sysCd);
this.sysInfos.put(sysCd, vo);
} catch(DAOException e) {
logger.warn(e.getMessage(), e);
}
}
public synchronized void removeSysInfo(String sysCd)
{
this.sysInfos.remove(sysCd);
}
public SysInfoVO getSysInfo(String sysCd)
{
return this.sysInfos.get(sysCd);
}
public HashMap<String, SysInfoVO> getAllSysInfos(){
return this.sysInfos;
}
public String[] getAllSysCodes() {
String[] syscodes = new String[sysInfos.size()];
Iterator<String> it = sysInfos.keySet().iterator();
for(int i=0;it.hasNext();i++) {
syscodes[i] = it.next();
}
return syscodes;
}
/* ****************************************************************** */
/* Lifecycle 인터페이스에 정의된 메소드 */
/* ****************************************************************** */
/**
* 1. 기능 : Lifecycle의 start 메서드로 TelegramManager를 초기화하는 메서드
* 2. 처리 개요 : TelegramDAO를 이용해 추출 전문 정보 모두를 가져와 초기화한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 시작되었거나,
* EAIServerDAO를 통해 Rule 정보를 가져온다.
* DAOExcepiton이 발생될 경우
**/
public void start() throws LifecycleException
{
if (started)
throw new LifecycleException("BECEAIMFR019");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
DAOFactory daoFactory = DAOFactory.newInstance();
SysInfoDAO dao = null;
try {
dao = (SysInfoDAO)daoFactory.create(SysInfoDAO.class);
this.sysInfos = dao.getAllSysInfos();
logger.info("[SysInfoManager]: system information loaded >> " + this.sysInfos.size());
} catch(DAOException e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e,"BECEAIMFR020"));
}
started = true;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
/**
* 1. 기능 : Lifecycle의 stop 메서드로 EAIServerManager를 종료하는 메서드
* 2. 처리 개요 : 멤버에 캐싱항 EAIServer Rule 정보를 clear한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 종료된 경우 발생
**/
public void stop() throws LifecycleException {
// Validate and update our current component state
if (!started)
throw new LifecycleException("BECEAIMFR021");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
this.sysInfos.clear();
started = false;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
/**
* 1. 기능 : LifecycleListener를 등록하는 메서드
* 2. 처리 개요 : LifecycleListener를 등록한다.
* 3. 주의사항
*
* @param listener LifecycleEvent를 수신한 LifecycleListener
**/
public void addLifecycleListener(LifecycleListener listener)
{
lifecycle.addLifecycleListener(listener);
}
/**
* 1. 기능 : 등록된 LifecycleListener 리스트를 반환하는 메서드
* 2. 처리 개요 : 등록된 LifecycleListener 리스트를 반환하다.
* 3. 주의사항
*
* @return 등록된 LifecycleListener 리스트
**/
public LifecycleListener[] findLifecycleListeners()
{
return lifecycle.findLifecycleListeners();
}
/**
* 1. 기능 : 등록된 LifecycleListener를 삭제하는 메서드
* 2. 처리 개요 : 파라미터의 LifecycleListener를 삭제한다.
* 3. 주의사항
*
* @param listener 삭제할 LifecycleListener
**/
public void removeLifecycleListener(LifecycleListener listener)
{
lifecycle.removeLifecycleListener(listener);
}
/**
* 1. 기능 : FlowRuleManager의 초기화 여부를 반환하는 getter 메서드
* 2. 처리 개요 : FlowRuleManager의 초기화 여부를 반환한다.
* 3. 주의사항
*
* @return 초기화 여부
**/
public boolean isStarted() {
return this.started;
}
}
@@ -0,0 +1,34 @@
package com.eactive.eai.batch.rule.sysInfo;
import com.eactive.eai.common.dao.Keys;
public interface SysInfoQuery
{
public static final String GET_ALL_SYSCODES =
" SELECT SysCd , \n" +
" SysName , \n" +
" SysIp , \n" +
" SysPort , \n" +
" UserId , \n" +
" UserPassword, \n" +
" SendDir , \n" +
" RecvDir , \n" +
" SftpYn \n" +
" FROM " + Keys.TABLE_OWNER + "TSEAIBJ11 \n" +
" WHERE ThisMsgUseYn = '1' " ;
public static final String GET_SYSCODE =
" SELECT SysCd , \n" +
" SysName , \n" +
" SysIp , \n" +
" SysPort , \n" +
" UserId , \n" +
" UserPassword, \n" +
" SendDir , \n" +
" RecvDir , \n" +
" SftpYn \n" +
" FROM " + Keys.TABLE_OWNER + "TSEAIBJ11 \n" +
" WHERE SysCd = ? " ;
}
@@ -0,0 +1,75 @@
package com.eactive.eai.batch.rule.sysInfo;
import java.io.Serializable;
public class SysInfoVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String sysCd = "";
private String sysName = "";
private String sysIp = "";
private short sysPort = -1;
private String userId = "";
private String userPassword= "";
private String sendDir = "";
private String recvDir = "";
private String sftpYn = "";
public String getSysCd() {
return sysCd;
}
public void setSysCd(String sysCd) {
this.sysCd = sysCd;
}
public String getSysName() {
return sysName;
}
public void setSysName(String sysName) {
this.sysName = sysName;
}
public String getSysIp() {
return sysIp;
}
public void setSysIp(String sysIp) {
this.sysIp = sysIp;
}
public short getSysPort() {
return sysPort;
}
public void setSysPort(short sysPort) {
this.sysPort = sysPort;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public String getSendDir() {
return sendDir;
}
public void setSendDir(String sendDir) {
this.sendDir = sendDir;
}
public String getRecvDir() {
return recvDir;
}
public void setRecvDir(String recvDir) {
this.recvDir = recvDir;
}
public String getSftpYn() {
return sftpYn;
}
public void setSftpYn(String sftpYn) {
this.sftpYn = sftpYn;
}
}
@@ -0,0 +1,41 @@
package com.eactive.eai.batch.rule.telegraminfo;
import java.sql.ResultSet;
import java.util.HashMap;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
public class TelegramInfoDAO extends BaseDAO implements TelegramInfoQuery
{
/**
* HashMap getAllTelegramInfos()
* 모든 텔레그램 정보를 구해서 해쉬맵으로 리턴해준다.
*/
public HashMap<String, TelegramInfoVO> getAllTelegramInfos() throws DAOException
{
HashMap<String, TelegramInfoVO> all = new HashMap<String, TelegramInfoVO>();
ResultSet rs = null;
TelegramInfoVO pvo = null;
try
{
this.connect(GET_ALL_TELEGRAM_INFO);
rs = this.executeQuery();
while(rs.next())
{
pvo = new TelegramInfoVO();
pvo.setTelegramID(rs.getString(1).trim());
pvo.setMsgMetaDstcd(rs.getString(2).trim());
pvo.setTelegramClsName(rs.getString(3).trim());
all.put(pvo.getTelegramID(), pvo);
}
} catch(Exception e) {
throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR033"));
} finally {
this.disconnect();
}
return all;
}
}
@@ -0,0 +1,222 @@
package com.eactive.eai.batch.rule.telegraminfo;
import java.util.HashMap;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.dao.DAOFactory;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.lifecycle.Lifecycle;
import com.eactive.eai.common.lifecycle.LifecycleException;
import com.eactive.eai.common.lifecycle.LifecycleListener;
import com.eactive.eai.common.lifecycle.LifecycleSupport;
import com.eactive.eai.common.util.Logger;
public class TelegramInfoManager implements Lifecycle
{
//파일로거
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
/**
* TelegramInfoManager Single Instance
*/
private static TelegramInfoManager instance = new TelegramInfoManager();
/**
* LifeccyleSupport object
*/
private LifecycleSupport lifecycle = new LifecycleSupport(this);
/**
* 기동 여부
*/
private boolean started;
/**
* 전문 정보를 저장하는 collection
*/
private HashMap<String, TelegramInfoVO> telegramInfos;
/**
* 1. 기능 : Default Constructor
* 2. 처리 개요 : 전문(Telegram) 정보를 저장하기 위한 HashMap을 초기화한다.
* 3. 주의사항
*
**/
private TelegramInfoManager() {
telegramInfos = new HashMap<String, TelegramInfoVO>();
}
/**
* 1. 기능 : TelegramManager Singleton Object를 반환하는 getter method
* 2. 처리 개요 : TelegramManager Singleton Object를 반환한다.
* 3. 주의사항
*
* @return TelegramManager Singleton object
**/
public static TelegramInfoManager getInstance() {
return instance;
}
/* ****************************************************************** */
/* Web Agent 호출을 위한 메소드 정의 */
/* ****************************************************************** */
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 삭제한다.
*/
public boolean removeTelegramInfo(TelegramInfoVO telegramInfoVO) throws Exception
{
return false;
}
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 다시 읽어온다.
*/
public boolean updateTelegramInfo(TelegramInfoVO telegramInfoVO) throws Exception
{
return false;
}
/**
* 1.기능: 전문 Key에 해당하는 전문 객체를 전체 HashMap에 추가한다.
*/
public boolean addTelegramInfo(TelegramInfoVO telegramInfoVO) throws Exception
{
return false;
}
public synchronized void setRuleCodeArray(String strRuleCode, TelegramInfoVO vo) throws Exception
{
this.telegramInfos.put(strRuleCode, vo);
}
public synchronized void removeRuleCodeArray(String strRuleCode) throws Exception
{
this.telegramInfos.remove(strRuleCode);
}
/**
* Telegram Mapping 정보 조회 : --> 텔레그램 클래스, 메시지 메타코드
*/
public TelegramInfoVO getTelegramInfo(String telegramID) throws Exception
{
TelegramInfoVO vo = null;
vo = (TelegramInfoVO) this.telegramInfos.get(telegramID);
return vo;
}
public HashMap<String, TelegramInfoVO> getAllData() throws Exception
{
return this.telegramInfos;
}
/* ****************************************************************** */
/* Lifecycle 인터페이스에 정의된 메소드 */
/* ****************************************************************** */
/**
* 1. 기능 : Lifecycle의 start 메서드로 TelegramManager를 초기화하는 메서드
* 2. 처리 개요 : TelegramDAO를 이용해 추출 전문 정보 모두를 가져와 초기화한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 시작되었거나,
* EAIServerDAO를 통해 Rule 정보를 가져온다.
* DAOExcepiton이 발생될 경우
**/
public void start() throws LifecycleException
{
if (started)
throw new LifecycleException("BECEAIMFR035");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
DAOFactory daoFactory = DAOFactory.newInstance();
TelegramInfoDAO dao = null;
try {
dao = (TelegramInfoDAO)daoFactory.create(TelegramInfoDAO.class);
this.telegramInfos = dao.getAllTelegramInfos();
logger.info("TelegramInfoManager: phase information loaded >> " + this.telegramInfos.size());
} catch(DAOException e) {
throw new LifecycleException(ExceptionUtil.getErrorCode(e,"BECEAIMFR036"));
}
started = true;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
}
/**
* 1. 기능 : Lifecycle의 stop 메서드로 EAIServerManager를 종료하는 메서드
* 2. 처리 개요 : 멤버에 캐싱항 EAIServer Rule 정보를 clear한다.
* 3. 주의사항
*
* @exception LifecycleException 이미 종료된 경우 발생
**/
public void stop() throws LifecycleException {
// Validate and update our current component state
if (!started)
throw new LifecycleException("BECEAIMFR037");
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
started = false;
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
}
/**
* 1. 기능 : LifecycleListener를 등록하는 메서드
* 2. 처리 개요 : LifecycleListener를 등록한다.
* 3. 주의사항
*
* @param listener LifecycleEvent를 수신한 LifecycleListener
**/
public void addLifecycleListener(LifecycleListener listener)
{
lifecycle.addLifecycleListener(listener);
}
/**
* 1. 기능 : 등록된 LifecycleListener 리스트를 반환하는 메서드
* 2. 처리 개요 : 등록된 LifecycleListener 리스트를 반환하다.
* 3. 주의사항
*
* @return 등록된 LifecycleListener 리스트
**/
public LifecycleListener[] findLifecycleListeners()
{
return lifecycle.findLifecycleListeners();
}
/**
* 1. 기능 : 등록된 LifecycleListener를 삭제하는 메서드
* 2. 처리 개요 : 파라미터의 LifecycleListener를 삭제한다.
* 3. 주의사항
*
* @param listener 삭제할 LifecycleListener
**/
public void removeLifecycleListener(LifecycleListener listener)
{
lifecycle.removeLifecycleListener(listener);
}
/**
* 1. 기능 : FlowRuleManager의 초기화 여부를 반환하는 getter 메서드
* 2. 처리 개요 : FlowRuleManager의 초기화 여부를 반환한다.
* 3. 주의사항
*
* @return 초기화 여부
**/
public boolean isStarted() {
return this.started;
}
}
@@ -0,0 +1,16 @@
package com.eactive.eai.batch.rule.telegraminfo;
import com.eactive.eai.common.dao.Keys;
public interface TelegramInfoQuery
{
/**
* 모든 Telegram 정보를 구한다.
*/
public static final String GET_ALL_TELEGRAM_INFO =
"SELECT TelgmClsID ,\n" +
" MsgMetaDstcd,\n" +
" TelgmClsName \n" +
"FROM " + Keys.TABLE_OWNER + "TSEAIBR05\n";
}
@@ -0,0 +1,33 @@
package com.eactive.eai.batch.rule.telegraminfo;
import java.io.Serializable;
public class TelegramInfoVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String telegramID = "";
private String telegramClsName = "";
private String MsgMetaDstcd = "";
public String getTelegramID() {
return telegramID;
}
public void setTelegramID(String pTelegramID) {
this.telegramID = pTelegramID;
}
public String getTelegramClsName() {
return telegramClsName;
}
public void setTelegramClsName(String pTelegramClsName) {
this.telegramClsName = pTelegramClsName;
}
public String getMsgMetaDstcd() {
return this.MsgMetaDstcd;
}
public void setMsgMetaDstcd(String pMsgMetaDstcd) {
this.MsgMetaDstcd = pMsgMetaDstcd;
}
}