1 25 26 package org.objectweb.jonas.webapp.jonasadmin.mbean; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.Iterator ; 31 32 import javax.management.ObjectName ; 33 import javax.servlet.ServletException ; 34 import javax.servlet.http.HttpServletRequest ; 35 import javax.servlet.http.HttpServletResponse ; 36 37 import org.apache.struts.action.ActionForm; 38 import org.apache.struts.action.ActionForward; 39 import org.apache.struts.action.ActionMapping; 40 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; 41 42 47 48 public final class ListMBeanPropertiesAction extends ListMBeanDetailsAction { 49 50 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form 52 , HttpServletRequest p_Request, HttpServletResponse p_Response) 53 throws IOException , ServletException { 54 55 try { 56 setAction(ACTION_PROPERTIES); 58 String sSelect = p_Request.getParameter("select"); 60 61 ArrayList list = new ArrayList (); 63 ObjectName on = new ObjectName (sSelect); 65 MbeanItem oItem = MbeanItem.build(on); 66 67 StringBuffer sbBranch = new StringBuffer ("domain*mbeans"); 69 sbBranch.append(WhereAreYou.NODE_SEPARATOR); 70 sbBranch.append(sSelect); 71 m_WhereAreYou.selectNameNode(sbBranch.toString(), true); 72 73 String sKey; 75 String sValue; 76 Iterator it = on.getKeyPropertyList().keySet().iterator(); 77 while (it.hasNext()) { 78 sKey = (String ) it.next(); 79 sValue = on.getKeyProperty(sKey); 80 list.add(new ViewMBeanProperties(sKey, sValue)); 81 } 82 p_Request.setAttribute("MBean", oItem); 84 p_Request.setAttribute("MBeanProperties", list); 85 } 86 catch (Throwable t) { 87 addGlobalError(t); 88 saveErrors(p_Request, m_Errors); 89 return (p_Mapping.findForward("Global Error")); 90 } 91 return p_Mapping.findForward("List MBean Properties"); 93 } 94 95 97 public class ViewMBeanProperties { 98 private String key; 99 private String value; 100 101 public ViewMBeanProperties() { 102 103 } 104 105 public ViewMBeanProperties(String ps_Key, String ps_Value) { 106 setKey(ps_Key); 107 setValue(ps_Value); 108 } 109 110 public String getKey() { 111 return key; 112 } 113 114 public void setKey(String key) { 115 this.key = key; 116 } 117 118 public String getValue() { 119 return value; 120 } 121 122 public void setValue(String value) { 123 this.value = value; 124 } 125 } 126 127 } 128 | Popular Tags |