Interface InheritedConfigurationDescription

  • All Superinterfaces:
    Serializable

    public interface InheritedConfigurationDescription
    extends Serializable
    This interface resembles a ChangeableConfigurationDescription but extends it by the means for inheritance. This allows to build hierarchies of configuration descriptions that inherit and override configuration entries. The inheritance of configuration descriptions is based on the inheritance of the corresponding entities of the activity model, for instance Operations and ExecutableComponentDescriptions. Since an InheritedConfigurationDescription has a slightly different semantic due to the inheritance and is only used in the activity model, it is separated from the ConfigurationDescription -class-hierarchy.
    Configuration entries are identified by their name, therefore this is also the base for inheritance. For overriding an entry set it appropriately. This will only apply to this configuration description and to its child configuration descriptions. To remove an entry for child configuration descriptions use removeInheritedEntry(String) which sets the corresponding entry to null. This way the entry becomes undefined. Undefining an entry is different from removing the entry for this configuration description which removes the overriding and inherits the value again.

    When overriding, only the description, and the restrictions may be changed. Additionally, an optional entry may be set to mandatory - but not vice versa. Only optional entries may be overridden.
    The name of an entry cannot be changed (directly) since the name identifies an entry. To rename an entry anyway, remove the entry with the old name and add the entry again as complete object with the new name.

    Author:
    Ulrich Kreher
    • Field Detail

      • serialVersionUID

        static final long serialVersionUID
        Generated ID for serialisation.
        See Also:
        Constant Field Values
    • Method Detail

      • getEntry

        ConfigurationDescription.ConfigurationEntry getEntry​(String entryName)
        Returns the configuration entry with the designated name or null if no entry with that name exists.
        Parameters:
        entryName - The name of the configuration entry to return.
        Returns:
        The configuration entry or null if no entry with that name exists.
      • getEntries

        Map<String,​ConfigurationDescription.ConfigurationEntry> getEntries()
        Gets a map containing all entries for this configuration description indexed by the name of the entry ( ConfigurationDescription.ConfigurationEntry.getName()). This name is also the key to retrieve the value from the appropriate Configuration.
        Since this configuration description is subject of inheritance, the map may contain inherited entries, so isEntryInherited(String) should be called to skip them if necessary. The map may contain null values (i.e. there is an entry name without ConfigurationEntry); this allows to prevent entries from being inherited. This is of course only allowed for non-optional entries.
        Returns:
        The entries for this configuration description indexed by their corresponding names.
      • setEntry

        void setEntry​(ConfigurationDescription.ConfigurationEntry entry)
        Adds or updates the designated configuration entry to/of this description. The value may then be set in the corresponding configuration or in a child configuration. This entry applies to this configuration description and its children.
        When changing the type or the restrictions of a configuration entry, the corresponding configuration needs to be checked whether a configuration value is provided. If it is not valid any more, it will have to be removed.

        A configuration entry is identified by its name, therefore if an entry with the designated name already exists, an update will be performed, otherwise a new entry will be created. The name must neither be null nor the empty string.

        Parameters:
        entry - The new or changed configuration entry for this description. Whether it is new or updated depends on the name of the entry. When updating the type or restrictions of the entry, configuration values of the corresponding configurations may be removed. This must not have null or the empty string as name.
      • removeEntry

        void removeEntry​(String name)
        Removes the entry with the designated name from this configuration description that overrides an entry from a parent entity. Afterwards the entry is inherited again. This will also apply if the designated entry is removed by this configuration description; this will be inherited completely afterwards. The removal applies to this configuration description and its children.
        Calling this method will have no effects if the entry with the designated name is already inherited.
        Parameters:
        name - The name of the configuration entry to remove from this configuration description and to inherit from a parent entity again. This must neither be null nor the empty string.
      • isEntryInherited

        boolean isEntryInherited​(String entryName)
        Gets whether the entry with the designated name is inherited from the parent configuration description, that is this configuration description does not override the entry with the designated name of a parent entity.
        Parameters:
        entryName - The name of the configuration entry to check whether it is overridden by this configuration description. This must neither be null nor the empty string.
        Returns:
        Whether the configuration entry with the designated name is inherited from a parent entity or it is provided by this configuration description.
      • isOverridingEntry

        boolean isOverridingEntry​(String entryName)
        Gets whether the configuration entry with the designated name is actually overriding the value from a parent description. This is only the case when an entry is present both in this description and in any parent description. I.e. this method is not simply negating the return value of isEntryInherited(String).
        Parameters:
        entryName - The name of the configuration entry to check whether it is overridden by this description. This must neither be null nor the empty string.
        Returns:
        Whether the configuration entry with the designated name is overriding the one from a parent entity.
      • overrideEntry

        void overrideEntry​(ConfigurationDescription.ConfigurationEntry entry)
        Overrides an entry of the parent configuration description with the designated one. The corresponding entry has to exist in the parent configuration description; entries are identified by name.
        Only the description, and the restrictions may be changed as well as an optional entry may be set to mandatory.
        Parameters:
        entry - The configuration entry providing new attributes for this description. The entry must exist in a parent configuration description and it may only override the description, restrictions and it may be set to non-optional.
      • removeInheritedEntry

        void removeInheritedEntry​(String entryName)
        Removes the entry with the designated name for the child entities, that is, the entry is overridden and set to null. The corresponding entry has to exist in the parent configuration description and it has to be optional.
        When removing the entry, one has also to remove the corresponding configuration value if it exists, that is, the configuration has to be overridden accordingly.
        Parameters:
        entryName - The name of the configuration entry that is removed for the child entities. The entry must exist in a parent configuration description and it must be optional.