1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.jtm; 27 28 import java.io.IOException ; 29 30 import javax.management.ObjectName ; 31 import javax.servlet.ServletException ; 32 import javax.servlet.http.HttpServletRequest ; 33 import javax.servlet.http.HttpServletResponse ; 34 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.jmx.J2eeObjectName; 39 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 40 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 41 import org.objectweb.jonas.webapp.jonasadmin.catalina.ConnectorForm; 42 43 47 public class EditJtmServiceAction extends JonasBaseAction { 48 49 59 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 60 , HttpServletRequest pRequest, HttpServletResponse pResponse) 61 throws IOException , ServletException { 62 63 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR 65 + "services" + WhereAreYou.NODE_SEPARATOR + "transaction", true); 66 67 JtmServiceForm oForm = new JtmServiceForm(); 69 m_Session.setAttribute("jtmServiceForm", oForm); 70 try { 71 String currentDomainName = m_WhereAreYou.getCurrentDomainName(); 73 String currentJonasServerName = m_WhereAreYou.getCurrentJonasServerName(); 74 String jtaResourceName = "JTAResource"; 75 ObjectName jtaResourceObjectName = J2eeObjectName.JTAResource(currentDomainName, currentJonasServerName, jtaResourceName); 76 77 String location; 78 boolean collocated = getBooleanAttribute(jtaResourceObjectName, "localJtm"); 79 if (collocated) { 80 location = m_Resources.getMessage("tab.jtm.collocated"); 82 oForm.setJtmLocation(location); 83 } else { 84 location = m_Resources.getMessage("tab.jtm.distant"); 86 oForm.setJtmLocation(location); 87 } 88 89 String host = getStringAttribute(jtaResourceObjectName, "hostName"); 90 oForm.setJtmHost(host); 91 92 int port = getIntegerAttribute(jtaResourceObjectName, "portNumber"); 93 String portValue = null; 94 if (port == 0) { 95 portValue = m_Resources.getMessage("tab.jtm.undefined"); 97 oForm.setJtmPort(portValue); 98 } else { 99 oForm.setJtmPort(Integer.toString(port)); 100 } 101 102 int timeOut = getIntegerAttribute(jtaResourceObjectName, "timeOut"); 103 oForm.setTimeOutText(String.valueOf(timeOut)); 104 } catch (Throwable t) { 105 addGlobalError(t); 106 saveErrors(pRequest, m_Errors); 107 return (pMapping.findForward("Global Error")); 108 } 109 110 return (pMapping.findForward("Jtm Service")); 112 } 113 114 } 115 | Popular Tags |