1 25 26 package org.objectweb.jonas.webapp.jonasadmin.jonasserver; 27 28 import java.io.IOException ; 29 30 import javax.management.MalformedObjectNameException ; 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.ActionMessage; 37 import org.apache.struts.action.ActionMessages; 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.JonasManagementRepr; 42 import org.objectweb.jonas.jmx.JonasObjectName; 43 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 44 47 48 public class EditJvmAction extends JonasBaseAction { 49 50 52 64 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 65 , HttpServletRequest pRequest, HttpServletResponse pResponse) 66 throws IOException , ServletException { 67 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER), true); 69 70 ActionMessages oErrors = new ActionMessages(); 71 72 ObjectName on_server = m_WhereAreYou.getCurrentJonasServer(); 74 ObjectName oObjectName = null; 76 String [] jvms = (String []) JonasManagementRepr.getAttribute(on_server, "javaVMs"); 78 try { 79 if (jvms.length > 0) { 80 oObjectName = new ObjectName (jvms[0]); 81 } else { 82 oErrors.add("JVMs", new ActionMessage("error.server.jonas.jvms")); 83 saveErrors(pRequest, oErrors); 84 return (pMapping.findForward("Global Error")); 85 } 86 } catch (MalformedObjectNameException e) { 87 addGlobalError(e); 88 saveErrors(pRequest, m_Errors); 89 return (pMapping.findForward("Global Error")); 90 } 91 92 JvmForm oForm = (JvmForm) pForm; 94 try { 95 oForm.setJavaVendor(getStringAttribute(oObjectName, "javaVendor")); 97 oForm.setJavaVersion(getStringAttribute(oObjectName, "javaVersion")); 98 oForm.setNode(getStringAttribute(oObjectName, "node")); 99 if (JonasManagementRepr.isRegistered(JonasObjectName.webContainerService())) { 100 oForm.setPresentServletContainer(true); 101 } else { 102 oForm.setPresentServletContainer(false); 103 } 104 } catch (Throwable t) { 105 addGlobalError(t); 106 saveErrors(pRequest, m_Errors); 107 return (pMapping.findForward("Global Error")); 108 } 109 110 return (pMapping.findForward("Jvm")); 112 } 113 114 } 115 | Popular Tags |