3.1.1.3.6 Inheritance and Merging of Configuration Settings
The configuration system supports configuration settings inheritance along the configuration path.
Configuration properties defined at ancestral configuration paths will be automatically inherited to child paths. The value of configuration property that is defined at the ancestral configuration path closest to the requested configuration path will be used. If a configuration property of configuration element is not defined on the current configuration path level nor defined anywhere on any of the ancestral paths, then the default value from the configuration schema will be used.
The configuration system also supports configuration collection inheritance and merging along the configuration path. Configuration collection elements from ancestral configuration paths are inherited to child configuration paths. New collection elements can be added on child paths. Existing collection elements inherited from parent nodes can be deleted. All collection elements inherited from a parent can be deleted by using the clear collection element. The configuration schema doesn’t support default collections. If collection is not configured directly on the requested configuration path nor on any of the parent configuration paths, it will be empty.
The exact merging rules are as follows:
First, the configuration system will check schema to determine if collection supports append or prepend semantics.
If it is append, then collection elements from child node will always be listed after its parent's collection elements.
In the case of prepend merge, the collection elements from child node will be listed before its parent's collection elements.
The configuration system will walk the full configuration path from the root down.
For each path, it will read locally defined collection elements.
It will clear all the elements from parent if a clear directive is detected.
It will remove all the elements flagged with the remove directive.
It will add elements of add type to the end of the element list in the case of append merge, or to the beginning of the list in the case of prepend merge.
It will fail if it detects a duplicate entry. The configuration schema contains information about which configuration property or set of properties are to be unique.
A merged configuration element for a given configuration path is a composite of all configuration properties and collection elements defined on the given configuration path, parent paths, or the default value in the configuration schema. These inheritance and merging rules are used for calculation of merged configuration elements.