1 21 22 package org.objectweb.jonas.webapp.jonasadmin.joramplatform; 23 24 import java.io.IOException ; 25 import java.util.ArrayList ; 26 import java.util.Set ; 27 import java.util.Vector ; 28 29 import javax.management.ObjectName ; 30 import javax.servlet.ServletException ; 31 import javax.servlet.http.HttpServletRequest ; 32 import javax.servlet.http.HttpServletResponse ; 33 34 import org.apache.struts.action.ActionForm; 35 import org.apache.struts.action.ActionForward; 36 import org.apache.struts.action.ActionMapping; 37 38 import org.objectweb.jonas.jmx.JonasManagementRepr; 39 import org.objectweb.jonas.jmx.JonasObjectName; 40 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx; 41 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 42 43 46 47 public class ListLocalDestinationsAction extends EditJoramBaseAction { 48 49 ObjectName ejbServiceObjectName = null; 50 String [] asParam = null; 51 String [] asSignature = null; 52 53 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 55 , HttpServletRequest pRequest, HttpServletResponse pResponse) 56 throws IOException , ServletException { 57 58 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_DOMAIN) + WhereAreYou.NODE_SEPARATOR 60 + "joramplatform" + WhereAreYou.NODE_SEPARATOR 61 + "joramlocalserver", true); 62 63 initRefs(); 66 67 String asDestName = null; 69 try { 70 ObjectName oObjectName = JonasObjectName.joramLocalServer(); 72 ArrayList alQueues = new ArrayList (); 73 Vector v = (Vector ) getListAttribute(oObjectName, "LocalQueuesNames"); 75 if (v != null) { 76 for (int i = 0; i < v.size(); i++) { 77 asDestName = (String ) v.get(i); 78 ObjectName queueOn = new ObjectName ("joram:type=JMSqueue,name=" + asDestName); 79 if (JonasAdminJmx.hasMBeanName(queueOn)) { 80 boolean deps = hasDeps(asDestName); 81 alQueues.add(new DestinationItem(asDestName, "queue", deps)); 82 } 83 } 84 } 85 v = (Vector ) getListAttribute(oObjectName, "LocalTopicsNames"); 87 ArrayList alTopics = new ArrayList (); 88 if (v != null) { 89 for (int i = 0; i < v.size(); i++) { 90 asDestName = (String ) v.get(i); 91 ObjectName topicOn = new ObjectName ("joram:type=JMStopic,name=" + asDestName); 92 if (JonasAdminJmx.hasMBeanName(topicOn)) { 93 boolean deps = hasDeps(asDestName); 94 alQueues.add(new DestinationItem(asDestName, "topic", deps)); 95 } 96 } 97 } 98 99 ArrayList alDestinations = new ArrayList (alQueues); 101 alDestinations.addAll(alTopics); 102 103 pRequest.setAttribute("destinationsList", alDestinations); 104 } catch (Throwable t) { 105 return (treatError(t, pMapping, pRequest)); 106 } 107 108 return (pMapping.findForward("Joram Destinations")); 110 } 111 112 } 113 | Popular Tags |