brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <>
Subject [GitHub] brooklyn-server pull request #440: BROOKLYN-345: persist brooklyn.parameters...
Date Fri, 02 Dec 2016 09:08:06 GMT
Github user ahgittin commented on a diff in the pull request:
    --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/
    @@ -374,15 +374,45 @@ protected ConfigInheritance getDefaultConfigInheritance() {
          * Searches for config keys in the type, additional interfaces and the implementation
(if specified)
         private Collection<FlagConfigKeyAndValueRecord> findAllFlagsAndConfigKeyValues(EntitySpec<?>
spec, ConfigBag bagFlags) {
    +        // Matches the bagFlags against the names used in brooklyn.parameters, entity
    +        // and entity fields with `@SetFromFlag`.
    +        //
    +        // Returns all config keys / flags that match things in bagFlags, including duplicates.
    +        // For example, if a configKey in Java is re-declared in YAML `brooklyn.parameters`,
    +        // then we'll get two records.
    +        //
    +        // Make some effort to have these returned in the right order. That is very important
    +        // because they are added to the `EntitySpec.configure(key, val)`. If there is
    +        // a key in `EntitySpec.config`, then the put will replace the value and leave
the key
    +        // as-is (so the default-value and description of the key will remain as whatever
    +        // first put said).
    +        // TODO We should remove duplicates, rather than just doing the `put` multiple
    +        // relying on ordering. We should also respect the ordered returned by 
    +        // EntityDynamicType.getConfigKeys, which is much better (it respects `BasicConfigKeyOverwriting`

    +        // etc).
    +        // 
    +        // However, that is hard/fiddly because of the way a config key can be referenced
    +        // its real name or flag-name.
    +        // 
    +        // I wonder if this is fundamentally broken (and I really do dislike our informal
    +        // of aliases). Consider a configKey with name A and alias B. The bagFlags could
    +        // {A: val1, B: val2}. There is no formal definition of which takes precedence.
We'll add 
    +        // both to the entity's configBag, without any warning - it's up to the `config().get()`

    +        // method to then figure out what to do. It gets worse if there is also a ConfigKey
    +        // name "B" the "val2" then applies to both!
    +        //
    +        // I plan to propose a change on dev@brooklyn, to replace `@SetFromFlag`!
             Set<FlagConfigKeyAndValueRecord> allKeys = MutableSet.of();
    --- End diff --
    agree -- applying in #462

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message