/** {@inheritDoc} */ public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { return findAttribute(attribute).getValue(); }
/** {@inheritDoc} */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { findAttribute(attribute.getName()).setValue(attribute.getValue()); }
/** * Creates {@link AbstractManagedAttribute}'s for the object and its {@link PropertyDescriptor}'s. * * @param pds * the PropertyDescriptor that should be created AbstractManagedAttributes for * @param obj * the object that the properties can be set and retrieved from * @return a map mapping from the name of the attribute to the AbstractManagedAttribute */ static Map<String, AbstractManagedAttribute> fromPropertyDescriptors(PropertyDescriptor[] pds, Object obj) { Map<String, AbstractManagedAttribute> result = new HashMap<String, AbstractManagedAttribute>(); for (PropertyDescriptor pd : pds) { AbstractManagedAttribute a = fromPropertyDescriptor(pd, obj); if (a != null) { result.put(a.getName(), a); } } return result; } }
/** {@inheritDoc} */ public MBeanInfo getMBeanInfo() { List<MBeanAttributeInfo> l = new ArrayList<MBeanAttributeInfo>(); for (AbstractManagedAttribute aa : attributes.values()) { try { l.add(aa.getInfo()); } catch (IntrospectionException e) { // /CLOVER:OFF throw new IllegalStateException(e);// don't test // /CLOVER:ON } } List<MBeanOperationInfo> lo = new ArrayList<MBeanOperationInfo>(); for (AbstractManagedOperation op : ops.values()) { try { lo.add(op.getInfo()); } catch (IntrospectionException e) { // /CLOVER:OFF throw new IllegalStateException(e);// don't test // /CLOVER:ON } } return new MBeanInfo(name, description, l.toArray(new MBeanAttributeInfo[0]), null, lo .toArray(new MBeanOperationInfo[0]), null); }