1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.mail; 27 28 import java.io.IOException ; 29 30 import javax.management.ObjectName ; 31 import javax.servlet.ServletException ; 32 import javax.servlet.http.HttpServletRequest ; 33 import javax.servlet.http.HttpServletResponse ; 34 35 import org.apache.struts.action.ActionForm; 36 import org.apache.struts.action.ActionForward; 37 import org.apache.struts.action.ActionMapping; 38 import org.objectweb.jonas.jmx.J2eeObjectName; 39 import org.objectweb.jonas.mail.MailServiceImpl; 40 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 41 42 46 public class EditSessionMailFactoryAction extends EditMailFactoryAction { 47 48 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 49 , HttpServletRequest p_Request, HttpServletResponse p_Response) 50 throws IOException , ServletException { 51 52 String sName = p_Request.getParameter("name"); 54 55 MailFactoryForm oForm = null; 57 if (sName != null) { 58 oForm = new MailFactoryForm(); 60 oForm.reset(p_Mapping, p_Request); 61 m_Session.setAttribute("mailFactoryForm", oForm); 62 oForm.setMailFactoryName(sName); 63 } 64 else { 65 oForm = (MailFactoryForm) m_Session.getAttribute("mailFactoryForm"); 67 } 68 69 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR 71 + "services" + WhereAreYou.NODE_SEPARATOR + "mail" + WhereAreYou.NODE_SEPARATOR 72 + "session" + WhereAreYou.NODE_SEPARATOR + oForm.getMailFactoryName(), true); 73 74 try { 76 if (sName != null) { 77 String domainName = m_WhereAreYou.getCurrentDomainName(); 78 String serverName = m_WhereAreYou.getCurrentJonasServerName(); 79 ObjectName oObjectName = J2eeObjectName.JavaMailResource(domainName 80 , oForm.getMailFactoryName(), serverName, MailServiceImpl.SESSION_PROPERTY_TYPE); 81 populate(oObjectName, oForm); 82 } 83 } 84 catch (Throwable t) { 85 addGlobalError(t); 86 saveErrors(p_Request, m_Errors); 87 return (p_Mapping.findForward("Global Error")); 88 } 89 return (p_Mapping.findForward("Session Factory")); 91 } 92 } 93 | Popular Tags |