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 EditMemoryRealmAction 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 = getForm(p_Mapping, p_Request); 56 String sAction = p_Request.getParameter("action"); 57 if ((sAction != null) && (sAction.equals("create") == true)) { 59 oForm = new MemoryRealmForm(); 60 oForm.reset(p_Mapping, p_Request); 61 m_Session.setAttribute("memoryRealmForm", oForm); 62 oForm.setAction("create"); 63 } 64 65 try { 67 if (oForm.getAction().equals("apply") == true) { 69 ObjectName oObjectName = JonasObjectName.securityMemoryFactory(oForm.getResource()); 70 oForm.setName(getStringAttribute(oObjectName, "Name")); 71 oForm.setGroups((String []) JonasManagementRepr.invoke(oObjectName, "listGroups", null, null)); 72 oForm.setRoles((String []) JonasManagementRepr.invoke(oObjectName, "listRoles", null, null)); 73 74 oForm.setResource(oForm.getName()); 75 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) 77 + WhereAreYou.NODE_SEPARATOR + "security" + WhereAreYou.NODE_SEPARATOR 78 + "factory.memory" + WhereAreYou.NODE_SEPARATOR + oForm.getName(), true); 79 } 80 } 81 catch (Throwable t) { 82 addGlobalError(t); 83 saveErrors(p_Request, m_Errors); 84 return (p_Mapping.findForward("Global Error")); 85 } 86 return (p_Mapping.findForward("Memory Realm")); 88 } 89 90 92 } 93 | Popular Tags |