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 CmiMemberAction 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:
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: "CmiMemberAction: 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: "CmiClusterAction: clust parameter is null."));
35: saveErrors(p_Request, m_Errors);
36: return (p_Mapping.findForward("Global Error"));
37: }
38: // Form used
39: CmiMemberForm oForm = (CmiMemberForm) p_Form;
40: oForm.setName(name);
41: try {
42: ObjectName on = JonasObjectName.clusterMember(name,
43: "CmiCluster", cluster);
44: oForm.setState(getStringAttribute(on, "State"));
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("CmiMember"));
53: }
54: }
|