1 25 26 package org.objectweb.jonas.webapp.jonasadmin; 27 28 import java.io.IOException ; 29 30 import javax.servlet.ServletException ; 31 import javax.servlet.http.HttpServletRequest ; 32 import javax.servlet.http.HttpServletResponse ; 33 34 import org.apache.struts.action.ActionMessage; 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.common.JProp; 39 import org.objectweb.jonas.common.Log; 40 import org.objectweb.jonas.jmx.JonasManagementRepr; 41 import org.objectweb.jonas.jmx.ManagementReprLoader; 42 import org.objectweb.util.monolog.api.BasicLevel; 43 import org.objectweb.util.monolog.api.Logger; 44 45 49 public class SetupWhereAreYouAction 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 return null; 58 } 59 60 public ActionForward execute(ActionMapping p_Mapping, ActionForm p_Form 61 , HttpServletRequest p_Request, HttpServletResponse p_Response) 62 throws IOException , ServletException { 63 64 initialize(p_Request); 66 67 try { 68 if (JonasManagementRepr.reprNull()) { 69 String serverName = null; 71 try { 72 JProp oJProp = JProp.getInstance(); 74 serverName = oJProp.getValue(JProp.JONAS_NAME); 75 } catch (Exception e) { 76 throw new JonasAdminException(WhereAreYou.EXCEPTION_JONASSERVER_NOTFOUND, e.getMessage(), e); 78 } 79 ManagementReprLoader.loadServerRepr(serverName); 80 } 81 if (m_WhereAreYou == null) { 82 m_WhereAreYou = new WhereAreYou(); 83 m_WhereAreYou.initialize(getServlet(), p_Request); 84 m_Session.setAttribute(WhereAreYou.SESSION_NAME, m_WhereAreYou); 85 } else { 86 m_WhereAreYou.refreshServers(p_Request); 87 } 88 } catch (JonasAdminException e) { 89 90 String message = m_Resources.getMessage(e.getId()); 91 Logger logger = Log.getLogger(Log.JONAS_ADMIN_PREFIX); 93 if (logger.isLoggable(BasicLevel.DEBUG)) { 94 logger.log(BasicLevel.DEBUG, message); 95 } 96 m_Errors.add(e.getId(), new ActionMessage(e.getId())); 97 saveErrors(p_Request, m_Errors); 98 return (p_Mapping.findForward("Global Error")); 99 } 100 return (p_Mapping.findForward("Frame Main")); 101 } 102 103 } 104 | Popular Tags |