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.Iterator ; 27 import java.util.List ; 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.WhereAreYou; 41 42 45 46 public class ListJoramServersAction extends EditJoramBaseAction { 47 48 50 public ActionForward executeAction(ActionMapping pMapping, ActionForm pForm 51 , HttpServletRequest pRequest, HttpServletResponse pResponse) 52 throws IOException , ServletException { 53 54 m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_DOMAIN) + WhereAreYou.NODE_SEPARATOR 56 + "joramplatform", true); 57 58 try { 59 ObjectName oName = JonasObjectName.joramLocalServer(); 61 String localId = (String ) JonasManagementRepr.getAttribute(oName, "LocalServerId"); 62 ArrayList remoteIds = new ArrayList (); 63 List list = (List ) JonasManagementRepr.getAttribute(oName, "PlatformServersIds"); 64 if (list != null) { 65 Iterator it = list.iterator(); 66 String id; 67 while (it.hasNext()) { 68 id = it.next().toString(); 69 if (!id.equals(localId)) { 70 remoteIds.add(id); 71 } 72 } 73 } 74 pRequest.setAttribute("localId", localId); 75 pRequest.setAttribute("remoteIds", remoteIds); 76 } catch (Throwable t) { 77 return (treatError(t, pMapping, pRequest)); 78 } 79 80 return (pMapping.findForward("JoramServers")); 82 } 83 84 } 85 | Popular Tags |