00001
00026 package org.objectweb.jonas.webapp.jonasadmin.service.db;
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
00045 public class ApplyDatasourceStatAction extends JonasBaseAction {
00046
00047
00048
00049 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form
00050 , HttpServletRequest p_Request, HttpServletResponse p_Response)
00051 throws IOException, ServletException {
00052
00053
00054 DatasourceForm oForm = (DatasourceForm) p_Form;
00055 try {
00056 String domainName = m_WhereAreYou.getCurrentDomainName();
00057 String serverName = m_WhereAreYou.getCurrentJonasServerName();
00058 populate(oForm, domainName, serverName);
00059 } catch (Throwable t) {
00060 addGlobalError(t);
00061 saveErrors(p_Request, m_Errors);
00062 return (p_Mapping.findForward("Global Error"));
00063 }
00064
00065 return new ActionForward(p_Mapping.findForward("ActionEditDatasourceStat").getPath() + "?name="
00066 + oForm.getDatasourceName());
00067 }
00068
00069
00070
00071 protected void populate(DatasourceForm p_Form, String domainName, String serverName)
00072 throws Exception {
00073
00074 ObjectName oObjectName = J2eeObjectName.getJDBCDataSource(domainName, serverName, p_Form.getDatasourceName());
00075
00076 p_Form.setCurrentOpened(toStringIntegerAttribute(oObjectName, "currentOpened"));
00077 p_Form.setCurrentBusy(toStringIntegerAttribute(oObjectName, "currentBusy"));
00078 p_Form.setCurrentInTx(toStringIntegerAttribute(oObjectName, "currentInTx"));
00079 p_Form.setOpenedCount(toStringIntegerAttribute(oObjectName, "openedCount"));
00080 p_Form.setConnectionFailures(toStringIntegerAttribute(oObjectName, "connectionFailures"));
00081 p_Form.setConnectionLeaks(toStringIntegerAttribute(oObjectName, "connectionLeaks"));
00082 p_Form.setCurrentWaiters(toStringIntegerAttribute(oObjectName, "currentWaiters"));
00083 p_Form.setWaitersHigh(toStringIntegerAttribute(oObjectName, "waitersHigh"));
00084 p_Form.setWaitersHighRecent(toStringIntegerAttribute(oObjectName, "waitersHighRecent"));
00085 p_Form.setWaiterCount(toStringIntegerAttribute(oObjectName, "waiterCount"));
00086 p_Form.setWaitingTime(toStringLongAttribute(oObjectName, "waitingTime"));
00087 p_Form.setWaitingHigh(toStringLongAttribute(oObjectName, "waitingHigh"));
00088 p_Form.setWaitingHighRecent(toStringLongAttribute(oObjectName, "waitingHighRecent"));
00089 p_Form.setServedOpen(toStringIntegerAttribute(oObjectName, "servedOpen"));
00090 p_Form.setRejectedOpen(toStringIntegerAttribute(oObjectName, "rejectedOpen"));
00091 p_Form.setRejectedFull(toStringIntegerAttribute(oObjectName, "rejectedFull"));
00092 p_Form.setRejectedTimeout(toStringIntegerAttribute(oObjectName, "rejectedTimeout"));
00093 p_Form.setRejectedOther(toStringIntegerAttribute(oObjectName, "rejectedOther"));
00094 }
00095
00096 }