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: EditResourceAdapterCFStatAction.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:
039: /**
040: * @author Eric Hardesty
041: */
042:
043: public class EditResourceAdapterCFStatAction extends JonasBaseAction {
044:
045: // --------------------------------------------------------- Public Methods
046:
047: public ActionForward executeAction(ActionMapping p_Mapping,
048: ActionForm p_Form, HttpServletRequest p_Request,
049: HttpServletResponse p_Response) throws IOException,
050: ServletException {
051:
052: // Form used is already in session as we already executed one EditResourceAdapter action
053: ResourceAdapterCFForm oForm = (ResourceAdapterCFForm) m_Session
054: .getAttribute("resourceAdapterCFForm");
055:
056: ResourceAdapterForm raForm = (ResourceAdapterForm) m_Session
057: .getAttribute("resourceAdapterForm");
058:
059: // Force the node selected in tree
060: m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER)
061: + WhereAreYou.NODE_SEPARATOR + "services"
062: + WhereAreYou.NODE_SEPARATOR + "resourceAdapter"
063: + WhereAreYou.NODE_SEPARATOR + raForm.getFile(), true);
064:
065: // Populate
066: try {
067: populate(oForm);
068: } catch (Throwable t) {
069: addGlobalError(t);
070: saveErrors(p_Request, m_Errors);
071: return (p_Mapping.findForward("Global Error"));
072: }
073: m_Session.setAttribute("resourceAdapterCFForm", oForm);
074:
075: // Forward to the jsp.
076: return (p_Mapping.findForward("RAR1.5 CF Stat"));
077: }
078:
079: // --------------------------------------------------------- Protected Methods
080:
081: protected void populate(ResourceAdapterCFForm p_Form)
082: throws Exception {
083:
084: // ObjectName used for JCAConnectionFactory
085:
086: ObjectName oObjectName = p_Form.getOName();
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: }
|