1 25 26 package org.objectweb.jonas.webapp.jonasadmin.security; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Collections ; 31 import java.util.Iterator ; 32 33 import javax.management.ObjectName ; 34 import javax.servlet.ServletException ; 35 import javax.servlet.http.HttpServletRequest ; 36 import javax.servlet.http.HttpServletResponse ; 37 38 import org.apache.struts.action.ActionForm; 39 import org.apache.struts.action.ActionForward; 40 import org.apache.struts.action.ActionMapping; 41 import org.objectweb.jonas.jmx.CatalinaObjectName; 42 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx; 43 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 44 45 48 49 public class EditSecurityCatalinaRealmAction extends JonasBaseAction { 50 51 53 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 54 , HttpServletRequest p_Request, HttpServletResponse p_Response) 55 throws IOException , ServletException { 56 57 try { 58 ArrayList al = new ArrayList (); 59 if (m_WhereAreYou.isCatalinaServer() == true) { 61 try { 62 ObjectName on; 63 on = CatalinaObjectName.catalinaRealm(m_WhereAreYou.getCurrentCatalinaServiceName()); 65 String sUsedRealmName = getStringAttribute(on, "resourceName"); 66 String sRealmName; 68 String sRealmType; 69 Iterator it = JonasAdminJmx.getListMbean(CatalinaObjectName.catalinaRealms()). 70 iterator(); 71 while (it.hasNext() == true) { 72 on = (ObjectName ) it.next(); 73 sRealmName = getStringAttribute(on, "resourceName"); 74 al.add(new RealmItem(sRealmName, null, sRealmName.equals(sUsedRealmName))); 75 } 76 Collections.sort(al, new RealmItemByNameComparator()); 78 } 79 catch (Exception e) { 80 } 83 } 84 p_Request.setAttribute("listSecurityRealms", al); 86 } 87 catch (Throwable t) { 88 addGlobalError(t); 89 saveErrors(p_Request, m_Errors); 90 return (p_Mapping.findForward("Global Error")); 91 } 92 return (p_Mapping.findForward("Security Catalina Realm")); 94 } 95 } 96 | Popular Tags |