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.JonasManagementRepr;
14: import org.objectweb.jonas.jmx.JonasObjectName;
15: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
16:
17: /**
18: * Cmi cluster monitoring action
19: * @author Adriana.Danes@bull.net
20: */
21: public class CmiClusterAction extends JonasBaseAction {
22:
23: public ActionForward executeAction(ActionMapping p_Mapping,
24: ActionForm p_Form, HttpServletRequest p_Request,
25: HttpServletResponse p_Response) throws IOException,
26: ServletException {
27:
28: // Get cluster name from the 'clust' parameter
29: String name = p_Request.getParameter("clust");
30: if (name == null) {
31: addGlobalError(new Exception(
32: "CmiClusterAction: clust parameter is null."));
33: saveErrors(p_Request, m_Errors);
34: return (p_Mapping.findForward("Global Error"));
35: }
36:
37: CmiClusterForm oForm = (CmiClusterForm) p_Form;
38: oForm.setName(name);
39: try {
40: ObjectName on = JonasObjectName.cluster(name, "CmiCluster");
41: oForm.setState(getStringAttribute(on, "State"));
42: oForm.setMcastAddr(getStringAttribute(on, "McastAddr"));
43: oForm.setMcastPort(getIntegerAttribute(on, "McastPort"));
44: oForm.setProtocol(getStringAttribute(on, "Protocol"));
45: } catch (Throwable t) {
46: addGlobalError(t);
47: saveErrors(p_Request, m_Errors);
48: return (p_Mapping.findForward("Global Error"));
49: }
50:
51: // Forward to the jsp.
52: return (p_Mapping.findForward("CmiCluster"));
53: }
54: }
|