for (Iterator i = attributes.iterator(); i.hasNext();) { Attribute attr = (Attribute) i.next(); try {
@Override public AttributeList setAttributes(AttributeList attributes) { if (attributes == null) throw new RuntimeOperationsException(new IllegalArgumentException( "Attribute list cannot be null.")); 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; }
} else { StringBuffer buffer = new StringBuffer("\n"); for (Iterator ii = list.iterator(); ii.hasNext();) { Attribute a = (Attribute) ii.next(); buffer.append(a.getName());
public AttributeList setAttributes(AttributeList attributes) { Iterator iterator = attributes.iterator(); AttributeList newValues = new AttributeList(attributes.size()); while (iterator.hasNext()) { Attribute attribute = (Attribute) iterator.next(); try { setAttribute(attribute); } catch (Exception exc) { attribute = new Attribute(attribute.getName(), exc); } newValues.add(attribute); } return newValues; }
for (Iterator i = attributes.iterator(); i.hasNext();) { Attribute attr = (Attribute) i.next(); try {
/** * Retrieve the attribute of name name * @param name * @return the attribute of name name, or null if it does not exist in the metric */ public Attribute getAttribute(String name) { Attribute attRet = null; Iterator<?> it = attributes.iterator(); while (it.hasNext()) { Attribute att = (Attribute) it.next(); if (att.getName().equals(name)) { attRet = att; break; } } return attRet; }
public String stringify(Object o) { final AttributeList attrList = (AttributeList) o; final Iterator iter = attrList.iterator(); return (IteratorStringifier.stringify(iter, mDelim)); }
public String stringify(Object o) { final AttributeList attrList = (AttributeList) o; final Iterator iter = attrList.iterator(); return (IteratorStringifier.stringify(iter, mDelim)); }
/** * Sets the value of specified aAttributes of the Dynamic MBean. * @param aAttributes list of attribute names and values. * @return AttributeList list of attribute names and values */ public AttributeList setAttributes(AttributeList aAttributes) { for (Iterator it = aAttributes.iterator(); it.hasNext();) { Attribute attribute = (Attribute) it.next(); try { setAttribute(attribute); } catch (Exception e) { continue; } } return aAttributes; }
/** * Sets the value of specified aAttributes of the Dynamic MBean. * @param aAttributes list of attribute names and values. * @return AttributeList list of attribute names and values */ public AttributeList setAttributes(AttributeList aAttributes) { for (Iterator it = aAttributes.iterator(); it.hasNext();) { Attribute attribute = (Attribute) it.next(); try { setAttribute(attribute); } catch (Exception e) { continue; } } return aAttributes; }
public AttributeList setAttributes(AttributeList attributes) { for (Iterator it = attributes.iterator(); it.hasNext();) { Attribute attribute = (Attribute) it.next(); try { setAttribute(attribute); } catch (Exception e) { throw new RuntimeException("Error setting attribute: " + attribute, e); } } return attributes; }
/** * Sets the values of several attributes. Delegates the work to the method <code>setAttribute</code>. * * @see #setAttribute(Attribute) * @see DynamicMBean#setAttributes(AttributeList) */ public AttributeList setAttributes(AttributeList attributes) { logging.trace("setAttributes(" + attributes + ")"); @SuppressWarnings("rawtypes") Iterator it = attributes.iterator(); while (it.hasNext()) { try { setAttribute((Attribute) it.next()); } catch (Exception e) { logging.error(e); } } return null; }
/** * Print an AttributeList format of an mbean * * @param mbean - mbean to print */ public void printMBean(AttributeList mbean) { for (Iterator i = mbean.iterator(); i.hasNext();) { Attribute attrib = (Attribute)i.next(); if (attrib.getValue() instanceof ObjectName) { printMBean((ObjectName)attrib.getValue()); } else if (attrib.getValue() instanceof ObjectInstance) { printMBean((ObjectInstance)attrib.getValue()); } else { out.println(attrib.getName() + " = " + attrib.getValue().toString()); out.println(); } } }
/** * Print an AttributeList format of an mbean * * @param mbean - mbean to print */ public void printMBean(AttributeList mbean) { for (Iterator i = mbean.iterator(); i.hasNext();) { Attribute attrib = (Attribute)i.next(); if (attrib.getValue() instanceof ObjectName) { printMBean((ObjectName)attrib.getValue()); } else if (attrib.getValue() instanceof ObjectInstance) { printMBean((ObjectInstance)attrib.getValue()); } else { out.println(attrib.getName() + " = " + attrib.getValue().toString()); out.println(); } } }
@Override public AttributeList setAttributes(AttributeList attributes) { AttributeList result = new AttributeList(); Iterator<Object> iterator = attributes.iterator(); while (iterator.hasNext()) { Attribute att = (Attribute) iterator.next(); try { setAttribute(att); Attribute res = new Attribute(att.getName(), getAttribute(att.getName())); result.add(res); } catch (Exception e) { } } return result; }
/** * Print an AttributeList format of an mbean * * @param mbean - mbean to print */ public void printMBean(AttributeList mbean) { for (Iterator i = mbean.iterator(); i.hasNext();) { Attribute attrib = (Attribute)i.next(); if (attrib.getValue() instanceof ObjectName) { printMBean((ObjectName)attrib.getValue()); } else if (attrib.getValue() instanceof ObjectInstance) { printMBean((ObjectInstance)attrib.getValue()); } else { out.println(attrib.getName() + " = " + attrib.getValue().toString()); out.println(); } } }
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException { AttributeList list = (AttributeList)value; context.startElement(name, attributes); for (Iterator i = list.iterator(); i.hasNext();) { Attribute item = (Attribute)i.next(); context.serialize(Constants.QNAME_LITERAL_ITEM, null, item); } context.endElement(); }
public final AttributeList setAttributes(AttributeList attributes) { // Prepare and return our response, eating all exceptions String names[] = new String[attributes.size()]; int n = 0; Iterator<Object> 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); }
public final AttributeList setAttributes(AttributeList attributes) { // Prepare and return our response, eating all exceptions String names[] = new String[attributes.size()]; int n = 0; Iterator<Object> 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); }
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); } } return results; }