public void listBeans( PrintWriter writer, String qry ) { Set<ObjectName> names = null; try { names=mBeanServer.queryNames(new ObjectName(qry), null); writer.println("OK - Number of results: " + names.size()); writer.println(); } catch (Exception ex) { writer.println("Error - " + ex.toString()); ex.printStackTrace(writer); return; } String dump = MBeanDumper.dumpBeans(mBeanServer, names); writer.print(dump); }
public void listBeans(PrintWriter writer, String qry) { Set<ObjectName> names = null; try { names = mBeanServer.queryNames(new ObjectName(qry), null); writer.println("OK - Number of results: " + names.size()); writer.println(); } catch (Exception ex) { writer.println("Error - " + ex.toString()); ex.printStackTrace(writer); return; } String dump = MBeanDumper.dumpBeans(mBeanServer, names); writer.print(dump); }
public void getAttribute(PrintWriter writer, String onameStr, String att, String key) { try { ObjectName oname = new ObjectName(onameStr); Object value = mBeanServer.getAttribute(oname, att); if(null != key && value instanceof CompositeData) value = ((CompositeData)value).get(key); String valueStr; if (value != null) { valueStr = value.toString(); } else { valueStr = "<null>"; } writer.print("OK - Attribute get '"); writer.print(onameStr); writer.print("' - "); writer.print(att); if(null != key) { writer.print(" - key '"); writer.print(key); writer.print("'"); } writer.print(" = "); writer.println(MBeanDumper.escape(valueStr)); } catch (Exception ex) { writer.println("Error - " + ex.toString()); ex.printStackTrace(writer); } }
public void getAttribute(PrintWriter writer, String onameStr, String att, String key) { try { ObjectName oname = new ObjectName(onameStr); Object value = mBeanServer.getAttribute(oname, att); if (null != key && value instanceof CompositeData) value = ((CompositeData) value).get(key); String valueStr; if (value != null) { valueStr = value.toString(); } else { valueStr = "<null>"; } writer.print("OK - Attribute get '"); writer.print(onameStr); writer.print("' - "); writer.print(att); if (null != key) { writer.print(" - key '"); writer.print(key); writer.print("'"); } writer.print(" = "); writer.println(MBeanDumper.escape(valueStr)); } catch (Exception ex) { writer.println("Error - " + ex.toString()); ex.printStackTrace(writer); } }