1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.resource; 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.jmx.JonasManagementRepr; 40 import org.objectweb.jonas.jmx.JonasObjectName; 41 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 42 43 46 47 public class ApplyResourceAdapterAction extends JonasBaseAction { 48 49 51 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 52 , HttpServletRequest p_Request, HttpServletResponse p_Response) 53 throws IOException , ServletException { 54 55 ResourceAdapterForm oForm = (ResourceAdapterForm) p_Form; 57 try { 58 String domainName = m_WhereAreYou.getCurrentDomainName(); 59 String serverName = m_WhereAreYou.getCurrentJonasServerName(); 60 populate(oForm); 61 } 62 catch (Throwable t) { 63 addGlobalError(t); 64 saveErrors(p_Request, m_Errors); 65 return (p_Mapping.findForward("Global Error")); 66 } 67 return new ActionForward(p_Mapping.findForward("ActionEditResourceAdapter").getPath() + "?select="+ 69 oForm.getOName()); 70 } 71 72 74 protected void populate(ResourceAdapterForm p_Form) 75 throws Exception { 76 String cf = p_Form.getConnectionFactory(); 78 ObjectName oObjectName = ObjectName.getInstance(cf); 79 setIntegerAttribute(oObjectName, "jdbcConnCheckLevel", p_Form.getJdbcConnCheckLevel()); 81 setIntegerAttribute(oObjectName, "connMaxAge", p_Form.getConnMaxAge()); 82 setIntegerAttribute(oObjectName, "maxOpentime", p_Form.getMaxOpentime()); 83 setStringAttribute(oObjectName, "jdbcTestStatement", p_Form.getJdbcTestStatement()); 84 setIntegerAttribute(oObjectName, "maxSize", p_Form.getMaxSize()); 85 setIntegerAttribute(oObjectName, "minSize", p_Form.getMinSize()); 86 setIntegerAttribute(oObjectName, "maxWaitTime", p_Form.getMaxWaitTime()); 87 setIntegerAttribute(oObjectName, "maxWaiters", p_Form.getMaxWaiters()); 88 setIntegerAttribute(oObjectName, "samplingPeriod", p_Form.getSamplingPeriod()); 89 } 90 91 } 92 | Popular Tags |