Package javax.management

Examples of javax.management.AttributeList


            throw new RuntimeOperationsException
                (new IllegalArgumentException("Attribute names list is null"),
                 "Attribute names list is null");

        // Prepare our response, eating all exceptions
        AttributeList response = new AttributeList();
        for (int i = 0; i < names.length; i++) {
            try {
                response.add(new Attribute(names[i],getAttribute(names[i])));
            } catch (Exception e) {
                // Not having a particular attribute in the response
                // is the indication of a getter problem
            }
        }
View Full Code Here


     *
     * @return The list of attributes that were set and their new values
     */
    @Override
    public AttributeList setAttributes(AttributeList attributes) {
        AttributeList response = new AttributeList();

        // Validate the input parameters
        if (attributes == null)
            return response;
       
View Full Code Here

      throw new RuntimeOperationsException(
    new IllegalArgumentException(
      "Null attribute list passed to setAttributes()"));
        }
 
  AttributeList resultList = new AttributeList();

  if (attributes.isEmpty())  {
      return resultList;
  }

  for (Iterator i = attributes.iterator(); i.hasNext();) {
      Attribute attr = (Attribute) i.next();

      try  {
    setAttribute(attr);
    String name = attr.getName();
    Object value = getAttribute(name);
    resultList.add(new Attribute(name, value));
      } catch (Exception e)  {
          String tmp = "MBean "
        + getMBeanName()
        + ": Problem encountered while setting attribute "
        + attr.getName()
View Full Code Here

      "MBean "
      + getMBeanName()
      + ": Null attribute list passed to getAttributes()"));
        }

  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)  {
          String tmp = "MBean "
        + getMBeanName()
        + ": Problem encountered while getting attribute "
        + attributeNames[i]
View Full Code Here

    }

    /* ------------------------------------------------------------ */
    public AttributeList getAttributes(String[] names)
    {
        AttributeList results = new AttributeList(names.length);
        for (int i = 0; i < names.length; i++)
        {
            try
            {
                results.add(new Attribute(names[i], getAttribute(names[i])));
            }
            catch (Exception e)
            {
                Log.warn(Log.EXCEPTION, e);
            }
View Full Code Here

    /* ------------------------------------------------------------ */
    public AttributeList setAttributes(AttributeList attrs)
    {
        Log.debug("setAttributes");

        AttributeList results = new AttributeList(attrs.size());
        Iterator iter = attrs.iterator();
        while (iter.hasNext())
        {
            try
            {
                Attribute attr = (Attribute) iter.next();
                setAttribute(attr);
                results.add(new Attribute(attr.getName(), getAttribute(attr.getName())));
            }
            catch (Exception e)
            {
                Log.warn(Log.EXCEPTION, e);
            }
View Full Code Here

        this.worker = Executors.newScheduledThreadPool(1).scheduleWithFixedDelay(new Runnable()
        {
            @Override
            public void run()
            {
                final AttributeList attrList;
                try {
                    attrList = mbeanConn.getAttributes(mbeanName, attrNames);
                    final LinkedHashMap<String, Object> data = new LinkedHashMap<String, Object>();

                    log.debug(String.format("Found %d data points", attrList.size()));

                    for (Object attrObj : attrList) {
                        Attribute attr = (Attribute) attrObj;

                        data.put(attr.getName(), attr.getValue());
View Full Code Here

            Set<ObjectName> names = connection.queryNames(new ObjectName(name), query);
            HashMap<String, AttributeList> map = new HashMap<String, AttributeList>();
            for(ObjectName n : names) {
                String objname = n.getCanonicalName();
                String[] attrnames = getMBeanAttributeNames(n);
                AttributeList attrs = connection.getAttributes(n, attrnames);
                map.put(objname, attrs);
            }
            return map;
        }
        catch(Exception e) {
View Full Code Here

            Set<ObjectName> names = connection.queryNames(new ObjectName(name), query);
            HashMap<String, AttributeList> map = new HashMap<String, AttributeList>();
            for(ObjectName n : names) {
                String objname = n.getCanonicalName();
                String[] attrnames = getMBeanAttributeNames(n);
                AttributeList attrs = connection.getAttributes(n, attrnames);
                map.put(objname, attrs);
            }
            return map;
        }
        catch(Exception e) {
View Full Code Here

        }
    }

    public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException {
        AbstractName abstractName = toAbstractName(name);
        AttributeList attributeList = new AttributeList(attributes.length);
        for (int i = 0; i < attributes.length; i++) {
            String attribute = attributes[i];
            try {
                Object value = kernel.getAttribute(abstractName, attribute);
                attributeList.add(i, new Attribute(attribute, value));
            } catch (NoSuchAttributeException e) {
                // ignored - caller will simply find no value
            } catch (GBeanNotFoundException e) {
                throw (InstanceNotFoundException)new InstanceNotFoundException(name.getCanonicalName()).initCause(e);
            } catch (InternalKernelException e) {
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.