001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 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: EditTransactionStatisticAction.java 4647 2004-04-26 08:03:01Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.service.jtm;
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.jmx.J2eeObjectName;
037: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
038: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
039:
040: /**
041: *
042: * @author Adriana Danes
043: */
044: public class EditTransactionStatisticAction extends JonasBaseAction {
045: /**
046: * Principal method
047: * @param pMapping action mapping
048: * @param pForm used form
049: * @param pRequest request parameters
050: * @param pResponse response parameters
051: * @return action forward
052: * @throws IOException action failed because a IOException
053: * @throws ServletException a ServletException occured
054: */
055: public ActionForward executeAction(ActionMapping pMapping,
056: ActionForm pForm, HttpServletRequest pRequest,
057: HttpServletResponse pResponse) throws IOException,
058: ServletException {
059:
060: // Force the node selected in tree
061: m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER)
062: + WhereAreYou.NODE_SEPARATOR + "services"
063: + WhereAreYou.NODE_SEPARATOR + "transaction", true);
064:
065: // Form used
066: JtmServiceStatisticForm oForm = (JtmServiceStatisticForm) pForm;
067: try {
068: // Object name used
069: String currentDomainName = m_WhereAreYou
070: .getCurrentDomainName();
071: String currentJonasServerName = m_WhereAreYou
072: .getCurrentJonasServerName();
073: String jtaResourceName = "JTAResource";
074: ObjectName jtaResourceObjectName = J2eeObjectName
075: .JTAResource(currentDomainName,
076: currentJonasServerName, jtaResourceName);
077: oForm.setCurrentTransactions(getIntegerAttribute(
078: jtaResourceObjectName, "totalCurrentTransactions"));
079: oForm.setBegunTransactions(getIntegerAttribute(
080: jtaResourceObjectName, "totalBegunTransactions"));
081: oForm
082: .setCommitedTransactions(getIntegerAttribute(
083: jtaResourceObjectName,
084: "totalCommittedTransactions"));
085: oForm.setRollBackedTransactions(getIntegerAttribute(
086: jtaResourceObjectName,
087: "totalRolledbackTransactions"));
088: oForm.setExpiredTransactions(getIntegerAttribute(
089: jtaResourceObjectName, "totalExpiredTransactions"));
090: } catch (Throwable t) {
091: addGlobalError(t);
092: saveErrors(pRequest, m_Errors);
093: return (pMapping.findForward("Global Error"));
094: }
095:
096: // Forward to the jsp.
097: return (pMapping.findForward("Transaction Statistic"));
098: }
099:
100: }
|