Java Code Examples for javax.management.AttributeList#iterator()

The following examples show how to use javax.management.AttributeList#iterator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MX4JModelMBean.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes)
{
   if (attributes == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_ATTRIBUTE_LIST_CANNOT_BE_NULL.toLocalizedString()));

   Logger logger = getLogger();

   AttributeList list = new AttributeList();
   for (Iterator i = attributes.iterator(); i.hasNext();)
   {
      Attribute attribute = (Attribute)i.next();
      String name = attribute.getName();
      try
      {
         setAttribute(attribute);
         list.add(attribute);
      }
      catch (Exception x)
      {
         if (logger.isEnabledFor(Logger.TRACE)) logger.trace("setAttribute for attribute " + name + " failed", x);
         // And go on with the next one
      }
   }
   return list;
}
 
Example 2
Source File: BaseModelMBean.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Set the values of several attributes of this MBean.
 *
 * @param attributes THe names and values to be set
 *
 * @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;
    
    // Prepare and return our response, eating all exceptions
    String names[] = new String[attributes.size()];
    int n = 0;
    Iterator<?> items = attributes.iterator();
    while (items.hasNext()) {
        Attribute item = (Attribute) items.next();
        names[n++] = item.getName();
        try {
            setAttribute(item);
        } catch (Exception e) {
            // Ignore all exceptions
        }
    }

    return (getAttributes(names));

}
 
Example 3
Source File: BaseModelMBean.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Set the values of several attributes of this MBean.
 *
 * @param attributes THe names and values to be set
 *
 * @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;
    
    // Prepare and return our response, eating all exceptions
    String names[] = new String[attributes.size()];
    int n = 0;
    Iterator<?> items = attributes.iterator();
    while (items.hasNext()) {
        Attribute item = (Attribute) items.next();
        names[n++] = item.getName();
        try {
            setAttribute(item);
        } catch (Exception e) {
            // Ignore all exceptions
        }
    }

    return (getAttributes(names));

}
 
Example 4
Source File: BaseModelMBean.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Set the values of several attributes of this MBean.
 *
 * @param attributes THe names and values to be set
 *
 * @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;

    // Prepare and return our response, eating all exceptions
    String names[] = new String[attributes.size()];
    int n = 0;
    Iterator<?> items = attributes.iterator();
    while (items.hasNext()) {
        Attribute item = (Attribute) items.next();
        names[n++] = item.getName();
        try {
            setAttribute(item);
        } catch (Exception e) {
            // Ignore all exceptions
        }
    }

    return getAttributes(names);

}
 
Example 5
Source File: MX4JModelMBean.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes)
{
   if (attributes == null) throw new RuntimeOperationsException(new IllegalArgumentException(LocalizedStrings.MX4JModelMBean_ATTRIBUTE_LIST_CANNOT_BE_NULL.toLocalizedString()));

   Logger logger = getLogger();

   AttributeList list = new AttributeList();
   for (Iterator i = attributes.iterator(); i.hasNext();)
   {
      Attribute attribute = (Attribute)i.next();
      String name = attribute.getName();
      try
      {
         setAttribute(attribute);
         list.add(attribute);
      }
      catch (Exception x)
      {
         if (logger.isEnabledFor(Logger.TRACE)) logger.trace("setAttribute for attribute " + name + " failed", x);
         // And go on with the next one
      }
   }
   return list;
}
 
Example 6
Source File: OldMBeanServerTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 7
Source File: OldMBeanServerTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 8
Source File: OldMBeanServerTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 9
Source File: AbstractDynamicMBean.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Sets the values of several attributes of the Dynamic MBean, and returns the list of attributes
 * that have been set.
 */
public AttributeList setAttributes(final AttributeList attributes) {

   // Check attributes is not null to avoid NullPointerException later on
   if (attributes == null) {
      throw new RuntimeOperationsException(
              new IllegalArgumentException("AttributeList attributes cannot be null"),
              "Cannot invoke a setter of " + dClassName);
   }
   final AttributeList resultList = new AttributeList();

   // if attributeNames is empty, nothing more to do
   if (attributes.isEmpty()) {
      return resultList;
   }

   // for each attribute, try to set it and add to the result list if successfull
   for (Iterator i = attributes.iterator(); i.hasNext();) {
      final Attribute attr = (Attribute)i.next();
      try {
         setAttribute(attr);
         final String name = attr.getName();
         final Object value = getAttribute(name);
         resultList.add(new Attribute(name, value));
      } catch (Exception e) {
         e.printStackTrace();
      }
   }
   return resultList;
}
 
Example 10
Source File: AbstractDynamicMBean.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
  * Sets the values of several attributes of the Dynamic MBean, and returns the
  * list of attributes that have been set.
  */
 public AttributeList setAttributes(AttributeList attributes) {

   // Check attributes is not null to avoid NullPointerException later on
   if (attributes == null) {
     throw new RuntimeOperationsException(
                   new IllegalArgumentException("AttributeList attributes cannot be null"),
	    "Cannot invoke a setter of " + dClassName);
   }
   AttributeList resultList = new AttributeList();

   // if attributeNames is empty, nothing more to do
   if (attributes.isEmpty())
     return resultList;

   // for each attribute, try to set it and add to the result list if successfull
   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) {
e.printStackTrace();
     }
   }
   return(resultList);
 }
 
Example 11
Source File: OldMBeanServerTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 12
Source File: OldMBeanServerTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 13
Source File: OldMBeanServerTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 14
Source File: OldMBeanServerTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 15
Source File: OldMBeanServerTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 16
Source File: OldMBeanServerTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 17
Source File: OldMBeanServerTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 18
Source File: OldMBeanServerTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 19
Source File: OldMBeanServerTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
Example 20
Source File: OldMBeanServerTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}