1 26 27 package org.objectweb.jonas.webapp.jonasadmin.security; 28 29 import java.io.IOException ; 30 31 import javax.management.ObjectName ; 32 import javax.servlet.ServletException ; 33 import javax.servlet.http.HttpServletRequest ; 34 import javax.servlet.http.HttpServletResponse ; 35 36 import org.apache.struts.action.ActionForm; 37 import org.apache.struts.action.ActionForward; 38 import org.apache.struts.action.ActionMapping; 39 import org.objectweb.jonas.jmx.JonasManagementRepr; 40 import org.objectweb.jonas.jmx.JonasObjectName; 41 42 45 46 public class ApplyRoleMemoryRealmAction extends BaseMemoryRealmAction { 47 48 50 52 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 53 , HttpServletRequest p_Request, HttpServletResponse p_Response) 54 throws IOException , ServletException { 55 56 MemoryRealmForm oRealmForm = getForm(p_Mapping, p_Request); 58 59 RoleMemoryRealmForm oForm = (RoleMemoryRealmForm) p_Form; 61 62 try { 64 ObjectName onRole = null; 65 if (oForm.getAction().equals("create") == true) { 67 ObjectName onRealm = JonasObjectName.securityMemoryFactory(oRealmForm.getResource()); 68 String [] asParam = { 69 oForm.getRole()}; 70 String [] asSignature = { 71 "java.lang.String", }; 72 JonasManagementRepr.invoke(onRealm, "addRole", asParam, asSignature); 73 onRole = JonasObjectName.role(oRealmForm.getResource(), oForm.getRole()); 75 } 76 else { 77 onRole = JonasObjectName.role(oRealmForm.getResource(), oForm.getRole()); 79 } 80 setStringAttribute(onRole, "Description", oForm.getDescription()); 82 } 83 catch (Throwable t) { 84 addGlobalError(t); 85 saveErrors(p_Request, m_Errors); 86 return (p_Mapping.findForward("Global Error")); 87 } 88 return (p_Mapping.findForward("ActionEditMemoryRealmRoles")); 90 } 91 92 94 } 95 | Popular Tags |