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,534 @@
//package com.eactive.eai.inbound.remote;
//
//import java.io.BufferedReader;
//import java.io.File;
//import java.io.InputStreamReader;
//
//import com.eactive.eai.batch.common.BatchDirUtil;
//import com.eactive.eai.batch.common.CalendarUtil;
//import com.eactive.eai.batch.common.ItmsSmsUtil;
//import com.eactive.eai.batch.common.StringUtil;
//import com.eactive.eai.common.property.PropManager;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//public abstract class CommonTransfer
//{
//
// //리모트 전송 프라퍼티 정보
// public static final String PROP_GROUP_REMOTE_TRANSFER = "RemoteTransferInfo";
// public static final String PROP_EAI_DUMMY_FILE_PATH = "EAI_DUMMY_FILE_PATH"; //EAI 더미파일 경로 (WLI 수신파일 Event Generator 에 설정된 Archive 경로와 같아야함)
//
// public static final String TRANSFER_TYPE_FTP = "FTP"; //DB에 입력되는 값
// public static final String TRANSFER_TYPE_NDM = "NDM"; //DB에 입력되는 값
//
// public static final String DIRECTION_SEND = "송신"; //DB에 입력되는 값
// public static final String DIRECTION_RECEIVE = "수신"; //DB에 입력되는 값
//
// public static final String STARTING_TYPE_EVENT = "Event"; //DB에 입력되는 값
// public static final String STARTING_TYPE_UI_NAVI = "UI(탐색)"; //DB에 입력되는 값
// public static final String STARTING_TYPE_UI_MANUAL = "UI(수동)"; //DB에 입력되는 값
//
// public static final String RESULT_CODE_SUCCESS = "0"; //정상
// public static final String RESULT_CODE_PROCESSING = "P"; //진행중
// public static final String RESULT_CODE_UNEXPECTED_ERROR = "999"; //오류
//
// public static final String SMSINFO = "SMSInfo";
// public static final String TRANS_MSG = "trans.msg";
// public static final String TRANS_LEVEL = "trans.level";
//
// protected static Logger logger = LoggerFactory.getLogger(ElinkLogger.LOGGER_DEFAULT);
//
// protected RemoteTransferLogVO logInfo;
// protected boolean isLogging = true;
// protected String scriptErrorMsg = "";
// protected String scriptOutputMsg = "";
// private String applCd = "";
//
// private static String getPropEaiDummyPath() throws Exception {
// String eaiDummyPath = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER, PROP_EAI_DUMMY_FILE_PATH);
// if (eaiDummyPath == null) throw new Exception("'EAI 리모트 송신 더미파일 경로' 프라퍼티 정보가 없습니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER +", PropName:"+ PROP_EAI_DUMMY_FILE_PATH +")");
// //디렉토리 맨끝에 "/" 가 있으면 빼로 리턴
// return eaiDummyPath.endsWith("/")? eaiDummyPath.substring(0, eaiDummyPath.length()-1) : eaiDummyPath;
// }
//
// public RemoteTransferLogVO getTransferLogVO() {
// return this.logInfo;
// }
//
// public static void sendFileByEvent(String eaiDir, String eaiFile) throws Exception {
// transferFileByEvent(DIRECTION_SEND, eaiDir, eaiFile, "", "");
// }
//
// public static void receiveFileByEvent(String remoteDir, String remoteFile) throws Exception {
// transferFileByEvent(DIRECTION_RECEIVE, "", "", remoteDir, remoteFile);
// }
//
// public static void transferFileByEvent(String sendRecvType, String eaiDir, String eaiFile, String remoteDir, String remoteFile) throws Exception {
//
// //logger.info("[리모트송수신] ■ 리모트 Event 송수신 시작......");
// //파라미터 체크
// if (!sendRecvType.equals(DIRECTION_SEND) && !sendRecvType.equals(DIRECTION_RECEIVE)) throw new Exception("{송수신구분} 파라미터 오류");
// if (sendRecvType.equals(DIRECTION_SEND) && eaiDir.equals("")) throw new Exception("{EAI 디렉토리} 파라미터 오류");
// if (sendRecvType.equals(DIRECTION_SEND) && eaiFile.equals("")) throw new Exception("{EAI 파일명} 파라미터 오류");
// if (sendRecvType.equals(DIRECTION_RECEIVE) && remoteDir.equals("")) throw new Exception("{리모트 디렉토리} 파라미터 오류");
// if (sendRecvType.equals(DIRECTION_RECEIVE) && remoteFile.equals("")) throw new Exception("{리모트 파일명} 파라미터 오류");
//
// String startingType = STARTING_TYPE_EVENT;
// String userId = "admin";
//
// //---------------------------------------------------------------------
// //1. Path 에 의한 remote Server 정보 조회
// RemoteServerVO remoteServerVO;
// try {
// //logger.info("[리모트송수신] ▶ 업무구분에 의한 리모트 서버정보 조회...");
// remoteServerVO = RemoteServerManager.getInstance().getRemoteServerByPath(sendRecvType.equals(DIRECTION_SEND)? eaiDir : remoteDir);
// if (remoteServerVO==null) throw new Exception("해당 Remote 경로에 대한 Remote 서버를 찾을수 없음");
// } catch (Exception ex) {
// logger.error("[리모트송수신] ★★★★★ 업무구분에 의한 리모트 서버정보 조회시 오류발생 ★★★★★", ex);
// logger.error("[리모트송수신] ▶ 리모트 송수신 오류 로그 기록...");
// //파일전송 거래 오류로그 DB Insert
// RemoteTransferLogVO logInfo = new RemoteTransferLogVO();
// logInfo.setTransferLogId ("RTL"+ CalendarUtil.getCurrentTimeNoDash() + StringUtil.getRandomDigit(3)); //전송로그ID 생성
// logInfo.setSendRecvType (sendRecvType);
// logInfo.setEaiFilePath (eaiDir);
// logInfo.setEaiFileName (eaiFile);
// logInfo.setRemoteFilePath (remoteDir);
// logInfo.setRemoteFileName (remoteFile);
// logInfo.setStartingType (startingType);
// logInfo.setCreateId (userId);
// logInfo.setResultCode (RESULT_CODE_UNEXPECTED_ERROR); //오류
// logInfo.setResultMsg (ex.toString());
// // DEFAULT 세팅 추가 2009.12.17 dhjeong
// logInfo.setTransferType (TRANSFER_TYPE_NDM);
// logInfo.setFransferStartTime(CalendarUtil.getCurrentTimeNoDash());
// logInfo.setFransferEndTime (CalendarUtil.getCurrentTimeNoDash());
//
// try {
// RemoteTransferLogManager.getInstance().insertRemoteTransferLog(logInfo);
// } catch (Exception e) {
// logger.error( e.getMessage(), e);
// }
// throw ex;
// }
//
// //---------------------------------------------------------------------
// //2. 해당 리모트서버에 설정된 전송타입 (FTP/NDM) 에 따른 객체 생성라 파일 송수신 수행
// CommonTransfer tran = null;
// if (remoteServerVO.getAutoTransferType().equals(TRANSFER_TYPE_FTP)) {
// logger.info("[리모트송수신] ▶ FTP 리모트 송수신 객체 생성...");
// tran = new FTPTransferByScript();
//
// } else if (remoteServerVO.getAutoTransferType().equals(TRANSFER_TYPE_NDM)) {
// logger.info("[리모트송수신] ▶ NDM 리모트 송수신 객체 생성...");
// tran = new NDMTransferByScript();
//
// } else {
// throw new Exception("리모트 서버 정보의 {자동전송유형} 필드 값이 'FTP' 또는 'NDM' 이 아닙니다. (Value:"+ remoteServerVO.getAutoTransferType() +")");
// }
//
// //---------------------------------------------------------------------
// //3. 리모트파일 송수신 수행
// tran.transferFile(remoteServerVO, sendRecvType, eaiDir, eaiFile, remoteDir, remoteFile, startingType, userId);
// }
//
// public RemoteTransferLogVO transferFile(RemoteServerVO remoteServerVO,
// String sendRecvType,
// String eaiDir,
// String eaiFile,
// String remoteDir,
// String remoteFile,
// String startingType,
// String userId) throws Exception {
//
// logger.info("[리모트송수신] ■ 리모트 송수신 수행 시작......");
// logger.info("[리모트송수신] ⓟ 송수신구분 : ["+ sendRecvType +"] (송신: EAI→Remote, 수신: Remote→EAI)");
// logger.info("[리모트송수신] ⓟ EAI 디렉토리 : ["+ eaiDir +"]");
// logger.info("[리모트송수신] ⓟ EAI 파일명 : ["+ eaiFile +"]");
// logger.info("[리모트송수신] ⓟ 리모트 디렉토리 : ["+ remoteDir +"]");
// logger.info("[리모트송수신] ⓟ 리모트 파일명 : ["+ remoteFile +"]");
// logger.info("[리모트송수신] ⓟ 기동유형 : ["+ startingType +"]");
// logger.info("[리모트송수신] ⓟ 사용자ID : ["+ userId +"]");
//
// //파라미터 체크
// if (remoteServerVO == null) throw new Exception("{리모트서버 VO} 파라미터 오류");
// if (!sendRecvType.equals(DIRECTION_SEND) && !sendRecvType.equals(DIRECTION_RECEIVE)) throw new Exception("{송수신구분} 파라미터 오류");
// if (sendRecvType.equals(DIRECTION_SEND) && eaiDir.equals("")) throw new Exception("{EAI 디렉토리} 파라미터 오류");
// if (sendRecvType.equals(DIRECTION_SEND) && eaiFile.equals("")) throw new Exception("{EAI 파일명} 파라미터 오류");
// if (sendRecvType.equals(DIRECTION_RECEIVE) && remoteDir.equals("")) throw new Exception("{리모트 디렉토리} 파라미터 오류");
// if (sendRecvType.equals(DIRECTION_RECEIVE) && remoteFile.equals("")) throw new Exception("{리모트 파일명} 파라미터 오류");
// if (!startingType.equals(STARTING_TYPE_EVENT) && !startingType.equals(STARTING_TYPE_UI_NAVI) && !startingType.equals(STARTING_TYPE_UI_MANUAL)) throw new Exception("{기동유형} 파라미터 오류");
// if (userId.equals("")) throw new Exception("{사용자ID} 파라미터 오류");
// //---------------------------------------------------------------------
// //1. 리모트파일 전송 시작로그 DB Insert
// //파일전송 로그정보 설정
// if (logInfo==null) logInfo = new RemoteTransferLogVO();
// logInfo.setTransferLogId ("RTL"+ CalendarUtil.getCurrentTimeNoDash() + StringUtil.getRandomDigit(3)); //전송로그ID 생성
// logInfo.setRemoteServerVO (remoteServerVO);
// logInfo.setRemoteServerId (remoteServerVO.getRemoteServerId());
// logInfo.setSendRecvType (sendRecvType);
// logInfo.setEaiFilePath (eaiDir);
// logInfo.setEaiFileName (eaiFile);
// logInfo.setRemoteFilePath (remoteDir);
// logInfo.setRemoteFileName (remoteFile);
// logInfo.setStartingType (startingType);
// logInfo.setFransferStartTime(CalendarUtil.getCurrentTimeNoDash());
// logInfo.setCreateId (userId);
// logInfo.setResultCode (RESULT_CODE_PROCESSING); //진행중
// if (this instanceof FTPTransferByApi || this instanceof FTPTransferByScript) {
// logInfo.setTransferType (TRANSFER_TYPE_FTP);
//// } else if (this instanceof NDMTransferByApi || this instanceof NDMTransferByScript) {
//// logInfo.setTransferType (TRANSFER_TYPE_NDM);
//// String sendRecvGb = null;
//// String fileName = null;
//// String ndmPname = null;
////
//// // DIRECTION_SEND 의 의미는 EAI-->내부서버이며 여기서 sendRecvGb는 대외기관과의 송수신 구분을 의미하므로 반대로 세팅함.
//// if ( sendRecvType.equals(DIRECTION_SEND) ){
//// sendRecvGb = "RECV";
//// }else{
//// sendRecvGb = "SEND";
//// }
//// int index = eaiFile.indexOf('_');
//// if ( index > 0 ) {
//// fileName = eaiFile.substring(0,index);
//// }else{
//// fileName = eaiFile;
//// }
//// if ( fileName.length() > 7 ){
////// ndmPname = sendRecvGb.subSequence(0,1) + fileName.substring(0,7);
//// // 파일명이 8자리 이상인 경우 파일명 8자리를 그대로 보내 준다.
//// // 향후 중복이 발생하게 되면 별도의 송신 스크립트를 만들어서 강제로 세팅하도록 한다.
//// // 2009.03.27
//// ndmPname = fileName.substring(0,8);
//// }else if ( fileName.length() > 3 ){
//// ndmPname = sendRecvGb.subSequence(0, 8 - fileName.length()) + fileName;
//// }else {
//// ndmPname = sendRecvGb + fileName + "0000";
//// ndmPname = ndmPname.substring(0,8);
//// }
//// logInfo.setNdmPname(ndmPname);
// }
//
// boolean isTreatDummyFile = false; //더미파일 생성여부 (Event 또는 UI_탐색화면으로 부터 기동한 경우 더미파일 생성)
// String eaiDelimiter = "";
// String remoteDelimiter = "";
// String dirTree = "";
// String eaiDummyPath = "";
// String remoteDummyPath = "";
// String[] batchCode = null;
//
// try {
//
// //---------------------------------------------------------------------
// //2. Event 또는 UI_탐색화면으로 부터 기동한 경우 상대 경로 설정
// if (sendRecvType.equals(DIRECTION_SEND) && (remoteDir.equals("") || remoteFile.equals(""))) {
// //EAI경로로 부터 리모트경로 설정
// isTreatDummyFile = true;
// eaiDelimiter = StringUtil.getDirDelimiter(eaiDir);
// remoteDelimiter = StringUtil.getDirDelimiter(remoteServerVO.getRemoteRootDir());
// dirTree = eaiDir.substring(BatchDirUtil.getResponseArchDir().length()); //예) /퇴직연금_WSR00/교보생명_IL05/계약및가입자_0100
//// 2008.1.16 by kscheon - start
//// remoteDir = remoteServerVO.getRemoteRootDir() + remoteDelimiter + "수신_Real"+ dirTree.replaceAll(eaiDelimiter, remoteDelimiter);
// remoteDir = remoteServerVO.getRemoteRootDir() + remoteDelimiter + StringUtil.replaceStr("수신_Real"+ dirTree, eaiDelimiter, remoteDelimiter);
//// 2008.1.16 by kscheon - end
// remoteFile = eaiFile; //EAI 파일명 그대로
// remoteDummyPath = remoteDir.replaceFirst("Real", "Root");
// batchCode = dirTree.substring(1).split(eaiDelimiter.replaceAll("\\\\", "\\\\\\\\"));
//// String instCode = batchCode.length<2? "" : batchCode[1].substring( batchCode[1].indexOf("_") + 1);
//// String fileName = checkFileName(remoteServerVO, instCode, eaiFile);
//// if ( !StringUtil.nvlTrim(fileName).equals("")) {
//// remoteFile = fileName;
//// isTreatDummyFile = false;
//// }
//
// } else if (sendRecvType.equals(DIRECTION_RECEIVE) && (eaiDir.equals("") || eaiFile.equals(""))) {
// //리모트경로로 부터 EAI경로 설정
//
// // 해당기능 없음 2012.11.28
//// isTreatDummyFile = true;
//// eaiDelimiter = StringUtil.getDirDelimiter(BatchDirUtil.getRequestRealDir());
//// remoteDelimiter = StringUtil.getDirDelimiter(remoteDir);
//// String dirSuffix = remoteDir.substring(remoteServerVO.getRemoteRootDir().length()); //예) /송신_Real/퇴직연금_WSR00/교보생명_IL05/계약및가입자_0100
//// dirTree = dirSuffix.substring(dirSuffix.indexOf(remoteDelimiter, 1)); //예) /퇴직연금_WSR00/교보생명_IL05/계약및가입자_0100
//// eaiDir = BatchDirUtil.getRequestRealDir() + dirTree;
//// eaiFile = remoteFile; //리모트 파일명 그대로
//// eaiDummyPath = BatchDirUtil.getRequestRootDir() + dirTree;
//// batchCode = dirTree.substring(1).split(remoteDelimiter.replaceAll("\\\\", "\\\\\\\\"));
//
// } else if (startingType.equals(STARTING_TYPE_UI_MANUAL)) {
// eaiDelimiter = StringUtil.getDirDelimiter(eaiDir);
// remoteDelimiter = StringUtil.getDirDelimiter(remoteDir);
// //수동 입력된 EAI 디렉토리가 EAI 배치 구조에 맞는지 체크 (송수신 Real/Root/Arch 디렉토리 길이가 모두 같음을 전제함)
// if (eaiDir.length() > BatchDirUtil.getResponseArchDir().length()) { //
// dirTree = eaiDir.substring(BatchDirUtil.getResponseArchDir().length()); //예) /퇴직연금_WSR00/교보생명_IL05/계약및가입자_0100
// batchCode = dirTree.substring(1).split(eaiDelimiter.replaceAll("\\\\", "\\\\\\\\"));
// }
// }
//
// //파일전송 로그정보 설정 (업무구분/대외기관/거래구분그룹)
// if (batchCode != null) {
// logInfo.setProcessCode (batchCode.length<1? "" : batchCode[0].substring( batchCode[0].indexOf("_") + 1));
// logInfo.setProcessName (batchCode.length<1? "" : batchCode[0].substring(0, batchCode[0].indexOf("_")));
// logInfo.setOrganCode (batchCode.length<2? "" : batchCode[1].substring( batchCode[1].indexOf("_") + 1));
// logInfo.setOrganName (batchCode.length<2? "" : batchCode[1].substring(0, batchCode[1].indexOf("_")));
// logInfo.setBizGroupCode (batchCode.length<3? "" : batchCode[2].substring( batchCode[2].indexOf("_") + 1));
// logInfo.setBizGroupName (batchCode.length<3? "" : batchCode[2].substring(0, batchCode[2].indexOf("_")));
//
// }
//
// if (sendRecvType.equals(DIRECTION_SEND)) {
// logger.info("[리모트송수신] ☞ FROM : EAI Dir [ "+ eaiDir + eaiDelimiter + eaiFile +" ]");
// logger.info("[리모트송수신] ☞ TO : Remote Dir [ "+ remoteDir + remoteDelimiter + remoteFile +" ]");
// } else {
// logger.info("[리모트송수신] ☞ FROM : Remote Dir [ "+ remoteDir + remoteDelimiter + remoteFile +" ]");
// logger.info("[리모트송수신] ☞ TO : EAI Dir [ "+ eaiDir + eaiDelimiter + eaiFile +" ]");
// }
// } catch (Exception ex) {
// logger.error("★★★★★ 전송경로 설정 시 오류 발생 !! ★★★★★", ex);
// //에러 메시지 설정
// logInfo.setResultCode (RESULT_CODE_UNEXPECTED_ERROR);
// logInfo.setResultMsg ("리모트파일 전송 경로 설정시 오류가 발생하였습니다.\n> caused by..."+ ex.toString());
// try {
// logger.info("[리모트송수신] ▶ 리모트파일 전송 결과로그 DB Update...");
// logInfo.setFransferEndTime(CalendarUtil.getCurrentTimeNoDash());
// RemoteTransferLogManager.getInstance().insertRemoteTransferLog(logInfo);
// } catch (Exception e) {
// logger.error("전송경로 설정 오류 시 전송결과로그 Update 시 오류 발생!", e);
// }
// throw ex;
// }
//
// try {
// //리모트파일 전송 시작로그 DB Insert
// logger.info("[리모트송수신] ▶ 리모트파일 전송 시작로그 DB Insert...");
// RemoteTransferLogManager.getInstance().insertRemoteTransferLog(logInfo);
//
// } catch (Exception ex) {
// logInfo.setResultCode (RESULT_CODE_UNEXPECTED_ERROR);
// logInfo.setResultMsg (ex.toString());
// throw new Exception("리모트파일 전송 전 전송시작로그 Insert 시 오류 발생!\n caused by..."+ ex.toString());
// }
//
// //---------------------------------------------------------------------
// //3. 리모트파일 송수신 수행
// try {
// //=================================================================
// // 3-1. 송신 (EAI -> Remote)
// //=================================================================
// if (sendRecvType.equals(DIRECTION_SEND)) {
// //리모트서버로 실제파일 송신.
// logger.info("[리모트송수신] ▶ 리모트 서버에 실제파일 송신...");
// try {
// sendFile(remoteServerVO, eaiDir, eaiFile, remoteDir, remoteFile);
// } catch (Exception ex) {
// throw new Exception("Real 파일 송신 실패!\n> caused by..."+ ex.toString());
// }
//
// if (isTreatDummyFile) {
// //리모트서버로 더미파일 송신.
// logger.info("[리모트송수신] ▶ 리모트 서버에 더미파일 송신...");
// try {
// this.isLogging = false; //더미파일 송신은 로그정보 설정 안함
// sendFile(remoteServerVO, getPropEaiDummyPath(), eaiFile, remoteDummyPath, remoteFile);
// this.isLogging = true;
//
// } catch (Exception ex) {
// throw new Exception("Dummy 파일 송신 실패!\n> caused by..."+ ex.toString());
// }
// }
//
// //=================================================================
// // 3-2. 수신 (Remote -> EAI)
// //=================================================================
// } else if (sendRecvType.equals(DIRECTION_RECEIVE)) {
// //리모트서버로 부터 실제파일 수신.
// logger.info("[리모트송수신] ▶ 리모트 서버로부터 실제파일 수신...");
// try {
// /*20081106 by kscheon
// * 로컬이여도 파일 copy가 아닌 ftp script 실행
// if (remoteIsLocal == true) {
// FileUtil.copyTransferFile(new File(remoteDir+remoteDelimiter+remoteFile), new File(eaiDir+eaiDelimiter+eaiFile));
// } else {
// */
// receiveFile(remoteServerVO, remoteDir, remoteFile, eaiDir, eaiFile);
// //}
// } catch (Exception ex) {
// throw new Exception("Real 파일 수신 실패!\n> caused by..."+ ex.toString());
// }
//
// if (isTreatDummyFile) {
// //더미파일 생성
// logger.info("[리모트송수신] ▶ EAI 서버에 더미파일 생성...");
// File dummyFile = new File(eaiDummyPath, eaiFile);
// boolean dummyResult = dummyFile.createNewFile();
// if (dummyResult==false) throw new Exception("Dummy 파일 생성 실패");
// }
// }
//
//
// } catch (Exception ex) {
// logger.error("★★★★★ 리모트파일 전송 시 오류 발생 !! ★★★★★", ex);
// //에러 메시지 설정
// if (logInfo.getResultCode().equals("") ||
// logInfo.getResultCode().equals(RESULT_CODE_PROCESSING)) logInfo.setResultCode(RESULT_CODE_UNEXPECTED_ERROR);
// logInfo.setResultMsg (ex.getMessage());
// throw ex;
//
// //---------------------------------------------------------------------
// //4. 리모트파일 전송 결과로그 DB Update
// } finally {
// try {
// logger.info("[리모트송수신] ▶ 리모트파일 전송 결과로그 DB Update...");
// RemoteTransferLogManager.getInstance().updateRemoteTransferLog(logInfo);
// // 송신인 경우 SMS발송한다.
// if ( sendRecvType.equals(DIRECTION_SEND) && !logInfo.getResultCode().endsWith(RESULT_CODE_SUCCESS) ){
// sendITSMSms();
// }
//
// } catch (Exception ex) {
// logger.error("리모트파일 전송 후 전송결과로그 Update 시 오류 발생!", ex);
// }
// }
//
// logger.info("[리모트송수신] ■ 리모트 송수신 수행 완료.");
// return logInfo;
// }
//
//
//
// protected void runSystemScript(String[] command) throws Exception {
//
// String cmdLine = command[0];
// for ( int inx=1; inx < command.length; inx++)
// cmdLine += " " + command[inx];
//
// logger.info("[리모트송수신] [Runtime.Exec] ▶ System Command Runtime 수행 시작...");
// logger.info("[리모트송수신] [Runtime.Exec] ⓟ Command : ["+ cmdLine +"]");
//
// //1. System FTP Shell 명령어를 Runtime 으로 실행
// Process process = Runtime.getRuntime().exec(command);
//
// //2. Runtime 실행 결과 저장
// BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
// String errorLine = null;
// StringBuffer errorBuffer = new StringBuffer();
// while ((errorLine = errorReader.readLine()) != null) {
// if (errorBuffer.length() > 0) errorBuffer.append("\n");
// errorBuffer.append(errorLine);
// logger.debug("[리모트송수신] [Runtime.Exec] stderr> "+ errorLine);
// }
//
// BufferedReader outputReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
// String outputLine = null;
// StringBuffer outputBuffer = new StringBuffer();
// while ((outputLine = outputReader.readLine()) != null) {
// if (outputBuffer.length() > 0) outputBuffer.append("\n");
// outputBuffer.append(outputLine);
// logger.debug("[리모트송수신] [Runtime.Exec] stdout> "+ outputLine);
// }
//
// int exitVal = process.waitFor();
//
// scriptErrorMsg = errorBuffer.toString();
// scriptOutputMsg = outputBuffer.toString();
//
// logger.info("[리모트송수신] [Runtime.Exec] ☞ Exit Value : "+ exitVal);
// logger.info("[리모트송수신] [Runtime.Exec] ▶ System Command Runtime 수행 완료.");
//
// if (isLogging) logInfo.setResultCode(exitVal+"");
//
// if (exitVal != 0) throw new Exception("Runtime.Exec 으로 실행한 Command exit value (="+ exitVal +") 가 정상이 아닙니다. (Command : "+ cmdLine +")\n> caused by..."+ scriptErrorMsg);
// }
//
// public abstract void sendFile ( RemoteServerVO remoteServerVO,
// String eaiDir,
// String eaiFile,
// String remoteDir,
// String remoteFile ) throws Exception;
//
// public abstract void receiveFile( RemoteServerVO remoteServerVO,
// String remoteDir,
// String remoteFile,
// String eaiDir,
// String eaiFile ) throws Exception;
//
//// private String checkFileName (RemoteServerVO remoteServerVO,
//// String institutionCode,
//// String eaiFile) throws Exception {
//// String processCode = remoteServerVO.getProcessCode();
//// String bizCode = getBizcode( processCode, institutionCode, eaiFile);
//// logInfo.setBizCode( bizCode );
//// BatchJobInfoVO info = DirInfoManager.getInstance().getFileInfoByDstcd(processCode, bizCode);
//// if ( info == null ) return null;
//// logInfo.setJobCode(info.getMsgDstCode());
//// applCd = info.getUapplCd();
//// if ( info.getRemoteNodeName() != null && !info.getRemoteNodeName().trim().equals( "")){
//// remoteServerVO.setRemoteNodeName(info.getRemoteNodeName());
//// }
//// return info.getFilename();
//// }
//
//// private String getBizcode(String processCode,
//// String institutionCode,
//// String fileName) throws Exception {
////
////
//// //거래구분 코드 설정
//// int bizCodeStartIndex = 0;
//// int bizCodeEndIndex = 0;
//// int orgIndex = 0;
//// ArrayList<OutsideVO> organList = OutsideManager.getInstance().getOutsideInfo(processCode);
//// for (int i=0; organList!=null && i<organList.size(); i++) {
//// OutsideVO organInfo = organList.get(i);
//// if ( institutionCode.equals(organInfo.getOsdCode()) ) {
//// bizCodeStartIndex = organInfo.getBizCdStartIdx();
//// bizCodeEndIndex = organInfo.getBizCdEndIdx();
//// orgIndex = organInfo.getBizCdEndIdx();
//// break;
//// }
//// }
//// if (bizCodeStartIndex <= 0 || bizCodeStartIndex >= fileName.length()) bizCodeStartIndex = 0;
//// if (bizCodeEndIndex <= 0 || bizCodeEndIndex > fileName.length()) bizCodeEndIndex = fileName.length();
////
//// String bizCode = fileName.substring(bizCodeStartIndex, bizCodeEndIndex);
//// // 거래 구분 코드 길이가 가변인 경우( END INDEX가 0인 경우)
//// if ( orgIndex == 0 ){
//// String delStr = null;
//// try {
//// Properties orgInfo = PropManager.getInstance().getProperties(
//// "TelegramInfo{" + processCode + "_" + institutionCode + "}");
//// delStr = orgInfo.getProperty( "del.string" );
////
//// } catch (Exception e) {}
////
//// if ( delStr != null && !delStr.trim().equals("")){
////
//// int delIndex = bizCode.indexOf(delStr);
////
//// if ( delIndex > -1 ) {
//// bizCode = bizCode.substring(0, delIndex );
//// }
//// }
//// }
//// return bizCode;
//// }
//
// private void sendITSMSms(){
//
// try {
//
// String message = "[수신 실패]" + "업무명:" + logInfo.getProcessName()
// + " 기관명:" + logInfo.getOrganName()
// + " 파일명:" + logInfo.getEaiFileName();
// ItmsSmsUtil.sendSMS( PropManager.getInstance().getProperty(ItmsSmsUtil.SMSINFO, ItmsSmsUtil.REQ_BY_GROUP), applCd, message );
// if ( applCd != null && !applCd.trim().equals("")){
// if (!PropManager.getInstance().getProperty(ItmsSmsUtil.SMSINFO, ItmsSmsUtil.EAI_SEND_YN).trim().equals("")){
// ItmsSmsUtil.sendSMS( PropManager.getInstance().getProperty(ItmsSmsUtil.SMSINFO, ItmsSmsUtil.REQ_BY_GROUP), "", message);
// }
// }
//
// } catch (Exception e) {}
// }
//
//}
@@ -0,0 +1,131 @@
//package com.eactive.eai.inbound.remote;
//
//import java.util.ArrayList;
//import org.apache.commons.net.ftp.FTPClient;
//import org.apache.commons.net.ftp.FTPFile;
//import org.apache.commons.net.ftp.FTPReply;
//
//public class FTPTransferByApi extends CommonTransfer
//{
//
// private FTPClient ftpClient = null;
//
//
// //-------------------------------------------------------------------------------------------
// //
// //-------------------------------------------------------------------------------------------
// private void connect(RemoteServerVO remoteServerVO) throws Exception {
//
// try {
// String remoteServerIP = remoteServerVO.getRemoteServerIP();
// String remoteFtpPort = remoteServerVO.getRemoteFtpPort();
//
// if (remoteFtpPort.equals("")) {
// logger.warn("[리모트송수신] [FTP_Api] 해당 서버["+ remoteServerIP +"] 에 연결할 FTP 포트번호가 주어지지 않았습니다. 디폴트 포트번호 '21' 을 설정합니다.");
// remoteFtpPort = "21";
// }
// logger.info("[리모트송수신] [FTP_Api] ▶ FTP 서버 연결 시도... " + remoteServerIP + ":" + remoteFtpPort);
//
//
// if (ftpClient!=null && ftpClient.isConnected()) {
// logger.info("[리모트송수신] [FTP_Api] ▶ 해당 FTP 서버에 이미 연결되어 있습니다.");
// return;
// }
//
// ftpClient = new FTPClient();
// ftpClient.setControlEncoding("EUC-KR");
// ftpClient.connect(remoteServerIP, Integer.parseInt(remoteFtpPort));
//
// int reply = ftpClient.getReplyCode();
// logger.info("[리모트송수신] [FTP_Api] ☞ 응답코드 : "+ reply);
//
// if (!FTPReply.isPositiveCompletion(reply)) {
// try {
// logger.error("[리모트송수신] [FTP_Api] FTP 서버 연결에 실패하였습니다.");
// ftpClient.disconnect();
//
// } catch (Exception ex) {
// logger.error( ex.getMessage(), ex);
// }
// throw new Exception("FTP 연결 응답코드("+ reply +") 가 비정상입니다.");
// }
// logger.info("[리모트송수신] [FTP_Api] ▶ FTP 서버에 연결되었습니다.");
//
// } catch (Exception ex) {
// logger.error( ex.getMessage(), ex);
// throw new Exception("FTP 연결 오류!\n caused by..."+ ex.toString());
// }
// }
//
// //-------------------------------------------------------------------------------------------
// //
// //-------------------------------------------------------------------------------------------
// private void disconnect() {
// logger.info("[리모트송수신] [FTP_Api] ▶ FTP 서버 연결 해제 시도...");
// try {
// if (ftpClient!=null && ftpClient.isConnected()) ftpClient.disconnect();
// logger.info("[리모트송수신] [FTP_Api] ▶ FTP 서버 연결이 해제 되었습니다.");
// } catch (Exception ex) {
// logger.error( ex.getMessage(), ex);
// }
// }
//
// //-------------------------------------------------------------------------------------------
// //
// //-------------------------------------------------------------------------------------------
// public ArrayList<TargetFileVO> listFiles(RemoteServerVO remoteServerVO, String remoteDir) throws Exception {
//
// logger.info("[리모트송수신] [FTP_Api] ■ 리모트 파일 목록 조회 시작...... (Component 사용)");
// logger.info("[리모트송수신] [FTP_Api] ⓟ 리모트 경로 : ["+ remoteDir +"]");
//
// //파라미터 체크
// if (remoteServerVO == null) throw new Exception("{리모트서버 VO} 파라미터 오류");
// if (remoteDir.equals("")) throw new Exception("{리모트경로} 파라미터 오류");
//
// ArrayList<TargetFileVO> alist = new ArrayList<TargetFileVO>();
//
// try {
// if (ftpClient == null || !ftpClient.isConnected()) this.connect(remoteServerVO);
//
// ftpClient.login(remoteServerVO.getRemoteUserId(), remoteServerVO.getRemotePassword());
//
// FTPFile[] files = ftpClient.listFiles(remoteDir);
// logger.info("[리모트송수신] [FTP_Api] ☞ 리모트 파일 건수 : ["+ files.length +"]");
//
// for (int i=0; i<files.length; i++) {
// TargetFileVO info = new TargetFileVO();
// info.setName (files[i].getName());
// info.setSize (files[i].getSize());
// info.setLastModified (files[i].getTimestamp().getTimeInMillis());
// info.setDirectory (files[i].isDirectory());
// info.setFile (files[i].isFile());
// alist.add(info);
// }
//
// } catch (Exception ex) {
// logger.error( ex.getMessage(), ex);
// throw new Exception("FTP 파일 목록 조회 실패!\n caused by..."+ ex.toString());
//
// } finally {
// this.disconnect();
// }
//
// logger.info("[리모트송수신] [FTP_Api] ■ 리모트 파일 목록 조회 완료.");
// return alist;
// }
//
// //-------------------------------------------------------------------------------------------
// //
// //-------------------------------------------------------------------------------------------
// public void sendFile(RemoteServerVO remoteServerVO, String eaiDir, String eaiFile, String remoteDir, String remoteFile) throws Exception {
// throw new Exception("Component 에 의한 EAI->Remote FTP 송신이 구현되지 않았습니다.");
// }
//
// //-------------------------------------------------------------------------------------------
// //
// //-------------------------------------------------------------------------------------------
// public void receiveFile(RemoteServerVO remoteServerVO, String remoteDir, String remoteFile, String eaiDir, String eaiFile) throws Exception {
// throw new Exception("Component 에 의한 Remote->EAI FTP 수신이 구현되지 않았습니다.");
// }
//
//}
@@ -0,0 +1,249 @@
//package com.eactive.eai.inbound.remote;
//
//import com.eactive.eai.batch.common.CalendarUtil;
//import com.eactive.eai.common.property.PropManager;
//import com.eactive.eai.common.util.DatetimeUtil;
//
//import java.io.File;
//import java.util.Date;
//
//public class FTPTransferByScript extends CommonTransfer
//{
//
// //리모트 FTP 전송 프라퍼티 정보
// public static final String PROP_GROUP_REMOTE_TRANSFER_FTP = "RemoteTransferFtpInfo";
// public static final String PROP_FTP_SEND_SCRIPT_PATH = "FTP_SEND_SCRIPT_PATH"; //FTP 송신 쉘스크립트 경로 (전체 경로)
// public static final String PROP_FTP_RECV_SCRIPT_PATH = "FTP_RECV_SCRIPT_PATH"; //FTP 수신 쉘스크립트 경로 (전체 경로)
//
// private static String getPropFtpSendScriptPath() throws Exception {
// String propValue = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER_FTP, PROP_FTP_SEND_SCRIPT_PATH);
// if (propValue == null) throw new Exception("'FTP 송신 쉘스크립트 파일' 프라퍼티 정보가 없습니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER_FTP +", PropName:"+ PROP_FTP_SEND_SCRIPT_PATH +")");
// return propValue;
// }
//
// private static String getPropFtpRecvScriptPath() throws Exception {
// String propValue = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER_FTP, PROP_FTP_RECV_SCRIPT_PATH);
// if (propValue == null) throw new Exception("'FTP 수신 쉘스크립트 파일' 프라퍼티 정보가 없습니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER_FTP +", PropName:"+ PROP_FTP_RECV_SCRIPT_PATH +")");
// return propValue;
// }
//
//
//
// //-------------------------------------------------------------------------------------------
// // 리모트서버로 실제파일 송신, 송신여부 리턴. (System FTP Shell Command 수행)
// //-------------------------------------------------------------------------------------------
// public void sendFile(RemoteServerVO remoteServerVO, String eaiDir, String eaiFile, String remoteDir, String remoteFile) throws Exception {
//
//
// logger.info("[리모트송수신] [FTP_Script] ■ EAI→Remote 파일 FTP 송신 시작...... (Runtime Script 사용)");
// logger.info("[리모트송수신] [FTP_Script] ⓟ 리모트 서버 VO : ["+ remoteServerVO +"]");
// logger.info("[리모트송수신] [FTP_Script] ⓟ EAI 경로 : ["+ eaiDir +"]");
// logger.info("[리모트송수신] [FTP_Script] ⓟ EAI 파일 : ["+ eaiFile +"]");
// logger.info("[리모트송수신] [FTP_Script] ⓟ 리모트 경로 : ["+ remoteDir +"]");
// logger.info("[리모트송수신] [FTP_Script] ⓟ 리모트 파일 : ["+ remoteFile +"]");
//
// //파라미터 체크
// if (remoteServerVO == null) throw new Exception("{리모트서버 VO} 파라미터 오류");
// if (eaiDir.equals("")) throw new Exception("{EAI경로} 파라미터 오류");
// if (eaiFile.equals("")) throw new Exception("{EAI파일} 파라미터 오류");
// if (remoteDir.equals("")) throw new Exception("{리모트경로} 파라미터 오류");
// if (remoteFile.equals("")) throw new Exception("{리모트파일} 파라미터 오류");
//
// //파일전송 로그정보 설정
// if (isLogging) {
// if (logInfo==null) logInfo = new RemoteTransferLogVO();
// logInfo.setRemoteServerVO (remoteServerVO);
// logInfo.setRemoteServerId (remoteServerVO.getRemoteServerId());
// logInfo.setSendRecvType (DIRECTION_SEND);
// logInfo.setTransferType (TRANSFER_TYPE_FTP);
// logInfo.setEaiFilePath (eaiDir);
// logInfo.setEaiFileName (eaiFile);
// logInfo.setRemoteFilePath (remoteDir);
// logInfo.setRemoteFileName (remoteFile);
// logInfo.setFransferStartTime(CalendarUtil.getCurrentTimeNoDash());
// File f = new File(eaiDir, eaiFile);
// logInfo.setFileSize (f.length()+"");
// logInfo.setFileLastModified (DatetimeUtil.getFormattedDate("yyyyMMddHHmmssSSS", new Date(f.lastModified())));
// }
//
///*
//#!/bin/sh
//
//REMOTE_IP=$1
//REMOTE_PORT=$2
//USER_ID=$3
//PASSWORD=$4
//EAI_DIR=$5
//EAI_FILE=$6
//REMOTE_DIR=$7
//REMOTE_FILE=$8
//
//cd ${EAI_DIR}
//
//ftp -n ${REMOTE_IP} ${REMOTE_PORT} <<END_SCRIPT
//user ${USER_ID} ${PASSWORD}
//cd ${REMOTE_DIR}
//put ${EAI_FILE}
//rename ${EAI_FILE} ${REMOTE_FILE}
//quit
//END_SCRIPT
//
//exit 0
//*/
// //1. System FTP Shell 명령어 생성
///*
// String command = getPropFtpSendScriptPath() +" "+ remoteServerVO.getRemoteServerIP()
// +" "+ remoteServerVO.getRemoteFtpPort()
// +" "+ remoteServerVO.getRemoteUserId()
// +" "+ remoteServerVO.getRemotePassword()
// +" "+ eaiDir
// +" "+ eaiFile
// +" "+ remoteDir
// +" "+ remoteFile;
// */
//
// String[] command = new String[9];
// command[0] = getPropFtpSendScriptPath();
// command[1] = remoteServerVO.getRemoteServerIP();
// command[2] = remoteServerVO.getRemoteFtpPort();
// command[3] = remoteServerVO.getRemoteUserId();
// command[4] = remoteServerVO.getRemotePassword();
// command[5] = eaiDir;
// command[6] = eaiFile;
// command[7] = remoteDir;
// command[8] = remoteFile;
//
// //2. System FTP Shell 명령어를 Runtime 으로 실행
// this.runSystemScript(command);
//
// //파일전송 로그정보 설정
// if (isLogging) logInfo.setFransferEndTime (CalendarUtil.getCurrentTimeNoDash());
//
// logger.info("[리모트송수신] [FTP_Script] ■ EAI→Remote 파일 FTP 송신 완료.");
// }
//
// //-------------------------------------------------------------------------------------------
// // 리모트서버로 부터 실제파일 수신, 수신여부 리턴. (System FTP Shell Command 수행)
// //-------------------------------------------------------------------------------------------
// public void receiveFile(RemoteServerVO remoteServerVO, String remoteDir, String remoteFile, String eaiDir, String eaiFile) throws Exception {
//
// logger.info("[리모트송수신] [FTP_Script] ■ Remote→EAI 파일 FTP 수신 시작...... (Runtime Script 사용)");
// logger.info("[리모트송수신] [FTP_Script] ⓟ 리모트 서버 VO : ["+ remoteServerVO +"]");
// logger.info("[리모트송수신] [FTP_Script] ⓟ 리모트 경로 : ["+ remoteDir +"]");
// logger.info("[리모트송수신] [FTP_Script] ⓟ 리모트 파일 : ["+ remoteFile +"]");
// logger.info("[리모트송수신] [FTP_Script] ⓟ EAI 경로 : ["+ eaiDir +"]");
// logger.info("[리모트송수신] [FTP_Script] ⓟ EAI 파일 : ["+ eaiFile +"]");
//
// //파라미터 체크
// if (remoteServerVO == null) throw new Exception("{리모트서버 VO} 파라미터 오류");
// if (remoteDir.equals("")) throw new Exception("{리모트경로} 파라미터 오류");
// if (remoteFile.equals("")) throw new Exception("{리모트파일} 파라미터 오류");
// if (eaiDir.equals("")) throw new Exception("{EAI경로} 파라미터 오류");
// if (eaiFile.equals("")) throw new Exception("{EAI파일} 파라미터 오류");
//
//
// //파일전송 로그정보 설정
// if (isLogging) {
// if (logInfo==null) logInfo = new RemoteTransferLogVO();
// logInfo.setRemoteServerVO (remoteServerVO);
// logInfo.setRemoteServerId (remoteServerVO.getRemoteServerId());
// logInfo.setSendRecvType (DIRECTION_RECEIVE);
// logInfo.setTransferType (TRANSFER_TYPE_FTP);
// logInfo.setEaiFilePath (eaiDir);
// logInfo.setEaiFileName (eaiFile);
// logInfo.setRemoteFilePath (remoteDir);
// logInfo.setRemoteFileName (remoteFile);
// logInfo.setFransferStartTime(CalendarUtil.getCurrentTimeNoDash());
// }
//
//
///*
//#!/bin/sh
//
//REMOTE_IP=$1
//REMOTE_PORT=$2
//USER_ID=$3
//PASSWORD=$4
//REMOTE_DIR=$5
//REMOTE_FILE=$6
//EAI_DIR=$7
//EAI_FILE=$8
//
//cd ${EAI_DIR}
//
//ftp -n ${REMOTE_IP} ${REMOTE_PORT} <<END_SCRIPT
//user ${USER_ID} ${PASSWORD}
//cd ${REMOTE_DIR}
//get ${REMOTE_FILE}
//quit
//END_SCRIPT
//
//if [ "${EAI_FILE}" != "" -a "${EAI_FILE}" != "${REMOTE_FILE}" ]
//then
// mv ${REMOTE_FILE} ${EAI_FILE}
//fi
//
//exit 0
//*/
// //1. System FTP Shell 명령어 생성
///*
// String command = getPropFtpRecvScriptPath() +" "+ remoteServerVO.getRemoteServerIP()
// +" "+ remoteServerVO.getRemoteFtpPort()
// +" "+ remoteServerVO.getRemoteUserId()
// +" "+ remoteServerVO.getRemotePassword()
// +" "+ remoteDir
// +" "+ remoteFile
// +" "+ eaiDir
// +" "+ eaiFile;
//*/
// String[] command = new String[9];
// command[0] = getPropFtpRecvScriptPath();
// command[1] = remoteServerVO.getRemoteServerIP();
// command[2] = remoteServerVO.getRemoteFtpPort();
// command[3] = remoteServerVO.getRemoteUserId();
// command[4] = remoteServerVO.getRemotePassword();
// command[5] = remoteDir;
// command[6] = remoteFile;
// command[7] = eaiDir;
// command[8] = eaiFile;
//
// //2. System FTP Shell 명령어를 Runtime 으로 실행
// this.runSystemScript(command);
//
// //파일전송 로그정보 설정
// if (isLogging) {
// File f = new File(eaiDir, eaiFile);
// logInfo.setFileSize (f.length()+"");
// logInfo.setFileLastModified (DatetimeUtil.getFormattedDate("yyyyMMddHHmmssSSS", new Date(f.lastModified())));
// logInfo.setFransferEndTime (CalendarUtil.getCurrentTimeNoDash());
// }
//
// logger.info("[리모트송수신] [FTP_Script] ■ Remote→EAI 파일 FTP 수신 완료.");
// }
//
//
//
// protected void runSystemScript(String[] command) throws Exception {
//
// //command Runtime 실행
// super.runSystemScript(command); //exit value가 0(정상) 이 아닌경우 throw Exception
//
// //exit value가 0(정상) 인 경우에도 에러메시지를 체크하여 오류 체크
// //0 byte 파일을 복사할때 '리턴된 0 인쇄 여부' 메시지 발생함 -> 오류로 간주 안함
// if (!super.scriptErrorMsg.equals("") && super.scriptErrorMsg.indexOf("리턴된 0 인쇄 여부") < 0) {
// logInfo.setResultCode(RESULT_CODE_UNEXPECTED_ERROR);
// throw new Exception("Runtime.Exec 으로 실행한 FTP Command 결과가 정상이 아닙니다.\n caused by..."+ super.scriptErrorMsg);
// }
//
// //exit value가 0(정상) 인 경우에도 output메시지를 체크하여 오류 체크
// //ftp 리턴코드 값이 500 번대로 시작하면 오류임 (5.547e-320초 동안... .일케 시작하는 문장도 있음->제외)
// String[] outputMsgLines = super.scriptOutputMsg.split("\n");
// for (int i=0; i<outputMsgLines.length; i++) {
// if (outputMsgLines[i].startsWith("5") && !outputMsgLines[i].startsWith("5.")) {
// logInfo.setResultCode(RESULT_CODE_UNEXPECTED_ERROR);
// throw new Exception("Runtime.Exec 으로 실행한 FTP Command 결과가 정상이 아닙니다.\n caused by..."+ outputMsgLines[i]);
// }
// }
// }
//
//}
@@ -0,0 +1,446 @@
//package com.eactive.eai.inbound.remote;
//
//import java.io.File;
//import java.io.FileInputStream;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.Enumeration;
//import java.util.Locale;
//import java.util.Properties;
//
//import com.eactive.eai.batch.common.CalendarUtil;
//import com.eactive.eai.batch.common.StringUtil;
//import com.eactive.eai.common.property.PropManager;
//import com.eactive.eai.common.util.DatetimeUtil;
//import com.sterlingcommerce.cd.sdk.CDProcess;
//import com.sterlingcommerce.cd.sdk.ConnectionException;
//import com.sterlingcommerce.cd.sdk.LogonException;
//import com.sterlingcommerce.cd.sdk.MediatorEnum;
//import com.sterlingcommerce.cd.sdk.MsgException;
//import com.sterlingcommerce.cd.sdk.Node;
//
//public class NDMTransferByApi extends CommonTransfer
//{
//
// //리모트 NDM 전송 프라퍼티 정보
// public static final String PROP_GROUP_REMOTE_TRANSFER_NDM = "RemoteTransferNdmInfo";
// public static final String PROP_NDM_SERVER_NODE_NAME = "NDM_SERVER_NODE_NAME"; //NDM 서버 NodeName (IP;Port)
// public static final String PROP_NDM_SERVER_USER_ID = "NDM_SERVER_USER_ID"; //NDM 서버 UserId
// public static final String PROP_NDM_SERVER_PASSWORD = "NDM_SERVER_PASSWORD"; //NDM 서버 Password
// public static final String PROP_NDM_SERVER_PROTOCOL = "NDM_SERVER_PROTOCOL"; //NDM 서버 Protocol (Default : TCPIP)
//
// private static final String DEFAULT_NDM_SERVER_PREFIX = "DEFAULT";
//
// private static final String COMMAND_TYPE_SELECT = "SELECT";
// private static final String COMMAND_TYPE_SUBMIT = "SUBMIT";
//
// private static Properties ndmServerProp;
// private String ndmNodeName = "";
// private String ndmUserId = "";
// private String ndmPassword = "";
// private String ndmProtocol = "";
//
// private Node cdNode = null;
//
// private boolean isNdmTrace = false;
//
// private static String getPropNdmServerNodeName() throws Exception {
// String propValue = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER_NDM, PROP_NDM_SERVER_NODE_NAME);
// if (propValue == null) throw new Exception("'NDM 서버 Node Name (IP;Port)' 프라퍼티 정보가 없습니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER_NDM +", PropName:"+ PROP_NDM_SERVER_NODE_NAME +")");
// return propValue;
// }
//
// private static String getPropNdmServerUserId() throws Exception {
// String propValue = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER_NDM, PROP_NDM_SERVER_USER_ID);
// if (propValue == null) throw new Exception("'NDM 서버 User Id' 프라퍼티 정보가 없습니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER_NDM +", PropName:"+ PROP_NDM_SERVER_USER_ID +")");
// return propValue;
// }
//
// private static String getPropNdmServerPassword() throws Exception {
// String propValue = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER_NDM, PROP_NDM_SERVER_PASSWORD);
// if (propValue == null) throw new Exception("'NDM 서버 Password' 프라퍼티 정보가 없습니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER_NDM +", PropName:"+ PROP_NDM_SERVER_PASSWORD +")");
// return propValue;
// }
//
// private static String getPropNdmServerProtocol() throws Exception {
// String propValue = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER_NDM, PROP_NDM_SERVER_PROTOCOL);
// if (propValue == null) {
// logger.warn("'NDM 서버 Protocol' 프라퍼티 정보가 없습니다. 디폴트값은 'TCPIP' 입니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER_NDM +", PropName:"+ PROP_NDM_SERVER_PROTOCOL +")");
// return "TCPIP";
// }
// return propValue;
// }
//
//
// //NDM property 파일정보 로딩
// public static void loadNdmServerProperty(String ndmServerPropFilePath) throws Exception {
// logger.info("[리모트송수신] [NDM_Api] ■ NDM 서버 정보 Property 파일 로딩 시작...");
// logger.info("[리모트송수신] [NDM_Api] ⓟ Property 파일 : ["+ ndmServerPropFilePath +"]");
//
// FileInputStream fis = null;
// try {
// fis = new FileInputStream(ndmServerPropFilePath);
// ndmServerProp = new Properties();
// ndmServerProp.load(fis);
//
// } catch (Exception ex) {
// logger.error( ex.getMessage(), ex);
// ndmServerProp = null;
// throw new Exception("NDM 서버 정보 Property 파일 로딩 오류!\n caused by..."+ ex.toString());
//
// } finally {
// try {
// if (fis != null)
// fis.close();
// }catch (Exception e) {
// logger.error( e.getMessage(), e);
// }
// }
// logger.info("[리모트송수신] [NDM_Api] ■ NDM 서버 정보 Property 파일 로딩 완료.");
// }
//
//
//
// public NDMTransferByApi() throws Exception {
// logger.info("[리모트송수신] [NDM_Api] ■ NDM 서버 정보 설정 시작 (by DB Property)...");
//
// this.setNDMServerInfo(getPropNdmServerNodeName(),
// getPropNdmServerUserId(),
// getPropNdmServerPassword(),
// getPropNdmServerProtocol());
//
// logger.info("[리모트송수신] [NDM_Api] ■ NDM 서버 정보 설정 완료 (by DB Property).");
// }
//
// public NDMTransferByApi(String ndmServerPropFilePath) throws Exception {
// this(ndmServerPropFilePath, DEFAULT_NDM_SERVER_PREFIX);
// }
//
// public NDMTransferByApi(String ndmServerPropFilePath, String ndmServerPrefix) throws Exception {
//
// logger.info("[리모트송수신] [NDM_Api] ■ NDM 서버 정보 설정 시작 (by Property File)...");
// logger.info("[리모트송수신] [NDM_Api] ⓟ NDM 서버 정보 Prefix : ["+ ndmServerPrefix +"]");
//
// if (ndmServerProp == null) loadNdmServerProperty(ndmServerPropFilePath);
//
// String checkReloading = ndmServerProp.getProperty(ndmServerPrefix +"_nodeName", "");
// //값이 없는 경우 파일을 다시 한번 읽도록 함
// if (checkReloading.equals("")) loadNdmServerProperty(ndmServerPropFilePath);
//
// String strNdmNodeName = ndmServerProp.getProperty(ndmServerPrefix +"_nodeName"); //ex) 172.17.33.111;1363
// String strNdmUserId = ndmServerProp.getProperty(ndmServerPrefix +"_userid");
// String strNdmPassword = ndmServerProp.getProperty(ndmServerPrefix +"_password");
// String strNdmProtocol = ndmServerProp.getProperty(ndmServerPrefix +"_protocol", "TCPIP");
//
// if (strNdmNodeName == null || strNdmNodeName.equals("")) throw new Exception("NDM 서버 정보 Property 파일에 '"+ ndmServerPrefix +"_nodeName' 프라퍼티 값을 설정하세요. ex) 172.17.61.71;1363");
// if (strNdmUserId == null || strNdmUserId. equals("")) throw new Exception("NDM 서버 정보 Property 파일에 '"+ ndmServerPrefix +"_userid' 프라퍼티 값을 설정하세요.");
// if (strNdmPassword == null || strNdmPassword.equals("")) throw new Exception("NDM 서버 정보 Property 파일에 '"+ ndmServerPrefix +"_password' 프라퍼티 값을 설정하세요.");
// if (strNdmProtocol == null || strNdmProtocol.equals("")) throw new Exception("NDM 서버 정보 Property 파일에 '"+ ndmServerPrefix +"_protocol' 프라퍼티 값을 설정하세요. ex) TCPIP");
//
// this.setNDMServerInfo(strNdmNodeName,
// strNdmUserId,
// strNdmPassword,
// strNdmProtocol);
//
// logger.info("[리모트송수신] [NDM_Api] ■ NDM 서버 정보 설정 완료 (by Property File).");
// }
//
// public NDMTransferByApi(String ndmNodeName, String ndmUserId, String ndmPassword, String ndmProtocol) throws Exception {
// logger.info("[리모트송수신] [NDM_Api] ■ NDM 서버 정보 설정 시작 (by Manual)...");
//
// this.setNDMServerInfo(ndmNodeName,
// ndmUserId,
// ndmPassword,
// ndmProtocol);
//
// logger.info("[리모트송수신] [NDM_Api] ■ NDM 서버 정보 설정 완료 (by Manual).");
// }
//
// public void setNDMServerInfo(String ndmNodeName, String ndmUserId, String ndmPassword, String ndmProtocol) throws Exception {
// this.ndmNodeName = ndmNodeName;
// this.ndmUserId = ndmUserId;
// this.ndmPassword = ndmPassword;
// this.ndmProtocol = ndmProtocol;
// logger.info("[리모트송수신] [NDM_Api] ************* NDM 서버 정보 *************");
// logger.info("[리모트송수신] [NDM_Api] - NodeName :"+ this.ndmNodeName);
// logger.info("[리모트송수신] [NDM_Api] - Userid :"+ this.ndmUserId );
// logger.info("[리모트송수신] [NDM_Api] - Password :"+ this.ndmPassword);
// logger.info("[리모트송수신] [NDM_Api] - Protocol :"+ this.ndmProtocol);
// logger.info("[리모트송수신] [NDM_Api] *****************************************");
//
// if (ndmNodeName == null || ndmNodeName.equals("")) throw new Exception("NDM 서버 정보 'Node Name' 값을 설정하세요. ex) 172.17.61.71;1363");
// if (ndmUserId == null || ndmUserId. equals("")) throw new Exception("NDM 서버 정보 'User Id' 값을 설정하세요.");
// if (ndmPassword == null || ndmPassword.equals("")) throw new Exception("NDM 서버 정보 'Password' 값을 설정하세요.");
// if (ndmProtocol == null || ndmProtocol.equals("")) throw new Exception("NDM 서버 정보 'Protocol' 값을 설정하세요. ex) TCPIP");
// }
//
// private void connect() throws Exception {
//
// try {
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM 서버 연결 시도... " + this.ndmNodeName);
// if (cdNode!=null) {
// logger.info("[리모트송수신] [NDM_Api] ▶ 해당 NDM 서버에 이미 연결되어 있습니다. (" + cdNode.getConnectionInfo().getAddress() + ":" + cdNode.getConnectionInfo().getPort() +")");
// return;
// }
//
// cdNode = new Node(this.ndmNodeName,
// this.ndmUserId,
// this.ndmPassword.toCharArray(),
// this.ndmProtocol,
// "EAI NDM Client Aplication",
// Locale.getDefault());
//
// if (isNdmTrace == true) {
// cdNode.getConnectionInfo().setTraceOn();
// } else {
// cdNode.getConnectionInfo().setTraceOff();
// }
// logger.info("[리모트송수신] [NDM_Api] ☞ NDM 서버 OS_TYPE : [" + cdNode.getConnectionInfo().getOSType() +"]");
// logger.info("[리모트송수신] [NDM_Api] ☞ NDM 서버 NODE_NAME : [" + cdNode.getConnectionInfo().getNodeName() +"]");
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM 서버에 연결되었습니다.");
//
// } catch (ConnectionException ex) {
// logger.error( ex.getMessage(), ex);
// throw new Exception("NDM 서버 연결 오류!\n caused by..."+ ex.toString());
//
// } catch (LogonException ex) {
// logger.error( ex.getMessage(), ex);
// throw new Exception("NDM 서버 로그인 오류!\n caused by..."+ ex.toString());
//
// } catch (Exception ex) {
// logger.error( ex.getMessage(), ex);
// throw new Exception("NDM 서버 연결정보 오류!\n caused by..."+ ex.toString());
// }
// }
//
// private void disconnect() {
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM 서버 연결 해제 시도...");
// try {
// if (cdNode!=null) cdNode.closeNode();
// cdNode = null;
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM 서버 연결이 해제 되었습니다.");
// } catch (Exception ex) {
// logger.error( ex.getMessage(), ex);
// }
// }
//
// //-------------------------------------------------------------------------------------------
// // 리모트서버로 파일 송신
// //-------------------------------------------------------------------------------------------
// public void sendFile(RemoteServerVO remoteServerVO, String ndmLocalDir, String ndmLocalFile, String remoteDir, String remoteFile) throws Exception {
//
// logger.info("[리모트송수신] [NDM_Api] ■ EAI→Remote 파일 NDM 송신 시작......");
// logger.info("[리모트송수신] [NDM_Api] ⓟ 리모트 서버 VO : ["+ remoteServerVO +"]");
// logger.info("[리모트송수신] [NDM_Api] ⓟ NDM로컬 경로 : ["+ ndmLocalDir +"]");
// logger.info("[리모트송수신] [NDM_Api] ⓟ NDM로컬 파일 : ["+ ndmLocalFile +"]");
// logger.info("[리모트송수신] [NDM_Api] ⓟ 리모트 경로 : ["+ remoteDir +"]");
// logger.info("[리모트송수신] [NDM_Api] ⓟ 리모트 파일 : ["+ remoteFile +"]");
//
// //파라미터 체크
// if (remoteServerVO == null) throw new Exception("{리모트서버 VO} 파라미터 오류");
// if (ndmLocalDir.equals("")) throw new Exception("{NDM로컬} 파라미터 오류");
// if (ndmLocalFile.equals("")) throw new Exception("{NDM로컬} 파라미터 오류");
// if (remoteDir.equals("")) throw new Exception("{리모트경로} 파라미터 오류");
// if (remoteFile.equals("")) throw new Exception("{리모트파일} 파라미터 오류");
//
// //파일전송 로그정보 설정
// if (isLogging) {
// if (logInfo==null) logInfo = new RemoteTransferLogVO();
// logInfo.setRemoteServerVO (remoteServerVO);
// logInfo.setRemoteServerId (remoteServerVO.getRemoteServerId());
// logInfo.setSendRecvType (DIRECTION_SEND);
// logInfo.setTransferType (TRANSFER_TYPE_NDM);
// logInfo.setEaiFilePath (ndmLocalDir);
// logInfo.setEaiFileName (ndmLocalFile);
// logInfo.setRemoteFilePath (remoteDir);
// logInfo.setRemoteFileName (remoteFile);
// logInfo.setFransferStartTime(CalendarUtil.getCurrentTimeNoDash());
// File f = new File(ndmLocalDir, ndmLocalFile);
// logInfo.setFileSize (f.length()+"");
// logInfo.setFileLastModified (DatetimeUtil.getFormattedDate("yyyyMMddHHmmssSSS", new Date(f.lastModified())));
// }
//
//
// String remoteDelimiter = StringUtil.getDirDelimiter(remoteDir);
// String ndmLocalDelimiter = StringUtil.getDirDelimiter(ndmLocalDir);
//
// if (remoteDir .endsWith(remoteDelimiter )) remoteDir = remoteDir .substring(0, remoteDir .length()-1);
// if (ndmLocalDir.endsWith(ndmLocalDelimiter)) ndmLocalDir = ndmLocalDir.substring(0, ndmLocalDir.length()-1);
// if (remoteFile==null || remoteFile.equals("")) remoteFile = ndmLocalFile;
//
// String command = logInfo.getNdmPname() + " process snode="+ remoteServerVO.getRemoteServerIP() +";"+ remoteServerVO.getRemoteNdmPort() +"\n"
// + "step1 copy from (file=\""+ ndmLocalDir + ndmLocalDelimiter + ndmLocalFile +"\" pnode)\n"
// + " to (file=\""+ remoteDir + remoteDelimiter + remoteFile +"\" disp=(rpl) snode)\n"
// + "pend";
// executeNdmCommand(COMMAND_TYPE_SUBMIT, command);
//
// //파일전송 로그정보 설정
// if (isLogging) logInfo.setFransferEndTime (CalendarUtil.getCurrentTimeNoDash());
//
// logger.info("[리모트송수신] [NDM_Api] ■ EAI→Remote 파일 NDM 송신 완료.");
// }
//
// //-------------------------------------------------------------------------------------------
// // 리모트서버로 부터 파일 수신
// //-------------------------------------------------------------------------------------------
// public void receiveFile(RemoteServerVO remoteServerVO, String remoteDir, String remoteFile, String ndmLocalDir, String ndmLocalFile) throws Exception {
// logger.info("[리모트송수신] [NDM_Api] ■ Remote→EAI 파일 NDM 수신 시작......");
// logger.info("[리모트송수신] [NDM_Api] ⓟ 리모트 서버 VO : ["+ remoteServerVO +"]");
// logger.info("[리모트송수신] [NDM_Api] ⓟ 리모트 경로 : ["+ remoteDir +"]");
// logger.info("[리모트송수신] [NDM_Api] ⓟ 리모트 파일 : ["+ remoteFile +"]");
// logger.info("[리모트송수신] [NDM_Api] ⓟ NDM로컬 경로 : ["+ ndmLocalDir +"]");
// logger.info("[리모트송수신] [NDM_Api] ⓟ NDM로컬 파일 : ["+ ndmLocalFile +"]");
//
// //파라미터 체크
// if (remoteServerVO == null) throw new Exception("{리모트서버 VO} 파라미터 오류");
// if (remoteDir.equals("")) throw new Exception("{리모트경로} 파라미터 오류");
// if (remoteFile.equals("")) throw new Exception("{리모트파일} 파라미터 오류");
// if (ndmLocalDir.equals("")) throw new Exception("{NDM로컬} 파라미터 오류");
// if (ndmLocalFile.equals("")) throw new Exception("{NDM로컬} 파라미터 오류");
//
// //파일전송 로그정보 설정
// if (isLogging) {
// if (logInfo==null) logInfo = new RemoteTransferLogVO();
// logInfo.setRemoteServerVO (remoteServerVO);
// logInfo.setRemoteServerId (remoteServerVO.getRemoteServerId());
// logInfo.setSendRecvType (DIRECTION_RECEIVE);
// logInfo.setTransferType (TRANSFER_TYPE_NDM);
// logInfo.setEaiFilePath (ndmLocalDir);
// logInfo.setEaiFileName (ndmLocalFile);
// logInfo.setRemoteFilePath (remoteDir);
// logInfo.setRemoteFileName (remoteFile);
// logInfo.setFransferStartTime(CalendarUtil.getCurrentTimeNoDash());
// }
//
// String remoteDelimiter = StringUtil.getDirDelimiter(remoteDir);
// String ndmLocalDelimiter = StringUtil.getDirDelimiter(ndmLocalDir);
//
// if (remoteDir .endsWith(remoteDelimiter )) remoteDir = remoteDir .substring(0, remoteDir .length()-1);
// if (ndmLocalDir.endsWith(ndmLocalDelimiter)) ndmLocalDir = ndmLocalDir.substring(0, ndmLocalDir.length()-1);
// if (ndmLocalFile==null || ndmLocalFile.equals("")) ndmLocalFile = remoteFile;
//
// String command = logInfo.getNdmPname() + " process snode="+ remoteServerVO.getRemoteServerIP() +";"+ remoteServerVO.getRemoteNdmPort() +"\n"
// + "step1 copy from (file=\""+ remoteDir + remoteDelimiter + remoteFile +"\" snode)\n"
// + " to (file=\""+ ndmLocalDir + ndmLocalDelimiter + ndmLocalFile +"\" disp=(rpl) pnode)\n"
// + "pend";
//
// executeNdmCommand(COMMAND_TYPE_SUBMIT, command);
//
// //파일전송 로그정보 설정
// if (isLogging) {
// File f = new File(ndmLocalDir, ndmLocalFile);
// logInfo.setFileSize (f.length()+"");
// logInfo.setFileLastModified (DatetimeUtil.getFormattedDate("yyyyMMddHHmmssSSS", new Date(f.lastModified())));
// logInfo.setFransferEndTime (CalendarUtil.getCurrentTimeNoDash());
// }
//
// logger.info("[리모트송수신] [NDM_Api] ■ Remote→EAI 파일 NDM 수신 완료.");
// }
//
//
// public ArrayList<Object> selectCommand(String selectCommand) throws Exception {
// logger.info("[리모트송수신] [NDM_Api] ■ NDM Select Command 시작......");
// logger.info("[리모트송수신] [NDM_Api] ⓟ Select Command : ["+ selectCommand +"]");
//
// ArrayList<Object> alist = executeNdmCommand(COMMAND_TYPE_SELECT, selectCommand);
//
// logger.info("[리모트송수신] [NDM_Api] ■ NDM Select Command 완료.");
// return alist;
// }
//
//
//
//
//
//
//
// @SuppressWarnings("rawtypes")
// private ArrayList<Object> executeNdmCommand(String commandType, String command) throws Exception {
//
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM Command 수행 시작... (Send Command to NDM 서버["+ this.ndmNodeName +"])");
// logger.info("[리모트송수신] [NDM_Api] ⓟ commandType : ["+ commandType +"]");
//
// ArrayList<Object> alist = null;
// try {
// this.connect();
//
// if (commandType.equalsIgnoreCase(COMMAND_TYPE_SUBMIT)) {
// alist = this.executeSubmitCommand(command); //throw Exception
//
// } else if (commandType.equalsIgnoreCase(COMMAND_TYPE_SELECT)) {
// alist = this.executeSelectCommand(command); //throw Exception
// }
//
// } catch (MsgException ex) {
// logger.error( ex.getMessage(), ex);
//
// String errMsg = ex.toString();
// Enumeration errorEnum = ex.elements();
// while (errorEnum.hasMoreElements()) {
// Object obj = errorEnum.nextElement();
// logger.error("[리모트송수신] [NDM_Api] - " + obj);
// errMsg += "\n - "+ obj;
// }
// throw new Exception("NDM Command 수행 실패!\n caused by..."+ errMsg);
//
// } catch (Exception ex) {
// logger.error( ex.getMessage(), ex);
// throw new Exception("NDM Command 수행 실패!\n caused by..."+ ex.toString());
//
// } finally {
// this.disconnect();
// }
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM Command 수행 완료.");
// return alist;
// }
//
// private ArrayList<Object> executeSubmitCommand(String command) throws Exception {
//
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM Submit Command 수행 시작...");
// logger.info("[리모트송수신] [NDM_Api] ⓟ Command : submit maxdelay=unlimited \n"+ command);
// MediatorEnum submitResults = cdNode.execute("submit maxdelay=unlimited", command);
//
// ArrayList<Object> alist = new ArrayList<Object>();
// while (submitResults.hasMoreElements()) {
// CDProcess processData = (CDProcess)submitResults.getNextElement();
// alist.add(processData);
// String processNumber = processData.getProcessNumber() +"";
// String resultCode = processData.getConditionCode() +"";
// String messageId = processData.getMsgId();
// String messageText = processData.getMsgText();
// logger.info("[리모트송수신] [NDM_Api] ☞ Process Number : "+ processNumber);
// logger.info("[리모트송수신] [NDM_Api] ☞ Return code : "+ resultCode);
// logger.info("[리모트송수신] [NDM_Api] ☞ Message id : "+ messageId +" ["+ messageText +"]");
//
// //파일전송 로그정보 설정
// if (isLogging) logInfo.setNdmPnumber (processNumber);
// if (isLogging) logInfo.setResultCode (resultCode);
//
// if (!resultCode.equals(RESULT_CODE_SUCCESS)) {
// throw new Exception("NDM Submit 명령어 실행 결과 값이 정상이 아닙니다. (ResultCode:"+ resultCode +", MessageId:"+ messageId +")");
// }
// }
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM Submit Command 수행 완료.");
// return alist;
// }
//
// private ArrayList<Object> executeSelectCommand(String command) throws Exception {
//
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM Select Command 수행 시작...");
// logger.info("[리모트송수신] [NDM_Api] ⓟ Command : "+ command);
// MediatorEnum seleteResults = cdNode.execute(command);
//
// ArrayList<Object> alist = new ArrayList<Object>();
// while (seleteResults.hasMoreElements()) {
// Object obj = seleteResults.getNextElement();
// alist.add(obj);
// logger.debug("[리모트송수신] [NDM_Api] ☞ Process Data : "+ obj);
// //CDProcess processData = (CDProcess)submitResults.getNextElement();
// //logger.info("[리모트송수신] [NDM_Api] [NDM Command] ☞ Process Data : "+ processData);
// }
// logger.info("[리모트송수신] [NDM_Api] ▶ NDM Select Command 수행 완료.");
// return alist;
// }
//
//
//}
@@ -0,0 +1,235 @@
//package com.eactive.eai.inbound.remote;
//
//import com.eactive.eai.batch.common.CalendarUtil;
//import com.eactive.eai.batch.common.StringUtil;
//import com.eactive.eai.common.property.PropManager;
//import com.eactive.eai.common.util.DatetimeUtil;
//
//import java.io.File;
//import java.util.Date;
//
//public class NDMTransferByScript extends CommonTransfer
//{
//
// //리모트 NDM 전송 프라퍼티 정보
// public static final String PROP_GROUP_REMOTE_TRANSFER_NDM = "RemoteTransferNdmInfo";
// public static final String PROP_NDM_SEND_SCRIPT_PATH = "NDM_SEND_SCRIPT_PATH"; //NDM 송신 쉘스크립트 경로 (전체 경로)
// public static final String PROP_NDM_RECV_SCRIPT_PATH = "NDM_RECV_SCRIPT_PATH"; //NDM 수신 쉘스크립트 경로 (전체 경로)
//
// private static String getPropNdmSendScriptPath() throws Exception {
// String propValue = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER_NDM, PROP_NDM_SEND_SCRIPT_PATH);
// if (propValue == null) throw new Exception("'NDM 송신 쉘스크립트 파일' 프라퍼티 정보가 없습니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER_NDM +", PropName:"+ PROP_NDM_SEND_SCRIPT_PATH +")");
// return propValue;
// }
//
// private static String getPropNdmRecvScriptPath() throws Exception {
// String propValue = PropManager.getInstance().getProperty(PROP_GROUP_REMOTE_TRANSFER_NDM, PROP_NDM_RECV_SCRIPT_PATH);
// if (propValue == null) throw new Exception("'NDM 수신 쉘스크립트 파일' 프라퍼티 정보가 없습니다. (PropGroupName:"+ PROP_GROUP_REMOTE_TRANSFER_NDM +", PropName:"+ PROP_NDM_RECV_SCRIPT_PATH +")");
// return propValue;
// }
//
//
// //-------------------------------------------------------------------------------------------
// // 리모트서버로 실제파일 송신, 송신여부 리턴. (System NDM Shell Command 수행)
// //-------------------------------------------------------------------------------------------
// public void sendFile(RemoteServerVO remoteServerVO, String eaiDir, String eaiFile, String remoteDir, String remoteFile) throws Exception {
//
//
// logger.info("[리모트송수신] [NDM_Script] ■ EAI→Remote 파일 NDM 송신 시작...... (Runtime Script 사용)");
// logger.info("[리모트송수신] [NDM_Script] ⓟ 리모트 서버 VO : ["+ remoteServerVO +"]");
// logger.info("[리모트송수신] [NDM_Script] ⓟ EAI 경로 : ["+ eaiDir +"]");
// logger.info("[리모트송수신] [NDM_Script] ⓟ EAI 파일 : ["+ eaiFile +"]");
// logger.info("[리모트송수신] [NDM_Script] ⓟ 리모트 경로 : ["+ remoteDir +"]");
// logger.info("[리모트송수신] [NDM_Script] ⓟ 리모트 파일 : ["+ remoteFile +"]");
//
// //파라미터 체크
// if (remoteServerVO == null) throw new Exception("{리모트서버 VO} 파라미터 오류");
// if (eaiDir.equals("")) throw new Exception("{EAI경로} 파라미터 오류");
// if (eaiFile.equals("")) throw new Exception("{EAI파일} 파라미터 오류");
// if (remoteDir.equals("")) throw new Exception("{리모트경로} 파라미터 오류");
// if (remoteFile.equals("")) throw new Exception("{리모트파일} 파라미터 오류");
//
// //파일전송 로그정보 설정
// if (isLogging) {
// if (logInfo==null) logInfo = new RemoteTransferLogVO();
// logInfo.setRemoteServerVO (remoteServerVO);
// logInfo.setRemoteServerId (remoteServerVO.getRemoteServerId());
// logInfo.setSendRecvType (DIRECTION_SEND);
// logInfo.setTransferType (TRANSFER_TYPE_NDM);
// logInfo.setEaiFilePath (eaiDir);
// logInfo.setEaiFileName (eaiFile);
// logInfo.setRemoteFilePath (remoteDir);
// logInfo.setRemoteFileName (remoteFile);
// logInfo.setFransferStartTime(CalendarUtil.getCurrentTimeNoDash());
// File f = new File(eaiDir, eaiFile);
// logInfo.setFileSize (f.length()+"");
// logInfo.setFileLastModified (DatetimeUtil.getFormattedDate("yyyyMMddHHmmssSSS", new Date(f.lastModified())));
// }
//
///*
//#!/bin/sh
//
//ndmcli -x << EOJ
//submit maxdelay=unlimited
//SENDFILE process snode=$1
//step1 copy from (file="$3" pnode)
// to (file="$4" disp=(rpl) snode)
//pend;
//EOJ
//*/
//
// String remoteDelimiter = StringUtil.getDirDelimiter(remoteDir);
// String eaiDelimiter = StringUtil.getDirDelimiter(eaiDir);
// if (remoteDir.endsWith(remoteDelimiter)) remoteDir = remoteDir.substring(0, remoteDir.length()-1);
// if (eaiDir .endsWith(eaiDelimiter )) eaiDir = eaiDir .substring(0, eaiDir .length()-1);
// if (remoteFile==null || remoteFile.equals("")) remoteFile = eaiFile;
//
// //1. System NDM Shell 명령어 생성
///*
// String command = getPropNdmSendScriptPath() +" "+ logInfo.getNdmPname()
// +" "+ remoteServerVO.getRemoteServerIP() +";"+ remoteServerVO.getRemoteNdmPort()
// +" "+ eaiDir + eaiDelimiter + eaiFile
// +" "+ remoteDir + remoteDelimiter + remoteFile;
//*/
// String[] command = new String[5];
// command[0] = getPropNdmSendScriptPath();
// command[1] = logInfo.getNdmPname();
//
// if ( remoteServerVO.getRemoteNodeName().trim().equals("")){
// command[2] = remoteServerVO.getRemoteServerIP() +";"+ remoteServerVO.getRemoteNdmPort();
// }else{
// command[2] = remoteServerVO.getRemoteNodeName().trim();
// }
// command[3] = eaiDir + eaiDelimiter + eaiFile;
// command[4] = remoteDir + remoteDelimiter + remoteFile;
//
// int pos = remoteFile.indexOf('|');
// if ( pos > -1 ){
// command[0] = remoteFile.substring(0,pos);
// command[4] = remoteFile.substring( pos + 1, remoteFile.length());
//
// }
// //2. System NDM Shell 명령어를 Runtime 으로 실행
// this.runSystemScript(command);
//
// //파일전송 로그정보 설정
// if (isLogging) logInfo.setFransferEndTime (CalendarUtil.getCurrentTimeNoDash());
//
// logger.info("[리모트송수신] [NDM_Script] ■ EAI→Remote 파일 NDM 송신 완료.");
// }
//
// //-------------------------------------------------------------------------------------------
// // 리모트서버로 부터 실제파일 수신, 수신여부 리턴. (System NDM Shell Command 수행)
// //-------------------------------------------------------------------------------------------
// public void receiveFile(RemoteServerVO remoteServerVO, String remoteDir, String remoteFile, String eaiDir, String eaiFile) throws Exception {
//
// logger.info("[리모트송수신] [NDM_Script] ■ Remote→EAI 파일 NDM 수신 시작...... (Runtime Script 사용)");
// logger.info("[리모트송수신] [NDM_Script] ⓟ 리모트 서버 VO : ["+ remoteServerVO +"]");
// logger.info("[리모트송수신] [NDM_Script] ⓟ 리모트 경로 : ["+ remoteDir +"]");
// logger.info("[리모트송수신] [NDM_Script] ⓟ 리모트 파일 : ["+ remoteFile +"]");
// logger.info("[리모트송수신] [NDM_Script] ⓟ EAI 경로 : ["+ eaiDir +"]");
// logger.info("[리모트송수신] [NDM_Script] ⓟ EAI 파일 : ["+ eaiFile +"]");
//
// //파라미터 체크
// if (remoteServerVO == null) throw new Exception("{리모트서버 VO} 파라미터 오류");
// if (remoteDir.equals("")) throw new Exception("{리모트경로} 파라미터 오류");
// if (remoteFile.equals("")) throw new Exception("{리모트파일} 파라미터 오류");
// if (eaiDir.equals("")) throw new Exception("{EAI경로} 파라미터 오류");
// if (eaiFile.equals("")) throw new Exception("{EAI파일} 파라미터 오류");
//
//
// //파일전송 로그정보 설정
// if (isLogging) {
// if (logInfo==null) logInfo = new RemoteTransferLogVO();
// logInfo.setRemoteServerVO (remoteServerVO);
// logInfo.setRemoteServerId (remoteServerVO.getRemoteServerId());
// logInfo.setSendRecvType (DIRECTION_RECEIVE);
// logInfo.setTransferType (TRANSFER_TYPE_NDM);
// logInfo.setEaiFilePath (eaiDir);
// logInfo.setEaiFileName (eaiFile);
// logInfo.setRemoteFilePath (remoteDir);
// logInfo.setRemoteFileName (remoteFile);
// logInfo.setFransferStartTime(CalendarUtil.getCurrentTimeNoDash());
// }
//
//
///*
//#!/bin/sh
//
//ndmcli -x << EOJ
//submit maxdelay=unlimited
//SENDFILE process snode=$1
//step1 copy from (file="$3" snode)
// to (file="$4" disp=(rpl) pnode)
//pend;
//EOJ
//*/
//
// String remoteDelimiter = StringUtil.getDirDelimiter(remoteDir);
// String eaiDelimiter = StringUtil.getDirDelimiter(eaiDir);
// if (remoteDir.endsWith(remoteDelimiter)) remoteDir = remoteDir.substring(0, remoteDir.length()-1);
// if (eaiDir .endsWith(eaiDelimiter )) eaiDir = eaiDir .substring(0, eaiDir .length()-1);
// if (eaiFile==null || eaiFile.equals("")) eaiFile = remoteFile;
//
// //1. System NDM Shell 명령어 생성
// /*
// String command = getPropNdmRecvScriptPath() +" "+ logInfo.getNdmPname()
// +" "+ remoteServerVO.getRemoteServerIP() +";"+ remoteServerVO.getRemoteNdmPort()
// +" "+ remoteDir + remoteDelimiter + remoteFile
// +" "+ eaiDir + eaiDelimiter + eaiFile;
// */
//
// String command[] = new String[5];
// command[0] = getPropNdmRecvScriptPath();
// command[1] = logInfo.getNdmPname();
// command[2] = remoteServerVO.getRemoteServerIP() +";"+ remoteServerVO.getRemoteNdmPort();
// command[3] = remoteDir + remoteDelimiter + remoteFile;
// command[4] = eaiDir + eaiDelimiter + eaiFile;
//
// //2. System NDM Shell 명령어를 Runtime 으로 실행
// this.runSystemScript(command);
//
// //파일전송 로그정보 설정
// if (isLogging) {
// File f = new File(eaiDir, eaiFile);
// logInfo.setFileSize (f.length()+"");
// logInfo.setFileLastModified (DatetimeUtil.getFormattedDate("yyyyMMddHHmmssSSS", new Date(f.lastModified())));
// logInfo.setFransferEndTime (CalendarUtil.getCurrentTimeNoDash());
// }
//
// logger.info("[리모트송수신] [NDM_Script] ■ Remote→EAI 파일 NDM 수신 완료.");
// }
//
//
//
// protected void runSystemScript(String[] command) throws Exception {
//
// super.runSystemScript(command);
//
// if (!super.scriptErrorMsg.equals("")) {
// logInfo.setResultCode(CommonTransfer.RESULT_CODE_UNEXPECTED_ERROR);
// throw new Exception("Runtime.Exec 으로 실행한 NDM Command 결과가 정상이 아닙니다.\n caused by..."+ super.scriptErrorMsg);
// }
//
// int index1, index2, index3;
// index1 = scriptOutputMsg.indexOf("Process Number = ");
// index2 = scriptOutputMsg.indexOf("Return code = ");
// index3 = scriptOutputMsg.indexOf("Message id = ");
// String processNumber = StringUtil.nvlTrim( scriptOutputMsg.substring(index1 + 17, scriptOutputMsg.indexOf("\n", index1)) );
// String resultCode = StringUtil.nvlTrim( scriptOutputMsg.substring(index2 + 17, scriptOutputMsg.indexOf("\n", index2)) );
// String messageId = StringUtil.nvlTrim( scriptOutputMsg.substring(index3 + 17, scriptOutputMsg.indexOf("\n", index3)) );
// logger.info("[리모트송수신] [NDM_Script] ☞ Process Number : "+ processNumber);
// logger.info("[리모트송수신] [NDM_Script] ☞ Return code : "+ resultCode);
// logger.info("[리모트송수신] [NDM_Script] ☞ Message id : "+ messageId);
//
// //파일전송 로그정보 설정
// if (isLogging) logInfo.setNdmPnumber (processNumber);
// if (isLogging) logInfo.setResultCode (resultCode);
//
// if (!resultCode.equals(RESULT_CODE_SUCCESS)) {
// logInfo.setResultCode(resultCode);
// throw new Exception("Runtime.Exec 으로 실행한 NDM Command 결과가 정상이 아닙니다. (NDM ResultCode:"+ resultCode +", NDM MessageId:"+ messageId +")");
// }
// }
//
//}
@@ -0,0 +1,226 @@
package com.eactive.eai.inbound.remote;
import java.sql.ResultSet;
//import java.sql.ResultSetMetaData;
import java.util.ArrayList;
import org.slf4j.LoggerFactory;
import com.eactive.eai.batch.common.StringUtil;
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.Logger;
public class RemoteDirectoryDAO extends BaseDAO implements RemoteDirectoryQuery
{
public RemoteDirectoryDAO() {
super();
super.logger = Logger.getLogger(Logger.LOGGER_FILEEVENT);
}
//-------------------------------------------------------------------------------------------
// REMOTE 서버정보 상세조회
//-------------------------------------------------------------------------------------------
public ArrayList<RemoteDirectoryVO> selectRemoteDirectory(String searchProcessCode, String searchType, String searchText) throws DAOException {
ResultSet rs = null;
int index = 0;
try {
String query = SEARCH_REMOTE_DIRECTORY;
if("SERVER_NAME".equals(searchType)) {
query = query + " AND A.\"RmtSevrName\" LIKE '%" + searchText + "%'\n";
}
else if("DIRECTORY_NAME".equals(searchType)) {
query = query + " AND B.\"RmtSevrJobDirName\" LIKE '%" + searchText + "%'\n";
}
else if("DIRECTORY_ID".equals(searchType)) {
query = query + " AND B.\"RmtSevrJobDirID\" LIKE '" + searchText + "%'\n";
}
query = query + " ORDER BY B.\"RmtSevrJobDirID\" ";
this.connect(query);
logger.debug(">>> 리모트 디렉토리 검색 SQL : \n"+ query);
index = 1;
this.preparedStatement.setString(index++, searchProcessCode); logger.debug(">>> 바인드("+(index-1)+") : ["+ searchProcessCode +"]");
rs = executeQuery();
ArrayList<RemoteDirectoryVO> alist = new ArrayList<RemoteDirectoryVO>();
while (rs.next()) {
RemoteServerVO sinfo = new RemoteServerVO();
sinfo.setRemoteServerId (StringUtil.nvlTrim(rs.getString(1 ))); // 리모트서버 ID (PK)
sinfo.setRemoteServerName(StringUtil.nvlTrim(rs.getString(2 ))); // 리모트서버 명
sinfo.setProcessCode (StringUtil.nvlTrim(rs.getString(3 ))); // 업무구분코드 (FK)
sinfo.setRemoteServerIP (StringUtil.nvlTrim(rs.getString(4 ))); // 리모트서버 IP
sinfo.setRemoteNdmPort (StringUtil.nvlTrim(rs.getString(5 ))); // 리모트서버 NDM Port Number
sinfo.setRemoteFtpPort (StringUtil.nvlTrim(rs.getString(6 ))); // 리모트서버 FTP Port Number
sinfo.setRemoteUserId (StringUtil.nvlTrim(rs.getString(7 ))); // 리모트서버 FTP User ID
sinfo.setRemotePassword (StringUtil.nvl (rs.getString(8 ))); // 리모트서버 FTP User Password
sinfo.setRemoteRootDir (StringUtil.nvlTrim(rs.getString(9 ))); // 리모트서버 Root Directory
sinfo.setAutoTransferType(StringUtil.nvlTrim(rs.getString(10))); // 리포트 파일 이벤트시 파일 복사 방법
sinfo.setUseYn (StringUtil.nvlTrim(rs.getString(11))); // 리모트서버 사용여부
sinfo.setCreateId (StringUtil.nvlTrim(rs.getString(12))); // 리모트서버 등록자ID
sinfo.setCreateTime (StringUtil.nvlTrim(rs.getString(13))); // 리모트서버 등록시간
sinfo.setUpdateId (StringUtil.nvlTrim(rs.getString(14))); // 리모트서버 수정자ID
sinfo.setUpdateTime (StringUtil.nvlTrim(rs.getString(15))); // 리모트서버 수정시간
//리모트 Root Directory 가 "/" 로 끝나면 "/" 제거
if (sinfo.getRemoteRootDir().endsWith("/")) {
sinfo.setRemoteRootDir(sinfo.getRemoteRootDir().substring(0, sinfo.getRemoteRootDir().length()-1));
}
RemoteDirectoryVO info = new RemoteDirectoryVO();
info.setRemoteDirId (StringUtil.nvlTrim(rs.getString(16)));
info.setRemoteDirName (StringUtil.nvlTrim(rs.getString(17)));
info.setRemoteServerId(StringUtil.nvlTrim(rs.getString(18)));
info.setProcessCode (StringUtil.nvlTrim(rs.getString(19)));
info.setProcessName (StringUtil.nvlTrim(rs.getString(20)));
info.setOrganCode (StringUtil.nvlTrim(rs.getString(21)));
info.setOrganName (StringUtil.nvlTrim(rs.getString(22)));
info.setBizGroupCode (StringUtil.nvlTrim(rs.getString(23)));
info.setBizGroupName (StringUtil.nvlTrim(rs.getString(24)));
info.setUseYn (StringUtil.nvlTrim(rs.getString(25)));
info.setCreateId (StringUtil.nvlTrim(rs.getString(26)));
info.setCreateTime (StringUtil.nvlTrim(rs.getString(27)));
info.setUpdateId (StringUtil.nvlTrim(rs.getString(28)));
info.setUpdateTime (StringUtil.nvlTrim(rs.getString(29)));
info.setRemoteServerVO (sinfo);
alist.add(info);
}
logger.info(">>> 리모트 디렉토리 검색 건수 : "+ alist.size());
return alist;
} catch (DAOException ex) {
throw ex;
} catch (Exception e) {
String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
throw new DAOException(errMsg); //<--------------
} finally {
disconnect();
}
}
//-------------------------------------------------------------------------------------------
// REMOTE 서버정보 신규
//-------------------------------------------------------------------------------------------
// public int insertRemoteDirectory(RemoteDirectoryVO remoteDirectoryVO) throws DAOException {
//
// int retValue = 0;
// int index = 0;
//
// try {
//
// String query = INSERT_REMOTE_DIRECTORY;
// this.connect(query);
// logger.debug(">>> 리모트 디렉토리 등록 SQL : \n"+ query);
//
// index = 1;
// this.preparedStatement.setString(index++, remoteDirectoryVO.getRemoteServerId()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getRemoteServerId() +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getRemoteDirName ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getRemoteDirName () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getRemoteServerId()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getRemoteServerId() +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getProcessCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getProcessCode () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getOrganCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getOrganCode () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getBizGroupCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getBizGroupCode () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getUseYn ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getUseYn () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getCreateId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getCreateId () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getCreateTime ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getCreateTime () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getUpdateId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getUpdateId () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getUpdateTime ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getUpdateTime () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getRemoteServerId()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getRemoteServerId() +"]");
//
// retValue = this.executeUpdate();
// logger.info(">>> 리모트 디렉토리 등록 건수 : "+ retValue);
//
// return retValue;
//
// } catch (DAOException ex) {
// throw ex;
// } catch (Exception e) {
// String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
// throw new DAOException(errMsg); //<--------------
// } finally {
// disconnect();
// }
// }
//
//
// //-------------------------------------------------------------------------------------------
// // REMOTE 서버정보 변경
// //-------------------------------------------------------------------------------------------
// public int updatetRemoteDirectory(RemoteDirectoryVO remoteDirectoryVO) throws DAOException {
//
// int retValue = 0;
// int index = 0;
//
// try {
//
// String query = UPDATE_REMOTE_DIRECTORY;
// this.connect(query);
// logger.debug(">>> 리모트 디렉토리 수정 SQL : \n"+ query);
//
// index = 1;
// this.preparedStatement.setString(index++, remoteDirectoryVO.getRemoteServerId()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getRemoteServerId() +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getRemoteDirName ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getRemoteDirName () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getOrganCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getOrganCode () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getBizGroupCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getBizGroupCode () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getUseYn ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getUseYn () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getUpdateId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getUpdateId () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getUpdateTime ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getUpdateTime () +"]");
// this.preparedStatement.setString(index++, remoteDirectoryVO.getRemoteDirId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirectoryVO.getRemoteDirId () +"]");
//
// retValue = this.executeUpdate();
// logger.info(">>> 리모트 디렉토리 수정 건수 : "+ retValue);
//
// return retValue;
//
// } catch (DAOException ex) {
// throw ex;
// } catch (Exception e) {
// String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
// throw new DAOException(errMsg); //<--------------
// } finally {
// disconnect();
// }
// }
//
//
// //-------------------------------------------------------------------------------------------
// // REMOTE 서버정보 삭제
// //-------------------------------------------------------------------------------------------
// public int deleteRemoteDirectory(String remoteDirId) throws DAOException {
//
// int retValue = 0;
// int index = 0;
//
// try {
//
// String query = DELETE_REMOTE_DIRECTORY;
// this.connect(query);
// logger.debug(">>> 리모트 디렉토리 삭제 SQL : \n"+ query);
//
// index = 1;
// this.preparedStatement.setString(index++, remoteDirId); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteDirId +"]");
//
// retValue = this.executeUpdate();
// logger.info(">>> 리모트 디렉토리 삭제 건수 : "+ retValue);
//
// return retValue;
//
// } catch (DAOException ex) {
// throw ex;
// } catch (Exception e) {
// String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
// throw new DAOException(errMsg); //<--------------
// } finally {
// disconnect();
// }
// }
}
@@ -0,0 +1,49 @@
package com.eactive.eai.inbound.remote;
import com.eactive.eai.common.dao.DAOFactory;
import java.util.ArrayList;
public class RemoteDirectoryManager
{
//singleton 객체 생성
private static RemoteDirectoryManager instance = new RemoteDirectoryManager();
//singleton 객체 리턴
public static RemoteDirectoryManager getInstance() {
return instance;
}
//생성자 (다른 클래스에서 new 불가)
private RemoteDirectoryManager() {}
public RemoteDirectoryVO detailRemoteDirectory(String remoteDirId) throws Exception {
RemoteDirectoryDAO dao = (RemoteDirectoryDAO)DAOFactory.newInstance().create(RemoteDirectoryDAO.class);
ArrayList<RemoteDirectoryVO> alist = dao.selectRemoteDirectory("", "DIRECTORY_ID", remoteDirId);
if (alist.size() == 0) return null;
return (RemoteDirectoryVO) alist.get(0);
}
public ArrayList<RemoteDirectoryVO> searchRemoteDirectory(String searchProcessCode, String searchType, String searchText) throws Exception {
RemoteDirectoryDAO dao = (RemoteDirectoryDAO)DAOFactory.newInstance().create(RemoteDirectoryDAO.class);
return dao.selectRemoteDirectory(searchProcessCode, searchType, searchText);
}
// public int insertRemoteDirectory(RemoteDirectoryVO remoteDirectoryVO) throws Exception {
// RemoteDirectoryDAO dao = (RemoteDirectoryDAO)DAOFactory.newInstance().create(RemoteDirectoryDAO.class);
// return dao.insertRemoteDirectory(remoteDirectoryVO);
// }
//
// public int updatetRemoteDirectory(RemoteDirectoryVO remoteDirectoryVO) throws Exception {
// RemoteDirectoryDAO dao = (RemoteDirectoryDAO)DAOFactory.newInstance().create(RemoteDirectoryDAO.class);
// return dao.updatetRemoteDirectory(remoteDirectoryVO);
// }
//
// public int deletetRemoteDirectory(String remoteDirId) throws Exception {
// RemoteDirectoryDAO dao = (RemoteDirectoryDAO)DAOFactory.newInstance().create(RemoteDirectoryDAO.class);
// return dao.deleteRemoteDirectory(remoteDirId);
// }
}
@@ -0,0 +1,78 @@
package com.eactive.eai.inbound.remote;
import com.eactive.eai.common.dao.Keys;
public interface RemoteDirectoryQuery
{
//REMOTE 서버별 작업디렉토리 목록 조회
public static final String SEARCH_REMOTE_DIRECTORY =
"SELECT A.RmtSevrID , \n"
+ " A.RmtSevrName , \n"
+ " A.BjobBzwkDstcd , \n"
+ " A.RmtSevrIP , \n"
+ " A.RmtSevrNDMPortNoName , \n"
+ " A.RmtSevrFTPPortNoName , \n"
+ " A.RmtSevrFTPUID , \n"
+ " A.RmtSevrFTPUserPwdName , \n"
+ " A.RmtSevrRootDirName , \n"
+ " A.RmtFileEvntCpyDstcd , \n"
+ " A.ThisMsgUseYn , \n"
+ " A.ThisMsgRegsntID , \n"
+ " A.ThisMsgRegiHMS , \n"
+ " A.ThisMsgAmndrID , \n"
+ " A.ThisMsgAmndHMS , \n"
+ " B.RmtSevrJobDirID , \n"
+ " B.RmtSevrJobDirName , \n"
+ " B.RmtSevrID , \n"
+ " B.BjobBzwkDstcd , \n"
+ " C.BjobBzwkName , \n"
+ " LTRIM(RTRIM(B.OsidInstiDstcd )) AS OsidInstiDstcd , \n"
+ " D.OsidInstiName , \n"
+ " B.TranGroupDsticID , \n"
+ " B.ThisMsgUseYn , \n"
+ " B.ThisMsgRegsntID , \n"
+ " B.ThisMsgRegiHMS , \n"
+ " B.ThisMsgAmndrID , \n"
+ " B.ThisMsgAmndHMS \n"
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBU01 A,\n"
+ " " + Keys.TABLE_OWNER + "TSEAIBU02 B \n"
+ " LEFT OUTER JOIN " + Keys.TABLE_OWNER + "TSEAIBJ02 C \n"
+ "ON B.BjobBzwkDstcd = C.BjobBzwkDstcd \n"
+ " LEFT OUTER JOIN " + Keys.TABLE_OWNER + "TSEAIBJ06 D \n"
+ "ON B.BjobBzwkDstcd = D.BjobBzwkDstcd \n"
+ "AND LTRIM(RTRIM(B.OsidInstiDstcd)) = LTRIM(RTRIM(D.OsidInstiDstcd)) \n"
+ "WHERE A.RmtSevrID = B.RmtSevrID \n"
+ "AND B.BjobBzwkDstcd LIKE ? || '%' \n";
//REMOTE 서버작업디렉토리 등록
public static final String INSERT_REMOTE_DIRECTORY =
"INSERT INTO " + Keys.TABLE_OWNER + "TSEAIBU02 ( \n"
+ " RmtSevrJobDirID , \n"
+ " RmtSevrJobDirName , RmtSevrID , BjobBzwkDstcd , OsidInstiDstcd , \n"
+ " TranGroupDsticID , ThisMsgUseYn , ThisMsgRegsntID , ThisMsgRegiHMS , \n"
+ " ThisMsgAmndrID , ThisMsgAmndHMS ) \n"
+ "SELECT cast(? as VARCHAR (30)) || 'RD' || VALUE( TO_CHAR(INT(SUBSTR(MAX(RmtSevrJobDirID),12,3)) + 1, '000'), '001'), \n"
+ " cast(? as VARCHAR (100)) , cast(? as VARCHAR (30)) , cast(? as CHARACTER (5)) , cast(? as CHARACTER (4)) , \n"
+ " cast(? as VARCHAR (10)) , cast(? as CHARACTER (1)) , cast(? as VARCHAR (40)) , cast(? as CHARACTER (16)) , \n"
+ " cast(? as VARCHAR (40)) , cast(? as CHARACTER (16)) \n"
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBU02 \n"
+ "WHERE RmtSevrID = ?";
//REMOTE 서버 작업디렉토리 변경
public static final String UPDATE_REMOTE_DIRECTORY =
"UPDATE " + Keys.TABLE_OWNER + "TSEAIBU02 \n"
+ "SET RmtSevrID = ?, \n"
+ " RmtSevrJobDirName = ?, \n"
+ " OsidInstiDstcd = ?, \n"
+ " TranGroupDsticID = ?, \n"
+ " ThisMsgUseYn = ?, \n"
+ " ThisMsgAmndrID = ?, \n"
+ " ThisMsgAmndHMS = ? \n"
+ "WHERE RmtSevrJobDirID = ?";
//REMOTE 서버 작업디렉토리 삭제
public static final String DELETE_REMOTE_DIRECTORY =
"DELETE FROM " + Keys.TABLE_OWNER + "TSEAIBU02 \n"
+ "WHERE RmtSevrJobDirID = ?";
}
@@ -0,0 +1,61 @@
package com.eactive.eai.inbound.remote;
import java.io.Serializable;
public class RemoteDirectoryVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String remoteDirId = ""; //리모트서버 작업디렉토리 ID
private String remoteDirName = ""; //리모트서버 작업디렉토리 명
private String remoteServerId = ""; //리모트서버 ID
private String processCode = ""; //업무구분코드
private String processName = ""; //업무구분명
private String organCode = ""; //대외기관코드
private String organName = ""; //대외기관명
private String bizGroupCode = ""; //거래구분그룹코드
private String bizGroupName = ""; //거래구분그룹명
private String useYn = ""; //사용여부
private String createId = ""; //등록자ID
private String createTime = ""; //등록시간
private String updateId = ""; //수정자ID
private String updateTime = ""; //수정시간
private RemoteServerVO remoteServerVO;
public void setRemoteDirId (String arg) { remoteDirId = arg; }
public void setRemoteDirName (String arg) { remoteDirName = arg; }
public void setRemoteServerId(String arg) { remoteServerId = arg; }
public void setProcessCode (String arg) { processCode = arg; }
public void setProcessName (String arg) { processName = arg; }
public void setOrganCode (String arg) { organCode = arg; }
public void setOrganName (String arg) { organName = arg; }
public void setBizGroupCode (String arg) { bizGroupCode = arg; }
public void setBizGroupName (String arg) { bizGroupName = arg; }
public void setUseYn (String arg) { useYn = arg; }
public void setCreateId (String arg) { createId = arg; }
public void setCreateTime (String arg) { createTime = arg; }
public void setUpdateId (String arg) { updateId = arg; }
public void setUpdateTime (String arg) { updateTime = arg; }
public void setRemoteServerVO (RemoteServerVO arg) { remoteServerVO = arg; }
public String getRemoteDirId () { return remoteDirId ; }
public String getRemoteDirName () { return remoteDirName ; }
public String getRemoteServerId() { return remoteServerId; }
public String getProcessCode () { return processCode ; }
public String getProcessName () { return processName ; }
public String getOrganCode () { return organCode ; }
public String getOrganName () { return organName ; }
public String getBizGroupCode () { return bizGroupCode ; }
public String getBizGroupName () { return bizGroupName ; }
public String getUseYn () { return useYn ; }
public String getCreateId () { return createId ; }
public String getCreateTime () { return createTime ; }
public String getUpdateId () { return updateId ; }
public String getUpdateTime () { return updateTime ; }
public RemoteServerVO getRemoteServerVO () { return remoteServerVO ; }
}
@@ -0,0 +1,282 @@
package com.eactive.eai.inbound.remote;
import java.sql.ResultSet;
import java.util.ArrayList;
import org.slf4j.LoggerFactory;
import com.eactive.eai.batch.common.StringUtil;
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.Logger;
public class RemoteServerDAO extends BaseDAO implements RemoteServerQuery
{
public RemoteServerDAO() {
super();
super.logger = Logger.getLogger(Logger.LOGGER_FILEEVENT);
}
//-------------------------------------------------------------------------------------------
// EAI <-> REMOTE 파일 자동 전송시 업무구분에 의한 Remote 서버정보 조회
//-------------------------------------------------------------------------------------------
public RemoteServerVO getRemoteServerByPath(String remotePath) throws DAOException {
ResultSet rs = null;
// int index = 0;
String bjobBzwkDstcd= null;
try {
String query = SELECT_REMOTE_SERVER_BY_PATH;
this.connect(query);
// logger.debug(">>> 업무구분에 의한 리모트 서버 조회 SQL : \n"+ query);
// index = 1;
//this.preparedStatement.setString(index++, remotePath); logger.debug(">>> 바인드("+(index-1)+") : ["+ remotePath +"]");
rs = executeQuery();
RemoteServerVO info = null;
while (rs.next()) {
bjobBzwkDstcd = StringUtil.nvlTrim(rs.getString("BjobBzwkDstcd" ));
if (remotePath.indexOf(bjobBzwkDstcd) == -1 )
continue;
info = new RemoteServerVO();
info.setRemoteServerId (StringUtil.nvlTrim(rs.getString("RmtSevrID" ))); // 리모트서버 ID (PK)
info.setRemoteServerName(StringUtil.nvlTrim(rs.getString("RmtSevrName"))); // 리모트서버 명
info.setProcessCode (StringUtil.nvlTrim(rs.getString("BjobBzwkDstcd" ))); // 업무구분코드 (FK)
info.setRemoteServerIP (StringUtil.nvlTrim(rs.getString("RmtSevrIP" ))); // 리모트서버 IP
info.setRemoteNdmPort (StringUtil.nvlTrim(rs.getString("RmtSevrNDMPortNoName" ))); // 리모트서버 NDM Port Number
info.setRemoteFtpPort (StringUtil.nvlTrim(rs.getString("RmtSevrFTPPortNoName" ))); // 리모트서버 FTP Port Number
info.setRemoteUserId (StringUtil.nvlTrim(rs.getString("RmtSevrFTPUID" ))); // 리모트서버 FTP User ID
info.setRemotePassword (StringUtil.nvl (rs.getString("RmtSevrFTPUserPwdName" ))); // 리모트서버 FTP User Password
info.setRemoteRootDir (StringUtil.nvlTrim(rs.getString("RmtSevrRootDirName" ))); // 리모트서버 Root Directory
info.setAutoTransferType(StringUtil.nvlTrim(rs.getString("RmtFileEvntCpyDstcd"))); // 리포트 파일 이벤트시 파일 복사 방법
info.setUseYn (StringUtil.nvlTrim(rs.getString("ThisMsgUseYn" ))); // 사용여부
info.setCreateId (StringUtil.nvlTrim(rs.getString("ThisMsgRegsntID" ))); // 등록자ID
info.setCreateTime (StringUtil.nvlTrim(rs.getString("ThisMsgRegiHMS" ))); // 등록시간
info.setUpdateId (StringUtil.nvlTrim(rs.getString("ThisMsgAmndrID" ))); // 수정자ID
info.setUpdateTime (StringUtil.nvlTrim(rs.getString("ThisMsgAmndHMS" ))); // 수정시간
//리모트 Root Directory 가 "/" 로 끝나면 "/" 제거
if (info.getRemoteRootDir().endsWith("/")) {
info.setRemoteRootDir(info.getRemoteRootDir().substring(0, info.getRemoteRootDir().length()-1));
}
}
//logger.info(">>> 업무구분에 의한 리모트 서버 조회 RemoteServerVO : "+ info);
return info;
} catch (DAOException ex) {
throw ex;
} catch (Exception e) {
String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
throw new DAOException(errMsg); //<--------------
} finally {
disconnect();
}
}
//-------------------------------------------------------------------------------------------
// REMOTE 서버정보 목록 검색 및 상세조회
//-------------------------------------------------------------------------------------------
public ArrayList<RemoteServerVO> selectRemoteServer(String searchProcessCode, String searchType, String searchText) throws DAOException {
ResultSet rs = null;
int index = 0;
try {
String query = SEARCH_REMOTE_SERVER;
if("SERVER_NAME".equals(searchType)) {
query = query + " AND A.\"RmtSevrName\" LIKE '%" + searchText + "%'\n ORDER BY A.\"RmtSevrID\" ";
}
else if("SERVER_ID".equals(searchType)) {
query = query + " AND A.\"RmtSevrID\" LIKE '" + searchText + "%'\n ORDER BY A.\"RmtSevrID\" ";
}
else if("SERVER_IP".equals(searchType)) {
query = query + " AND A.\"RmtSevrIP\" LIKE '%" + searchText + "%'\n ORDER BY A.\"RmtSevrID\" ";
}
else {
query = query + " ORDER BY A.\"RmtSevrID\" ";
}
this.connect(query);
logger.debug(">>> 리모트 서버 검색 SQL : \n"+ query);
index = 1;
this.preparedStatement.setString(index++, searchProcessCode); logger.debug(">>> 바인드("+(index-1)+") : ["+ searchProcessCode +"]");
rs = executeQuery();
ArrayList<RemoteServerVO> alist = new ArrayList<RemoteServerVO>();
while (rs.next()) {
RemoteServerVO info = new RemoteServerVO();
info.setRemoteServerId (StringUtil.nvlTrim(rs.getString("RmtSevrID" ))); // 리모트서버 ID (PK)
info.setRemoteServerName(StringUtil.nvlTrim(rs.getString("RmtSevrName" ))); // 리모트서버 명
info.setProcessCode (StringUtil.nvlTrim(rs.getString("BjobBzwkDstcd" ))); // 업무구분코드 (FK)
info.setProcessName (StringUtil.nvlTrim(rs.getString("BjobBzwkName" ))); // 업무구분명
info.setRemoteServerIP (StringUtil.nvlTrim(rs.getString("RmtSevrIP" ))); // 리모트서버 IP
info.setRemoteNdmPort (StringUtil.nvlTrim(rs.getString("RmtSevrNDMPortNoName" ))); // 리모트서버 NDM Port Number
info.setRemoteFtpPort (StringUtil.nvlTrim(rs.getString("RmtSevrFTPPortNoName" ))); // 리모트서버 FTP Port Number
info.setRemoteUserId (StringUtil.nvlTrim(rs.getString("RmtSevrFTPUID" ))); // 리모트서버 FTP User ID
info.setRemotePassword (StringUtil.nvl (rs.getString("RmtSevrFTPUserPwdName"))); // 리모트서버 FTP User Password
info.setRemoteRootDir (StringUtil.nvlTrim(rs.getString("RmtSevrRootDirName" ))); // 리모트서버 Root Directory
info.setAutoTransferType(StringUtil.nvlTrim(rs.getString("RmtFileEvntCpyDstcd" ))); // 리포트 파일 이벤트시 파일 복사 방법
info.setUseYn (StringUtil.nvlTrim(rs.getString("ThisMsgUseYn" ))); // 사용여부
info.setCreateId (StringUtil.nvlTrim(rs.getString("ThisMsgRegsntID" ))); // 등록자ID
info.setCreateTime (StringUtil.nvlTrim(rs.getString("ThisMsgRegiHMS" ))); // 등록시간
info.setUpdateId (StringUtil.nvlTrim(rs.getString("ThisMsgAmndrID" ))); // 수정자ID
info.setUpdateTime (StringUtil.nvlTrim(rs.getString("ThisMsgAmndHMS" ))); // 수정시간
//리모트 Root Directory 가 "/" 로 끝나면 "/" 제거
if (info.getRemoteRootDir().endsWith("/")) {
info.setRemoteRootDir(info.getRemoteRootDir().substring(0, info.getRemoteRootDir().length()-1));
}
alist.add(info);
}
logger.info(">>> 리모트 서버 검색 건수 : "+ alist.size());
return alist;
} catch (DAOException ex) {
throw ex;
} catch (Exception e) {
String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
throw new DAOException(errMsg); //<--------------
} finally {
disconnect();
}
}
//-------------------------------------------------------------------------------------------
// REMOTE 서버정보 신규
//-------------------------------------------------------------------------------------------
public int insertRemoteServer(RemoteServerVO remoteServerVO) throws DAOException {
int retValue = 0;
int index = 0;
try {
String query = INSERT_REMOTE_SERVER;
this.connect(query);
logger.debug(">>> 리모트 서버 등록 SQL : \n"+ query);
index = 1;
this.preparedStatement.setString(index++, remoteServerVO.getProcessCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getProcessCode () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteServerName()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteServerName() +"]");
this.preparedStatement.setString(index++, remoteServerVO.getProcessCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getProcessCode () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteServerIP ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteServerIP () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteNdmPort ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteNdmPort () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteFtpPort ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteFtpPort () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteUserId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteUserId () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemotePassword ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemotePassword () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteRootDir ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteRootDir () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getAutoTransferType()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getAutoTransferType() +"]");
this.preparedStatement.setString(index++, remoteServerVO.getUseYn ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getUseYn () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getCreateId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getCreateId () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getCreateTime ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getCreateTime () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getUpdateId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getUpdateId () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getUpdateTime ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getUpdateTime () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getProcessCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getProcessCode () +"]");
retValue = this.executeUpdate();
logger.info(">>> 리모트 서버 등록 건수 : "+ retValue);
return retValue;
} catch (DAOException ex) {
throw ex;
} catch (Exception e) {
String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
throw new DAOException(errMsg); //<--------------
} finally {
disconnect();
}
}
//-------------------------------------------------------------------------------------------
// REMOTE 서버정보 변경
//-------------------------------------------------------------------------------------------
public int updatetRemoteServer(RemoteServerVO remoteServerVO) throws DAOException {
int retValue = 0;
int index = 0;
try {
String query = UPDATE_REMOTE_SERVER;
this.connect(query);
logger.debug(">>> 리모트 서버 변경 SQL : \n"+ query);
index = 1;
this.preparedStatement.setString(index++, remoteServerVO.getRemoteServerName()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteServerName() +"]");
this.preparedStatement.setString(index++, remoteServerVO.getProcessCode ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getProcessCode () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteServerIP ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteServerIP () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteNdmPort ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteNdmPort () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteFtpPort ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteFtpPort () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteUserId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteUserId () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemotePassword ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemotePassword () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteRootDir ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteRootDir () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getAutoTransferType()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getAutoTransferType() +"]");
this.preparedStatement.setString(index++, remoteServerVO.getUseYn ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getUseYn () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getUpdateId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getUpdateId () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getUpdateTime ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getUpdateTime () +"]");
this.preparedStatement.setString(index++, remoteServerVO.getRemoteServerId ()); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerVO.getRemoteServerId () +"]");
retValue = this.executeUpdate();
logger.info(">>> 리모트 서버 수정 건수 : "+ retValue);
return retValue;
} catch (DAOException ex) {
throw ex;
} catch (Exception e) {
String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
throw new DAOException(errMsg); //<--------------
} finally {
disconnect();
}
}
//-------------------------------------------------------------------------------------------
// REMOTE 서버정보 삭제
//-------------------------------------------------------------------------------------------
public int deleteRemoteServer(String remoteServerId) throws DAOException {
int retValue = 0;
int index = 0;
try {
String query = DELETE_REMOTE_SERVER;
this.connect(query);
logger.debug(">>> 리모트 서버 삭제 SQL : \n"+ query);
index = 1;
this.preparedStatement.setString(index++, remoteServerId); logger.debug(">>> 바인드("+(index-1)+") : ["+ remoteServerId +"]");
retValue = this.executeUpdate();
logger.info(">>> 리모트 서버 삭제 건수 : "+ retValue);
return retValue;
} catch (DAOException ex) {
throw ex;
} catch (Exception e) {
String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
throw new DAOException(errMsg); //<--------------
} finally {
disconnect();
}
}
}
@@ -0,0 +1,54 @@
package com.eactive.eai.inbound.remote;
import com.eactive.eai.common.dao.DAOFactory;
import java.util.ArrayList;
public class RemoteServerManager
{
//singleton 객체 생성
private static RemoteServerManager instance = new RemoteServerManager();
//singleton 객체 리턴
public static RemoteServerManager getInstance() {
return instance;
}
//생성자 (다른 클래스에서 new 불가)
private RemoteServerManager() {}
public RemoteServerVO getRemoteServerByPath(String remotePath) throws Exception {
RemoteServerDAO dao = (RemoteServerDAO)DAOFactory.newInstance().create(RemoteServerDAO.class);
return dao.getRemoteServerByPath(remotePath);
}
public RemoteServerVO detailRemoteServer(String remoteServerId) throws Exception {
RemoteServerDAO dao = (RemoteServerDAO)DAOFactory.newInstance().create(RemoteServerDAO.class);
ArrayList<RemoteServerVO> alist = dao.selectRemoteServer("", "SERVER_ID", remoteServerId);
if (alist.size() == 0) return null;
return alist.get(0);
}
public ArrayList<RemoteServerVO> searchRemoteServer(String searchProcessCode, String searchType, String searchText) throws Exception {
RemoteServerDAO dao = (RemoteServerDAO)DAOFactory.newInstance().create(RemoteServerDAO.class);
return dao.selectRemoteServer(searchProcessCode, searchType, searchText);
}
public int insertRemoteServer(RemoteServerVO remoteServerVO) throws Exception {
RemoteServerDAO dao = (RemoteServerDAO)DAOFactory.newInstance().create(RemoteServerDAO.class);
return dao.insertRemoteServer(remoteServerVO);
}
public int updatetRemoteServer(RemoteServerVO remoteServerVO) throws Exception {
RemoteServerDAO dao = (RemoteServerDAO)DAOFactory.newInstance().create(RemoteServerDAO.class);
return dao.updatetRemoteServer(remoteServerVO);
}
public int deletetRemoteServer(String remoteServerId) throws Exception {
RemoteServerDAO dao = (RemoteServerDAO)DAOFactory.newInstance().create(RemoteServerDAO.class);
return dao.deleteRemoteServer(remoteServerId);
}
}
@@ -0,0 +1,101 @@
package com.eactive.eai.inbound.remote;
import com.eactive.eai.common.dao.Keys;
public interface RemoteServerQuery
{
//EAI <-> REMOTE 파일 자동 전송시 업무구분에 의한 Remote 서버정보 조회
public static final String SELECT_REMOTE_SERVER_BY_PATH =
"SELECT RmtSevrID , \n"
+ " RmtSevrName , \n"
+ " BjobBzwkDstcd , \n"
+ " RmtSevrIP , \n"
+ " RmtSevrNDMPortNoName , \n"
+ " RmtSevrFTPPortNoName , \n"
+ " RmtSevrFTPUID , \n"
+ " RmtSevrFTPUserPwdName , \n"
+ " RmtSevrRootDirName , \n"
+ " RmtFileEvntCpyDstcd , \n"
+ " ThisMsgUseYn , \n"
+ " ThisMsgRegsntID , \n"
+ " ThisMsgRegiHMS , \n"
+ " ThisMsgAmndrID , \n"
+ " ThisMsgAmndHMS \n"
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBU01 \n"
//+ "WHERE ? LIKE RmtSevrRootDirName || '%' \n"
// + "WHERE ? LIKE '%' || BjobBzwkDstcd || '%' \n"
// + "AND ThisMsgUseYn = '1' --사용중인 것만 조회";
+ "WHERE ThisMsgUseYn = '1' --사용중인 것만 조회";
//REMOTE 서버 목록 조회
public static final String SEARCH_REMOTE_SERVER =
"SELECT A.RmtSevrID , \n"
+ " A.RmtSevrName , \n"
+ " A.BjobBzwkDstcd , \n"
+ " B.BjobBzwkName , \n"
+ " A.RmtSevrIP , \n"
+ " A.RmtSevrNDMPortNoName , \n"
+ " A.RmtSevrFTPPortNoName , \n"
+ " A.RmtSevrFTPUID , \n"
+ " A.RmtSevrFTPUserPwdName , \n"
+ " A.RmtSevrRootDirName , \n"
+ " A.RmtFileEvntCpyDstcd , \n"
+ " A.ThisMsgUseYn , \n"
+ " A.ThisMsgRegsntID , \n"
+ " A.ThisMsgRegiHMS , \n"
+ " A.ThisMsgAmndrID , \n"
+ " A.ThisMsgAmndHMS \n"
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBU01 A \n"
// + " " + Keys.TABLE_OWNER + "TSEAIBJ02 B \n"
+ " LEFT OUTER JOIN " + Keys.TABLE_OWNER + "TSEAIBJ02 B \n"
// + "WHERE A.BjobBzwkDstcd = B.BjobBzwkDstcd (+) \n"
+ "on A.BjobBzwkDstcd = B.BjobBzwkDstcd \n"
// + "AND A.BjobBzwkDstcd LIKE ? || '%' \n"
+ "WHERE A.BjobBzwkDstcd LIKE ? || '%' \n";
//+ " AND ( ( ? = 'SERVER_NAME' AND A.RmtSevrName LIKE '%' || ? || '%' ) OR \n"
//+ " ( ? = 'SERVER_ID' AND A.RmtSevrID LIKE ? || '%' ) OR \n"
//+ " ( ? = 'SERVER_IP' AND A.RmtSevrIP LIKE '%' || ? || '%' ) ) \n"
//+ "ORDER BY A.RmtSevrID ";
//REMOTE 서버 등록
public static final String INSERT_REMOTE_SERVER =
"INSERT INTO " + Keys.TABLE_OWNER + "TSEAIBU01 ( \n"
+ " RmtSevrID , \n"
+ " RmtSevrName , BjobBzwkDstcd , RmtSevrIP , RmtSevrNDMPortNoName , \n"
+ " RmtSevrFTPPortNoName , RmtSevrFTPUID , RmtSevrFTPUserPwdName , RmtSevrRootDirName , \n"
+ " RmtFileEvntCpyDstcd , ThisMsgUseYn , ThisMsgRegsntID , ThisMsgRegiHMS , \n"
+ " ThisMsgAmndrID , ThisMsgAmndHMS ) \n"
// + "SELECT ? || 'RS' || NVL( TO_CHAR( SUBSTR(MAX(RmtSevrID),8,2) + 1, 'FM00'), '01'), \n"
// + "SELECT ? || 'RS' || VALUE( TO_CHAR(INT(SUBSTR(MAX(RmtSevrID),8,2)) + 1, '00'), '01'), \n"
+ "SELECT cast(? as CHARACTER (5)) || 'RS' || VALUE( TO_CHAR(INT(SUBSTR(MAX(RmtSevrID),8,2)) + 1, '00'), '01'), \n"
+ " cast (? as VARCHAR(100)) , cast(? as CHARACTER (5)) , cast (? as VARCHAR(15)) , \n"
+ " cast (? as VARCHAR(10)) , cast (? as VARCHAR(10)) , cast (? as VARCHAR(40)) , cast (? as VARCHAR(40)) , \n"
+ " cast (? as VARCHAR(300)) , cast (? as CHARACTER(3)) , cast (? as CHARACTER(1)) , \n"
+ " cast (? as VARCHAR(40)) , cast (? as CHARACTER(16)) , cast (? as VARCHAR(40)) ,\n"
+ " cast (? as CHARACTER(16)) \n"
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBU01 \n"
+ "WHERE BjobBzwkDstcd = ?";
//REMOTE 서버 변경
public static final String UPDATE_REMOTE_SERVER =
"UPDATE " + Keys.TABLE_OWNER + "TSEAIBU01 \n"
+ "SET RmtSevrName = ?, \n"
+ " BjobBzwkDstcd = ?, \n"
+ " RmtSevrIP = ?, \n"
+ " RmtSevrNDMPortNoName = ?, \n"
+ " RmtSevrFTPPortNoName = ?, \n"
+ " RmtSevrFTPUID = ?, \n"
+ " RmtSevrFTPUserPwdName = ?, \n"
+ " RmtSevrRootDirName = ?, \n"
+ " RmtFileEvntCpyDstcd = ?, \n"
+ " ThisMsgUseYn = ?, \n"
+ " ThisMsgAmndrID = ?, \n"
+ " ThisMsgAmndHMS = ? \n"
+ "WHERE RmtSevrID = ?";
//REMOTE 서버 삭제
public static final String DELETE_REMOTE_SERVER =
"DELETE FROM " + Keys.TABLE_OWNER + "TSEAIBU01 \n"
+ "WHERE RmtSevrID = ?";
}
@@ -0,0 +1,67 @@
package com.eactive.eai.inbound.remote;
import java.io.Serializable;
public class RemoteServerVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String remoteServerId = ""; //리모트서버 ID
private String remoteServerName = ""; //리모트서버 명
private String processCode = ""; //업무구분코드
private String processName = ""; //업무구분명
private String remoteServerIP = ""; //리모트서버 IP
private String remoteNdmPort = ""; //리모트서버 NDM Port Number
private String remoteFtpPort = ""; //리모트서버 FTP Port Number
private String remoteUserId = ""; //리모트서버 FTP User ID
private String remotePassword = ""; //리모트서버 FTP User Password
private String remoteRootDir = ""; //리모트서버 Root Directory
private String autoTransferType = ""; //리포트 파일 이벤트시 파일 복사 방법
private String useYn = ""; //사용여부
private String createId = ""; //등록자ID
private String createTime = ""; //등록시간
private String udpateId = ""; //수정자ID
private String updateTime = ""; //수정시간
private String remoteNodeName = ""; //리모트서버 노드 명
public void setRemoteServerId (String arg) { remoteServerId = arg; }
public void setRemoteServerName(String arg) { remoteServerName = arg; }
public void setProcessCode (String arg) { processCode = arg; }
public void setProcessName (String arg) { processName = arg; }
public void setRemoteServerIP (String arg) { remoteServerIP = arg; }
public void setRemoteNdmPort (String arg) { remoteNdmPort = arg; }
public void setRemoteFtpPort (String arg) { remoteFtpPort = arg; }
public void setRemoteUserId (String arg) { remoteUserId = arg; }
public void setRemotePassword (String arg) { remotePassword = arg; }
public void setRemoteRootDir (String arg) { remoteRootDir = arg; }
public void setAutoTransferType(String arg) { autoTransferType = arg; }
public void setUseYn (String arg) { useYn = arg; }
public void setCreateId (String arg) { createId = arg; }
public void setCreateTime (String arg) { createTime = arg; }
public void setUpdateId (String arg) { udpateId = arg; }
public void setUpdateTime (String arg) { updateTime = arg; }
public void setRemoteNodeName (String arg) { remoteNodeName = arg; }
public String getRemoteServerId () { return remoteServerId ; }
public String getRemoteServerName() { return remoteServerName ; }
public String getProcessCode () { return processCode ; }
public String getProcessName () { return processName ; }
public String getRemoteServerIP () { return remoteServerIP ; }
public String getRemoteNdmPort () { return remoteNdmPort ; }
public String getRemoteFtpPort () { return remoteFtpPort ; }
public String getRemoteUserId () { return remoteUserId ; }
public String getRemotePassword () { return remotePassword ; }
public String getRemoteRootDir () { return remoteRootDir ; }
public String getAutoTransferType() { return autoTransferType ; }
public String getUseYn () { return useYn ; }
public String getCreateId () { return createId ; }
public String getCreateTime () { return createTime ; }
public String getUpdateId () { return udpateId ; }
public String getUpdateTime () { return updateTime ; }
public String getRemoteNodeName () { return remoteNodeName ; }
}
@@ -0,0 +1,316 @@
package com.eactive.eai.inbound.remote;
import java.io.File;
import java.util.Properties;
import com.eactive.eai.adapter.ftp.Transfer;
import com.eactive.eai.batch.common.BatchDirUtil;
import com.eactive.eai.batch.common.EzgatorUtil;
import com.eactive.eai.batch.ftp.FTPUtil;
import com.eactive.eai.batch.osd.OutsideManager;
import com.eactive.eai.batch.osd.OutsideVO;
import com.eactive.eai.batch.rule.dirInfo.BatchJobInfoVO;
import com.eactive.eai.batch.rule.dirInfo.DirInfoManager;
import com.eactive.eai.batch.rule.sysInfo.SysInfoManager;
import com.eactive.eai.batch.rule.sysInfo.SysInfoVO;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.property.PropManager;
import com.eactive.eai.common.util.DatetimeUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.UCMsgSenderUtil;
import com.eactive.eai.common.util.UUIDGenerator;
public class RemoteTransfer {
// FileLoger
static Logger logger = Logger.getLogger(Logger.LOGGER_FILEEVENT);
private String CBS_DIR_INFO = "CBSDirInfo";
private String DEFAULT_SYS_CODE = "default.sys";
private String DEFAULT_APP_CODE = "default.app";
private String SEND_ROOT = "send.root";
private RemoteTransferLogVO loginfo;
public String sendFile(String procCode, String instCode, String fileName, String startPtrnDstcd, String userId, boolean cbsYn){
BatchJobInfoVO bjvo = null;
try {
loginfo = new RemoteTransferLogVO();
loginfo.setFileTrsmtLogID(UUIDGenerator.getUUID());
loginfo.setSendRecvYn(RemoteTransferLogKeys.SEND);
loginfo.setFileTrsmtStartPtrnDstcd(startPtrnDstcd);
loginfo.setThisMsgRegsntID(userId);
loginfo.setBjobBzwkDstcd(procCode);
loginfo.setOsidInstiDstcd(instCode);
String srcFilePath = BatchDirUtil.getResponseArchDir()
+ File.separatorChar
+ procCode
+ File.separatorChar
+ instCode;
loginfo.setFileTrsmtPathName(srcFilePath);
loginfo.setTrsmtFileName(fileName);
String srcFileName = srcFilePath + File.separatorChar + fileName;
File file = new File(srcFileName);
if ( !file.exists() ){
String msg = "E:수신 파일이 존재 하지 않습니다. + [" + srcFileName + "]";
logger.error(msg);
return msg;
}
loginfo.setFileTrsmtSize(file.length());
//거래구분 코드 설정
int bizCodeStartIndex = 0;
int bizCodeEndIndex = 0;
OutsideVO organInfo = OutsideManager.getInstance().getOutsideInfo(procCode, instCode);
bizCodeStartIndex = organInfo.getBizCdStartIdx();
bizCodeEndIndex = organInfo.getBizCdEndIdx();
if (bizCodeStartIndex <= 0 || bizCodeStartIndex >= fileName.length()) bizCodeStartIndex = 0;
if (bizCodeEndIndex == 0 || bizCodeEndIndex > fileName.length()) bizCodeEndIndex = fileName.length();
if (bizCodeEndIndex < 0 && 0 < fileName.length() + bizCodeEndIndex ) bizCodeEndIndex = fileName.length() + bizCodeEndIndex;
// 거래 구분 코드 길이가 가변인 경우( END INDEX가 0인 경우)
if ( organInfo.getBizCdEndIdx() == 0 ){
String delStr = null;
try {
Properties orgInfo = PropManager.getInstance().getProperties(
"TelegramInfo{" + procCode + "_" + instCode + "}");
delStr = orgInfo.getProperty( "del.string" );
if ( delStr != null && !delStr.trim().equals("")){
int delIndex = fileName.indexOf(delStr);
if ( delIndex > -1 ) {
bizCodeEndIndex = delIndex;
}
}
}catch( Exception e) {}
}
String bizCode = fileName.substring(bizCodeStartIndex, bizCodeEndIndex);
loginfo.setBjobMsgDstcd(bizCode);
bjvo = DirInfoManager.getInstance().getFileInfoByDstcd(procCode, bizCode);
String sysCd = PropManager.getInstance().getProperty(CBS_DIR_INFO, DEFAULT_SYS_CODE);
String applCd = PropManager.getInstance().getProperty(CBS_DIR_INFO, DEFAULT_APP_CODE);
String tarSysCode = "";
String tarAppCode = "";
if ( sysCd != null && !sysCd.equals(""))
tarSysCode = sysCd;
if ( applCd != null && !applCd.equals(""))
tarAppCode = applCd;
if ( bjvo != null ){
if ( bjvo.getSysCd()!= null && !bjvo.getSysCd().trim().equals(""))
tarSysCode = bjvo.getSysCd();
if ( bjvo.getUapplCd()!= null && !bjvo.getUapplCd().trim().equals(""))
tarAppCode = bjvo.getUapplCd().toLowerCase();
}
if ( cbsYn ){
tarSysCode = sysCd;
}else{
if ( tarSysCode.equals(sysCd) ){
return "";
}
}
// 계정계로 보내는 경우 시스템코드가 null 이 아니고 업무코드가 null 이면 보내지 않는다.
if ( cbsYn && bjvo != null && bjvo.getSysCd()!= null && !bjvo.getSysCd().trim().equals("") &&
( bjvo.getUapplCd() == null || bjvo.getUapplCd().trim().equals("")) ){
return "";
}
SysInfoVO vo = SysInfoManager.getInstance().getSysInfo(tarSysCode);
if ( vo == null ){
return "E:미등록 시스템 구분 코드입니다.";
}
String rmtFileTrsmtPathName = vo.getRecvDir().replaceAll("#APP#", tarAppCode);
String rmtTrsmtFileName = procCode + "_" + instCode + "_" + fileName;
loginfo.setRmtFileTrsmtPathName(rmtFileTrsmtPathName);
loginfo.setRmtTrsmtFileName(rmtTrsmtFileName);
loginfo.setThisStgePrcssRsultCd(RemoteTransferLogKeys.STATUS_START);
loginfo.setFileTrsmtStartHMS(DatetimeUtil.getCurrentTimeMillis());
try {
RemoteTransferLogManager.getInstance().insertRemoteTransferLog(loginfo);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
try {
EzgatorUtil.rename(vo.getSysIp(), vo.getSysPort(), rmtFileTrsmtPathName + "/" + rmtTrsmtFileName, rmtFileTrsmtPathName + "/" + rmtTrsmtFileName +"_"+DatetimeUtil.getCurrentTimeMillis());
} catch (Exception e) {
}
EzgatorUtil.store(vo.getSysIp(), vo.getSysPort(), rmtFileTrsmtPathName + "/" + rmtTrsmtFileName, srcFileName);
File chkFile = new File(srcFileName+BatchDirUtil.getResponseRootExt());
chkFile.createNewFile();
EzgatorUtil.store(vo.getSysIp(), vo.getSysPort(), rmtFileTrsmtPathName + "/" + rmtTrsmtFileName+BatchDirUtil.getResponseRootExt(), srcFileName+BatchDirUtil.getResponseRootExt());
try {
loginfo.setThisStgePrcssRsultCd(RemoteTransferLogKeys.STATUS_SUCCESS);
loginfo.setFileTrsmtEndHMS(DatetimeUtil.getCurrentTimeMillis());
RemoteTransferLogManager.getInstance().updateRemoteTransferLog(loginfo);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} catch (Throwable t) {
logger.error(t.getMessage(), t);
try {
// 파일로그 처리
String errMsg = ExceptionUtil.getErrorCode(t, "BECEAIIFE005");
logger.error(errMsg, t); //Local 수신 File Event Listener 에서 오류가 발생하였습니다.
UCMsgSenderUtil.setUcMsg(bjvo, procCode + "_" + instCode + "_" + fileName , false, t.getMessage());
loginfo.setThisStgePrcssRsultCd(RemoteTransferLogKeys.STATUS_ERROR);
loginfo.setFileTrsmtEndHMS(DatetimeUtil.getCurrentTimeMillis());
StringBuffer sb = new StringBuffer();
sb.append(t.getMessage()+"\n");
sb.append(t.getClass().getCanonicalName()+"\n");
StackTraceElement[] ste = t.getStackTrace();
for (int inx = 0; inx < ste.length; inx++) {
sb.append("\tat "+ ste[inx].getClassName() +"(" +ste[inx].getFileName()).append(":"+ ste[inx].getLineNumber() +")\n");
}
loginfo.setObstclOccurCausCtnt(new String(sb));
RemoteTransferLogManager.getInstance().updateRemoteTransferLog(loginfo);
} catch (Throwable e) {
logger.error("[Req Recv File Event] ★★★★★ 수신 File Event Listner 예외 처리 중 에러 !! ★★★★★", e);
}
}
return "S:송신 성공[" + fileName + "]";
}
public String recvFile( String fullFileName, String startPtrnDstcd, String userId ) {
BatchJobInfoVO bjvo = null;
try {
loginfo = new RemoteTransferLogVO();
loginfo.setFileTrsmtLogID(UUIDGenerator.getUUID());
loginfo.setSendRecvYn(RemoteTransferLogKeys.RECV);
loginfo.setFileTrsmtStartPtrnDstcd(startPtrnDstcd);
loginfo.setThisMsgRegsntID(userId);
String fileName = fullFileName;
String filePath = "/";
int index = fullFileName.lastIndexOf("/");
if ( index > -1 ){
fileName = fullFileName.substring(index + 1);
filePath = fullFileName.substring(0,index);
}
loginfo.setTrsmtFileName(fileName);
if ( fileName.length() < 11 ){
return "E:파일명 길이가 충분하지 않습니다. 받은 파일명:[" + fileName + "], 파일명:[업무구분(5)_기관구분(4)_기관파일명]" ;
}
String procCode = fileName.substring(0,5);
String instCode = fileName.substring(6, 10);
loginfo.setBjobBzwkDstcd(procCode);
loginfo.setOsidInstiDstcd(instCode);
String localFileName = fileName.substring(11);
//거래구분 코드 설정
int bizCodeStartIndex = 0;
int bizCodeEndIndex = 0;
OutsideVO organInfo = OutsideManager.getInstance().getOutsideInfo(procCode, instCode);
if ( organInfo == null ){
return "E:미등록 업무/기관 코드입니다. 업무구분[" + procCode + "]기관코드[" + instCode + "]" ;
}
bizCodeStartIndex = organInfo.getBizCdStartIdx();
bizCodeEndIndex = organInfo.getBizCdEndIdx();
if (bizCodeStartIndex <= 0 || bizCodeStartIndex >= localFileName.length()) bizCodeStartIndex = 0;
if (bizCodeEndIndex <= 0 || bizCodeEndIndex > localFileName.length()) bizCodeEndIndex = localFileName.length();
String bizCode = localFileName.substring(bizCodeStartIndex, bizCodeEndIndex);
loginfo.setBjobMsgDstcd(bizCode);
bjvo = DirInfoManager.getInstance().getFileInfoByDstcd(procCode, bizCode);
String sysCd = PropManager.getInstance().getProperty(CBS_DIR_INFO, DEFAULT_SYS_CODE);
String tarSysCode = "";
if ( sysCd != null && !sysCd.equals(""))
tarSysCode = sysCd;
if ( bjvo != null ){
if ( bjvo.getSysCd()!= null && !bjvo.getSysCd().trim().equals(""))
tarSysCode = bjvo.getSysCd();
}else{
return "E:미등록 업무 구분(파일) 코드입니다.";
}
SysInfoVO vo = SysInfoManager.getInstance().getSysInfo(tarSysCode);
if ( vo == null ){
return "E:미등록 시스템 구분 코드입니다.";
}
String sendRootDir= PropManager.getInstance().getProperty(CBS_DIR_INFO, SEND_ROOT);
loginfo.setFileTrsmtPathName(sendRootDir);
loginfo.setRmtFileTrsmtPathName(filePath);
loginfo.setRmtTrsmtFileName(localFileName);
loginfo.setThisStgePrcssRsultCd(RemoteTransferLogKeys.STATUS_START);
loginfo.setFileTrsmtStartHMS(DatetimeUtil.getCurrentTimeMillis());
try {
RemoteTransferLogManager.getInstance().insertRemoteTransferLog(loginfo);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
long size = -1;
try{
size = FTPUtil.retrieve(vo.getSysIp(), vo.getSysPort(), vo.getUserId(), vo.getUserPassword(), fullFileName, sendRootDir, vo.getSftpYn().equals("1"), logger, Transfer.AUTH_TYPE_ID);
}catch( Exception t){
try {
// 파일로그 처리
String errMsg = ExceptionUtil.getErrorCode(t, "BECEAIIFE005");
logger.error(errMsg, t); //Local 수신 File Event Listener 에서 오류가 발생하였습니다.
UCMsgSenderUtil.setUcMsg(bjvo, fileName , false, t.getMessage());
loginfo.setThisStgePrcssRsultCd(RemoteTransferLogKeys.STATUS_ERROR);
loginfo.setFileTrsmtEndHMS(DatetimeUtil.getCurrentTimeMillis());
StringBuffer sb = new StringBuffer();
sb.append(t.getMessage()+"\n");
sb.append(t.getClass().getCanonicalName()+"\n");
StackTraceElement[] ste = t.getStackTrace();
for (int inx = 0; inx < ste.length; inx++) {
sb.append("\tat "+ ste[inx].getClassName() +"(" +ste[inx].getFileName()).append(":"+ ste[inx].getLineNumber() +")\n");
}
loginfo.setObstclOccurCausCtnt(new String(sb));
RemoteTransferLogManager.getInstance().updateRemoteTransferLog(loginfo);
} catch (Throwable e) {
logger.error("[Req Recv File Event] ★★★★★ 수신 File Event Listner 예외 처리 중 에러 !! ★★★★★", e);
}
return "E:" + t.getMessage();
}
try {
loginfo.setFileTrsmtSize(size);
loginfo.setThisStgePrcssRsultCd(RemoteTransferLogKeys.STATUS_SUCCESS);
loginfo.setFileTrsmtEndHMS(DatetimeUtil.getCurrentTimeMillis());
RemoteTransferLogManager.getInstance().updateRemoteTransferLog(loginfo);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} catch (Throwable t) {
logger.error(t.getMessage(), t);
return "E:수신 실패[" + t.getMessage() +"]";
}
return "S:수신 성공[" + fullFileName +"]";
}
}
@@ -0,0 +1,138 @@
package com.eactive.eai.inbound.remote;
import java.sql.ResultSet;
import com.eactive.eai.batch.common.StringUtil;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
public class RemoteTransferLogDAO extends BaseDAO implements RemoteTransferLogQuery
{
//-------------------------------------------------------------------------------------------
//
//-------------------------------------------------------------------------------------------
public int insertRemoteTransferLog(RemoteTransferLogVO logVO) throws DAOException {
int retValue = 0;
int index = 0;
try {
this.connect(INSERT_REMOTE_TRANSFER_LOG);
//logger.debug(">>> 리모트 파일 전송로그 등록 SQL : \n"+ INSERT_REMOTE_TRANSFER_LOG);
index = 1;
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtLogID (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getFileTrsmtLogID (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtStartPtrnDstcd(), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getFileTrsmtStartPtrnDstcd(), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtStartHMS (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getFileTrsmtStartHMS (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtEndHMS (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getFileTrsmtEndHMS (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getBjobBzwkDstcd (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getBjobBzwkDstcd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getOsidInstiDstcd (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getOsidInstiDstcd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getBjobMsgDstcd (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getBjobMsgDstcd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtPathName (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getFileTrsmtPathName (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getTrsmtFileName (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getTrsmtFileName (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getRmtFileTrsmtPathName (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getRmtFileTrsmtPathName (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getRmtTrsmtFileName (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getRmtTrsmtFileName (), " ") +"]");
this.preparedStatement.setLong (index++, logVO.getFileTrsmtSize() ); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getFileTrsmtSize (), "0") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getThisMsgRegsntID (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getThisMsgRegsntID (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getThisStgePrcssRsultCd (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getThisStgePrcssRsultCd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getSendRecvYn (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getThisStgePrcssRsultCd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getObstclOccurCausCtnt (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.getObstclOccurCausCtnt (), " ") +"]");
retValue = this.executeUpdate();
//logger.info(">>> 리모트 파일 전송로그 등록 건수 : "+ retValue);
return retValue;
} catch (DAOException ex) {
throw ex;
} catch (Exception e) {
String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
throw new DAOException(errMsg); //<--------------
} finally {
disconnect();
}
}
public int updateRemoteTransferLog(RemoteTransferLogVO logVO) throws DAOException {
int retValue = 0;
int index = 0;
try {
this.connect(UPDATE_REMOTE_TRANSFER_LOG);
//logger.debug(">>> 리모트 파일 전송로그 수정 SQL : \n"+ UPDATE_REMOTE_TRANSFER_LOG);
index = 1;
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtStartPtrnDstcd(), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geFileTrsmtStartPtrnDstcd(), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtStartHMS (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geFileTrsmtStartHMS (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtEndHMS (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geFileTrsmtEndHMS (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getBjobBzwkDstcd (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geBjobBzwkDstcd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getOsidInstiDstcd (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geOsidInstiDstcd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getBjobMsgDstcd (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geBjobMsgDstcd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtPathName (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geFileTrsmtPathName (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getTrsmtFileName (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geTrsmtFileName (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getRmtFileTrsmtPathName (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geRmtFileTrsmtPathName (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getRmtTrsmtFileName (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geRmtTrsmtFileName (), " ") +"]");
this.preparedStatement.setLong (index++, logVO.getFileTrsmtSize() ); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geFileTrsmtSize (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getThisMsgRegsntID (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geThisMsgRegsntID (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getThisStgePrcssRsultCd (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geThisStgePrcssRsultCd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getSendRecvYn (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geThisStgePrcssRsultCd (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getObstclOccurCausCtnt (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geObstclOccurCausCtnt (), " ") +"]");
this.preparedStatement.setString(index++, StringUtil.nvlTrim(logVO.getFileTrsmtLogID (), " ")); //logger.debug(">>> 바인드("+(index-1)+") : ["+ StringUtil.nvlTrim(logVO.geFileTrsmtLogID (), " ") +"]");
retValue = this.executeUpdate();
//logger.info(">>> 리모트 파일 전송로그 등록 수정 : "+ retValue);
if ( retValue == 0 ){
retValue = insertRemoteTransferLog(logVO);
}
return retValue;
} catch (DAOException ex) {
throw ex;
} catch (Exception e) {
String errMsg = ExceptionUtil.getErrorCode(e, "UNDEFINEDCD", new String[] {});
throw new DAOException(errMsg); //<--------------
} finally {
disconnect();
}
}
public RemoteTransferLogVO getRemoteTransferLog( String fileTrsmtLogID ) throws DAOException {
RemoteTransferLogVO vo = null;
ResultSet rs = null;
try {
this.connect(SELECT_REMOTE_TRANSFER_LOG);
this.preparedStatement.setString(1, fileTrsmtLogID);
rs = executeQuery();
vo = new RemoteTransferLogVO();
while (rs.next())
{
vo.setFileTrsmtStartPtrnDstcd(rs.getString("FileTrsmtStartPtrnDstcd"));
vo.setFileTrsmtStartHMS (rs.getString("FileTrsmtStartHMS" ));
vo.setFileTrsmtEndHMS (rs.getString("FileTrsmtEndHMS" ));
vo.setBjobBzwkDstcd (rs.getString("BjobBzwkDstcd" ));
vo.setOsidInstiDstcd (rs.getString("OsidInstiDstcd" ));
vo.setBjobMsgDstcd (rs.getString("BjobMsgDstcd" ));
vo.setFileTrsmtPathName (rs.getString("FileTrsmtPathName" ));
vo.setTrsmtFileName (rs.getString("TrsmtFileName" ));
vo.setRmtFileTrsmtPathName (rs.getString("RmtFileTrsmtPathName" ));
vo.setRmtTrsmtFileName (rs.getString("RmtTrsmtFileName" ));
vo.setFileTrsmtSize (rs.getInt ("FileTrsmtSize" ));
vo.setThisMsgRegsntID (rs.getString("ThisMsgRegsntID" ));
vo.setThisStgePrcssRsultCd (rs.getString("ThisStgePrcssRsultCd" ));
vo.setSendRecvYn (rs.getString("SendRecvYn" ));
vo.setObstclOccurCausCtnt (rs.getString("ObstclOccurCausCtnt" ));
}
} catch(Exception e) {
logger.error(e.getMessage(), e);
// throw new DAOException(ExceptionUtil.getErrorCode(e,"BECEAIMFR017", new String[] {strRuleCode, strPhaseCode}));
} finally {
this.disconnect();
}
return vo;
}
}
@@ -0,0 +1,14 @@
package com.eactive.eai.inbound.remote;
public class RemoteTransferLogKeys {
public static final String START_BY_EVENT = "E";
public static final String START_BY_UI = "U";
public static final String START_BY_API = "A";
public static final String STARTER_SYSTEM = "SYSTEM";
public static final String STATUS_START = "S";
public static final String STATUS_SUCCESS = "T";
public static final String STATUS_ERROR = "E";
public static final String SEND = "S";
public static final String RECV = "R";
}
@@ -0,0 +1,31 @@
package com.eactive.eai.inbound.remote;
import com.eactive.eai.common.dao.DAOFactory;
public class RemoteTransferLogManager
{
//singleton 객체 생성
private static RemoteTransferLogManager instance = new RemoteTransferLogManager();
//singleton 객체 리턴
public static RemoteTransferLogManager getInstance() {
return instance;
}
//생성자 (다른 클래스에서 new 불가)
private RemoteTransferLogManager() {}
public int insertRemoteTransferLog(RemoteTransferLogVO remoteTransferLogVO) throws Exception {
RemoteTransferLogDAO dao = (RemoteTransferLogDAO)DAOFactory.newInstance().create(RemoteTransferLogDAO.class);
return dao.insertRemoteTransferLog(remoteTransferLogVO);
}
public int updateRemoteTransferLog(RemoteTransferLogVO remoteTransferLogVO) throws Exception {
RemoteTransferLogDAO dao = (RemoteTransferLogDAO)DAOFactory.newInstance().create(RemoteTransferLogDAO.class);
return dao.updateRemoteTransferLog(remoteTransferLogVO);
}
public RemoteTransferLogVO getRemoteTransferLog( String fileTrsmtLogID ) throws Exception {
RemoteTransferLogDAO dao = (RemoteTransferLogDAO)DAOFactory.newInstance().create(RemoteTransferLogDAO.class);
return dao.getRemoteTransferLog(fileTrsmtLogID);
}
}
@@ -0,0 +1,83 @@
package com.eactive.eai.inbound.remote;
import com.eactive.eai.common.dao.Keys;
public interface RemoteTransferLogQuery
{
public static final String INSERT_REMOTE_TRANSFER_LOG =
"INSERT INTO " + Keys.TABLE_OWNER + "TSEAIBU03 ( \n"
+ " FileTrsmtLogID ,\n"
+ " FileTrsmtStartPtrnDstcd ,\n"
+ " FileTrsmtStartHMS ,\n"
+ " FileTrsmtEndHMS ,\n"
+ " BjobBzwkDstcd ,\n"
+ " OsidInstiDstcd ,\n"
+ " BjobMsgDstcd ,\n"
+ " FileTrsmtPathName ,\n"
+ " TrsmtFileName ,\n"
+ " RmtFileTrsmtPathName ,\n"
+ " RmtTrsmtFileName ,\n"
+ " FileTrsmtSize ,\n"
+ " ThisMsgRegsntID ,\n"
+ " ThisMsgRegiHMS ,\n"
+ " ThisStgePrcssRsultCd ,\n"
+ " SendRecvYn ,\n"
+ " ObstclOccurCausCtnt )\n"
+ "VALUES ( \n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? ,\n"
+ " TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF3'),\n"
+ " ? ,\n"
+ " ? ,\n"
+ " ? )";
public static final String UPDATE_REMOTE_TRANSFER_LOG =
"UPDATE " + Keys.TABLE_OWNER + "TSEAIBU03\n"
+ "SET FileTrsmtStartPtrnDstcd = ?, \n"
+ " FileTrsmtStartHMS = ?, \n"
+ " FileTrsmtEndHMS = ?, \n"
+ " BjobBzwkDstcd = ?, \n"
+ " OsidInstiDstcd = ?, \n"
+ " BjobMsgDstcd = ?, \n"
+ " FileTrsmtPathName = ?, \n"
+ " TrsmtFileName = ?, \n"
+ " RmtFileTrsmtPathName = ?, \n"
+ " RmtTrsmtFileName = ?, \n"
+ " FileTrsmtSize = ?, \n"
+ " ThisMsgRegsntID = ?, \n"
+ " ThisStgePrcssRsultCd = ?, \n"
+ " SendRecvYn = ?, \n"
+ " ObstclOccurCausCtnt = ? \n"
+ "WHERE FileTrsmtLogID = ? ";
public static final String SELECT_REMOTE_TRANSFER_LOG =
"SELECT FileTrsmtStartPtrnDstcd ,\n"
+ " FileTrsmtStartHMS ,\n"
+ " FileTrsmtEndHMS ,\n"
+ " BjobBzwkDstcd ,\n"
+ " OsidInstiDstcd ,\n"
+ " BjobMsgDstcd ,\n"
+ " FileTrsmtPathName ,\n"
+ " TrsmtFileName ,\n"
+ " RmtFileTrsmtPathName ,\n"
+ " RmtTrsmtFileName ,\n"
+ " FileTrsmtSize ,\n"
+ " ThisMsgRegsntID ,\n"
+ " ThisStgePrcssRsultCd ,\n"
+ " SendRecvYn ,\n"
+ " ObstclOccurCausCtnt \n"
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBU03\n"
+ "WHERE FileTrsmtLogID = ? ";
}
@@ -0,0 +1,147 @@
package com.eactive.eai.inbound.remote;
import java.io.Serializable;
public class RemoteTransferLogVO implements Serializable
{
private static final long serialVersionUID = 1L;
private String fileTrsmtLogID = ""; //파일전송로그ID
private String fileTrsmtStartPtrnDstcd = ""; //파일전송시작유형구분코드
private String fileTrsmtStartHMS = ""; //파일전송시작시각
private String fileTrsmtEndHMS = ""; //파일전송종료시각
private String bjobBzwkDstcd = ""; //BATCH작업업무구분코드
private String osidInstiDstcd = ""; //대외기관구분코드
private String bjobMsgDstcd = ""; //BATCH작업메시지구분코드
private String fileTrsmtPathName = ""; //파일전송경로명
private String trsmtFileName = ""; //전송파일명
private String rmtFileTrsmtPathName = ""; //원격파일전송경로명
private String rmtTrsmtFileName = ""; //원격전송파일명
private long fileTrsmtSize = 0L; //파일전송크기
private String thisMsgRegsntID = ""; //당메시지등록자ID
private String thisMsgRegiHMS = ""; //당메시지등록시각
private String thisStgePrcssRsultCd = ""; //당단계처리결과코드
private String obstclOccurCausCtnt = ""; //장애발생원인내용
private String SendRecvYn = ""; //송수신구분
public String getFileTrsmtLogID() {
return fileTrsmtLogID;
}
public void setFileTrsmtLogID(String fileTrsmtLogID) {
this.fileTrsmtLogID = fileTrsmtLogID;
}
public String getFileTrsmtStartPtrnDstcd() {
return fileTrsmtStartPtrnDstcd;
}
public void setFileTrsmtStartPtrnDstcd(String fileTrsmtStartPtrnDstcd) {
this.fileTrsmtStartPtrnDstcd = fileTrsmtStartPtrnDstcd;
}
public String getFileTrsmtStartHMS() {
return fileTrsmtStartHMS;
}
public void setFileTrsmtStartHMS(String fileTrsmtStartHMS) {
this.fileTrsmtStartHMS = fileTrsmtStartHMS;
}
public String getFileTrsmtEndHMS() {
return fileTrsmtEndHMS;
}
public void setFileTrsmtEndHMS(String fileTrsmtEndHMS) {
this.fileTrsmtEndHMS = fileTrsmtEndHMS;
}
public String getBjobBzwkDstcd() {
return bjobBzwkDstcd;
}
public void setBjobBzwkDstcd(String bjobBzwkDstcd) {
this.bjobBzwkDstcd = bjobBzwkDstcd;
}
public String getOsidInstiDstcd() {
return osidInstiDstcd;
}
public void setOsidInstiDstcd(String osidInstiDstcd) {
this.osidInstiDstcd = osidInstiDstcd;
}
public String getBjobMsgDstcd() {
return bjobMsgDstcd;
}
public void setBjobMsgDstcd(String bjobMsgDstcd) {
this.bjobMsgDstcd = bjobMsgDstcd;
}
public String getFileTrsmtPathName() {
return fileTrsmtPathName;
}
public void setFileTrsmtPathName(String fileTrsmtPathName) {
this.fileTrsmtPathName = fileTrsmtPathName;
}
public String getTrsmtFileName() {
return trsmtFileName;
}
public void setTrsmtFileName(String trsmtFileName) {
this.trsmtFileName = trsmtFileName;
}
public String getRmtFileTrsmtPathName() {
return rmtFileTrsmtPathName;
}
public void setRmtFileTrsmtPathName(String rmtFileTrsmtPathName) {
this.rmtFileTrsmtPathName = rmtFileTrsmtPathName;
}
public String getRmtTrsmtFileName() {
return rmtTrsmtFileName;
}
public void setRmtTrsmtFileName(String rmtTrsmtFileName) {
this.rmtTrsmtFileName = rmtTrsmtFileName;
}
public long getFileTrsmtSize() {
return fileTrsmtSize;
}
public void setFileTrsmtSize(long fileTrsmtSize) {
this.fileTrsmtSize = fileTrsmtSize;
}
public String getThisMsgRegsntID() {
return thisMsgRegsntID;
}
public void setThisMsgRegsntID(String thisMsgRegsntID) {
this.thisMsgRegsntID = thisMsgRegsntID;
}
public String getThisMsgRegiHMS() {
return thisMsgRegiHMS;
}
public void setThisMsgRegiHMS(String thisMsgRegiHMS) {
this.thisMsgRegiHMS = thisMsgRegiHMS;
}
public String getThisStgePrcssRsultCd() {
return thisStgePrcssRsultCd;
}
public void setThisStgePrcssRsultCd(String thisStgePrcssRsultCd) {
this.thisStgePrcssRsultCd = thisStgePrcssRsultCd;
}
public String getObstclOccurCausCtnt() {
return obstclOccurCausCtnt;
}
public void setObstclOccurCausCtnt(String obstclOccurCausCtnt) {
this.obstclOccurCausCtnt = obstclOccurCausCtnt;
}
public String getSendRecvYn() {
return SendRecvYn;
}
public void setSendRecvYn(String sendRecvYn) {
SendRecvYn = sendRecvYn;
}
@Override
public String toString() {
return "RemoteTransferLogVO [fileTrsmtLogID=" + fileTrsmtLogID
+ ", fileTrsmtStartPtrnDstcd=" + fileTrsmtStartPtrnDstcd
+ ", fileTrsmtStartHMS=" + fileTrsmtStartHMS
+ ", fileTrsmtEndHMS=" + fileTrsmtEndHMS + ", bjobBzwkDstcd="
+ bjobBzwkDstcd + ", osidInstiDstcd=" + osidInstiDstcd
+ ", bjobMsgDstcd=" + bjobMsgDstcd + ", fileTrsmtPathName="
+ fileTrsmtPathName + ", trsmtFileName=" + trsmtFileName
+ ", rmtFileTrsmtPathName=" + rmtFileTrsmtPathName
+ ", rmtTrsmtFileName=" + rmtTrsmtFileName
+ ", fileTrsmtSize="
+ fileTrsmtSize + ", thisMsgRegsntID=" + thisMsgRegsntID
+ ", thisMsgRegiHMS=" + thisMsgRegiHMS
+ ", thisStgePrcssRsultCd=" + thisStgePrcssRsultCd
+ ", obstclOccurCausCtnt=" + obstclOccurCausCtnt + "]";
}
}
@@ -0,0 +1,30 @@
package com.eactive.eai.inbound.remote;
import java.io.Serializable;
public class TargetFileVO implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String name = "";
private long size = 0;
private long lastModified = 0;
private boolean directory = false;
private boolean file = false;
public void setName (String arg) { name = arg; }
public void setSize (long arg) { size = arg; }
public void setLastModified(long arg) { lastModified = arg; }
public void setDirectory (boolean arg) { directory = arg; }
public void setFile (boolean arg) { file = arg; }
public String getName () { return name ; }
public long getSize () { return size ; }
public long getLastModified() { return lastModified; }
public boolean isDirectory () { return directory ; }
public boolean isFile () { return file ; }
}