1 25 26 package org.objectweb.jonas.webapp.jonasadmin.mbean; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Collections ; 31 import java.util.Iterator ; 32 33 import javax.management.ObjectName ; 34 import javax.servlet.ServletException ; 35 import javax.servlet.http.HttpServletRequest ; 36 import javax.servlet.http.HttpServletResponse ; 37 38 import org.apache.struts.action.ActionForm; 39 import org.apache.struts.action.ActionForward; 40 import org.apache.struts.action.ActionMapping; 41 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx; 42 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 43 import org.objectweb.jonas.webapp.jonasadmin.common.BeanComparator; 44 45 50 51 public final class ListMBeansAction extends JonasBaseAction { 52 53 55 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 56 , HttpServletRequest p_Request, HttpServletResponse p_Response) 57 throws IOException , ServletException { 58 59 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER), true); 61 62 try { 63 MbeanItem oItem; 64 ArrayList list = new ArrayList (); 65 Iterator it = JonasAdminJmx.getListMbean(null).iterator(); 66 while (it.hasNext()) { 67 oItem = MbeanItem.build((ObjectName ) it.next()); 68 list.add(oItem); 69 } 70 Collections.sort(list, new BeanComparator(new String [] { 71 "domain", "textFamily", "objectName"})); 72 p_Request.setAttribute("MBeans", list); 73 } catch (Throwable t) { 74 addGlobalError(t); 75 saveErrors(p_Request, m_Errors); 76 return (p_Mapping.findForward("Global Error")); 77 } 78 return p_Mapping.findForward("List MBeans"); 80 } 81 82 } 83 | Popular Tags |