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 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 41 42 45 46 public class EditDatasourceStatAction extends JonasBaseAction { 47 48 50 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 51 , HttpServletRequest p_Request, HttpServletResponse p_Response) 52 throws IOException , ServletException { 53 54 String sName = null; 56 57 DatasourceForm oForm = (DatasourceForm) m_Session.getAttribute("datasourceForm"); 59 60 if (oForm != null) { 61 sName = oForm.getDatasourceName(); 62 } else { 63 return (p_Mapping.findForward("Global Error")); 64 } 65 66 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR 68 + "services" + WhereAreYou.NODE_SEPARATOR + "database" + WhereAreYou.NODE_SEPARATOR 69 + sName, true); 70 71 try { 73 if (sName != null) { 74 populate(oForm, m_WhereAreYou.getCurrentDomainName(), m_WhereAreYou.getCurrentJonasServerName()); 75 } 76 } catch (Throwable t) { 77 addGlobalError(t); 78 saveErrors(p_Request, m_Errors); 79 return (p_Mapping.findForward("Global Error")); 80 } 81 return (p_Mapping.findForward("DatasourceStat")); 83 } 84 85 87 protected void populate(DatasourceForm p_Form, String domainName, String serverName) 88 throws Exception { 89 90 ObjectName oObjectName = J2eeObjectName.getJDBCDataSource(domainName, serverName, p_Form.getDatasourceName()); 92 93 p_Form.setCurrentOpened(toStringIntegerAttribute(oObjectName, "currentOpened")); 94 p_Form.setCurrentBusy(toStringIntegerAttribute(oObjectName, "currentBusy")); 95 p_Form.setBusyMaxRecent(toStringIntegerAttribute(oObjectName, "busyMax")); 96 p_Form.setBusyMinRecent(toStringIntegerAttribute(oObjectName, "busyMin")); 97 p_Form.setCurrentInTx(toStringIntegerAttribute(oObjectName, "currentInTx")); 98 p_Form.setOpenedCount(toStringIntegerAttribute(oObjectName, "openedCount")); 99 p_Form.setConnectionFailures(toStringIntegerAttribute(oObjectName, "connectionFailures")); 100 p_Form.setConnectionLeaks(toStringIntegerAttribute(oObjectName, "connectionLeaks")); 101 p_Form.setCurrentWaiters(toStringIntegerAttribute(oObjectName, "currentWaiters")); 102 p_Form.setWaitersHigh(toStringIntegerAttribute(oObjectName, "waitersHigh")); 103 p_Form.setWaitersHighRecent(toStringIntegerAttribute(oObjectName, "waitersHighRecent")); 104 p_Form.setWaiterCount(toStringIntegerAttribute(oObjectName, "waiterCount")); 105 p_Form.setWaitingTime(toStringLongAttribute(oObjectName, "waitingTime")); 106 p_Form.setWaitingHigh(toStringLongAttribute(oObjectName, "waitingHigh")); 107 p_Form.setWaitingHighRecent(toStringLongAttribute(oObjectName, "waitingHighRecent")); 108 p_Form.setServedOpen(toStringIntegerAttribute(oObjectName, "servedOpen")); 109 p_Form.setRejectedOpen(toStringIntegerAttribute(oObjectName, "rejectedOpen")); 110 p_Form.setRejectedFull(toStringIntegerAttribute(oObjectName, "rejectedFull")); 111 p_Form.setRejectedTimeout(toStringIntegerAttribute(oObjectName, "rejectedTimeout")); 112 p_Form.setRejectedOther(toStringIntegerAttribute(oObjectName, "rejectedOther")); 113 } 114 } 115 | Popular Tags |