Package javax.management

Examples of javax.management.AttributeList


        }
    }

    public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException {
        AbstractName abstractName = toAbstractName(name);
        AttributeList set = new AttributeList(attributes.size());
        for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
            Attribute attribute = (Attribute) iterator.next();
            String attributeName = attribute.getName();
            Object attributeValue = attribute.getValue();
            try {
                kernel.setAttribute(abstractName, attributeName, attributeValue);
                set.add(attribute);
            } catch (NoSuchAttributeException e) {
                // ignored - caller will see value was not set because this attribute will not be in the attribute list
            } catch (GBeanNotFoundException e) {
                throw (InstanceNotFoundException)new InstanceNotFoundException(name.getCanonicalName()).initCause(e);
            } catch (InternalKernelException e) {
View Full Code Here


            throw new ReflectionException(e);
        }
    }

    public AttributeList getAttributes(String[] attributes) {
        AttributeList results = new AttributeList(attributes.length);
        for (int i = 0; i < attributes.length; i++) {
            String name = attributes[i];
            try {
                Object value = getAttribute(name);
                results.add(new Attribute(name, value));
            } catch (JMException e) {
                log.warn("Exception while getting attribute " + name, e);
            }
        }
        return results;
View Full Code Here

        }
        return results;
    }

    public AttributeList setAttributes(AttributeList attributes) {
        AttributeList results = new AttributeList(attributes.size());
        for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
            Attribute attribute = (Attribute) iterator.next();
            try {
                setAttribute(attribute);
                results.add(attribute);
            } catch (JMException e) {
                log.warn("Exception while setting attribute " + attribute.getName(), e);
            }
        }
        return results;
View Full Code Here

        }
        throw new AttributeNotFoundException( "Cannot find " + attributeName + " attribute " );
    }

    public AttributeList getAttributes(String[] attributeNames) {
        AttributeList resultList = new AttributeList();
        if ( attributeNames.length == 0 ) return resultList;
        for ( int i = 0; i < attributeNames.length; i++ ) {
            try {
                Object value = getAttribute( attributeNames[i] );
                resultList.add( new Attribute( attributeNames[i],
                                               value ) );
            } catch ( Exception e ) {
                e.printStackTrace();
            }
        }
View Full Code Here

                                                 ReflectionException {
        throw new AttributeNotFoundException( "No attribute can be set in this MBean" );
    }

    public AttributeList setAttributes(AttributeList attributes) {
        return new AttributeList();
    }
View Full Code Here

  public abstract void setAttribute(Object o, Attribute attribute)
      throws AttributeNotFoundException, InvalidAttributeValueException,
      MBeanException, ReflectionException;
 
  public AttributeList getAttributes(Object o, String[] attributes) {
    AttributeList list = new AttributeList();
        for (String name : attributes) {
      try {
        Object value = getAttribute(o, name);
              if (value != null)
                  list.add(new Attribute(name, value));
      } catch (Exception e) {
      }
        }
        return list;
  }
View Full Code Here

        return list;
  }

  public AttributeList setAttributes(Object o, AttributeList attributes) {
    Attribute[] attrs = (Attribute[]) attributes.toArray(new Attribute[0]);
        AttributeList retlist = new AttributeList();
        for (Attribute attr : attrs) {
            String name = attr.getName();
            Object value = attr.getValue();
            try {
              setAttribute(o, attr);
                retlist.add(new Attribute(name, value));
            } catch (Exception e) {
      }
        }
        return retlist;
  }
View Full Code Here

            throw new MBeanException(e);
        }
    }

    public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException {
        AttributeList attributeList = new AttributeList(attributes.length);
        for (int i = 0; i < attributes.length; i++) {
            String attribute = attributes[i];
            try {
                Object value = kernel.getAttribute(name, attribute);
                attributeList.add(i, new Attribute(attribute, value));
            } catch (NoSuchAttributeException e) {
                // ignored - caller will simply find no value
            } catch (GBeanNotFoundException e) {
                throw new InstanceNotFoundException(name.getCanonicalName());
            } catch (InternalKernelException e) {
View Full Code Here

            throw new MBeanException(e);
        }
    }

    public AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException {
        AttributeList set = new AttributeList(attributes.size());
        for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
            Attribute attribute = (Attribute) iterator.next();
            String attributeName = attribute.getName();
            Object attributeValue = attribute.getValue();
            try {
                kernel.setAttribute(name, attributeName, attributeValue);
                set.add(attribute);
            } catch (NoSuchAttributeException e) {
                // ignored - caller will see value was not set because this attribute will not be in the attribute list
            } catch (GBeanNotFoundException e) {
                throw new InstanceNotFoundException(name.getCanonicalName());
            } catch (InternalKernelException e) {
View Full Code Here

    }

    public void testGetAttributes() throws Exception
    {
        ConcreteMBean mbean = new ConcreteMBean();
        AttributeList list = mbean.getAttributes(new String[]
        { "attribute1", "attribute2" });
        assertEquals("value1", ((Attribute) list.get(0)).getValue());
        assertEquals("value2", ((Attribute) list.get(1)).getValue());
    }
View Full Code Here

TOP

Related Classes of javax.management.AttributeList

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.