1 <%@ page import="org.ultramonkey.l7.model.*,
2 org.ultramonkey.l7.controller.*,
3 org.ultramonkey.l7.view.*, java.util.*"
4 language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
10 if (session.isNew()) {
11 MessageView error = new MessageView(41333, LogCategorySet.GUI_USER_AUTHENTICATION,
12 Message.INVALID_SESSSION);
13 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
14 response.sendRedirect(RedirectPages.LOGIN);
21 MessageView message = (MessageView) session.getAttribute(SessionKeys.RESULT_MESSAGE);
22 String errorMessage = null;
25 if (message != null) {
26 errorMessage = message.getMessage();
27 errorNumber = message.getErrno();
28 category = message.getCategory();
29 session.setAttribute(SessionKeys.RESULT_MESSAGE, null);
36 MessageView commandmessage = (MessageView) session.getAttribute(SessionKeys.COMMAND_MESSAGE);
37 String commandMessage = null;
38 int commandNumber = 0;
39 String commandCategory = "";
40 if (commandmessage != null) {
41 commandMessage = commandmessage.getMessage();
42 commandNumber = commandmessage.getErrno();
43 commandCategory = commandmessage.getCategory();
44 session.setAttribute(SessionKeys.COMMAND_MESSAGE, null);
47 // get replicationData
48 L7guiFramework framework = new L7guiFramework();
49 ReplicationData rep = framework.getReplicationData();
50 ReplicationStatus repStatus = ReplicationStatus.OUT;
52 MessageView error = new MessageView(41334, LogCategorySet.GUI_IO,
53 Message.UNEXPECTED_ERROR);
54 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
55 response.sendRedirect(RedirectPages.LOGIN);
59 repStatus = rep.replicationMode;
61 String printRepStatus = null;
62 String changeModeMessage = null;
65 printRepStatus = "Master Running";
66 changeModeMessage = "If you would like to stop sending Replication data, push the following button.";
69 printRepStatus = "Slave Running";
70 changeModeMessage = "If you would like to stop receiving Replication data, push the following button.";
73 printRepStatus = "Master Stopped";
74 changeModeMessage = "If you would like to start sending Replication data, push the following button.";
77 printRepStatus = "Slave Stopped";
78 changeModeMessage = "If you would like to start receiving Replication data, push the following button.";
81 printRepStatus = "Replication Invalid";
84 printRepStatus = "In Starting Replication";
87 MessageView error = new MessageView(41335, LogCategorySet.GUI_REPLICATION,
88 Message.UNEXPECTED_ERROR);
89 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
90 response.sendRedirect(RedirectPages.LOGIN);
94 String selfNic = rep.nic;
95 String peerIp = rep.otherNode.host;
97 if ( (selfNic == null) || (peerIp == null) ){
98 MessageView error = new MessageView(41336, LogCategorySet.GUI_IO_FILE,
99 Message.UNEXPECTED_ERROR);
100 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
101 response.sendRedirect(RedirectPages.LOGIN);
105 HashMap<String, Integer> repDatainfo = rep.component;
107 if (repDatainfo != null){
108 keys = repDatainfo.keySet();
114 ClusterData cd = framework.getClusterData();
116 MessageView error = new MessageView(41337, LogCategorySet.GUI_IO_COMMAND,
117 Message.CLUSTER_DATA_ERROR);
118 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
119 response.sendRedirect(RedirectPages.LOGIN);
126 String cssSeat = "l7gui_single_style.css";
127 if ( cd.self_status == ClusterStatus.ACTIVE ){
128 cssSeat = "l7gui_act_style.css";
130 else if ( cd.self_status == ClusterStatus.STANDBY ){
131 cssSeat = "l7gui_sby_style.css";
138 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
141 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
142 <meta http-equiv="Pragma" content="no-cache">
143 <meta http-equiv="Cache-Control" content="no-cache">
144 <meta http-equiv="Expires" content="0">
145 <meta http-equiv="Content-Script-Type" content="text/javascript" />
146 <meta http-equiv="Content-Style-Type" content="text/css" />
147 <script src="l7gui.js" type="text/javascript"></script>
149 <meta http-equiv="refresh" content="<%= RedirectPages.NOSCRIPT_TIME %>; url=<%= RedirectPages.LOGIN %>"/>
151 <link rel="stylesheet" type="text/css" href="<%= cssSeat %>" />
152 <link rel="shortcut icon" href="images/favicon.ico"/>
154 <title>Replication</title>
158 <body class="normal">
159 <jsp:include page="menu.jsp" flush="false"/>
166 if ( (message != null) && (errorMessage != null) ) {
169 <p class="error">[<%=category %> - <%=errorNumber %>]</p>
170 <p class="error"><%=errorMessage %></p>
174 else if ( (commandmessage != null) && (commandMessage != null) ){
176 <p class="success">[<%=commandCategory %> - <%=commandNumber %>]</p>
177 <p class="success"><%=commandMessage %></p>
182 <h2> Replication Current Status</h2>
184 <form method="post" action="ReplicationModeChangeServlet" name="rep" >
186 <legend>Replication Current Status</legend>
187 <table class="infotable" cellspacing="0">
190 <th>Replication Mode</th>
195 <td class="center"><%=printRepStatus %></td>
200 <% if ( changeModeMessage != null){
202 <h4><%=changeModeMessage %></h4>
209 <input type="submit" name="button" value="<%=ButtonMode.REP_MASTER_STOPPING %>" onClick="return confirm(replication_stop_send)" />
214 <input type="submit" name="button" value="<%=ButtonMode.REP_SLAVE_STOPPING %>" onClick="return confirm(replication_stop_receive)" />
219 <input type="submit" name="button" value="<%=ButtonMode.REP_MASTER_RUNNING %>" onClick="return confirm(replication_start_send)" />
224 <input type="submit" name="button" value="<%=ButtonMode.REP_SLAVE_RUNNING %>" onClick="return confirm(replication_start_receive)" />
233 if ( repStatus != ReplicationStatus.SINGLE ){
235 <form method="post" action="replication_modify.jsp" name="rep_info">
236 <h2> Replication Configuration Information</h2>
238 <legend>Replication Configuration Information</legend>
239 <table class="infotable" cellspacing="0">
242 <th>Self Node</th><th colspan="2">Peer Node</th><th rowspan="2">Interval</th>
245 <th>NIC</th><th>IP Address</th><th>Port Number</th>
250 <td class="center"><%=selfNic %></td>
251 <td class="center"><%=peerIp %></td>
252 <td class="center"><%=rep.otherNode.port %></td>
253 <td class="center"><%=rep.interval %> [µsec]</td>
258 <h4>If you would like to modify Interval, push the following button.</h4>
260 <input type="submit" value="Modify" />
263 <% if (keys != null) {%>
264 <h2> Replication Data Size Information</h2>
266 <legend>Replication Data Size Information</legend>
267 <table class="infotable" cellspacing="0">
270 for (Iterator iterator = keys.iterator(); iterator.hasNext();){
272 <th><%=iterator.next() %></th>
279 for (Iterator iterator = keys.iterator(); iterator.hasNext();){
280 String key = (String)iterator.next();
281 double size = ((Integer)repDatainfo.get(key)) * 480;
282 String sizeUnit = "[byte]";
283 if ( (size >= 1000) && ( size < 1000000 )){
285 sizeUnit = "[Kbyte]";
287 else if( size >= 1000000 ){
288 size = size / 1000000 ;
289 sizeUnit = "[Mbyte]";
291 out.println("<td class=\"center\">" + size + "" + sizeUnit + "</td>");
299 if ( repStatus == ReplicationStatus.MASTER ){
301 <h2> Immediate Replication</h2>
302 <form method="post" action="ReplicationRunServlet" name="rep" >
303 <h4>If you would like to execute immediate Replication, push the following button.</h4>
305 <input type="submit" name="button_immediate" value="<%=ButtonMode.REP_EXECUTE%>" onClick="return confirm(replication_dump)" />