// =============================================================================== // Lookup methods private boolean matches( MBeanPolicyConfig pConfig, JmxRequest.Type pType, ObjectName pName, String pValue) { Set<String> values = pConfig.getValues(pType, pName); if (values == null) { ObjectName pattern = pConfig.findMatchingMBeanPattern(pName); if (pattern != null) { values = pConfig.getValues(pType, pattern); } } return values != null && (values.contains(pValue) || wildcardMatch(values, pValue)); }
private void extractMBeanPolicy(MBeanPolicyConfig pConfig, Node pMBeanNode) throws MalformedObjectNameException { NodeList params = pMBeanNode.getChildNodes(); String name = null; Set<String> readAttributes = new HashSet<String>(); Set<String> writeAttributes = new HashSet<String>(); Set<String> operations = new HashSet<String>(); for (int k = 0; k < params.getLength(); k++) { Node param = params.item(k); if (param.getNodeType() != Node.ELEMENT_NODE) { continue; } assertNodeName(param, "name", "attribute", "operation"); String tag = param.getNodeName(); if (tag.equals("name")) { if (name != null) { throw new SecurityException("<name> given twice as MBean name"); } else { name = param.getTextContent().trim(); } } else if (tag.equals("attribute")) { extractAttribute(readAttributes, writeAttributes, param); } else if (tag.equals("operation")) { operations.add(param.getTextContent().trim()); } else { throw new SecurityException("Tag <" + tag + "> invalid"); } } if (name == null) { throw new SecurityException("No <name> given for <mbean>"); } pConfig.addValues(new ObjectName(name), readAttributes, writeAttributes, operations); }