Package javax.management.modelmbean

Examples of javax.management.modelmbean.ModelMBeanAttributeInfo


  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


  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

    return assembler;
  }

  public void testSupermanIsReadOnly() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = info.getAttribute("Superman");

    assertTrue(attr.isReadable());
    assertFalse(attr.isWritable());
  }
View Full Code Here

            }
   
            // Ordinary property.
            String fqan = prefix + attrName;
            boolean writable = isWritable(type, pdesc);
            attributes.add(new ModelMBeanAttributeInfo(
                    fqan, convertType(
                            object.getClass(), attrName, attrType, writable).getName(),
                    pdesc.getShortDescription(), true, writable, false));
           
            propertyDescriptors.put(fqan, pdesc);
View Full Code Here

        }

        final boolean isIs =
            (readMethod != null) && readMethod.getName().startsWith( "is" );

        final ModelMBeanAttributeInfo info =
            new ModelMBeanAttributeInfo( name, type, description, isReadable, isWriteable, isIs );

        // additional info needed for modelMbean to work
        final Descriptor descriptor = info.getDescriptor();
        descriptor.setField( "currencyTimeLimit", new Integer( 1 ) );
        if( isReadable )
        {
            descriptor.setField( "getMethod", readMethod.getName() );
        }
        if( isWriteable )
        {
            descriptor.setField( "setMethod", writeMethod.getName() );
        }
        info.setDescriptor( descriptor );

        return info;
    }
View Full Code Here

            }
   
            // Ordinary property.
            String fqan = prefix + attrName;
            boolean writable = isWritable(type, pdesc);
            attributes.add(new ModelMBeanAttributeInfo(
                    fqan, convertType(
                            object.getClass(), attrName, attrType, writable).getName(),
                    pdesc.getShortDescription(), true, writable, false));
           
            propertyDescriptors.put(fqan, pdesc);
View Full Code Here

        return (IoFilter) object;
    }

    @Override
    protected void addExtraAttributes(List<ModelMBeanAttributeInfo> attributes) {
        attributes.add(new ModelMBeanAttributeInfo(
                "attributes", Map.class.getName(), "attributes",
                true, false, false));
    }
View Full Code Here

     */
    public Object getAttribute(String name)
        throws AttributeNotFoundException, MBeanException,
            ReflectionException {
                name = MBeanMetaHelper.mapToMBeanAttributeName(name);
                ModelMBeanAttributeInfo attrInfo = (ModelMBeanAttributeInfo)MBeanHelper.findMatchingAttributeInfo((MBeanInfo)info, name);
                if(attrInfo==null)
                    throw new AttributeNotFoundException(name);
                //FIXME add check "is readable"
                Object o = null;
                try {
View Full Code Here

    public void setAttribute(Attribute attribute)
        throws AttributeNotFoundException, MBeanException,
        ReflectionException
    {
                attribute = new Attribute(MBeanMetaHelper.mapToMBeanAttributeName(attribute.getName()), attribute.getValue());
                ModelMBeanAttributeInfo attrInfo = (ModelMBeanAttributeInfo)MBeanHelper.findMatchingAttributeInfo((MBeanInfo)info, attribute.getName());
                if(attrInfo==null)
                    throw new AttributeNotFoundException();
                //FIXME add check "is writable"
               
                try {
View Full Code Here

   {
      // testcase for bug #794320
      // Test that only name and descriptorType are mandatory
      Descriptor descriptor = new DescriptorSupport(new String[]{"name", "descriptortype", "default"},
                                                    new String[]{"attribute1", "attribute", "default"});
      ModelMBeanAttributeInfo attribute
              = new ModelMBeanAttributeInfo("attribute1", "java.lang.String", "An attribute", true, true, false, descriptor);
      // in case of bug #794320 the descriptor is overrided
      assertEquals(attribute.getDescriptor().getFieldValue("default"), "default");
      assertNull(attribute.getDescriptor().getFieldValue("value"));
   }
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.