init
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
package com.eactive.eai.rms.onl.adapter;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 시스템상의 해당명령을 수행하여 결과를 반환한다.
|
||||
* 2. 처리 개요 :
|
||||
* - 시스템상의 해당명령을 수행하여 결과를 반환한다.
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.2 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
public abstract class AgentExecCommand {
|
||||
|
||||
private final Logger logger = Logger.getLogger(AgentExecCommand.class);
|
||||
|
||||
// YUN_DEBUG : execCommand 함수에 오류가 있어서 수정함 (2008.04.14)
|
||||
// 내용 : Runtime.exec() 의 결과를 1 KByte 밖에 못얻어오는 현상.
|
||||
|
||||
public String execCommand(String command) {
|
||||
|
||||
String result = "";
|
||||
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
Process ps = null;
|
||||
InputStream is = null;
|
||||
byte[] buff = null;
|
||||
|
||||
int len;
|
||||
ByteArrayOutputStream baos = null;
|
||||
|
||||
try {
|
||||
|
||||
// 명령어 수행
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Command Exec : " + command);
|
||||
}
|
||||
ps = rt.exec(command);
|
||||
|
||||
if (!isError(ps)) {
|
||||
|
||||
// 명령 수행에 문제가 없었을 경우
|
||||
is = ps.getInputStream();
|
||||
|
||||
len = 0;
|
||||
buff = new byte[4096];
|
||||
baos = new ByteArrayOutputStream();
|
||||
|
||||
while ((len = is.read(buff)) > 0) {
|
||||
baos.write(buff, 0, len);
|
||||
}
|
||||
|
||||
result = new String(baos.toByteArray());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("AgentExecCommand result =" + result);
|
||||
}
|
||||
} // end of else
|
||||
|
||||
} catch (Exception e) {
|
||||
// 예외 상황 발생
|
||||
logger.error(e.toString());
|
||||
|
||||
} finally {
|
||||
|
||||
if (baos != null) {
|
||||
try {
|
||||
baos.close();
|
||||
} catch (IOException e) {
|
||||
baos = null;
|
||||
logger.error(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
is = null;
|
||||
logger.error(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (ps != null) {
|
||||
ps.destroy();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String execCommand_test(String command) {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
Runtime runtime = null;
|
||||
Process process = null;
|
||||
try {
|
||||
runtime = Runtime.getRuntime();
|
||||
|
||||
process = runtime.exec(command);
|
||||
InputStream is = process.getInputStream();
|
||||
InputStreamReader isr = new InputStreamReader(is);
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error( e );
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 명령분 수행에 대한 에러 체크
|
||||
* 2. 처리 개요 :
|
||||
* - 명령문 수행에 대한 에러 체크
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.2 $
|
||||
* @since : rts 1.0
|
||||
* @param ps
|
||||
* @return
|
||||
*/
|
||||
private boolean isError(Process ps) {
|
||||
|
||||
boolean result = true;
|
||||
InputStream es = ps.getErrorStream();
|
||||
byte[] buff = new byte[1024];
|
||||
|
||||
try {
|
||||
|
||||
// check
|
||||
if(es.available() <= 0) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("isError = false");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (es.read(buff) != -1) {
|
||||
// 명령 수행에 문제가 있을 경우
|
||||
String s = new String(buff);
|
||||
|
||||
logger.error(s);
|
||||
result = true;
|
||||
} else {
|
||||
// 명령 수행에 문제가 없을 경우
|
||||
result = false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
result = true;
|
||||
logger.error(e.toString());
|
||||
} finally {
|
||||
if (es != null) {
|
||||
try {
|
||||
es.close();
|
||||
} catch (IOException e) {
|
||||
es = null;
|
||||
logger.error(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("isError = " + result);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.eactive.eai.rms.onl.adapter.common.vo;
|
||||
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang.builder.ToStringStyle;
|
||||
|
||||
import com.eactive.eai.rms.onl.common.vo.SearchForm;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. ��� :
|
||||
* 2. ó�� ���� :
|
||||
* -
|
||||
* 3. ���ǻ��� :
|
||||
* </pre>
|
||||
* @author : �ڱ⼷
|
||||
* @version : $Revision: 1.3 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
public class ErrorContentForm
|
||||
extends SearchForm {
|
||||
|
||||
/** log level */
|
||||
private String logLevel = "TOTAL";
|
||||
|
||||
private String componentId = "";
|
||||
|
||||
/** log type */
|
||||
private String logType = "WCA";
|
||||
|
||||
private String adapterGroupNm;
|
||||
|
||||
private String luGroupNm;
|
||||
|
||||
private String luNm;
|
||||
|
||||
/** @return Returns the logLevel. */
|
||||
public String getLogLevel() {
|
||||
return logLevel;
|
||||
}
|
||||
|
||||
/** @param logLevel The logLevel to set. */
|
||||
public void setLogLevel(String logLevel) {
|
||||
this.logLevel = logLevel;
|
||||
}
|
||||
|
||||
/** @return Returns the logType. */
|
||||
public String getLogType() {
|
||||
if (logType == null) {
|
||||
return null;
|
||||
} else {
|
||||
return logType.trim();
|
||||
}
|
||||
}
|
||||
|
||||
/** @param logType The logType to set. */
|
||||
public void setLogType(String logType) {
|
||||
this.logType = logType;
|
||||
}
|
||||
|
||||
public String getComponentId() {
|
||||
return componentId;
|
||||
}
|
||||
|
||||
public void setComponentId(String componentId) {
|
||||
this.componentId = componentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Object#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE).appendSuper(super.toString()).append("logLevel",
|
||||
this.logLevel).append("componentId", this.componentId).append("logType",
|
||||
this.logType).toString();
|
||||
}
|
||||
|
||||
public String getAdapterGroupNm() {
|
||||
return adapterGroupNm;
|
||||
}
|
||||
|
||||
public void setAdapterGroupNm(String adapterGroupNm) {
|
||||
this.adapterGroupNm = adapterGroupNm;
|
||||
}
|
||||
|
||||
public String getLuGroupNm() {
|
||||
return luGroupNm;
|
||||
}
|
||||
|
||||
public void setLuGroupNm(String luGroupNm) {
|
||||
this.luGroupNm = luGroupNm;
|
||||
}
|
||||
|
||||
public String getLuNm() {
|
||||
return luNm;
|
||||
}
|
||||
|
||||
public void setLuNm(String luNm) {
|
||||
this.luNm = luNm;
|
||||
}
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.eactive.eai.rms.onl.adapter.count;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
|
||||
@Controller
|
||||
public class AdapterCountRetrieveController {
|
||||
|
||||
@Autowired
|
||||
private AdapterCountRetrieveService service;
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/retrieve/adapterCountRetrieve.view")
|
||||
public String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/retrieve/adapterCountRetrieve.json", params = "cmd=LIST")
|
||||
public ResponseEntity<List<Map<String, Object>>> list(String searchAdapterGroup, String searchInstanceName) {
|
||||
|
||||
List<Map<String, Object>> selectList = service.selectList(searchAdapterGroup, searchInstanceName);
|
||||
|
||||
return ResponseEntity.ok().body(selectList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.eactive.eai.rms.onl.adapter.count;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.onl.common.service.jspcall.JspCallAgentUtilService;
|
||||
|
||||
@Service
|
||||
public class AdapterCountRetrieveService {
|
||||
|
||||
|
||||
@Autowired
|
||||
@Qualifier("OnlJspCallAgentUtilService")
|
||||
private JspCallAgentUtilService jspCallAgentUtilService;
|
||||
|
||||
public List<Map<String, Object>> selectList(String searchAdapterGroup, String searchInstanceName) {
|
||||
|
||||
Map<String,String> filter = new HashMap<String,String>();
|
||||
|
||||
List<Map<String, Object>> response = null;
|
||||
|
||||
if (StringUtils.isNotBlank(searchInstanceName)) {
|
||||
response = jspCallAgentUtilService.agentCallByGetMethod("adapter_count_agent.jsp", new ArrayList<String>() {{ add(searchInstanceName); }}, new HashMap<>(), filter);
|
||||
} else {
|
||||
response = jspCallAgentUtilService.agentCallByGetMethod("adapter_count_agent.jsp", new HashMap<>(), filter);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(searchAdapterGroup)) {
|
||||
response = response.stream().filter(row -> String.valueOf(row.get("AdptrBzwkGroupName")).contains(searchAdapterGroup)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.eactive.eai.rms.onl.adapter.http.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
|
||||
@Controller
|
||||
public class HttpAdapterStatusController extends BaseController {
|
||||
|
||||
@RequestMapping("/adapter/http/httpAdapterStatus.do")
|
||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void findList(HttpServletRequest request, HttpServletResponse response, Map model) throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.eactive.eai.rms.onl.adapter.http.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.onl.adapter.common.vo.ErrorContentForm;
|
||||
|
||||
@Controller
|
||||
public class HttpErrorContentsController extends BaseController {
|
||||
|
||||
private static final String AGENT_PAGE = "adapter_log_agent.jsp";
|
||||
|
||||
@RequestMapping("/adapter/http/errorContents.do")
|
||||
public ResponseEntity<Void> handleRequest(HttpServletRequest request, HttpServletResponse response) {
|
||||
ErrorContentForm form = new ErrorContentForm();
|
||||
|
||||
// parameter 설정
|
||||
form.setEaiSvrInstNm(request.getParameter("eaiSvrInstNm"));
|
||||
form.setEaiSvrIp(request.getParameter("eaiSvrIp"));
|
||||
form.setEaiSvrLsnPort(request.getParameter("eaiSvrLsnPort"));
|
||||
form.setAgentPage(AGENT_PAGE);
|
||||
form.setSearchText(request.getParameter("searchText")); // 검색안
|
||||
form.setLogLevel(request.getParameter("logLevel"));
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.eactive.eai.rms.onl.adapter.http.controller;//package com.eactive.eai.rms.onl.adapter.http.controller;
|
||||
//
|
||||
//import java.util.Map;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//
|
||||
//import org.springframework.stereotype.Controller;
|
||||
//import org.springframework.validation.BindException;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.servlet.ModelAndView;
|
||||
//
|
||||
//import com.eactive.eai.rms.common.spring.OnlineFormController;
|
||||
//import com.eactive.eai.rms.onl.common.vo.BaseForm;
|
||||
//
|
||||
///**
|
||||
// * <pre>
|
||||
// * 1. ��� :
|
||||
// * 2. ó�� ���� :
|
||||
// * -
|
||||
// * 3. ���ǻ��� :
|
||||
// * </pre>
|
||||
// * @author : �ڱ⼷
|
||||
// * @version : $Revision: 1.2 $
|
||||
// * @since : rts 1.0
|
||||
// */
|
||||
//@Controller
|
||||
//public class HttpLogInfomationController
|
||||
// extends OnlineFormController {
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public HttpLogInfomationController() {
|
||||
// super();
|
||||
// setValidateOnBinding(false);
|
||||
// setFormView("adapter.http.logInfomation");
|
||||
// setCommandName("baseForm");
|
||||
// setCommandClass(BaseForm.class);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * <pre>
|
||||
// * 1. ��� :
|
||||
// * 2. ó�� ���� :
|
||||
// * -
|
||||
// * 3. ���ǻ��� : Overriden
|
||||
// * </pre>
|
||||
// * @author : �ڱ⼷
|
||||
// * @version : $Revision: 1.2 $
|
||||
// * @since : rts 1.0
|
||||
// * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(
|
||||
// * javax.servlet.http.HttpServletRequest,
|
||||
// * javax.servlet.http.HttpServletResponse,
|
||||
// * java.lang.Object, org.springframework.validation.BindException)
|
||||
// * @param request
|
||||
// * @param response
|
||||
// * @param form
|
||||
// * @param bindException
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
//
|
||||
// @RequestMapping("/adapter/http/logInfomation.do")
|
||||
// protected ModelAndView onSubmit(HttpServletRequest request,
|
||||
// HttpServletResponse response, Object form,
|
||||
// BindException bindException)
|
||||
// throws Exception {
|
||||
//
|
||||
// //BaseForm baseForm = (BaseForm) form;
|
||||
// Map model = createModel(request);
|
||||
//
|
||||
// return new ModelAndView("adapter.http.logInfomation", "model", model);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
package com.eactive.eai.rms.onl.adapter.http.httpStatus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.common.vo.SimpleResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.adapter.socket.MapComparator;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.util.CallAgentUtil;
|
||||
import com.eactive.eai.rms.onl.common.util.DataSetUtil;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : 박기섭
|
||||
* @version : $Revision: 1.13 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class HttpStatusController extends BaseController {
|
||||
private static final String AGENT_PAGE_STATUS = "adapter_status_agent.jsp";
|
||||
private static final String AGENT_PAGE_STARTSTOP = "adapter_startstop_agent.jsp";
|
||||
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
@Autowired
|
||||
protected HttpStatusController(EAIServerService eaiServerService) {
|
||||
this.eaiServerService = eaiServerService;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/http/httpStatus.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd) {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/adapter/http/httpStatus.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<HashMap<String, Object>>> selectList(
|
||||
@RequestParam(name = "adapterType", defaultValue = "") List<String> adapterTypes,
|
||||
String searchAdapterGroup) {
|
||||
|
||||
List<EAIServer> serverList = eaiServerService.selectEaiServerIpList();
|
||||
|
||||
if (serverList.isEmpty()) {
|
||||
throw new BizException("서버리스트가 없습니다.");
|
||||
}
|
||||
|
||||
List<String> urls = new ArrayList<>();
|
||||
|
||||
for (EAIServer serverMap : serverList) {
|
||||
for (String adapterType : adapterTypes) {
|
||||
String url = "http://" + serverMap.getEaisevrip() + ":" + serverMap.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH + AGENT_PAGE_STATUS + "?adapterType=" + adapterType
|
||||
+ "&eaiSvrInstNm=" + serverMap.getEaisevrinstncname();
|
||||
urls.add(url);
|
||||
logger.debug(url);
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, String> filter = new HashMap<>();
|
||||
if (searchAdapterGroup != null && !"".equals(searchAdapterGroup)) {
|
||||
filter.put("adapterGroupName", searchAdapterGroup);
|
||||
}
|
||||
|
||||
DataSetUtil gUtil = new DataSetUtil();
|
||||
gUtil.setFilter(filter);
|
||||
List<HashMap<String, Object>> list = gUtil.flushXmlToClient(urls);
|
||||
|
||||
// 리스트에서 데이터가 없을때 제거
|
||||
list.removeIf(m -> m.get("adapterGroupSimple") == null || m.get("adapterGroupSimple") == "");
|
||||
|
||||
// 어댑터 업무그룹별 정렬
|
||||
String[] compareParam = { "adapterGroupName", "eaiSvrInstNm" };
|
||||
MapComparator comp = new MapComparator(compareParam);
|
||||
Collections.sort(list, comp);
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/adapter/http/httpStatus.json", params = "cmd=TRANSACTION_STARTSTOP")
|
||||
public ResponseEntity<SimpleResponse> transactionStartStop(HttpServletRequest request, String eaiInstanceName,
|
||||
String adapterType, String control, String adapterGroupName, String adapterName) throws Exception {
|
||||
|
||||
EAIServer eaiServer = eaiServerService.getByEaiSevrInstncName(eaiInstanceName);
|
||||
|
||||
String url = "http://" + eaiServer.getEaisevrip() + ":" + eaiServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH + AGENT_PAGE_STARTSTOP;
|
||||
|
||||
// cmd 는 START/STOP
|
||||
NameValuePair[] postParameters = new NameValuePair[] { new NameValuePair("adapterType", adapterType),
|
||||
new NameValuePair("adapterGroupNm", adapterGroupName), new NameValuePair("adapterNm", adapterName),
|
||||
new NameValuePair("adapterStartStop", control) };
|
||||
|
||||
// Agent를 호출한다.
|
||||
CallAgentUtil util = new CallAgentUtil();
|
||||
String message = util.getAgentDataToString(url, postParameters);
|
||||
return ResponseEntity.ok(SimpleResponse.of(message));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/http/httpStatus.excel", params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, String gridData,
|
||||
String header, String headerTitle, String fileName, String merge) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
Gson gson = new Gson();
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<String, Object>[] list = gson.fromJson(gridData, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson(header, String[].class);
|
||||
String[] headerTitles = gson.fromJson(headerTitle, String[].class);
|
||||
|
||||
HashMap<String, Object>[] lmerge = null;
|
||||
if (merge != null) {
|
||||
lmerge = gson.fromJson(merge, HashMap[].class);
|
||||
}
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", list);
|
||||
resultMap.put("fileName", fileName);
|
||||
resultMap.put("merge", lmerge);
|
||||
ModelAndView modelAndView = new ModelAndView("excelView", resultMap);
|
||||
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.eactive.eai.rms.onl.adapter.http.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Scope("prototype")
|
||||
@SuppressWarnings(value = { "deprecation", "unchecked" })
|
||||
public class EaiEngineHttpStatusService {
|
||||
|
||||
|
||||
public EaiEngineHttpStatusService() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List getHttpAdapterStatusList() throws Exception {
|
||||
ArrayList statusArray = new ArrayList();
|
||||
//TODO WLS => JBOSS
|
||||
//
|
||||
// MBeanHomeUtil mbeanHomeUtil = (MBeanHomeUtil) applicationContext.getBean("mbeanHomeUtil");
|
||||
//
|
||||
// Set runtimeSet = mbeanHomeUtil.getMBeanHome().getMBeansByType(
|
||||
// "ServletRuntime");
|
||||
//
|
||||
// ServletStatusVO servletVo = null;
|
||||
//
|
||||
// for (Iterator it = runtimeSet.iterator(); it.hasNext();) {
|
||||
// ServletRuntimeMBean servletRuntime = (ServletRuntimeMBean) it.next();
|
||||
// String servletName = servletRuntime.getServletName();
|
||||
// if (HTTP_ADAPTER_NAME.indexOf(servletName) > -1) {
|
||||
// servletVo = new ServletStatusVO();
|
||||
// servletVo.setServerName(servletRuntime.getObjectName()
|
||||
// .getLocation());
|
||||
// servletVo.setExecutionTimeAverage(servletRuntime.getExecutionTimeAverage());
|
||||
// servletVo.setExecutionTimeHigh(servletRuntime.getExecutionTimeHigh());
|
||||
// servletVo.setExecutionTimeLow(servletRuntime.getExecutionTimeLow());
|
||||
// servletVo.setExecutionTimeTotal(servletRuntime.getExecutionTimeTotal());
|
||||
// servletVo.setInvocationTotalCount(servletRuntime.getInvocationTotalCount());
|
||||
// servletVo.setPoolMaxCapacity(servletRuntime.getPoolMaxCapacity());
|
||||
// servletVo.setReloadTotalCount(servletRuntime.getReloadTotalCount());
|
||||
// servletVo.setServletName(servletName);
|
||||
// servletVo.setServletPath(servletRuntime.getServletPath());
|
||||
// statusArray.add(servletVo);
|
||||
// }
|
||||
// }
|
||||
return statusArray;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.eactive.eai.rms.onl.adapter.http.vo;
|
||||
|
||||
public class ServletStatusVO {
|
||||
|
||||
private String serverName = null;
|
||||
private String servletName = null;
|
||||
private int executionTimeAverage = 0;
|
||||
private int executionTimeHigh = 0;
|
||||
private int executionTimeLow = 0;
|
||||
private int executionTimeTotal = 0;
|
||||
private int invocationTotalCount = 0;
|
||||
private int poolMaxCapacity = 0;
|
||||
private int reloadTotalCount = 0;
|
||||
private String servletPath = null;
|
||||
|
||||
public ServletStatusVO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public int getExecutionTimeAverage() {
|
||||
return executionTimeAverage;
|
||||
}
|
||||
|
||||
public void setExecutionTimeAverage(int executionTimeAverage) {
|
||||
this.executionTimeAverage = executionTimeAverage;
|
||||
}
|
||||
|
||||
public int getExecutionTimeHigh() {
|
||||
return executionTimeHigh;
|
||||
}
|
||||
|
||||
public void setExecutionTimeHigh(int executionTimeHigh) {
|
||||
this.executionTimeHigh = executionTimeHigh;
|
||||
}
|
||||
|
||||
public int getExecutionTimeLow() {
|
||||
return executionTimeLow;
|
||||
}
|
||||
|
||||
public void setExecutionTimeLow(int executionTimeLow) {
|
||||
this.executionTimeLow = executionTimeLow;
|
||||
}
|
||||
|
||||
public int getExecutionTimeTotal() {
|
||||
return executionTimeTotal;
|
||||
}
|
||||
|
||||
public void setExecutionTimeTotal(int executionTimeTotal) {
|
||||
this.executionTimeTotal = executionTimeTotal;
|
||||
}
|
||||
|
||||
public int getInvocationTotalCount() {
|
||||
return invocationTotalCount;
|
||||
}
|
||||
|
||||
public void setInvocationTotalCount(int invocationTotalCount) {
|
||||
this.invocationTotalCount = invocationTotalCount;
|
||||
}
|
||||
|
||||
public int getPoolMaxCapacity() {
|
||||
return poolMaxCapacity;
|
||||
}
|
||||
|
||||
public void setPoolMaxCapacity(int poolMaxCapacity) {
|
||||
this.poolMaxCapacity = poolMaxCapacity;
|
||||
}
|
||||
|
||||
public int getReloadTotalCount() {
|
||||
return reloadTotalCount;
|
||||
}
|
||||
|
||||
public void setReloadTotalCount(int reloadTotalCount) {
|
||||
this.reloadTotalCount = reloadTotalCount;
|
||||
}
|
||||
|
||||
public String getServletName() {
|
||||
return servletName;
|
||||
}
|
||||
|
||||
public void setServletName(String servletName) {
|
||||
this.servletName = servletName;
|
||||
}
|
||||
|
||||
public String getServletPath() {
|
||||
return servletPath;
|
||||
}
|
||||
|
||||
public void setServletPath(String servletPath) {
|
||||
this.servletPath = servletPath;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
package com.eactive.eai.rms.onl.adapter.info;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.common.util.ContainerUtil;
|
||||
|
||||
public class AdapterInfosManager {
|
||||
private Context context;
|
||||
|
||||
protected final Logger logger = Logger.getLogger(getClass());
|
||||
|
||||
|
||||
//모니터링을 위한 정보를 저장할 VO
|
||||
public static HashMap<String,AdapterInfosVO> adaptersMap = null;
|
||||
|
||||
public AdapterInfosManager() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
/** singleton 구현을 위한 자신의 instance */
|
||||
private static AdapterInfosManager instance ;
|
||||
|
||||
public void init() {
|
||||
//RMS가 기동할 때 인스턴스별로 돌면서 개별 DB의 어뎁터를 불러옴
|
||||
try {
|
||||
if (ContainerUtil.get() == ContainerUtil.TOMCAT) {
|
||||
Context initContext = new InitialContext();
|
||||
context = (Context) initContext.lookup("java:/comp/env");
|
||||
}
|
||||
else {
|
||||
context = new InitialContext();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//취약점소스 수정 2020.08.24
|
||||
logger.error(" error", e);
|
||||
}
|
||||
loadAdapterInfos();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public static AdapterInfosManager getInstance() {
|
||||
synchronized (AdapterInfosManager.class) {
|
||||
if (instance == null) {
|
||||
instance = new AdapterInfosManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public void loadAdapterInfos() {
|
||||
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
adaptersMap = new HashMap<String,AdapterInfosVO>();
|
||||
//int i = 0;
|
||||
for(DataSourceType d : DataSourceTypeManager.getOnlineDataSourceTypes() ) {
|
||||
logger.info(" Adapter 정보 구성을 위한 db 접속 ==> " + d.toString());
|
||||
// Source Connection
|
||||
conn = getConnection(d.getJndiName());
|
||||
if(conn != null) { //취약점소스 수정 2020.08.25
|
||||
stmt = conn.prepareStatement(makeSqlStatus(d.getSchema()));
|
||||
}
|
||||
|
||||
if(stmt != null) { //취약점소스 수정 2020.08.26
|
||||
rs = stmt.executeQuery();
|
||||
}
|
||||
while ( rs.next() ) {
|
||||
|
||||
if(rs != null){ //취약점소스 수정 2020.08.26
|
||||
//AdapterInfosVO 처리
|
||||
AdapterInfosVO avo = new AdapterInfosVO();
|
||||
//HASHMAP에 있는 어뎁터인지를 먼저 확인함
|
||||
avo.setAdptrBzwkGroupName(rs.getString(1));
|
||||
if ( adaptersMap.containsKey(avo.getAdptrBzwkGroupName()) ) {
|
||||
avo = adaptersMap.get(avo.getAdptrBzwkGroupName());
|
||||
avo.ALEAISevrInstncName.add(rs.getString(3));
|
||||
} else {
|
||||
avo.setAdptrBzwkGroupDesc(rs.getString(2));
|
||||
avo.ALEAISevrInstncName.add(rs.getString(3));
|
||||
avo.setSocketType(rs.getString(4));
|
||||
avo.setOsidInstiBzwkRsempName(rs.getString(5));
|
||||
avo.setOsidInstiTelno(rs.getString(6));
|
||||
avo.setBoundType(rs.getString(7));
|
||||
//tobe 추가
|
||||
avo.setPermanent(rs.getString(8));
|
||||
avo.setHostName(rs.getString(9));
|
||||
avo.setPortNumber(rs.getString(10));
|
||||
}
|
||||
adaptersMap.put(avo.getAdptrBzwkGroupName(), avo);
|
||||
}
|
||||
|
||||
}
|
||||
closeConnection(conn, stmt, rs);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace(); //취약점소스 수정 2020.08.24
|
||||
logger.error(" DB Source CONNECTION FAIL");
|
||||
} finally {
|
||||
closeConnection(conn, stmt, rs);
|
||||
}
|
||||
}
|
||||
|
||||
public Connection getConnection(String datasource) throws Exception {
|
||||
try {
|
||||
DataSource ds = null;
|
||||
if(context != null){ //취약점소스 수정 2020.08.24
|
||||
ds = (DataSource) context.lookup(datasource);
|
||||
}
|
||||
if(ds != null){ //취약점소스 수정 2020.08.24
|
||||
return ds.getConnection();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
protected void closeConnection(Connection con, Statement stmt, ResultSet rs) {
|
||||
if (rs != null) {
|
||||
try {
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (stmt != null) {
|
||||
try {
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
if (con != null) {
|
||||
try {
|
||||
if (!con.isClosed()) {
|
||||
con.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<String, AdapterInfosVO> getAdaptersMap() {
|
||||
return adaptersMap;
|
||||
}
|
||||
|
||||
public static void setAdaptersMap(HashMap<String, AdapterInfosVO> adaptersMap) {
|
||||
AdapterInfosManager.adaptersMap = adaptersMap;
|
||||
}
|
||||
|
||||
public void updateAdapterInfo(AdapterInfosVO aptinfo) {
|
||||
adaptersMap.put(aptinfo.getAdptrBzwkGroupName(), aptinfo);
|
||||
}
|
||||
|
||||
public void removeAdapterInfo(String adptrName) {
|
||||
if ( adaptersMap.containsKey(adptrName) )
|
||||
adaptersMap.remove(adptrName);
|
||||
}
|
||||
|
||||
public AdapterInfosVO getAdapterVOInfo(String adptrName) {
|
||||
if ( adaptersMap.containsKey(adptrName) )
|
||||
return adaptersMap.get(adptrName);
|
||||
return new AdapterInfosVO();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
System.out.println("---------------- Display START -------------------");
|
||||
Collection<AdapterInfosVO> coll = AdapterInfosManager.adaptersMap.values();
|
||||
Iterator<AdapterInfosVO> iter = coll.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
AdapterInfosVO tempVO = iter.next();
|
||||
System.out.println(tempVO.toString());
|
||||
}
|
||||
|
||||
return new String("---------------- Display END -------------------" );
|
||||
}
|
||||
|
||||
public String makeSqlStatus(String schemaId) {
|
||||
String SqlString = new String();
|
||||
|
||||
SqlString =
|
||||
"SELECT "
|
||||
+ "\n A.ADPTRBZWKGROUPNAME, "
|
||||
+ "\n A.ADPTRBZWKGROUPDESC, "
|
||||
+ "\n B.EAISEVRINSTNCNAME, "
|
||||
+ "\n TAB1.SOCKETTYPE AS \"SOCKETTYPE\", "
|
||||
+ "\n A.OSIDINSTITELNO, "
|
||||
+ "\n A.OSIDINSTIBZWKRSEMPNAME , "
|
||||
+ "\n TAB2.BOUNDTYPE AS \"BOUNDTYPE\" , "
|
||||
+ "\n TAB3.PERMANENT AS \"PERMANENT\", "
|
||||
+ "\n TAB4.HOSTNAME AS \"HOSTNAME\" ,"
|
||||
+ "\n TAB5.PORTNUMBER AS \"PORTNUMBER\" "
|
||||
+ "\n FROM " + schemaId + ".TSEAIAD01 A, "
|
||||
+ "\n " + schemaId + ".TSEAIAD02 B, "
|
||||
+ "\n ( SELECT C.PRPTYGROUPNAME, "
|
||||
+ "\n C.PRPTY2VAL AS SOCKETTYPE "
|
||||
+ "\n FROM " + schemaId + ".TSEAIAD15 C "
|
||||
+ "\n WHERE C.PRPTYNAME = 'socket.type' "
|
||||
+ "\n ) TAB1, "
|
||||
+ "\n ( SELECT C.PRPTYGROUPNAME , "
|
||||
+ "\n C.PRPTY2VAL AS BOUNDTYPE "
|
||||
+ "\n FROM " + schemaId + ".TSEAIAD15 C "
|
||||
+ "\n WHERE C.PRPTYNAME = 'bound.usage' "
|
||||
+ "\n ) TAB2, "
|
||||
+ "\n ( SELECT C.PRPTYGROUPNAME , "
|
||||
+ "\n C.PRPTY2VAL AS PERMANENT "
|
||||
+ "\n FROM " + schemaId + ".TSEAIAD15 C "
|
||||
+ "\n WHERE C.PRPTYNAME = 'permanent' "
|
||||
+ "\n ) TAB3, "
|
||||
+ "\n ( SELECT C.PRPTYGROUPNAME , "
|
||||
+ "\n C.PRPTY2VAL AS HOSTNAME "
|
||||
+ "\n FROM " + schemaId + ".TSEAIAD15 C "
|
||||
+ "\n WHERE C.PRPTYNAME = 'host.name' "
|
||||
+ "\n ) TAB4 , "
|
||||
+ "\n ( SELECT C.PRPTYGROUPNAME , "
|
||||
+ "\n C.PRPTY2VAL AS PORTNUMBER "
|
||||
+ "\n FROM " + schemaId + ".TSEAIAD15 C "
|
||||
+ "\n WHERE C.PRPTYNAME = 'port.number' "
|
||||
+ "\n ) TAB5 "
|
||||
+ "\n WHERE A.ADPTRCD = 'NET' "
|
||||
+ "\n AND A.ADPTRBZWKGROUPNAME = B.ADPTRBZWKGROUPNAME "
|
||||
+ "\n AND B.PRPTYGROUPNAME = TAB1.PRPTYGROUPNAME "
|
||||
+ "\n AND B.PRPTYGROUPNAME = TAB2.PRPTYGROUPNAME "
|
||||
+ "\n AND B.PRPTYGROUPNAME = TAB3.PRPTYGROUPNAME "
|
||||
+ "\n AND B.PRPTYGROUPNAME = TAB4.PRPTYGROUPNAME "
|
||||
+ "\n AND B.PRPTYGROUPNAME = TAB5.PRPTYGROUPNAME "
|
||||
+ "\n ORDER BY 1, 3, 4 "
|
||||
+ "\n WITH UR";
|
||||
System.out.println(SqlString);
|
||||
return SqlString;
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, String>> getEaiServerIpList(String name) {
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
try {
|
||||
//int i = 0;
|
||||
|
||||
DataSourceType d = DataSourceTypeManager.getDataSourceType(name);
|
||||
|
||||
logger.debug(" Adapter 정보 구성을 위한 db 접속 ==> " + name +"=" + d);
|
||||
|
||||
if(d == null) {
|
||||
return list;
|
||||
}
|
||||
|
||||
// Source Connection
|
||||
conn = getConnection(d.getJndiName());
|
||||
if(conn != null) {//취약점소스 수정 2020.08.25
|
||||
stmt = conn.prepareStatement(makeSqlInst(d.getSchema()));
|
||||
}
|
||||
if(stmt != null) { //취약점소스 수정 2020.08.27
|
||||
rs = stmt.executeQuery();
|
||||
}
|
||||
|
||||
if(rs != null){ //취약점소스 수정 2020.08.26
|
||||
while ( rs.next() ) {
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
map.put("EAISVRINSTNM", rs.getString("EAISVRINSTNM"));
|
||||
map.put("EAISVRIP", rs.getString("EAISVRIP"));
|
||||
map.put("EAISVRLSNPORT", rs.getString("EAISVRLSNPORT"));
|
||||
map.put("HOSTNAME", rs.getString("HOSTNAME"));
|
||||
map.put("FAILOVERSVRNM", rs.getString("FAILOVERSVRNM"));
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace(); //취약점소스 수정 2020.08.24
|
||||
logger.error(" DB Source CONNECTION FAIL");
|
||||
} finally {
|
||||
closeConnection(conn, stmt, rs);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String makeSqlInst(String schemaId) {
|
||||
String SqlString = new String();
|
||||
|
||||
SqlString =
|
||||
"\n SELECT EAISEVRINSTNCNAME AS \"EAISVRINSTNM\", EAISEVRIP AS \"EAISVRIP\" , "
|
||||
+"\n SEVRLSNPORTNAME AS \"EAISVRLSNPORT\", FLOVRSEVRNAME AS \"FAILOVERSVRNM\", "
|
||||
+"\n HOSTNAME AS \"HOSTNAME\" "
|
||||
+"\n FROM " + schemaId + ".TSEAISY02 "
|
||||
+"\n WHERE EAISEVRINSTNCNAME != 'ALL' "
|
||||
+"\n AND EAISEVRIP != '*' "
|
||||
+"\n ORDER BY EAISEVRIP, SEVRLSNPORTNAME ASC";
|
||||
|
||||
return SqlString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.eactive.eai.rms.onl.adapter.info;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AdapterInfosVO {
|
||||
public String adptrBzwkGroupName; //AD01 어댑터그룹명
|
||||
public String adptrBzwkGroupDesc; //AD01 대외기관명
|
||||
public ArrayList<String> ALEAISevrInstncName = new ArrayList<String>(); //AD02 EAI서버인스턴스명 AL
|
||||
public String socketType; //CM03 SERVER / CLIENT
|
||||
//DB에서 로드하기 위한 임시적 프로퍼티로 Monitor에서 사용할 때는 ArrayList를 호출하도록 주의한다
|
||||
public String eAISevrInstncName;
|
||||
public String boundType; //INBOUND, OUTBOUND
|
||||
public String osidInstiBzwkRsempName; //담당자명
|
||||
public String osidInstiTelno; //담당자연락처
|
||||
|
||||
//TOBE 추가
|
||||
public String permanent; //permanent
|
||||
public String hostName; //host.name
|
||||
public String portNumber; //port.Number
|
||||
|
||||
|
||||
public String toString() {
|
||||
String output = this.adptrBzwkGroupName + ": [" + this.adptrBzwkGroupDesc + "," ;
|
||||
for ( String temp : this.ALEAISevrInstncName ) {
|
||||
output += temp + ",";
|
||||
}
|
||||
output += osidInstiBzwkRsempName + ", " + osidInstiTelno + ", " + socketType + "]";
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public ArrayList<String> getALEAISevrInstncName() {
|
||||
return ALEAISevrInstncName;
|
||||
}
|
||||
|
||||
public void setALEAISevrInstncName(ArrayList<String> sevrInstncName) {
|
||||
ALEAISevrInstncName = sevrInstncName;
|
||||
}
|
||||
|
||||
public String getEAISevrInstncName() {
|
||||
return eAISevrInstncName;
|
||||
}
|
||||
|
||||
public void setEAISevrInstncName(String sevrInstncName) {
|
||||
eAISevrInstncName = sevrInstncName;
|
||||
}
|
||||
|
||||
public String getAdptrBzwkGroupName() {
|
||||
return adptrBzwkGroupName;
|
||||
}
|
||||
public void setAdptrBzwkGroupName(String adptrBzwkGroupName) {
|
||||
this.adptrBzwkGroupName = adptrBzwkGroupName;
|
||||
}
|
||||
public String getAdptrBzwkGroupDesc() {
|
||||
return adptrBzwkGroupDesc;
|
||||
}
|
||||
public void setAdptrBzwkGroupDesc(String adptrBzwkGroupDesc) {
|
||||
this.adptrBzwkGroupDesc = adptrBzwkGroupDesc;
|
||||
}
|
||||
public String getSocketType() {
|
||||
return socketType;
|
||||
}
|
||||
public void setSocketType(String socketType) {
|
||||
this.socketType = socketType;
|
||||
}
|
||||
public String getBoundType() {
|
||||
return boundType;
|
||||
}
|
||||
|
||||
public void setBoundType(String boundType) {
|
||||
this.boundType = boundType;
|
||||
}
|
||||
|
||||
public String getOsidInstiBzwkRsempName() {
|
||||
return osidInstiBzwkRsempName;
|
||||
}
|
||||
|
||||
public void setOsidInstiBzwkRsempName(String osidInstiBzwkRsempName) {
|
||||
this.osidInstiBzwkRsempName = osidInstiBzwkRsempName;
|
||||
}
|
||||
|
||||
public String getOsidInstiTelno() {
|
||||
return osidInstiTelno;
|
||||
}
|
||||
|
||||
public void setOsidInstiTelno(String osidInstiTelno) {
|
||||
this.osidInstiTelno = osidInstiTelno;
|
||||
}
|
||||
|
||||
public String getPermanent() {
|
||||
return permanent;
|
||||
}
|
||||
|
||||
public void setPermanent(String permanent) {
|
||||
this.permanent = permanent;
|
||||
}
|
||||
|
||||
public String getHostName() {
|
||||
return hostName;
|
||||
}
|
||||
|
||||
public void setHostName(String hostName) {
|
||||
this.hostName = hostName;
|
||||
}
|
||||
|
||||
public String getPortNumber() {
|
||||
return portNumber;
|
||||
}
|
||||
|
||||
public void setPortNumber(String portNumber) {
|
||||
this.portNumber = portNumber;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.EMSRuntimeException;
|
||||
import com.eactive.eai.rms.onl.manage.sna.lugroup.LuGroupService;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
||||
@Controller
|
||||
public class SnaConnectionListController extends BaseController{
|
||||
|
||||
|
||||
@Autowired
|
||||
@Qualifier("snaConnectionListService")
|
||||
private SnaConnectionListService service;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("luGroupService")
|
||||
private LuGroupService groupService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaConnectionListMan.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaConnectionListMan.json",params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo( HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||
|
||||
HashMap paramMap = new HashMap();
|
||||
List groupList = groupService.selectSnaGroupList();
|
||||
List adapterList = groupService.selectSnaAdapterList();
|
||||
List luGroupShortNameList = groupService.selectLuGroupShortNameList();
|
||||
List luGroupList = groupService.selectLuGroupList(paramMap);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("groupRows" , groupList );
|
||||
resultMap.put("adapterRows" , adapterList);
|
||||
resultMap.put("luGroupShortNameRows" , luGroupShortNameList);
|
||||
resultMap.put("luGroupList" , luGroupList);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaConnectionListMan.json",params = "cmd=LIST_CHANGE_COMBO")
|
||||
public ModelAndView initCombo2( HttpServletRequest request,
|
||||
HttpServletResponse response,String adptrGstatSevrName , String adptrGroupName) throws Exception {
|
||||
HashMap paramMap = new HashMap();
|
||||
paramMap.put("adptrGstatSevrName", adptrGstatSevrName);
|
||||
paramMap.put("adptrGroupName", adptrGroupName);
|
||||
List luGroupList = groupService.selectLuGroupList(paramMap);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("luGroupList" , luGroupList);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@PostMapping(value= "/onl/adapter/sna/snaConnectionListMan.json", params = "cmd=LIST")
|
||||
public ModelAndView selectList(@RequestParam Map<String,Object> paramMap) {
|
||||
|
||||
List<EAIServer> serverList = eaiServerService.selectEaiServerIpList();
|
||||
|
||||
for (EAIServer eaiServer : serverList) {
|
||||
if (eaiServer.getHostname().equals(paramMap.get("hostName"))) {
|
||||
paramMap.put("eaiSvrIp", eaiServer.getEaisevrip());
|
||||
}
|
||||
}
|
||||
|
||||
// SnaStatusCmd 설정
|
||||
String statusCmd = null;
|
||||
|
||||
statusCmd = "SnaStatus -t " + paramMap.get("adptGrpNm") + " -gA " + paramMap.get("luGrpNm") + " -host "
|
||||
+ paramMap.get("eaiSvrIp");
|
||||
|
||||
paramMap.put("snaStatusCmd", statusCmd);
|
||||
List list = service.executeSnaStatus(paramMap);
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("rows", list);
|
||||
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/sna/snaConnectionListMan.json", params = "cmd=TRANSACTION_CHANGE")
|
||||
public ModelAndView transactionBackUp(HttpServletRequest request, @RequestParam HashMap<String, Object> paramMap) {
|
||||
|
||||
EAIServer eaiServer = eaiServerService
|
||||
.findFirstByHostname((String) paramMap.get("hostName"))
|
||||
.orElseThrow(() -> new EMSRuntimeException("HOST를 조회 할 수 없습니다."));
|
||||
|
||||
// SnaStatusCmd 설정
|
||||
String statusCmd = null;
|
||||
|
||||
String type = paramMap.get("type").toString();
|
||||
|
||||
statusCmd = (type.startsWith("START_") ? "SnaStart -t "
|
||||
: "SnaStop -t ")
|
||||
+ paramMap.get("adptGrpNm") + " -g " + paramMap.get("luGrpNm")+ " ";
|
||||
|
||||
if (type.endsWith("_LU")) {
|
||||
statusCmd += " -s " + request.getParameter("luNm") + " ";
|
||||
}
|
||||
statusCmd += "-host " + eaiServer.getEaisevrip();
|
||||
|
||||
logger.info("controller statusCmd : " + statusCmd);
|
||||
paramMap.put("snaStatusCmd", statusCmd);
|
||||
List list = service.executeStartStop(paramMap);
|
||||
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("result", list); // 전체 페이지수
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaConnectionListMan.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, String gridData, String header, String headerTitle, String fileName, String merge) throws Exception {
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
|
||||
Gson gson = new Gson();
|
||||
HashMap<String, Object>[] list = gson.fromJson(gridData, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson(header, String[].class);
|
||||
String[] headerTitles = gson.fromJson(headerTitle, String[].class);
|
||||
|
||||
HashMap<String, Object>[] lmerge = null;
|
||||
if (merge !=null){
|
||||
lmerge = gson.fromJson(merge, HashMap[].class);
|
||||
}
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", list);
|
||||
resultMap.put("fileName", fileName);
|
||||
resultMap.put("merge", lmerge);
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,452 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.onl.adapter.AgentExecCommand;
|
||||
|
||||
@Service("snaConnectionListService")
|
||||
public class SnaConnectionListService extends AgentExecCommand{
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SnaConnectionListService.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
public List executeSnaStatus(Map<String,Object> paramMap) {
|
||||
|
||||
List list = new ArrayList();
|
||||
|
||||
// 명령어의 경로를 얻는다.
|
||||
String cmdPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SNA_STATUS_PATH,
|
||||
""); // /fsapp/eai/SNAAdapter/bin/
|
||||
|
||||
/*if ((paramMap.get("snaStatusCmd").toString()).indexOf("grep") > -1) {
|
||||
paramMap.put("snaStatusCmd","SnaStatus -tA | grep -E 'DOWN|그룹'");
|
||||
}*/
|
||||
|
||||
logger.info("SnaStatus cmdPath : " + cmdPath);
|
||||
// 명령어
|
||||
String cmd = cmdPath + paramMap.get("snaStatusCmd");
|
||||
|
||||
//cmd = CharsetDecoderUtil.toKor(cmd);
|
||||
|
||||
logger.info("SnaStatus Command Exec : " + cmd);
|
||||
|
||||
String result = execCommand(cmd);
|
||||
|
||||
int linePoint = 0;
|
||||
|
||||
// 정보를 라인단위로 파싱하여
|
||||
linePoint = result.indexOf("\n");
|
||||
|
||||
//================================================================================================================================================
|
||||
//어댑터 그룹(SNAAdapter_HOST_OUT) LU 그룹명 (SNAAdapter_HOST_OUT_001) LU 그룹 상태 (정상)
|
||||
//총 LU수 (175) UP LU수 (175) 사용 가능 LU수 (175) 수신 대기 LU수 (0) 송신 대기 LU수 (0) WCA 세션 수 (10)
|
||||
//송신 건수 (1319) 수신 건수 (8) TIMEOUT 건수 (0) 송신 실패 건수 (0) 수신 실패 건수 (0) 큐 대기 건수 (0) 큐 대기 최대 건수 (0)
|
||||
//================================================================================================================================================
|
||||
// LU이름 LU모드 LU상태 LU세부상태 TRAN상태 백업LU APP_ID 세션연결수 송신건수 수신건수 타임아웃 송신실패 수신실패 세션초기화시간
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//TEN11001 SENDONLY UP - READY 0 I81 1 309 0 0 0 0 2005.10.07 13:23:14
|
||||
//TEN11002 SENDONLY UP - READY 0 I81 1 183 0 0 0 0 2005.10.07 13:23:08
|
||||
//TEN11003 SENDONLY UP - READY 0 I81 1 135 0 0 0 0 2005.10.07 13:23:14
|
||||
//TEN11004 SENDONLY UP - READY 0 I81 1 112 0 0 0 0 2005.10.07 13:23:08
|
||||
//TEN11005 SENDONLY UP - READY 0 I81 1 102 0 0 0 0 2005.10.07 13:23:12
|
||||
//================================================================================================================================================
|
||||
|
||||
String taskCode = ""; // 서비스 코드명
|
||||
String luGroup = ""; // Lu 그룹명
|
||||
|
||||
while (linePoint > -1) {
|
||||
|
||||
Map map = new HashMap();
|
||||
|
||||
// 한 라인만을 읽어 온다.
|
||||
String line = result.substring(0, linePoint);
|
||||
result = result.substring(linePoint + 1);
|
||||
|
||||
// 리스트 부분만
|
||||
if ((line.indexOf("======") < 0) && (line.indexOf("-----") < 0)
|
||||
&& (line.indexOf("총") < 0) && (line.indexOf("송신") < 0)
|
||||
&& (line.indexOf("[") != 0)) {
|
||||
//에러에 대한 예외처리 에러시 첫자가 '[' 로 온다.
|
||||
|
||||
// 업무코드(서비스코드)와 LU그룹을 얻는부분
|
||||
if (line.indexOf("LU 그룹 상태") > -1) {
|
||||
|
||||
int point1 = line.indexOf("(");
|
||||
int point2 = line.indexOf(")");
|
||||
|
||||
// 서비스코드
|
||||
taskCode = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
luGroup = line.substring(point1 + 1, point2);
|
||||
|
||||
linePoint = result.indexOf("\n");
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
logger.info("line : " + line);
|
||||
|
||||
StringTokenizer st = new StringTokenizer(line);
|
||||
int stCount = 0;
|
||||
|
||||
map.put("taskCode", taskCode);
|
||||
map.put("luGroup", luGroup);
|
||||
|
||||
String sessionInitTime = "";
|
||||
|
||||
while (st.hasMoreTokens()) {
|
||||
|
||||
String t = st.nextToken();
|
||||
//System.out.println(t);
|
||||
|
||||
switch (stCount) {
|
||||
|
||||
case 0:
|
||||
// Lu 이름
|
||||
map.put("luName", t.trim());
|
||||
break;
|
||||
case 1:
|
||||
// Lu 모드
|
||||
map.put("luMode", t.trim());
|
||||
map.put("luModeToolTip", getLuModeToolTip(t.trim()));
|
||||
break;
|
||||
case 2:
|
||||
// Lu 상태
|
||||
map.put("luState", t.trim());
|
||||
map.put("luStateToolTip", getLuStateToolTip(t.trim()));
|
||||
// 상태에 대한 이미지 셋팅
|
||||
if ((t.trim()).equals("UP")) {
|
||||
map.put("startStop", "1"); //start
|
||||
} else {
|
||||
map.put("startStop", "0"); //stop
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// Lu 세부 상태
|
||||
map.put("luDetailState", t.trim());
|
||||
map.put("luDetailStateToolTip",
|
||||
getLuDetailStateToolTip(t.trim()));
|
||||
break;
|
||||
case 4:
|
||||
// TRAN 상태
|
||||
map.put("tranState", t.trim());
|
||||
map.put("tranStateToolTip",
|
||||
getTranStateToolTip(t.trim()));
|
||||
break;
|
||||
case 5:
|
||||
// 백업LU
|
||||
map.put("backupLu", t.trim());
|
||||
break;
|
||||
case 6:
|
||||
// APP_ID
|
||||
map.put("appId", t.trim());
|
||||
break;
|
||||
case 7:
|
||||
// Session 연결수
|
||||
map.put("sessionCnt", t.trim());
|
||||
break;
|
||||
case 8:
|
||||
// 송신 건수
|
||||
map.put("sendCnt", t.trim());
|
||||
break;
|
||||
case 9:
|
||||
// 수신 건수
|
||||
map.put("receiveCnt", t.trim());
|
||||
break;
|
||||
case 10:
|
||||
// 타임아웃 건수
|
||||
map.put("timeOut", t.trim());
|
||||
break;
|
||||
case 11:
|
||||
// 송신 실패 건수
|
||||
map.put("sendFailCnt", t.trim());
|
||||
break;
|
||||
case 12:
|
||||
// 수신 실패 건수
|
||||
map.put("receiveFailCnt", t.trim());
|
||||
break;
|
||||
case 13:
|
||||
// Session 초기화 시간 (년 월 일)
|
||||
sessionInitTime = t.trim();
|
||||
break;
|
||||
case 14:
|
||||
// Session 초기화 시간 (시 분 초)
|
||||
map.put("sessionInitTime", sessionInitTime + " " + t.trim());
|
||||
|
||||
break;
|
||||
}
|
||||
stCount++;
|
||||
|
||||
} // end of while
|
||||
|
||||
if (stCount < 13)
|
||||
map.put("sessionInitTime", "");
|
||||
|
||||
if (map.size() >= 10) {
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
linePoint = result.indexOf("\n");
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
} // end of refresh
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Lu 모드에 대한 툴팁정보를 얻는다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private String getLuModeToolTip(String code) {
|
||||
|
||||
String result = "";
|
||||
|
||||
if (code.equals("SENDONLY")) {
|
||||
|
||||
result = "전문 타입의 Non-Response 모드로 호스트로 데이터 송신만을 수행";
|
||||
|
||||
} else if (code.equals("RECVONLY")) {
|
||||
|
||||
result = "전문 타입의 Non-Response 모드로 호스트로부터 데이터 수신만을 수행";
|
||||
|
||||
} else if (code.equals("SENDRECV")) {
|
||||
|
||||
result = "전문 타입의 Response 모드로 호스트와 데이터 송수신 수행";
|
||||
|
||||
} else if (code.equals("TERMINAL")) {
|
||||
|
||||
result = "단말 타입의 Response 모드로 호스트와 데이터 송수신 수행";
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Tran 상태에 대한 툴팁정보를 얻는다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private String getTranStateToolTip(String code) {
|
||||
|
||||
String result = "";
|
||||
|
||||
if (code.equals("NOTREADY")) {
|
||||
|
||||
result = "Transaction을 수행할 수 없는 상태";
|
||||
|
||||
} else if (code.equals("READY")) {
|
||||
|
||||
result = "Transaction을 수행할 수 있는 상태";
|
||||
|
||||
} else if (code.equals("SEND")) {
|
||||
|
||||
result = "호스트로부터 데이터를 송신하고 있는 상태";
|
||||
|
||||
} else if (code.equals("RECV")) {
|
||||
|
||||
result = "호스트로부터 데이터를 수신 대기하고 있는 상태";
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Lu 세부 상태에 대한 툴팁정보를 얻는다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private String getLuDetailStateToolTip(String code) {
|
||||
|
||||
String result = "";
|
||||
|
||||
if (code.equals("API_ERROR")) {
|
||||
|
||||
result = "SNA Gateway 내부 장애가 발생한 상태";
|
||||
|
||||
} else if (code.equals("NOT_DEF")) {
|
||||
|
||||
result = "LU가 정의되지 않은 상태";
|
||||
|
||||
} else if (code.equals("LINK_DOWN")) {
|
||||
|
||||
result = "호스트와의 SNA Link가 Down된 상태";
|
||||
|
||||
} else if (code.equals("NET_DOWN")) {
|
||||
|
||||
result = "호스트와의 Network가 Down된 상태";
|
||||
|
||||
} else if (code.equals("DISCONN")) {
|
||||
|
||||
result = "호스트와의 LU 세션이 해제된 상태";
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Lu 상태에 대한 툴팁정보를 얻는다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private String getLuStateToolTip(String code) {
|
||||
|
||||
String result = "";
|
||||
|
||||
if (code.equals("DOWN")) {
|
||||
|
||||
result = "호스트와 세션이 해제된 상태";
|
||||
|
||||
} else if (code.equals("TRY_INIT")) {
|
||||
|
||||
result = "호스트와 세션을 연결하기 위한 자원 초기화 상태";
|
||||
|
||||
} else if (code.equals("TRY_INITSELF")) {
|
||||
|
||||
result = "호스트로 INIT-SELF 데이터를 송신하는 상태";
|
||||
|
||||
} else if (code.equals("WAIT_BIND")) {
|
||||
|
||||
result = "호스트로부터 BIND 데이터를 수신 대기하는 상태";
|
||||
|
||||
} else if (code.equals("WAIT_SDT")) {
|
||||
|
||||
result = "호스트로부터 SDT 데이터를 수신 대기하는 상태";
|
||||
|
||||
} else if (code.equals("UP")) {
|
||||
|
||||
result = "호스트와 LU-LU 세션이 연결된 상태";
|
||||
|
||||
} else if (code.equals("TRY_TERMSELF")) {
|
||||
|
||||
result = "호스트로 TERM-SELF 데이터를 송신하는 상태";
|
||||
|
||||
} else if (code.equals("WAIT_UNBIND")) {
|
||||
|
||||
result = "호스트로부터 UNBIND 데이터를 수신 대기하는 상태";
|
||||
|
||||
} else if (code.equals("TRY_TERM")) {
|
||||
|
||||
result = "호스트와 세션을 해제하기 위한 자원 해제 상태";
|
||||
|
||||
} else if (code.equals("RECV_UNBIND")) {
|
||||
|
||||
result = "호스트로부터 UNBIND를 수신한 상태";
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Sna 명령어 실행
|
||||
* 2. 처리 개요 :
|
||||
* - SnaStart, SnaStop 명령어 실행
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 1.0
|
||||
* @param form
|
||||
* @return
|
||||
*/
|
||||
public List executeStartStop(HashMap<String,Object> paramMap) {
|
||||
|
||||
// 명령어
|
||||
String cmd = paramMap.get("snaStatusCmd").toString();
|
||||
|
||||
logger.info("SnaStartStop Cmd : " + cmd);
|
||||
|
||||
return executeCmd(cmd);
|
||||
|
||||
} // end of refresh
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 명령을 실행후 결과를 반환한다.
|
||||
* 2. 처리 개요 :
|
||||
* - 명령어를 실행후 결과를 반환한다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 1.0
|
||||
* @param cmd
|
||||
* @return
|
||||
*/
|
||||
private List executeCmd(String cmd) {
|
||||
|
||||
List list = new ArrayList();
|
||||
|
||||
// 명령어의 경로를 얻는다.
|
||||
String cmdPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SNA_STATUS_PATH,
|
||||
"/fsapp/eai/SNAAdapter/bin/");
|
||||
|
||||
String command = cmdPath + cmd;
|
||||
|
||||
String result = execCommand(command);
|
||||
|
||||
Map map = new HashMap();
|
||||
if ((result.trim()).length() > 0) {
|
||||
map.put("msg", result.trim());
|
||||
} else {
|
||||
map.put("msg", "명령처리에 실패 하였습니다.");
|
||||
}
|
||||
|
||||
list.add(map);
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
|
||||
@Controller
|
||||
public class SnaLogInformationController extends BaseController{
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaLogInformationMan.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.common.util.CharsetDecoderUtil;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.onl.adapter.socket2.vo.ErrorContentVO;
|
||||
import com.eactive.eai.rms.onl.common.util.DateUtil;
|
||||
|
||||
@Controller
|
||||
public class SnaLuLogController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("comboService")
|
||||
private ComboService comboService;
|
||||
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaLuLogMan.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaLuLogMan.json",params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo( HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||
|
||||
String logType = request.getParameter("logType");
|
||||
List serverList = new ArrayList<HashMap<String,Object>>();
|
||||
|
||||
if("SNA".equals(logType)){
|
||||
// serverList = comboService.selectListComboForTable("TSEAIAD13", "SNAADPTRSEVRNAME","SNAADPTRSEVRIPNAME", "", "SNAADPTRSEVRNAME");
|
||||
}else{
|
||||
serverList = comboService.getFromEAIServerWithoutAll();
|
||||
}
|
||||
|
||||
List<ComboVo> loglevelList = comboService.getFromCode("SNA_SEARCH_LOGLEVEL");
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("serverRows" , serverList);
|
||||
resultMap.put("logLevelRows" , loglevelList);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaLuLogMan.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,@RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
List list = execute(paramMap);
|
||||
|
||||
for (int i = 0 ; i < list.size() ; i++)
|
||||
{
|
||||
//ErrorContentVO vo = (ErrorContentVO) list.get(i);
|
||||
|
||||
//dataSet.put("sline", vo.getSline(), 500, GauceDataColumn.TB_NORMAL);
|
||||
}
|
||||
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("rows" , list);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
public List execute(HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
String logLevel = (String)paramMap.get("searchLogLevel");
|
||||
String logType = (String)paramMap.get("logType");
|
||||
String searchText = (String)paramMap.get("searchText");
|
||||
|
||||
int count = 0;
|
||||
//---------------------------------------------------------
|
||||
// 대상 파일명
|
||||
//---------------------------------------------------------
|
||||
|
||||
String fileName = "";
|
||||
|
||||
String lastLineText = null;
|
||||
RandomAccessFile randomAccessFile = null;
|
||||
//---------------------------------------------------------
|
||||
// 버프의 내용을 라인씩 읽어 들인다.
|
||||
//---------------------------------------------------------
|
||||
ArrayList errorContentList = new ArrayList();
|
||||
ErrorContentVO errorContent = null;
|
||||
try {
|
||||
//---------------------------------------------------------
|
||||
// 대상 파일명
|
||||
//---------------------------------------------------------
|
||||
String defaultLogPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.DEFAULT_LOG_PATH,
|
||||
"/fslog/eai/");
|
||||
String snaWcaLogFile = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SNA_WCA_LOG_FILE,
|
||||
"snaAdapter.log");
|
||||
|
||||
logger.info("defaultLogPath : "+defaultLogPath);
|
||||
logger.info("snaWcaLogFile : "+snaWcaLogFile);
|
||||
|
||||
if (logType.equals("WCA")) {
|
||||
// (Was 도메인 경로 + Was인스턴스명 + 파일경로) - 이동철
|
||||
fileName = defaultLogPath
|
||||
+ (String)paramMap.get("searchInstNm") + "/"
|
||||
+ snaWcaLogFile;
|
||||
} else {
|
||||
fileName = snaWcaLogFile + "."
|
||||
+ DateUtil.getDate();
|
||||
}
|
||||
|
||||
logger.info("fileName : "+fileName);
|
||||
|
||||
if (logLevel.equals("TOTAL"))
|
||||
logLevel = "";
|
||||
|
||||
File file = new File(fileName);
|
||||
randomAccessFile = new RandomAccessFile(file, "r");
|
||||
|
||||
long currentPoint = randomAccessFile.getFilePointer();
|
||||
do {
|
||||
randomAccessFile.seek(currentPoint); // 마지막지점 검색
|
||||
lastLineText = randomAccessFile.readLine(); // 마지막지점의 라인을 읽어온다.
|
||||
currentPoint = randomAccessFile.getFilePointer();
|
||||
|
||||
count++;
|
||||
|
||||
if (lastLineText == null)
|
||||
break;
|
||||
|
||||
// 만약 현 라인에 해당 로그 level 이 존재 하지 않거나
|
||||
if (lastLineText.indexOf(logLevel) >= 0
|
||||
&& lastLineText.indexOf(searchText) >= 0) {
|
||||
errorContent = new ErrorContentVO();
|
||||
|
||||
lastLineText = CharsetDecoderUtil.toKor(lastLineText);
|
||||
errorContent.setSline(count + ":" + lastLineText);
|
||||
|
||||
//가장 최근이 맨 상단으로 가기 위해(이동철)
|
||||
errorContentList.add(0, errorContent);
|
||||
} else {
|
||||
// YUN_DEBUG
|
||||
logger.debug("lastLineText.indexOf(logLevel) < 0 ");
|
||||
}
|
||||
} while (lastLineText != null);
|
||||
|
||||
} catch (IOException e) {
|
||||
logger.error(e);
|
||||
} finally {
|
||||
try {
|
||||
randomAccessFile.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
return errorContentList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.EMSRuntimeException;
|
||||
import com.eactive.eai.rms.onl.manage.sna.lugroup.LuGroupService;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Controller
|
||||
public class SnaProcessStatusController extends BaseController{
|
||||
|
||||
|
||||
@Autowired
|
||||
@Qualifier("snaProcessStatusService")
|
||||
private SnaProcessStatusService service;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("luGroupService")
|
||||
private LuGroupService groupService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
private final String CMD_STATUS = "SnaStatus -t -host ";
|
||||
private final String CMD_INIT = "SnaRestat -a -host ";
|
||||
private final String CMD_START = "BackupLUStart -t -host ";
|
||||
private final String CMD_STOP = "BackupLUStop -t -host ";
|
||||
|
||||
@Autowired
|
||||
@Qualifier("comboService")
|
||||
private ComboService comboService;
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaProcessStatusMan.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaProcessStatusMan.json",params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo( HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||
|
||||
// List snaHostList = comboService.selectListComboForTable("TSEAIAD13", "SNAADPTRSEVRNAME","SNAADPTRSEVRIPNAME", "", "SNAADPTRSEVRNAME");
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
// resultMap.put("snaHostRows" , snaHostList);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaProcessStatusMan.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,@RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
List snaHostList = groupService.selectSnaHostList(paramMap);
|
||||
|
||||
// YUN_info
|
||||
if( logger.isInfoEnabled()) {
|
||||
logger.info("findStatusNonAgent snaHostList=" + snaHostList);
|
||||
}
|
||||
|
||||
String[] url = new String[snaHostList.size()];
|
||||
|
||||
//String adptGrpNm = "";
|
||||
//String luGrpNm = "";
|
||||
String snaStatusCmd = "";
|
||||
List<HashMap<String, Object>> resultList = new ArrayList<HashMap<String, Object>>();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
logger.info("########## START findStatusNonAgent ##########");
|
||||
|
||||
// 호출할 Agent Page List
|
||||
for (int i = 0; i < url.length ; i++)
|
||||
{
|
||||
logger.info("########## start for : " + i + " ###");
|
||||
|
||||
Map serverMap = (Map) snaHostList.get(i);
|
||||
snaStatusCmd = (CMD_STATUS + (String) serverMap.get("EAISVRIP"));
|
||||
//form.setSnaStatusCmd(CMD_STATUS + "172.17.50.51");
|
||||
|
||||
// YUN_info
|
||||
if( logger.isInfoEnabled()) logger.info("YUN_info command : [" + CMD_STATUS + (String) serverMap.get("EAISVRIP") + "]");
|
||||
if( logger.isInfoEnabled()) logger.info("########## init service ##########");
|
||||
|
||||
if( logger.isInfoEnabled()) logger.info("########## call service ##########");
|
||||
List list = service.executeSnaStatus(snaStatusCmd);
|
||||
|
||||
// YUN_info
|
||||
if( logger.isInfoEnabled()) logger.info("returned list size = " + list.size() );
|
||||
|
||||
String hostName = (String) serverMap.get("HOSTNAME");
|
||||
//String hostName = "keaita02";
|
||||
|
||||
HashMap<String, Object> rsMap = new HashMap<String, Object>();
|
||||
|
||||
if( logger.isInfoEnabled()) logger.info("########## start result loop ##########");
|
||||
// 호출 결과가 없으면 서버명만 출력한다.
|
||||
// 예전 AS-IS에 process_status_data.jsp에서 처리하던 것
|
||||
if (list.size() < 1)
|
||||
{
|
||||
if( logger.isInfoEnabled()) logger.info("########## no data ##########");
|
||||
rsMap.put("hostNm",hostName);
|
||||
rsMap.put("taskCode","");
|
||||
rsMap.put("luGroup","");
|
||||
rsMap.put("luGroupState","");
|
||||
rsMap.put("numLu", "");
|
||||
rsMap.put("backupLu","");
|
||||
rsMap.put("upLu", "");
|
||||
rsMap.put("usefulLu","");
|
||||
rsMap.put("resLu", "");
|
||||
rsMap.put("sendLu","");
|
||||
rsMap.put("wcaSession","");
|
||||
rsMap.put("sendCnt", "");
|
||||
rsMap.put("resCnt","");
|
||||
rsMap.put("timeOut", "");
|
||||
rsMap.put("sendFailCnt","");
|
||||
rsMap.put("resFailCnt","");
|
||||
rsMap.put("queueWaitCnt","");
|
||||
rsMap.put("queueWaitMaxCnt","");
|
||||
|
||||
resultList.add(rsMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( logger.isInfoEnabled()) logger.info("########## multi rows ##########");
|
||||
|
||||
for (int j = 0 ; j < list.size() ; j++)
|
||||
{
|
||||
if( logger.isInfoEnabled()) logger.info("########## inner for + " + (j+1) + " ##########");
|
||||
|
||||
Map map = (Map) list.get(j);
|
||||
|
||||
rsMap = new HashMap<String, Object>();
|
||||
rsMap.put("hostNm", hostName);
|
||||
rsMap.put("taskCode", (String)map.get("taskCode"));
|
||||
rsMap.put("luGroup", (String)map.get("luGroup"));
|
||||
rsMap.put("luGroupState",(String)map.get("luGroupState"));
|
||||
rsMap.put("numLu", (String)map.get("numLu"));
|
||||
rsMap.put("backupLu", (String)map.get("backupLu"));
|
||||
rsMap.put("upLu", (String)map.get("upLu"));
|
||||
rsMap.put("usefulLu", (String)map.get("usefulLu"));
|
||||
rsMap.put("resLu", (String)map.get("resLu"));
|
||||
rsMap.put("sendLu", (String)map.get("sendLu"));
|
||||
rsMap.put("wcaSession",(String)map.get("wcaSession"));
|
||||
rsMap.put("sendCnt", (String)map.get("sendCnt"));
|
||||
rsMap.put("resCnt", (String)map.get("resCnt"));
|
||||
rsMap.put("timeOut", (String)map.get("timeOut"));
|
||||
rsMap.put("sendFailCnt", (String)map.get("sendFailCnt"));
|
||||
rsMap.put("resFailCnt", (String)map.get("resFailCnt"));
|
||||
rsMap.put("queueWaitCnt", (String)map.get("queueWaitCnt"));
|
||||
rsMap.put("queueWaitMaxCnt", (String)map.get("queueWaitMaxCnt"));
|
||||
|
||||
resultList.add(rsMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( logger.isInfoEnabled()) logger.info("########## write service ##########");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("rows" , resultList);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 서버 초기화, 재시작, 종료를 처리한다.
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.17.4.4 $
|
||||
* @since : rts 1.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @param hostInfomation
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaProcessStatusMan.json", params = "cmd=LIST_STAT_CHANGE")
|
||||
public ModelAndView changeStatusNonAgent(HttpServletRequest request, HttpServletResponse response,@RequestParam HashMap<String,Object> paramMap) {
|
||||
EAIServer eaiServer = eaiServerService
|
||||
.findFirstByHostname((String) paramMap.get("hostName"))
|
||||
.orElseThrow(() -> new EMSRuntimeException("HOST를 조회 할 수 없습니다."));
|
||||
|
||||
String msg = "";
|
||||
String type = paramMap.get("snaStatusCmd").toString();
|
||||
|
||||
if ("INIT".equals(type))
|
||||
{
|
||||
paramMap.put("snaStatusCmd",CMD_INIT);
|
||||
}
|
||||
else if (type.startsWith("BACKUP_"))
|
||||
{
|
||||
paramMap.put("snaStatusCmd" ,("BACKUP_START".equals(type) ? CMD_START : CMD_STOP));
|
||||
}
|
||||
|
||||
|
||||
String result = "";
|
||||
//Sna Lu 건수 초기화
|
||||
String cmd = (String) paramMap.get("snaStatusCmd")+(String) eaiServer.getEaisevrip();
|
||||
|
||||
logger.info("cmd :"+cmd);
|
||||
List list = null;
|
||||
|
||||
if ("INIT".equals(cmd))
|
||||
{
|
||||
list = service.executeInit(cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
list = service.executeBackupLu(cmd);
|
||||
}
|
||||
|
||||
if(list != null && list.size() > 0){
|
||||
for (int i = 0 ; i < list.size() ; i++)
|
||||
{
|
||||
Map map = (Map) list.get(i);
|
||||
|
||||
result += (String)map.get("msg") + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
msg = result;
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("result" ,msg);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaProcessStatusMan.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
Gson gson = new Gson();
|
||||
String jsonStr = (String)paramMap.get("gridData");
|
||||
HashMap<String, Object>[] dataList = gson.fromJson(jsonStr, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = gson.fromJson((String)paramMap.get("headerTitle"), String[].class);
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", dataList);
|
||||
resultMap.put("fileName", (String)paramMap.get("fileName"));
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.onl.adapter.AgentExecCommand;
|
||||
|
||||
@Service("snaProcessStatusService")
|
||||
public class SnaProcessStatusService extends AgentExecCommand {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SnaProcessStatusService.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
public List executeSnaStatus(String snaStatusCmd) {
|
||||
|
||||
List list = new ArrayList();
|
||||
|
||||
// 명령어의 경로를 얻는다.
|
||||
String cmdPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SNA_STATUS_PATH,
|
||||
"/fsapp/eai/SNAAdapter/bin/");
|
||||
|
||||
// 명령어
|
||||
String cmd = cmdPath + snaStatusCmd;
|
||||
|
||||
//cmd = CharsetDecoderUtil.toKor(cmd);
|
||||
|
||||
logger.info("SnaStatus Command Exec : " + cmd);
|
||||
|
||||
String result = execCommand(cmd);
|
||||
|
||||
// YUN_DEBUG
|
||||
logger.info("executeSnaStatus() ret size=" + result.length() );
|
||||
logger.info("executeSnaStatus() result =[" + result + "]" );
|
||||
|
||||
|
||||
logger.info("SnaStatus Command Result : \n" + result);
|
||||
|
||||
int linePoint = 0;
|
||||
|
||||
// 정보를 라인단위로 파싱하여
|
||||
linePoint = result.indexOf("\n");
|
||||
|
||||
// ================================================================================================================================================
|
||||
// 어댑터 그룹(OUT_SNA_KESAPOOL_001) LU 그룹명 (OUT_SNA_KESAPOOL_001_001) LU 그룹 상태 (정상)
|
||||
// 총 LU수 (28) 총 백업 LU 수 (2) UP LU수 (28) 사용 가능 LU수 (28) 수신 대기 LU수 (0) 송신 대기 LU수 (0) WCA 세션 수 (5)
|
||||
// 송신 건수 (0) 수신 건수 (0) TIMEOUT 건수 (0) 송신 실패 건수 (0) 수신 실패 건수 (0) 큐 대기 건수 (0) 큐 대기 최대 건수 (0)
|
||||
// ================================================================================================================================================
|
||||
// 어댑터 그룹(SNAAdapter_HOST_IN) LU 그룹명 (SNAAdapter_HOST_IN_001) LU 그룹 상태 (정상)
|
||||
// 총 LU수 (50) 총 백업 LU 수 (0) UP LU수 (50) 사용 가능 LU수 (50) 수신 대기 LU수 (0) 송신 대기 LU수 (0) WCA 세션 수 (5)
|
||||
// 송신 건수 (0) 수신 건수 (0) TIMEOUT 건수 (0) 송신 실패 건수 (0) 수신 실패 건수 (0) 큐 대기 건수 (0) 큐 대기 최대 건수 (0)
|
||||
// ================================================================================================================================================
|
||||
// 어댑터 그룹(SNAAdapter_HOST_OUT) LU 그룹명 (SNAAdapter_HOST_OUT_001) LU 그룹 상태 (정상)
|
||||
// 총 LU수 (175) 총 백업 LU 수 (0) UP LU수 (175) 사용 가능 LU수 (175) 수신 대기 LU수 (0) 송신 대기 LU수 (0) WCA 세션 수 (5)
|
||||
// 송신 건수 (0) 수신 건수 (0) TIMEOUT 건수 (0) 송신 실패 건수 (0) 수신 실패 건수 (0) 큐 대기 건수 (0) 큐 대기 최대 건수 (0)
|
||||
// ================================================================================================================================================
|
||||
|
||||
String taskCode = "";
|
||||
String luGroup = "";
|
||||
String luGroupState = "";
|
||||
String numLu = "";
|
||||
String backupLu = "";
|
||||
String upLu = "";
|
||||
String usefulLu = "";
|
||||
String resLu = "";
|
||||
String sendLu = "";
|
||||
String wcaSession = "";
|
||||
String sendCnt = "";
|
||||
String resCnt = "";
|
||||
String timeOut = "";
|
||||
String sendFailCnt = "";
|
||||
String resFailCnt = "";
|
||||
String queueWaitCnt = "";
|
||||
String queueWaitMaxCnt = "";
|
||||
|
||||
while (linePoint > -1) {
|
||||
|
||||
// 한 라인만을 읽어 온다.
|
||||
String line = result.substring(0, linePoint);
|
||||
result = result.substring(linePoint + 1);
|
||||
|
||||
//logger.info("Line : " + line);
|
||||
|
||||
// 필요한 데이터가 있는 부분만
|
||||
if ((line.indexOf("======") < 0) && (line.indexOf("-----") < 0)) {
|
||||
|
||||
int point1 = 0;
|
||||
int point2 = 0;
|
||||
|
||||
// 업무코드(서비스코드)와 LU그룹을 얻는부분
|
||||
if (line.indexOf("LU 그룹 상태") > -1) {
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
// 서비스코드
|
||||
taskCode = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
// LU그룹
|
||||
luGroup = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//LU그룹 상태
|
||||
luGroupState = line.substring(point1 + 1, point2);
|
||||
|
||||
//총 LU수, UP LU수, 사용 가능 LU수, 수신 대기 LU수, 송신 대기 LU수
|
||||
} else if (line.indexOf("총 LU수") > -1) {
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//총 LU수
|
||||
numLu = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//백업LU수
|
||||
backupLu = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//UP LU수
|
||||
upLu = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//사용가능 LU수
|
||||
usefulLu = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//수신대기 LU수
|
||||
resLu = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//송신대기 LU수
|
||||
sendLu = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//WCA 세션 수
|
||||
wcaSession = line.substring(point1 + 1, point2);
|
||||
|
||||
} else if (line.indexOf("송신 건수") > -1) {
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//송신 건수
|
||||
sendCnt = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//수신 건수
|
||||
resCnt = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//타임아웃건수
|
||||
timeOut = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//송신실패건수
|
||||
sendFailCnt = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//수신실패건수
|
||||
resFailCnt = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//큐대기건수
|
||||
queueWaitCnt = line.substring(point1 + 1, point2);
|
||||
line = line.substring(point2 + 1);
|
||||
|
||||
point1 = line.indexOf("(");
|
||||
point2 = line.indexOf(")");
|
||||
|
||||
//큐 대기 최대 건수
|
||||
queueWaitMaxCnt = line.substring(point1 + 1, point2);
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("taskCode", taskCode);
|
||||
map.put("luGroup", luGroup);
|
||||
map.put("luGroupState", luGroupState);
|
||||
map.put("numLu", numLu);
|
||||
map.put("backupLu", backupLu);
|
||||
map.put("upLu", upLu);
|
||||
map.put("usefulLu", usefulLu);
|
||||
map.put("resLu", resLu);
|
||||
map.put("sendLu", sendLu);
|
||||
map.put("wcaSession", wcaSession);
|
||||
map.put("sendCnt", sendCnt);
|
||||
map.put("resCnt", resCnt);
|
||||
map.put("timeOut", timeOut);
|
||||
map.put("sendFailCnt", sendFailCnt);
|
||||
map.put("resFailCnt", resFailCnt);
|
||||
map.put("queueWaitCnt", queueWaitCnt);
|
||||
map.put("queueWaitMaxCnt", queueWaitMaxCnt);
|
||||
|
||||
list.add(map);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
linePoint = result.indexOf("\n");
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
} // end of refresh
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Sna 명령어 실행
|
||||
* 2. 처리 개요 :
|
||||
* - SnaRestart 명령어 실행
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 1.0
|
||||
* @param form
|
||||
* @return
|
||||
*/
|
||||
public List executeInit(String cmd) {
|
||||
|
||||
logger.debug("SnaRestat Cmd : " + cmd);
|
||||
|
||||
return executeCmd(cmd);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Sna 명령어 실행
|
||||
* 2. 처리 개요 :
|
||||
* - BackupLUStart, BackupLUStop 명령어 실행
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 1.0
|
||||
* @param form
|
||||
* @return
|
||||
*/
|
||||
public List executeBackupLu(String cmd) {
|
||||
|
||||
logger.debug("SnaBackupLuStartStop Cmd : " + cmd);
|
||||
|
||||
return executeCmd(cmd);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 명령을 실행후 결과를 반환한다.
|
||||
* 2. 처리 개요 :
|
||||
* - 명령어를 실행후 결과를 반환한다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 1.0
|
||||
* @param cmd
|
||||
* @return
|
||||
*/
|
||||
private List executeCmd(String cmd) {
|
||||
|
||||
List list = new ArrayList();
|
||||
|
||||
// 명령어의 경로를 얻는다.
|
||||
String cmdPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SNA_STATUS_PATH,
|
||||
"/fsapp/eai/SNAAdapter/bin/");
|
||||
|
||||
String command = cmdPath + cmd;
|
||||
|
||||
String result = execCommand(command);
|
||||
|
||||
Map map = new HashMap();
|
||||
if ((result.trim()).length() > 0) {
|
||||
map.put("msg", result.trim());
|
||||
} else {
|
||||
map.put("msg", "명령처리에 실패 하였습니다.");
|
||||
}
|
||||
|
||||
list.add(map);
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Controller
|
||||
public class SnaTrackingController extends BaseController{
|
||||
|
||||
|
||||
@Autowired
|
||||
@Qualifier("snaTrackingService")
|
||||
private SnaTrackingService service;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("comboService")
|
||||
private ComboService comboService;
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaTrackingMan.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaTrackingMan.json",params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo( HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||
|
||||
List<ComboVo> listLogPrcssSerno = comboService.getFromCode("LOGPRCSSSERNO_TYPE");
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("logPrcssSernoList", listLogPrcssSerno);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaTrackingMan.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,@RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
logger.debug("param : "+paramMap.toString());
|
||||
HashMap map = service.selectList( pageVo.getStartNum(), pageVo.getEndNum(), paramMap);
|
||||
|
||||
pageVo.setTotalCount((Integer)map.get("totalCount"));
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("total" , pageVo.getTotal()); //전체 페이지수
|
||||
resultMap.put("page" , pageVo.getPage()); //현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());//전체 레코드건수
|
||||
resultMap.put("rows" , map.get("list"));
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaTrackingMan.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
Gson gson = new Gson();
|
||||
String jsonStr = (String)paramMap.get("gridData");
|
||||
HashMap<String, Object>[] dataList = gson.fromJson(jsonStr, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = gson.fromJson((String)paramMap.get("headerTitle"), String[].class);
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", dataList);
|
||||
resultMap.put("fileName", (String)paramMap.get("fileName"));
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.eactive.eai.rms.common.base.SqlMapClientTemplateDao;
|
||||
|
||||
@Repository("snaTrackingDao")
|
||||
@SuppressWarnings("unchecked")
|
||||
public class SnaTrackingDao extends SqlMapClientTemplateDao{
|
||||
|
||||
public int selectListCount(HashMap param) throws Exception {
|
||||
return (Integer)template.queryForObject("SnaTracking.selectListCount", param);
|
||||
}
|
||||
public List selectList(HashMap param) throws Exception {
|
||||
return template.queryForList("SnaTracking.selectList", param);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.onl.adapter.AgentExecCommand;
|
||||
|
||||
@Service("snaTrackingService")
|
||||
public class SnaTrackingService extends AgentExecCommand{
|
||||
|
||||
@Autowired
|
||||
@Qualifier("snaTrackingDao")
|
||||
private SnaTrackingDao dao;
|
||||
|
||||
public HashMap selectList(int startNum,int endNum,HashMap paramMap) throws Exception{
|
||||
// 전체 목록수 얻기
|
||||
int totalCount = dao.selectListCount(paramMap);
|
||||
|
||||
paramMap.put("startNum" , startNum);// 시작 record
|
||||
paramMap.put("endNum" , endNum);// 끝 record
|
||||
|
||||
List<HashMap<String, Object>> list = dao.selectList(paramMap);
|
||||
|
||||
HashMap map = new HashMap();
|
||||
|
||||
map.put("totalCount", totalCount);
|
||||
map.put("list", list);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.EMSRuntimeException;
|
||||
import com.eactive.eai.rms.onl.manage.adapter.adapter.AdapterManService;
|
||||
import com.eactive.eai.rms.onl.manage.sna.lugroup.LuGroupService;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Controller
|
||||
public class SnaWcaConnectionListController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
@Qualifier("snaWcaConnectionListService")
|
||||
private SnaWcaConnectionListService service;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("luGroupService")
|
||||
private LuGroupService groupService;
|
||||
|
||||
@Autowired
|
||||
private AdapterManService adapterManService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaConnectionListMan.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaConnectionListMan.json",params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo( HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||
|
||||
HashMap paramMap = new HashMap();
|
||||
List groupList = groupService.selectSnaGroupList();
|
||||
List adapterList = groupService.selectSnaAdapterList();
|
||||
List luGroupShortNameList = groupService.selectLuGroupShortNameList();
|
||||
List luGroupList = groupService.selectLuGroupList(paramMap);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("groupRows" , groupList );
|
||||
resultMap.put("adapterRows" , adapterList);
|
||||
resultMap.put("luGroupShortNameRows" , luGroupShortNameList);
|
||||
resultMap.put("luGroupList" , luGroupList);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaConnectionListMan.json",params = "cmd=LIST_CHANGE_COMBO")
|
||||
public ModelAndView initCombo2( HttpServletRequest request,
|
||||
HttpServletResponse response,String adptrGstatSevrName , String adptrGroupName) throws Exception {
|
||||
HashMap paramMap = new HashMap();
|
||||
paramMap.put("adptrGstatSevrName", adptrGstatSevrName);
|
||||
paramMap.put("adptrGroupName", adptrGroupName);
|
||||
List luGroupList = groupService.selectLuGroupList(paramMap);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("luGroupList" , luGroupList);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaConnectionListMan.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,@RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
EAIServer eaiServer = eaiServerService
|
||||
.findFirstByHostname((String) paramMap.get("hostName"))
|
||||
.orElseThrow(() -> new EMSRuntimeException("HOST를 조회 할 수 없습니다."));
|
||||
|
||||
// SnaStatusCmd 설정
|
||||
String statusCmd = null;
|
||||
|
||||
statusCmd = "WcaStatus -t " + paramMap.get("adptGrpNm") + " -gA "
|
||||
+ paramMap.get("luGrpNm") + " -host " + eaiServer.getEaisevrip();
|
||||
|
||||
paramMap.put("WcaStatusCmd", statusCmd);
|
||||
List list = service.executeWcaStatus(paramMap);
|
||||
if(logger.isInfoEnabled()) logger.info("cmd list size :" + list.size());
|
||||
//SNA 어댑터 APP_CODE 프라퍼티 MAP 담기
|
||||
List<Map<String, String>> dbMapList = adapterManService.selectAdapterPropInfo(paramMap);
|
||||
HashMap<String, Object> dbMap = new HashMap<String, Object>();
|
||||
|
||||
for(Map<String, String> tmp : dbMapList){
|
||||
dbMap.put(tmp.get("ADPTRBZWKNAME"), tmp.get("PRPTY2VAL"));
|
||||
}
|
||||
|
||||
//메모리 DB비교 결과
|
||||
for (int i=0; i<list.size();i++){
|
||||
HashMap<String,Object> tmp = (HashMap<String, Object>) list.get(i);
|
||||
|
||||
if(tmp.get("appCode") != null){
|
||||
if(tmp.get("appCode").equals(dbMap.get(tmp.get("adapterName")))){
|
||||
tmp.put("compare", "true");
|
||||
}else{
|
||||
tmp.put("compare", "false");
|
||||
}
|
||||
}else{
|
||||
if(dbMap.get(tmp.get("adapterName")) == null || "".equals(dbMap.get(tmp.get("adapterName")))){
|
||||
tmp.put("compare", "true");
|
||||
}else{
|
||||
tmp.put("compare", "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(logger.isInfoEnabled()) logger.info("메모리 DB비교 결과 list size :" + list.size());
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("rows" , list);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaConnectionListMan.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
Gson gson = new Gson();
|
||||
String jsonStr = (String)paramMap.get("gridData");
|
||||
HashMap<String, Object>[] dataList = gson.fromJson(jsonStr, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = gson.fromJson((String)paramMap.get("headerTitle"), String[].class);
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", dataList);
|
||||
resultMap.put("fileName", (String)paramMap.get("fileName"));
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,371 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.onl.adapter.AgentExecCommand;
|
||||
|
||||
@Service("snaWcaConnectionListService")
|
||||
public class SnaWcaConnectionListService extends AgentExecCommand{
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SnaWcaConnectionListService.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : SNA 정보 수집
|
||||
* 2. 처리 개요 :
|
||||
* - 명령어를 사용하여 정보를 수집 파싱한다.
|
||||
* - 파싱한 정보를 RtsServiceSnaConnectionList 에 저장한다.
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
public List executeWcaStatus(HashMap<String,Object> paramMap) {
|
||||
|
||||
List list = new ArrayList();
|
||||
|
||||
// 명령어의 경로를 얻는다.
|
||||
String cmdPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SNA_STATUS_PATH,
|
||||
""); // /fsapp/eai/SNAAdapter/bin/
|
||||
|
||||
/*if ((paramMap.get("snaStatusCmd").toString()).indexOf("grep") > -1) {
|
||||
paramMap.put("snaStatusCmd","SnaStatus -tA | grep -E 'DOWN|그룹'");
|
||||
}*/
|
||||
|
||||
logger.info("WcaStatus cmdPath : " + cmdPath);
|
||||
// 명령어
|
||||
String cmd = cmdPath + paramMap.get("WcaStatusCmd");
|
||||
|
||||
//cmd = CharsetDecoderUtil.toKor(cmd);
|
||||
|
||||
logger.info("WcaStatus Command Exec : " + cmd);
|
||||
|
||||
String result = execCommand(cmd);
|
||||
|
||||
int linePoint = 0;
|
||||
|
||||
// 정보를 라인단위로 파싱하여
|
||||
linePoint = result.indexOf("\n");
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// WCA IP WCA ADAPTER NAME CODE REG DATETIME WCA APP CODE
|
||||
// ------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// 127.0.0.1 _DAO_IN_SNA_AsR{DAO_IN_SNA_AsR_i11} 2019.10.10 08:06:20 ACM,ARS,ATS,B2B,BBA,BBG,BBS,BCN,BWB,CAQ,CAV,CBF,CBG,CDB,CDC,CDG,CDF,CDH,CDM,CDS,CFF,CFH,CFK,CFS,CFZ,CGK,CGS,CRS,DAN,EBA,EBE,EBP,EFT,EGI,EIE,EIG,ELB,ESI,ESJ,ESN,FPI,GCM,GMK,HBJ,HGD,HJB,HJJ,HJK,HMY,HPJ,HSH,HSI,HSJ,HST,HTJ,HYD,ICB,IKC,IDC,IVN,IWB,JGS,JJJ,JRO,JWB,JYB,JYK,KAA,KAD,KAE,KBG,KBH,KEC,KED,KEE,KFL,KGA,KIG,KIS,KJI,KJJ,KJW,KKT,KMB,KOK,KVN,KSI,KSJ,KSN,KTN,KWB,LGC,MCI,MFB,NKS,NOV,OTP,PAE,PBS,PDM,PGS,PID,POS,PPC,SBJ,SBK,SDS,SHI,SIA,SIC,SIN,SKW,SUP,SWB,THD,TPP,TXA,UNS,UJR,WHJ,WNS,ZLO
|
||||
// 127.0.0.1 _DAO_IN_SNA_AsR{DAO_IN_SNA_AsR_i11} 2019.10.10 08:06:20 ACM,ARS,ATS,B2B,BBA,BBG,BBS,BCN,BWB,CAQ,CAV,CBF,CBG,CDB,CDC,CDG,CDF,CDH,CDM,CDS,CFF,CFH,CFK,CFS,CFZ,CGK,CGS,CRS,DAN,EBA,EBE,EBP,EFT,EGI,EIE,EIG,ELB,ESI,ESJ,ESN,FPI,GCM,GMK,HBJ,HGD,HJB,HJJ,HJK,HMY,HPJ,HSH,HSI,HSJ,HST,HTJ,HYD,ICB,IKC,IDC,IVN,IWB,JGS,JJJ,JRO,JWB,JYB,JYK,KAA,KAD,KAE,KBG,KBH,KEC,KED,KEE,KFL,KGA,KIG,KIS,KJI,KJJ,KJW,KKT,KMB,KOK,KVN,KSI,KSJ,KSN,KTN,KWB,LGC,MCI,MFB,NKS,NOV,OTP,PAE,PBS,PDM,PGS,PID,POS,PPC,SBJ,SBK,SDS,SHI,SIA,SIC,SIN,SKW,SUP,SWB,THD,TPP,TXA,UNS,UJR,WHJ,WNS,ZLO
|
||||
// 127.0.0.1 _DAO_IN_SNA_AsR{DAO_IN_SNA_AsR_i11} 2019.10.10 08:06:20 ACM,ARS,ATS,B2B,BBA,BBG,BBS,BCN,BWB,CAQ,CAV,CBF,CBG,CDB,CDC,CDG,CDF,CDH,CDM,CDS,CFF,CFH,CFK,CFS,CFZ,CGK,CGS,CRS,DAN,EBA,EBE,EBP,EFT,EGI,EIE,EIG,ELB,ESI,ESJ,ESN,FPI,GCM,GMK,HBJ,HGD,HJB,HJJ,HJK,HMY,HPJ,HSH,HSI,HSJ,HST,HTJ,HYD,ICB,IKC,IDC,IVN,IWB,JGS,JJJ,JRO,JWB,JYB,JYK,KAA,KAD,KAE,KBG,KBH,KEC,KED,KEE,KFL,KGA,KIG,KIS,KJI,KJJ,KJW,KKT,KMB,KOK,KVN,KSI,KSJ,KSN,KTN,KWB,LGC,MCI,MFB,NKS,NOV,OTP,PAE,PBS,PDM,PGS,PID,POS,PPC,SBJ,SBK,SDS,SHI,SIA,SIC,SIN,SKW,SUP,SWB,THD,TPP,TXA,UNS,UJR,WHJ,WNS,ZLO
|
||||
// 127.0.0.1 _DAO_IN_SNA_AsR{DAO_IN_SNA_AsR_i11} 2019.10.10 08:06:20 ACM,ARS,ATS,B2B,BBA,BBG,BBS,BCN,BWB,CAQ,CAV,CBF,CBG,CDB,CDC,CDG,CDF,CDH,CDM,CDS,CFF,CFH,CFK,CFS,CFZ,CGK,CGS,CRS,DAN,EBA,EBE,EBP,EFT,EGI,EIE,EIG,ELB,ESI,ESJ,ESN,FPI,GCM,GMK,HBJ,HGD,HJB,HJJ,HJK,HMY,HPJ,HSH,HSI,HSJ,HST,HTJ,HYD,ICB,IKC,IDC,IVN,IWB,JGS,JJJ,JRO,JWB,JYB,JYK,KAA,KAD,KAE,KBG,KBH,KEC,KED,KEE,KFL,KGA,KIG,KIS,KJI,KJJ,KJW,KKT,KMB,KOK,KVN,KSI,KSJ,KSN,KTN,KWB,LGC,MCI,MFB,NKS,NOV,OTP,PAE,PBS,PDM,PGS,PID,POS,PPC,SBJ,SBK,SDS,SHI,SIA,SIC,SIN,SKW,SUP,SWB,THD,TPP,TXA,UNS,UJR,WHJ,WNS,ZLO
|
||||
// 127.0.0.1 _DAO_IN_SNA_AsR{DAO_IN_SNA_AsR_i11} 2019.10.10 08:06:20 ACM,ARS,ATS,B2B,BBA,BBG,BBS,BCN,BWB,CAQ,CAV,CBF,CBG,CDB,CDC,CDG,CDF,CDH,CDM,CDS,CFF,CFH,CFK,CFS,CFZ,CGK,CGS,CRS,DAN,EBA,EBE,EBP,EFT,EGI,EIE,EIG,ELB,ESI,ESJ,ESN,FPI,GCM,GMK,HBJ,HGD,HJB,HJJ,HJK,HMY,HPJ,HSH,HSI,HSJ,HST,HTJ,HYD,ICB,IKC,IDC,IVN,IWB,JGS,JJJ,JRO,JWB,JYB,JYK,KAA,KAD,KAE,KBG,KBH,KEC,KED,KEE,KFL,KGA,KIG,KIS,KJI,KJJ,KJW,KKT,KMB,KOK,KVN,KSI,KSJ,KSN,KTN,KWB,LGC,MCI,MFB,NKS,NOV,OTP,PAE,PBS,PDM,PGS,PID,POS,PPC,SBJ,SBK,SDS,SHI,SIA,SIC,SIN,SKW,SUP,SWB,THD,TPP,TXA,UNS,UJR,WHJ,WNS,ZLO
|
||||
|
||||
while (linePoint > -1) {
|
||||
|
||||
Map map = new HashMap();
|
||||
|
||||
// 한 라인만을 읽어 온다.
|
||||
String line = result.substring(0, linePoint);
|
||||
result = result.substring(linePoint + 1);
|
||||
|
||||
// 리스트 부분만
|
||||
if ((line.indexOf("======") < 0) && (line.indexOf("-----") < 0) && (line.indexOf("WCA") < 0)
|
||||
&& (line.indexOf("[") != 0)) {
|
||||
|
||||
logger.info("line : " + line);
|
||||
|
||||
StringTokenizer st = new StringTokenizer(line);
|
||||
int stCount = 0;
|
||||
|
||||
String regTime = "";
|
||||
|
||||
while (st.hasMoreTokens()) {
|
||||
|
||||
String t = st.nextToken();
|
||||
//System.out.println(t);
|
||||
|
||||
switch (stCount) {
|
||||
|
||||
case 0:
|
||||
map.put("wcaIp", t.trim());
|
||||
break;
|
||||
case 1:
|
||||
map.put("adapterName", t.trim());
|
||||
break;
|
||||
case 2:
|
||||
regTime = t.trim();
|
||||
break;
|
||||
case 3:
|
||||
map.put("codeRegDate", regTime + " " + t.trim());
|
||||
break;
|
||||
case 4:
|
||||
map.put("appCode", t.trim());
|
||||
break;
|
||||
}
|
||||
stCount++;
|
||||
|
||||
} // end of while
|
||||
|
||||
if (map.size() >= 3) {
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
linePoint = result.indexOf("\n");
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
} // end of refresh
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Lu 모드에 대한 툴팁정보를 얻는다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
// private String getLuModeToolTip(String code) {
|
||||
//
|
||||
// String result = "";
|
||||
//
|
||||
// if (code.equals("SENDONLY")) {
|
||||
//
|
||||
// result = "전문 타입의 Non-Response 모드로 호스트로 데이터 송신만을 수행";
|
||||
//
|
||||
// } else if (code.equals("RECVONLY")) {
|
||||
//
|
||||
// result = "전문 타입의 Non-Response 모드로 호스트로부터 데이터 수신만을 수행";
|
||||
//
|
||||
// } else if (code.equals("SENDRECV")) {
|
||||
//
|
||||
// result = "전문 타입의 Response 모드로 호스트와 데이터 송수신 수행";
|
||||
//
|
||||
// } else if (code.equals("TERMINAL")) {
|
||||
//
|
||||
// result = "단말 타입의 Response 모드로 호스트와 데이터 송수신 수행";
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Tran 상태에 대한 툴팁정보를 얻는다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
// private String getTranStateToolTip(String code) {
|
||||
//
|
||||
// String result = "";
|
||||
//
|
||||
// if (code.equals("NOTREADY")) {
|
||||
//
|
||||
// result = "Transaction을 수행할 수 없는 상태";
|
||||
//
|
||||
// } else if (code.equals("READY")) {
|
||||
//
|
||||
// result = "Transaction을 수행할 수 있는 상태";
|
||||
//
|
||||
// } else if (code.equals("SEND")) {
|
||||
//
|
||||
// result = "호스트로부터 데이터를 송신하고 있는 상태";
|
||||
//
|
||||
// } else if (code.equals("RECV")) {
|
||||
//
|
||||
// result = "호스트로부터 데이터를 수신 대기하고 있는 상태";
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Lu 세부 상태에 대한 툴팁정보를 얻는다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
// private String getLuDetailStateToolTip(String code) {
|
||||
//
|
||||
// String result = "";
|
||||
//
|
||||
// if (code.equals("API_ERROR")) {
|
||||
//
|
||||
// result = "SNA Gateway 내부 장애가 발생한 상태";
|
||||
//
|
||||
// } else if (code.equals("NOT_DEF")) {
|
||||
//
|
||||
// result = "LU가 정의되지 않은 상태";
|
||||
//
|
||||
// } else if (code.equals("LINK_DOWN")) {
|
||||
//
|
||||
// result = "호스트와의 SNA Link가 Down된 상태";
|
||||
//
|
||||
// } else if (code.equals("NET_DOWN")) {
|
||||
//
|
||||
// result = "호스트와의 Network가 Down된 상태";
|
||||
//
|
||||
// } else if (code.equals("DISCONN")) {
|
||||
//
|
||||
// result = "호스트와의 LU 세션이 해제된 상태";
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Lu 상태에 대한 툴팁정보를 얻는다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.7 $
|
||||
* @since : rts 1.0
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
// private String getLuStateToolTip(String code) {
|
||||
//
|
||||
// String result = "";
|
||||
//
|
||||
// if (code.equals("DOWN")) {
|
||||
//
|
||||
// result = "호스트와 세션이 해제된 상태";
|
||||
//
|
||||
// } else if (code.equals("TRY_INIT")) {
|
||||
//
|
||||
// result = "호스트와 세션을 연결하기 위한 자원 초기화 상태";
|
||||
//
|
||||
// } else if (code.equals("TRY_INITSELF")) {
|
||||
//
|
||||
// result = "호스트로 INIT-SELF 데이터를 송신하는 상태";
|
||||
//
|
||||
// } else if (code.equals("WAIT_BIND")) {
|
||||
//
|
||||
// result = "호스트로부터 BIND 데이터를 수신 대기하는 상태";
|
||||
//
|
||||
// } else if (code.equals("WAIT_SDT")) {
|
||||
//
|
||||
// result = "호스트로부터 SDT 데이터를 수신 대기하는 상태";
|
||||
//
|
||||
// } else if (code.equals("UP")) {
|
||||
//
|
||||
// result = "호스트와 LU-LU 세션이 연결된 상태";
|
||||
//
|
||||
// } else if (code.equals("TRY_TERMSELF")) {
|
||||
//
|
||||
// result = "호스트로 TERM-SELF 데이터를 송신하는 상태";
|
||||
//
|
||||
// } else if (code.equals("WAIT_UNBIND")) {
|
||||
//
|
||||
// result = "호스트로부터 UNBIND 데이터를 수신 대기하는 상태";
|
||||
//
|
||||
// } else if (code.equals("TRY_TERM")) {
|
||||
//
|
||||
// result = "호스트와 세션을 해제하기 위한 자원 해제 상태";
|
||||
//
|
||||
// } else if (code.equals("RECV_UNBIND")) {
|
||||
//
|
||||
// result = "호스트로부터 UNBIND를 수신한 상태";
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Sna 명령어 실행
|
||||
* 2. 처리 개요 :
|
||||
* - SnaStart, SnaStop 명령어 실행
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 1.0
|
||||
* @param form
|
||||
* @return
|
||||
*/
|
||||
public List executeStartStop(HashMap<String,Object> paramMap) {
|
||||
|
||||
// 명령어
|
||||
String cmd = paramMap.get("snaStatusCmd").toString();
|
||||
|
||||
logger.info("SnaStartStop Cmd : " + cmd);
|
||||
|
||||
return executeCmd(cmd);
|
||||
|
||||
} // end of refresh
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 명령을 실행후 결과를 반환한다.
|
||||
* 2. 처리 개요 :
|
||||
* - 명령어를 실행후 결과를 반환한다.
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 1.0
|
||||
* @param cmd
|
||||
* @return
|
||||
*/
|
||||
private List executeCmd(String cmd) {
|
||||
|
||||
List list = new ArrayList();
|
||||
|
||||
// 명령어의 경로를 얻는다.
|
||||
String cmdPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SNA_STATUS_PATH,
|
||||
"/fsapp/eai/SNAAdapter/bin/");
|
||||
|
||||
String command = cmdPath + cmd;
|
||||
|
||||
String result = execCommand(command);
|
||||
|
||||
Map map = new HashMap();
|
||||
if ((result.trim()).length() > 0) {
|
||||
map.put("msg", result.trim());
|
||||
} else {
|
||||
map.put("msg", "명령처리에 실패 하였습니다.");
|
||||
}
|
||||
|
||||
list.add(map);
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.eactive.eai.rms.onl.adapter.sna;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.exception.EMSRuntimeException;
|
||||
import com.eactive.eai.rms.onl.common.util.CallAgentUtil;
|
||||
import com.eactive.eai.rms.onl.common.util.DataSetUtil;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
||||
@Controller
|
||||
public class SnaWcaStatusController extends BaseController{
|
||||
|
||||
private final String AGENT_PAGE_STATUS = "adapter_sna_status_agent.jsp";
|
||||
private final String AGENT_PAGE_STARTSTOP = "adapter_startstop_agent.jsp";
|
||||
private final String AGENT_PAGE_BACKUP = "adapter_sna_backup_change_agent.jsp";
|
||||
private final String ADAPTER_TYPE = "SNA";
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaStatusMan.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaStatusMan.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,@RequestParam HashMap<String,Object> paramMap
|
||||
) {
|
||||
|
||||
|
||||
List<EAIServer> serverList = eaiServerService.selectEaiServerIpList();
|
||||
if (serverList.isEmpty()) {
|
||||
throw new BizException("서버리스트가 없습니다.");
|
||||
}
|
||||
|
||||
List<String> urls = new ArrayList<>();
|
||||
|
||||
for (EAIServer serverMap : serverList)
|
||||
{
|
||||
String url = "http://" + serverMap.getEaisevrip() + ":"
|
||||
+ serverMap.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH
|
||||
+ AGENT_PAGE_STATUS + "?eaiSvrInstNm="
|
||||
+ serverMap.getEaisevrinstncname() + "&adapterType="
|
||||
+ ADAPTER_TYPE;
|
||||
urls.add(url);
|
||||
logger.info(url);
|
||||
}
|
||||
|
||||
String searchAdapterGroup = (String)paramMap.get("searchAdapterGroup");
|
||||
String searchAdapter = (String)paramMap.get("searchAdapter");
|
||||
|
||||
HashMap<String,String> filter = new HashMap<>();
|
||||
if (searchAdapterGroup !=null && !"".equals(searchAdapterGroup)){
|
||||
filter.put("AdapterGroup",searchAdapterGroup);
|
||||
}
|
||||
if (searchAdapter !=null && !"".equals(searchAdapter)){
|
||||
filter.put("Adapter",searchAdapter);
|
||||
}
|
||||
|
||||
DataSetUtil gUtil = new DataSetUtil();
|
||||
gUtil.setFilter(filter);
|
||||
List<HashMap<String, Object>> list = gUtil.flushXmlToClient(urls);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("rows" , list);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaStatusMan.json", params = "cmd=TRANSACTION_STARTSTOP")
|
||||
private ModelAndView transactionStartStop(HttpServletRequest request,String eaiInstanceName, String adapterGroupNm,String adapterNm, String adapterStartStop) throws Exception {
|
||||
|
||||
String result = null;
|
||||
|
||||
EAIServer selectedServer = eaiServerService
|
||||
.getByEaiSevrInstncName(eaiInstanceName);
|
||||
|
||||
// 호출할 Agent Page
|
||||
String url = "http://" + selectedServer.getEaisevrip() + ":"
|
||||
+ selectedServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH
|
||||
+ AGENT_PAGE_STARTSTOP
|
||||
+ "?adapterType=" + ADAPTER_TYPE
|
||||
+ "&adapterGroupNm=" + adapterGroupNm
|
||||
+ "&adapterNm=" + adapterNm
|
||||
+ "&adapterStartStop=" + adapterStartStop;
|
||||
|
||||
logger.info(url);
|
||||
// Agent를 호출한다.
|
||||
CallAgentUtil agent = new CallAgentUtil();
|
||||
|
||||
result = agent.getAgentDataToString(url);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("message", result); // 전체 페이지수
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaStatusMan.json", params = "cmd=TRANSACTION_BACKUP")
|
||||
public ModelAndView transactionBackUp(HttpServletRequest request,String eaiInstanceName, String adapterGroupNm,String luGroupNm, String backupMode) throws Exception {
|
||||
|
||||
String result = null;
|
||||
EAIServer selectedServer = eaiServerService
|
||||
.getByEaiSevrInstncName(eaiInstanceName);
|
||||
// 호출할 Agent Page
|
||||
String url = "http://" + selectedServer.getEaisevrip() + ":"
|
||||
+ selectedServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH
|
||||
+ AGENT_PAGE_BACKUP + "?"
|
||||
+ "adapterType=" + ADAPTER_TYPE
|
||||
+ "&adapterGroupNm=" + adapterGroupNm
|
||||
+ "&luGroupNm=" + luGroupNm
|
||||
+ "&backupMode=" + backupMode;
|
||||
|
||||
logger.info(url);
|
||||
// Agent를 호출한다.
|
||||
CallAgentUtil agent = new CallAgentUtil();
|
||||
result = agent.getAgentDataToString(url);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("message", result); // 전체 페이지수
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/sna/snaWcaStatusMan.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, String gridData, String header, String headerTitle, String fileName, String merge) throws Exception {
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
|
||||
Gson gson = new Gson();
|
||||
HashMap<String, Object>[] list = gson.fromJson(gridData, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson(header, String[].class);
|
||||
String[] headerTitles = gson.fromJson(headerTitle, String[].class);
|
||||
|
||||
HashMap<String, Object>[] lmerge = null;
|
||||
if (merge !=null){
|
||||
lmerge = gson.fromJson(merge, HashMap[].class);
|
||||
}
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", list);
|
||||
resultMap.put("fileName", fileName);
|
||||
resultMap.put("merge", lmerge);
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class MapComparator implements Comparator<HashMap<String, Object>>{
|
||||
|
||||
private final String[] key ;
|
||||
|
||||
public MapComparator(String[] key){
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(HashMap<String, Object> first, HashMap<String, Object> second){
|
||||
int result = 0;
|
||||
for(int i=0; i< key.length;i++){
|
||||
if(first.get(key[i]) == null || second.get(key[i]) == null) {
|
||||
continue;
|
||||
}
|
||||
result = ((String) first.get(key[i])).compareTo((String) second.get(key[i]));
|
||||
if(result != 0) break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.common.vo.SimpleResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.util.CallAgentUtil;
|
||||
import com.eactive.eai.rms.onl.common.util.DataSetUtil;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
import com.eactive.eai.rms.onl.manage.adapter.adapter.AdapterManService;
|
||||
import com.eactive.eai.rms.onl.manage.adapter.adapter.ui.AdapterGroupUI;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Socket 상태 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.3 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketConnectionController extends BaseController {
|
||||
private final String AGENT_PAGE_STATUS = "adapter_socket2_agent3.jsp";
|
||||
private final String AGENT_PAGE_STARTSTOP = "adapter_socket2_close.jsp";
|
||||
|
||||
private ComboService comboService;
|
||||
|
||||
private AdapterManService adapterManService;
|
||||
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
@Autowired
|
||||
protected SocketConnectionController(ComboService comboService, AdapterManService adapterManService,
|
||||
EAIServerService eaiServerService) {
|
||||
this.comboService = comboService;
|
||||
this.adapterManService = adapterManService;
|
||||
this.eaiServerService = eaiServerService;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketConnection.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd)
|
||||
throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/adapter/socket/socketConnection.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<HashMap<String, Object>>> selectList(HttpServletRequest request,
|
||||
String searchEaiSevrInstncName, String searchAdptrBzwkGroupName) {
|
||||
|
||||
List<EAIServer> serverList = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(searchEaiSevrInstncName)) {
|
||||
serverList.addAll(eaiServerService.selectEaiServerIpList());
|
||||
} else {
|
||||
serverList.add(eaiServerService.getByEaiSevrInstncName(searchEaiSevrInstncName));
|
||||
}
|
||||
|
||||
if (serverList.isEmpty()) {
|
||||
throw new BizException("서버리스트가 없습니다.");
|
||||
}
|
||||
|
||||
List<String> urlList = new ArrayList<>();
|
||||
for (EAIServer serverMap : serverList) {
|
||||
String url = "http://" + serverMap.getEaisevrip() + ":" + serverMap.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH + AGENT_PAGE_STATUS + "?eaiSvrInstNm="
|
||||
+ serverMap.getEaisevrinstncname() + "&adapterGroupName=" + searchAdptrBzwkGroupName;
|
||||
logger.debug(url);
|
||||
urlList.add(url);
|
||||
}
|
||||
|
||||
DataSetUtil gUtil = new DataSetUtil();
|
||||
List<HashMap<String, Object>> list = gUtil.flushXmlToClient(urlList);
|
||||
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/adapter/socket/socketConnection.json", params = "cmd=TRANSACTION_STARTSTOP")
|
||||
public ResponseEntity<SimpleResponse> transactionStartStop(HttpServletRequest request,
|
||||
String searchEaiSevrInstncName, String adptrBzwkGroupName, String adptrBzwkName, String remoteAddress,
|
||||
String localAddress, String session) throws Exception {
|
||||
|
||||
EAIServer eaiServer = eaiServerService.getByEaiSevrInstncName(searchEaiSevrInstncName);
|
||||
|
||||
String url = "http://" + eaiServer.getEaisevrip() + ":" + eaiServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH + AGENT_PAGE_STARTSTOP;
|
||||
|
||||
// cmd 는 start/stop
|
||||
NameValuePair[] postParameters = new NameValuePair[] {
|
||||
new NameValuePair("adapterGroupName", adptrBzwkGroupName),
|
||||
new NameValuePair("adapterName", adptrBzwkName), new NameValuePair("remoteAddress", remoteAddress),
|
||||
new NameValuePair("localAddress", localAddress), new NameValuePair("sessionName", session) };
|
||||
|
||||
// Agent를 호출한다.
|
||||
CallAgentUtil util = new CallAgentUtil();
|
||||
String message = util.getAgentDataToString(url, postParameters);
|
||||
|
||||
return ResponseEntity.ok(SimpleResponse.of(message));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketConnection.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
// 업무구분
|
||||
List<ComboVo> instanceList = comboService.getFromEAIServerWithoutAll();
|
||||
List<AdapterGroupUI> adapterList = adapterManService.selectSocketAdapterGroup("NET");
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("instanceList", instanceList);
|
||||
resultMap.put("adapterList", adapterList);
|
||||
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketConnection.excel", params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam HashMap<String, Object> paramMap) throws Exception {
|
||||
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
Gson gson = new Gson();
|
||||
String jsonStr = (String) paramMap.get("gridData");
|
||||
HashMap<String, Object>[] dataList = gson.fromJson(jsonStr, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = gson.fromJson((String) paramMap.get("headerTitle"), String[].class);
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", dataList);
|
||||
resultMap.put("fileName", (String) paramMap.get("fileName"));
|
||||
ModelAndView modelAndView = new ModelAndView("excelView", resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.util.CallAgentUtil;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
|
||||
@Controller
|
||||
public class SocketErrorContentsController extends BaseController {
|
||||
|
||||
private final String AGENT_PAGE = "adapter_log_agent.jsp";
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("comboService")
|
||||
private ComboService comboService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketErrorContents.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd)
|
||||
throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketErrorContents.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
// 업무구분
|
||||
List<ComboVo> instanceList = comboService.getFromEAIServerWithoutAll();
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("instanceList", instanceList);
|
||||
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketErrorContents.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request, JsonPageVo pageVo, String searchEaiSevrInstncName,
|
||||
String searchText) throws Exception {
|
||||
|
||||
EAIServer selectedServer = eaiServerService.getByEaiSevrInstncName(searchEaiSevrInstncName);
|
||||
|
||||
// LOG 파일 위치 프라퍼티로
|
||||
String defaultLogPath = monitoringContext.getStringProperty(MonitoringContext.DEFAULT_LOG_PATH, "/fslog/eai/");
|
||||
String socketErrorLogFile = monitoringContext
|
||||
.getStringProperty(MonitoringContext.SOCKET_ERROR_LOG_FILE, "netAdapterError.log");
|
||||
String logPath = "";
|
||||
|
||||
if (defaultLogPath == null || defaultLogPath.equals("")) {
|
||||
logPath = "/fslog/eai/" + searchEaiSevrInstncName + socketErrorLogFile;
|
||||
} else {
|
||||
logPath = defaultLogPath + searchEaiSevrInstncName + "/" + socketErrorLogFile;
|
||||
}
|
||||
|
||||
// http://192.168.68.21:30311/ONLWeb/agent/host/adapter_log_agent.jsp?fileName=/fslog/eai/EAIDS01_i01/netAdapter.log
|
||||
// searchText=[찾으려는값]
|
||||
// checkHead=[라인의 시작문자]
|
||||
// skipLineCount=[이전페이지의 마지막 라인수]
|
||||
String url = "http://" + selectedServer.getEaisevrip() + ":" + selectedServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH + AGENT_PAGE + "?fileName=" + logPath + "&searchText="
|
||||
+ URLEncoder.encode(searchText);
|
||||
|
||||
logger.info("url : " + url);
|
||||
|
||||
CallAgentUtil util = new CallAgentUtil();
|
||||
List<HashMap<String, Object>> list = new ArrayList<>();
|
||||
HashMap map = null;
|
||||
String result = util.getAgentDataToString(url);
|
||||
|
||||
int linePoint = 0;
|
||||
|
||||
// 정보를 라인단위로 파싱하여
|
||||
if (result != null) {
|
||||
linePoint = result.indexOf("\n");
|
||||
}
|
||||
|
||||
while (linePoint > -1) {
|
||||
map = new HashMap();
|
||||
// 한 라인만을 읽어 온다.
|
||||
String line = null;
|
||||
if (result != null) {
|
||||
line = result.substring(0, linePoint);
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
result = result.substring(linePoint + 1);
|
||||
}
|
||||
map.put("logContent", line);
|
||||
list.add(map);
|
||||
|
||||
linePoint = result.indexOf("\n");
|
||||
}
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("total", pageVo.getTotal()); // 전체 페이지수
|
||||
resultMap.put("page", pageVo.getPage()); // 현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());// 전체 레코드건수
|
||||
resultMap.put("rows", list);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+354
@@ -0,0 +1,354 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.adapter.common.vo.ErrorContentForm;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.util.CallAgentUtil;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : SOCKET 로그 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* Xml을 수신하지 않고 String을 받아 처리한다.(CallAgentUtil 이용)
|
||||
* 이전 로컬 WAS에서 Service단에서 Agent없이 조회하던 방식
|
||||
* 방식 변경(2008/05/21) --> Agent
|
||||
* Agent(2008/04까지) --> Local WAS(2008/04 이후) --> Agent(2008/05/21이후)
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketLogContentsController extends BaseController {
|
||||
// private final String AGENT_PAGE = "/adapter/socket/adapter_socket_log_content_agent.jsp";
|
||||
private final String AGENT_PAGE = "adapter_log_agent.jsp";
|
||||
|
||||
@Autowired
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ComboService comboService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
/*
|
||||
* /adapter/socket/adapter_socket_log_content.jsp
|
||||
* /adapter/socket/adapter_socket_log_content_data.jsp
|
||||
* /adapter/socket/adapter_socket_log_content_agent.jsp
|
||||
*/
|
||||
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketLogContents.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketLogContents.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
List<ComboVo> instanceList = comboService.getFromEAIServerWithoutAll();
|
||||
List<ComboVo> loglevelList = comboService.getFromCode("SNA_SEARCH_LOGLEVEL");
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("instanceList", instanceList);
|
||||
resultMap.put("logLevelRows", loglevelList);
|
||||
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketLogContents.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,String searchEaiSevrInstncName , String searchLogLevel, String searchText) throws Exception {
|
||||
|
||||
EAIServer selectedServer = eaiServerService.getByEaiSevrInstncName(searchEaiSevrInstncName);
|
||||
|
||||
//LOG 파일 위치 프라퍼티로
|
||||
String defaultLogPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.DEFAULT_LOG_PATH, "/fslog/eai/");
|
||||
String socketLogFile = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SOCKET_LOG_FILE, "netAdapter.log");
|
||||
String logPath = "";
|
||||
|
||||
logger.info("defaultLogPath : "+defaultLogPath);
|
||||
|
||||
if (defaultLogPath == null || defaultLogPath.equals("")) {
|
||||
logPath = "/fslog/eai/" + searchEaiSevrInstncName + socketLogFile;
|
||||
} else {
|
||||
logPath = defaultLogPath + searchEaiSevrInstncName + "/"
|
||||
+ socketLogFile;
|
||||
}
|
||||
logger.info("logPath : "+logPath);
|
||||
|
||||
//http://192.168.68.21:30311/ONLWeb/agent/host/adapter_log_agent.jsp?logLevel=TOTAL&fileName=/fslog/eai/EAIDS01_i01/netAdapter.log
|
||||
//searchText=[찾으려는값]
|
||||
//checkHead=[라인의 시작문자]
|
||||
//skipLineCount=[이전페이지의 마지막 라인수]
|
||||
String url = "http://" + (String) selectedServer.getEaisevrip() + ":"
|
||||
+ (String) selectedServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH
|
||||
+ AGENT_PAGE
|
||||
+ "?logLevel=" + searchLogLevel
|
||||
+ "&fileName=" + logPath
|
||||
+ "&searchText=" + URLEncoder.encode(searchText)
|
||||
;
|
||||
logger.info("url : "+url);
|
||||
|
||||
CallAgentUtil util = new CallAgentUtil();
|
||||
List<HashMap<String, Object>> list = new ArrayList<>();
|
||||
HashMap map = null;
|
||||
String result = util.getAgentDataToString(url);
|
||||
|
||||
int linePoint = 0;
|
||||
|
||||
// 정보를 라인단위로 파싱하여
|
||||
if(result != null){
|
||||
linePoint = result.indexOf("\n");
|
||||
}
|
||||
|
||||
while (linePoint > -1) {
|
||||
map = new HashMap();
|
||||
// 한 라인만을 읽어 온다.
|
||||
String line = null;
|
||||
if(result != null){
|
||||
line = result.substring(0, linePoint);
|
||||
}
|
||||
|
||||
result = result.substring(linePoint + 1);
|
||||
map.put("logContent", line);
|
||||
list.add(map);
|
||||
|
||||
linePoint = result.indexOf("\n");
|
||||
}
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("total" , pageVo.getTotal()); //전체 페이지수
|
||||
resultMap.put("page" , pageVo.getPage()); //현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());//전체 레코드건수
|
||||
resultMap.put("rows" , list);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : SOCKET 로그 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 : Overriden
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 1.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/onl/adapter/socket/socketLogContents.do")
|
||||
public ModelAndView handleRequest(HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
//Map model = this.createModel(request);
|
||||
ErrorContentForm form = new ErrorContentForm();
|
||||
|
||||
// parameter 설정
|
||||
form.setEaiSvrInstNm(request.getParameter("eaiSvrInstNm"));
|
||||
form.setEaiSvrIp(request.getParameter("eaiSvrIp"));
|
||||
form.setEaiSvrLsnPort(request.getParameter("eaiSvrLsnPort"));
|
||||
form.setAgentPage(AGENT_PAGE);
|
||||
form.setSearchText(request.getParameter("searchText"));
|
||||
form.setLogLevel(request.getParameter("logLevel"));
|
||||
|
||||
String cmd = request.getParameter("cmd");
|
||||
|
||||
// try {
|
||||
// // adapter.socket2.findLogContentsAgent
|
||||
// if ("SELECT_LIST".equals(cmd)) {
|
||||
// getLogList(request, response, form);
|
||||
// }
|
||||
// } catch (BizException be) {
|
||||
// //be.printStackTrace();
|
||||
// logger.error("[BIZ ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(be);
|
||||
// } catch (SysException se) {
|
||||
// //se.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(se);
|
||||
// } catch (Exception e) {
|
||||
// //e.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(e);
|
||||
// } finally {
|
||||
// GauceOutputStream gos = null;
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
//
|
||||
// if (gos != null) {
|
||||
// try {
|
||||
// gos.close();
|
||||
// } catch (Exception e) {
|
||||
// gos = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 로그 리스트 조회
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 2.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @param form
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void getLogList(HttpServletRequest request,
|
||||
HttpServletResponse response, ErrorContentForm form)
|
||||
throws Exception {
|
||||
String url = form.getWebAgentPath();
|
||||
|
||||
// YUN_DEBUG (2008.05.22)
|
||||
// local 에서 테스트 하기 위해 default 값을 사용함
|
||||
String defaultLogPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.DEFAULT_LOG_PATH, "/fslog/eai/");
|
||||
String socketLogFile = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SOCKET_LOG_FILE, "netAdapter.log");
|
||||
String logPath = "";
|
||||
if (defaultLogPath == null || defaultLogPath.equals("")) {
|
||||
logPath = "/fslog/eai/" + form.getEaiSvrInstNm() + socketLogFile;
|
||||
} else {
|
||||
logPath = defaultLogPath + form.getEaiSvrInstNm() + "/"
|
||||
+ socketLogFile;
|
||||
}
|
||||
|
||||
// 파라미터에 특수문자가 포함되어 있으므로 Post 방식으로 WebMethod를 실행해야 한다.
|
||||
NameValuePair[] postParameters = new NameValuePair[] {
|
||||
new NameValuePair("fileName", logPath),
|
||||
new NameValuePair("logLevel", form.getLogLevel()),
|
||||
new NameValuePair("searchText", form.getSearchText()) };
|
||||
|
||||
// debug
|
||||
logger.debug("SocketLogContentsController:getLogList()");
|
||||
logger.debug("url=" + url);
|
||||
for (int i = 0; i < postParameters.length; i++) {
|
||||
logger.debug("param:" + postParameters[i].getName() + " : ["
|
||||
+ postParameters[i].getValue() + "]");
|
||||
}
|
||||
|
||||
// GauceInputStream gis = null;
|
||||
// GauceOutputStream gos = null;
|
||||
//
|
||||
// try {
|
||||
// gis = ((HttpGauceRequest) request).getGauceInputStream();
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
// GauceDataSet dataSet = gis.read("ds_01");
|
||||
//
|
||||
// // Agent를 호출한다.
|
||||
// CallAgentUtil util = new CallAgentUtil();
|
||||
// String result = util.getAgentDataToString(url, postParameters);
|
||||
// String arrResult[] = null;
|
||||
// if(result != null){
|
||||
// arrResult = result.split("\n");
|
||||
// }
|
||||
//
|
||||
// // YUN_DEBUG : (2008.05.22) 로그 데이터를 역순으로 출력한다.
|
||||
// if(arrResult != null){ //취약점소스 수정 2020.08.24
|
||||
// for (int i = arrResult.length - 1; i >= 0; i--) {
|
||||
// dataSet.put("sline", arrResult[i], 1000,
|
||||
// GauceDataColumn.TB_NORMAL);
|
||||
// dataSet.heap();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// gos.write(dataSet);
|
||||
// } catch (Exception e) {
|
||||
// throw e;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/logInfoMation.view")
|
||||
private String viewLogInfoMation(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketLogContents.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
Gson gson = new Gson();
|
||||
String jsonStr = (String)paramMap.get("gridData");
|
||||
HashMap<String, Object>[] dataList = gson.fromJson(jsonStr, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = gson.fromJson((String)paramMap.get("headerTitle"), String[].class);
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", dataList);
|
||||
resultMap.put("fileName", (String)paramMap.get("fileName"));
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.util.DataSetUtil;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
import com.eactive.eai.rms.onl.manage.adapter.adapter.AdapterManService;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Socket 상태 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.3 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketProcessController extends BaseController{
|
||||
private final String AGENT_PAGE_STATUS = "adapter_socket2_agent2.jsp";
|
||||
|
||||
@Autowired
|
||||
private AdapterManService adapterManService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketProcess.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketProcess.json",params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo( HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
|
||||
List listRealTimeGroup = adapterManService.selectListRealTimeGroup();
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("realTimeGroupRows" , listRealTimeGroup);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketProcess.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,String searchType , String searchAdapterGroup, String searchRealTimeCd
|
||||
) throws Exception {
|
||||
|
||||
List<EAIServer> serverList = eaiServerService.selectEaiServerIpList();
|
||||
|
||||
if(serverList.isEmpty()) {
|
||||
throw new BizException("서버리스트가 없습니다.");
|
||||
}
|
||||
|
||||
List<String> urls = new ArrayList<>();
|
||||
|
||||
for (EAIServer serverMap : serverList)
|
||||
{
|
||||
|
||||
String url = "http://" + serverMap.getEaisevrip() + ":"
|
||||
+ serverMap.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH
|
||||
+ AGENT_PAGE_STATUS + "?cmd=get+connection+summary"
|
||||
+ "&eaiSvrInstNm=" + serverMap.getEaisevrinstncname();
|
||||
|
||||
|
||||
logger.debug(url);
|
||||
urls.add(url);
|
||||
}
|
||||
|
||||
HashMap<String,String> filter = new HashMap<>();
|
||||
if (searchAdapterGroup !=null && !"".equals(searchAdapterGroup)){
|
||||
filter.put("AdptrBzwkGroupName",searchAdapterGroup);
|
||||
}
|
||||
|
||||
if ("ERR".equals(searchType)){
|
||||
filter.put("Status", "false"); // 어댑터 상태
|
||||
filter.put("Starting", "STOPPED"); // 기동상태
|
||||
}
|
||||
else if ("24H".equals(searchType)){
|
||||
filter.put("Param8", "1"); // 24시업무여부
|
||||
}
|
||||
else if ("24E".equals(searchType)){
|
||||
filter.put("Param8", "1"); // 24시업무여부
|
||||
filter.put("Status", "false"); // 어댑터 상태
|
||||
filter.put("Starting", "STOPPED"); // 기동상태
|
||||
}
|
||||
else if("GRP".equals(searchType))
|
||||
{
|
||||
filter.put("Param7", searchRealTimeCd); // 24시업무명
|
||||
}
|
||||
|
||||
|
||||
DataSetUtil gUtil = new DataSetUtil();
|
||||
gUtil.setFilter(filter);
|
||||
List<HashMap<String, Object>> list = gUtil.flushXmlToClient(urls);
|
||||
pageVo.setTotalCount(list.size());
|
||||
|
||||
//어댑터 업무그룹별 정렬
|
||||
String[] compareParam = {"AdptrBzwkGroupName","EaiSevrInstncName"};
|
||||
|
||||
MapComparator comp = new MapComparator(compareParam);
|
||||
Collections.sort(list,comp);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("total" , pageVo.getTotal()); //전체 페이지수
|
||||
resultMap.put("page" , pageVo.getPage()); //현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());//전체 레코드건수
|
||||
resultMap.put("rows" , list);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketProcess.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, String gridData, String header, String headerTitle, String fileName, String merge) throws Exception {
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
|
||||
Gson gson = new Gson();
|
||||
HashMap<String, Object>[] list = gson.fromJson(gridData, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson(header, String[].class);
|
||||
String[] headerTitles = gson.fromJson(headerTitle, String[].class);
|
||||
|
||||
HashMap<String, Object>[] lmerge = null;
|
||||
if (merge !=null){
|
||||
lmerge = gson.fromJson(merge, HashMap[].class);
|
||||
}
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", list);
|
||||
resultMap.put("fileName", fileName);
|
||||
resultMap.put("merge", lmerge);
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
|
||||
return modelAndView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.util.CallAgentUtil;
|
||||
import com.eactive.eai.rms.onl.common.util.DataSetUtil;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
import com.eactive.eai.rms.onl.manage.adapter.adapter.AdapterManService;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Socket 상태 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.3 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketStatusController extends BaseController {
|
||||
private final String AGENT_PAGE_STATUS = "adapter_socket2_agent1.jsp";
|
||||
private final String AGENT_PAGE_STARTSTOP = "adapter_socket2_startstop.jsp";
|
||||
|
||||
@Autowired
|
||||
private AdapterManService adapterManService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketStatus.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd)
|
||||
throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketStatus.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
List listRealTimeGroup = adapterManService.selectListRealTimeGroup();
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("realTimeGroupRows", listRealTimeGroup);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/adapter/socket/socketStatus.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<HashMap<String, Object>>> selectList(HttpServletRequest request,
|
||||
String searchType, String searchAdapterGroup, String searchRealTimeCd) {
|
||||
|
||||
List<EAIServer> serverList = eaiServerService.selectEaiServerIpList();
|
||||
|
||||
if (serverList.isEmpty()) {
|
||||
throw new BizException("서버리스트가 없습니다.");
|
||||
}
|
||||
|
||||
List<String> urls = new ArrayList<>();
|
||||
for (EAIServer serverMap : serverList) {
|
||||
String url = "http://" + serverMap.getEaisevrip() + ":" + serverMap.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH + AGENT_PAGE_STATUS + "?adapterType=SOC"
|
||||
+ "&eaiSvrInstNm=" + serverMap.getEaisevrinstncname();
|
||||
urls.add(url);
|
||||
logger.debug(url);
|
||||
}
|
||||
|
||||
HashMap<String, String> filter = new HashMap<>();
|
||||
if (searchAdapterGroup != null && !"".equals(searchAdapterGroup)) {
|
||||
filter.put("AdptrBzwkGroupName", searchAdapterGroup);
|
||||
}
|
||||
|
||||
if ("ERR".equals(searchType)) {
|
||||
filter.put("Status", "false"); // 어댑터 상태
|
||||
filter.put("Starting", "STOPPED"); // 기동상태
|
||||
} else if ("24H".equals(searchType)) {
|
||||
filter.put("Param8", "1"); // 24시업무여부
|
||||
} else if ("24E".equals(searchType)) {
|
||||
filter.put("Param8", "1"); // 24시업무여부
|
||||
filter.put("Status", "false"); // 어댑터 상태
|
||||
filter.put("Starting", "STOPPED"); // 기동상태
|
||||
} else if ("GRP".equals(searchType)) {
|
||||
filter.put("Param7", searchRealTimeCd); // 24시업무명
|
||||
}
|
||||
|
||||
DataSetUtil gUtil = new DataSetUtil();
|
||||
gUtil.setFilter(filter);
|
||||
List<HashMap<String, Object>> list = gUtil.flushXmlToClient(urls);
|
||||
|
||||
// 어댑터 업무그룹별 정렬
|
||||
String[] compareParam = { "AdptrBzwkGroupName", "EaiSevrInstncName", "AdptrBzwkName" };
|
||||
|
||||
MapComparator comp = new MapComparator(compareParam);
|
||||
Collections.sort(list, comp);
|
||||
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketStatus.json", params = "cmd=TRANSACTION_STARTSTOP")
|
||||
public ModelAndView transactionStartStop(HttpServletRequest request, String eaiInstanceName, String control,
|
||||
String adapterGroupName, String adapterName) throws Exception {
|
||||
|
||||
EAIServer selectedServer = eaiServerService.getByEaiSevrInstncName(eaiInstanceName);
|
||||
|
||||
String url = "http://" + selectedServer.getEaisevrip() + ":" + selectedServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH + AGENT_PAGE_STARTSTOP;
|
||||
|
||||
// cmd 는 start/stop
|
||||
NameValuePair[] postParameters = new NameValuePair[] { new NameValuePair("cmd", control),
|
||||
new NameValuePair("adapterGroupName", adapterGroupName),
|
||||
new NameValuePair("adapterName", adapterName) };
|
||||
|
||||
// Agent를 호출한다.
|
||||
CallAgentUtil util = new CallAgentUtil();
|
||||
String message = util.getAgentDataToString(url, postParameters);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("message", message); // 전체 페이지수
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketStatus.excel", params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, String gridData,
|
||||
String header, String headerTitle, String fileName, String merge) throws Exception {
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
|
||||
Gson gson = new Gson();
|
||||
HashMap<String, Object>[] list = gson.fromJson(gridData, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson(header, String[].class);
|
||||
String[] headerTitles = gson.fromJson(headerTitle, String[].class);
|
||||
|
||||
HashMap<String, Object>[] lmerge = null;
|
||||
if (merge != null) {
|
||||
lmerge = gson.fromJson(merge, HashMap[].class);
|
||||
}
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", list);
|
||||
resultMap.put("fileName", fileName);
|
||||
resultMap.put("merge", lmerge);
|
||||
ModelAndView modelAndView = new ModelAndView("excelView", resultMap);
|
||||
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.server.EAIServer;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.data.entity.onl.server.EAIServerService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.util.CallAgentUtil;
|
||||
import com.eactive.eai.rms.onl.common.util.DataSetUtil;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Socket 상태 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.3 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketTrackingController extends BaseController{
|
||||
private final String AGENT_PAGE_STATUS = "adapter_socket2_trace_agent.jsp";
|
||||
private final String AGENT_PAGE_STARTSTOP = "adapter_socket2_trace_level.jsp";
|
||||
|
||||
|
||||
@Autowired
|
||||
@Qualifier("comboService")
|
||||
private ComboService comboService;
|
||||
|
||||
@Autowired
|
||||
private EAIServerService eaiServerService;
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketTracking.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false ) String cmd ) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())){
|
||||
cmd = "";
|
||||
}else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0]+cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketTracking.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,String searchEaiSevrInstncName
|
||||
) throws Exception {
|
||||
|
||||
EAIServer selectedServer = eaiServerService.getByEaiSevrInstncName(searchEaiSevrInstncName);
|
||||
|
||||
String url = "http://" + selectedServer.getEaisevrip() + ":"
|
||||
+ selectedServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH
|
||||
+ AGENT_PAGE_STATUS ;
|
||||
|
||||
DataSetUtil gUtil = new DataSetUtil();
|
||||
|
||||
List<HashMap<String, Object>> list = gUtil.flushXmlToClient(url);
|
||||
pageVo.setTotalCount(list.size());
|
||||
//어댑터 업무그룹별 정렬
|
||||
String[] compareParam = {"AdptrBzwkGroupName"};
|
||||
MapComparator comp = new MapComparator(compareParam);
|
||||
Collections.sort(list,comp);
|
||||
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("total" , pageVo.getTotal()); //전체 페이지수
|
||||
resultMap.put("page" , pageVo.getPage()); //현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());//전체 레코드건수
|
||||
resultMap.put("rows" , list);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
@RequestMapping(value= "/onl/adapter/socket/socketTracking.json", params = "cmd=TRANSACTION_STARTSTOP")
|
||||
public ModelAndView transactionStartStop(HttpServletRequest request,
|
||||
String searchEaiSevrInstncName, String adptrBzwkGroupName,
|
||||
String adptrBzwkName, String level) throws Exception {
|
||||
|
||||
EAIServer selectedServer = eaiServerService.getByEaiSevrInstncName(searchEaiSevrInstncName);
|
||||
String url = "http://" + selectedServer.getEaisevrip() + ":"
|
||||
+ selectedServer.getSevrlsnportname()
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH
|
||||
+ AGENT_PAGE_STARTSTOP;
|
||||
|
||||
NameValuePair[] postParameters = new NameValuePair[] {
|
||||
new NameValuePair("adapterGroupName", adptrBzwkGroupName ),
|
||||
new NameValuePair("adapterName" , adptrBzwkName),
|
||||
new NameValuePair("level" , level)
|
||||
};
|
||||
|
||||
// Agent를 호출한다.
|
||||
CallAgentUtil util = new CallAgentUtil();
|
||||
String message = util.getAgentDataToString(url, postParameters);
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("message", message); // 전체 페이지수
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/onl/adapter/socket/socketTracking.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ModelAndView initCombo(HttpServletRequest request, HttpServletResponse response) {
|
||||
List<ComboVo> instanceList = comboService.getFromEAIServerWithoutAll();
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("instanceList", instanceList);
|
||||
|
||||
return new ModelAndView("jsonView", resultMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket2.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.onl.adapter.common.vo.ErrorContentForm;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketErrorContents2Controller extends BaseController {
|
||||
private final String AGENT_PAGE = "adapter_log_agent.jsp";
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private transient MonitoringContext monitoringContext;
|
||||
|
||||
// adapter.socket2.errorContents
|
||||
|
||||
/*
|
||||
* /adapter/socket/adapter_socket_error_content.jsp
|
||||
* /adapter/socket/adapter_socket_error_content_data.jsp
|
||||
* /adapter/socket/adapter_socket_error_content_agent.jsp
|
||||
*/
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : SOCKET 에러 로그 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 : Overriden
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 1.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/adapter/socket2/socketErrorContents2.do")
|
||||
public ModelAndView handleRequest(HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
// Map model = new HashMap();
|
||||
ErrorContentForm form = new ErrorContentForm();
|
||||
|
||||
// parameter 설정
|
||||
form.setEaiSvrInstNm(request.getParameter("eaiSvrInstNm"));
|
||||
form.setEaiSvrIp(request.getParameter("eaiSvrIp"));
|
||||
form.setEaiSvrLsnPort(request.getParameter("eaiSvrLsnPort"));
|
||||
form.setAgentPage(AGENT_PAGE);
|
||||
form.setSearchText(request.getParameter("searchText")); // 검색안
|
||||
form.setLogLevel("TOTAL");
|
||||
|
||||
String cmd = request.getParameter("cmd");
|
||||
|
||||
// try {
|
||||
// // adapter.socket2.findLogContentsAgent
|
||||
// if ("SELECT_LIST".equals(cmd)) {
|
||||
// getLogList(request, response, form);
|
||||
// }
|
||||
// } catch (BizException be) {
|
||||
// //be.printStackTrace();
|
||||
// logger.error("[BIZ ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(be);
|
||||
// } catch (SysException se) {
|
||||
// // se.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(se);
|
||||
// } catch (Exception e) {
|
||||
// //e.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(e);
|
||||
// } finally {
|
||||
// GauceOutputStream gos = null;
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
//
|
||||
// if (gos != null) {
|
||||
// try {
|
||||
// gos.close();
|
||||
// } catch (Exception e) {
|
||||
// gos = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 로그 리스트 조회
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 2.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @param form
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void getLogList(HttpServletRequest request,
|
||||
HttpServletResponse response, ErrorContentForm form)
|
||||
throws Exception {
|
||||
String url = form.getWebAgentPath();
|
||||
|
||||
// YUN_DEBUG (2008.05.22)
|
||||
// local 에서 테스트 하기 위해 default 값을 사용함
|
||||
String defaultLogPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.DEFAULT_LOG_PATH, "/fslog/eai/");
|
||||
String logPath = "";
|
||||
if (defaultLogPath == null || defaultLogPath.equals("")) {
|
||||
logPath = "/fslog/eai/" + form.getEaiSvrInstNm()
|
||||
+ "/netAdapterError.log";
|
||||
} else {
|
||||
logPath = defaultLogPath
|
||||
+ form.getEaiSvrInstNm()
|
||||
+ "/"
|
||||
+ monitoringContext.getStringProperty(
|
||||
MonitoringContext.SOCKET_ERROR_LOG_FILE,
|
||||
"netAdapterError.log");
|
||||
}
|
||||
|
||||
// 파라미터에 특수문자가 포함되어 있으므로 Post 방식으로 WebMethod를 실행해야 한다.
|
||||
NameValuePair[] postParameters = new NameValuePair[] {
|
||||
new NameValuePair("fileName", logPath),
|
||||
new NameValuePair("logLevel", form.getLogLevel()),
|
||||
new NameValuePair("searchText", form.getSearchText()) };
|
||||
|
||||
// debug
|
||||
logger.debug("SocketErrorContentsController:getLogList()");
|
||||
logger.debug("url=" + url);
|
||||
for (int i = 0; i < postParameters.length; i++) {
|
||||
logger.debug("param:" + postParameters[i].getName() + " : ["
|
||||
+ postParameters[i].getValue() + "]");
|
||||
}
|
||||
|
||||
// GauceInputStream gis = null;
|
||||
// GauceOutputStream gos = null;
|
||||
//
|
||||
// try {
|
||||
// gis = ((HttpGauceRequest) request).getGauceInputStream();
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
// GauceDataSet dataSet = gis.read("ds_01");
|
||||
//
|
||||
// // Agent를 호출한다.
|
||||
// CallAgentUtil util = new CallAgentUtil();
|
||||
// String result = util.getAgentDataToString(url, postParameters);
|
||||
//
|
||||
// if(result != null){
|
||||
// String arrResult[] = result.split("\n");
|
||||
//
|
||||
// // YUN_DEBUG : (2008.05.22) 로그 데이터를 역순으로 출력한다.
|
||||
// for (int i = arrResult.length - 1; i >= 0; i--) {
|
||||
// dataSet.put("sline", arrResult[i], 1000,
|
||||
// GauceDataColumn.TB_NORMAL);
|
||||
// dataSet.heap();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// gos.write(dataSet);
|
||||
// } catch (Exception e) {
|
||||
// throw e;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket2.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketErrorInformation2Controller extends BaseController {
|
||||
private final String AGENT_PAGE = "adapter_socket2_error.jsp";
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 어댑터 에러 팝업 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 : Overriden
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 2.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/adapter/socket2/errorInformation2.do")
|
||||
public ModelAndView handleRequest(HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
String cmd = request.getParameter("cmd");
|
||||
|
||||
// try {
|
||||
// if ("SELECT_LIST".equals(cmd)) {
|
||||
// getLogList(request, response, model);
|
||||
// }
|
||||
// } catch (BizException be) {
|
||||
// //be.printStackTrace();
|
||||
// logger.error("[BIZ ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(be);
|
||||
// } catch (SysException se) {
|
||||
// //se.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(se);
|
||||
// } catch (Exception e) {
|
||||
// //e.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(e);
|
||||
// } finally {
|
||||
// GauceOutputStream gos = null;
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
//
|
||||
// if (gos != null) {
|
||||
// try {
|
||||
// gos.close();
|
||||
// } catch (Exception e) {
|
||||
// gos = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 어댑터 에러 리스트 조회
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.8 $
|
||||
* @since : rts 2.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @param form
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void getLogList(HttpServletRequest request, HttpServletResponse response, Map model) throws Exception {
|
||||
List serverList = (List) model.get("serverList");
|
||||
|
||||
String url = null;
|
||||
|
||||
String eaiSvrInstNm = request.getParameter("eaiSvrInstNm");
|
||||
String adapterGrpNm = request.getParameter("adapterGrpNm");
|
||||
String adptNm = request.getParameter("adptNm");
|
||||
|
||||
if(serverList != null){ //취약점소스 수정 2020.08.27
|
||||
for (int i = 0; i < serverList.size(); i++) {
|
||||
Map serverMap = (Map) serverList.get(i);
|
||||
if (serverMap != null && eaiSvrInstNm != null && eaiSvrInstNm.equals((String) serverMap.get("EAISVRINSTNM"))) {
|
||||
url = "http://" + (String) serverMap.get("EAISVRIP") + ":"
|
||||
+ (String) serverMap.get("EAISVRLSNPORT")
|
||||
+ HostInfomationForm.WEB_AGENT_CONTEXT_PATH
|
||||
+ AGENT_PAGE;
|
||||
|
||||
logger.debug(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check url
|
||||
if (url == null)
|
||||
throw new BizException("인스턴스명과 동일한 URL이 없습니다.");
|
||||
|
||||
// 파라미터에 특수문자가 포함되어 있으므로 Post 방식으로 WebMethod를 실행해야 한다.
|
||||
NameValuePair[] postParameters = new NameValuePair[] {
|
||||
new NameValuePair("adapterGroupName", adapterGrpNm),
|
||||
new NameValuePair("adapterName", adptNm) };
|
||||
|
||||
// GauceInputStream gis = null;
|
||||
// GauceOutputStream gos = null;
|
||||
//
|
||||
// try {
|
||||
// gis = ((HttpGauceRequest) request).getGauceInputStream();
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
// GauceDataSet dataSet = gis.read("ds_01");
|
||||
//
|
||||
// // Agent를 호출한다.
|
||||
// CallAgentUtil util = new CallAgentUtil();
|
||||
// String result = util.getAgentDataToString(url, postParameters);
|
||||
// String arrResult[] = null; //취약점소스 수정 2020.08.24
|
||||
// if(result != null){
|
||||
// arrResult = result.split("\n");
|
||||
// }
|
||||
//
|
||||
// if (arrResult != null) {
|
||||
// for (int i = 0; i < arrResult.length; i++) {
|
||||
// dataSet.put("sline", arrResult[i], 1000,
|
||||
// GauceDataColumn.TB_NORMAL);
|
||||
// dataSet.heap();
|
||||
// }
|
||||
//
|
||||
// gos.write(dataSet);
|
||||
// } else {
|
||||
// logger.debug("ErrorInformation2Controller: result data is null");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// throw e;
|
||||
// }
|
||||
}
|
||||
}
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket2.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
import com.eactive.eai.rms.onl.adapter.common.vo.ErrorContentForm;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : SOCKET 로그 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* Xml을 수신하지 않고 String을 받아 처리한다.(CallAgentUtil 이용)
|
||||
* 이전 로컬 WAS에서 Service단에서 Agent없이 조회하던 방식
|
||||
* 방식 변경(2008/05/21) --> Agent
|
||||
* Agent(2008/04까지) --> Local WAS(2008/04 이후) --> Agent(2008/05/21이후)
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketLogContents2Controller extends BaseController {
|
||||
// private final String AGENT_PAGE = "/adapter/socket/adapter_socket_log_content_agent.jsp";
|
||||
private final String AGENT_PAGE = "adapter_log_agent.jsp";
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private transient MonitoringContext monitoringContext;
|
||||
|
||||
/*
|
||||
* /adapter/socket/adapter_socket_log_content.jsp
|
||||
* /adapter/socket/adapter_socket_log_content_data.jsp
|
||||
* /adapter/socket/adapter_socket_log_content_agent.jsp
|
||||
*/
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : SOCKET 로그 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 : Overriden
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 1.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/adapter/socket2/socketLogContents2.do")
|
||||
public ModelAndView handleRequest(HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
//Map model = this.createModel(request);
|
||||
ErrorContentForm form = new ErrorContentForm();
|
||||
|
||||
// parameter 설정
|
||||
form.setEaiSvrInstNm(request.getParameter("eaiSvrInstNm"));
|
||||
form.setEaiSvrIp(request.getParameter("eaiSvrIp"));
|
||||
form.setEaiSvrLsnPort(request.getParameter("eaiSvrLsnPort"));
|
||||
form.setAgentPage(AGENT_PAGE);
|
||||
form.setSearchText(request.getParameter("searchText"));
|
||||
form.setLogLevel(request.getParameter("logLevel"));
|
||||
|
||||
String cmd = request.getParameter("cmd");
|
||||
|
||||
// try {
|
||||
// // adapter.socket2.findLogContentsAgent
|
||||
// if ("SELECT_LIST".equals(cmd)) {
|
||||
// getLogList(request, response, form);
|
||||
// }
|
||||
// } catch (BizException be) {
|
||||
// //be.printStackTrace();
|
||||
// logger.error("[BIZ ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(be);
|
||||
// } catch (SysException se) {
|
||||
// //se.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(se);
|
||||
// } catch (Exception e) {
|
||||
// //e.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(e);
|
||||
// } finally {
|
||||
// GauceOutputStream gos = null;
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
//
|
||||
// if (gos != null) {
|
||||
// try {
|
||||
// gos.close();
|
||||
// } catch (Exception e) {
|
||||
// gos = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : 로그 리스트 조회
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.5 $
|
||||
* @since : rts 2.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @param form
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void getLogList(HttpServletRequest request,
|
||||
HttpServletResponse response, ErrorContentForm form)
|
||||
throws Exception {
|
||||
String url = form.getWebAgentPath();
|
||||
|
||||
// YUN_DEBUG (2008.05.22)
|
||||
// local 에서 테스트 하기 위해 default 값을 사용함
|
||||
String defaultLogPath = monitoringContext.getStringProperty(
|
||||
MonitoringContext.DEFAULT_LOG_PATH, "/fslog/eai/");
|
||||
String socketLogFile = monitoringContext.getStringProperty(
|
||||
MonitoringContext.SOCKET_LOG_FILE, "netAdapter.log");
|
||||
String logPath = "";
|
||||
if (defaultLogPath == null || defaultLogPath.equals("")) {
|
||||
logPath = "/fslog/eai/" + form.getEaiSvrInstNm() + socketLogFile;
|
||||
} else {
|
||||
logPath = defaultLogPath + form.getEaiSvrInstNm() + "/"
|
||||
+ socketLogFile;
|
||||
}
|
||||
|
||||
// 파라미터에 특수문자가 포함되어 있으므로 Post 방식으로 WebMethod를 실행해야 한다.
|
||||
NameValuePair[] postParameters = new NameValuePair[] {
|
||||
new NameValuePair("fileName", logPath),
|
||||
new NameValuePair("logLevel", form.getLogLevel()),
|
||||
new NameValuePair("searchText", form.getSearchText()) };
|
||||
|
||||
// debug
|
||||
logger.debug("SocketLogContentsController:getLogList()");
|
||||
logger.debug("url=" + url);
|
||||
for (int i = 0; i < postParameters.length; i++) {
|
||||
logger.debug("param:" + postParameters[i].getName() + " : ["
|
||||
+ postParameters[i].getValue() + "]");
|
||||
}
|
||||
|
||||
// GauceInputStream gis = null;
|
||||
// GauceOutputStream gos = null;
|
||||
//
|
||||
// try {
|
||||
// gis = ((HttpGauceRequest) request).getGauceInputStream();
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
// GauceDataSet dataSet = gis.read("ds_01");
|
||||
//
|
||||
// // Agent를 호출한다.
|
||||
// CallAgentUtil util = new CallAgentUtil();
|
||||
// String result = util.getAgentDataToString(url, postParameters);
|
||||
// String arrResult[] = null;
|
||||
// if(result != null){
|
||||
// arrResult= result.split("\n");
|
||||
// // YUN_DEBUG : (2008.05.22) 로그 데이터를 역순으로 출력한다.
|
||||
// for (int i = arrResult.length - 1; i >= 0; i--) {
|
||||
// dataSet.put("sline", arrResult[i], 1000,
|
||||
// GauceDataColumn.TB_NORMAL);
|
||||
// dataSet.heap();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// gos.write(dataSet);
|
||||
// } catch (Exception e) {
|
||||
// throw e;
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket2.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.spring.BaseController;
|
||||
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.4 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
@Controller
|
||||
public class SocketLogInfomation2Controller extends BaseController
|
||||
{
|
||||
/**
|
||||
* <pre>
|
||||
* 1. 기능 : Socket 로그 위치 정보
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 : Overriden
|
||||
* </pre>
|
||||
*
|
||||
* @author : vs.net
|
||||
* @version : $Revision: 1.4 $
|
||||
* @since : rts 1.0
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/adapter/socket2/logInfomation2.do")
|
||||
public ModelAndView handleRequest(HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception
|
||||
{
|
||||
String cmd = request.getParameter("cmd");
|
||||
|
||||
// try
|
||||
// {
|
||||
// if ("SELECT_DEFAULT".equals(cmd))
|
||||
// {
|
||||
// getDefaultValue(response);
|
||||
// }
|
||||
// }
|
||||
// catch (BizException be)
|
||||
// {
|
||||
// //be.printStackTrace();
|
||||
// logger.error("[BIZ ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(be);
|
||||
// }
|
||||
// catch (SysException se)
|
||||
// {
|
||||
// //se.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(se);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// //e.printStackTrace();
|
||||
// logger.error("[SYS ERROR]");
|
||||
// ((HttpGauceResponse) response).addException(e);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// GauceOutputStream gos = null;
|
||||
// gos = ((HttpGauceResponse) response).getGauceOutputStream();
|
||||
//
|
||||
// if (gos != null)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// gos.close();
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// gos = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket2.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.onl.adapter.common.vo.ErrorContentForm;
|
||||
import com.eactive.eai.rms.onl.adapter.socket2.vo.ErrorContentVO;
|
||||
import com.eactive.eai.rms.onl.common.util.CharsetDecoderUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* <pre>
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 박기섭, 이동철
|
||||
* @version : $Revision: 1.4 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
|
||||
@Service("socket2ErrorContentService")
|
||||
public class SocketErrorContentService {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(SocketErrorContentService.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private transient MonitoringContext monitoringContext;
|
||||
|
||||
public List execute(ErrorContentForm form) {
|
||||
|
||||
int count = 0;
|
||||
|
||||
String logLevel = form.getLogLevel();
|
||||
|
||||
//---------------------------------------------------------
|
||||
// 대상 파일명
|
||||
// (Was 도메인 경로 + Was인스턴스명 + 파일경로) - 이동철
|
||||
//---------------------------------------------------------
|
||||
|
||||
String file_name = monitoringContext.getStringProperty(
|
||||
MonitoringContext.DEFAULT_LOG_PATH, "/fslog/eai/")
|
||||
+ form.getEaiSvrInstNm()
|
||||
+ "/"
|
||||
+ monitoringContext.getStringProperty(
|
||||
MonitoringContext.SOCKET_ERROR_LOG_FILE,
|
||||
"netAdapterError.log");
|
||||
|
||||
if (logLevel.equals("TOTAL"))
|
||||
logLevel = "";
|
||||
|
||||
RandomAccessFile randomaccessfile = null;
|
||||
ArrayList errorContentList = new ArrayList();
|
||||
ErrorContentVO errorContent = null;
|
||||
|
||||
try {
|
||||
File file = new File(file_name);
|
||||
randomaccessfile = new RandomAccessFile(file, "r");
|
||||
long currentPoint = 0L;
|
||||
randomaccessfile.getFilePointer();
|
||||
String currentText = null;
|
||||
//---------------------------------------------------------
|
||||
// 버프의 내용을 라인씩 읽어 들인다.
|
||||
//---------------------------------------------------------
|
||||
do {
|
||||
// 마지막지점 검색
|
||||
randomaccessfile.seek(currentPoint);
|
||||
// 마지막지점의 라인을 읽어온다.
|
||||
currentText = randomaccessfile.readLine();
|
||||
if(currentText != null) {
|
||||
currentText = currentText.trim();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
currentPoint = randomaccessfile.getFilePointer();
|
||||
|
||||
count++;
|
||||
|
||||
if (currentText.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 만약 현 라인에 해당 로그 level 이 존재 하지 않거나
|
||||
//if (currentText.indexOf(logLevel) >= 0 && currentText.indexOf(form.getSearchText()) >= 0) {
|
||||
errorContent = new ErrorContentVO();
|
||||
|
||||
// TODO SOCKET 로그 파싱부
|
||||
// ---> 현재 이 로그로 파싱함
|
||||
// ---> 향후 바뀔수 있음
|
||||
//[2005-08-03 13:44:18 FileLogger{NET}_EAI_DSVR0101] INFO - SOCKET_B2B_IN session stopped with SOCKET_B2B_IN-SESSION-14
|
||||
|
||||
errorContent.setSline(count + ":"
|
||||
+ CharsetDecoderUtil.toKor(currentText));
|
||||
|
||||
//가장 최근이 맨 상단으로 가기 위해(이동철)
|
||||
//errorContentList.add(errorContent);
|
||||
errorContentList.add(0, errorContent);
|
||||
|
||||
//}
|
||||
|
||||
} while (currentText != null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
} finally {
|
||||
if (randomaccessfile != null) {
|
||||
try {
|
||||
randomaccessfile.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return errorContentList;
|
||||
}
|
||||
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket2.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.onl.adapter.common.vo.ErrorContentForm;
|
||||
import com.eactive.eai.rms.onl.adapter.socket2.vo.ErrorContentVO;
|
||||
import com.eactive.eai.rms.onl.common.util.CharsetDecoderUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* <pre>
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 박기섭, 이동철
|
||||
* @version : $Revision: 1.4 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
|
||||
@Service("socket2LogContentService")
|
||||
public class SocketLogContentService {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(SocketLogContentService.class);
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private transient MonitoringContext monitoringContext;
|
||||
|
||||
public List execute(ErrorContentForm form) {
|
||||
|
||||
int count = 0;
|
||||
|
||||
String logLevel = form.getLogLevel();
|
||||
|
||||
//---------------------------------------------------------
|
||||
// 대상 파일명
|
||||
// (Was 도메인 경로 + Was인스턴스명 + 파일경로) - 이동철
|
||||
//---------------------------------------------------------
|
||||
|
||||
String file_name = monitoringContext.getStringProperty(
|
||||
MonitoringContext.DEFAULT_LOG_PATH, "/fslog/eai/")
|
||||
+ form.getEaiSvrInstNm()
|
||||
+ "/"
|
||||
+ monitoringContext.getStringProperty(
|
||||
MonitoringContext.SOCKET_LOG_FILE, "netAdapter.log");
|
||||
|
||||
if (logLevel.equals("TOTAL"))
|
||||
logLevel = "";
|
||||
|
||||
RandomAccessFile randomaccessfile = null;
|
||||
ArrayList errorContentList = new ArrayList();
|
||||
ErrorContentVO errorContent = null;
|
||||
|
||||
try {
|
||||
File file = new File(file_name);
|
||||
randomaccessfile = new RandomAccessFile(file, "r");
|
||||
long currentPoint = 0L;
|
||||
randomaccessfile.getFilePointer();
|
||||
String currentText = null;
|
||||
//---------------------------------------------------------
|
||||
// 버프의 내용을 라인씩 읽어 들인다.
|
||||
//---------------------------------------------------------
|
||||
do {
|
||||
// 마지막지점 검색
|
||||
randomaccessfile.seek(currentPoint);
|
||||
// 마지막지점의 라인을 읽어온다.
|
||||
currentText = randomaccessfile.readLine();
|
||||
if(currentText != null) { //취약점소스 수정 2020.08.27
|
||||
currentText = currentText.trim();
|
||||
}
|
||||
currentPoint = randomaccessfile.getFilePointer();
|
||||
|
||||
count++;
|
||||
|
||||
if (currentText == null) {
|
||||
break;
|
||||
}
|
||||
if (currentText.length() == 0 || currentText.indexOf("[") != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 만약 현 라인에 해당 로그 level 이 존재 하지 않거나
|
||||
if (currentText.indexOf(logLevel) >= 0
|
||||
&& currentText.indexOf(form.getSearchText()) >= 0) {
|
||||
errorContent = new ErrorContentVO();
|
||||
|
||||
// TODO SOCKET 로그 파싱부
|
||||
// ---> 현재 이 로그로 파싱함
|
||||
// ---> 향후 바뀔수 있음
|
||||
//[2005-08-03 13:44:18 FileLogger{NET}_EAI_DSVR0101] INFO - SOCKET_B2B_IN session stopped with SOCKET_B2B_IN-SESSION-14
|
||||
|
||||
errorContent.setSline(count + ":"
|
||||
+ CharsetDecoderUtil.toKor(currentText));
|
||||
|
||||
//가장 최근이 맨 상단으로 가기 위해(이동철)
|
||||
//errorContentList.add(errorContent);
|
||||
errorContentList.add(0, errorContent);
|
||||
|
||||
}
|
||||
} while (currentText != null);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
} finally {
|
||||
if (randomaccessfile != null) {
|
||||
try {
|
||||
randomaccessfile.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return errorContentList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket2.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ErrorContentVO
|
||||
implements Serializable {
|
||||
private String stime = "";
|
||||
private String sclass = "";
|
||||
private String smethod = "";
|
||||
private String slevel = "";
|
||||
private String scode = "";
|
||||
private String sline = "";
|
||||
|
||||
/** @return Returns the sclass. */
|
||||
public String getSclass() {
|
||||
return sclass;
|
||||
}
|
||||
|
||||
/** @param class1 The sclass to set. */
|
||||
public void setSclass(String class1) {
|
||||
sclass = class1;
|
||||
}
|
||||
|
||||
/** @return Returns the scode. */
|
||||
public String getScode() {
|
||||
return scode;
|
||||
}
|
||||
|
||||
/** @param code The scode to set. */
|
||||
public void setScode(String code) {
|
||||
scode = code;
|
||||
}
|
||||
|
||||
/** @return Returns the slevel. */
|
||||
public String getSlevel() {
|
||||
return slevel;
|
||||
}
|
||||
|
||||
/** @param level The slevel to set. */
|
||||
public void setSlevel(String level) {
|
||||
slevel = level;
|
||||
}
|
||||
|
||||
/** @return Returns the smethod. */
|
||||
public String getSmethod() {
|
||||
return smethod;
|
||||
}
|
||||
|
||||
/** @param method The smethod to set. */
|
||||
public void setSmethod(String method) {
|
||||
smethod = method;
|
||||
}
|
||||
|
||||
/** @return Returns the stime. */
|
||||
public String getStime() {
|
||||
return stime;
|
||||
}
|
||||
|
||||
/** @param time The stime to set. */
|
||||
public void setStime(String time) {
|
||||
stime = time;
|
||||
}
|
||||
|
||||
/** @return Returns the sline. */
|
||||
public String getSline() {
|
||||
return sline;
|
||||
}
|
||||
|
||||
/** @param sline The sline to set. */
|
||||
public void setSline(String sline) {
|
||||
this.sline = sline;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.eactive.eai.rms.onl.adapter.socket2.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.eactive.eai.rms.onl.common.vo.HostInfomationForm;
|
||||
|
||||
/**
|
||||
*
|
||||
* <pre>
|
||||
* 1. 기능 :
|
||||
* 2. 처리 개요 :
|
||||
* -
|
||||
* 3. 주의사항 :
|
||||
* </pre>
|
||||
* @author : 이동철
|
||||
* @version : $Revision: 1.1 $
|
||||
* @since : rts 1.0
|
||||
*/
|
||||
public class SocketConnectionListForm
|
||||
extends HostInfomationForm
|
||||
implements Serializable {
|
||||
|
||||
private String adapterGrpNm = "";
|
||||
|
||||
private String netadminCmd = "";
|
||||
|
||||
public String getAdapterGrpNm() {
|
||||
return adapterGrpNm;
|
||||
}
|
||||
|
||||
public void setAdapterGrpNm(String adapterGrpNm) {
|
||||
this.adapterGrpNm = adapterGrpNm;
|
||||
}
|
||||
|
||||
public String getNetadminCmd() {
|
||||
return netadminCmd;
|
||||
}
|
||||
|
||||
public void setNetadminCmd(String netadminCmd) {
|
||||
this.netadminCmd = netadminCmd;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user