1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.jms; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Collections ; 31 32 import javax.management.ObjectName ; 33 import javax.servlet.ServletException ; 34 import javax.servlet.http.HttpServletRequest ; 35 import javax.servlet.http.HttpServletResponse ; 36 37 import org.apache.struts.action.ActionForm; 38 import org.apache.struts.action.ActionForward; 39 import org.apache.struts.action.ActionMapping; 40 import org.objectweb.jonas.jmx.JonasManagementRepr; 41 import org.objectweb.jonas.jmx.JonasObjectName; 42 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction; 43 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 44 import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItem; 45 import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItemByNameComparator; 46 47 51 public class PresentConnectionFactoryAction extends JonasBaseAction { 52 54 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 55 , HttpServletRequest p_Request, HttpServletResponse p_Response) 56 throws IOException , ServletException { 57 58 String cfName = p_Request.getParameter("name"); 60 61 CfForm oForm = null; 63 if (cfName != null) { 64 oForm = new CfForm(); 66 oForm.reset(p_Mapping, p_Request); 67 m_Session.setAttribute("cfForm", oForm); 68 oForm.setName(cfName); 69 } 70 else { 71 oForm = (CfForm) m_Session.getAttribute("cfForm"); 73 } 74 75 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR 77 + "services" + WhereAreYou.NODE_SEPARATOR + "jms" + WhereAreYou.NODE_SEPARATOR + "cf" 78 + WhereAreYou.NODE_SEPARATOR + oForm.getName(), true); 79 80 try { 82 if (cfName != null) { 83 ArrayList al = new ArrayList (); 84 String [] asParam = new String [1]; 85 String [] asSignature = new String [1]; 86 asSignature[0] = "java.lang.String"; 87 asParam[0] = cfName; 88 ObjectName ejbServiceMB = JonasObjectName.ejbService(); 89 if (JonasManagementRepr.isRegistered(ejbServiceMB)) { 90 java.util.Iterator it = ((java.util.Set ) JonasManagementRepr.invoke( 91 ejbServiceMB, "getJmsConnectionFactoryDependence", asParam 92 , asSignature)).iterator(); 93 while (it.hasNext()) { 94 al.add(new EjbItem((ObjectName ) it.next())); 95 } 96 Collections.sort(al, new EjbItemByNameComparator()); 98 } 99 oForm.setListUsedByEjb(al); 101 102 ObjectName jmsServiceMB = JonasObjectName.jmsService(); 104 String mode = (String ) JonasManagementRepr.invoke(jmsServiceMB 105 , "getConnectionFactoryMode", asParam, asSignature); 106 oForm.setMode(mode); 107 } 108 } 109 catch (Throwable t) { 110 addGlobalError(t); 111 saveErrors(p_Request, m_Errors); 112 return (p_Mapping.findForward("Global Error")); 113 } 114 115 return (p_Mapping.findForward("Connection Factory")); 117 } 118 } 119 | Popular Tags |