1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.resource; 27 28 import java.io.IOException ; 29 import java.util.Iterator ; 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.JonasObjectName; 40 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminException; 41 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx; 42 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 43 44 47 48 public class EditRarAction extends JonasBaseAction { 49 50 52 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 53 , HttpServletRequest p_Request, HttpServletResponse p_Response) 54 throws IOException , ServletException { 55 56 String sSelectedPath = p_Request.getParameter("path"); 58 59 try { 61 if (sSelectedPath != null) { 62 ObjectName on; 63 String sPath; 64 String sName = null; 65 boolean bFound = false; 66 Iterator it = JonasAdminJmx.getListMbean(JonasObjectName.resourceAdapters()). 67 iterator(); 68 while ((it.hasNext() == true) && (bFound == false)) { 69 on = (ObjectName ) it.next(); 70 sPath = getStringAttribute(on, "Filename"); 71 sName = getStringAttribute(on, "JndiName"); 72 if (sSelectedPath.equals(sPath) == true) { 73 bFound = true; 74 } 75 } 76 if (bFound == true) { 77 p_Request.setAttribute("name", sName); 78 } 79 else { 80 throw new JonasAdminException("error.resourceadapter.notfound" 81 , m_Resources.getMessage("error.resourceadapter.notfound", sSelectedPath)); 82 } 83 } 84 } 85 catch (Throwable t) { 86 addGlobalError(t); 87 saveErrors(p_Request, m_Errors); 88 return (p_Mapping.findForward("Global Error")); 89 } 90 return (p_Mapping.findForward("ActionEditResourceAdapter")); 92 } 93 } 94 | Popular Tags |