1 17 18 package org.apache.geronimo.console.web.taglib; 19 20 import java.io.IOException ; 21 import javax.management.MBeanServer ; 22 import javax.servlet.jsp.JspWriter ; 23 24 30 public final class MBeanServerContextValueTag extends MBeanServerContextSupport { 31 private String type = ""; 32 private MBeanServerContextTag ctx; 33 private MBeanServer server; 34 35 public int doStartTag() { 36 ctx = getMBeanServerContext(); 37 server = ctx.getMBeanServer(); 38 JspWriter out = pageContext.getOut(); 39 40 try { 41 if (server != null) { 42 String output = getContextValue(getType()); 43 out.print(output); 44 } 45 } catch (IOException e) { 46 e.printStackTrace(); 47 } 48 return EVAL_BODY_INCLUDE; 49 } 50 51 public int doEndTag() { 52 return EVAL_PAGE; 53 } 54 55 public String getType() { 56 return type; 57 } 58 59 public void setType(String type) { 60 this.type = type; 61 } 62 63 private String getContextValue(String type) { 64 if (type.equals("ObjectNameFilter")) { 65 return ctx.getObjectNameFilter(); 66 } 67 return "error, attribute [" + type + "] not recognized"; 68 } 69 } | Popular Tags |