Package javax.management.modelmbean

Examples of javax.management.modelmbean.ModelMBeanInfo


  /**
   * Gets the <code>ModelMBeanInfo</code> for the bean with the supplied key
   * and of the supplied type.
   */
  private ModelMBeanInfo getMBeanInfo(Object managedBean, String beanKey) throws JMException {
    ModelMBeanInfo info = this.assembler.getMBeanInfo(managedBean, beanKey);
    if (logger.isWarnEnabled() && ObjectUtils.isEmpty(info.getAttributes()) &&
        ObjectUtils.isEmpty(info.getOperations())) {
      logger.warn("Bean with key '" + beanKey +
          "' has been registered as an MBean but has no exposed attributes or operations");
    }
    return info;
  }
View Full Code Here


        try {
            registerMBeanWithServer(obj, persist(name), forceRegistration);          
        } catch (NotCompliantMBeanException e) {       
            //If this is not a "normal" MBean, then try to deploy it using JMX annotations
            ModelMBeanAssembler assembler = new ModelMBeanAssembler();
            ModelMBeanInfo mbi = assembler.getModelMbeanInfo(obj.getClass());
            register(obj, name, mbi, forceRegistration);
        }               
    }
View Full Code Here

        try {
            registerMBeanWithServer(obj, persist(name), forceRegistration);          
        } catch (NotCompliantMBeanException e) {       
            //If this is not a "normal" MBean, then try to deploy it using JMX annotations
            ModelMBeanAssembler assembler = new ModelMBeanAssembler();
            ModelMBeanInfo mbi = assembler.getModelMbeanInfo(obj.getClass());
            register(obj, name, mbi, forceRegistration);
        }               
    }
View Full Code Here

    assertEquals("Incorrect name on MBean", name, bean.getName());
  }

  public void testRegisterExistingMBeanWithUserSuppliedObjectName() throws Exception {
    ObjectName objectName = ObjectNameManager.getInstance("spring:name=Foo");
    ModelMBeanInfo info = new ModelMBeanInfoSupport("myClass", "myDescription", null, null, null, null);
    RequiredModelMBean bean = new RequiredModelMBean(info);

    MBeanExporter exporter = new MBeanExporter();
    exporter.setServer(getServer());
    exporter.registerManagedResource(bean, objectName);
View Full Code Here

    assertEquals("Incorrect number of attributes registered",
        getExpectedAttributeCount(), inf.getAttributes().length);
  }

  public void testGetMBeanInfo() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    assertNotNull("MBeanInfo should not be null", info);
  }
View Full Code Here

    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    assertNotNull("MBeanInfo should not be null", info);
  }

  public void testGetMBeanAttributeInfo() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    MBeanAttributeInfo[] inf = info.getAttributes();
    assertEquals("Invalid number of Attributes returned",
        getExpectedAttributeCount(), inf.length);

    for (int x = 0; x < inf.length; x++) {
      assertNotNull("MBeanAttributeInfo should not be null", inf[x]);
View Full Code Here

          inf[x].getDescription());
    }
  }

  public void testGetMBeanOperationInfo() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    MBeanOperationInfo[] inf = info.getOperations();
    assertEquals("Invalid number of Operations returned",
        getExpectedOperationCount(), inf.length);

    for (int x = 0; x < inf.length; x++) {
      assertNotNull("MBeanOperationInfo should not be null", inf[x]);
View Full Code Here

          inf[x].getDescription());
    }
  }

  public void testDescriptionNotNull() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();

    assertNotNull("The MBean description should not be null",
        info.getDescription());
  }
View Full Code Here

        new Object[] {new Integer(20), new Integer(30)}, new String[] {"int", "int"});
  assertEquals("Incorrect result", new Integer(50), result);
  }

  public void testAttributeInfoHasDescriptors() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();

    ModelMBeanAttributeInfo attr = info.getAttribute(NAME_ATTRIBUTE);
    Descriptor desc = attr.getDescriptor();
    assertNotNull("getMethod field should not be null",
        desc.getFieldValue("getMethod"));
    assertNotNull("setMethod field should not be null",
        desc.getFieldValue("setMethod"));
View Full Code Here

    assertEquals("setMethod field has incorrect value", "setName",
        desc.getFieldValue("setMethod"));
  }

  public void testAttributeHasCorrespondingOperations() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();

    ModelMBeanOperationInfo get = info.getOperation("getName");
    assertNotNull("get operation should not be null", get);
    assertEquals("get operation should have visibility of four",
        (Integer) get.getDescriptor().getFieldValue("visibility"),
        new Integer(4));
    assertEquals("get operation should have role \"getter\"", "getter", get.getDescriptor().getFieldValue("role"));

    ModelMBeanOperationInfo set = info.getOperation("setName");
    assertNotNull("set operation should not be null", set);
    assertEquals("set operation should have visibility of four",
        (Integer) set.getDescriptor().getFieldValue("visibility"),
        new Integer(4));
    assertEquals("set operation should have role \"setter\"", "setter", set.getDescriptor().getFieldValue("role"));
View Full Code Here

TOP

Related Classes of javax.management.modelmbean.ModelMBeanInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.