1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.db; 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 41 44 45 public class ApplyDatasourceStatAction extends JonasBaseAction { 46 47 49 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 50 , HttpServletRequest p_Request, HttpServletResponse p_Response) 51 throws IOException , ServletException { 52 53 DatasourceForm oForm = (DatasourceForm) p_Form; 55 try { 56 String domainName = m_WhereAreYou.getCurrentDomainName(); 57 String serverName = m_WhereAreYou.getCurrentJonasServerName(); 58 populate(oForm, domainName, serverName); 59 } catch (Throwable t) { 60 addGlobalError(t); 61 saveErrors(p_Request, m_Errors); 62 return (p_Mapping.findForward("Global Error")); 63 } 64 return new ActionForward(p_Mapping.findForward("ActionEditDatasourceStat").getPath() + "?name=" 66 + oForm.getDatasourceName()); 67 } 68 69 71 protected void populate(DatasourceForm p_Form, String domainName, String serverName) 72 throws Exception { 73 ObjectName oObjectName = J2eeObjectName.getJDBCDataSource(domainName, serverName, p_Form.getDatasourceName()); 75 p_Form.setCurrentOpened(toStringIntegerAttribute(oObjectName, "currentOpened")); 77 p_Form.setCurrentBusy(toStringIntegerAttribute(oObjectName, "currentBusy")); 78 p_Form.setCurrentInTx(toStringIntegerAttribute(oObjectName, "currentInTx")); 79 p_Form.setOpenedCount(toStringIntegerAttribute(oObjectName, "openedCount")); 80 p_Form.setConnectionFailures(toStringIntegerAttribute(oObjectName, "connectionFailures")); 81 p_Form.setConnectionLeaks(toStringIntegerAttribute(oObjectName, "connectionLeaks")); 82 p_Form.setCurrentWaiters(toStringIntegerAttribute(oObjectName, "currentWaiters")); 83 p_Form.setWaitersHigh(toStringIntegerAttribute(oObjectName, "waitersHigh")); 84 p_Form.setWaitersHighRecent(toStringIntegerAttribute(oObjectName, "waitersHighRecent")); 85 p_Form.setWaiterCount(toStringIntegerAttribute(oObjectName, "waiterCount")); 86 p_Form.setWaitingTime(toStringLongAttribute(oObjectName, "waitingTime")); 87 p_Form.setWaitingHigh(toStringLongAttribute(oObjectName, "waitingHigh")); 88 p_Form.setWaitingHighRecent(toStringLongAttribute(oObjectName, "waitingHighRecent")); 89 p_Form.setServedOpen(toStringIntegerAttribute(oObjectName, "servedOpen")); 90 p_Form.setRejectedOpen(toStringIntegerAttribute(oObjectName, "rejectedOpen")); 91 p_Form.setRejectedFull(toStringIntegerAttribute(oObjectName, "rejectedFull")); 92 p_Form.setRejectedTimeout(toStringIntegerAttribute(oObjectName, "rejectedTimeout")); 93 p_Form.setRejectedOther(toStringIntegerAttribute(oObjectName, "rejectedOther")); 94 } 95 96 } 97 | Popular Tags |