00001
00026 package org.objectweb.jonas.webapp.jonasadmin.service.jtm;
00027
00028 import java.io.IOException;
00029
00030 import javax.management.ObjectName;
00031 import javax.servlet.ServletException;
00032 import javax.servlet.http.HttpServletRequest;
00033 import javax.servlet.http.HttpServletResponse;
00034
00035 import org.apache.struts.action.ActionForm;
00036 import org.apache.struts.action.ActionForward;
00037 import org.apache.struts.action.ActionMapping;
00038 import org.objectweb.jonas.jmx.J2eeObjectName;
00039 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
00040 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
00041 import org.objectweb.jonas.webapp.jonasadmin.catalina.ConnectorForm;
00042
00047 public class EditJtmServiceAction extends JonasBaseAction {
00048
00059 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm
00060 , HttpServletRequest pRequest, HttpServletResponse pResponse)
00061 throws IOException, ServletException {
00062
00063
00064 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR
00065 + "services" + WhereAreYou.NODE_SEPARATOR + "transaction", true);
00066
00067
00068 JtmServiceForm oForm = new JtmServiceForm();
00069 m_Session.setAttribute("jtmServiceForm", oForm);
00070 try {
00071
00072 String currentDomainName = m_WhereAreYou.getCurrentDomainName();
00073 String currentJonasServerName = m_WhereAreYou.getCurrentJonasServerName();
00074 String jtaResourceName = "JTAResource";
00075 ObjectName jtaResourceObjectName = J2eeObjectName.JTAResource(currentDomainName, currentJonasServerName, jtaResourceName);
00076
00077 String location;
00078 boolean collocated = getBooleanAttribute(jtaResourceObjectName, "localJtm");
00079 if (collocated) {
00080
00081 location = m_Resources.getMessage("tab.jtm.collocated");
00082 oForm.setJtmLocation(location);
00083 } else {
00084
00085 location = m_Resources.getMessage("tab.jtm.distant");
00086 oForm.setJtmLocation(location);
00087 }
00088
00089 String host = getStringAttribute(jtaResourceObjectName, "hostName");
00090 oForm.setJtmHost(host);
00091
00092 int port = getIntegerAttribute(jtaResourceObjectName, "portNumber");
00093 String portValue = null;
00094 if (port == 0) {
00095
00096 portValue = m_Resources.getMessage("tab.jtm.undefined");
00097 oForm.setJtmPort(portValue);
00098 } else {
00099 oForm.setJtmPort(Integer.toString(port));
00100 }
00101
00102 int timeOut = getIntegerAttribute(jtaResourceObjectName, "timeOut");
00103 oForm.setTimeOutText(String.valueOf(timeOut));
00104 } catch (Throwable t) {
00105 addGlobalError(t);
00106 saveErrors(pRequest, m_Errors);
00107 return (pMapping.findForward("Global Error"));
00108 }
00109
00110
00111 return (pMapping.findForward("Jtm Service"));
00112 }
00113
00114 }