001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: EditResourceAdapterStatAction.java 6947 2005-06-15 08:51:26Z kemlerp $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.service.resource;
025:
026: import java.io.IOException;
027:
028: import javax.management.ObjectName;
029: import javax.servlet.ServletException;
030: import javax.servlet.http.HttpServletRequest;
031: import javax.servlet.http.HttpServletResponse;
032:
033: import org.apache.struts.action.ActionForm;
034: import org.apache.struts.action.ActionForward;
035: import org.apache.struts.action.ActionMapping;
036: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
037: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
038: import org.objectweb.jonas.webapp.jonasadmin.common.ObjectNameItem;
039:
040: /**
041: * @author Eric Hardesty
042: */
043:
044: public class EditResourceAdapterStatAction extends JonasBaseAction {
045:
046: // --------------------------------------------------------- Public Methods
047:
048: public ActionForward executeAction(ActionMapping p_Mapping,
049: ActionForm p_Form, HttpServletRequest p_Request,
050: HttpServletResponse p_Response) throws IOException,
051: ServletException {
052:
053: // Form used is already in session as we already executed one EditResourceAdapter action
054: ResourceAdapterForm oForm = (ResourceAdapterForm) m_Session
055: .getAttribute("resourceAdapterForm");
056:
057: // Populate
058: try {
059: populate(oForm);
060: } catch (Throwable t) {
061: addGlobalError(t);
062: saveErrors(p_Request, m_Errors);
063: return (p_Mapping.findForward("Global Error"));
064: }
065: m_Session.setAttribute("resourceAdapterForm", oForm);
066:
067: // Force the node selected in tree
068: m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER)
069: + WhereAreYou.NODE_SEPARATOR + "services"
070: + WhereAreYou.NODE_SEPARATOR + "resourceAdapter"
071: + WhereAreYou.NODE_SEPARATOR + oForm.getFile(), true);
072:
073: // Forward to the jsp.
074: return (p_Mapping.findForward("RAR1.0 Stat"));
075: }
076:
077: // --------------------------------------------------------- Protected Methods
078:
079: protected void populate(ResourceAdapterForm p_Form)
080: throws Exception {
081:
082: // ObjectName used for JCAConnectionFactory
083:
084: ObjectNameItem oni = (ObjectNameItem) p_Form.getCF().get(0);
085: String sObjectName = oni.getObjectName();
086: ObjectName oObjectName = ObjectName.getInstance(sObjectName);
087:
088: p_Form.setCurrentOpened(toStringIntegerAttribute(oObjectName,
089: "currentOpened"));
090: p_Form.setCurrentBusy(toStringIntegerAttribute(oObjectName,
091: "currentBusy"));
092: p_Form.setBusyMaxRecent(toStringIntegerAttribute(oObjectName,
093: "busyMax"));
094: p_Form.setBusyMinRecent(toStringIntegerAttribute(oObjectName,
095: "busyMin"));
096: p_Form.setCurrentInTx(toStringIntegerAttribute(oObjectName,
097: "currentInTx"));
098: p_Form.setOpenedCount(toStringIntegerAttribute(oObjectName,
099: "openedCount"));
100: p_Form.setConnectionFailures(toStringIntegerAttribute(
101: oObjectName, "connectionFailures"));
102: p_Form.setConnectionLeaks(toStringIntegerAttribute(oObjectName,
103: "connectionLeaks"));
104: p_Form.setCurrentWaiters(toStringIntegerAttribute(oObjectName,
105: "currentWaiters"));
106: p_Form.setWaitersHigh(toStringIntegerAttribute(oObjectName,
107: "waitersHigh"));
108: p_Form.setWaitersHighRecent(toStringIntegerAttribute(
109: oObjectName, "waitersHighRecent"));
110: p_Form.setWaiterCount(toStringIntegerAttribute(oObjectName,
111: "waiterCount"));
112: p_Form.setWaitingTime(toStringLongAttribute(oObjectName,
113: "waitingTime"));
114: p_Form.setWaitingHigh(toStringLongAttribute(oObjectName,
115: "waitingHigh"));
116: p_Form.setWaitingHighRecent(toStringLongAttribute(oObjectName,
117: "waitingHighRecent"));
118: p_Form.setServedOpen(toStringIntegerAttribute(oObjectName,
119: "servedOpen"));
120: p_Form.setRejectedOpen(toStringIntegerAttribute(oObjectName,
121: "rejectedOpen"));
122: p_Form.setRejectedFull(toStringIntegerAttribute(oObjectName,
123: "rejectedFull"));
124: p_Form.setRejectedTimeout(toStringIntegerAttribute(oObjectName,
125: "rejectedTimeout"));
126: p_Form.setRejectedOther(toStringIntegerAttribute(oObjectName,
127: "rejectedOther"));
128:
129: }
130:
131: }
|