init
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.ext.eai.fds;//package com.ext.eai.fds;
|
||||
//
|
||||
//public interface FDSKeys {
|
||||
//
|
||||
// final String SERVICES_FILE = "adssvc.properties";
|
||||
// final String YES = "Y";
|
||||
// final String NO = "N";
|
||||
// final String SKIP_YN = "SKIP_YN";
|
||||
// final String CONNECT_TARGET = "CONNECT_TARGET";
|
||||
// interface JSON {
|
||||
// String HEADER = "Header";
|
||||
// String SYSTEM_HEADER = "systemHeader";
|
||||
// String BODY = "Body";
|
||||
// String TX_CODE = "DLNG_ID";
|
||||
// String TX_RESP_CODE = "RSPNS_RSLT_DVSN_CD";
|
||||
// String FDS_MSG_TYPE_CODE = "MSG_TYPE_CODE";
|
||||
// }
|
||||
//
|
||||
// interface TX_RESP_CODE {
|
||||
// String NORMAL = "N";
|
||||
// }
|
||||
//
|
||||
// interface FDS_MSG_TYPE_CODE {
|
||||
// String REQ = "T";
|
||||
// String RES = "R";
|
||||
// }
|
||||
//
|
||||
// interface CONNECT_TARGET_CD {
|
||||
// String HTTP = "http";
|
||||
// String COLLECT = "collect";
|
||||
// String DETECT = "detect";
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@@ -0,0 +1,302 @@
|
||||
//package com.ext.eai.fds;
|
||||
//
|
||||
//import java.io.InputStream;
|
||||
//import java.io.UnsupportedEncodingException;
|
||||
//import java.util.Map;
|
||||
//import java.util.Properties;
|
||||
//
|
||||
//import org.json.simple.parser.JSONParser;
|
||||
//
|
||||
//import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
//import com.eactive.eai.common.lifecycle.Lifecycle;
|
||||
//import com.eactive.eai.common.lifecycle.LifecycleException;
|
||||
//import com.eactive.eai.common.lifecycle.LifecycleListener;
|
||||
//import com.eactive.eai.common.lifecycle.LifecycleSupport;
|
||||
//import com.eactive.eai.common.message.EAIMessage;
|
||||
//import com.eactive.eai.common.message.ExtMessage;
|
||||
//import com.eactive.eai.common.server.EAIServerManager;
|
||||
//import com.eactive.eai.common.util.Logger;
|
||||
//import com.ext.eai.common.stdmessage.STDMessage;
|
||||
//import com.greenbeesoft.ids.connector.Connector;
|
||||
//import com.greenbeesoft.ids.connector.ConnectorManager;
|
||||
//
|
||||
///**
|
||||
//* 1. 기능 : FDS 전송을 위한 Rule 정보를 File로 부터 로딩해 메모리에 관리하는 Manager 클래스
|
||||
//* 2. 처리 개요 : File Rule 정보에 저장된 FDS Rule 정보를 메모리에 로딩 관리한다.
|
||||
//* * -
|
||||
//* 3. 주의사항
|
||||
//*
|
||||
//* @author :
|
||||
//* @version : v 1.0.0
|
||||
//* @see : 관련 기능을 참조
|
||||
//* @since :
|
||||
//* :
|
||||
//*/
|
||||
//public class FDSManager implements Lifecycle
|
||||
//{
|
||||
// public static String FDS_PROP_GROUP_NAME = "FDS";
|
||||
// public static String FDS_SEND_SKIP_YN = "FDS_SEND_SKIP_YN";
|
||||
// static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
// /**
|
||||
// * FDSManager Single Instance
|
||||
// */
|
||||
// private static FDSManager instance = new FDSManager();
|
||||
//
|
||||
// /**
|
||||
// * LifecyleSupport object
|
||||
// */
|
||||
// private LifecycleSupport lifecycle = new LifecycleSupport(this);
|
||||
//
|
||||
// /**
|
||||
// * Property 정보를 저장하는 collection
|
||||
// */
|
||||
// private Properties acceptedServiceList;
|
||||
//
|
||||
// private Connector fdsConnector;
|
||||
//
|
||||
// private String skipYn ;
|
||||
// private String connectTarget ;
|
||||
//
|
||||
// /**
|
||||
// * 기동 여부
|
||||
// */
|
||||
// private boolean started;
|
||||
//
|
||||
// /**
|
||||
// * 1. 기능 : Default Constructor
|
||||
// * 2. 처리 개요 :
|
||||
// * -
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// **/
|
||||
// private FDSManager() {
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 1. 기능 : FDSManager Singleton Object를 반환하는 getter method
|
||||
// * 2. 처리 개요 : FDSManager Singleton Object를 반환한다.
|
||||
// * -
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// * @param
|
||||
// * @return
|
||||
// * @exception
|
||||
// **/
|
||||
// public static FDSManager getInstance() {
|
||||
// return instance;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 1. 기능 : FDSManager의 초기화 여부를 반환하는 getter 메서드
|
||||
// * 2. 처리 개요 : FDSManager의 초기화 여부를 반환한다.
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// * @return 초기화 여부
|
||||
// **/
|
||||
// public boolean isStarted() {
|
||||
// return this.started;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // =================================================================================
|
||||
// // 이 부분은 Lifecycle용으로 제공되는 메소드이다.
|
||||
// /**
|
||||
// * 1. 기능 : Lifecycle의 start 메서드로 FDSManager를 초기화하는 메서드
|
||||
// * 2. 처리 개요 : PropertyDAO를 이용해 추출 Rule 정보 모두를 가져와 초기화한다.
|
||||
// * -
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// * @param
|
||||
// * @return
|
||||
// * @exception
|
||||
// **/
|
||||
// public void start() throws LifecycleException {
|
||||
// if (started)
|
||||
// throw new LifecycleException("RECEAICPM201");
|
||||
//
|
||||
// // Notify our interested LifecycleListeners
|
||||
// lifecycle.fireLifecycleEvent(STARTING_EVENT, this);
|
||||
//
|
||||
// try {
|
||||
// init();
|
||||
// } catch(Exception e) {
|
||||
// //throw new LifecycleException("RECEAICPM201");
|
||||
// throw new LifecycleException(ExceptionUtil.getErrorCode(e,"RECEAICPM201"));
|
||||
// }
|
||||
//
|
||||
// started = true;
|
||||
// logger.info("FDSManager] It is started.");
|
||||
// // Notify our interested LifecycleListeners
|
||||
// lifecycle.fireLifecycleEvent(STARTED_EVENT, this);
|
||||
// }
|
||||
// private void init() throws Exception {
|
||||
// Properties serviceList = new Properties();
|
||||
// //File Load
|
||||
// InputStream is = getClass().getClassLoader().getResourceAsStream(FDSKeys.SERVICES_FILE);
|
||||
// if ( is == null )
|
||||
// {
|
||||
//// throw new IllegalArgumentException("Not Found FDS Properties file in classpath. [" + SERVICES_FILE + "]");
|
||||
// logger.error("Not Found FDS Properties file in classpath. [" + FDSKeys.SERVICES_FILE + "]");
|
||||
// }
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// serviceList.load(is);
|
||||
// acceptedServiceList = serviceList;
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// logger.error("acceptedServiceList : " + acceptedServiceList.size());
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// try {
|
||||
// if ( is != null ) is.close();
|
||||
// } catch (Exception e2) {
|
||||
// }
|
||||
// }
|
||||
// skipYn = ( acceptedServiceList.containsKey(FDSKeys.SKIP_YN)) ? acceptedServiceList.getProperty(FDSKeys.SKIP_YN) : FDSKeys.NO;
|
||||
// connectTarget= ( acceptedServiceList.containsKey(FDSKeys.CONNECT_TARGET)) ? acceptedServiceList.getProperty(FDSKeys.CONNECT_TARGET) : FDSKeys.CONNECT_TARGET_CD.HTTP;
|
||||
//
|
||||
// ConnectorManager connectorManager = ConnectorManager.getInstance();
|
||||
// try{
|
||||
// connectorManager.init(EAIServerManager.getInstance().getSystemEnvTypeConvert()+"_adsapi.properties");//D/T/P
|
||||
// }catch(Exception e){
|
||||
// logger.error("ConnectorManager init fail " ,e);
|
||||
// }
|
||||
//
|
||||
// fdsConnector = connectorManager.getConnector(connectTarget);
|
||||
//
|
||||
// }
|
||||
// public synchronized void reload() throws Exception {
|
||||
// if(logger.isWarn()) {
|
||||
// logger.warn("FDSManager] reload all Started ...");
|
||||
// }
|
||||
// init();
|
||||
// if(logger.isWarn()) {
|
||||
// logger.warn("FDSManager] reload all finished ...");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 1. 기능 : Lifecycle의 stop 메서드로 FDSManager를 종료하는 메서드
|
||||
// * 2. 처리 개요 : 멤버에 캐싱한 프라퍼티 Rule 정보를 clear한다.
|
||||
// * -
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// * @param
|
||||
// * @return
|
||||
// * @exception
|
||||
// **/
|
||||
// public void stop() throws LifecycleException {
|
||||
// // Validate and update our current component state
|
||||
// if (!started)
|
||||
// throw new LifecycleException("RECEAICPM203");
|
||||
//
|
||||
// // Notify our interested LifecycleListeners
|
||||
// lifecycle.fireLifecycleEvent(STOPING_EVENT, this);
|
||||
//
|
||||
//
|
||||
//
|
||||
// started = false;
|
||||
// logger.info("FDSManager] It is stopped.");
|
||||
// // Notify our interested LifecycleListeners
|
||||
// lifecycle.fireLifecycleEvent(STOPPED_EVENT, this);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 1. 기능 : LifecycleListener를 등록하는 메서드
|
||||
// * 2. 처리 개요 : LifecycleListener를 등록한다.
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// * @param listener LifecycleEvent를 수신한 LifecycleListener
|
||||
// **/
|
||||
// public void addLifecycleListener(LifecycleListener listener)
|
||||
// {
|
||||
// lifecycle.addLifecycleListener(listener);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 1. 기능 : 등록된 LifecycleListener 리스트를 반환하는 메서드
|
||||
// * 2. 처리 개요 : 등록된 LifecycleListener 리스트를 반환하다.
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// * @return 등록된 LifecycleListener 리스트
|
||||
// **/
|
||||
// public LifecycleListener[] findLifecycleListeners()
|
||||
// {
|
||||
// return lifecycle.findLifecycleListeners();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 1. 기능 : 등록된 LifecycleListener를 삭제하는 메서드
|
||||
// * 2. 처리 개요 : 파라미터의 LifecycleListener를 삭제한다.
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// * @param listener 삭제할 LifecycleListener
|
||||
// **/
|
||||
// public void removeLifecycleListener(LifecycleListener listener)
|
||||
// {
|
||||
// lifecycle.removeLifecycleListener(listener);
|
||||
// }
|
||||
//
|
||||
// public void send(EAIMessage reqEaiMsg, EAIMessage retEaiMsg){
|
||||
// ExtMessage extMessage =retEaiMsg.getExtMsg();
|
||||
// String serviceId = extMessage.getServiceId();
|
||||
// String responseType = extMessage.getResponseType();
|
||||
// if ( FDSKeys.TX_RESP_CODE.NORMAL.equals(responseType) && acceptedServiceList.containsKey(serviceId)){
|
||||
// if(!FDSKeys.YES.equals(skipYn)) {
|
||||
// Map reqJson = null;
|
||||
// try {
|
||||
// reqJson = getJSONMap(reqEaiMsg,retEaiMsg, acceptedServiceList.getProperty(serviceId));
|
||||
// fdsConnector.send(reqJson);
|
||||
// logger.debug("fds collect send ~ OK !!" );
|
||||
// } catch (Exception e) {
|
||||
// logger.error("fds send parsing error", e);
|
||||
// }
|
||||
// }else {
|
||||
// logger.debug("fds collect skip ~ !!" );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// private static Map getJSONMap(EAIMessage reqEaiMsg,EAIMessage retEaiMsg, String io) throws Exception{
|
||||
// if (io == null ){
|
||||
// throw new Exception("invalid property io ="+ io);
|
||||
// }
|
||||
//
|
||||
// ExtMessage reqExt =retEaiMsg.getExtMsg();
|
||||
// STDMessage reqStd =(STDMessage)reqExt.getStdMessage();
|
||||
//
|
||||
// Object bodyObj = null;
|
||||
// if (!"O".equals(io)){ //요청 body 셋팅
|
||||
// bodyObj = reqEaiMsg.getExtMsg().getBizData()[0];
|
||||
// }else{
|
||||
// bodyObj = reqExt.getBizData()[0];
|
||||
// }
|
||||
//
|
||||
// String body ="";
|
||||
// if (bodyObj instanceof String){
|
||||
// body =(String)bodyObj;
|
||||
// }else if (bodyObj instanceof byte[]){
|
||||
// try {
|
||||
// body = new String((byte[])bodyObj,"utf-8");
|
||||
// } catch (UnsupportedEncodingException e) {
|
||||
// logger.error("fds send data convert error ", e);
|
||||
// }
|
||||
// }
|
||||
// String sendData = reqStd.toJSONString(body);
|
||||
//
|
||||
//
|
||||
// Map reqJson = (Map)new JSONParser().parse(sendData);
|
||||
//
|
||||
// Map<String,Object> header = (Map)reqJson.get(FDSKeys.JSON.HEADER);
|
||||
// Map<String,Object> systemHeader = (Map)header.get(FDSKeys.JSON.SYSTEM_HEADER);
|
||||
// systemHeader.put(FDSKeys.JSON.FDS_MSG_TYPE_CODE, FDSKeys.FDS_MSG_TYPE_CODE.REQ );
|
||||
// if (logger.isDebug()){
|
||||
// logger.debug("fds send data = "+reqJson);
|
||||
// }
|
||||
// return reqJson;
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user