01: package org.objectweb.jonas.webapp.jonasadmin.monitoring;
02:
03: import java.io.IOException;
04:
05: import javax.management.ObjectName;
06: import javax.servlet.ServletException;
07: import javax.servlet.http.HttpServletRequest;
08: import javax.servlet.http.HttpServletResponse;
09:
10: import org.apache.struts.action.ActionForm;
11: import org.apache.struts.action.ActionForward;
12: import org.apache.struts.action.ActionMapping;
13: import org.objectweb.jonas.jmx.JonasObjectName;
14: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
15: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
16:
17: public class TomcatMemberAction extends JonasBaseAction {
18:
19: public ActionForward executeAction(ActionMapping p_Mapping,
20: ActionForm p_Form, HttpServletRequest p_Request,
21: HttpServletResponse p_Response) throws IOException,
22: ServletException {
23: // Get member name from the 'member' parameter and cluster name from the 'clust' parameter
24: String name = p_Request.getParameter("member");
25: if (name == null) {
26: addGlobalError(new Exception(
27: "JkMemberAction: member parameter is null."));
28: saveErrors(p_Request, m_Errors);
29: return (p_Mapping.findForward("Global Error"));
30: }
31: String cluster = p_Request.getParameter("clust");
32: if (cluster == null) {
33: addGlobalError(new Exception(
34: "JkClusterAction: clust parameter is null."));
35: saveErrors(p_Request, m_Errors);
36: return (p_Mapping.findForward("Global Error"));
37: }
38: // Form used
39: TomcatMemberForm oForm = (TomcatMemberForm) p_Form;
40: oForm.setName(name);
41: // cluster type
42: String type = "TomcatCluster";
43: try {
44: ObjectName on = JonasObjectName.clusterMember(name, type,
45: cluster);
46: oForm.setHost(getStringAttribute(on, "HostName"));
47: oForm.setState(getStringAttribute(on, "State"));
48: oForm
49: .setReceiverInfo(getStringAttribute(on,
50: "ReceiverInfo"));
51: oForm.setTcpListenAddress(getStringAttribute(on,
52: "TcpListenAddress"));
53: oForm.setTcpListenPort(getIntegerAttribute(on,
54: "TcpListenPort"));
55: oForm.setTcpThreadCount(getIntegerAttribute(on,
56: "TcpThreadCount"));
57: oForm.setTcpReceivedBytes(getLongAttribute(on,
58: "TotalReceivedBytes"));
59: oForm.setSenderInfo(getStringAttribute(on, "SenderInfo"));
60: oForm.setAckTimeout(getLongAttribute(on, "AckTimeout"));
61: oForm
62: .setAutoConnect(getBooleanAttribute(on,
63: "AutoConnect"));
64: oForm.setDoTransmitterProcessingStats(getBooleanAttribute(
65: on, "DoTransmitterProcessingStats"));
66: oForm.setReplicationMode(getStringAttribute(on,
67: "ReplicationMode"));
68: oForm.setWaitForAck(getBooleanAttribute(on, "WaitForAck"));
69: } catch (Throwable t) {
70: addGlobalError(t);
71: saveErrors(p_Request, m_Errors);
72: return (p_Mapping.findForward("Global Error"));
73: }
74:
75: // Forward to the jsp.
76: return (p_Mapping.findForward("TomcatMember"));
77: }
78: }
|