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 37 import org.objectweb.jonas.jmx.JonasManagementRepr; 38 import org.objectweb.jonas.jmx.JonasObjectName; 39 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx; 40 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 41 import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItem; 42 import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItemByNameComparator; 43 44 47 48 public class EditJoramLocalTopicAction extends EditJoramBaseAction { 49 50 52 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 53 , HttpServletRequest pRequest, HttpServletResponse pResponse) 54 throws IOException , ServletException { 55 56 String name = pRequest.getParameter("name"); 57 58 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_DOMAIN) + WhereAreYou.NODE_SEPARATOR 60 + "joramplatform" + WhereAreYou.NODE_SEPARATOR 61 + "joramlocalserver" + WhereAreYou.NODE_SEPARATOR 62 + "joramlocaltopic" + name, true); 63 64 try { 65 JoramLocalTopicForm oForm = null; 67 if (name != null) { 68 oForm = new JoramLocalTopicForm(); 70 oForm.reset(pMapping, pRequest); 71 m_Session.setAttribute("joramLocalTopicForm", oForm); 73 ObjectName oObjectName = JonasObjectName.joramTopic(name); 75 oForm.setName(getStringAttribute(oObjectName, "JndiName")); 76 oForm.setId(getStringAttribute(oObjectName, "AgentId")); 77 } else { 78 oForm = (JoramLocalTopicForm) m_Session.getAttribute("joramLocalTopicForm"); 80 } 81 82 if (name != null) { 84 ArrayList al = new ArrayList (); 85 String [] asParam = new String [1]; 86 String [] asSignature = new String [1]; 87 asSignature[0] = "java.lang.String"; 88 asParam[0] = name; 89 ObjectName ejbServiceObjectName = JonasObjectName.ejbService(); 90 if (JonasManagementRepr.isRegistered(ejbServiceObjectName)) { 91 java.util.Iterator it = ((java.util.Set ) JonasManagementRepr.invoke( 92 ejbServiceObjectName, "getJmsDestinationDependence", asParam 93 , asSignature)).iterator(); 94 while (it.hasNext()) { 95 al.add(new EjbItem((ObjectName ) it.next())); 96 } 97 Collections.sort(al, new EjbItemByNameComparator()); 99 oForm.setListUsedByEjb(al); 101 } 102 } 103 } catch (Throwable t) { 104 return (treatError(t, pMapping, pRequest)); 105 } 106 107 return (pMapping.findForward("JoramLocalTopic")); 109 } 110 111 } 112 | Popular Tags |