1 25 26 package org.objectweb.jonas.webapp.jonasadmin.security; 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.JonasManagementRepr; 39 import org.objectweb.jonas.jmx.JonasObjectName; 40 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 41 42 45 46 public class ApplyMemoryRealmAction extends BaseMemoryRealmAction { 47 48 50 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 51 , HttpServletRequest p_Request, HttpServletResponse p_Response) 52 throws IOException , ServletException { 53 54 MemoryRealmForm oForm = (MemoryRealmForm) p_Form; 56 57 try { 59 if (oForm.getAction().equals("create") == true) { 61 oForm.setResource(oForm.getName()); 62 ObjectName oObjectName = JonasObjectName.securityService(); 64 String [] asParam = { 65 oForm.getName()}; 66 String [] asSignature = { 67 "java.lang.String"}; 68 JonasManagementRepr.invoke(oObjectName, "addJResourceMemory", asParam, asSignature); 69 refreshTree(); 71 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) 73 + WhereAreYou.NODE_SEPARATOR + "security" + WhereAreYou.NODE_SEPARATOR 74 + "factory.memory" + WhereAreYou.NODE_SEPARATOR + oForm.getName(), true); 75 oForm.setAction("apply"); 77 } 78 if (oForm.isSave()) { 80 ObjectName onRealm = JonasObjectName.securityMemoryFactory(oForm.getResource()); 81 JonasManagementRepr.invoke(onRealm, "saveConfig", null, null); 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("Memory Realm")); 91 } 92 93 95 } 96 | Popular Tags |