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:
14: import org.objectweb.jonas.jmx.JonasObjectName;
15: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
16:
17: public class EjbHaMemberAction 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:
24: // Get member name from the 'member' parameter and cluster name from the 'clust' parameter
25: String name = p_Request.getParameter("member");
26: if (name == null) {
27: addGlobalError(new Exception(
28: "EjbHaMemberAction: member parameter is null."));
29: saveErrors(p_Request, m_Errors);
30: return (p_Mapping.findForward("Global Error"));
31: }
32: String cluster = p_Request.getParameter("clust");
33: if (cluster == null) {
34: addGlobalError(new Exception(
35: "EjbHaClusterAction: clust parameter is null."));
36: saveErrors(p_Request, m_Errors);
37: return (p_Mapping.findForward("Global Error"));
38: }
39: // Form used
40: EjbHaMemberForm oForm = (EjbHaMemberForm) p_Form;
41: oForm.setName(name);
42: try {
43: ObjectName on = JonasObjectName.clusterMember(name,
44: "EjbHaCluster", cluster);
45: oForm.setState(getStringAttribute(on, "State"));
46: } catch (Throwable t) {
47: addGlobalError(t);
48: saveErrors(p_Request, m_Errors);
49: return (p_Mapping.findForward("Global Error"));
50: }
51:
52: // Forward to the jsp.
53: return (p_Mapping.findForward("EjbHaMember"));
54: }
55: }
|