<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="com.eactive.eai.transformer.engine.TransformEngine"%>

<%
    
    String             action    = request.getParameter("actionType");
    TransformEngine    engine    = TransformEngine.getInstance();
    
    String status = "";
    
    if("START".equals(action)){
        engine.start();
          
    }
    if("STOP".equals(action)){
        engine.stop();
    }

    if(engine.isStarted())
        status = "시작됨";
    else
        status = "종료됨";
%>

<html>
    <head>
        <title>
            TransRuleReload Manager
        </title>
        <script>
        function doAction() {
            document.frm.submit();
        }
        
        function doStop() {
            document.frm.actionType.value="STOP";
            document.frm.submit();
        }
        
        function doStart() {
            document.frm.actionType.value="START";
            document.frm.submit();
        }
        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>TransRuleReload Configuration</b> <br><br>
        </p>
        <form name="frm" action="">
        <input type="hidden" name="actionType" value="">
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
         <tr bgcolor='white'>
            <td align='right' bgcolor="#003366">&nbsp; <font color="yellow"><b>항목</b> &nbsp;</font></td>
            <td align='left' bgcolor="#003366">&nbsp; <font color="yellow"><b>설명</b> &nbsp;</font></td>
        </tr>
        <tr bgcolor='white'>            
            <td align='right' width='180' bgcolor="#ccccff">현재상태 :&nbsp;&nbsp;</td>
            <td align='left' style="height: 40;">&nbsp;<input type="text" name="period" value="<%=status%>" readonly ></td>            
        </tr>
        <tr bgcolor='white'>            
            <td align='right' width='180' bgcolor="#ccccff">상태변경 버튼 :&nbsp;&nbsp;</td>
            <%
	        if ("시작됨".equals(status)){
			%>       
           		<td align='left' style="height: 40;">&nbsp;<input type="button" value="STOP" onclick="doStop()"></td>  
           		
           		<tr bgcolor='white'>            
            		<td align='right' width='180' bgcolor="#ccccff">버튼설명 :&nbsp;&nbsp;</td>
            		<td>&nbsp;TransformEngine 에서 clearEngine()을 실행합니다.</td>
           		</tr>  
            <%
	        } else {
			%>        
				<td align='left'>
		            <input type="button" value="START" onclick="doStart()">
		        </td>
           		<tr bgcolor='white'>            
            		<td align='right' width='180' bgcolor="#ccccff">버튼설명 :&nbsp;&nbsp;</td>
            		<td>&nbsp;&TransformEngine 에서 initEngine()을 실행합니다.</td>
            	</tr>		        
			<%        
			}
			%>		
		<tr bgcolor='white'>            
       		<td rowspan=4 align='right' width='180' bgcolor="#ccccff">실행Manager :&nbsp;&nbsp;</td>
       		<td>&nbsp;LayoutTypeManager</td>
       	</tr>      
	    <tr bgcolor='white'>
	    	<td>&nbsp;FunctionManager</td>
        </tr>
        <tr bgcolor='white'>
	    	<td>&nbsp;LayoutManager</td>
        </tr>
        <tr bgcolor='white'>
	    	<td>&nbsp;TransformManager</td>
        </tr>
        </table><br>
 
        </form>
    </body>
</html>