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:
16: public class EjbHaClusterAction extends JonasBaseAction {
17:
18: public ActionForward executeAction(ActionMapping p_Mapping,
19: ActionForm p_Form, HttpServletRequest p_Request,
20: HttpServletResponse p_Response) throws IOException,
21: ServletException {
22: // Get cluster name from the 'clust' parameter
23: String name = p_Request.getParameter("clust");
24: if (name == null) {
25: addGlobalError(new Exception(
26: "EjbHaClusterAction: clust parameter is null."));
27: saveErrors(p_Request, m_Errors);
28: return (p_Mapping.findForward("Global Error"));
29: }
30:
31: EjbHaClusterForm oForm = (EjbHaClusterForm) p_Form;
32: oForm.setName(name);
33: try {
34: ObjectName on = JonasObjectName.cluster(name,
35: "EjbHaCluster");
36: String state = getStringAttribute(on, "State");
37: oForm.setState(state);
38: oForm.setMcastAddr(getStringAttribute(on, "McastAddr"));
39: oForm.setMcastPort(getIntegerAttribute(on, "McastPort"));
40: } catch (Throwable t) {
41: addGlobalError(t);
42: saveErrors(p_Request, m_Errors);
43: return (p_Mapping.findForward("Global Error"));
44: }
45:
46: // Forward to the jsp.
47: return (p_Mapping.findForward("EjbHaCluster"));
48: }
49: }
|