Java Code Examples for javax.management.ObjectName#getKeyPropertyList()
The following examples show how to use
javax.management.ObjectName#getKeyPropertyList() .
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: JMXAccessControlList.java From activemq-artemis with Apache License 2.0 | 6 votes |
public boolean isInWhiteList(ObjectName objectName) { TreeMap<String, Access> domainMap = whitelist.get(objectName.getDomain()); if (domainMap != null) { if (domainMap.containsKey("")) { return true; } Hashtable<String, String> keyPropertyList = objectName.getKeyPropertyList(); for (Map.Entry<String, String> keyEntry : keyPropertyList.entrySet()) { String key = normalizeKey(keyEntry.getKey() + "=" + keyEntry.getValue()); for (Access accessEntry : domainMap.values()) { if (accessEntry.getKeyPattern().matcher(key).matches()) { return true; } } } } return false; }
Example 2
Source File: ConfiguredDomains.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
ObjectName getMirroredObjectName(ObjectName name) { String domain = name.getDomain(); String mirroredDomain = null; if (domain.equals(legacyDomain)) { mirroredDomain = exprDomain; } else if (domain.equals(exprDomain)) { mirroredDomain = legacyDomain; } if (mirroredDomain == null) { return null; } try { return new ObjectName(mirroredDomain, name.getKeyPropertyList()); } catch (MalformedObjectNameException e) { throw new RuntimeException(e); } }
Example 3
Source File: JMXAccessControlList.java From activemq-artemis with Apache License 2.0 | 6 votes |
public List<String> getRolesForObject(ObjectName objectName, String methodName) { TreeMap<String, Access> domainMap = domainAccess.get(objectName.getDomain()); if (domainMap != null) { Hashtable<String, String> keyPropertyList = objectName.getKeyPropertyList(); for (Map.Entry<String, String> keyEntry : keyPropertyList.entrySet()) { String key = normalizeKey(keyEntry.getKey() + "=" + keyEntry.getValue()); for (Access accessEntry : domainMap.values()) { if (accessEntry.getKeyPattern().matcher(key).matches()) { return accessEntry.getMatchingRolesForMethod(methodName); } } } Access access = domainMap.get(""); if (access != null) { return access.getMatchingRolesForMethod(methodName); } } return defaultAccess.getMatchingRolesForMethod(methodName); }
Example 4
Source File: CassandraTest.java From spectator with Apache License 2.0 | 5 votes |
private JmxData timer(String props, int i) throws Exception { ObjectName name = new ObjectName("org.apache.cassandra.metrics:" + props); Map<String, String> stringAttrs = new HashMap<>(name.getKeyPropertyList()); stringAttrs.put("EventType", "calls"); stringAttrs.put("LatencyUnit", "MICROSECONDS"); stringAttrs.put("RateUnit", "SECONDS"); Map<String, Number> numAttrs = new HashMap<>(); numAttrs.put("OneMinuteRate", 100.0 + i); numAttrs.put("FiveMinuteRate", 500.0 + i); numAttrs.put("FifteenMinuteRate", 1500.0 + i); numAttrs.put("MeanRate", 987.0 + i); numAttrs.put("Count", 1000 + i); numAttrs.put("Min", 10 + i); numAttrs.put("Max", 9000 + i); numAttrs.put("Mean", 1000 + i); numAttrs.put("StdDev", 10 + i); numAttrs.put("50thPercentile", 5000.0 + i); numAttrs.put("75thPercentile", 7500.0 + i); numAttrs.put("95thPercentile", 9500.0 + i); numAttrs.put("99thPercentile", 9900.0 + i); numAttrs.put("999thPercentile", 9990.0 + i); return new JmxData(name, stringAttrs, numAttrs); }
Example 5
Source File: Repository.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 6
Source File: Repository.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 7
Source File: ModelControllerMBeanHelper.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
ObjectNameMatchResourceAction(ObjectName baseName) { this.baseName = baseName; this.properties = baseName == null ? Collections.<String, String>emptyMap() : baseName.getKeyPropertyList(); try { this.domainOnlyName = baseName == null ? null : ObjectName.getInstance(baseName.getDomain() + ":*"); } catch (MalformedObjectNameException e) { throw new IllegalStateException(e); } this.propertyListPattern = baseName != null && baseName.isPropertyListPattern(); }
Example 8
Source File: Repository.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 9
Source File: Repository.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 10
Source File: Repository.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 11
Source File: Repository.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 12
Source File: Repository.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 13
Source File: DataSource.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * Creates the ObjectName for the ConnectionPoolMBean object to be registered * @param original the ObjectName for the DataSource * @return the ObjectName for the ConnectionPoolMBean * @throws MalformedObjectNameException */ public ObjectName createObjectName(ObjectName original) throws MalformedObjectNameException { String domain = ConnectionPool.POOL_JMX_DOMAIN; Hashtable<String,String> properties = original.getKeyPropertyList(); String origDomain = original.getDomain(); properties.put("type", "ConnectionPool"); properties.put("class", this.getClass().getName()); if (original.getKeyProperty("path")!=null || properties.get("context")!=null) { //this ensures that if the registration came from tomcat, we're not losing //the unique domain, but putting that into as an engine attribute properties.put("engine", origDomain); } ObjectName name = new ObjectName(domain,properties); return name; }
Example 14
Source File: Repository.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 15
Source File: DataSource.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * Creates the ObjectName for the ConnectionPoolMBean object to be registered * @param original the ObjectName for the DataSource * @return the ObjectName for the ConnectionPoolMBean * @throws MalformedObjectNameException */ public ObjectName createObjectName(ObjectName original) throws MalformedObjectNameException { String domain = ConnectionPool.POOL_JMX_DOMAIN; Hashtable<String,String> properties = original.getKeyPropertyList(); String origDomain = original.getDomain(); properties.put("type", "ConnectionPool"); properties.put("class", this.getClass().getName()); if (original.getKeyProperty("path")!=null || properties.get("context")!=null) { //this ensures that if the registration came from tomcat, we're not losing //the unique domain, but putting that into as an engine attribute properties.put("engine", origDomain); } ObjectName name = new ObjectName(domain,properties); return name; }
Example 16
Source File: Repository.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 17
Source File: Repository.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 18
Source File: Repository.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Builds a new ObjectNamePattern object from an ObjectName pattern. * @param pattern The ObjectName pattern under examination. **/ public ObjectNamePattern(ObjectName pattern) { this(pattern.isPropertyListPattern(), pattern.isPropertyValuePattern(), pattern.getCanonicalKeyPropertyListString(), pattern.getKeyPropertyList(), pattern); }
Example 19
Source File: JmxUtils.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Append an additional key/value pair to an existing {@link ObjectName} with the key being * the static value {@code identity} and the value being the identity hash code of the * managed resource being exposed on the supplied {@link ObjectName}. This can be used to * provide a unique {@link ObjectName} for each distinct instance of a particular bean or * class. Useful when generating {@link ObjectName ObjectNames} at runtime for a set of * managed resources based on the template value supplied by a * {@link org.springframework.jmx.export.naming.ObjectNamingStrategy}. * @param objectName the original JMX ObjectName * @param managedResource the MBean instance * @return an ObjectName with the MBean identity added * @throws MalformedObjectNameException in case of an invalid object name specification * @see org.springframework.util.ObjectUtils#getIdentityHexString(Object) */ public static ObjectName appendIdentityToObjectName(ObjectName objectName, Object managedResource) throws MalformedObjectNameException { Hashtable<String, String> keyProperties = objectName.getKeyPropertyList(); keyProperties.put(IDENTITY_OBJECT_NAME_KEY, ObjectUtils.getIdentityHexString(managedResource)); return ObjectNameManager.getInstance(objectName.getDomain(), keyProperties); }
Example 20
Source File: ObjectNameAddressUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 3 votes |
/** * Straight conversion from an ObjectName to a PathAddress. * * There may not necessarily be a Resource at this path address (if that correspond to a pattern) but it must * match a model in the registry. * * @param domain the name of the caller's JMX domain * @param registry the root resource for the management model * @param name the ObjectName to convert * * @return the PathAddress, or {@code null} if no address matches the object name */ static PathAddress toPathAddress(String domain, ImmutableManagementResourceRegistration registry, ObjectName name) { if (!name.getDomain().equals(domain)) { return PathAddress.EMPTY_ADDRESS; } if (name.equals(ModelControllerMBeanHelper.createRootObjectName(domain))) { return PathAddress.EMPTY_ADDRESS; } final Hashtable<String, String> properties = name.getKeyPropertyList(); return searchPathAddress(PathAddress.EMPTY_ADDRESS, registry, properties); }