Java Code Examples for javax.management.ObjectName#getKeyPropertyListString()
The following examples show how to use
javax.management.ObjectName#getKeyPropertyListString() .
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: MetricCollector.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * Returns the list of labels and their values of each metric, which are the key properties of mBeans * * @param mBeanName Bean name * @return Map of key properties and their values */ private LinkedHashMap<String, String> getKeyPropertyList( Map<ObjectName, LinkedHashMap<String, String>> keyPropertiesPerBean, ObjectName mBeanName) { LinkedHashMap<String, String> keyProperties = keyPropertiesPerBean.get(mBeanName); if (keyProperties == null) { keyProperties = new LinkedHashMap<>(); String properties = mBeanName.getKeyPropertyListString(); Matcher match = PROPERTY_PATTERN.matcher(properties); while (match.lookingAt()) { keyProperties.put(match.group(1), match.group(2)); properties = properties.substring(match.end()); if (properties.startsWith(",")) { properties = properties.substring(1); } match.reset(properties); } keyPropertiesPerBean.put(mBeanName, keyProperties); } return keyProperties; }
Example 2
Source File: JmxMBeanPropertyCache.java From soul with Apache License 2.0 | 6 votes |
/** * Gets key property list. * * @param mbeanName the mbean name * @return the key property list */ public Map<String, String> getKeyPropertyList(final ObjectName mbeanName) { Map<String, String> keyProperties = keyPropertiesPerBean.get(mbeanName); if (keyProperties == null) { keyProperties = new LinkedHashMap<>(); String properties = mbeanName.getKeyPropertyListString(); Matcher match = PROPERTY_PATTERN.matcher(properties); while (match.lookingAt()) { keyProperties.put(match.group(1), match.group(2)); properties = properties.substring(match.end()); if (properties.startsWith(",")) { properties = properties.substring(1); } match.reset(properties); } keyPropertiesPerBean.put(mbeanName, keyProperties); } return keyProperties; }
Example 3
Source File: JmxScraper.java From hawkular-agent with Apache License 2.0 | 6 votes |
static LinkedHashMap<String, String> getKeyPropertyList(ObjectName mbeanName) { // Implement a version of ObjectName.getKeyPropertyList that returns the // properties in the ordered they were added (the ObjectName stores them // in the order they were added). LinkedHashMap<String, String> output = new LinkedHashMap<String, String>(); String properties = mbeanName.getKeyPropertyListString(); Matcher match = PROPERTY_PATTERN.matcher(properties); while (match.lookingAt()) { output.put(match.group(1), match.group(2)); properties = properties.substring(match.end()); if (properties.startsWith(",")) { properties = properties.substring(1); } match.reset(properties); } return output; }
Example 4
Source File: JmxMBeanPropertyCache.java From jmx_exporter with Apache License 2.0 | 6 votes |
public LinkedHashMap<String, String> getKeyPropertyList(ObjectName mbeanName) { LinkedHashMap<String, String> keyProperties = keyPropertiesPerBean.get(mbeanName); if (keyProperties == null) { keyProperties = new LinkedHashMap<String, String>(); String properties = mbeanName.getKeyPropertyListString(); Matcher match = PROPERTY_PATTERN.matcher(properties); while (match.lookingAt()) { keyProperties.put(match.group(1), match.group(2)); properties = properties.substring(match.end()); if (properties.startsWith(",")) { properties = properties.substring(1); } match.reset(properties); } keyPropertiesPerBean.put(mbeanName, keyProperties); } return keyProperties; }
Example 5
Source File: MBeans.java From javamelody with Apache License 2.0 | 4 votes |
private List<MBeanNode> getMBeanNodes() throws JMException { final List<MBeanNode> result = new ArrayList<MBeanNode>(); final Set<ObjectName> names = mbeanServer.queryNames(null, null); for (final ObjectName name : names) { final String domain = name.getDomain(); if ("jboss.deployment".equals(domain)) { // la partie "jboss.deployment" dans JBoss (5.0.x) est plutôt inutile et trop lourde continue; } MBeanNode domainNode = getMBeanNodeFromList(result, domain); if (domainNode == null) { domainNode = new MBeanNode(domain); result.add(domainNode); } final String keyPropertyListString = name.getKeyPropertyListString(); final String firstPropertyValue; final int indexOf = keyPropertyListString.indexOf('='); if (indexOf == -1) { // n'arrive probablement pas, mais au cas où firstPropertyValue = null; } else { firstPropertyValue = name .getKeyProperty(keyPropertyListString.substring(0, indexOf)); } MBeanNode firstPropertyNode = getMBeanNodeFromList(domainNode.getChildren(), firstPropertyValue); if (firstPropertyNode == null) { firstPropertyNode = new MBeanNode(firstPropertyValue); domainNode.getChildren().add(firstPropertyNode); } try { final MBeanNode mbean = getMBeanNode(name); firstPropertyNode.getChildren().add(mbean); } catch (final IllegalStateException e) { // for JBoss EAP 6 (#757) continue; } } sortMBeanNodes(result); return result; }