/** {@inheritDoc} */ public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { findAttribute(attribute.getName()).setValue(attribute.getValue()); }
/** {@inheritDoc} */ public final AttributeList getAttributes(String[] attributes) { final AttributeList result = new AttributeList(attributes.length); for (String attrName : attributes) { try { final Object attrValue = getAttribute(attrName); result.add(new Attribute(attrName, attrValue)); } catch (Exception e) { // OK: attribute is not included in returned list, per spec } } return result; }
/** {@inheritDoc} */ public final AttributeList setAttributes(AttributeList attributes) { final AttributeList result = new AttributeList(attributes.size()); for (Object attrObj : attributes) { Attribute attr = (Attribute) attrObj; try { setAttribute(attr); result.add(new Attribute(attr.getName(), attr.getValue())); } catch (Exception e) { // OK: attribute is not included in returned list, per spec } } return result; } }
/** * Creates a {@link DynamicMBean} from the specified parameters. * * @param name * the name of the MBean * @param description * the description of the MBean * @param attributes * a Map of all attributes * @param ops * a Map of all operations * @return the newly created MBean */ public static DynamicMBean from(String name, String description, Map<String, AbstractManagedAttribute> attributes, Map<OperationKey, AbstractManagedOperation> ops) { return new MBean(name, description, attributes, ops); }
/** {@inheritDoc} */ public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { return findAttribute(attribute).getValue(); }