PropertySimple findOverrideForMetric(MetricTemplate def, PropertyList overrides) { for (Property p : overrides.getList()) { PropertyMap map = (PropertyMap) p; String metricName = map.getSimpleValue(METRIC_NAME_PROPERTY, null); String resourceTypeName = map.getSimpleValue(RESOURCE_TYPE_NAME_PROPERTY, null); String resourceTypePlugin = map.getSimpleValue(RESOURCE_TYPE_PLUGIN_PROPERTY, null); PropertySimple updateSchedules = map.getSimple(UPDATE_SCHEDULES_PROPERTY); if (metricName == null || resourceTypeName == null || resourceTypePlugin == null || updateSchedules == null) { continue; } if (metricName.equals(def.getMetricName()) && resourceTypeName.equals(def.getResourceTypeName()) && resourceTypePlugin.equals(def.getResourceTypePlugin())) { return updateSchedules; } } return null; } }
protected AugeasNode getExistingChildNodeForListMemberPropertyMap(AugeasNode parentNode, PropertyDefinitionList propDefList, PropertyMap propMap) { String mapKey = getListMemberMapKey(propDefList); if (mapKey != null) { String existingChildNodeName = propMap.getSimple(mapKey).getStringValue(); AugeasNode existingChildNode = new AugeasNode(parentNode, existingChildNodeName); return (this.augeas.exists(existingChildNode.getPath())) ? existingChildNode : null; } else { return null; } }
/** * Note, this only supports editing existing appenders; adding or removing appenders is not supported, since the * underlying JVM mBean (LoggingMXBean) does not support it. * * @param report the report which will contain the results of the requested update */ @Override public void updateResourceConfiguration(ConfigurationUpdateReport report) { PropertyList list = report.getConfiguration().getList("AppenderList"); LoggingMXBean logging = getEmsBean().getProxy(LoggingMXBean.class); for (Property property : list.getList()) { PropertyMap map = (PropertyMap) property; String name = map.getSimple("name").getStringValue(); String level = map.getSimple("level").getStringValue(); if ((level != null) && !level.equals(getLoggerLevel(logging, name))) { try { logging.setLoggerLevel(name, level); } catch (IllegalArgumentException iae) { report.setErrorMessage("Error setting logger level: " + iae.getMessage()); } } } report.setStatus(ConfigurationUpdateStatus.SUCCESS); } }
for (Property prop2 : pl.getList()) { PropertyMap propMap2 = (PropertyMap) prop2; String itemName = propMap2.getSimple(namePropLocator).getStringValue(); if (itemName == null) { throw new IllegalArgumentException("Map contains no entry with name [" + namePropLocator + "]"); for (Property prop2 : pl.getList()) { PropertyMap propMap2 = (PropertyMap) prop2; String itemName = propMap2.getSimple(namePropLocator).getStringValue(); String errorMessage = propMap2.getErrorMessage(); boolean contains = existingPropnames.contains(itemName);