<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="com.eactive.eai.adapter.AdapterGroupVO"%>
<%@ page import="com.eactive.eai.adapter.AdapterManager"%>
<%@ page import="com.eactive.eai.adapter.Keys"%>


<%@ page import="com.eactive.eai.inbound.processor.RequestProcessor"%>

<%
    AdapterManager manager = AdapterManager.getInstance();
    List all = manager.getAllAdapterGroupNames();
    
    String flag = request.getParameter("flag");
    if(flag!=null && flag.equals("reset")) {
    	RequestProcessor.resetCount();   
    }
    
    
%>
<html>
    <head>
        <META HTTP-EQUIV="refresh" Content="5; /ESBWeb/common/currentTx.jsp">
        <title>
            어댑터 별 진행 서비스 수
        </title>
        <script>
            function go() {
                document.frm.submit();
            }
        </script>
    </head>
    <body>        
        <p>
            RequestProcessor 처리 현황
        </p>
        <form name="frm" method="post">
        <input type="hidden" name="flag" value="reset">
        <table width="450" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='center'>현재수신 건수</td>
            <td align='center'>에러건수</td>
            <td align='center'>초기화</td>
        </tr>
        <tr bgcolor='white'>
            <td align='center'><%= RequestProcessor.rcvCount()%></td>
            <td align='center'><%= RequestProcessor.errCount()%></td>
            <td align='center'><input type="submit" value="reset"></td>
        </tr>
        </table>
        </form>    
        <br>
        <p>
            어댑터 별 진행 서비스 수
        </p>
        <table width="450" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='center'>이름</td>
            <td align='center'>상태</td>
            <td align='center'>진행건수</td>
        </tr>
        <% 
            for(int i=0;i<all.size();i++) {
                String name = (String)all.get(i);
                AdapterGroupVO g = (AdapterGroupVO)manager.getAdapterGroupVO(name); 
        %>
        <tr bgcolor='white'>
            <td align='right'><%=g.getName()%></td>
            <td align='center'><%=g.isStarted()%></td>
            <td align='center'><%=g.currentTx()%></td>
        </tr>
        <%  }%>
        </table>
            
    </body>
</html>