ResetTransactionsAction.java

00001 
00026 package org.objectweb.jonas.webapp.jonasadmin.service.jtm;
00027 
00028 import java.io.IOException;
00029 import java.io.IOException;
00030 import java.util.ArrayList;
00031 import java.util.Date;
00032 import java.util.List;
00033 import java.util.Collections;
00034 import java.util.Iterator;
00035 
00036 import javax.management.ObjectName;
00037 import javax.servlet.ServletException;
00038 import javax.servlet.http.HttpServletRequest;
00039 import javax.servlet.http.HttpServletResponse;
00040 
00041 import org.apache.struts.action.ActionForm;
00042 import org.apache.struts.action.ActionForward;
00043 import org.apache.struts.action.ActionMapping;
00044 import org.objectweb.jonas.jmx.JonasManagementRepr;
00045 //import org.objectweb.jonas.jmx.JonasObjectName;
00046 import org.objectweb.jonas.jmx.J2eeObjectName;
00047 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
00048 
00053 public class ResetTransactionsAction extends JonasBaseAction {
00064     public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm
00065         , HttpServletRequest pRequest, HttpServletResponse pResponse)
00066         throws IOException, ServletException {
00067 
00068         try {
00069             // Get container list
00070             String mys;
00071             String sDate;
00072             String sTransaction;
00073             String sResource;
00074             String sState;
00075             Object txObject;
00076             String [] myTxInfo;
00077             int    txInfoSize;
00078             ArrayList al = new ArrayList();
00079 
00080             // Object name used
00081             String currentDomainName = m_WhereAreYou.getCurrentDomainName();
00082             String currentJonasServerName = m_WhereAreYou.getCurrentJonasServerName();
00083             String jtaResourceName = "JTAResource";
00084             ObjectName jtaResourceObjectName = J2eeObjectName.JTAResource(currentDomainName, currentJonasServerName, jtaResourceName);
00085 
00086             txObject = JonasManagementRepr.invoke(jtaResourceObjectName, "getAllActiveTx", null, null);
00087             myTxInfo = (String []) txObject;
00088 
00089             if (txObject != null) {
00090                 txInfoSize = myTxInfo.length;
00091 
00092                 for (int i = 0; i < txInfoSize; i++) {
00093                     mys = myTxInfo[i];
00094                     int myix1 = mys.indexOf("????");
00095                     sDate = mys.substring(0, myix1);
00096                     int myix2 = mys.indexOf("????", myix1 + 4);
00097                     sTransaction = mys.substring(myix1 + 4, myix2);
00098                     int myix3 = mys.indexOf("????", myix2 + 4);
00099                     sResource = mys.substring(myix2 + 4, myix3);
00100                     sState = mys.substring(myix3 + 4);
00101                     al.add(new TxItem (sDate, sTransaction, sResource, sState));
00102                 }
00103              }
00104 
00105              // Set list in the request
00106              pRequest.setAttribute("listTransactionsEntries", al);
00107         } catch (Throwable t) {
00108             addGlobalError(t);
00109             saveErrors(pRequest, m_Errors);
00110             return (pMapping.findForward("Global Error"));
00111         }
00112 
00113         // Forward to action
00114         return (pMapping.findForward("Jtm Monitor"));
00115     }
00116 
00117 }

Generated on Tue Feb 15 15:05:33 2005 for JOnAS by  doxygen 1.3.9.1