Java 8 MBeanAttributeInfo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MBeanAttributeInfo class.

This code example shows how to use the following methods:isReadable, isWritable
		assembler.setMethodMappings(props);
		return assembler;
	} 
 
	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());
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:isReadable, isWritable
		assembler.afterPropertiesSet();
		return assembler;
	} 
 
	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 readab;e", attr.isReadable());
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:isReadable, isWritable
 
	@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());
	} 
 
	@Override 
	protected String getObjectName() {
		return OBJECT_NAME;
	} 
 
	@Override 
	protected int getExpectedOperationCount() { 
		return 7; 
	} 
 
7
CodeRank
This code example shows how to use the following methods:isReadable, isWritable
 
	@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());
	} 
 
	@Override 
	protected String getObjectName() {
		return OBJECT_NAME;
	} 
 
	@Override 
	protected int getExpectedOperationCount() { 
		return 11; 
	} 
 
7
CodeRank
This code example shows how to use the following methods:isReadable, isWritable
 
	@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());
	} 
 
	@Override 
	protected String getObjectName() {
		return OBJECT_NAME;
	} 
 
	@Override 
	protected int getExpectedOperationCount() { 
		return 7; 
	} 
 
7
CodeRank
This code example shows how to use the following methods:isReadable, isWritable
	@Test
	public void testSupermanIsReadOnly() throws Exception {
		ModelMBeanInfo info = getMBeanInfoFromAssembler();
		ModelMBeanAttributeInfo attr = info.getAttribute("Superman");
 
		assertTrue(attr.isReadable());
		assertFalse(attr.isWritable());
	} 
 
	/* 
	 * http://opensource.atlassian.com/projects/spring/browse/SPR-2754 
	 */ 
	@Test
	public void testIsNotIgnoredDoesntIgnoreUnspecifiedBeanMethods() throws Exception {
		final String beanKey = "myTestBean";
		MethodExclusionMBeanInfoAssembler assembler = new MethodExclusionMBeanInfoAssembler();
		Properties ignored = new Properties();
		ignored.setProperty(beanKey, "dontExposeMe,setSuperman");
		assembler.setIgnoredMethodMappings(ignored);
		Method method = JmxTestBean.class.getMethod("dontExposeMe");
7
CodeRank
This code example shows how to use the following methods:isReadable, isWritable
 
	@Test
	public void testAttributeFromInterface() throws Exception {
		ModelMBeanInfo inf = getMBeanInfoFromAssembler();
		ModelMBeanAttributeInfo attr = inf.getAttribute("Colour");
		assertTrue("The name attribute should be writable", attr.isWritable());
		assertTrue("The name attribute should be readable", attr.isReadable());
	} 
 
	@Test
	public void testOperationFromInterface() throws Exception {
		ModelMBeanInfo inf = getMBeanInfoFromAssembler();
		ModelMBeanOperationInfo op = inf.getOperation("fromInterface");
		assertNotNull(op);
	} 
 
	@Test
	public void testOperationOnGetter() throws Exception {
		ModelMBeanInfo inf = getMBeanInfoFromAssembler();
		ModelMBeanOperationInfo op = inf.getOperation("getExpensiveToCalculate");
7
CodeRank
This code example shows how to use the following methods:isReadable, getDescription, getName
  } 
 
  private void writeAttribute(JsonGenerator jg, ObjectName oname, final boolean description,
      MBeanAttributeInfo attr)
  throws IOException {
    if (!attr.isReadable()) {
      return; 
    } 
    String attName = attr.getName();
    if ("modelerType".equals(attName)) {
      return; 
    } 
    if (attName.indexOf("=") >= 0 || attName.indexOf(":") >= 0 || attName.indexOf(" ") >= 0) {
      return; 
    } 
    String descriptionStr = description? attr.getDescription(): null;
    Object value = null; 
    try { 
      value = mBeanServer.getAttribute(oname, attName);
    } catch (RuntimeMBeanException e) {
      // UnsupportedOperationExceptions happen in the normal course of business, 
6
CodeRank
This code example shows how to use the following methods:
		return null; 
	} 
 
	@Override 
	public MBeanInfo getMBeanInfo() {
		MBeanAttributeInfo attr = new MBeanAttributeInfo("name", "java.lang.String", "", true, false, false);
		return new MBeanInfo(
				TestDynamicMBean.class.getName(), "",
				new MBeanAttributeInfo[]{attr},
				new MBeanConstructorInfo[0],
				new MBeanOperationInfo[0],
				new MBeanNotificationInfo[0]);
	} 
 
	@Override 
	public boolean equals(Object obj) { 
		return (obj instanceof TestDynamicMBean); 
	} 
 
	@Override 
6
CodeRank
This code example shows how to use the following methods:isReadable, getName
	} 
 
	@Override 
	protected Object load() 
	{ 
		if (attribute.isReadable())
		{ 
			try 
			{ 
				return server.getObject().getAttribute(objectName, attribute.getName());
			} 
			catch (Exception ex)
			{ 
				onError(ex);
			} 
		} 
		return null; 
	} 
 
	public void setObject(Object object) 
6
CodeRank
See Code Examples for Java 8 MBeanAttributeInfo Methods: