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.Vector ; 27 28 import javax.management.ObjectName ; 29 import javax.servlet.ServletException ; 30 import javax.servlet.http.HttpServletRequest ; 31 import javax.servlet.http.HttpServletResponse ; 32 33 import org.apache.struts.action.ActionForm; 34 import org.apache.struts.action.ActionForward; 35 import org.apache.struts.action.ActionMapping; 36 37 import org.objectweb.jonas.jmx.JonasManagementRepr; 38 import org.objectweb.jonas.jmx.JonasObjectName; 39 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 40 41 44 45 public class ListRemoteDestinationsAction extends EditJoramBaseAction { 46 47 49 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 50 , HttpServletRequest pRequest, HttpServletResponse pResponse) 51 throws IOException , ServletException { 52 53 String id = pRequest.getParameter("id"); 54 if (id == null) { 55 id = (String ) m_Session.getAttribute("remoteServerId"); 57 } 58 59 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_DOMAIN) + WhereAreYou.NODE_SEPARATOR 61 + "joramplatform" + WhereAreYou.NODE_SEPARATOR 62 + "joramremoteserver" + id, true); 63 64 try { 65 ObjectName oObjectName = JonasObjectName.joramRemoteServer(id); 67 String asDestName = null; 68 ArrayList alQueues = new ArrayList (); 69 Vector v = (Vector ) JonasManagementRepr.invoke(oObjectName, "retrieveRemoteQueuesNames", null, null); 71 if (v != null) { 72 for (int i = 0; i < v.size(); i++) { 73 asDestName = (String ) v.get(i); 74 boolean deps = false; 75 alQueues.add(new DestinationItem(asDestName, "queue", deps)); 78 } 79 } 80 v = (Vector ) JonasManagementRepr.invoke(oObjectName, "retrieveRemoteTopicsNames", null, null); 82 ArrayList alTopics = new ArrayList (); 83 if (v != null) { 84 for (int i = 0; i < v.size(); i++) { 85 asDestName = (String ) v.get(i); 86 boolean deps = false; 87 alTopics.add(new DestinationItem(asDestName, "topic", deps)); 90 } 91 } 92 93 ArrayList alDestinations = new ArrayList (alQueues); 95 alDestinations.addAll(alTopics); 96 97 pRequest.setAttribute("destinationsList", alDestinations); 98 } catch (Throwable t) { 99 return (treatError(t, pMapping, pRequest)); 100 } 101 102 return (pMapping.findForward("Joram Remote Destinations")); 104 } 105 106 } 107 | Popular Tags |