1 25 26 package org.objectweb.jonas.webapp.jonasadmin.resource; 27 28 import java.util.Properties ; 29 30 import javax.servlet.ServletException ; 31 import javax.servlet.http.HttpServletRequest ; 32 import javax.servlet.http.HttpServletResponse ; 33 34 import org.apache.struts.action.ActionForm; 35 import org.apache.struts.action.ActionForward; 36 import org.apache.struts.action.ActionMapping; 37 import org.objectweb.jonas.jmx.JonasManagementRepr; 38 import org.objectweb.jonas.jmx.JonasObjectName; 39 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 40 41 44 public class ApplyMailFactoryPropertiesAction extends EditMailFactoryPropertiesAction { 45 46 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 47 , HttpServletRequest p_Request, HttpServletResponse p_Response) 48 throws ServletException { 49 50 MailFactoryPropertiesForm oForm = (MailFactoryPropertiesForm) m_Session.getAttribute("mailFactoryPropertiesForm"); 52 String name = oForm.getMailFactoryName(); 54 String type = oForm.getType(); 55 try { 56 boolean mimePartFactory; 58 if (type.equals("javax.mail.internet.MimePartDataSource") == true) 59 mimePartFactory = true; 60 else 61 mimePartFactory = false; 62 Properties props = getPropsFromForm(oForm, mimePartFactory); 63 Boolean fromFile = new Boolean (false); 64 Object [] aoParam = { name, props, fromFile}; 65 String [] asSign_3 = { "java.lang.String", "java.util.Properties", "java.lang.Boolean" }; 66 JonasManagementRepr.invoke(JonasObjectName.mailService(), "createMailFactoryMBean", aoParam, asSign_3); 67 m_WhereAreYou.setCurrentJonasDeploymentType(WhereAreYou.DEPLOYMENT_MAIL); 69 refreshTree(p_Request); 70 } catch (Throwable t) { 71 addGlobalError(t); 72 saveErrors(p_Request, m_Errors); 73 return (p_Mapping.findForward("Global Error")); 74 } 75 m_Session.removeAttribute("mailFactoryPropertiesForm"); 77 return (p_Mapping.findForward("ActionListMailFactories")); 78 } 79 } 80 | Popular Tags |