ApplyTopAction.java

00001 
00026 package org.objectweb.jonas.webapp.jonasadmin;
00027 
00028 import java.io.IOException;
00029 
00030 import javax.servlet.ServletException;
00031 import javax.servlet.http.HttpServletRequest;
00032 import javax.servlet.http.HttpServletResponse;
00033 
00034 import org.apache.struts.action.ActionError;
00035 import org.apache.struts.action.ActionErrors;
00036 import org.apache.struts.action.ActionForm;
00037 import org.apache.struts.action.ActionForward;
00038 import org.apache.struts.action.ActionMapping;
00039 
00040 import org.objectweb.jonas.jmx.JonasManagementRepr;
00041 
00047 public class ApplyTopAction extends JonasBaseAction {
00048 
00049 // --------------------------------------------------------- Public Methods
00050 
00051     public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form, HttpServletRequest p_Request
00052         , HttpServletResponse p_Response)
00053         throws IOException, ServletException {
00054         // What locale does the user want to switch to?
00055         String sRequested = ((TopForm) p_Form).getServerSelect();
00056 
00057         // Switch to the specified locale, if it exists
00058         if (sRequested != null) {
00059             String sCurrentRMIConnectorName = null;
00060             try {
00061                 // Save current RmiConnector
00062                 sCurrentRMIConnectorName = JonasManagementRepr.getCurrentRMIConnectorName();
00063                 // Set the new RmiConnector
00064                 JonasManagementRepr.setCurrentRMIConnectorName(sRequested);
00065                 // Refresh the current servers
00066                 m_WhereAreYou.refreshServers(p_Request);
00067             }
00068             catch (Exception e) {
00069                 ActionErrors errors = new ActionErrors();
00070                 // Delete RMIconnector_ of string
00071                 String sServerName = sRequested.substring(13);
00072                 errors.add("serverSelect", new ActionError("error.server.jonas.serverName.bad"
00073                     , sServerName));
00074                 try {
00075                     // Restore current RmiConnector
00076                     JonasManagementRepr.setCurrentRMIConnectorName(sCurrentRMIConnectorName);
00077                 }
00078                 catch (Exception eBis) {
00079                     // none
00080                 }
00081                 saveErrors(p_Request, errors);
00082             }
00083         }
00084         // Forward control back to the ActionEditTop
00085         return (p_Mapping.findForward("ActionEditTop"));
00086     }
00087 }

Generated on Tue Feb 15 15:05:25 2005 for JOnAS by  doxygen 1.3.9.1