@Mapping( "isReadable" ) public ValueRepresentation isReadable() { return bool( attrInfo.isReadable() ); }
private Map<String,Object> toNeo4jValue( ObjectName name, MBeanAttributeInfo[] attributes ) throws JMException { HashMap<String,Object> out = new HashMap<>(); for ( MBeanAttributeInfo attribute : attributes ) { if ( attribute.isReadable() ) { out.put( attribute.getName(), toNeo4jValue( name, attribute ) ); } } return out; }
private static Set<String> getAttributesNames(ObjectName name) { try { final Set<String> result = new HashSet<String>(); final MBeanInfo mBeanInfo = MBEAN_SERVER.getMBeanInfo(name); final MBeanAttributeInfo[] attributes = mBeanInfo.getAttributes(); for (final MBeanAttributeInfo attribute : attributes) { if (attribute.isReadable()) { result.add(attribute.getName()); } } return result; } catch (final JMException e) { return Collections.emptySet(); } } }
if (inf.isReadable()) { return this.serverToUse.getAttribute(this.objectName, attributeName);
/** * Description of the specified attribute name. * * @param attr - the attribute * @return String the description */ protected String describeAttribute(MBeanAttributeInfo attr) { StringBuilder buf = new StringBuilder(); buf.append("("); if (attr.isReadable()) { buf.append("r"); } if (attr.isWritable()) { buf.append("w"); } buf.append(") ") .append(attr.getType()) .append(" ") .append(attr.getName()); return buf.toString(); }
if (inf.isReadable()) { return this.serverToUse.getAttribute(this.objectName, attributeName);
public String get(ObjectName bean, String attr) throws Exception { MBeanInfo mbinfo = mserver.getMBeanInfo(bean); MBeanAttributeInfo ai = attrInfo(mbinfo, attr); if (ai == null) { throw new IllegalArgumentException("No such attribute '" + attr + "'"); } if (!ai.isReadable()) { throw new IllegalArgumentException("Attribute '" + attr + "' is write-only"); } Object v = mserver.getAttribute(bean, attr); String type = ai.getType(); String text = format(v, type); return text; }
private void writeAttribute(JsonGenerator jg, ObjectName oname, MBeanAttributeInfo attr) throws IOException { if (!attr.isReadable()) { return;
final boolean description, final MBeanAttributeInfo attr) throws IOException { if (!attr.isReadable()) { return;
if (attribute.isReadable() && !"password".equalsIgnoreCase(attribute.getName())) { attributeNames.add(attribute.getName());
sb.append(" (A) "); sb.append(ai.getName()).append(" : ").append(toPrintableType(ai.getType())).append(""); if (!ai.isReadable()) { sb.append(" - WRITEONLY");
private static void writeAttribute(MBeanServerConnection mBeanServer, JsonGenerator jg, ObjectName oname, MBeanAttributeInfo attr) throws IOException { if (!attr.isReadable()) { return;
log.info(" ** NAME: \t" + attrInfo[i].getName()); log.info(" DESCR: \t" + attrInfo[i].getDescription()); log.info(" TYPE: \t" + attrInfo[i].getType() + "\tREAD: " + attrInfo[i].isReadable() + "\tWRITE: " + attrInfo[i].isWritable());
private void assertNickName(MBeanAttributeInfo attr) { assertNotNull("Nick Name should not be null", attr); assertTrue("Nick Name should be writable", attr.isWritable()); assertTrue("Nick Name should be readable", attr.isReadable()); }
private void assertNickName(MBeanAttributeInfo attr) { assertNotNull("Nick Name should not be null", attr); assertTrue("Nick Name should be writable", attr.isWritable()); assertTrue("Nick Name should be readable", attr.isReadable()); }
throw new IllegalArgumentException("No such attribute '" + attr + "'"); if (!ai.isReadable()) { throw new IllegalArgumentException("Attribute '" + attr + "' is write-only");
@Test public void testNickNameIsExposed() throws Exception { ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo(); MBeanAttributeInfo attr = inf.getAttribute("NickName"); assertNotNull("Nick Name should not be null", attr); assertTrue("Nick Name should be writable", attr.isWritable()); assertTrue("Nick Name should be readable", attr.isReadable()); }
@Test public void testNickNameIsExposed() throws Exception { ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo(); MBeanAttributeInfo attr = inf.getAttribute("NickName"); assertNotNull("Nick Name should not be null", attr); assertTrue("Nick Name should be writable", attr.isWritable()); assertTrue("Nick Name should be readable", attr.isReadable()); }
@Test public void testNickNameIsExposed() throws Exception { ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo(); MBeanAttributeInfo attr = inf.getAttribute("NickName"); assertNotNull("Nick Name should not be null", attr); assertTrue("Nick Name should be writable", attr.isWritable()); assertTrue("Nick Name should be readable", attr.isReadable()); }
if ("fooMetric".equals(info.getName())) { assertEquals("java.lang.Long", info.getType()); assertTrue(info.isReadable()); assertTrue(info.isWritable()); assertFalse(info.isIs());