1 12 13 package org.ejtools.jmx.browser.web.taglib; 14 15 16 17 import javax.management.MBeanAttributeInfo ; 18 19 import javax.servlet.jsp.JspException ; 20 21 import javax.servlet.jsp.tagext.TagSupport ; 22 23 24 25 import org.apache.struts.util.RequestUtils; 26 27 import org.apache.struts.util.ResponseUtils; 28 29 import org.ejtools.util.ClassTools; 30 31 32 33 50 51 public class MBeanAttributeClassTag extends TagSupport 52 53 { 54 55 56 57 protected boolean filter = true; 58 59 60 61 protected boolean ignore = false; 62 63 64 65 protected String name = null; 66 67 68 69 protected String scope = null; 70 71 72 73 74 75 86 87 public int doStartTag() 88 89 throws JspException 90 91 { 92 93 95 MBeanAttributeInfo info = (MBeanAttributeInfo ) RequestUtils.lookup(pageContext, name, scope); 96 97 if (ignore) 98 99 { 100 101 if (info == null) 102 103 { 104 105 return (SKIP_BODY); 106 107 } 108 109 111 } 112 113 114 115 String output = ClassTools.classDisplay(info.getType()); 116 117 118 119 if (filter) 120 121 { 122 123 ResponseUtils.write(pageContext, ResponseUtils.filter(output)); 124 125 } 126 127 else 128 129 { 130 131 ResponseUtils.write(pageContext, output); 132 133 } 134 135 136 137 139 return (SKIP_BODY); 140 141 } 142 143 144 145 146 147 158 159 public boolean getFilter() 160 161 { 162 163 return (this.filter); 164 165 } 166 167 168 169 170 171 182 183 public boolean getIgnore() 184 185 { 186 187 return (this.ignore); 188 189 } 190 191 192 193 194 195 206 207 public String getName() 208 209 { 210 211 return (this.name); 212 213 } 214 215 216 217 218 219 230 231 public String getScope() 232 233 { 234 235 return (this.scope); 236 237 } 238 239 240 241 242 243 244 245 public void release() 246 247 { 248 249 super.release(); 250 251 filter = true; 252 253 ignore = false; 254 255 name = null; 256 257 scope = null; 258 259 id = null; 260 261 } 262 263 264 265 266 267 276 277 public void setFilter(boolean filter) 278 279 { 280 281 this.filter = filter; 282 283 } 284 285 286 287 288 289 298 299 public void setIgnore(boolean ignore) 300 301 { 302 303 this.ignore = ignore; 304 305 } 306 307 308 309 310 311 320 321 public void setName(String name) 322 323 { 324 325 this.name = name; 326 327 } 328 329 330 331 332 333 342 343 public void setScope(String scope) 344 345 { 346 347 this.scope = scope; 348 349 } 350 351 } 352 353 354 355 | Popular Tags |