1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.mail; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Iterator ; 31 32 import javax.management.ObjectName ; 33 import javax.servlet.ServletException ; 34 import javax.servlet.http.HttpServletRequest ; 35 import javax.servlet.http.HttpServletResponse ; 36 37 import org.apache.struts.action.ActionForm; 38 import org.apache.struts.action.ActionForward; 39 import org.apache.struts.action.ActionMapping; 40 import org.objectweb.jonas.jmx.J2eeObjectName; 41 import org.objectweb.jonas.mail.MailServiceImpl; 42 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx; 43 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 44 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 45 46 50 public class ListSessionMailFactoriesAction extends JonasBaseAction { 51 52 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 53 , HttpServletRequest p_Request, HttpServletResponse p_Response) 54 throws IOException , ServletException { 55 56 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR 58 + "services" + WhereAreYou.NODE_SEPARATOR + "mail" + WhereAreYou.NODE_SEPARATOR 59 + "session", true); 60 61 try { 63 String sName; 64 String sJndiName; 65 ObjectName oObjectName; 66 ArrayList al = new ArrayList (); 68 ArrayList alDeployed = JonasAdminJmx.getSessionMailFactoriesDeployed(m_WhereAreYou); 69 Iterator it = alDeployed.iterator(); 70 String domainName = m_WhereAreYou.getCurrentDomainName(); 71 String serverName = m_WhereAreYou.getCurrentJonasServerName(); 72 while (it.hasNext()) { 73 sName = it.next().toString(); 74 oObjectName = J2eeObjectName.JavaMailResource(domainName, sName, serverName 76 , MailServiceImpl.SESSION_PROPERTY_TYPE); 77 sJndiName = getStringAttribute(oObjectName, "Name"); 78 al.add(new MailFactoryItem(sName, sJndiName)); 79 } 80 81 p_Request.setAttribute("listMailFactories", al); 83 } 84 catch (Throwable t) { 85 addGlobalError(t); 86 saveErrors(p_Request, m_Errors); 87 return (p_Mapping.findForward("Global Error")); 88 } 89 90 return (p_Mapping.findForward("Session Factories")); 92 } 93 } 94 | Popular Tags |