1 22 package org.jboss.console.plugins.helpers.servlet; 23 24 import org.jboss.console.plugins.helpers.jmx.Server; 25 import org.jboss.mx.util.MBeanProxy; 26 27 import javax.management.ObjectName ; 28 import javax.servlet.jsp.JspTagException ; 29 import javax.servlet.jsp.tagext.TagSupport ; 30 31 46 public class MBeanTag 47 extends TagSupport 48 { 49 protected String interfaceName = null; 50 protected String variableName = null; 51 protected String mbeanName = null; 52 53 public String getIntf () { return this.interfaceName; } 54 public void setIntf (String intf) { this.interfaceName = intf; } 55 56 public String getId () { return this.variableName; } 57 public void setId (String var) { this.variableName = var; } 58 59 public String getMbean () { return this.mbeanName; } 60 public void setMbean (String mbean) { this.mbeanName = mbean; } 61 62 63 public int doStartTag () throws JspTagException 64 { 65 try 66 { 67 ObjectName objName = null; 70 if (mbeanName == null) 71 { 72 objName = new ObjectName (pageContext.getRequest().getParameter("ObjectName")); 73 } 74 else 75 { 76 objName = new ObjectName (mbeanName); 77 } 78 79 Class type = Thread.currentThread().getContextClassLoader().loadClass(this.interfaceName); 82 83 Object result = MBeanProxy.get(type, objName, Server.getMBeanServer()); 86 87 pageContext.setAttribute(variableName, result); 90 91 return EVAL_BODY_INCLUDE; 92 } 93 catch (Exception e) 94 { 95 throw new JspTagException (e.toString()); 96 } 97 } 98 99 public int doEndTag () throws JspTagException 100 { 101 return EVAL_PAGE; 102 } 103 } 104 | Popular Tags |