init
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
package com.eactive.eai.agent;
|
||||
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.server.EAIServerDAO;
|
||||
import com.eactive.eai.common.server.EAIServerVO;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : 등록된 EAI Server 에 Command를 broadcast
|
||||
* 2. 처리 개요 : 등록된 EAI Server 에 Command를 broadcast
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class AgentUtil
|
||||
{
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private static final String WEB_AGENT_SERVLET_URL = "/BAPAppWeb/WebAgent";
|
||||
|
||||
|
||||
//생성자 (private : 객체 생성 불가)
|
||||
private AgentUtil() {}
|
||||
|
||||
|
||||
private static HashMap<String, String> getAllSvrUrl() throws Exception {
|
||||
|
||||
EAIServerDAO dao = (EAIServerDAO) DAOFactory.newInstance().create(EAIServerDAO.class);
|
||||
ArrayList<EAIServerVO> serverList = dao.getAllServerList();
|
||||
if (serverList == null || serverList.size() == 0) return null;
|
||||
|
||||
HashMap<String, String> urlLists = new HashMap<String, String>();
|
||||
|
||||
for (int i = 0; i<serverList.size(); i++) {
|
||||
EAIServerVO vo = (EAIServerVO) serverList.get(i);
|
||||
if (vo.getName().equalsIgnoreCase("ALL")) continue; //서버명이 'ALL' 인 경우는 무시
|
||||
urlLists.put(vo.getName(), vo.toURL(EAIServerVO.HTTP_PROTOCOL) + WEB_AGENT_SERVLET_URL);
|
||||
logger.debug("[ AgentUtil ] getAllSvrUrl - URL : " + urlLists.get(vo.getName()));
|
||||
}
|
||||
return urlLists;
|
||||
}
|
||||
|
||||
private static HashMap<String, String> getSvrUrl(EAIServerVO vo) throws Exception {
|
||||
|
||||
if (vo == null) return null;
|
||||
|
||||
HashMap<String, String> urlLists = new HashMap<String, String>();
|
||||
urlLists.put(vo.getName(), vo.toURL(EAIServerVO.HTTP_PROTOCOL) + WEB_AGENT_SERVLET_URL);
|
||||
logger.debug("[ AgentUtil ] getAllSvrUrl - URL : " + urlLists.get(vo.getName()));
|
||||
return urlLists;
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> broadcast(EAIServerVO serverVO, Command command) throws Exception {
|
||||
return broadcast(getSvrUrl(serverVO), command);
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> broadcast(Command command) throws Exception {
|
||||
return broadcast(getAllSvrUrl(), command);
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> callMainServer(Command command) throws Exception {
|
||||
return broadcast(getSvrUrl(getMainServerVO()), command);
|
||||
}
|
||||
|
||||
public static EAIServerVO getServerVO(String serverName) throws Exception {
|
||||
if (serverName == null || serverName.equals("")) throw new Exception("서버명 파라미터가 null 또는 공백입니다.");
|
||||
|
||||
EAIServerDAO dao = (EAIServerDAO) DAOFactory.newInstance().create(EAIServerDAO.class);
|
||||
ArrayList<EAIServerVO> serverList = dao.getAllServerList();
|
||||
if (serverList == null || serverList.size() == 0) return null;
|
||||
|
||||
for (int i = 0; i < serverList.size(); i++) {
|
||||
EAIServerVO vo = (EAIServerVO) serverList.get(i);
|
||||
if (vo.getName().equals(serverName)) return vo;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EAIServerVO getMainServerVO() throws Exception {
|
||||
|
||||
EAIServerDAO dao = (EAIServerDAO) DAOFactory.newInstance().create(EAIServerDAO.class);
|
||||
ArrayList<EAIServerVO> serverList = dao.getAllServerList();
|
||||
|
||||
if ( serverList.size() > 0 )
|
||||
return serverList.get(0);
|
||||
// //서버명 중에 xxxxxi11 로 끝나는 서버를 메인서버로 본다.
|
||||
// for (int i = 0; serverList != null && i < serverList.size(); i++) {
|
||||
// EAIServerVO vo = serverList.get(i);
|
||||
//// if (vo.getName().endsWith("i11")) return vo;
|
||||
// return vo;
|
||||
// }
|
||||
throw new Exception("서버정보 테이블(TSEAIBP03) 에 메인서버를 설정하세요.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 등록된 EAI Server에 Command를 broadcast
|
||||
* 2. 처리 개요 : 등록된 EAI Server의 URLConnection을 생성하여 Command broadcast하고
|
||||
* 전송된 결과값의 HashMap을 생성하여 반환
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param command broadcast할 Command
|
||||
* @return HashMap broadcast후 전송된 결과값.
|
||||
* 전송된 데이터가 sucess가 아니면 Exception이 전송된 것임.
|
||||
* @exception Exception
|
||||
**/
|
||||
public static HashMap<String, Object> broadcast(HashMap<String, String> servers, Command command) throws Exception {
|
||||
|
||||
HashMap<String, Object> returnValue = new HashMap<String, Object>();
|
||||
|
||||
logger.debug("[ AgentUtil ] broadcast 시작...");
|
||||
if (servers != null) {
|
||||
|
||||
logger.debug("[ AgentUtil ] 대상 서버수 =" + servers.size());
|
||||
Iterator<String> it = servers.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String svrName = (String) it.next();
|
||||
String url = (String) servers.get(svrName);
|
||||
URLConnection urlCon = getURLConnection(url);
|
||||
try {
|
||||
logger.debug("[ AgentUtil ] COMMAND = " + command);
|
||||
Object response = sendCommand(urlCon, command);
|
||||
returnValue.put(svrName, response);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("[ AgentUtil ] ★★★★★ broadcast 예외 발생 !! ★★★★★", e);
|
||||
returnValue.put(svrName, e.getMessage());
|
||||
}
|
||||
logger.debug("[ AgentUtil ] 대상 서버 ["+svrName+"] 결과 = ["+ returnValue.get(svrName) +"]");
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.error("[ AgentUtil ] 대상 서버 없음.");
|
||||
}
|
||||
logger.debug("[ AgentUtil ] broadcast 완료.");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 해당 URLConnection으로 command 전송 처리 결과를 반환
|
||||
* 2. 처리 개요 : 해당 URLConnection으로 command 전송하고 처리 결과를 반환
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param urlCon 연결할 URLConnection
|
||||
* @param command 전송할 Command
|
||||
* @return String 처리된 결과
|
||||
* @exception Exception
|
||||
**/
|
||||
private static Object sendCommand(URLConnection urlCon, Command command) throws Exception {
|
||||
|
||||
ObjectOutputStream oos = null;
|
||||
ObjectInputStream ois = null;
|
||||
Object response = "";
|
||||
|
||||
try {
|
||||
HashMap<String, Command> hm = new HashMap<String, Command>();
|
||||
hm.put("command", command);
|
||||
|
||||
oos = new ObjectOutputStream(urlCon.getOutputStream());
|
||||
oos.writeObject((Serializable) hm);
|
||||
oos.flush();
|
||||
logger.debug("[ AgentUtil ] SendCommand - " + urlCon.getURL().toString() +" ["+ command.getClass().getName() + "]");
|
||||
|
||||
ois = new ObjectInputStream(urlCon.getInputStream());
|
||||
response = ois.readObject();
|
||||
|
||||
} finally {
|
||||
try { if (oos != null) oos.close(); } catch (Exception ex) {}
|
||||
try { if (ois != null) ois.close(); } catch (Exception ex) {}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 지정된 url의 URLConnection 생성
|
||||
* 2. 처리 개요 : 지정된 url의 URLConnection 생성
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param url URLConnection을 생성을 위한 url
|
||||
* @return URLConnection 생성된 URLConnection
|
||||
* @exception
|
||||
**/
|
||||
private static URLConnection getURLConnection(String url) throws Exception {
|
||||
|
||||
URL u = new URL(url);
|
||||
HttpURLConnection conn = (HttpURLConnection) u.openConnection();
|
||||
|
||||
if (conn == null) throw new Exception("HttpURLConnection 을 생성할 수 없습니다. (URL : "+ url +")");
|
||||
|
||||
conn.setDoInput(true);
|
||||
conn.setDoOutput(true);
|
||||
conn.setUseCaches(false);
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-type", "application/octet-stream");
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.eactive.eai.agent.adapter;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
import com.eactive.eai.adapter.AdapterManager;
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 AdapterManager의 정보 변경
|
||||
* 2. 처리 개요 : AdapterGroupVO를 manager에서 remove
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class RemoveAdapterGroupCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : RemoveAdapterGroupCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public RemoveAdapterGroupCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : AdapterManager에 AdapterGroupVO를 제거
|
||||
* 2. 처리 개요 : AdapterGroupVO의 EAISvrInstNm이 DEFAULT_SERVER(ALL) 이거나 LocalServer인 경우
|
||||
* AdapterManager에 등록된 해당 AdapterGroupVO를 제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
String adapterGroupName = (String)args;
|
||||
logger.debug("adapterGroupName : "+adapterGroupName );
|
||||
AdapterGroupVO gvo = AdapterManager.getInstance().getAdapterGroupVO(adapterGroupName);
|
||||
|
||||
if (gvo != null) {
|
||||
gvo.stop();
|
||||
AdapterManager.getInstance().removeAdapterGroupVO(adapterGroupName);
|
||||
}
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.eactive.eai.agent.adapter;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
import com.eactive.eai.adapter.AdapterManager;
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 AdapterManager의 정보 변경
|
||||
* 2. 처리 개요 : AdapterGroupVO의 member variable 값 변경
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see
|
||||
* @since
|
||||
*/
|
||||
public class UpdateAdapterGroupCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : UpdateAdapterGroupCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
**/
|
||||
public UpdateAdapterGroupCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : AdapterManager의 AdapterGroupVO를 수정
|
||||
* 2. 처리 개요 : AdapterGroupVO의 EAISvrInstNm이 DEFAULT_SERVER(ALL) 이거나 LocalServer인 경우
|
||||
* AdapterManager에 등록된 해당 AdapterGroupVO의 데이터 수정
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
|
||||
String adapterGroupName = (String)args;
|
||||
AdapterGroupVO current = AdapterManager.getInstance().getAdapterGroupVO(adapterGroupName);
|
||||
|
||||
if (current != null) {
|
||||
current.stop();
|
||||
AdapterManager.getInstance().removeAdapterGroupVO(adapterGroupName);
|
||||
// } else {
|
||||
// logger.info("Manager's AdapterGroupVO is null. -- "+vo.getName());
|
||||
}
|
||||
AdapterGroupVO vo = AdapterManager.getInstance().getAdapterGroupInDB(adapterGroupName);
|
||||
|
||||
if (vo.isUsedFlag()) {
|
||||
vo.start();
|
||||
AdapterManager.getInstance().addAdapterGroupVO(vo);
|
||||
}
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.eactive.eai.agent.adapter.socket;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
import com.eactive.eai.adapter.AdapterManager;
|
||||
import com.eactive.eai.adapter.AdapterVO;
|
||||
import com.eactive.eai.adapter.socket.config.SocketAdapterManager;
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 CodeMessageManager의 정보 변경
|
||||
* 2. 처리 개요 : CodeMessageManager에 CodeMessageVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class SocketServerCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
/**
|
||||
* 1. 기능 : SelectSocketServerCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public SocketServerCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : ServerSocket 정보를 가지고옮
|
||||
* 2. 처리 개요 : ServerSocket 정보를 가지고옮
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
try {
|
||||
|
||||
List<Map<String,Serializable>> ls = getSocketServerAdapterInfo();
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return ls;
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<Map<String,Serializable>> getSocketServerAdapterInfo() throws Exception {
|
||||
|
||||
try {
|
||||
//리턴 ArrayList 생성
|
||||
List<Map<String,Serializable>> retList = new ArrayList<Map<String,Serializable>>();
|
||||
|
||||
//메모리의 전체 AdapterGroup 객체 조회
|
||||
HashMap<String, AdapterGroupVO> allAdapterGroupMap = AdapterManager.getInstance().getAllAdapterGroupVO();
|
||||
|
||||
//AdapterGroup 이 없으면
|
||||
if (allAdapterGroupMap == null || allAdapterGroupMap.size() == 0) {
|
||||
return retList;
|
||||
}
|
||||
|
||||
//AdapterGroup 명으로 정렬
|
||||
Object[] adapterGroupNames = allAdapterGroupMap.keySet().toArray();
|
||||
Arrays.sort(adapterGroupNames);
|
||||
|
||||
//===================================================================================
|
||||
//AdapterGroup 별 LOOP
|
||||
for (int i=0; i<adapterGroupNames.length; i++) {
|
||||
AdapterGroupVO gvo = allAdapterGroupMap.get(adapterGroupNames[i]);
|
||||
String adapterGroupName = gvo.getName();
|
||||
String processCode = gvo.getBatchProcessCode();
|
||||
String organCode = gvo.getBatchInstitutionCode();
|
||||
OutsideVO ovo = OutsideManager.getInstance().getOutsideInfo(processCode, organCode);
|
||||
String processName = ovo.getBatchName();
|
||||
String organName = ovo.getOsdName();
|
||||
|
||||
//해당 AdapterGroup의 전체 Adapter 객체 조회
|
||||
HashMap<String,AdapterVO> allAdapterMap = gvo.getAllAdapters();
|
||||
|
||||
//Adapter 가 없으면 디폴트 값 설정
|
||||
if (allAdapterMap == null || allAdapterMap.size() == 0) {
|
||||
Map<String, Serializable> map = new HashMap<String, Serializable>();
|
||||
map.put("adptrBzwkGroupName", adapterGroupName);
|
||||
map.put("bjobBzwkDstcd" , processCode );
|
||||
map.put("processName" , processName );
|
||||
map.put("organName" , organName );
|
||||
map.put("osidInstiDstCd" , organCode );
|
||||
map.put("adptrBzwkName" , "No Adapters" );
|
||||
map.put("ip" , "" );
|
||||
map.put("port" , "" );
|
||||
map.put("maxConnectioncount", 0 );
|
||||
map.put("curConnectioncount", 0 );
|
||||
map.put("status" , "N/A" );
|
||||
retList.add(map);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Adapter 명으로 정렬
|
||||
Object[] adapterNames = allAdapterMap.keySet().toArray();
|
||||
Arrays.sort(adapterNames);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
//Adapter 별 LOOP
|
||||
for (int k=0; k<adapterNames.length; k++) {
|
||||
AdapterVO avo = (AdapterVO) allAdapterMap.get(adapterNames[k]);
|
||||
String adapterName = avo.getName();
|
||||
int maxConnCnt = avo.getContext().getMaxConnection();
|
||||
int curConnCnt = SocketAdapterManager.getInstance().getSocketServiceCount(adapterGroupName, adapterName);
|
||||
boolean isActive = avo.isStarted();
|
||||
|
||||
Map<String, Serializable> map = new HashMap<String, Serializable>();
|
||||
map.put("adptrBzwkGroupName", adapterGroupName );
|
||||
map.put("bjobBzwkDstcd" , processCode );
|
||||
map.put("processName" , processName );
|
||||
map.put("organName" , organName );
|
||||
map.put("osidInstiDstCd" , organCode );
|
||||
map.put("adptrBzwkName" , adapterName );
|
||||
map.put("ip" , avo.getBatchServerIP() );
|
||||
map.put("port" , avo.getBatchServerPortNo());
|
||||
map.put("maxConnectioncount", maxConnCnt );
|
||||
map.put("curConnectioncount", curConnCnt );
|
||||
map.put("status" , isActive? "기동중" : "중지" );
|
||||
retList.add(map);
|
||||
}
|
||||
}
|
||||
return retList;
|
||||
|
||||
}catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.eactive.eai.agent.adapter.socket;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SocketServerVO implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String serverName; //서버명
|
||||
private String bjobBzwkDstcd; //작업업무구분코드
|
||||
private String osidInstiDstCd; //대외기관구분코드
|
||||
private String osidInstiName; //대외기관명
|
||||
private String adptrBzwkGroupName; //어댑터업무그룹명
|
||||
private String adptrBzwkName; //어댑터업무명
|
||||
private String ip; //아이피
|
||||
private String port; //포트
|
||||
private String status; //상태
|
||||
private int maxConnectionCount;
|
||||
private int curConnectionCount;
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
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 getOsidInstiName() {
|
||||
return osidInstiName;
|
||||
}
|
||||
public void setOsidInstiName(String osidInstiName) {
|
||||
this.osidInstiName = osidInstiName;
|
||||
}
|
||||
public String getAdptrBzwkGroupName() {
|
||||
return adptrBzwkGroupName;
|
||||
}
|
||||
public void setAdptrBzwkGroupName(String adptrBzwkGroupName) {
|
||||
this.adptrBzwkGroupName = adptrBzwkGroupName;
|
||||
}
|
||||
public String getAdptrBzwkName() {
|
||||
return adptrBzwkName;
|
||||
}
|
||||
public void setAdptrBzwkName(String adptrBzwkName) {
|
||||
this.adptrBzwkName = adptrBzwkName;
|
||||
}
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
public int getMaxConnectionCount() {
|
||||
return maxConnectionCount;
|
||||
}
|
||||
public void setMaxConnectionCount(int maxConnectionCount) {
|
||||
this.maxConnectionCount = maxConnectionCount;
|
||||
}
|
||||
public int getCurConnectionCount() {
|
||||
return curConnectionCount;
|
||||
}
|
||||
public void setCurConnectionCount(int curConnectionCount) {
|
||||
this.curConnectionCount = curConnectionCount;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SocketServerVO [serverName=" + serverName + ", bjobBzwkDstcd="
|
||||
+ bjobBzwkDstcd + ", osidInstiDstCd=" + osidInstiDstCd
|
||||
+ ", osidInstiName=" + osidInstiName + ", adptrBzwkGroupName="
|
||||
+ adptrBzwkGroupName + ", adptrBzwkName=" + adptrBzwkName
|
||||
+ ", ip=" + ip + ", port=" + port + ", status=" + status
|
||||
+ ", maxConnectionCount=" + maxConnectionCount
|
||||
+ ", curConnectionCount=" + curConnectionCount + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.agent.adapter.socket;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.eactive.eai.adapter.socket.service.SocketService;
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.running.BatchRunningJobManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class SocketSessionCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public SocketSessionCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
try {
|
||||
List<Map<String, String>> alist = getAllRunningSessionVO();
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return alist;
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<Map<String, String>> getAllRunningSessionVO() throws Exception {
|
||||
List<Map<String, String>> retList = new ArrayList<Map<String, String>>();
|
||||
|
||||
HashMap<String, BatchDoc> allDocs = BatchRunningJobManager.getInstance().getAllRunningDocuments();
|
||||
Object[] uuids = allDocs.keySet().toArray();
|
||||
|
||||
for (int i=0; i<allDocs.size(); i++) {
|
||||
BatchDoc batchDoc = (BatchDoc) BatchRunningJobManager.getInstance().getRunningDocument((String)uuids[i]);
|
||||
SocketService service = (SocketService) BatchRunningJobManager.getInstance().getRunningSocketService((String)uuids[i]);
|
||||
|
||||
//socket 이 null 이거나 remote address 가 null 이어서 remote에 연결되지 않은 소켓은 목록에 추가 안함
|
||||
if (service == null ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Date date = new Date(service.getFirstActivity());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||
String timestamp = sdf.format(date);
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put( "serverName" , batchDoc.getBatchMsg().getBody().getWLIServerName());
|
||||
map.put( "processName" , batchDoc.getBatchMsg().getHeader().getProcessName());
|
||||
map.put( "organName" , batchDoc.getBatchMsg().getHeader().getInstitutionName());
|
||||
map.put( "processType" , batchDoc.getBatchMsg().getHeader().getProcessType());
|
||||
map.put( "uuid" , batchDoc.getBatchMsg().getHeader().getUUID());
|
||||
map.put( "adapterGroupName", service.getContext()==null? "" : service.getContext().getAdapterGroupName());
|
||||
map.put( "adapterName" , service.getContext()==null? "" : service.getContext().getAdapterName());
|
||||
map.put( "localIpPort" , service.getCurrentSocket() == null || service.getCurrentSocket().getLocalAddress() == null?
|
||||
"" :
|
||||
service.getCurrentSocket().getLocalAddress().getHostAddress() + ":" + service.getCurrentSocket().getLocalPort());
|
||||
map.put( "remoteIpPort" , service.getCurrentSocket() == null || service.getCurrentSocket().getInetAddress() == null ?
|
||||
"" :
|
||||
service.getCurrentSocket().getInetAddress().getHostAddress() + ":" + service.getCurrentSocket().getPort());
|
||||
map.put( "startTimeStamp" , timestamp);
|
||||
map.put( "status" , "연결됨");
|
||||
retList.add(map);
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.eactive.eai.agent.adapter.socket;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class SocketSessionVO implements Serializable//, Comparable
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String serverName = ""; //서버인스턴스명
|
||||
private String uuid = ""; //UUID
|
||||
private String processType = ""; //업무유형
|
||||
private String processCode = ""; //업무코드
|
||||
private String processName = ""; //업무명
|
||||
private String organCode = ""; //대외기관코드
|
||||
private String organName = ""; //대외기관명
|
||||
private String adapterGroupName = ""; //어댑터그룹명
|
||||
private String adapterName = ""; //어댑터명
|
||||
private String localIp = ""; //로컬IP
|
||||
private String localPort = ""; //로컬Port
|
||||
private String remoteIp = ""; //리모트IP
|
||||
private String remotePort = ""; //리모트Port
|
||||
private long startTimeStamp = 0; //연결시작시간
|
||||
private long endTimeStamp = 0; //연결종료시간 (배치에서는 무의미함)
|
||||
private String status = ""; //Session Service 상태
|
||||
|
||||
public void setServerName (String arg) { this.serverName = arg; }
|
||||
public void setUuid (String arg) { this.uuid = arg; }
|
||||
public void setProcessType (String arg) { this.processType = arg; }
|
||||
public void setProcessCode (String arg) { this.processCode = arg; }
|
||||
public void setProcessName (String arg) { this.processName = arg; }
|
||||
public void setOrganCode (String arg) { this.organCode = arg; }
|
||||
public void setOrganName (String arg) { this.organName = arg; }
|
||||
public void setAdapterGroupName(String arg) { this.adapterGroupName = arg; }
|
||||
public void setAdapterName (String arg) { this.adapterName = arg; }
|
||||
public void setLocalIp (String arg) { this.localIp = arg; }
|
||||
public void setLocalPort (String arg) { this.localPort = arg; }
|
||||
public void setRemoteIp (String arg) { this.remoteIp = arg; }
|
||||
public void setRemotePort (String arg) { this.remotePort = arg; }
|
||||
public void setStartTimeStamp (long arg) { this.startTimeStamp = arg; }
|
||||
public void setEndTimeStamp (long arg) { this.endTimeStamp = arg; }
|
||||
public void setStatus (String arg) { this.status = arg; }
|
||||
|
||||
public String getServerName () { return this.serverName ; }
|
||||
public String getUuid () { return this.uuid ; }
|
||||
public String getProcessType () { return this.processType ; }
|
||||
public String getProcessCode () { return this.processCode ; }
|
||||
public String getProcessName () { return this.processName ; }
|
||||
public String getOrganCode () { return this.organCode ; }
|
||||
public String getOrganName () { return this.organName ; }
|
||||
public String getAdapterGroupName() { return this.adapterGroupName; }
|
||||
public String getAdapterName () { return this.adapterName ; }
|
||||
public String getLocalIp () { return this.localIp ; }
|
||||
public String getLocalPort () { return this.localPort ; }
|
||||
public String getRemoteIp () { return this.remoteIp ; }
|
||||
public String getRemotePort () { return this.remotePort ; }
|
||||
public long getStartTimeStamp () { return this.startTimeStamp ; }
|
||||
public long getEndTimeStamp () { return this.endTimeStamp ; }
|
||||
public String getStatus () { return this.status ; }
|
||||
|
||||
// public int compareTo(Object arg0) {
|
||||
// SocketSessionVO info = (SocketSessionVO) arg0;
|
||||
// int compare = 0;
|
||||
// if ((compare = this.getServerName ().compareTo(info.getServerName ())) != 0) return compare;
|
||||
// if ((compare = this.getAdapterGroupName().compareTo(info.getAdapterGroupName())) != 0) return compare;
|
||||
// if ((compare = this.getAdapterName ().compareTo(info.getAdapterName ())) != 0) return compare;
|
||||
// return (int) (this.getStartTimeStamp() - info.getStartTimeStamp());
|
||||
// }
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("\nSocketSessionVO [ ");
|
||||
sb.append("serverName=" ).append(serverName );
|
||||
sb.append(", uuid=" ).append(uuid );
|
||||
sb.append(", processType=" ).append(processType );
|
||||
sb.append(", processCode=" ).append(processCode );
|
||||
sb.append(", processName=" ).append(processName );
|
||||
sb.append(", organCode=" ).append(organCode );
|
||||
sb.append(", organName=" ).append(organName );
|
||||
sb.append(", adapterGroupName=").append(adapterGroupName);
|
||||
sb.append(", adapterName=" ).append(adapterName );
|
||||
sb.append(", localIp=" ).append(localIp );
|
||||
sb.append(", localPort=" ).append(localPort );
|
||||
sb.append(", remoteIp=" ).append(remoteIp );
|
||||
sb.append(", remotePort=" ).append(remotePort );
|
||||
sb.append(", startTimeStamp=" ).append(startTimeStamp );
|
||||
sb.append(", endTimeStamp=" ).append(endTimeStamp );
|
||||
sb.append(", status=" ).append(status );
|
||||
sb.append(" ]");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.eactive.eai.agent.adapter.socket;
|
||||
|
||||
import com.eactive.eai.adapter.socket.config.SocketAdapterManager;
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.running.BatchRunningJobManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class SocketStartStopCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public static final String START_SOCKET_SERVER = "START_SOCKET_SERVER";
|
||||
public static final String STOP_SOCKET_SERVER = "STOP_SOCKET_SERVER";
|
||||
public static final String START_SOCKET_SESSION = "START_SOCKET_SESSION";
|
||||
public static final String STOP_SOCKET_SESSION = "STOP_SOCKET_SESSION";
|
||||
|
||||
|
||||
public SocketStartStopCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
String startStopType = argArray[0]; //기동중지 구분
|
||||
String adapterGroupName = argArray[1]; //어댑터그룹명
|
||||
String adapterName = argArray[2]; //어댑터명
|
||||
String uuid = argArray.length<4? "":argArray[3]; //UUID (세션종료시만 사용)
|
||||
logger.info("※ 기동/종료구분 : "+ startStopType);
|
||||
logger.info("※ 어댑터그룹 : "+ adapterGroupName);
|
||||
logger.info("※ 어댑터 : "+ adapterName);
|
||||
logger.info("※ UUID : "+ uuid);
|
||||
|
||||
String retValue = "";
|
||||
if (startStopType.equals(START_SOCKET_SERVER)) {
|
||||
retValue = SocketAdapterManager.getInstance().start(adapterGroupName, adapterName);
|
||||
|
||||
} else if (startStopType.equals(STOP_SOCKET_SERVER)) {
|
||||
retValue = SocketAdapterManager.getInstance().stop(adapterGroupName, adapterName);
|
||||
|
||||
} else if (startStopType.equals(STOP_SOCKET_SESSION)) {
|
||||
logger.debug("★★★★★★★★★★★★★★★★ SocketStartStopCommand : 사용자에 의한 Socket Session 강제 종료가 요청되었습니다. ★★★★★★★★★★★★★★★★");
|
||||
BatchRunningJobManager.getInstance().closeRunningSocket(uuid);
|
||||
retValue = "Socket Session 강제 종료가 완료 되었습니다.";
|
||||
|
||||
} else {
|
||||
throw new Exception("Start/Stop 구분 파라미터 오류");
|
||||
}
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return retValue;
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// private void stopSession(String adapterGroupName, String adapterName, String remoteIpPort) throws Exception {
|
||||
//
|
||||
// String[] TempIpPort = remoteIpPort.split(":");
|
||||
// String remoteIp = TempIpPort[0];
|
||||
// String remotePort = TempIpPort[1];
|
||||
//
|
||||
// //소켓서버에 연결된 전체 Session 정보를 메모리에서 조회
|
||||
// //(연결된 Session 이 없어도 각 AdapterGroup 별 LinkedList 정보가 존재함)
|
||||
// HashMap allSessions = SocketAdapterManager.getInstance().getAllSessions();
|
||||
// if (allSessions == null || allSessions.size() == 0) throw new Exception("모든 어댑터그룹의 세션 정보가 비어있습니다.");
|
||||
//
|
||||
// //AdapterGroup 명 조회
|
||||
// Object[] adapterGroupNames = allSessions.keySet().toArray();
|
||||
// //Arrays.sort(adapterGroupNames);
|
||||
//
|
||||
// //===================================================================================
|
||||
// //AdapterGroup 별 LOOP
|
||||
// for (int i=0; i<allSessions.size(); i++) {
|
||||
//
|
||||
// logger.debug("> "+ adapterGroupNames[i]);
|
||||
// if (!adapterGroupName.equals(adapterGroupNames[i])) continue;
|
||||
//
|
||||
// //해당 AdapterGroup의 현재 연결된 Session 정보 조회
|
||||
// //(Adapter 별로 분리하지 않고 연결 순서대로 들어가있다)
|
||||
// LinkedList serviceList = (LinkedList) allSessions.get(adapterGroupNames[i]);
|
||||
// if (serviceList == null || serviceList.size() == 0) break;
|
||||
//
|
||||
// //-------------------------------------------------------------------
|
||||
// //Adapter 별 LOOP
|
||||
// for (int k=0; k<serviceList.size(); k++) {
|
||||
// InboundServer session = (InboundServer) serviceList.get(k);
|
||||
// AdapterVO avo = session.getContext().getAdapterVO();
|
||||
// logger.debug(" > "+ avo.getName() +" / "+ session.getRemoteIPAddress() +" / "+ session.getRemotePort());
|
||||
//
|
||||
// if (adapterName.equals(avo.getName()) &&
|
||||
// remoteIp.equals(session.getRemoteIPAddress()) &&
|
||||
// remotePort.equals(session.getRemotePort()) ) {
|
||||
//
|
||||
// session.disconnect();
|
||||
// SocketAdapterManager.getInstance().removeConnection(session);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// //-------------------------------------------------------------------
|
||||
// }
|
||||
// //===================================================================================
|
||||
//
|
||||
// throw new Exception("해당 세션이 이미 종료 되었습니다.");
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.eactive.eai.agent.code;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.code.CodeMessageManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 CodeMessageManager의 정보 변경
|
||||
* 2. 처리 개요 : CodeMessageManager에 CodeMessageVO제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class RemoveCodeMessageCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoveCodeMessageCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : CodeMessageManager에 CodeMessageVO제거
|
||||
* 2. 처리 개요 : CodeMessageManager에 CodeMessageVO제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String msgKey = (String) args;
|
||||
CodeMessageManager.getInstance().removeMessage(msgKey);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.eactive.eai.agent.code;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.code.CodeMessageManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 CodeMessageManager의 정보 변경
|
||||
* 2. 처리 개요 : CodeMessageManager에 CodeMessageVO 데이터 변경
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class UpdateCodeMessageCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdateCodeMessageCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : CodeMessageManager에 CodeMessageVO 데이터 변경
|
||||
* 2. 처리 개요 : CodeMessageManager에 CodeMessageVO 데이터 변경
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if( !(args instanceof java.lang.String) ) {
|
||||
String rspErrorCode = "RECEAIMCM001";
|
||||
String msg = makeException(rspErrorCode, null);
|
||||
if (logger.isError()) logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
String key = (String) args;
|
||||
|
||||
try{
|
||||
CodeMessageManager manager = CodeMessageManager.getInstance();
|
||||
manager.reload(key);
|
||||
}catch (Exception e){
|
||||
String rspErrorCode = "RECEAIMCM002";
|
||||
String msg = makeException(rspErrorCode, e);
|
||||
if (logger.isError()) logger.error(msg,e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.eactive.eai.agent.command;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Agent에 의해 실행될 Command 를 정의하기 위한 base class
|
||||
* 2. 처리 개요 : Agent에 의해 실행될 Command 를 정의하기 위한 base class
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*
|
||||
*/
|
||||
public abstract class Command implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** Command object name */
|
||||
protected String name;
|
||||
/** Command Arguments */
|
||||
protected Object args;
|
||||
|
||||
private HashMap<String,String> errorCode ;
|
||||
|
||||
static {
|
||||
HashMap<String,String> errorCode = new HashMap<String,String>();
|
||||
errorCode.put("RECEAIMCM001", "Command 이름[{1}] 유효하지 않은 파라메터 타입 - {2}");
|
||||
errorCode.put("RECEAIMCM002", "Command 이름[{1}] execute 메소드 실행중 에러가 발생 - {2}");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Default Constructor
|
||||
* 2. 처리 개요 : name을 Class name으로 setting한다.
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public Command() {
|
||||
this.name = this.getClass().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : 파리미터의 name을 setting하는 Constructor
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param name Command object name
|
||||
**/
|
||||
public Command(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : command의 arguments를 setting하는 setter method
|
||||
* 2. 처리 개요 : command의 arguments를 setting하는 setter method
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param args command arguments
|
||||
**/
|
||||
public void setArgs(Object args) {
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : command의 business logic method<br>
|
||||
* 2. 처리 개요 : command의 business logic method<br>
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException
|
||||
**/
|
||||
public abstract Object execute() throws CommandException;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 에러 Message 생성
|
||||
* 2. 처리 개요 : 에러코드와 Exception cause로 에러 메시지 생성
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param rspErrorcode EAI 에러코드
|
||||
* @param cause Exception cause
|
||||
* @return String 에러 메시지
|
||||
* @exception CommandException
|
||||
**/
|
||||
protected String makeException(String rspErrorCode, Throwable cause) throws CommandException{
|
||||
String[] msgArgs = new String[2];
|
||||
msgArgs[0] = name;
|
||||
if(cause == null){
|
||||
msgArgs[1] = args.toString();
|
||||
}
|
||||
else{
|
||||
msgArgs[1] = cause.getMessage();
|
||||
}
|
||||
String msg = makeMessage((String)errorCode.get(rspErrorCode),msgArgs) ;
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
protected static String makeMessage(String msg, String[] args) {
|
||||
String keyword = null, head = null, tail = null;
|
||||
int idx = -1;
|
||||
for(int i=0;i<args.length;i++) {
|
||||
keyword = "{"+(i+1)+"}";
|
||||
idx = msg.indexOf(keyword);
|
||||
if(idx == -1) {
|
||||
continue;
|
||||
}
|
||||
head = msg.substring(0,idx);
|
||||
tail = msg.substring(idx+keyword.length());
|
||||
msg = head+args[i]+tail;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.eactive.eai.agent.command;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Command Logic을 실행하다 발생될 User Define 오류를 처리하기 위한 Exception class<br>
|
||||
* 2. 처리 개요 : Command Logic을 실행하다 발생될 User Define 오류를 처리하기 위한 Exception class<br>
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*
|
||||
*/
|
||||
public class CommandException extends Exception {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Default Constructor
|
||||
* 2. 처리 개요 : Default Constructor
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public CommandException() {
|
||||
super("CommandException is occured.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Exception message를 초기화하는 Constructor
|
||||
* 2. 처리 개요 : Exception message를 초기화하는 Constructor
|
||||
* -
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param msg Exception message
|
||||
**/
|
||||
public CommandException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.eactive.eai.agent.command;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
/**
|
||||
* 1. 기능 : 공통 command
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*
|
||||
*/
|
||||
public class CommonCommand extends Command {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public CommonCommand(String name,Object args) {
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
public CommonCommand(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
if (name.indexOf(".") >=0 ){
|
||||
try {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class cl = Class.forName(this.name);
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
Constructor constructor = cl.getConstructor(String.class);
|
||||
Object obj = constructor.newInstance(this.name);
|
||||
Command c = (Command)obj;
|
||||
c.setArgs(args);
|
||||
return c.execute();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String rspErrorCode = "RECEAIMCM002";
|
||||
String msg = makeException(rspErrorCode, null);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}else{
|
||||
String rspErrorCode = "RECEAIMCM001";
|
||||
String msg = makeException(rspErrorCode, null);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.eactive.eai.agent.flowController;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.flowController.BatchTargetVO;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerDAO;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerManager;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class AddBatchTargetCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : AddBatchTargetCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public AddBatchTargetCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : FlowControllerManager BatchTargetVO 추가
|
||||
* 2. 처리 개요 : FlowControllerManager BatchTargetVO 추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception CommandException
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
String processCode = argArray[0];
|
||||
String organCode = argArray[1];
|
||||
// add by kscheon
|
||||
// String adapterGroupName = argArray[2];
|
||||
|
||||
FlowControllerDAO dao = (FlowControllerDAO)DAOFactory.newInstance().create(FlowControllerDAO.class);
|
||||
BatchTargetVO vo = dao.getBatchTargetVO(processCode, organCode);
|
||||
|
||||
FlowControllerManager.getInstance().getTargets().put(processCode + organCode, vo);
|
||||
|
||||
// //20080429 Adapter에 대외기관 코드 추가 - by kscheon - start
|
||||
// AdapterGroupVO current = AdapterManager.getInstance().getAdapterGroupVO(adapterGroupName);
|
||||
// if (current == null){
|
||||
// logger.info(this.name +" Manager's AdapterGroupVO is null. -- "+adapterGroupName);
|
||||
//
|
||||
// }else {
|
||||
// current.setBatchProcessCode(processCode);
|
||||
// current.setBatchInstitutionCode(organCode);
|
||||
// }
|
||||
// //20080429 Adapter에 대외기관 코드 추가 - by kscheon - end
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.eactive.eai.agent.flowController;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RemoveBatchTargetCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : RemoveBatchTargetCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @paramw
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public RemoveBatchTargetCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : RemoveBatchTargetCommand BatchTargetVO 제거
|
||||
* 2. 처리 개요 : RemoveBatchTargetCommand BatchTargetVO 제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception CommandException
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
String processCode = argArray[0];
|
||||
String organCode = argArray[1];
|
||||
|
||||
FlowControllerManager.getInstance().getTargets().remove(processCode + organCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.eactive.eai.agent.flowController;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.flowController.BatchTargetVO;
|
||||
import com.eactive.eai.batch.flowController.DemandTargetVO;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerDAO;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerManager;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class UpdateBatchTargetCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : UpdateBatchTargetCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public UpdateBatchTargetCommand() {
|
||||
super("UpdateBatchTargetCommand");
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : UpdateBatchTargetCommand BatchTargetVO 변경
|
||||
* 2. 처리 개요 : UpdateBatchTargetCommand BatchTargetVO 변경
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception CommandException
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
String processCode = argArray[0];
|
||||
String organCode = argArray[1];
|
||||
String organStatus = (argArray.length > 2)? argArray[2] : "";
|
||||
|
||||
//Framework 에서 장애(회복)통보 전문 수신시 대외기관 상태를 변경하는 경우
|
||||
//테이블 update 가 commit이 안된 상태이므로 메모리의 정보를 직접 변경해야 한다.
|
||||
if (!organStatus.equals("")) {
|
||||
logger.debug(" - 대외기관 요구송수신 연결 정보 Memory update ("+ processCode +", "+ organCode +", "+ (organStatus.equals(DemandTargetVO.ORGAN_SOCKET_STATUS_ERROR)? "장애" : "정상") +")");
|
||||
DemandTargetVO[] demandTargetList = FlowControllerManager.getInstance().getRemoteHostInfo(processCode, organCode);
|
||||
for (int i=0; i<demandTargetList.length; i++) {
|
||||
demandTargetList[i].setOrganSocketStatus(organStatus);
|
||||
logger.debug(" > 대외기관 요구송수신 연결 정보 ☞ (IP: "+ demandTargetList[i].getIpAddress() +", Port: "+ demandTargetList[i].getPortNumber() +", ID: "+ demandTargetList[i].getSocketID() +", PW: "+ demandTargetList[i].getSocketPwd() +", Timeout: "+ demandTargetList[i].getTimeoutInterval() +", OrganStatus: "+ demandTargetList[i].getOrganSocketStatus() +")");
|
||||
}
|
||||
|
||||
//관리 UI에서 대외기관 정보를 수정한 경우
|
||||
} else {
|
||||
FlowControllerDAO dao = (FlowControllerDAO)DAOFactory.newInstance().create(FlowControllerDAO.class);
|
||||
BatchTargetVO vo = dao.getBatchTargetVO(processCode, organCode);
|
||||
|
||||
FlowControllerManager.getInstance().getTargets().put(processCode + organCode, vo);
|
||||
}
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.agent.flowController;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
import com.eactive.eai.adapter.AdapterManager;
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.flowController.BatchTargetVO;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerDAO;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerManager;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class UpdateBatchTargetForRTSCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : UpdateBatchTargetForRTSCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public UpdateBatchTargetForRTSCommand() {
|
||||
super("UpdateBatchTargetForRTSCommand");
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : UpdateBatchTargetForRTSCommand BatchTargetVO 변경
|
||||
* 2. 처리 개요 : UpdateBatchTargetForRTSCommand BatchTargetVO 변경
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception CommandException
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
String processCode = argArray[0];
|
||||
String organCode = argArray[1];
|
||||
// add by kscheon
|
||||
String adapterGroupName = argArray[2];
|
||||
|
||||
FlowControllerDAO dao = (FlowControllerDAO)DAOFactory.newInstance().create(FlowControllerDAO.class);
|
||||
BatchTargetVO vo = dao.getBatchTargetVO(processCode, organCode);
|
||||
|
||||
FlowControllerManager.getInstance().getTargets().put(processCode + organCode, vo);
|
||||
|
||||
// 20080429 Adapter에 대외기관 코드 추가 - by kscheon - start
|
||||
AdapterGroupVO current = AdapterManager.getInstance().getAdapterGroupVO(adapterGroupName);
|
||||
|
||||
if (current == null){
|
||||
logger.info(this.name +" Manager's AdapterGroupVO is null. -- "+adapterGroupName);
|
||||
|
||||
} else {
|
||||
current.setBatchProcessCode(processCode);
|
||||
current.setBatchInstitutionCode(organCode);
|
||||
}
|
||||
//20080429 Adapter에 대외기관 코드 추가 - by kscheon - end
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.eactive.eai.agent.ftp;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.inbound.remote.RemoteTransfer;
|
||||
import com.eactive.eai.inbound.remote.RemoteTransferLogKeys;
|
||||
import com.eactive.eai.inbound.remote.RemoteTransferLogManager;
|
||||
import com.eactive.eai.inbound.remote.RemoteTransferLogVO;
|
||||
|
||||
public class RemoteTransferCommand extends Command
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoteTransferCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
String[] param = (String[])args;
|
||||
String logID = param[0];
|
||||
String userId = param[1];
|
||||
|
||||
try {
|
||||
logger.debug("[RemoteTransferCommand]logID-->[" + logID + "]");
|
||||
RemoteTransferLogVO log = RemoteTransferLogManager.getInstance().getRemoteTransferLog(logID);
|
||||
RemoteTransfer transfer = new RemoteTransfer();
|
||||
if (log.getSendRecvYn().equals(RemoteTransferLogKeys.SEND)){
|
||||
transfer.sendFile(log.getBjobBzwkDstcd(), log.getOsidInstiDstcd(), log.getTrsmtFileName(), RemoteTransferLogKeys.START_BY_UI, userId, false);
|
||||
return transfer.sendFile(log.getBjobBzwkDstcd(), log.getOsidInstiDstcd(), log.getTrsmtFileName(), RemoteTransferLogKeys.START_BY_UI, userId, true);
|
||||
}else{
|
||||
return transfer.recvFile( log.getRmtFileTrsmtPathName() + "/" + log.getTrsmtFileName(), RemoteTransferLogKeys.START_BY_UI, userId);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.eactive.eai.agent.holiday;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.eventscheduler.holiday.HolidayManager;
|
||||
import com.eactive.eai.batch.eventscheduler.holiday.HolidayVO;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 HolidayManager의 정보 변경
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class RemoveHolidayCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoveHolidayCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : HolidayManager에 HolidayVO제거
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
String holidayType = argArray[0];
|
||||
String holiday = argArray[1];
|
||||
String description = argArray[2];
|
||||
|
||||
HolidayVO vo = new HolidayVO(holidayType, holiday, description);
|
||||
HolidayManager manager = HolidayManager.getInstance();
|
||||
|
||||
manager.removeHoliday(vo);
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.eactive.eai.agent.holiday;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.eventscheduler.holiday.HolidayManager;
|
||||
import com.eactive.eai.batch.eventscheduler.holiday.HolidayVO;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 HolidayManager의 정보 변경
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class UpdateHolidayCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdateHolidayCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : HolidayManager에 HolidayVO추가
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
String holidayType = argArray[0];
|
||||
String holiday = argArray[1];
|
||||
String description = argArray[2];
|
||||
|
||||
|
||||
HolidayVO vo = new HolidayVO(holidayType, holiday, description);
|
||||
|
||||
HolidayManager manager = HolidayManager.getInstance();
|
||||
manager.setHoliday(vo);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.eactive.eai.agent.kikwaninfo;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.kikwanInfo.KikwanInfoManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 HolidayManager의 정보 변경
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class RemoveKikwaninfoCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoveKikwaninfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : HolidayManager에 HolidayVO제거
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String kikwanCd = (String) args;
|
||||
KikwanInfoManager manager = KikwanInfoManager.getInstance();
|
||||
|
||||
manager.removeKikwanInfo(kikwanCd);
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.eactive.eai.agent.kikwaninfo;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.kikwanInfo.KikwanInfoManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 HolidayManager의 정보 변경
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class UpdateKikwaninfoCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdateKikwaninfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : HolidayManager에 HolidayVO추가
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String kikwanCd = (String) args;
|
||||
|
||||
KikwanInfoManager manager = KikwanInfoManager.getInstance();
|
||||
manager.setKikwanInfo(kikwanCd);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
//package com.eactive.eai.agent.makeDir;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Collections;
|
||||
//
|
||||
//import com.eactive.eai.agent.command.Command;
|
||||
//import com.eactive.eai.agent.command.CommandException;
|
||||
//import com.eactive.eai.common.property.PropManager;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import com.eactive.eai.inbound.remote.NDMTransferByScript;
|
||||
//
|
||||
//
|
||||
//public class GetScriptListCommand extends Command
|
||||
//{
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// private static final long serialVersionUID = 1L;
|
||||
//
|
||||
// public GetScriptListCommand() {
|
||||
// super("GetScriptListCommand");
|
||||
// }
|
||||
//
|
||||
// public Object execute() throws CommandException
|
||||
// {
|
||||
// Logger logger = LoggerFactory.getLogger(ElinkLogger.LOGGER_DEFAULT);
|
||||
// logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
//
|
||||
// ArrayList<String> returnList = new ArrayList<String>();
|
||||
// String sendShell = PropManager.getInstance().getProperty(NDMTransferByScript.PROP_GROUP_REMOTE_TRANSFER_NDM, NDMTransferByScript.PROP_NDM_SEND_SCRIPT_PATH);
|
||||
// if ( sendShell == null ){
|
||||
// logger.error(this.name + "PROPERTY가 등록되어 있지 않습니다.[" + NDMTransferByScript.PROP_GROUP_REMOTE_TRANSFER_NDM + "],[" + NDMTransferByScript.PROP_NDM_SEND_SCRIPT_PATH + "]");
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// File file = new File(sendShell);
|
||||
// String path = file.getParent();
|
||||
//
|
||||
// file = new File(path);
|
||||
//
|
||||
// if ( file.exists() ) {
|
||||
// File[] tmplist = file.listFiles();
|
||||
// ArrayList<File> al = new ArrayList<File>();
|
||||
// for ( int inx = 0; inx < tmplist.length; inx++){
|
||||
// al.add(tmplist[inx]);
|
||||
// }
|
||||
//
|
||||
// Collections.sort( al );
|
||||
//
|
||||
// int len = al.size();
|
||||
// File[] list = new File[len];
|
||||
// for ( int inx = 0; inx < len; inx++ ){
|
||||
// list[inx]=al.get(inx);
|
||||
// }
|
||||
// for ( int inx = 0; inx < list.length; inx++){
|
||||
// file = list[inx];
|
||||
// if ( file.isFile()){
|
||||
// String fileName = file.getPath();
|
||||
// if ( fileName.endsWith( ".sh" ) )
|
||||
// {
|
||||
// returnList.add( fileName );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return returnList;
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.eactive.eai.agent.makeDir;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class MakeDirOrganCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MakeDirOrganCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
|
||||
String processCode = argArray[0];
|
||||
String organCode = argArray[1];
|
||||
|
||||
BatchDirUtil.makeDirOrgan(processCode, organCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.eactive.eai.agent.makeDir;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class MakeDirProcessCommand extends Command
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public MakeDirProcessCommand() {
|
||||
super("MakeDirProcessCommand");
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
|
||||
String processCode = argArray[0];
|
||||
|
||||
BatchDirUtil.makeDirProcess(processCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.eactive.eai.agent.makeDir;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RemoveDirOrganCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoveDirOrganCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
|
||||
String processCode = argArray[0];
|
||||
String organCode = argArray[1];
|
||||
|
||||
BatchDirUtil.removeDirOrgan(processCode, organCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.eactive.eai.agent.makeDir;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RemoveDirProcessCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoveDirProcessCommand() {
|
||||
super("RemoveDirProcessCommand");
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
|
||||
String processCode = argArray[0];
|
||||
|
||||
BatchDirUtil.removeDirProcess(processCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.eactive.eai.agent.osd;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 OutsideManager의 정보 변경
|
||||
* 2. 처리 개요 : OutsideManager에 OutsideVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class RemoveOutsideCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoveOutsideCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : OutsideManager에 OutsideVO추가
|
||||
* 2. 처리 개요 : OutsideManager에 OutsideVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
String[] argArray = (String[]) args;
|
||||
String batchCode = argArray[0];
|
||||
String outCode = argArray[1];
|
||||
|
||||
try {
|
||||
|
||||
OutsideManager manager = OutsideManager.getInstance();
|
||||
|
||||
manager.removeOutsideInfo(batchCode, outCode);
|
||||
manager.removeOutsideLinkInfo(batchCode, outCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.eactive.eai.agent.osd;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 OutsideManager의 정보 변경
|
||||
* 2. 처리 개요 : OutsideManager에 OutsideVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class UpdateOutsideCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdateOutsideCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : OutsideManager의 OutsideVO, OustsideLinkVO변경
|
||||
* 2. 처리 개요 : OutsideManager의 OutsideVO, OustsideLinkVO변
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
OutsideManager manager = OutsideManager.getInstance();
|
||||
|
||||
try {
|
||||
String[] argArray = (String[]) args;
|
||||
String processCode = argArray[0];
|
||||
String organCode = argArray[1];
|
||||
|
||||
manager.updateOutsideInfo(processCode, organCode);
|
||||
manager.updateOutsideLinkInfo(processCode, organCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.eactive.eai.agent.property;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 PropManager의 정보 변경
|
||||
* 2. 처리 개요 : PropManager에서 해당 PropGroupVO 제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class RemovePropertyCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : RemovePropertyCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public RemovePropertyCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : PropManager에서 해당 PropGroupVO 제거
|
||||
* 2. 처리 개요 : PropGroupVO EAISvrInstNm이 DEFAULT_SERVER(ALL) 이거나 LocalServer인 경우
|
||||
* PropManager에서 해당 PropGroupVO 제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception CommandException
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
PropManager.getInstance().removePropGroupVO((String)args);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.eactive.eai.agent.property;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.property.PropGroupVO;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 PropManager의 정보 변경
|
||||
* 2. 처리 개요 : PropManager에서 해당 PropGroupVO 의 데이터 수정
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class UpdatePropertyCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : UpdatePropertyCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public UpdatePropertyCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : PropManager에서 해당 PropGroupVO 의 데이터 수정
|
||||
* 2. 처리 개요 : PropGroupVO EAISvrInstNm이 DEFAULT_SERVER(ALL) 이거나 LocalServer인 경우
|
||||
* PropManager에서 해당 PropGroupVO 의 데이터 수정
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception CommandException
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
PropGroupVO vo = PropManager.getInstance().getPropGroupVOinDB((String)args);
|
||||
|
||||
logger.info(this.name +": (Agent Argument) PropGroupName=["+vo.getName()+"]");
|
||||
|
||||
PropManager.getInstance().setPropGroupVO((String)args, vo);
|
||||
|
||||
/**
|
||||
* FileLogger log.level modify
|
||||
*/
|
||||
if(((String)args).startsWith("FileLogger{")){
|
||||
com.eactive.eai.common.util.Logger.reloadLogLevel((String)args);
|
||||
}
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.agent.rule.dirInfo;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.dirInfo.DirInfoManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RefreshAllJobCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RefreshAllJobCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
try {
|
||||
DirInfoManager.getInstance().loadAllFileInfo();
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "sucess";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.eactive.eai.agent.rule.nodeinfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.nodeinfo.NodeInfoDAO;
|
||||
import com.eactive.eai.batch.rule.nodeinfo.NodeInfoManager;
|
||||
import com.eactive.eai.batch.rule.nodeinfo.NodeInfoVO;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RemoveNodeInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoveNodeInfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" " + msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = (String)args;
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
NodeInfoDAO dao = (NodeInfoDAO)DAOFactory.newInstance().create(NodeInfoDAO.class);
|
||||
HashMap<String, ArrayList<NodeInfoVO>> map = dao.getAllNodeInfo();
|
||||
ArrayList<NodeInfoVO> al = map.get(strRuleCode);
|
||||
if (al == null) {
|
||||
NodeInfoManager.getInstance().removeRuleCodeArray(strRuleCode);
|
||||
}else{
|
||||
NodeInfoManager.getInstance().setRuleCodeArray(strRuleCode, al);
|
||||
}
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.eactive.eai.agent.rule.nodeinfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.nodeinfo.NodeInfoDAO;
|
||||
import com.eactive.eai.batch.rule.nodeinfo.NodeInfoManager;
|
||||
import com.eactive.eai.batch.rule.nodeinfo.NodeInfoVO;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class UpdateNodeInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdateNodeInfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" " + msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = (String)args;
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
NodeInfoDAO dao = (NodeInfoDAO)DAOFactory.newInstance().create(NodeInfoDAO.class);
|
||||
HashMap<String, ArrayList<NodeInfoVO>> map = dao.getAllNodeInfo();
|
||||
ArrayList<NodeInfoVO> al = map.get(strRuleCode);
|
||||
if (al == null) {
|
||||
String errMsg = this.name + ": error >> RuleCode [" + strRuleCode + "] not found in DBMS";
|
||||
logger.error(errMsg);
|
||||
return errMsg;
|
||||
}
|
||||
NodeInfoManager.getInstance().setRuleCodeArray(strRuleCode, al);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.eactive.eai.agent.rule.phaseinfo;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.phaseinfo.PhaseInfoManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
|
||||
public class RemovePhaseInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemovePhaseInfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" "+ msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = (String)args;
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
PhaseInfoManager.getInstance().removeRuleCodeArray(strRuleCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.eactive.eai.agent.rule.phaseinfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.phaseinfo.PhaseInfoDAO;
|
||||
import com.eactive.eai.batch.rule.phaseinfo.PhaseInfoManager;
|
||||
import com.eactive.eai.batch.rule.phaseinfo.PhaseInfoVO;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class UpdatePhaseInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdatePhaseInfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" "+ msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = (String)args;
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
PhaseInfoDAO dao = (PhaseInfoDAO)DAOFactory.newInstance().create(PhaseInfoDAO.class);
|
||||
HashMap<String, ArrayList<PhaseInfoVO>> map = dao.getAllPhaseInfos();
|
||||
ArrayList<PhaseInfoVO> al = map.get(strRuleCode);
|
||||
if (al == null) {
|
||||
String errMsg = this.name + ": error >> RuleCode [" + strRuleCode + "] not found in DBMS";
|
||||
logger.error(errMsg);
|
||||
return errMsg;
|
||||
}
|
||||
PhaseInfoManager.getInstance().setRuleCodeArray(strRuleCode, al);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.eactive.eai.agent.rule.ruleinfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoDAO;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoManager;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoVO;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class AddRuleInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AddRuleInfoCommand() {
|
||||
super("AddRuleInfoCommand");
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" "+ msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = (String)args;
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
RuleInfoDAO dao = (RuleInfoDAO)DAOFactory.newInstance().create(RuleInfoDAO.class);
|
||||
HashMap<String, RuleInfoVO> map = dao.getAllRuleInfo();
|
||||
RuleInfoVO vo = map.get(strRuleCode);
|
||||
if (vo == null) {
|
||||
String errMsg = this.name + ": error >> RuleCode [" + strRuleCode + "] not found in DBMS";
|
||||
logger.error(errMsg);
|
||||
return errMsg;
|
||||
}
|
||||
RuleInfoManager.getInstance().setRuleCodeArray(strRuleCode, vo);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.eactive.eai.agent.rule.ruleinfo;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RemoveRuleInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public RemoveRuleInfoCommand() {
|
||||
super("RemoveRuleInfoCommand");
|
||||
}
|
||||
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" "+ msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = (String)args;
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
RuleInfoManager.getInstance().removeRuleCodeArray(strRuleCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.eactive.eai.agent.rule.ruleinfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoDAO;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoManager;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoVO;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class UpdateRuleInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdateRuleInfoCommand() {
|
||||
super("UpdateRuleInfoCommand");
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" "+ msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = (String)args;
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
RuleInfoDAO dao = (RuleInfoDAO)DAOFactory.newInstance().create(RuleInfoDAO.class);
|
||||
HashMap<String, RuleInfoVO> map = dao.getAllRuleInfo();
|
||||
RuleInfoVO vo = map.get(strRuleCode);
|
||||
if (vo == null) {
|
||||
String errMsg = this.name + ": error >> RuleCode [" + strRuleCode + "] not found in DBMS";
|
||||
logger.error(errMsg);
|
||||
return errMsg;
|
||||
}
|
||||
RuleInfoManager.getInstance().setRuleCodeArray(strRuleCode, vo);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.eactive.eai.agent.rule.telegraminfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoDAO;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoManager;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoVO;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class AddTelegramInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public AddTelegramInfoCommand() {
|
||||
super("AddTelegramInfoCommand");
|
||||
}
|
||||
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" "+ msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = (String)args;
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
TelegramInfoDAO dao = (TelegramInfoDAO)DAOFactory.newInstance().create(TelegramInfoDAO.class);
|
||||
HashMap<String, TelegramInfoVO> map = dao.getAllTelegramInfos();
|
||||
TelegramInfoVO vo = map.get(strRuleCode);
|
||||
if (vo == null) {
|
||||
String errMsg = this.name + ": error >> RuleCode [" + strRuleCode + "] not found in DBMS";
|
||||
logger.error(errMsg);
|
||||
throw new CommandException(errMsg);
|
||||
}
|
||||
TelegramInfoManager.getInstance().setRuleCodeArray(strRuleCode, vo);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.eactive.eai.agent.rule.telegraminfo;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RemoveTelegramInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
public RemoveTelegramInfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" "+ msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = ((String)args).trim();
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
TelegramInfoManager.getInstance().removeRuleCodeArray(strRuleCode);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.eactive.eai.agent.rule.telegraminfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoDAO;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoManager;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoVO;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class UpdateTelegramInfoCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdateTelegramInfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(this.name+" "+ msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String strRuleCode = ((String)args).trim();
|
||||
logger.info(this.name +": (Agent Argument) RuleCode=["+strRuleCode+"]");
|
||||
|
||||
TelegramInfoDAO dao = (TelegramInfoDAO)DAOFactory.newInstance().create(TelegramInfoDAO.class);
|
||||
HashMap<String, TelegramInfoVO> map = dao.getAllTelegramInfos();
|
||||
TelegramInfoVO vo = map.get(strRuleCode);
|
||||
if (vo == null) {
|
||||
String errMsg = this.name + ": error >> RuleCode [" + strRuleCode + "] not found in DBMS";
|
||||
logger.error(errMsg);
|
||||
return errMsg;
|
||||
}
|
||||
TelegramInfoManager.getInstance().setRuleCodeArray(strRuleCode, vo);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.eactive.eai.agent.schedule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.scheduler.ScheduleBasisManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
/**
|
||||
* 1. 기능
|
||||
* 2. 처리 개요
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see : 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
|
||||
public class GetScheduleBasisListCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 GetScheduleBasisListCommand 생성자
|
||||
* 2. 처리 개요
|
||||
* 3. 주의사항
|
||||
*
|
||||
**/
|
||||
public GetScheduleBasisListCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
ArrayList<String> holicodes = null;
|
||||
|
||||
String day = (String)args;
|
||||
if ( day.length() >0){
|
||||
holicodes = ScheduleBasisManager.getInstance().getIntervalTypes( day );
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
String[] arr = new String[holicodes.size()];
|
||||
for ( int inx = 0; inx < holicodes.size(); inx++){
|
||||
arr[inx] = holicodes.get(inx);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.eactive.eai.agent.schedule;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class RequestRecieveCommand extends Command{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public RequestRecieveCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name +" 이 호출되었습니다.");
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] logKeys = (String[])args;
|
||||
String scheduleCode = logKeys[0];
|
||||
String reqYYYYMMDD = logKeys[1];
|
||||
logger.debug("scheduleCode---->" + scheduleCode);
|
||||
logger.debug("reqYYYYMMDD----->" + reqYYYYMMDD);
|
||||
SchedulerMessageManager manager = SchedulerMessageManager.getInstance();
|
||||
manager.requestRecieveJob(scheduleCode.trim(), reqYYYYMMDD);
|
||||
|
||||
|
||||
return "작업큐에 데이터가 추가되었습니다.";
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.eactive.eai.agent.sysinfo;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.sysInfo.SysInfoManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 HolidayManager의 정보 변경
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class RemoveSysinfoCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RemoveSysinfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : HolidayManager에 HolidayVO제거
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO제거
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String sysCd = (String) args;
|
||||
SysInfoManager manager = SysInfoManager.getInstance();
|
||||
|
||||
manager.removeSysInfo(sysCd);
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.eactive.eai.agent.sysinfo;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.sysInfo.SysInfoManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 HolidayManager의 정보 변경
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class UpdateSysinfoCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UpdateSysinfoCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : HolidayManager에 HolidayVO추가
|
||||
* 2. 처리 개요 : HolidayManager에 HolidayVO추가
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @exception CommandException Argument Type이 다르거나 Command 수행중 Excpetion이 발생할 경우
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String sysCd = (String) args;
|
||||
|
||||
SysInfoManager manager = SysInfoManager.getInstance();
|
||||
manager.setSysInfo(sysCd);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = makeException("BECEAICAG002", e);
|
||||
logger.error(msg, e);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.eactive.eai.agent.telegram;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.common.StringUtil;
|
||||
import com.eactive.eai.batch.telegram.TelegramManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 전문을 삭제
|
||||
* 2. 처리 개요 : TelegramManager를 이용하여 입력된 전문 Key에 해당하는 HashMap의 객체를 삭제
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class RemoveTelegramCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : AddFlowRuleCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public RemoveTelegramCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : FlowRule 추가
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception CommandException
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
TelegramManager telegramManager = TelegramManager.getInstance();
|
||||
|
||||
try
|
||||
{
|
||||
// 입력값(parameter가 없으면 에러를 발생한다.
|
||||
if(args == null) throw new Exception("[RemoveFlowPhaseCommand] 입력 파라미터가 없습니다.");
|
||||
|
||||
// 파라미터 확인
|
||||
if( !(args instanceof String) ) {
|
||||
String rspErrorCode = "BECEAICAG001";
|
||||
String msg = makeException(rspErrorCode, null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
String telegramKey = StringUtil.nvlTrim((String)args);
|
||||
|
||||
|
||||
// TelegramManager를 이용하여 새로운 Rule을 등록한다.
|
||||
boolean result = telegramManager.removeTelegram(telegramKey);
|
||||
|
||||
logger.debug("RemoveTelegram 이용한 전문 삭제 결과 : " + result);
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.agent.telegram;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.common.StringUtil;
|
||||
import com.eactive.eai.batch.telegram.TelegramManager;
|
||||
import com.eactive.eai.batch.telegram.TelegramVO;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
/**
|
||||
* 1. 기능 : Running중인 EAI Server의 메모리에 로딩된 전문을 삭제
|
||||
* 2. 처리 개요 : TelegramManager를 이용하여 입력된 전문 Key에 해당하는 HashMap의 객체를 삭제
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @author
|
||||
* @version v 1.0.0
|
||||
* @see 관련 기능을 참조
|
||||
* @since
|
||||
*/
|
||||
public class UpdateTelegramCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 1. 기능 : AddFlowRuleCommand 생성자
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public UpdateTelegramCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : FlowRule 추가
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @exception CommandException
|
||||
**/
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
TelegramManager telegramManager = TelegramManager.getInstance();
|
||||
|
||||
try
|
||||
{
|
||||
// 입력값(parameter가 없으면 에러를 발생한다.
|
||||
if(args == null) throw new Exception("[UpdateTelegramCommand] 입력 파라미터가 없습니다.");
|
||||
|
||||
// 파라미터 확인
|
||||
if( !(args instanceof String) ) {
|
||||
String rspErrorCode = "BECEAICAG001";
|
||||
String msg = makeException(rspErrorCode, null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
String telegramKey = StringUtil.nvlTrim((String)args);
|
||||
|
||||
|
||||
// TelegramManager를 이용하여 새로운 Rule을 등록한다.
|
||||
TelegramVO result = telegramManager.updateTelegram(telegramKey);
|
||||
|
||||
logger.debug("UpdateTelegramCommand 이용한 전문 수정 결과 : " + result.toString());
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
return "success";
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.eactive.eai.agent.transaction;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class AdditionReportCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public AdditionReportCommand() {
|
||||
super("AdditionReportCommand");
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
if ( args == null || !(args instanceof String) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String sendData = ((String)args).substring(4);
|
||||
logger.debug(this.name + "- 받은 데이터 : \n["+sendData+"]");
|
||||
|
||||
String result = com.eactive.eai.batch.bokex.BOKEXAddTelegramManager.getInstance().doTelegram(sendData);
|
||||
logger.debug(this.name + "- 되돌려 주는 데이터 : \n["+result+"]");
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
|
||||
return "0000" + result;
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.agent.transaction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.rule.dirInfo.BatchJobPriorityManager;
|
||||
import com.eactive.eai.batch.rule.dirInfo.BatchJobPriorityVO;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class BatchJobPriorityCommand extends Command
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
HashMap<String, ArrayList<BatchJobPriorityVO>> resultMap = null;
|
||||
|
||||
public BatchJobPriorityCommand() {
|
||||
super("BatchJobPriorityCommand");
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
try{
|
||||
if( args instanceof String[]){//메모리 업데이트
|
||||
try{
|
||||
String[] params = (String[])args;
|
||||
|
||||
ArrayList<BatchJobPriorityVO> alist = null;
|
||||
|
||||
if (params != null && params.length >= 4){
|
||||
HashMap<String, ArrayList<BatchJobPriorityVO>> jobmap = BatchJobPriorityManager.getInstance().getPriorityDatas();
|
||||
|
||||
alist = jobmap.get(params[0]);
|
||||
|
||||
if (alist != null && alist.size()>0){
|
||||
for (int i =0; i<alist.size(); i++){
|
||||
BatchJobPriorityVO vo = (BatchJobPriorityVO)alist.get(i);
|
||||
|
||||
if (params[1].equals(vo.getBizCode())){
|
||||
vo.setDataCount(Integer.parseInt(params[2]));
|
||||
vo.setExecutedFlag(Boolean.parseBoolean(params[3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BatchJobPriorityManager.getInstance().addJobPriorityData(params[0], alist);
|
||||
logger.debug(this.name + " add JobPriorityData - BizKey : \n["+params[0]+"]");
|
||||
|
||||
resultMap = BatchJobPriorityManager.getInstance().getPriorityDatas();
|
||||
return resultMap;
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}else if (args instanceof String){//메모리 삭제
|
||||
try {
|
||||
String bizKey = (String)args;
|
||||
BatchJobPriorityManager.getInstance().delPriorityData(bizKey);
|
||||
|
||||
logger.debug(this.name + "del JobPriorityData - BizKey : \n["+bizKey+"]");
|
||||
|
||||
resultMap = BatchJobPriorityManager.getInstance().getPriorityDatas();
|
||||
|
||||
return resultMap;
|
||||
}catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}else {
|
||||
resultMap = BatchJobPriorityManager.getInstance().getPriorityDatas();
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
logger.error( e.getMessage(), e);
|
||||
throw new CommandException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.eactive.eai.agent.transaction;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.running.BatchRunningJobManager;
|
||||
import com.eactive.eai.batch.scheduler.JobFileTransferVO;
|
||||
import com.eactive.eai.batch.scheduler.JobMasterLogVO;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageVO;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.common.util.UUIDGenerator;
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
|
||||
public class JobUserCancelCommand extends Command{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public JobUserCancelCommand() {
|
||||
super();
|
||||
}
|
||||
|
||||
public JobUserCancelCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name +" 이 호출되었습니다.");
|
||||
if ( args == null || !(args instanceof HashMap) ) {
|
||||
String msg = makeException("RECEAIMCM001", null); //BECEAICAG001
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
Map<String, Object>paramMap = (HashMap)args;
|
||||
|
||||
String bjobDmndMsgID = (String)paramMap.get("bjobDmndMsgID");
|
||||
|
||||
BatchDoc batchDoc = BatchRunningJobManager.getInstance().getRunningDocument(bjobDmndMsgID);
|
||||
|
||||
if (batchDoc == null){
|
||||
return bjobDmndMsgID+"에 해당하는 Batch Job이 없습니다.";
|
||||
}
|
||||
|
||||
batchDoc.setUserCancel(true);
|
||||
ChannelSftp channelSftp = batchDoc.getSftpChannel();
|
||||
Object ioStream = batchDoc.getIOStream();
|
||||
if (channelSftp == null && ioStream == null){
|
||||
return "실행중인 sFTP 송수신이 없습니다.";
|
||||
}
|
||||
|
||||
if(channelSftp != null)channelSftp.quit();
|
||||
if(ioStream != null){
|
||||
if(ioStream instanceof InputStream)((InputStream)ioStream).close();
|
||||
else if(ioStream instanceof OutputStream)((OutputStream)ioStream).close();
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("RECEAIMCM002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
return "전송종료를 요청했습니다.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.eactive.eai.agent.transaction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.running.BatchRunningJobManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class ProcessingFileStatusCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public ProcessingFileStatusCommand() {
|
||||
super("ProcessingFileStatusCommand");
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
try {
|
||||
ArrayList<ProcessingFileStatusVO> alist = getProcessingBatchJodStatus();
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
logger.info("###### 이 서버에서 진행중인 작업 건 수 (메모리서 조회) : "+ alist.size());
|
||||
return alist;
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<ProcessingFileStatusVO> getProcessingBatchJodStatus() throws Exception {
|
||||
ArrayList<ProcessingFileStatusVO> retList = new ArrayList<ProcessingFileStatusVO>();
|
||||
|
||||
HashMap<String, BatchDoc> allDocs = BatchRunningJobManager.getInstance().getAllRunningDocuments();
|
||||
Object[] uuids = allDocs.keySet().toArray();
|
||||
|
||||
for (int i=0; i<allDocs.size(); i++) {
|
||||
BatchDoc batchDoc = allDocs.get(uuids[i]);
|
||||
|
||||
ProcessingFileStatusVO info = new ProcessingFileStatusVO();
|
||||
info.setUuid (batchDoc.getBatchMsg().getHeader().getUUID());
|
||||
info.setSubUuid (batchDoc.getBatchMsg().getBody().getSubUUID());
|
||||
info.setProcessCode (batchDoc.getBatchMsg().getHeader().getProcessCode());
|
||||
info.setProcessName (batchDoc.getBatchMsg().getHeader().getProcessName());
|
||||
info.setOrganCode (batchDoc.getBatchMsg().getHeader().getInstitutionCode());
|
||||
info.setOrganName (batchDoc.getBatchMsg().getHeader().getInstitutionName());
|
||||
info.setProcessType (batchDoc.getBatchMsg().getHeader().getProcessType());
|
||||
info.setBatchStartTime(batchDoc.getBatchMsg().getHeader().getBatchStartTime());
|
||||
info.setPhaseStartTime(batchDoc.getBatchMsg().getBody().getPhaseStartTime());
|
||||
info.setFileName (batchDoc.getBatchMsg().getHeader().getFileName());
|
||||
info.setTotalFileSize (batchDoc.getBatchMsg().getHeader().getFileSize());
|
||||
info.setCurrFileSize (batchDoc.getBatchMsg().getBody().getCurFileSize());
|
||||
retList.add(info);
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.agent.transaction;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ProcessingFileStatusVO implements Serializable//, Comparable
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String serverName = "";
|
||||
private String uuid = ""; // 작업요청메시지ID (UUID)
|
||||
private String subUuid = ""; // 작업요청부메시지ID (subUUID)
|
||||
private String processCode = "";
|
||||
private String processName = "";
|
||||
private String organCode = "";
|
||||
private String organName = "";
|
||||
private String processType = "";
|
||||
private String batchStartTime = "";
|
||||
private String phaseStartTime = "";
|
||||
private String fileName = "";
|
||||
private long totalFileSize = 0;
|
||||
private long currFileSize = 0;
|
||||
|
||||
|
||||
public void setServerName (String arg) { serverName = arg; }
|
||||
public void setUuid (String arg) { uuid = arg; }
|
||||
public void setSubUuid (String arg) { subUuid = 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 setProcessType (String arg) { processType = arg; }
|
||||
public void setBatchStartTime(String arg) { batchStartTime = arg; }
|
||||
public void setPhaseStartTime(String arg) { phaseStartTime = arg; }
|
||||
public void setFileName (String arg) { fileName = arg; }
|
||||
public void setTotalFileSize (long arg) { totalFileSize = arg; }
|
||||
public void setCurrFileSize (long arg) { currFileSize = arg; }
|
||||
|
||||
|
||||
public String getServerName () { return serverName ; }
|
||||
public String getUuid () { return uuid ; }
|
||||
public String getSubUuid () { return subUuid ; }
|
||||
public String getProcessCode () { return processCode ; }
|
||||
public String getProcessName () { return processName ; }
|
||||
public String getOrganCode () { return organCode ; }
|
||||
public String getOrganName () { return organName ; }
|
||||
public String getProcessType () { return processType ; }
|
||||
public String getBatchStartTime() { return batchStartTime; }
|
||||
public String getPhaseStartTime() { return phaseStartTime; }
|
||||
public String getFileName () { return fileName ; }
|
||||
public long getTotalFileSize () { return totalFileSize ; }
|
||||
public long getCurrFileSize () { return currFileSize ; }
|
||||
|
||||
|
||||
// public int compareTo(Object arg0) {
|
||||
// ProcessingFileStatusVO info = (ProcessingFileStatusVO) arg0;
|
||||
// //int compare = 0;
|
||||
// //if ((compare = this.getServerName ().compareTo(info.getServerName ())) != 0) return compare;
|
||||
// //if ((compare = this.getProcessName().compareTo(info.getProcessName())) != 0) return compare;
|
||||
// //if ((compare = this.getOrganName ().compareTo(info.getOrganName ())) != 0) return compare;
|
||||
// return this.getBatchStartTime().compareTo(info.getBatchStartTime());
|
||||
// }
|
||||
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("\nProcessingFileStatusVO [ ");
|
||||
sb.append("serverName=" ).append(serverName );
|
||||
sb.append(", uuid=" ).append(uuid );
|
||||
sb.append(", subUuid=" ).append(subUuid );
|
||||
sb.append(", processCode=" ).append(processCode );
|
||||
sb.append(", processName=" ).append(processName );
|
||||
sb.append(", organCode=" ).append(organCode );
|
||||
sb.append(", organName=" ).append(organName );
|
||||
sb.append(", processType=" ).append(processType );
|
||||
sb.append(", batchStartTime=" ).append(batchStartTime );
|
||||
sb.append(", phaseStartTime=" ).append(phaseStartTime );
|
||||
sb.append(", fileName=" ).append(fileName );
|
||||
sb.append(", totalFileSize=" ).append(totalFileSize );
|
||||
sb.append(", currFileSize=" ).append(currFileSize );
|
||||
sb.append(" ]");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.eactive.eai.agent.transaction;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.running.BatchRunningJobManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class ProcessingFileTransferCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public ProcessingFileTransferCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name + " Agent 가 호출되었습니다.");
|
||||
|
||||
try {
|
||||
|
||||
List<Map<String,Serializable>> alist = getProcessingBatchJodStatus();
|
||||
|
||||
logger.info(this.name + " Agent 가 성공적으로 완료되었습니다.");
|
||||
logger.info("###### 이 서버에서 진행중인 작업 건 수 (메모리서 조회) : "+ alist.size());
|
||||
return alist;
|
||||
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<Map<String,Serializable>> getProcessingBatchJodStatus() throws Exception {
|
||||
List<Map<String,Serializable>> retList = new ArrayList<Map<String,Serializable>>();
|
||||
|
||||
HashMap<String, BatchDoc> allDocs = BatchRunningJobManager.getInstance().getAllRunningDocuments();
|
||||
Object[] uuids = allDocs.keySet().toArray();
|
||||
|
||||
for (int i=0; i<allDocs.size(); i++) {
|
||||
BatchDoc batchDoc = allDocs.get(uuids[i]);
|
||||
|
||||
Map<String,Serializable> map = new HashMap<String,Serializable>();
|
||||
map.put( "Uuid" , batchDoc.getBatchMsg().getHeader().getUUID());
|
||||
map.put( "SubUuid" , batchDoc.getBatchMsg().getBody().getSubUUID());
|
||||
map.put( "ProcessCode" , batchDoc.getBatchMsg().getHeader().getProcessCode());
|
||||
map.put( "ProcessName" , batchDoc.getBatchMsg().getHeader().getProcessName());
|
||||
map.put( "OrganCode" , batchDoc.getBatchMsg().getHeader().getInstitutionCode());
|
||||
map.put( "OrganName" , batchDoc.getBatchMsg().getHeader().getInstitutionName());
|
||||
map.put( "ProcessType" , batchDoc.getBatchMsg().getHeader().getProcessType());
|
||||
map.put( "BatchStartTime" , batchDoc.getBatchMsg().getHeader().getBatchStartTime());
|
||||
map.put( "PhaseStartTime" , batchDoc.getBatchMsg().getBody().getPhaseStartTime());
|
||||
map.put( "FileName" , batchDoc.getBatchMsg().getHeader().getFileName());
|
||||
map.put( "TotalFileSize" , batchDoc.getBatchMsg().getHeader().getFileSize());
|
||||
map.put( "CurrFileSize" , batchDoc.getBatchMsg().getBody().getCurFileSize());
|
||||
int rate = (int)(100 * batchDoc.getBatchMsg().getBody().getCurFileSize() / batchDoc.getBatchMsg().getHeader().getFileSize());
|
||||
if ( rate > 0 && rate <= 100 ){
|
||||
map.put( "Rate" , rate);
|
||||
}else{
|
||||
map.put( "Rate" , "-");
|
||||
}
|
||||
retList.add(map);
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.eactive.eai.agent.transaction;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.scheduler.JobFileTransferVO;
|
||||
import com.eactive.eai.batch.scheduler.JobMasterLogVO;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageVO;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.common.util.UUIDGenerator;
|
||||
|
||||
public class ReSendRSDataCommand extends Command{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public ReSendRSDataCommand(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Object execute() throws CommandException
|
||||
{
|
||||
logger.info(this.name +" 이 호출되었습니다.");
|
||||
if ( args == null || !(args instanceof String[]) ) {
|
||||
String msg = makeException("BECEAICAG001", null);
|
||||
logger.error(msg);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
|
||||
try {
|
||||
String[] logKeys = (String[])args;
|
||||
String argUUID = logKeys[0];
|
||||
String argSubUUID = logKeys[1];
|
||||
String argSndrcvFileName = logKeys[2];
|
||||
|
||||
SchedulerMessageManager manager = SchedulerMessageManager.getInstance();
|
||||
JobMasterLogVO vo = manager.getJobLogByKey(argUUID, argSubUUID);
|
||||
JobFileTransferVO fvo = manager.getFileLogList(argUUID, argSubUUID, argSndrcvFileName);
|
||||
|
||||
if (fvo == null ){
|
||||
logger.warn("fail.. 전송할 파일명이 설정되어 있지 않습니다. 파일명이 설정된 단계까지 실행되었는지 확인 필요합니다.");
|
||||
return "fail.. 전송할 파일명이 설정되어 있지 않습니다. 파일명이 설정된 단계까지 실행되었는지 확인 필요합니다.";
|
||||
}else {
|
||||
SchedulerMessageVO scheduleInfo = SchedulerMessageManager.getInstance().getScheduleInfo(fvo.getBjobTranDstcdName(), vo.getProcessCode(), vo.getOrganCode());
|
||||
String strEndTime = scheduleInfo.getEndTime();
|
||||
String strStartTime = CalendarUtil.getCurrentTimeNoDash().substring(8,12);
|
||||
|
||||
int endTime = Integer.parseInt(strEndTime);
|
||||
int startTime = Integer.parseInt(strStartTime);
|
||||
|
||||
if (startTime > endTime){
|
||||
strEndTime = "2359"; //하루의 마지막 시간으로 설정
|
||||
}
|
||||
|
||||
String newUuid = UUIDGenerator.getUUID();
|
||||
|
||||
scheduleInfo.setUUID (argUUID);//로깅을 위해 새로운 uuid 할당한다.
|
||||
scheduleInfo.setSubUUID (newUuid);
|
||||
scheduleInfo.setFilePath (fvo.getFilePath());
|
||||
scheduleInfo.setFileName (fvo.getFileName());
|
||||
scheduleInfo.setRenamedFileName(fvo.getRenamedFileName());
|
||||
scheduleInfo.setHdrInfoName (fvo.getHdrInfoName());
|
||||
|
||||
scheduleInfo.setStartTime(DatetimeUtil.getCurrentDate() + strStartTime + "00" + "000" );
|
||||
scheduleInfo.setEndTime (DatetimeUtil.getCurrentDate() + strEndTime + "00" + "000" );
|
||||
|
||||
BatchDoc newBatchDoc = EAIBatchMsgManager.createBatchMsg(true);
|
||||
newBatchDoc.getBatchMsg().getHeader().setBatchStartTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
newBatchDoc.getBatchMsg().getBody().setPhaseStartTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
|
||||
//JOB QUEUE 테이블에 등록
|
||||
int resultCnt = SchedulerMessageManager.getInstance().insertJobToQueue(scheduleInfo);
|
||||
logger.info("[요구송신 재전송을 위을 위해 배치 JOB QUEUE 테이블 INSERT 건수: "+ resultCnt);
|
||||
|
||||
//DB로그를 위해서 조회정보를 batchDoc에 세팅
|
||||
newBatchDoc.getBatchMsg().getHeader().setUUID(argUUID);
|
||||
newBatchDoc.getBatchMsg().getBody().setSubUUID(newUuid);
|
||||
|
||||
newBatchDoc.getBatchMsg().getHeader().setScheduleSTime(scheduleInfo.getStartTime()); //전송 시작 시각
|
||||
newBatchDoc.getBatchMsg().getHeader().setScheduleETime(scheduleInfo.getEndTime());
|
||||
newBatchDoc.getBatchMsg().getHeader().setLayerCode(CommonKeys.LAYER_SCHEDULER);
|
||||
newBatchDoc.getBatchMsg().getHeader().setProcessCode(vo.getProcessCode());
|
||||
newBatchDoc.getBatchMsg().getHeader().setFileName(fvo.getFileName());
|
||||
newBatchDoc.getBatchMsg().getHeader().setRenamedFileName(fvo.getRenamedFileName());
|
||||
newBatchDoc.getBatchMsg().getHeader().setHdrInfoName(fvo.getHdrInfoName());
|
||||
newBatchDoc.getBatchMsg().getHeader().setScheduleCode(vo.getScheduleCode());
|
||||
newBatchDoc.getBatchMsg().getHeader().setProcessType(vo.getProcessType());
|
||||
newBatchDoc.getBatchMsg().getHeader().setInstitutionCode(vo.getOrganCode());
|
||||
newBatchDoc.getBatchMsg().getHeader().setUserID(vo.getMsgSenderId());
|
||||
newBatchDoc.getBatchMsg().getHeader().setUserName(vo.getMsgSenderName());
|
||||
newBatchDoc.getBatchMsg().getHeader().setSystemConnCode(vo.getSystemConnCode());
|
||||
newBatchDoc.getBatchMsg().getHeader().setRemoteIP(vo.getRemoteServerIp());
|
||||
newBatchDoc.getBatchMsg().getHeader().setRuleCode(vo.getRuleCode());
|
||||
|
||||
|
||||
newBatchDoc.getBatchMsg().getBody().setWLIServerName(vo.getWeblogicName());
|
||||
newBatchDoc.getBatchMsg().getBody().setSubLayerCode(CommonKeys.SUB_LAYER_SCHEDULER_QUEUE);
|
||||
newBatchDoc.getBatchMsg().getBody().setPhaseEndTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
newBatchDoc.getBatchMsg().getBody().setErrorCode(0);
|
||||
newBatchDoc.getBatchMsg().getBody().setErrorMsg("");
|
||||
newBatchDoc.getBatchMsg().getBody().setRetryCount(scheduleInfo.getRecvFailCnt());
|
||||
|
||||
//요구송신 재처리에 대한 최초 DB로그. StartLog 호출.
|
||||
LogUtil.setStartLog (newBatchDoc);
|
||||
}
|
||||
|
||||
return "재전송을 위한 작업큐에 데이터가 추가되었습니다.";
|
||||
} catch (Exception ex) {
|
||||
String msg = makeException("BECEAICAG002", ex);
|
||||
logger.error(msg, ex);
|
||||
throw new CommandException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.batch.rule.dirInfo.BatchJobPriorityManager;
|
||||
import com.eactive.eai.batch.rule.dirInfo.BatchJobPriorityVO;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class BatchJobPriorityMan extends HttpServlet
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
/**
|
||||
* 1. 기능 : 요청으로 전달된 Command 실행
|
||||
* 2. 처리 개요 : 요청으로 전달된 Command 실행하고 실행된 결과를 ObjectOutStream을 통해 전송
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("[BatchJobPriorityMan] Servlet starting .......");
|
||||
|
||||
String scr_name = request.getParameter("scr_name");
|
||||
|
||||
if ("UPDATE".equals(scr_name)){
|
||||
String key = request.getParameter("key");
|
||||
int index = Integer.parseInt(request.getParameter("index"));
|
||||
|
||||
String m_bizCode[] = request.getParameterValues("bizCode");
|
||||
String m_dataCount[] = request.getParameterValues("dataCount");
|
||||
String m_isexe[] = request.getParameterValues("isexe");
|
||||
|
||||
BatchJobPriorityManager jobpmanager = BatchJobPriorityManager.getInstance();
|
||||
HashMap<String, ArrayList<BatchJobPriorityVO>> jobmap = jobpmanager.getPriorityDatas();
|
||||
|
||||
ArrayList<BatchJobPriorityVO> alist = jobmap.get(key);
|
||||
|
||||
if (alist != null && alist.size()>0){
|
||||
for (int i =0; i<alist.size(); i++){
|
||||
BatchJobPriorityVO vo = alist.get(i);
|
||||
|
||||
if (m_bizCode[index].equals(vo.getBizCode())){
|
||||
vo.setDataCount(Integer.parseInt(m_dataCount[index]));
|
||||
vo.setExecutedFlag(Boolean.parseBoolean(m_isexe[index]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if("DELETE".equals(scr_name)){
|
||||
|
||||
String key = request.getParameter("key");
|
||||
BatchJobPriorityManager jobpmanager = BatchJobPriorityManager.getInstance();
|
||||
jobpmanager.delPriorityData(key);
|
||||
}
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/batchjobpriority.jsp");
|
||||
rd.forward(request, response);
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.error( ex.getMessage(), ex);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(ex.getMessage());
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.batch.flowController.BatchTargetVO;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerManager;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class CheckFileSysHealth extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
/**
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("[CheckFileSysHealth] Servlet starting .......");
|
||||
response.setContentType("text/html;charset=euc-kr");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
String strBatch = request.getParameter("batch");
|
||||
if (strBatch == null) strBatch = "";
|
||||
String strOutside = request.getParameter("outside");
|
||||
if (strOutside==null) strOutside = "";
|
||||
|
||||
Object batchCodes[] = OutsideManager.getInstance().getBatchCodeArray();
|
||||
ArrayList<String> batchNames = new ArrayList<String>();
|
||||
for (int i=0; i<batchCodes.length; i++) {
|
||||
ArrayList<OutsideVO> organList = OutsideManager.getInstance().getOutsideInfo((String)batchCodes[i]);
|
||||
if (organList.size()>0) {
|
||||
OutsideVO osdvo = (OutsideVO)organList.get(0);
|
||||
BatchTargetVO bvo = FlowControllerManager.getInstance().getBatchTargetInfo(osdvo.getBatchCode(), osdvo.getOsdCode());
|
||||
if (bvo == null) {
|
||||
batchNames.add("");
|
||||
} else {
|
||||
batchNames.add(bvo.getProcessName());
|
||||
}
|
||||
} else {
|
||||
batchNames.add("");
|
||||
}
|
||||
}
|
||||
response.getWriter().println("<%@ taglib uri='/WEB-INF/tld/c.tld' prefix='c'%>");
|
||||
response.getWriter().println("<HTML><HEAD>");
|
||||
response.getWriter().println("</HEAD>");
|
||||
response.getWriter().println("<BODY TOPMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0 >");
|
||||
response.getWriter().println("<table cellSpacing=1 cellPadding=3 width=640 bgColor=#7f7f7f border=0 STYLE='font-size:10pt'>");
|
||||
response.getWriter().println("<TBODY>");
|
||||
if (strBatch.equalsIgnoreCase("all")) {
|
||||
for (int i=0; i< batchCodes.length; i++) {
|
||||
String strBatchCode = (String)batchCodes[i];
|
||||
String strBatchName = (String)batchNames.get(i);
|
||||
|
||||
response.getWriter().println("<TR bgcolor='#ffbbbb' height='20' class='txt'>");
|
||||
response.getWriter().println("<TD class=c style='PADDING-LEFT: 10px' height=20>");
|
||||
response.getWriter().println(" BATCH CODE ");
|
||||
response.getWriter().println(" </TD><TD> ");
|
||||
response.getWriter().println( strBatchCode );
|
||||
response.getWriter().println(" </TD>");
|
||||
response.getWriter().println("<TD class=c style='PADDING-LEFT: 10px' height=20>");
|
||||
response.getWriter().println(" BATCH NAME ");
|
||||
response.getWriter().println(" </TD><TD>" );
|
||||
response.getWriter().println( strBatchName );
|
||||
response.getWriter().println(" </TD>");
|
||||
response.getWriter().println(" </TR>");
|
||||
PrintBatchSubDirectory(response, strOutside, strBatchName, strBatchCode);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i=0; i< batchCodes.length; i++) {
|
||||
String strBatchCode = (String)batchCodes[i];
|
||||
String strBatchName = (String)batchNames.get(i);
|
||||
if (strBatch.equalsIgnoreCase(strBatchCode)) {
|
||||
response.getWriter().println("<TR bgcolor='#ffbbbb' height='20' class='txt'>");
|
||||
response.getWriter().println("<TD class=c style='PADDING-LEFT: 10px' height=20>");
|
||||
response.getWriter().println(" BATCH CODE ");
|
||||
response.getWriter().println(" </TD><TD> ");
|
||||
response.getWriter().println( strBatchCode );
|
||||
response.getWriter().println(" </TD>");
|
||||
response.getWriter().println("<TD class=c style='PADDING-LEFT: 10px' height=20>");
|
||||
response.getWriter().println(" BATCH NAME ");
|
||||
response.getWriter().println(" </TD><TD>" );
|
||||
response.getWriter().println( strBatchName );
|
||||
response.getWriter().println(" </TD>");
|
||||
response.getWriter().println(" </TR>");
|
||||
PrintBatchSubDirectory(response, strOutside, strBatchName, strBatchCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
response.getWriter().println("</TBODY> </TABLE>");
|
||||
response.getWriter().println("</HTML>");
|
||||
response.getWriter().println(sb.toString());
|
||||
} catch (Exception ex) {
|
||||
logger.error( ex.getMessage(), ex);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(ex.getMessage());
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintBatchSubDirectory(HttpServletResponse response, String strOsdCondition, String strBatchName, String strBatchCode) throws Exception
|
||||
{
|
||||
ArrayList<OutsideVO> organList = OutsideManager.getInstance().getOutsideInfo(strBatchCode);
|
||||
for (int i=0; i<organList.size(); i++) {
|
||||
OutsideVO osdvo = (OutsideVO)organList.get(i);
|
||||
if (strOsdCondition.equalsIgnoreCase("") || strOsdCondition.equalsIgnoreCase("all")) {
|
||||
response.getWriter().println("<TR bgcolor='#ffff' height='20' class='txt'>");
|
||||
response.getWriter().println("<TD class=c style='PADDING-LEFT: 10px' bgcolor=#eeffff height=20>");
|
||||
response.getWriter().println(" 배치업무 ");
|
||||
response.getWriter().println(" </TD><TD> ");
|
||||
response.getWriter().println( strBatchName+"["+strBatchCode+"]" );
|
||||
response.getWriter().println(" </TD>");
|
||||
response.getWriter().println("<TD class=c style='PADDING-LEFT: 10px' bgcolor=#eeffff height=20>");
|
||||
response.getWriter().println(" 대외기관 ");
|
||||
response.getWriter().println(" </TD><TD>" );
|
||||
response.getWriter().println( osdvo.getOsdName()+"["+osdvo.getOsdCode()+"]" );
|
||||
response.getWriter().println(" </TD>");
|
||||
response.getWriter().println(" </TR>");
|
||||
PrintOsdSubDirectory(response, strBatchCode, osdvo.getOsdCode());
|
||||
} else {
|
||||
if (strOsdCondition.equalsIgnoreCase(osdvo.getOsdCode())) {
|
||||
response.getWriter().println("<TR bgcolor='#ffff' height='20' class='txt'>");
|
||||
response.getWriter().println("<TD class=c style='PADDING-LEFT: 10px' bgcolor=#eeffff height=20>");
|
||||
response.getWriter().println(" 배치업무 ");
|
||||
response.getWriter().println(" </TD><TD> ");
|
||||
response.getWriter().println( strBatchName+"["+strBatchCode+"]" );
|
||||
response.getWriter().println(" </TD>");
|
||||
response.getWriter().println("<TD class=c style='PADDING-LEFT: 10px' bgcolor=#eeffff height=20>");
|
||||
response.getWriter().println(" 대외기관 ");
|
||||
response.getWriter().println(" </TD><TD>" );
|
||||
response.getWriter().println( osdvo.getOsdName()+"["+osdvo.getOsdCode()+"]" );
|
||||
response.getWriter().println(" </TD>");
|
||||
response.getWriter().println(" </TR>");
|
||||
PrintOsdSubDirectory(response, strBatchCode, osdvo.getOsdCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintOsdSubDirectory(HttpServletResponse response, String strBatCd, String strOsdCd) throws Exception
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
sb.append(strBatCd);
|
||||
sb.append("/");
|
||||
sb.append(strOsdCd);
|
||||
|
||||
response.getWriter().println("<TR bgcolor='#dddddd' height='20' class='txt'>");
|
||||
response.getWriter().println("<TD align=left colspan=4 class=c style='PADDING-LEFT: 10px' bgcolor=#e7e7e7 height=20>");
|
||||
response.getWriter().println("요구송신용 디렉토리");
|
||||
response.getWriter().println(" </TD> ");
|
||||
|
||||
PrintCheckResult(response, BatchDirUtil.getRequestArchDir()+"/"+sb.toString());
|
||||
PrintCheckResult(response, BatchDirUtil.getRequestErrorDir()+"/"+sb.toString());
|
||||
// PrintCheckResult(response, BatchDirUtil.getRequestRealDir()+"/"+sb.toString());
|
||||
// PrintCheckResult(response, BatchDirUtil.getRequestRootDir()+"/"+sb.toString());
|
||||
|
||||
response.getWriter().println("<TR bgcolor='#dddddd' height='20' class='txt'>");
|
||||
response.getWriter().println("<TD align=left colspan=4 class=c style='PADDING-LEFT: 10px' bgcolor=#e7e7e7 height=20>");
|
||||
response.getWriter().println("요구/응답수신용 디렉토리");
|
||||
response.getWriter().println(" </TD> ");
|
||||
|
||||
PrintCheckResult(response, BatchDirUtil.getResponseArchDir()+"/"+sb.toString());
|
||||
PrintCheckResult(response, BatchDirUtil.getResponseErrorDir()+"/"+sb.toString());
|
||||
PrintCheckResult(response, BatchDirUtil.getResponseRealDir()+"/"+sb.toString());
|
||||
PrintCheckResult(response, BatchDirUtil.getResponseRootDir()+"/"+sb.toString());
|
||||
|
||||
// if (strGroupCondition.equals("") || strGroupCondition.equals("all")) {
|
||||
// sb = new StringBuffer();
|
||||
// sb.append(strBatNm +"_"+ strBatCd);
|
||||
// sb.append("/");
|
||||
// sb.append(strOsdNm +"_"+ strOsdCd);
|
||||
//
|
||||
// response.getWriter().println("<TR bgcolor='#dddddd' height='20' class='txt'>");
|
||||
// response.getWriter().println("<TD align=left colspan=4 class=c style='PADDING-LEFT: 10px' bgcolor=#e7e7e7 height=20>");
|
||||
// response.getWriter().println("응답송신용 디렉토리");
|
||||
// response.getWriter().println(" </TD> ");
|
||||
//
|
||||
// PrintCheckResult(response, BatchDirUtil.getResSendArchDir()+"/"+sb.toString());
|
||||
// PrintCheckResult(response, BatchDirUtil.getResSendRealDir()+"/"+sb.toString());
|
||||
// }
|
||||
}
|
||||
|
||||
private void PrintCheckResult(HttpServletResponse response, String strDir) throws Exception
|
||||
{
|
||||
File f = new File(strDir);
|
||||
|
||||
response.getWriter().println("<TR bgcolor='#ffffff' height='20' class='txt'>");
|
||||
response.getWriter().println("<TD align=left colspan=3 class=c style='PADDING-LEFT: 10px' bgcolor=#ffffff height=20>");
|
||||
response.getWriter().println(strDir);
|
||||
response.getWriter().println("</TD><TD align=center>");
|
||||
|
||||
if (f.exists()) {
|
||||
response.getWriter().println("<font color=blue>EXIST</font>");
|
||||
} else {
|
||||
response.getWriter().println("<font color=red>NOT EXIST</font>");
|
||||
}
|
||||
response.getWriter().println("</TD>");
|
||||
response.getWriter().println("</TR>");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.adapter.socket.outbound.OutboundSocketClient;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.osd.OutsideLinkVO;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoManager;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoVO;
|
||||
import com.eactive.eai.batch.running.BatchRunningJobManager;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.common.util.UUIDGenerator;
|
||||
import com.eactive.eai.inbound.ResponseHandler;
|
||||
|
||||
/**
|
||||
* 회선상태 체크 Agent
|
||||
*/
|
||||
public class CheckLine extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static final int ERROR_NO_ERROR = 0;
|
||||
//BatchRunningJobManager 에서 UUID에 해당하는 소켓인스탄스를 찾을 수 없다.
|
||||
public static final int ERROR_NO_SOCKET = 1;
|
||||
public static final int ERROR_NO_PROCDATA = 2;
|
||||
public static final int ERROR_NO_NEXTSTAGE = 3;
|
||||
public static final int ERROR_TELEGRAM_COMPILE = 4;
|
||||
public static final int ERROR_RECV_PRE_LENGTH = 5;
|
||||
public static final int ERROR_RECV_ERROR = 6;
|
||||
public static final int ERROR_TIMEOUT_OVER = 7;
|
||||
public static final int ERROR_RECV_SHORT_LENGTH = 8;
|
||||
public static final int ERROR_LENGTH_PARSE = 9;
|
||||
public static final int ERROR_UNEXPECTED_TELEGRAM = 10;
|
||||
public static final int ERROR_NO_CLASS_DEFINITION = 11;
|
||||
public static final int ERROR_NO_TELEGRAM_ID = 12;
|
||||
public static final int ERROR_WRITE_ERROR = 13;
|
||||
public static final int ERROR_SEND_VALIDATION = 14;
|
||||
public static final int ERROR_RECV_VALIDATION = 15;
|
||||
public static final int ERROR_POST_EXECUTION = 16;
|
||||
public static final int ERROR_EXECUTION = 17;
|
||||
public static final int ERROR_ERR_TELEGRAM_META = 18;
|
||||
public static final int ERROR_INFORMAL_ACTION = 19;
|
||||
public static final int ERROR_READ_FILE = 20;
|
||||
// 플로우 컴포넌트에서 송수신 중 비정형필드에 대한 처리데이터 길이를 구할 수 없다.
|
||||
public static final int ERROR_INFORMAL_FIELD_LENGTH= 21;
|
||||
// 소켓연결 중 소켓 포트정보가 없다.
|
||||
public static final int ERROR_NO_SOCKET_PORT = 22;
|
||||
// Outbound 소켓연결 중 연결 실패
|
||||
public static final int ERROR_FAIL_TO_CONNECT = 23;
|
||||
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
String errorMsg = "";
|
||||
private final String ruleID = "CH001";
|
||||
|
||||
/**
|
||||
* 1. 기능 : 요청으로 전달된 Command 실행
|
||||
* 2. 처리 개요 : 요청으로 전달된 Command 실행하고 실행된 결과를 ObjectOutStream을 통해 전송
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("[CheckLine] Servlet starting .......");
|
||||
String strProcessCodeCode = request.getParameter("processCode");
|
||||
String strOrganCode = request.getParameter("organCode");
|
||||
String strBizCode = request.getParameter("bizCode");
|
||||
String strIP = request.getParameter("organIP");
|
||||
String strPort = request.getParameter("organPort");
|
||||
int nPort = -1;
|
||||
try {
|
||||
nPort = Integer.parseInt(strPort);
|
||||
} catch (Exception ex) {
|
||||
nPort = -1;
|
||||
}
|
||||
response.setContentType("text/html;charset=euc-kr");
|
||||
|
||||
if (strOrganCode==null||strOrganCode.length()==0||
|
||||
strIP==null||strIP.length()==0||nPort==-1) {
|
||||
logger.info("[CheckLine] ▷▷▷ URL format error !!!! ");
|
||||
response.getWriter().println("[ERROR] URL FORMAT ERROR<BR>");
|
||||
response.getWriter().println("-->URL PATTERN<BR>");
|
||||
response.getWriter().println("<BR>");
|
||||
response.getWriter().println("http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/CheckLine?organCode=IL03&bizCode=0000300&organIP=172.17.61.71&organPort=41021   ▷▷▷회선체크 URL 형식<BR>" );
|
||||
} else {
|
||||
//BatchMsgDoc 생성
|
||||
BatchDoc batchMsgDoc = EAIBatchMsgManager.createBatchMsgWithUUID(true); //true:초기화함
|
||||
|
||||
//BatchMsgDoc Layer, SubLayer, StartTime 설정
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_FLOW_CONTROLLER, CommonKeys.SUB_LAYER_FLOW_CONTROLLER);
|
||||
|
||||
batchMsgDoc = setBatchMessage(batchMsgDoc, strProcessCodeCode, strOrganCode, strBizCode, strIP, strPort) ;
|
||||
if (batchMsgDoc == null) {
|
||||
logger.info("[CheckLine] : BatchMsg is NULL!! >>" + this.errorMsg);
|
||||
response.getWriter().println("[ERROR] " + this.errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
// OutboundSocketHandle처럼 소켓을 만들어서 BatchRunningJobManager 등록 해준다.
|
||||
Socket socket=null;
|
||||
|
||||
try {
|
||||
socket=new Socket(strIP, nPort);
|
||||
} catch (UnknownHostException e) {
|
||||
String errMsg = ExceptionUtil.getErrorCode(e, "BECEAIASC001", new String[] {strIP, Integer.toString(nPort)});
|
||||
throw new Exception(errMsg); //Socket 연결 에러 (IP: %1, Port: %2), 서버를 찾을 수 없습니다.
|
||||
} catch(IOException e){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("[ERROR] IP[" + strIP +"]");
|
||||
sb.append("PORT[" + strPort + "] socket connection error");
|
||||
sb.append("[" + e.getLocalizedMessage() + "]");
|
||||
response.getWriter().println(sb.toString());
|
||||
// String errMsg =
|
||||
ExceptionUtil.getErrorCode(e, "BECEAIASC002", new String[] {strIP, Integer.toString(nPort)});
|
||||
|
||||
logger.error( e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
|
||||
String strUUID = batchMsgDoc.getBatchMsg().getHeader().getUUID();
|
||||
OutboundSocketClient socketClient = new OutboundSocketClient(socket);
|
||||
BatchRunningJobManager.getInstance().addRunningJobInfo(strUUID, socketClient, batchMsgDoc);
|
||||
|
||||
logger.info("[CheckLine] : FlowController JPD call & start ");
|
||||
String startTime = CalendarUtil.getCurrentTimeNoDash();
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseStartTime(startTime);
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseEndTime(startTime);
|
||||
LogUtil.setStartLog(batchMsgDoc);
|
||||
ResponseHandler handler = new ResponseHandler();
|
||||
batchMsgDoc = handler.execute(batchMsgDoc);
|
||||
logger.info("[CheckLine] : FlowController JPD call & end ");
|
||||
|
||||
// BatchRunningJobManager 에서 제거한다.
|
||||
BatchRunningJobManager.getInstance().removeRunningJobInfo(strUUID);
|
||||
try {
|
||||
socket.close();
|
||||
} catch (UnknownHostException e) {
|
||||
String errMsg = ExceptionUtil.getErrorCode(e, "BECEAIASC001", new String[] {strIP, Integer.toString(nPort)});
|
||||
throw new Exception(errMsg); //Socket 연결 에러 (IP: %1, Port: %2), 서버를 찾을 수 없습니다.
|
||||
} catch(IOException e){
|
||||
String errMsg = ExceptionUtil.getErrorCode(e, "BECEAIASC002", new String[] {strIP, Integer.toString(nPort)});
|
||||
throw new Exception(errMsg); //Socket 연결 에러 (IP: %1, Port: %2), I/O Exception이 발생했습니다.
|
||||
}
|
||||
|
||||
// 결과를 확인한다.
|
||||
int nErrorCode = batchMsgDoc.getBatchMsg().getBody().getErrorCode();
|
||||
if (nErrorCode == ERROR_NO_ERROR) {
|
||||
// 성공 ...
|
||||
String strResponseCode = batchMsgDoc.getBatchMsg().getBody().getLastResCode();
|
||||
if (strResponseCode.equalsIgnoreCase("000")) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("[SUCCESS] IP[" + strIP +"]");
|
||||
sb.append("PORT[" + strPort + "] connection test ok!!!");
|
||||
response.getWriter().println(sb.toString());
|
||||
} else {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("[ERROR] IP[" + strIP +"]");
|
||||
sb.append("PORT[" + strPort + "] Receive Error response Code");
|
||||
sb.append("[" + strResponseCode + "]");
|
||||
response.getWriter().println(sb.toString());
|
||||
}
|
||||
} else {
|
||||
// 실패 ...
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("[ERROR]");
|
||||
sb.append("ERROR CODE [" + nErrorCode + "]" + this.getErrorMsg(nErrorCode));
|
||||
response.getWriter().println(sb.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error( ex.getMessage(), ex);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(ex.getMessage());
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
// IGNORE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BatchDoc setBatchMessage(BatchDoc batchMsgDoc, String strBatchCode, String strOsdCode, String strBizCode, String strTargetIP, String strTargetPort)
|
||||
{
|
||||
//----------------------------------------------------------------------------------------
|
||||
ArrayList<OutsideVO> osd_array = OutsideManager.getInstance().getOutsideInfo(strBatchCode);
|
||||
if (osd_array == null) {
|
||||
this.errorMsg = "Not found outside institution information list of Batch Job Code["+strBatchCode+"]";
|
||||
logger.debug(this.errorMsg);
|
||||
return null;
|
||||
}
|
||||
int i = 0;
|
||||
for (i=0; i<osd_array.size(); i++) {
|
||||
OutsideVO vo = (OutsideVO) osd_array.get(i);
|
||||
if (vo.getOsdCode().equalsIgnoreCase(strOsdCode)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == osd_array.size()) {
|
||||
this.errorMsg = "Not found outside institution information by 대외기관코드["+strOsdCode+"] 배치업무코드["+strBatchCode+"]";
|
||||
logger.debug(this.errorMsg);
|
||||
return null;
|
||||
}
|
||||
OutsideVO ovo = (OutsideVO) osd_array.get(i);
|
||||
|
||||
ArrayList<OutsideLinkVO> link_Array = OutsideManager.getInstance().getOutsideLinkInfo(strOsdCode);
|
||||
if (link_Array == null) {
|
||||
this.errorMsg = "Not found outside link list(TSEAIBJ05) of institution code in OutsideManager ["+strOsdCode+"]";
|
||||
logger.debug(this.errorMsg);
|
||||
return null;
|
||||
}
|
||||
int idx = 0;
|
||||
OutsideLinkVO linkVO = null;
|
||||
for (idx = 0; idx< link_Array.size(); idx++) {
|
||||
linkVO = (OutsideLinkVO) link_Array.get(idx);
|
||||
if (linkVO.getLinkIP().equalsIgnoreCase(strTargetIP) && linkVO.getLinkPort().trim().equalsIgnoreCase(strTargetPort)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (idx == link_Array.size()) {
|
||||
this.errorMsg = "Not found outside link information by mapping IP["+strTargetIP+"] Port["+strTargetPort+"]";
|
||||
logger.debug(this.errorMsg);
|
||||
return null;
|
||||
}
|
||||
String uuid = UUIDGenerator.getUUID();
|
||||
batchMsgDoc.getBatchMsg().getHeader().setUUID(uuid);
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessCode(ovo.getBatchCode());
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessName(ovo.getBatchName());
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessType(CommonKeys.PROCESS_REQUEST_SEND);
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionCode(ovo.getOsdCode());
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionName(ovo.getOsdName());
|
||||
batchMsgDoc.getBatchMsg().getHeader().setScheduleCode("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setScheduleSTime("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setScheduleETime("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFilePath("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFileName("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setRenamedFileName("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setJobCode("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBizCode(strBizCode);
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFlowCode(this.ruleID);
|
||||
batchMsgDoc.getBatchMsg().getHeader().setRuleCode(this.ruleID);
|
||||
// RULE 정보 조회
|
||||
RuleInfoVO vo = RuleInfoManager.getInstance().getRuleInfo(this.ruleID);
|
||||
batchMsgDoc.getBatchMsg().getHeader().setRuleDesc(vo.getDesc());
|
||||
batchMsgDoc.getBatchMsg().getHeader().setLayerCode(CommonKeys.LAYER_FLOW_CONTROLLER);
|
||||
batchMsgDoc.getBatchMsg().getHeader().setTRXID("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setRequestResponse("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setSendRecv("");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setUserName("");
|
||||
// batchMsgDoc.getBatchMsg().getHeader().setProtocol("TCP/IP");
|
||||
batchMsgDoc.getBatchMsg().getHeader().setUserID(linkVO.getUserID()); // 실제 링크가 할당되면 알수 있다.
|
||||
batchMsgDoc.getBatchMsg().getHeader().setUserPassword(linkVO.getPwd()); // 실제 링크가 할당되면 알수 있다.
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBlockSize(ovo.getBlkSize());
|
||||
batchMsgDoc.getBatchMsg().getHeader().setSequenceSize(ovo.getSequenceSize());
|
||||
batchMsgDoc.getBatchMsg().getHeader().setRemoteIP(linkVO.getLinkIP()); // 실제 링크가 할당되면 알수 있다.
|
||||
batchMsgDoc.getBatchMsg().getHeader().setPort(linkVO.getLinkPort()); // 실제 링크가 할당되면 알수 있다.
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBatchStartTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
|
||||
batchMsgDoc.getBatchMsg().getBody().setSubUUID(uuid);
|
||||
batchMsgDoc.getBatchMsg().getBody().setSubLayerCode(CommonKeys.SUB_LAYER_FLOW_PHASE_CK);
|
||||
batchMsgDoc.getBatchMsg().getBody().setWLIServerName(System.getProperty("weblogic.Name"));
|
||||
|
||||
batchMsgDoc.getBatchMsg().getBody().setActionTag("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setRecallTag("");
|
||||
|
||||
batchMsgDoc.getBatchMsg().getBody().setBlockNum(0); // 현 운영 블럭넘버
|
||||
batchMsgDoc.getBatchMsg().getBody().setSeqNum(0); // 현 운영 시퀀스 넘버
|
||||
|
||||
batchMsgDoc.getBatchMsg().getBody().setLastPhaseCode("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setNextPhaseCode("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setLastPhaseStartTime("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setLastPhaseEndTime("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseStartTime("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseEndTime("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setLastPhaseType("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseType("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setNextPhaseType("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setNodeCount(0);
|
||||
batchMsgDoc.getBatchMsg().getBody().setPortNo("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setSndMsgCode("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setRcvMsgCode("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setTimeoutInterval("");
|
||||
batchMsgDoc.getBatchMsg().getBody().setRetryCount(0);
|
||||
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setRuleCode ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setPhaseCode ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setPhaseType ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setFlowClassName ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setLengthTelegramID ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setLengthClassName ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setLengthMsgCode ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setLengthFieldIndex (-1);
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setPhaseSeq ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setPhaseTelegramID ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setPhaseClassName ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setPhaseMsgCode ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setTelegramTypeValue ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setBizCodeValue ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setControlCodeValue ("");
|
||||
batchMsgDoc.getBatchMsg().getPhaseinfo().setResponseCodeValue ("");
|
||||
|
||||
//스케쥴러 Processing 단계 시작시간 설정
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseStartTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
return batchMsgDoc;
|
||||
}
|
||||
|
||||
public String getErrorMsg(int nErrorCode) {
|
||||
switch (nErrorCode) {
|
||||
case ERROR_NO_ERROR:
|
||||
return "NO_ERROR";
|
||||
case ERROR_NO_SOCKET :
|
||||
return "NO SOCKET";
|
||||
case ERROR_NO_PROCDATA :
|
||||
return "NO PROCDATA";
|
||||
case ERROR_NO_NEXTSTAGE :
|
||||
return "NO NEXT STAGE";
|
||||
case ERROR_TELEGRAM_COMPILE :
|
||||
return "TELEGRAM COMPILE";
|
||||
case ERROR_RECV_PRE_LENGTH :
|
||||
return "RECV PRE LENGTH";
|
||||
case ERROR_RECV_ERROR :
|
||||
return "RECV ERROR";
|
||||
case ERROR_TIMEOUT_OVER :
|
||||
return "TIMEOUT OVER";
|
||||
case ERROR_RECV_SHORT_LENGTH :
|
||||
return "RECV SHORT LENGTH";
|
||||
case ERROR_LENGTH_PARSE :
|
||||
return "LENGTH PARSE ERROR";
|
||||
case ERROR_UNEXPECTED_TELEGRAM :
|
||||
return "UNEXPECTED TEELGRAM";
|
||||
case ERROR_NO_CLASS_DEFINITION :
|
||||
return "NO CLASS DEFINITION";
|
||||
case ERROR_NO_TELEGRAM_ID :
|
||||
return "NO TELEGRAM ID";
|
||||
case ERROR_WRITE_ERROR :
|
||||
return "WRITE ERROR";
|
||||
case ERROR_SEND_VALIDATION :
|
||||
return "SEND VALIDATION ERROR";
|
||||
case ERROR_RECV_VALIDATION :
|
||||
return "RECV VALIDATION ERROR";
|
||||
case ERROR_POST_EXECUTION :
|
||||
return "doPostExecution ERROR";
|
||||
case ERROR_EXECUTION :
|
||||
return "doExecute ERROR";
|
||||
case ERROR_ERR_TELEGRAM_META :
|
||||
return "ERROR TELEGRAM META DATA";
|
||||
case ERROR_INFORMAL_ACTION :
|
||||
return "ERROR IN INFORMAL FIELD ACTION";
|
||||
case ERROR_READ_FILE :
|
||||
return "READ FILE ERROR";
|
||||
case ERROR_INFORMAL_FIELD_LENGTH : // 플로우 컴포넌트에서 송수신 중 비정형필드에 대한 처리데이터 길이를 구할 수 없다.
|
||||
return "ERROR IN INFORMAL FIELD LENGTH";
|
||||
case ERROR_NO_SOCKET_PORT : // 소켓연결 중 소켓 포트정보가 없다.
|
||||
return "SOCKET PORT ERROR";
|
||||
case ERROR_FAIL_TO_CONNECT : // Outbound 소켓연결 중 연결 실패
|
||||
return "SOCKET CONNECT ERROR";
|
||||
default:
|
||||
return "UNKNOWN ERROR CODE["+nErrorCode+"]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterDAO;
|
||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
import com.eactive.eai.adapter.AdapterVO;
|
||||
import com.eactive.eai.adapter.socket.config.SocketAdapterManager;
|
||||
import com.eactive.eai.adapter.socket.service.SocketService;
|
||||
import com.eactive.eai.common.dao.DAOException;
|
||||
import com.eactive.eai.common.dao.DAOFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class CheckServerSocket extends HttpServlet
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
/**
|
||||
* 1. 기능 : 요청으로 전달된 Command 실행
|
||||
* 2. 처리 개요 : 요청으로 전달된 Command 실행하고 실행된 결과를 ObjectOutStream을 통해 전송
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
boolean bAllOK = true;
|
||||
logger.info("[CheckServerSocket] Servlet starting .......");
|
||||
response.setContentType("text/html;charset=euc-kr");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
ArrayList<AdapterGroupVO> groups = null;
|
||||
AdapterDAO dao = null;
|
||||
try {
|
||||
dao = (AdapterDAO)DAOFactory.newInstance().create(AdapterDAO.class);
|
||||
groups = dao.getAllAdapterGroups();
|
||||
} catch(DAOException e) {
|
||||
response.getWriter().println("[ERROR] AdapterDAO.getAllDapterGroups 조회시 장애 발생 ... ");
|
||||
return;
|
||||
}
|
||||
logger.info("[CheckServerSocket] Queried AdapterGroup count = " + groups.size());
|
||||
AdapterGroupVO gvo = null;
|
||||
// AdapterVO avo = null;
|
||||
for(int i=0;i<groups.size();i++) {
|
||||
gvo = (AdapterGroupVO)groups.get(i);
|
||||
ArrayList<AdapterVO> all = null;
|
||||
try {
|
||||
all = dao.getAllAdapters(gvo.getName());
|
||||
for(int j=0;j<all.size();j++) {
|
||||
AdapterVO vo = all.get(j);
|
||||
// String ip = vo.getBatchServerIP();
|
||||
// String port = vo.getBatchServerPortNo();
|
||||
sb.append("[BatchJob : "+vo.getBatchProcessCode()+"]");
|
||||
sb.append("["+vo.getBatchInstitutionName()+" - "+vo.getBatchInstitutionCode()+"]");
|
||||
sb.append("["+vo.getAdapterGroupName()+" >> "+vo.getName()+"]");
|
||||
sb.append("[ HOST : " + vo.getBatchServerIP() + " PORT : " + vo.getBatchServerPortNo() + " ]");
|
||||
|
||||
SocketService ss = SocketAdapterManager.getInstance().getSocketService(vo.getAdapterGroupName(), vo.getName());
|
||||
if (ss == null) {
|
||||
sb.append("[ SOCKET SERVICE : NOT EXISTS !!! ]");
|
||||
bAllOK = false;
|
||||
} else {
|
||||
if (ss.isActive()) {
|
||||
sb.append("[ SOCKET SERVICE : ACTIVE !!! ]");
|
||||
} else {
|
||||
sb.append("[ SOCKET SERVICE : IN ACTIVE !!!]");
|
||||
bAllOK = false;
|
||||
}
|
||||
}
|
||||
sb.append("<BR>\n");
|
||||
}
|
||||
|
||||
} catch(DAOException e) {
|
||||
response.getWriter().println("[ERROR] AdapterDAO.getAllDapterGroups 조회시 장애 발생 ... ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (bAllOK) {
|
||||
response.getWriter().println("[SUCCESS]<BR>");
|
||||
} else {
|
||||
response.getWriter().println("[ERROR]<BR>");
|
||||
}
|
||||
response.getWriter().println(sb.toString());
|
||||
} catch (Exception ex) {
|
||||
logger.error( ex.getMessage(), ex);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(ex.getMessage());
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
// IGNORE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterManager;
|
||||
import com.eactive.eai.batch.code.CodeMessageManager;
|
||||
import com.eactive.eai.batch.eventscheduler.holiday.HolidayManager;
|
||||
import com.eactive.eai.batch.flowController.FlowControllerManager;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.rule.dirInfo.DirInfoManager;
|
||||
import com.eactive.eai.batch.rule.nodeinfo.NodeInfoManager;
|
||||
import com.eactive.eai.batch.rule.nodeinfo.NodeInfoVO;
|
||||
import com.eactive.eai.batch.rule.phaseinfo.PhaseInfoManager;
|
||||
import com.eactive.eai.batch.rule.phaseinfo.PhaseInfoVO;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoManager;
|
||||
import com.eactive.eai.batch.rule.ruleinfo.RuleInfoVO;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoManager;
|
||||
import com.eactive.eai.batch.rule.telegraminfo.TelegramInfoVO;
|
||||
import com.eactive.eai.batch.telegram.TelegramManager;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* LifeCycle에 의해 로드된 데이터를 원격에서 Refresh 하기 위해 제공하는 서블릿
|
||||
*
|
||||
* WebBrowser 를 통해 호출가능하도록 WEB.XML 에 URL 등록함.
|
||||
*/
|
||||
public class DBRefreshAgent extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
/**
|
||||
* 1. 기능 : 요청으로 전달된 Command 실행
|
||||
* 2. 처리 개요 : 요청으로 전달된 Command 실행하고 실행된 결과를 ObjectOutStream을 통해 전송
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("[DBRefreshAgent] Servlet starting .......");
|
||||
|
||||
String strTarget = request.getParameter("Target");
|
||||
if (strTarget == null) strTarget = "";
|
||||
|
||||
response.setContentType("text/html;charset=euc-kr");
|
||||
if (strTarget.equalsIgnoreCase("ALL")) {
|
||||
// 일단 당분간 테스트를 위해 여기서 REFRESH 하자
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ PhaseInfoManager data reload ");
|
||||
PhaseInfoManager.getInstance().stop();
|
||||
PhaseInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBR02 table reloaded !!!<BR><BR>");
|
||||
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ NodeInfoManager data reload ");
|
||||
NodeInfoManager.getInstance().stop();
|
||||
NodeInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBR03 table reloaded !!!<BR><BR>");
|
||||
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ RuleInfoManager data reload ");
|
||||
RuleInfoManager.getInstance().stop();
|
||||
RuleInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBR04 table reloaded !!!<BR><BR>");
|
||||
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ RuleInfoManager data reload ");
|
||||
TelegramInfoManager.getInstance().stop();
|
||||
TelegramInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBR05 table reloaded !!!<BR><BR>");
|
||||
|
||||
logger.info("[DBRefreshAgentAgent] 대외기관 정보 리로딩 한다.");
|
||||
OutsideManager.getInstance().stop();
|
||||
OutsideManager.getInstance().start();
|
||||
AdapterManager.getInstance().stop();
|
||||
AdapterManager.getInstance().start();
|
||||
FlowControllerManager.getInstance().stop();
|
||||
FlowControllerManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBJ06, TSEAIBJ05 Reloading OK !!! <BR>");
|
||||
|
||||
logger.info("[DBRefreshAgentAgent] 업무분류 코드 및 서브 디렉토리 정보 .");
|
||||
DirInfoManager.getInstance().stop();
|
||||
DirInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBJ01 Reloading OK !!! <BR>");
|
||||
|
||||
logger.info("[DBRefreshAgentAgent] Property Table Reloading .");
|
||||
PropManager.getInstance().stop();
|
||||
PropManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBP01, TSEAIBP02 (Property table) Reloading OK !!! <BR>");
|
||||
|
||||
logger.info("[DBRefreshAgentAgent] CodeMessage Table Reloading .");
|
||||
CodeMessageManager.getInstance().stop();
|
||||
CodeMessageManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBP05 CodeMessage table Reloading OK !!! <BR>");
|
||||
|
||||
logger.info("[DBRefreshAgentAgent] Telegram Table Reloading .");
|
||||
TelegramManager.getInstance().stop();
|
||||
TelegramManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBM02 Telegram table Reloading OK !!! <BR>");
|
||||
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 정보 [TSEAIBR04] <BR>");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayRuleInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 구성 노드 (STAGE) [TSEAIBR03] 정보<BR> ");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayNodeInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 구성노드 변환 규칙 [TSEAIBR02] <BR> ");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayPhaseInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 노드(단계)별 처리 담당 클래스 리스트 [TSEAIBR05] <BR>");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayTelegramInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBR02")) {
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ PhaseInfoManager data reload ");
|
||||
PhaseInfoManager.getInstance().stop();
|
||||
PhaseInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBR02 table reloaded !!!<BR><BR>");
|
||||
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 구성노드 변환 규칙 <BR>");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayPhaseInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBR03")) {
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ NodeInfoManager data reload ");
|
||||
NodeInfoManager.getInstance().stop();
|
||||
NodeInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBR03 table reloaded !!!<BR><BR>");
|
||||
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 구성 노드 (STAGE) 정보 <BR>");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayNodeInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBR04")) {
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ RuleInfoManager data reload ");
|
||||
RuleInfoManager.getInstance().stop();
|
||||
RuleInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBR04 table reloaded !!!<BR><BR>");
|
||||
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 정보 <BR>");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayRuleInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBR05")) {
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ RuleInfoManager data reload ");
|
||||
TelegramInfoManager.getInstance().stop();
|
||||
TelegramInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBR05 table reloaded !!!<BR><BR>");
|
||||
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 노드(단계)별 처리 담당 클래스 리스트 <BR>");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayTelegramInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBJ06")) {
|
||||
logger.info("[DBRefreshAgentAgent] 대외기관 정보 리로딩 한다.");
|
||||
OutsideManager.getInstance().stop();
|
||||
OutsideManager.getInstance().start();
|
||||
AdapterManager.getInstance().stop();
|
||||
//socket이 realead되기를 기다리기 위해 2초 sleep
|
||||
Thread.sleep(2*1000);
|
||||
|
||||
AdapterManager.getInstance().start();
|
||||
FlowControllerManager.getInstance().stop();
|
||||
FlowControllerManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBJ06, TSEAIBJ05 Reloading OK !!! <BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBJ01")) {
|
||||
logger.info("[DBRefreshAgentAgent] 업무분류 코드 및 서브 디렉토리 정보 .");
|
||||
DirInfoManager.getInstance().stop();
|
||||
DirInfoManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBJ01 Reloading OK !!! <BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBP01")) {
|
||||
logger.info("[DBRefreshAgentAgent] Property Table Reloading .");
|
||||
PropManager.getInstance().stop();
|
||||
PropManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBP01, TSEAIBP02 (Property table) Reloading OK !!! <BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBP05")) {
|
||||
logger.info("[DBRefreshAgentAgent] CodeMessage Table Reloading .");
|
||||
CodeMessageManager.getInstance().stop();
|
||||
CodeMessageManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBP05 CodeMessage table Reloading OK !!! <BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("TSEAIBM02")) {
|
||||
logger.info("[DBRefreshAgentAgent] Telegram Table Reloading .");
|
||||
TelegramManager.getInstance().stop();
|
||||
TelegramManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBM02 Telegram table Reloading OK !!! <BR>");
|
||||
}
|
||||
else if (strTarget.equalsIgnoreCase("VIEW")) {
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 정보 [TSEAIBR04] <BR>");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayRuleInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 구성 노드 (STAGE) [TSEAIBR03] 정보<BR> ");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayNodeInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 구성노드 변환 규칙 [TSEAIBR02] <BR> ");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayPhaseInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
response.getWriter().println("▷▷▷ 룰 노드(단계)별 처리 담당 클래스 리스트 [TSEAIBR05] <BR>");
|
||||
response.getWriter().println("-------------------------------------------------------------------------------------------------<BR>");
|
||||
this.displayTelegramInfo(response);
|
||||
response.getWriter().println("================================================================================================<BR>");
|
||||
}else if (strTarget.equalsIgnoreCase("TSEAIBE02")) {
|
||||
logger.info("[DBRefreshAgentAgent] EventScheduler Holiday Table Reloading .");
|
||||
HolidayManager.getInstance().stop();
|
||||
HolidayManager.getInstance().start();
|
||||
response.getWriter().println("TSEAIBE02 EventScheduler Holiday table Reloading OK !!! <BR>");
|
||||
} else {
|
||||
logger.info("[DBResfreshAgent] ▷▷▷ unknown target !!!! >>"+strTarget+"<<<BR>");
|
||||
response.getWriter().println("Unknown Target. No process done !!! ▷▷▷ CHECK YOUR URL ▷▷▷<BR>");
|
||||
response.getWriter().println("▷▷▷ URL PATTERN ▷▷▷<BR>");
|
||||
response.getWriter().println("▷▷▷▷▷▷▷▷▷▷▷▷▷▷▷ <BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=ALL'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=ALL</A> ▷▷▷룰관련 모든 매니저 DB 리로딩 <BR>" );
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=VIEW'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=VIEW</A> ▷▷▷룰관련 모든 매니저 DB Display <BR>" );
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBR02'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBR02</A> ▷▷▷PHASE 변환룰 정보<BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBR03'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBR03</A> ▷▷▷PHASE 정보<BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBR04'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBR04</A> ▷▷▷RULE 정보<BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBR05'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBR05</A> ▷▷▷텔레그램 매핑정보<BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBJ06'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBJ06</A> ▷▷▷대외기관정보 (TSEAIBJ06, TSEAIBJ05 둘다 리프레쉬)<BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBJ01'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBJ01</A> ▷▷▷파일이름기반 거래분류 테이블 <BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBP01'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBP01</A> ▷▷▷프라퍼티테이블 정보 <BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBP05'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBP05</A> ▷▷▷코드메세지 테이블 정보 <BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBM02'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBM02</A> ▷▷▷Telegram 테이블 정보 <BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBE02'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBE02</A> ▷▷▷이벤트 스케줄러 휴일관리 테이블 정보 <BR>");
|
||||
response.getWriter().println("<A href='http://" + request.getServerName()+":"+request.getServerPort()+ request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBE03'>http://" + request.getServerName()+":"+request.getServerPort()+ "/" + request.getContextPath() + "/DBRefreshAgent?Target=TSEAIBE03</A> ▷▷▷이벤트 스케줄러 테이블 정보 <BR>");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error( ex.getMessage(), ex);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(ex.getMessage());
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
// IGNORE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void displayPhaseInfo(HttpServletResponse response) {
|
||||
try {
|
||||
HashMap<String, ArrayList<PhaseInfoVO>> hm = PhaseInfoManager.getInstance().getAllData();
|
||||
Object[] objs = hm.keySet().toArray();
|
||||
for (int i=0; i<objs.length; i++) {
|
||||
String rulecode = (String)objs[i];
|
||||
ArrayList<PhaseInfoVO> al = hm.get(rulecode);
|
||||
response.getWriter().println("RULE ["+rulecode+"] phase(stage) change rule record count >> " + al.size() + "<BR>");
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public void displayNodeInfo(HttpServletResponse response) {
|
||||
try {
|
||||
HashMap<String, ArrayList<NodeInfoVO>> hm = NodeInfoManager.getInstance().getAllData();
|
||||
Object[] objs = hm.keySet().toArray();
|
||||
for (int i=0; i<objs.length; i++) {
|
||||
String rulecode = (String)objs[i];
|
||||
ArrayList<NodeInfoVO> al = hm.get(rulecode);
|
||||
response.getWriter().println("RULE ["+rulecode+"] distinct node(stage) count >> " + al.size()+ "<BR>");
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public void displayRuleInfo(HttpServletResponse response) {
|
||||
try {
|
||||
HashMap<String, RuleInfoVO> hm = RuleInfoManager.getInstance().getAllData();
|
||||
Object[] objs = hm.keySet().toArray();
|
||||
for (int i=0; i<objs.length; i++) {
|
||||
String rulecode = (String)objs[i];
|
||||
RuleInfoVO vo = hm.get(rulecode);
|
||||
response.getWriter().println("RULE ["+rulecode+"] >>> " + vo.getDesc()+ "<BR>");
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public void displayTelegramInfo(HttpServletResponse response) {
|
||||
try {
|
||||
HashMap<String, TelegramInfoVO> hm = TelegramInfoManager.getInstance().getAllData();
|
||||
Object[] objs = hm.keySet().toArray();
|
||||
for (int i=0; i<objs.length; i++) {
|
||||
String telegramid = (String)objs[i];
|
||||
TelegramInfoVO vo = hm.get(telegramid);
|
||||
response.getWriter().println("TELEGRAM MAPPING ["+telegramid+"] : Telegram MetaCode ["+vo.getMsgMetaDstcd()+"] --- Class ["+vo.getTelegramClsName()+"]<BR>");
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import static com.eactive.eai.agent.web.FepFileSupport.ENCODING;
|
||||
import static com.eactive.eai.agent.web.FepFileSupport.FAIL;
|
||||
import static com.eactive.eai.agent.web.FepFileSupport.SUCCESS;
|
||||
import static com.eactive.eai.agent.web.FepFileSupport.getResMsg;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageVO;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class FepFileReceive extends HttpServlet{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
/**
|
||||
* 1. 기능 : Eai Bat Call
|
||||
* 2. 처리 개요 : 요청 메세지를 받아서 처리 후 메세지 리턴.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("Servlet starting .......");
|
||||
|
||||
String msg = request.getParameter("msg");
|
||||
logger.debug("msg["+msg+"]");
|
||||
response.setCharacterEncoding(ENCODING);
|
||||
PrintWriter writer = response.getWriter();
|
||||
|
||||
if ( msg == null || msg.getBytes().length < 110 ){
|
||||
writer.print(getResMsg(FAIL, "파라메터값(msg)이 전달되지 않았습니다. length = " + ((msg == null) ? 0 : msg.getBytes().length)));
|
||||
return;
|
||||
}
|
||||
if ( !msg.endsWith("@@") ){
|
||||
writer.print(getResMsg(FAIL, "종료문자열이 \"@@\" 이어야 합니다."));
|
||||
return;
|
||||
}
|
||||
getFileEventInfo(msg);
|
||||
writer.print(getResMsg(SUCCESS, "수신 요청했습니다."));
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.debug(ex.getMessage(), ex);
|
||||
try {
|
||||
response.getWriter().print(getResMsg(FAIL, "E:" + ex.getMessage()));
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 요구 수신을 처리한다.
|
||||
* @param message 요청 받은 메시지
|
||||
* @throws Exception
|
||||
*/
|
||||
private void getFileEventInfo(String message) throws Exception
|
||||
{
|
||||
// 수신한 파일 정보
|
||||
logger.info("[Recv File Event] =========================================================================");
|
||||
logger.info("[Recv File Event] ▶▶▶▶▶▶▶▶▶▶ Local 수신요청 FILE EVENT 발생 !! ◀◀◀◀◀◀◀◀◀◀");
|
||||
logger.info("[Recv File Event] ※ 요청 메시지 : [" + message +"]");
|
||||
logger.info("[Recv File Event] =========================================================================");
|
||||
|
||||
String processCode = message.substring(0, 5);
|
||||
String institutionCode = message.substring(5, 9);
|
||||
|
||||
logger.info("processCode = " + processCode);
|
||||
logger.info("institutionCode = " + institutionCode);
|
||||
|
||||
//거래구분 코드 설정
|
||||
OutsideVO organInfo = OutsideManager.getInstance().getOutsideInfo(processCode, institutionCode);
|
||||
if ( organInfo == null ){
|
||||
throw new Exception("미등록 업무구분/기관코드:" + processCode + "/" + institutionCode);
|
||||
}
|
||||
|
||||
String institutionName = organInfo.getOsdName();
|
||||
String processName = organInfo.getBatchName();
|
||||
String bizCode = message.substring(9, 19).trim();
|
||||
String fileName = message.substring(19, message.length() - 2).trim();
|
||||
|
||||
logger.info("[Recv File Event] -------------------------------------------------------------------------");
|
||||
logger.info("[Recv File Event] ■ File Event 파싱 정보");
|
||||
logger.info("[Recv File Event] - 업무구분명 : [" + processName +"] (업무구분코드: "+ processCode +")");
|
||||
logger.info("[Recv File Event] - 대외기관명 : [" + institutionName +"] (대외기관코드: "+ institutionCode +")");
|
||||
logger.info("[Recv File Event] - 거래구분코드: [" + bizCode +"]");
|
||||
logger.info("[Recv File Event] - 수신파일명 : [" + fileName +"]");
|
||||
logger.info("[Recv File Event] -------------------------------------------------------------------------");
|
||||
|
||||
String remotePath = null;
|
||||
if (fileName.contains("/")) {
|
||||
int position = fileName.lastIndexOf("/");
|
||||
remotePath = fileName.substring(0, position);
|
||||
fileName = fileName.substring(position + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* FileEvent가 SchedulerProcess로 전달할 기본 EAIBatchMsg를 생성한다.
|
||||
* FileEventListener가 입력가능한 값들은 EAIBatchMsg의 항목 중 다음과 같다.
|
||||
* - UUID
|
||||
* - Layer 구분 코드 (한시적)
|
||||
* - ProcessCode: 수신한 서브디렉토리와 동일
|
||||
* - FileName : 송수신 원 파일명
|
||||
* - FilePath : 파일이 실재 존재하는 디렉토리
|
||||
* - RenamedFileName : 저장후 이름이 변경된 파일명
|
||||
*/
|
||||
// BatchMsgDoc 생성
|
||||
BatchDoc batchMsgDoc = EAIBatchMsgManager.createBatchMsgWithUUID(false); //UUID 생성, false:초기화안함
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_FILE_EVENT, CommonKeys.SUB_LAYER_FILE_EVENT); // layer, flowPahse, 시작시간 설정
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessCode(processCode); // 업무코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessName(processName); // 업무명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessType(CommonKeys.PROCESS_REQUEST_RECEIVE); // 업무유형 (요구송신 설정)
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionCode(institutionCode); // 대외기관코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionName(institutionName); // 대외기관명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFileName(fileName); // 원 파일명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBizCode(bizCode); // 거래구분코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setHdrInfoName(message); // 체크파일 이름
|
||||
SchedulerMessageVO info = SchedulerMessageManager.getInstance().getRecvScheduleInfo(bizCode, processCode, institutionCode);
|
||||
if ( info == null ){
|
||||
String errMsg = ExceptionUtil.getErrorCode("BECEAISSC016", new String[] {processCode, institutionCode, bizCode});
|
||||
throw new Exception(errMsg); //해당 정보에 대한 스케쥴 정보가 존재하지 않습니다. (업무코드: {1}, 대외기관코드: {2}, 거래구분코드: {3})
|
||||
}
|
||||
|
||||
info.setFileName(fileName);
|
||||
//1. 요구수신 스케쥴러 단계 DB로그를 위한 BatchMsg 객체 생성
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_SCHEDULER, CommonKeys.SUB_LAYER_SCHEDULER_QUEUE); // layer, flowPahse, 시작시간 설정
|
||||
|
||||
//2. 요구수신 디렉토리 설정 (수신_Real/업무구분/대외기관/..)
|
||||
//요구수신 기준 디렉토리 --> 배치업무유형코드(ProcessCode) 와 대외기관코드 (InstitutionCode) 로 계산.
|
||||
String strPathName = BatchDirUtil.getResponseRealDir();
|
||||
if ( strPathName.charAt(strPathName.length()-1) != '/' ) {
|
||||
strPathName = strPathName + '/';
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(processCode);
|
||||
sb.append("/");
|
||||
sb.append(institutionCode);
|
||||
strPathName = strPathName + sb.toString();
|
||||
info.setFilePath(strPathName);
|
||||
|
||||
//3. UUID 설정 및 스케쥴 송수신 시각 설정
|
||||
info.setUUID (batchMsgDoc.getBatchMsg().getHeader().getUUID());
|
||||
info.setSubUUID (batchMsgDoc.getBatchMsg().getBody().getSubUUID());
|
||||
info.setStartTime(DatetimeUtil.getCurrentDate() + "000000000");
|
||||
info.setEndTime (DatetimeUtil.getCurrentDate() + "235900000");
|
||||
info.setHdrInfoName(message);
|
||||
|
||||
//4. Job_Queue 테이블에 등록
|
||||
logger.info("[요구수신 스케쥴러] =========================================================================");
|
||||
logger.info("[요구수신 스케쥴러] ■ 요구수신 스케쥴 정보를 Job_Queue 테이블에 추가......");
|
||||
int resultCnt = SchedulerMessageManager.getInstance().insertJobToQueue(info);
|
||||
logger.info("[요구수신 스케쥴러] ==> 배치 Job_Queue 테이블 INSERT 건수: "+ resultCnt);
|
||||
logger.info("[요구수신 스케쥴러] =========================================================================");
|
||||
|
||||
// 단계 종료시간을 추가한다.
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseEndTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
|
||||
// 요구송신에 대한 최초 DB로그. StartLog 호출.
|
||||
LogUtil.setStartLog (batchMsgDoc);
|
||||
logger.info("[Recv File Event] ※ Event 파일명 : [" + fileName +"]");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import static com.eactive.eai.agent.web.FepFileSupport.ENCODING;
|
||||
import static com.eactive.eai.agent.web.FepFileSupport.FAIL;
|
||||
import static com.eactive.eai.agent.web.FepFileSupport.SUCCESS;
|
||||
import static com.eactive.eai.agent.web.FepFileSupport.getResMsg;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.FileUtil;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageVO;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class FepFileSend extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
|
||||
/**
|
||||
* 1. 기능 : Eai Bat Call
|
||||
* 2. 처리 개요 : 요청 메세지를 받아서 처리 후 메세지 리턴.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("Servlet starting .......");
|
||||
|
||||
String msg = request.getParameter("msg");
|
||||
logger.debug("msg["+msg+"]");
|
||||
response.setCharacterEncoding(ENCODING);
|
||||
|
||||
if ( msg == null || msg.getBytes().length <= 100 ){
|
||||
response.getWriter().print(getResMsg(FAIL, "파라메터값(msg)이 전달되지 않았습니다. length = " + ((msg == null) ? 0 : msg.getBytes().length)));
|
||||
return;
|
||||
}
|
||||
if ( !msg.endsWith("@@") ){
|
||||
response.getWriter().print(getResMsg(FAIL, "종료문자열이 \"@@\" 이어야 합니다."));
|
||||
return;
|
||||
}
|
||||
|
||||
getFileEventInfo(msg);
|
||||
response.getWriter().print(getResMsg(SUCCESS, "송신 요청했습니다."));
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.debug(ex.getMessage(), ex);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(getResMsg(FAIL, ex.getMessage()));
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 요구 송신을 처리한다.
|
||||
* @param message 요청 받은 메시지
|
||||
* @throws Exception
|
||||
*/
|
||||
private void getFileEventInfo(String message) throws Exception
|
||||
{
|
||||
// 송신한 파일 정보
|
||||
logger.info("[Send File Event] =========================================================================");
|
||||
logger.info("[Send File Event] ▶▶▶▶▶▶▶▶▶▶ Local 송신요청 FILE EVENT 발생 !! ◀◀◀◀◀◀◀◀◀◀");
|
||||
logger.info("[Send File Event] ※ 요청 메시지 : [" + message +"]");
|
||||
logger.info("[Send File Event] =========================================================================");
|
||||
|
||||
String processCode = message.substring(0, 5);
|
||||
String institutionCode = message.substring(5, 9);
|
||||
|
||||
logger.info("processCode = " + processCode);
|
||||
logger.info("institutionCode = " + institutionCode);
|
||||
|
||||
//거래구분 코드 설정
|
||||
OutsideVO organInfo = OutsideManager.getInstance().getOutsideInfo(processCode, institutionCode);
|
||||
if ( organInfo == null ){
|
||||
throw new Exception("미등록 업무구분/기관코드:" + processCode + "/" + institutionCode);
|
||||
}
|
||||
|
||||
String institutionName = organInfo.getOsdName();
|
||||
String processName = organInfo.getBatchName();
|
||||
String bizCode = message.substring(9, 19).trim();
|
||||
String fileName = message.substring(19, message.length() - 2).trim();
|
||||
|
||||
logger.info("[Send File Event] -------------------------------------------------------------------------");
|
||||
logger.info("[Send File Event] ■ File Event 파싱 정보");
|
||||
logger.info("[Send File Event] - 업무구분명 : [" + processName +"] (업무구분코드: "+ processCode +")");
|
||||
logger.info("[Send File Event] - 대외기관명 : [" + institutionName +"] (대외기관코드: "+ institutionCode +")");
|
||||
logger.info("[Send File Event] - 거래구분코드: [" + bizCode +"]");
|
||||
logger.info("[Send File Event] - 송신파일명 : [" + fileName +"]");
|
||||
if (fileName.contains("/")) {
|
||||
int position = fileName.lastIndexOf("/");
|
||||
fileName = fileName.substring(position + 1);
|
||||
logger.info("[Send File Event] - 송신파일명2 : [" + fileName +"]");
|
||||
}
|
||||
|
||||
logger.info("[Send File Event] -------------------------------------------------------------------------");
|
||||
|
||||
/* 저장할 디렉토리 및 파일정보
|
||||
* sourceDir : 파일을 읽어올 최상위 디렉토리
|
||||
* targetDir : 파일을 저장할 디렉토리
|
||||
*
|
||||
* 현재는 FileEvent에 의해서 옮겨지는 Arch디렉토리가 읽어 올 디렉토리가 된다. (sourceDir)
|
||||
* Arch 디렉토리에 있는 파일을 읽어서 Arch디렉토리 밑에 업무코드명과 동일하게 디렉토리를 만들고 저장한다.
|
||||
*/
|
||||
String targetDir = BatchDirUtil.getRequestArchDir() +"/"+ processCode +"/"+ institutionCode ;
|
||||
String localDir = BatchDirUtil.getRequestRootDir() +"/"+ processCode +"/"+ institutionCode ;
|
||||
/*
|
||||
* FileEvent가 SchedulerProcess로 전달할 기본 EAIBatchMsg를 생성한다.
|
||||
* FileEventListener가 입력가능한 값들은 EAIBatchMsg의 항목 중 다음과 같다.
|
||||
* - UUID
|
||||
* - Layer 구분 코드 (한시적)
|
||||
* - ProcessCode: 송신한 서브디렉토리와 동일
|
||||
* - FileName : 송송신 원 파일명
|
||||
* - FilePath : 파일이 실재 존재하는 디렉토리
|
||||
* - RenamedFileName : 저장후 이름이 변경된 파일명
|
||||
*/
|
||||
// BatchMsgDoc 생성
|
||||
BatchDoc batchMsgDoc = EAIBatchMsgManager.createBatchMsgWithUUID(false); //UUID 생성, false:초기화안함
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_FILE_EVENT, CommonKeys.SUB_LAYER_FILE_EVENT); // layer, flowPahse, 시작시간 설정
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessCode(processCode); // 업무코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessName(processName); // 업무명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessType(CommonKeys.PROCESS_REQUEST_RECEIVE); // 업무유형 (요구송신 설정)
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionCode(institutionCode); // 대외기관코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionName(institutionName); // 대외기관명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFileName(fileName); // 원 파일명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBizCode(bizCode); // 거래구분코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setHdrInfoName(message); // 거래구분코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFilePath(targetDir); // 파일이 실재 존재하는 디렉토리
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFileErrorPath(targetDir); // 장애발생시 실파일이 이동할 디렉토리를 지정한다.
|
||||
|
||||
moveFile(batchMsgDoc, localDir, fileName, targetDir);
|
||||
|
||||
SchedulerMessageVO info = SchedulerMessageManager.getInstance().getScheduleInfo(bizCode, processCode, institutionCode);
|
||||
if ( info == null ){
|
||||
String errMsg = ExceptionUtil.getErrorCode("BECEAISSC016", new String[] {processCode, institutionCode, bizCode});
|
||||
throw new Exception(errMsg); //해당 정보에 대한 스케쥴 정보가 존재하지 않습니다. (업무코드: {1}, 대외기관코드: {2}, 거래구분코드: {3})
|
||||
}
|
||||
|
||||
info.setFileName(fileName);
|
||||
//1. 요구송신 스케쥴러 단계 DB로그를 위한 BatchMsg 객체 생성
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_SCHEDULER, CommonKeys.SUB_LAYER_SCHEDULER_QUEUE); // layer, flowPahse, 시작시간 설정
|
||||
|
||||
//2. 요구송신 디렉토리 설정 (송신_Real/업무구분/대외기관/..)
|
||||
//요구송신 기준 디렉토리 --> 배치업무유형코드(ProcessCode) 와 대외기관코드 (InstitutionCode) 로 계산.
|
||||
String strPathName = BatchDirUtil.getRequestArchDir();
|
||||
if ( strPathName.charAt(strPathName.length()-1) != '/' ) {
|
||||
strPathName = strPathName + '/';
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(processCode);
|
||||
sb.append("/");
|
||||
sb.append(institutionCode);
|
||||
strPathName = strPathName + sb.toString();
|
||||
info.setFilePath(strPathName);
|
||||
|
||||
//3. UUID 설정 및 스케쥴 송송신 시각 설정
|
||||
info.setUUID (batchMsgDoc.getBatchMsg().getHeader().getUUID());
|
||||
info.setSubUUID (batchMsgDoc.getBatchMsg().getBody().getSubUUID());
|
||||
info.setStartTime(DatetimeUtil.getCurrentDate() + "000000000");
|
||||
info.setEndTime (DatetimeUtil.getCurrentDate() + "235900000");
|
||||
info.setHdrInfoName(message);
|
||||
info.setRenamedFileName(batchMsgDoc.getBatchMsg().getHeader().getRenamedFileName());
|
||||
|
||||
//4. Job_Queue 테이블에 등록
|
||||
logger.info("[요구송신 스케쥴러] =========================================================================");
|
||||
logger.info("[요구송신 스케쥴러] ■ 요구송신 스케쥴 정보를 Job_Queue 테이블에 추가......");
|
||||
int resultCnt = SchedulerMessageManager.getInstance().insertJobToQueue(info);
|
||||
logger.info("[요구송신 스케쥴러] ==> 배치 Job_Queue 테이블 INSERT 건수: "+ resultCnt);
|
||||
logger.info("[요구송신 스케쥴러] =========================================================================");
|
||||
|
||||
// 단계 종료시간을 추가한다.
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseEndTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
|
||||
// 요구송신에 대한 최초 DB로그. StartLog 호출.
|
||||
LogUtil.setStartLog (batchMsgDoc);
|
||||
logger.info("[Send File Event] ※ Event 파일명 : [" + fileName +"]");
|
||||
|
||||
}
|
||||
|
||||
private void moveFile(BatchDoc batchMsgDoc, String dirPath, String fileName, String targetDir) throws Exception
|
||||
{
|
||||
String renamedFileName = fileName + "_" + CalendarUtil.getCurrentTimeNoDash();
|
||||
File realFile = new File(dirPath +"/"+ fileName);
|
||||
File archFile = new File(targetDir +"/"+ renamedFileName);
|
||||
|
||||
//Root 디렉토리에서 Arch 디렉토리로 파일 이동
|
||||
logger.info("[Send File Event] -------------------------------------------------------------------------");
|
||||
logger.info("[Send File Event] ■ 요구송신 파일 이동 (송신_Real -> 송신_Arch)");
|
||||
logger.info("[Send File Event] - Real 디렉토리: ["+ dirPath +"/"+ fileName +"] (exists: "+ realFile.exists() +")");
|
||||
logger.info("[Send File Event] - Arch 디렉토리: ["+ targetDir +"/"+ renamedFileName +"] (exists: "+ archFile.exists() +")");
|
||||
logger.info("[Send File Event] - 변경된 파일명: " + renamedFileName);
|
||||
logger.info("[Send File Event] -------------------------------------------------------------------------");
|
||||
|
||||
boolean isSuccessMoveFile = FileUtil.copyTransferFile(realFile, archFile, true);
|
||||
|
||||
if (!isSuccessMoveFile) {
|
||||
String errMsg = ExceptionUtil.getErrorCode("BECEAIIFE002", new String[] {realFile.getAbsolutePath(), archFile.getAbsolutePath()});
|
||||
throw new Exception(errMsg); //요구송신 데이터파일을 송신_Real 디렉토리({1})에서 송신_Arch 디렉토리({2})로 이동시 실패하였습니다.
|
||||
}
|
||||
batchMsgDoc.getBatchMsg().getHeader().setRenamedFileName(renamedFileName); //변경된 파일명 설정
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import com.eactive.eai.adapter.socket.common.CommonLib;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.doc.Header;
|
||||
|
||||
public class FepFileSupport {
|
||||
/** encoding */
|
||||
public static final String ENCODING = "MS949";
|
||||
/** 파일 송신 상태 검사 */
|
||||
public static final String SUCCESS = "SUCCESS";
|
||||
/** 파일 요구 수신 */
|
||||
public static final String FAIL = "FAIL";
|
||||
|
||||
/**
|
||||
* HTTP 요청에 대한 응답
|
||||
* @param responseCode 성공 여부
|
||||
* @param responseMessage 메시지
|
||||
* @return HTTP 요청 응답 전문
|
||||
*/
|
||||
public static String getResMsg(String responseCode, String responseMessage) {
|
||||
String outStr = String.format("%-10s%s@@", responseCode, CommonLib.stringFormat(responseMessage, false, ' ', 100));
|
||||
return outStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 송수신 후 결과 통보
|
||||
* @param sendOrReceive 송수신 구분. S: 송신, R: 수신
|
||||
* @param resultCode 성공 여부
|
||||
* @param batchDoc
|
||||
* @param remoteFilename 송수신 파일 이름
|
||||
* @param ListFileName 수신할 List 파일 이름
|
||||
* @param ListFileYn 수신시 List 파일 존재 여부. Y/N
|
||||
* @return 파일 송수신 결과 통보 전문
|
||||
*/
|
||||
public static String getNotifyMessage(String sendOrReceive, boolean resultCode, BatchDoc batchDoc, String listFileName, String ListFileYn, int fileCount, String remoteFilename) {
|
||||
String result = resultCode ? SUCCESS : FAIL;
|
||||
Header header = batchDoc.getBatchMsg().getHeader();
|
||||
String outStr = String.format("%s%-10s%5s%4s%-10s%-100s%010d%-100s%1s@@", sendOrReceive, result,
|
||||
header.getProcessCode(), header.getInstitutionCode(), header.getBizCode(),
|
||||
remoteFilename, fileCount, listFileName, ListFileYn);
|
||||
return outStr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.adapter.socket.common.CommonLib;
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageVO;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class FepReqRecvFile extends HttpServlet{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
/**
|
||||
* 1. 기능 : Eai Bat Call
|
||||
* 2. 처리 개요 : 요청 메세지를 받아서 처리 후 메세지 리턴.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("Servlet starting .......");
|
||||
|
||||
String msg = request.getParameter("msg");
|
||||
logger.debug("msg["+msg+"]");
|
||||
response.setCharacterEncoding("EUC-KR");
|
||||
|
||||
if ( msg == null || msg.getBytes().length < 140 ){
|
||||
response.setCharacterEncoding("EUC-KR");
|
||||
response.getWriter().print(getResMsg(false, "E:메시지 값이 전달되지 않았습니다."));
|
||||
return;
|
||||
}
|
||||
if ( !msg.endsWith("@@") ){
|
||||
response.setCharacterEncoding("EUC-KR");
|
||||
response.getWriter().print(getResMsg(false, "E:종료문자열이 \"@@\" 이어야 합니다."));
|
||||
return;
|
||||
}
|
||||
|
||||
String trx_id = msg.substring(0, 19).trim();
|
||||
logger.debug("trx_id["+trx_id+"]");
|
||||
String fileName = msg.substring(38, 138).trim();
|
||||
logger.debug("fileName["+fileName+"]");
|
||||
|
||||
if ( !trx_id.equals("FEP_REQ_RECV") ){
|
||||
response.setCharacterEncoding("EUC-KR");
|
||||
response.getWriter().print(getResMsg(false, "E:요청 시작 문자열이 \"FEP_REQ_RECV\" 이어야 합니다."));
|
||||
return;
|
||||
}
|
||||
getFileEventInfo(fileName);
|
||||
response.setCharacterEncoding("EUC-KR");
|
||||
response.getWriter().print(getResMsg(true, fileName));
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.debug(ex.getMessage(), ex);
|
||||
try {
|
||||
response.getWriter().print(getResMsg(false, "E:" + ex.getMessage()));
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
private String getResMsg( boolean flag, String msg){
|
||||
String sFlag = "1";
|
||||
if ( flag ) sFlag = "0";
|
||||
String outStr = "FEP_REQ_RECV " +
|
||||
DatetimeUtil.getCurrentDate() +
|
||||
"0000000000" + sFlag + CommonLib.stringFormat(msg, false, ' ', 100) + "@@";
|
||||
return outStr;
|
||||
|
||||
}
|
||||
|
||||
private void getFileEventInfo(String reqFileName) throws Exception
|
||||
{
|
||||
// 수신한 파일 정보
|
||||
logger.info("[Req Recv File Event] =========================================================================");
|
||||
logger.info("[Req Recv File Event] ▶▶▶▶▶▶▶▶▶▶ Local 수신요청 FILE EVENT 발생 !! ◀◀◀◀◀◀◀◀◀◀");
|
||||
logger.info("[Req Recv File Event] ※ Event 파일명 : [" + reqFileName +"]");
|
||||
logger.info("[Req Recv File Event] =========================================================================");
|
||||
|
||||
String processCode = reqFileName.substring(0, 5);
|
||||
String institutionCode = reqFileName.substring(6, 10);
|
||||
|
||||
logger.info("processCode = " + processCode);
|
||||
|
||||
logger.info("institutionCode = " + institutionCode);
|
||||
|
||||
//거래구분 코드 설정
|
||||
int bizCodeStartIndex = 0;
|
||||
int bizCodeEndIndex = 0;
|
||||
OutsideVO organInfo = OutsideManager.getInstance().getOutsideInfo(processCode, institutionCode);
|
||||
if ( organInfo == null ){
|
||||
throw new Exception("미등록 업무구분/기관코드:" + processCode + "/" + institutionCode);
|
||||
}
|
||||
String institutionName = organInfo.getOsdName();
|
||||
String processName = organInfo.getBatchName();
|
||||
bizCodeStartIndex = organInfo.getBizCdStartIdx();
|
||||
bizCodeEndIndex = organInfo.getBizCdEndIdx();
|
||||
logger.info("processName = " + processName);
|
||||
|
||||
String fileName = reqFileName.substring(11);
|
||||
|
||||
if (bizCodeStartIndex <= 0 || bizCodeStartIndex >= fileName.length()) bizCodeStartIndex = 0;
|
||||
if (bizCodeEndIndex <= 0 || bizCodeEndIndex > fileName.length()) bizCodeEndIndex = fileName.length();
|
||||
String bizCode = fileName.substring(bizCodeStartIndex, bizCodeEndIndex);
|
||||
|
||||
logger.info("[Req Recv File Event] -------------------------------------------------------------------------");
|
||||
logger.info("[Req Recv File Event] ■ File Event 파싱 정보");
|
||||
logger.info("[Req Recv File Event] - 업무구분명 : [" + processName +"] (업무구분코드: "+ processCode +")");
|
||||
logger.info("[Req Recv File Event] - 대외기관명 : [" + institutionName +"] (대외기관코드: "+ institutionCode +")");
|
||||
logger.info("[Req Recv File Event] - 수신파일명 : [" + fileName +"]");
|
||||
logger.info("[Req Recv File Event] - 거래구분코드: [" + bizCode +"]");
|
||||
logger.info("[Req Recv File Event] -------------------------------------------------------------------------");
|
||||
|
||||
|
||||
/*
|
||||
* FileEvent가 SchedulerProcess로 전달할 기본 EAIBatchMsg를 생성한다.
|
||||
* FileEventListener가 입력가능한 값들은 EAIBatchMsg의 항목 중 다음과 같다.
|
||||
* - UUID
|
||||
* - Layer 구분 코드 (한시적)
|
||||
* - ProcessCode: 수신한 서브디렉토리와 동일
|
||||
* - FileName : 송수신 원 파일명
|
||||
* - FilePath : 파일이 실재 존재하는 디렉토리
|
||||
* - RenamedFileName : 저장후 이름이 변경된 파일명
|
||||
*/
|
||||
// BatchMsgDoc 생성
|
||||
BatchDoc batchMsgDoc = EAIBatchMsgManager.createBatchMsgWithUUID(false); //UUID 생성, false:초기화안함
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_FILE_EVENT, CommonKeys.SUB_LAYER_FILE_EVENT); // layer, flowPahse, 시작시간 설정
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessCode(processCode); // 업무코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessName(processName); // 업무명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessType(CommonKeys.PROCESS_REQUEST_RECEIVE); // 업무유형 (요구송신 설정)
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionCode(institutionCode); // 대외기관코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionName(institutionName); // 대외기관명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFileName(fileName); // 원 파일명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBizCode(bizCode); // 거래구분코드
|
||||
SchedulerMessageVO info = SchedulerMessageManager.getInstance().getRecvScheduleInfo(bizCode, processCode, institutionCode);
|
||||
if ( info == null ){
|
||||
String errMsg = ExceptionUtil.getErrorCode("BECEAISSC016", new String[] {processCode, institutionCode, bizCode});
|
||||
throw new Exception(errMsg); //해당 정보에 대한 스케쥴 정보가 존재하지 않습니다. (업무코드: {1}, 대외기관코드: {2}, 거래구분코드: {3})
|
||||
}
|
||||
|
||||
info.setFileName(fileName);
|
||||
//1. 요구수신 스케쥴러 단계 DB로그를 위한 BatchMsg 객체 생성
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_SCHEDULER, CommonKeys.SUB_LAYER_SCHEDULER_QUEUE); // layer, flowPahse, 시작시간 설정
|
||||
|
||||
//2. 요구수신 디렉토리 설정 (수신_Real/업무구분/대외기관/..)
|
||||
//요구수신 기준 디렉토리 --> 배치업무유형코드(ProcessCode) 와 대외기관코드 (InstitutionCode) 로 계산.
|
||||
String strPathName = BatchDirUtil.getResponseRealDir();
|
||||
if ( strPathName.charAt(strPathName.length()-1) != '/' ) {
|
||||
strPathName = strPathName + '/';
|
||||
}
|
||||
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(processCode);
|
||||
sb.append("/");
|
||||
sb.append(institutionCode);
|
||||
strPathName = strPathName + sb.toString();
|
||||
info.setFilePath(strPathName);
|
||||
|
||||
|
||||
//3. UUID 설정 및 스케쥴 송수신 시각 설정
|
||||
info.setUUID (batchMsgDoc.getBatchMsg().getHeader().getUUID());
|
||||
info.setSubUUID (batchMsgDoc.getBatchMsg().getBody().getSubUUID());
|
||||
info.setStartTime(DatetimeUtil.getCurrentDate() + "000000000");
|
||||
info.setEndTime (DatetimeUtil.getCurrentDate() + "235900000");
|
||||
|
||||
//4. Job_Queue 테이블에 등록
|
||||
logger.info("[요구수신 스케쥴러] =========================================================================");
|
||||
logger.info("[요구수신 스케쥴러] ■ 요구수신 스케쥴 정보를 Job_Queue 테이블에 추가......");
|
||||
int resultCnt = SchedulerMessageManager.getInstance().insertJobToQueue(info);
|
||||
logger.info("[요구수신 스케쥴러] ==> 배치 Job_Queue 테이블 INSERT 건수: "+ resultCnt);
|
||||
logger.info("[요구수신 스케쥴러] =========================================================================");
|
||||
|
||||
// 단계 종료시간을 추가한다.
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseEndTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
|
||||
// 요구송신에 대한 최초 DB로그. StartLog 호출.
|
||||
LogUtil.setStartLog (batchMsgDoc);
|
||||
logger.info("[Req Recv File Event] ※ Event 파일명 : [" + fileName +"]");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.inbound.remote.RemoteTransfer;
|
||||
import com.eactive.eai.inbound.remote.RemoteTransferLogKeys;
|
||||
|
||||
public class FepSendFile extends HttpServlet{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
/**
|
||||
* 1. 기능 : Eai Bat Call
|
||||
* 2. 처리 개요 : 요청 메세지를 받아서 처리 후 메세지 리턴.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @return
|
||||
* @exception
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("Servlet starting .......");
|
||||
|
||||
String fileName = request.getParameter("msg");
|
||||
// logger.debug("[FepSendFile]msg-->" + fileName);
|
||||
// String sysCd = msg.substring(0, 5);
|
||||
// String fileName = msg.substring(5);
|
||||
// logger.debug("sysCd["+sysCd+"]");
|
||||
logger.debug("fileName["+fileName+"]");
|
||||
|
||||
if ( fileName == null || fileName.getBytes().length <= 11 ){
|
||||
response.setCharacterEncoding("EUC-KR");
|
||||
response.getWriter().print("E:파라메터값(msg)이 전달되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
// String procCode = fileName.substring(0, 5);
|
||||
// String instCode = fileName.substring(6, 10);
|
||||
RemoteTransfer transfer = new RemoteTransfer();
|
||||
String rtnmsg = transfer.recvFile( fileName, RemoteTransferLogKeys.START_BY_API, RemoteTransferLogKeys.STARTER_SYSTEM);
|
||||
|
||||
|
||||
String outStr = new String(rtnmsg.getBytes(),"EUC-KR");
|
||||
logger.debug("outStr["+outStr+"]");
|
||||
response.setCharacterEncoding("EUC-KR");
|
||||
response.getWriter().print(outStr);
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.debug(ex.getMessage(), ex);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(ex.getMessage());
|
||||
throw ex;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class FrontFilter implements Filter
|
||||
{
|
||||
public static final String PROP_GROUP = "FrontFilter";
|
||||
public static final String PROP_KEY1 = "SERVER_LIST";
|
||||
public static final String PROP_KEY2 = "CLIENT_LIST";
|
||||
|
||||
public void init(FilterConfig config) throws ServletException{
|
||||
|
||||
}
|
||||
|
||||
public void destroy(){
|
||||
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException{
|
||||
try {
|
||||
HttpServletRequest request = (HttpServletRequest)req;
|
||||
HttpServletResponse response = (HttpServletResponse)res;
|
||||
PropManager manager = PropManager.getInstance();
|
||||
String serverList = manager.getProperty(PROP_GROUP,PROP_KEY1);
|
||||
String clientList = manager.getProperty(PROP_GROUP,PROP_KEY2);
|
||||
if(serverList==null) {
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.warn("[FrontFilter] Cannot configure the "+PROP_GROUP+"."+PROP_KEY1+" property.");
|
||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,"Cannot configure the "+PROP_GROUP+"."+PROP_KEY1+" property.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(clientList == null) clientList = "";
|
||||
|
||||
String[] serverIpList = serverList.split(",");
|
||||
String[] clientIpList = clientList.split(",");
|
||||
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
String remoteAddr = request.getRemoteAddr();
|
||||
if( isAllowedIP(serverIpList, remoteAddr) ) {
|
||||
if(logger.isDebugEnabled()) {
|
||||
logger.debug("FrontFilter] HTTP Access. server IP - " + remoteAddr);
|
||||
}
|
||||
}
|
||||
else if( isAllowedIP(clientIpList, remoteAddr) ) {
|
||||
if(logger.isDebugEnabled()) {
|
||||
logger.debug("FrontFilter] HTTP Access. client IP - " + remoteAddr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(logger.isWarnEnabled()) {
|
||||
logger.warn("FrontFilter] Invalid Access. - " + remoteAddr);
|
||||
}
|
||||
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Invalid Access.");
|
||||
return;
|
||||
}
|
||||
chain.doFilter(req,res);
|
||||
} catch(Exception e) {
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
logger.error("FrontFilter] Error - " + e.getMessage(), e);
|
||||
throw new ServletException(e.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAllowedIP(String[] ipList, String remoteIp) {
|
||||
|
||||
if(ipList == null || ipList.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for( String allow : ipList ) {
|
||||
if (allow.indexOf('*') == -1) {
|
||||
if (allow.equals(remoteIp)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
String allowRegexp = allow.replaceAll("\\*", "[0-9]+").trim();
|
||||
Matcher matcher = Pattern.compile(allowRegexp, Pattern.CASE_INSENSITIVE).matcher(remoteIp);
|
||||
if (matcher.matches()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
//package com.eactive.eai.agent.web;
|
||||
//
|
||||
//import java.io.BufferedReader;
|
||||
//import java.io.InputStreamReader;
|
||||
//import java.io.PrintWriter;
|
||||
//import java.net.URL;
|
||||
//import java.net.URLConnection;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.HashMap;
|
||||
//
|
||||
//import javax.servlet.http.HttpServlet;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//
|
||||
//import com.eactive.eai.batch.rule.dirInfo.BatchJobPriorityManager;
|
||||
//import com.eactive.eai.batch.rule.dirInfo.BatchJobPriorityVO;
|
||||
//import com.eactive.eai.common.property.PropManager;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
//
|
||||
//public class ImgJobPriorityAgent extends HttpServlet
|
||||
//{
|
||||
//
|
||||
// private static final long serialVersionUID = 1L;
|
||||
// Logger logger = LoggerFactory.getLogger(ElinkLogger.LOGGER_DEFAULT);
|
||||
//
|
||||
// /**
|
||||
// * 1. 기능 : 요청으로 전달된 Command 실행
|
||||
// * 2. 처리 개요 : 요청으로 전달된 Command 실행하고 실행된 결과를 ObjectOutStream을 통해 전송
|
||||
// * 3. 주의사항
|
||||
// *
|
||||
// * @param request HttpServletRequest
|
||||
// * @param response HttpServletResponse
|
||||
// * @return
|
||||
// * @exception
|
||||
// **/
|
||||
// public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
// String propName = "TelegramInfo{BIIMG_KFTS}";
|
||||
// String rurl = "http://172.17.167.92/mf/Pres_Logic/mf1/jsp_mf1eaitranconfirm/evnEaiTranConfirm_Response.jsp";
|
||||
// String rvalue = "rvalue=0";
|
||||
// boolean isNormal = true;
|
||||
//
|
||||
// try {
|
||||
// logger.info("[ImgJobPriorityAgent] Servlet starting .......");
|
||||
//
|
||||
// try{
|
||||
// PropManager pmanager = PropManager.getInstance();
|
||||
// rurl = pmanager.getProperty(propName, "result.url");
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// isNormal = false;
|
||||
// rvalue="rvalue=-1";
|
||||
// logger.error("[ImgJobPriorityAgent] url property 를 가져오는데 실패했습니다. 프로퍼티가 설정되어있는지 확인요함. - propName : ["+propName+"], url을 기본값 ["+rurl+"]로 설정합니다.");
|
||||
// }
|
||||
//
|
||||
// logger.info("[ImgJobPriorityAgent] rurl : ["+rurl+"]");
|
||||
//
|
||||
// String list = request.getParameter("list");
|
||||
// String strsendCount = request.getParameter("scount");
|
||||
// String strtotalCount = request.getParameter("tcount");
|
||||
// String[] lists = list.split(",");
|
||||
//
|
||||
// if (list == null || list.length() <=0 || lists.length != 3){
|
||||
// logger.error("ImgJobPriorityAgent ] 우선순위 목록 데이터가 비정상적입니다. - ["+list+"]");
|
||||
// isNormal = false;
|
||||
// rvalue="rvalue=-1";
|
||||
// }
|
||||
//
|
||||
// int sendCount = 0;
|
||||
// int totalCount = 0;
|
||||
//
|
||||
// try{
|
||||
// sendCount = Integer.parseInt(strsendCount);
|
||||
// totalCount = Integer.parseInt(strtotalCount);
|
||||
//
|
||||
// if (sendCount < 0 || totalCount <0 || sendCount > totalCount){
|
||||
// logger.error("ImgJobPriorityAgent ] count value faile.. [sendCount/totalCount] - ["+sendCount+"/"+totalCount+"]");
|
||||
// isNormal = false;
|
||||
// rvalue="rvalue=-1";
|
||||
// }
|
||||
//
|
||||
// }catch (Exception ne){
|
||||
// ne.printStackTrace();
|
||||
// logger.error("ImgJobPriorityAgent ] count value faile.. [sendCount/totalCount] - ["+sendCount+"/"+totalCount+"]");
|
||||
// isNormal = false;
|
||||
// rvalue="rvalue=-1";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (isNormal){
|
||||
// BatchJobPriorityManager jobpmanager = BatchJobPriorityManager.getInstance();
|
||||
// HashMap jobmap = jobpmanager.getPriorityDatas();
|
||||
//
|
||||
// ArrayList alist = (ArrayList)jobmap.get(lists[0]);
|
||||
//
|
||||
// if (alist != null && alist.size()>0){
|
||||
//
|
||||
// BatchJobPriorityVO vo1 = (BatchJobPriorityVO)alist.get(1); //두번째 가져오기..
|
||||
//
|
||||
// if (vo1.isExecuted() && vo1.getDataCount() < totalCount ){
|
||||
// logger.error("ImgJobPriorityAgent ] 어음 이미지 데이터가 대외기관으로 전송중이므로 메모리 정보 업데이트가 불가합니다.");
|
||||
// isNormal = false;
|
||||
// rvalue="rvalue=-2";
|
||||
// }
|
||||
// }else {
|
||||
// ArrayList palist = new ArrayList();
|
||||
//
|
||||
// for (int plistIndex = 0; plistIndex < lists.length; plistIndex++){
|
||||
//
|
||||
// BatchJobPriorityVO jpvo = new BatchJobPriorityVO();
|
||||
//
|
||||
// //기본정보를 설정한다.
|
||||
// jpvo.setBizCode(lists[plistIndex]);
|
||||
// jpvo.setOsdCd("KFTS");
|
||||
// jpvo.setOsdName("결제원송신");
|
||||
// jpvo.setProcessCd("BIIMG");
|
||||
// jpvo.setProcessName("어음이미지");
|
||||
//
|
||||
//
|
||||
// if (plistIndex == 0){
|
||||
// jpvo.setExecutedFlag(true);
|
||||
// jpvo.setDataCount(1); //첫번째는 시작 파일로 파일 수는 1개임.
|
||||
// }
|
||||
// if (plistIndex == 1){
|
||||
// jpvo.setExecutedFlag(true);
|
||||
// jpvo.setDataCount(sendCount); //데이터파일은 파라메터값으로 설정.
|
||||
// jpvo.setDataCountInfo(totalCount);
|
||||
// }
|
||||
//
|
||||
// palist.add(plistIndex, jpvo);
|
||||
//
|
||||
// }
|
||||
// jobpmanager.addJobPriorityData(lists[0], palist);
|
||||
//
|
||||
// logger.info("[ImgJobPriorityAgent] 메모리정보 업데이트했습니다. - ["+list+"/"+strsendCount+"/"+strtotalCount+"]");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// URL u = new URL(rurl);
|
||||
// URLConnection conn = u.openConnection();
|
||||
//
|
||||
// if (conn == null) {
|
||||
// logger.error("[ImgJobPriorityAgent] HttpURLConnection 을 생성할 수 없습니다. (URL : "+ rurl +")");
|
||||
// }
|
||||
//
|
||||
// conn.setDoInput(true);
|
||||
// conn.setDoOutput(true);
|
||||
// conn.setUseCaches(false);
|
||||
//
|
||||
//
|
||||
// PrintWriter pout = new PrintWriter(conn.getOutputStream());
|
||||
// pout.println(rvalue);
|
||||
// pout.close();
|
||||
//
|
||||
// try{
|
||||
//
|
||||
// BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
//
|
||||
// }catch (Exception ce){
|
||||
// logger.error("[ImgJobPriorityAgent] 처리결과를 전송할 connection이 올바른지 확인이 필요합니다. - "+ce.getMessage());
|
||||
// }
|
||||
//
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// response.setStatus(500);
|
||||
//
|
||||
// try {
|
||||
// response.getWriter().println(ex.getMessage());
|
||||
// throw ex;
|
||||
// } catch (Exception e) {
|
||||
// // IGNORE
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.agent.command.Command;
|
||||
import com.eactive.eai.agent.command.CommandException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class WebAgent extends HttpServlet
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
ObjectInputStream is = null;
|
||||
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
protected Object execute(Command command) throws CommandException {
|
||||
try{
|
||||
return command.execute();
|
||||
|
||||
}catch (CommandException ce){
|
||||
logger.error( ce.getMessage(), ce);
|
||||
throw ce;
|
||||
}catch (Exception e){
|
||||
logger.error( e.getMessage(), e);
|
||||
String errorMsg = ExceptionUtil.getErrorCode(e, "BECEAICAG010");
|
||||
if (logger.isError()) logger.error(errorMsg);
|
||||
throw new CommandException(errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
|
||||
ObjectInputStream is = new ObjectInputStream(request.getInputStream());
|
||||
ObjectOutputStream os = new ObjectOutputStream(response.getOutputStream());
|
||||
|
||||
Command command = (Command)is.readObject();
|
||||
Object obj;
|
||||
try{
|
||||
obj = execute(command);
|
||||
}catch (Exception e){
|
||||
obj = e.getMessage();
|
||||
}finally{
|
||||
is.close();
|
||||
os.close();
|
||||
}
|
||||
|
||||
os.writeObject((Serializable)obj);
|
||||
|
||||
is.close();
|
||||
os.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error( e.getMessage(), e);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(e.getMessage());
|
||||
throw e;
|
||||
} catch (Exception ex) {
|
||||
logger.error( ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user