00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 package org.objectweb.jonas.webapp.jonasadmin.mbean;
00027
00028 import java.io.IOException;
00029 import java.util.ArrayList;
00030 import java.util.Iterator;
00031
00032 import javax.management.ObjectName;
00033 import javax.servlet.ServletException;
00034 import javax.servlet.http.HttpServletRequest;
00035 import javax.servlet.http.HttpServletResponse;
00036
00037 import org.apache.struts.action.ActionForm;
00038 import org.apache.struts.action.ActionForward;
00039 import org.apache.struts.action.ActionMapping;
00040 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
00041
00048 public final class ListMBeanPropertiesAction extends ListMBeanDetailsAction {
00049
00050
00051 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form
00052 , HttpServletRequest p_Request, HttpServletResponse p_Response)
00053 throws IOException, ServletException {
00054
00055 try {
00056
00057 setAction(ACTION_PROPERTIES);
00058
00059 String sSelect = p_Request.getParameter("select");
00060
00061
00062 ArrayList list = new ArrayList();
00063
00064 ObjectName on = new ObjectName(sSelect);
00065 MbeanItem oItem = MbeanItem.build(on);
00066
00067
00068 StringBuffer sbBranch = new StringBuffer("mbeans");
00069 sbBranch.append(WhereAreYou.NODE_SEPARATOR);
00070 sbBranch.append(sSelect);
00071 m_WhereAreYou.selectNameNode(sbBranch.toString(), true);
00072
00073
00074 String sKey;
00075 String sValue;
00076 Iterator it = on.getKeyPropertyList().keySet().iterator();
00077 while (it.hasNext()) {
00078 sKey = (String) it.next();
00079 sValue = on.getKeyProperty(sKey);
00080 list.add(new ViewMBeanProperties(sKey, sValue));
00081 }
00082
00083 p_Request.setAttribute("MBean", oItem);
00084 p_Request.setAttribute("MBeanProperties", list);
00085 }
00086 catch (Throwable t) {
00087 addGlobalError(t);
00088 saveErrors(p_Request, m_Errors);
00089 return (p_Mapping.findForward("Global Error"));
00090 }
00091
00092 return p_Mapping.findForward("List MBean Properties");
00093 }
00094
00095
00096
00097 public class ViewMBeanProperties {
00098 private String key;
00099 private String value;
00100
00101 public ViewMBeanProperties() {
00102
00103 }
00104
00105 public ViewMBeanProperties(String ps_Key, String ps_Value) {
00106 setKey(ps_Key);
00107 setValue(ps_Value);
00108 }
00109
00110 public String getKey() {
00111 return key;
00112 }
00113
00114 public void setKey(String key) {
00115 this.key = key;
00116 }
00117
00118 public String getValue() {
00119 return value;
00120 }
00121
00122 public void setValue(String value) {
00123 this.value = value;
00124 }
00125 }
00126
00127 }