/** * Merge the content of the specified repository to this repository. * @param repository the repository to include */ public void include(ConfigurationMetadataRepository repository) { for (ConfigurationMetadataGroup group : repository.getAllGroups().values()) { ConfigurationMetadataGroup existingGroup = this.allGroups.get(group.getId()); if (existingGroup == null) { this.allGroups.put(group.getId(), group); } else { // Merge properties group.getProperties().forEach((name, value) -> putIfAbsent( existingGroup.getProperties(), name, value)); // Merge sources group.getSources().forEach((name, value) -> putIfAbsent(existingGroup.getSources(), name, value)); } } }
private ConfigurationMetadataGroup getGroup(ConfigurationMetadataSource source) { if (source == null) { ConfigurationMetadataGroup rootGroup = this.allGroups.get(ROOT_GROUP); if (rootGroup == null) { rootGroup = new ConfigurationMetadataGroup(ROOT_GROUP); this.allGroups.put(ROOT_GROUP, rootGroup); } return rootGroup; } return this.allGroups.get(source.getGroupId()); }
result.addAll(group.getProperties().values()); else if ("_ROOT_GROUP_".equals(group.getId())) { for (ConfigurationMetadataProperty property : group.getProperties().values()) { if (isWhiteListed(property, whiteListedProperties)) { result.add(property); for (ConfigurationMetadataProperty property : group.getProperties().values()) { if (isWhiteListed(property, whiteListedProperties)) { result.add(property);
/** * Register the specified {@link ConfigurationMetadataSource sources}. * @param sources the sources to add */ public void add(Collection<ConfigurationMetadataSource> sources) { for (ConfigurationMetadataSource source : sources) { String groupId = source.getGroupId(); ConfigurationMetadataGroup group = this.allGroups.get(groupId); if (group == null) { group = new ConfigurationMetadataGroup(groupId); this.allGroups.put(groupId, group); } String sourceType = source.getType(); if (sourceType != null) { putIfAbsent(group.getSources(), sourceType, source); } } }
/** * Return whether a configuration property group (class) has been white listed as * being a "main" group. */ private boolean isWhiteListed(ConfigurationMetadataGroup group, Collection<String> classes) { Set<String> sourceTypes = group.getSources().keySet(); return !sourceTypes.isEmpty() && classes.containsAll(sourceTypes); }
@Override public Map<String, ConfigurationMetadataProperty> getAllProperties() { Map<String, ConfigurationMetadataProperty> properties = new HashMap<>(); for (ConfigurationMetadataGroup group : this.allGroups.values()) { properties.putAll(group.getProperties()); } return properties; }
for (ConfigurationMetadataProperty property : group.getProperties().values()) { if (!isDeprecatedError(property)) { result.add(property); else if ("_ROOT_GROUP_".equals(group.getId())) { for (ConfigurationMetadataProperty property : group.getProperties().values()) { if (isWhiteListed(property, whiteListedProperties)) { if (!isDeprecatedError(property)) { for (ConfigurationMetadataProperty property : group.getProperties().values()) { if (isWhiteListed(property, whiteListedProperties)) { if (!isDeprecatedError(property)) {
/** * Return whether a configuration property group (class) has been white listed as * being a "main" group. */ private boolean isWhiteListed(ConfigurationMetadataGroup group, Collection<String> classes) { Set<String> sourceTypes = group.getSources().keySet(); return !sourceTypes.isEmpty() && classes.containsAll(sourceTypes); }
/** * Add a {@link ConfigurationMetadataProperty} with the * {@link ConfigurationMetadataSource source} that defines it, if any. * @param property the property to add * @param source the source */ public void add(ConfigurationMetadataProperty property, ConfigurationMetadataSource source) { if (source != null) { putIfAbsent(source.getProperties(), property.getId(), property); } putIfAbsent(getGroup(source).getProperties(), property.getId(), property); }
for (ConfigurationMetadataProperty property : group.getProperties().values()) { if (!isDeprecatedError(property)) { result.add(property); else if ("_ROOT_GROUP_".equals(group.getId())) { for (ConfigurationMetadataProperty property : group.getProperties().values()) { if (isWhiteListed(property, whiteListedProperties)) { if (!isDeprecatedError(property)) { for (ConfigurationMetadataProperty property : group.getProperties().values()) { if (isWhiteListed(property, whiteListedProperties)) { if (!isDeprecatedError(property)) {
/** * Return whether a configuration property group (class) has been white listed as being a "main" group. */ private boolean isWhiteListed(ConfigurationMetadataGroup group, Collection<String> classes) { Set<String> sourceTypes = group.getSources().keySet(); return !sourceTypes.isEmpty() && classes.containsAll(sourceTypes); }