1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.jtm; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 31 import javax.management.ObjectName ; 32 import javax.servlet.ServletException ; 33 import javax.servlet.http.HttpServletRequest ; 34 import javax.servlet.http.HttpServletResponse ; 35 36 import org.apache.struts.action.ActionForm; 37 import org.apache.struts.action.ActionForward; 38 import org.apache.struts.action.ActionMapping; 39 import org.objectweb.jonas.jmx.J2eeObjectName; 40 import org.objectweb.jonas.jmx.JonasManagementRepr; 41 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 42 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 43 44 47 48 public class ListXaResourceAction extends JonasBaseAction { 49 50 private String myasparam = null; 51 52 54 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 55 , HttpServletRequest pRequest, HttpServletResponse pResponse) 56 throws IOException , ServletException { 57 58 try { 61 ItemsXaResourceForm xForm = (ItemsXaResourceForm) m_Session.getAttribute("itemsXaResourceForm"); 62 xForm.setAction(null); 63 xForm.setSelectedItems(new String [0]); 64 } catch (Exception e) { 65 ; 67 } 68 69 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR 71 + "services" + WhereAreYou.NODE_SEPARATOR + "transaction", true); 72 73 JtmServiceXAResourceForm oForm = (JtmServiceXAResourceForm) pForm; 75 76 try { 77 String [] asParam = new String [1]; 79 String [] asSignature = {"java.lang.String"}; 80 String mys; 81 String sResmgr; 82 String sResource; 83 String sFullXid; 84 String sXid; 85 String sXidstate; 86 String sXidcount; 87 Object txObject; 88 String [] myTxInfo; 89 int txInfoSize; 90 ArrayList al = new ArrayList (); 91 92 String sName = pRequest.getParameter("fulltrans"); 94 95 if (sName == null) { 96 sName = myasparam; 97 } else { 98 myasparam = sName; 99 } 100 101 asParam[0] = sName; 102 103 String currentDomainName = m_WhereAreYou.getCurrentDomainName(); 105 String currentJonasServerName = m_WhereAreYou.getCurrentJonasServerName(); 106 String jtaResourceName = "JTAResource"; 107 ObjectName jtaResourceObjectName = J2eeObjectName.JTAResource(currentDomainName, currentJonasServerName, jtaResourceName); 108 109 txObject = JonasManagementRepr.invoke(jtaResourceObjectName, "getAllXAResource", asParam, asSignature); 110 111 myTxInfo = (String []) txObject; 112 113 if (txObject != null) { 114 txInfoSize = myTxInfo.length; 115 116 for (int i = 0; i < txInfoSize; i++) { 117 mys = myTxInfo[i]; 118 int myix1 = mys.indexOf("????"); 119 sResmgr = mys.substring(0, myix1); 120 int myix2 = mys.indexOf("????", myix1 + 4); 121 sResource = mys.substring(myix1 + 4, myix2); 122 int myix3 = mys.indexOf("????", myix2 + 4); 123 sFullXid = mys.substring(myix2 + 4, myix3); 124 int myix4 = mys.indexOf("????", myix3 + 4); 125 sXid = mys.substring(myix3 + 4, myix4); 126 sXidstate = mys.substring(myix4 + 4); 127 al.add(new TxXaresource (null, sResmgr, sResource, sFullXid, sXid, sXidstate)); 128 } 129 } 130 131 pRequest.setAttribute("listXaResourceEntries", al); 133 } 134 catch (Throwable t) { 135 addGlobalError(t); 136 saveErrors(pRequest, m_Errors); 137 return (pMapping.findForward("Global Error")); 138 } 139 140 return (pMapping.findForward("Jtm XAResource")); 142 } 143 } 144 | Popular Tags |