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 EditJoramQueueAction extends EditJoramBaseAction { 48 49 51 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 52 , HttpServletRequest pRequest, HttpServletResponse pResponse) 53 throws IOException , ServletException { 54 55 56 String name = pRequest.getParameter("name"); 57 String serverId = pRequest.getParameter("id"); 59 if (serverId != null) { 60 m_Session.setAttribute("currentId", serverId); 61 } else { 62 serverId = (String ) m_Session.getAttribute("currentId"); 63 } 64 String localId = (String ) m_Session.getAttribute("localId"); 66 try { 67 JoramQueueForm oForm = null; 69 MonitoringDestForm mForm = new MonitoringDestForm(); 70 if (name != null) { 71 oForm = new JoramQueueForm(); 73 oForm.reset(pMapping, pRequest); 74 m_Session.setAttribute("joramQueueForm", oForm); 76 ObjectName oObjectName = JoramObjectName.joramQueue(name); 78 populateDestination(oObjectName, oForm); 79 getStatistics(oObjectName, mForm, oForm); 80 oForm.setMessageIds((String []) JonasManagementRepr.getAttribute(oObjectName, "MessageIds")); 81 oForm.setNbMaxMsg(getIntegerAttribute(oObjectName, "NbMaxMsg")); 82 oForm.setPendingMessages(getIntegerAttribute(oObjectName, "PendingMessages")); 83 oForm.setPendingRequests(getIntegerAttribute(oObjectName, "PendingRequests")); 84 oForm.setThreshold(getIntegerAttribute(oObjectName, "Threshold")); 85 m_Session.setAttribute("joramStatForm", mForm); 86 } else { 87 oForm = (JoramQueueForm) m_Session.getAttribute("joramQueueForm"); 89 serverId = oForm.getId(); 90 localId = (String ) m_Session.getAttribute("localId"); 91 if (localId == null) { 92 ObjectName joramPlatformON = JoramObjectName.joramPlatform(); 93 localId = getStringAttribute(joramPlatformON, "LocalServerId"); 94 m_Session.setAttribute("localId", localId); 95 } 96 } 97 98 if (name != null) { 100 ArrayList al = new ArrayList (); 101 String [] asParam = new String [1]; 102 String [] asSignature = new String [1]; 103 asSignature[0] = "java.lang.String"; 104 asParam[0] = name; 105 ObjectName ejbServiceObjectName = JonasObjectName.ejbService(); 106 if (JonasManagementRepr.isRegistered(ejbServiceObjectName)) { 107 java.util.Iterator it = ((java.util.Set ) JonasManagementRepr.invoke( 108 ejbServiceObjectName, "getJmsDestinationDependence", asParam 109 , asSignature)).iterator(); 110 while (it.hasNext()) { 111 al.add(new EjbItem((ObjectName ) it.next())); 112 } 113 Collections.sort(al, new EjbItemByNameComparator()); 115 oForm.setListUsedByEjb(al); 117 } 118 } 119 } catch (Throwable t) { 120 return (treatError(t, pMapping, pRequest)); 121 } 122 123 boolean isLocalServer; 124 if (serverId.equals(localId)) { 125 isLocalServer = true; 126 } else { 127 isLocalServer = false; 128 } 129 m_Session.setAttribute("isLocalServer", new Boolean (isLocalServer)); 130 131 String nodeName = null; 133 if (isLocalServer) { 134 nodeName = getTreeBranchName(DEPTH_DOMAIN) + WhereAreYou.NODE_SEPARATOR 135 + "joramplatform" + WhereAreYou.NODE_SEPARATOR 136 + "joramlocalserver" + WhereAreYou.NODE_SEPARATOR 137 + "joramqueue" + name; 138 } else { 139 nodeName = getTreeBranchName(DEPTH_DOMAIN) + WhereAreYou.NODE_SEPARATOR 140 + "joramplatform" + WhereAreYou.NODE_SEPARATOR 141 + "joramremoteserver" + serverId + WhereAreYou.NODE_SEPARATOR 142 + "joramqueue" + name; 143 } 144 m_WhereAreYou.selectNameNode(nodeName, true); 145 return (pMapping.findForward("JoramQueue")); 146 } 147 148 } 149 | Popular Tags |