1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.container; 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.jmx.J2eeObjectName; 42 import org.objectweb.jonas.jmx.JonasManagementRepr; 43 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx; 44 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 45 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 46 47 50 51 public class ListContainersAction 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) + WhereAreYou.NODE_SEPARATOR 61 + "services" + WhereAreYou.NODE_SEPARATOR + "ejbContainers", true); 62 63 try { 65 String sFile; 67 String sPath; 68 String sName; 69 ArrayList al = new ArrayList (); 70 String p_DomainName = m_WhereAreYou.getCurrentDomainName(); 71 String p_ServerName = m_WhereAreYou.getCurrentJonasServerName(); 72 ObjectName onContainers = J2eeObjectName.getEJBModules(p_DomainName, p_ServerName); 73 Iterator itNames = JonasManagementRepr.queryNames(onContainers).iterator(); 74 while (itNames.hasNext()) { 75 ObjectName it_on = (ObjectName ) itNames.next(); 76 sPath = getStringAttribute(it_on, "fileName"); 77 sFile = JonasAdminJmx.extractFilename(sPath); 78 sName = it_on.getKeyProperty("name"); 79 al.add(new ContainerItem(sFile, sPath, it_on.toString(), sName)); 80 } 81 82 Collections.sort(al, new ContainerItemByFile()); 83 p_Request.setAttribute("listContainers", al); 85 } 86 catch (Throwable t) { 87 addGlobalError(t); 88 saveErrors(p_Request, m_Errors); 89 return (p_Mapping.findForward("Global Error")); 90 } 91 return (p_Mapping.findForward("Containers")); 93 } 94 } 95 | Popular Tags |