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.Collections ; 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 import org.objectweb.jonas.jmx.JonasManagementRepr; 37 import org.objectweb.jonas.jmx.JonasObjectName; 38 import org.objectweb.jonas.jmx.JoramObjectName; 39 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 40 import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItem; 41 import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItemByNameComparator; 42 43 46 47 public class EditJoramTopicAction extends EditJoramBaseAction { 48 49 51 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 52 , HttpServletRequest pRequest, HttpServletResponse pResponse) 53 throws IOException , ServletException { 54 55 String name = pRequest.getParameter("name"); 56 String serverId = pRequest.getParameter("id"); 58 if (serverId != null) { 59 m_Session.setAttribute("currentId", serverId); 60 } else { 61 serverId = (String ) m_Session.getAttribute("currentId"); 62 } 63 String localId = (String ) m_Session.getAttribute("localId"); 65 try { 66 JoramTopicForm oForm = null; 68 MonitoringDestForm mForm = new MonitoringDestForm(); 69 if (name != null) { 70 oForm = new JoramTopicForm(); 72 oForm.reset(pMapping, pRequest); 73 m_Session.setAttribute("joramTopicForm", oForm); 75 ObjectName oObjectName = JoramObjectName.joramTopic(name); 77 populateDestination(oObjectName, oForm); 78 getStatistics(oObjectName, mForm, oForm); 79 oForm.setSubscriptions(getIntegerAttribute(oObjectName, "Subscriptions")); 80 oForm.setSubscriberIds((String []) JonasManagementRepr.getAttribute(oObjectName, "SubscriberIds")); 81 m_Session.setAttribute("joramStatForm", mForm); 82 } else { 83 oForm = (JoramTopicForm) m_Session.getAttribute("joramTopicForm"); 85 serverId = oForm.getId(); 86 localId = (String ) m_Session.getAttribute("localId"); 87 if (localId == null) { 88 ObjectName joramPlatformON = JoramObjectName.joramPlatform(); 89 localId = getStringAttribute(joramPlatformON, "LocalServerId"); 90 m_Session.setAttribute("localId", localId); 91 } 92 } 93 94 if (name != null) { 96 ArrayList al = new ArrayList (); 97 String [] asParam = new String [1]; 98 String [] asSignature = new String [1]; 99 asSignature[0] = "java.lang.String"; 100 asParam[0] = name; 101 ObjectName ejbServiceObjectName = JonasObjectName.ejbService(); 102 if (JonasManagementRepr.isRegistered(ejbServiceObjectName)) { 103 java.util.Iterator it = ((java.util.Set ) JonasManagementRepr.invoke( 104 ejbServiceObjectName, "getJmsDestinationDependence", asParam 105 , asSignature)).iterator(); 106 while (it.hasNext()) { 107 al.add(new EjbItem((ObjectName ) it.next())); 108 } 109 Collections.sort(al, new EjbItemByNameComparator()); 111 oForm.setListUsedByEjb(al); 113 } 114 } 115 } catch (Throwable t) { 116 return (treatError(t, pMapping, pRequest)); 117 } 118 119 boolean isLocalServer; 120 if (serverId.equals(localId)) { 121 isLocalServer = true; 122 } else { 123 isLocalServer = false; 124 } 125 m_Session.setAttribute("isLocalServer", new Boolean (isLocalServer)); 126 127 String nodeName = null; 129 if (isLocalServer) { 130 nodeName = getTreeBranchName(DEPTH_DOMAIN) + WhereAreYou.NODE_SEPARATOR 131 + "joramplatform" + WhereAreYou.NODE_SEPARATOR 132 + "joramlocalserver" + WhereAreYou.NODE_SEPARATOR 133 + "joramtopic" + name; 134 } else { 135 nodeName = getTreeBranchName(DEPTH_DOMAIN) + WhereAreYou.NODE_SEPARATOR 136 + "joramplatform" + WhereAreYou.NODE_SEPARATOR 137 + "joramremoteserver" + serverId + WhereAreYou.NODE_SEPARATOR 138 + "joramtopic" + name; 139 } 140 m_WhereAreYou.selectNameNode(nodeName, true); 141 return (pMapping.findForward("JoramTopic")); 142 } 143 144 } 145 | Popular Tags |