Package javax.management.modelmbean

Examples of javax.management.modelmbean.ModelMBeanAttributeInfo


      final boolean WRITABLE = true;
      final boolean ISIS     = true;
     
      RequiredModelMBean mbean = new RequiredModelMBean();
     
      ModelMBeanAttributeInfo attr1 = new ModelMBeanAttributeInfo(
            "Kissa",
            String.class.getName(),
            "Some attribute description",
            !READABLE, !WRITABLE, !ISIS
      );
     
      ModelMBeanAttributeInfo attr2 = new ModelMBeanAttributeInfo(
            "Koira",
            String.class.getName(),
            "Another attribute description",
            !READABLE, !WRITABLE, !ISIS
      );
View Full Code Here


      descr1.setField("name", "Room");
      descr1.setField("descriptorType", "attribute");
      descr1.setField("displayName", "Room Number");
      descr1.setField("default", "D325");

      ModelMBeanAttributeInfo roomNameInfo =
         new ModelMBeanAttributeInfo(
            "Room",                        // attribute name
            String.class.getName(),        // attribute type
            "Room name or number.",        // description
            READABLE, WRITABLE, !BOOLEAN,  // read write
            descr1                         // descriptor
         );

      // build 'Active' read-only attribute
      Descriptor descr2 = new DescriptorSupport();
      descr2.setField("name", "Active");
      descr2.setField("descriptorType", "attribute");
      descr2.setField("getMethod", "isActive");
      descr2.setField("currencyTimeLimit", "10");

      ModelMBeanAttributeInfo activeInfo =
         new ModelMBeanAttributeInfo(
            "Active",
            boolean.class.getName(),
            "Printer state.",
            READABLE, !WRITABLE, !BOOLEAN,
            descr2
View Full Code Here

         MBeanAttributeInfo[] mais = mmeta.getAttributes();
         StringBuffer buf = new StringBuffer();
         buf.append("<attributes>\n");
         for (int i = 0; i < mais.length; i++)
         {
            ModelMBeanAttributeInfo mai = (ModelMBeanAttributeInfo) mais[i];
            buf.append(" <attribute name=\"" + mai.getName() + "\" ");
            buf.append("type=\"" + mai.getType() + "\">");
            log.debug("Trying to load " + mai.getName());
            Descriptor aDesc = mai.getDescriptor();
            if (aDesc==null)
              throw new Exception("aDesc is null");
            log.debug(aDesc.toString());
            Object att = aDesc.getFieldValue(ModelMBeanConstants.ATTRIBUTE_VALUE);
            if (att!=null)
View Full Code Here

      descr1.setField("name", "Room");
      descr1.setField("descriptorType", "attribute");
      descr1.setField("displayName", "Room Number");
      descr1.setField("default", "D325");

      ModelMBeanAttributeInfo roomNameInfo =
         new ModelMBeanAttributeInfo(
            "Room",                        // attribute name
            String.class.getName(),        // attribute type
            "Room name or number.",        // description
            READABLE, WRITABLE, !BOOLEAN,  // read write
            descr1                         // descriptor
         );


      // build 'Active' read-only attribute
      Descriptor descr2 = new DescriptorSupport();
      descr2.setField("name", "Active");
      descr2.setField("descriptorType", "attribute");
      descr2.setField("getMethod", "isActive");
      descr2.setField("currencyTimeLimit", "10");

      ModelMBeanAttributeInfo activeInfo =
         new ModelMBeanAttributeInfo(
            "Active",
            boolean.class.getName(),
            "Printer state.",
            READABLE, !WRITABLE, !BOOLEAN,
            descr2
View Full Code Here

      descr2.setField("name", "pojoAttribute");
      descr2.setField("descriptorType", "attribute");
      descr2.setField("getMethod", "getpojoAttribute");
      descr2.setField("setMethod", "setpojoAttribute");

      ModelMBeanAttributeInfo pojoAttributeInfo =
         new ModelMBeanAttributeInfo(
            "pojoAttribute",
            int.class.getName(),
            "A simple integer attribute.",
            READABLE, WRITABLE, !BOOLEAN,
            descr2
View Full Code Here

         descriptor.setField(NAME, "Active");
         descriptor.setField(DESCRIPTOR_TYPE, ATTRIBUTE_DESCRIPTOR);
         descriptor.setField(PERSIST_POLICY, PP_ON_TIMER);
         descriptor.setField(PERSIST_PERIOD, "1000");

         ModelMBeanAttributeInfo attrInfo = new ModelMBeanAttributeInfo(
               "Active",
               boolean.class.getName(),
               "Test Attribute",
               IS_READABLE,
               !IS_WRITABLE,
View Full Code Here

      if (getter != null || setter != null) {
        // If both getter and setter are null, then this does not need exposing.
        String attrName = JmxUtils.getAttributeName(prop, isUseStrictCasing());
        String description = getAttributeDescription(prop, beanKey);
        ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(attrName, description, getter, setter);

        Descriptor desc = info.getDescriptor();
        if (getter != null) {
          desc.setField(FIELD_GET_METHOD, getter.getName());
        }
        if (setter != null) {
          desc.setField(FIELD_SET_METHOD, setter.getName());
        }

        populateAttributeDescriptor(desc, getter, setter, beanKey);
        info.setDescriptor(desc);
        infos.add(info);
      }
    }

    return infos.toArray(new ModelMBeanAttributeInfo[infos.size()]);
View Full Code Here

      if (getter != null || setter != null) {
        // If both getter and setter are null, then this does not need exposing.
        String attrName = JmxUtils.getAttributeName(prop, isUseStrictCasing());
        String description = getAttributeDescription(prop, beanKey);
        ModelMBeanAttributeInfo info = new ModelMBeanAttributeInfo(attrName, description, getter, setter);

        Descriptor desc = info.getDescriptor();
        if (getter != null) {
          desc.setField(FIELD_GET_METHOD, getter.getName());
        }
        if (setter != null) {
          desc.setField(FIELD_SET_METHOD, setter.getName());
        }

        populateAttributeDescriptor(desc, getter, setter, beanKey);
        info.setDescriptor(desc);
        infos.add(info);
      }
    }

    return infos.toArray(new ModelMBeanAttributeInfo[infos.size()]);
View Full Code Here

  }

  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"));
    assertEquals("getMethod field has incorrect value", "getName",
View Full Code Here

  protected static final String OBJECT_NAME = "bean:name=testBean4";

  public void testGetAgeIsReadOnly() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
    assertTrue("Age is not readable", attr.isReadable());
    assertFalse("Age is not writable", attr.isWritable());
  }
View Full Code Here

TOP

Related Classes of javax.management.modelmbean.ModelMBeanAttributeInfo

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.