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 PresentTopicAction 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 topicName = p_Request.getParameter("name"); 60 61 TopicForm oForm = null; 63 if (topicName != null) { 64 oForm = new TopicForm(); 66 oForm.reset(p_Mapping, p_Request); 67 m_Session.setAttribute("topicForm", oForm); 68 oForm.setName(topicName); 69 } 70 else { 71 oForm = (TopicForm) m_Session.getAttribute("topicForm"); 73 } 74 75 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR 77 + "services" + WhereAreYou.NODE_SEPARATOR + "jms" + WhereAreYou.NODE_SEPARATOR 78 + "topic" + WhereAreYou.NODE_SEPARATOR + oForm.getName(), true); 79 80 try { 82 if (topicName != 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] = topicName; 88 ObjectName ejbServiceMB = JonasObjectName.ejbService(); 89 if (JonasManagementRepr.isRegistered(ejbServiceMB)) { 90 java.util.Iterator it = ((java.util.Set ) JonasManagementRepr.invoke( 91 ejbServiceMB, "getJmsDestinationDependence", 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 int subscriptions = ((Integer ) JonasManagementRepr.invoke(jmsServiceMB 105 , "getSubscriptions", asParam, asSignature)).intValue(); 106 oForm.setSubscriptions(subscriptions); 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("Topic")); 117 } 118 } 119 | Popular Tags |