brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #462: Inherit config default values
Date Mon, 13 Feb 2017 12:51:46 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/462#discussion_r100786370
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
---
    @@ -397,48 +397,83 @@ protected ConfigInheritance getDefaultRuntimeInheritance() {
     
             final InheritanceContext context = InheritanceContext.RUNTIME_MANAGEMENT;
             ConfigInheritance currentInheritance = ConfigInheritances.findInheritance(queryKey,
context, getDefaultRuntimeInheritance());
    -        
    +
             BasicConfigValueAtContainer<TContainer, Object> last = null;
    -        
    +
             while (c!=null) {
                 Maybe<Object> v = getRawValueAtContainer(c, queryKey);
                 BasicConfigValueAtContainer<TContainer, Object> next = new BasicConfigValueAtContainer<TContainer,
Object>(c, getKeyAtContainer(c, queryKey), v);
    -            
    +
                 if (last!=null && !currentInheritance.considerParent(last, next,
context)) break;
    -            
    +
                 ConfigInheritance currentInheritanceExplicit = ConfigInheritances.findInheritance(next.getKey(),
InheritanceContext.RUNTIME_MANAGEMENT, null);
                 if (currentInheritanceExplicit!=null) {
                     if (count>0 && !currentInheritanceExplicit.isReinheritable(next,
context)) break;
                     currentInheritance = currentInheritanceExplicit;
                 }
    -            
    +
                 if (next.isValueExplicitlySet()) result.add(0, next);
     
                 last = next;
                 c = getParentOfContainer(c);
                 count++;
             }
    -        
    +
             return result;
         }
    -    
    -    @Override
    +
    +    @Override @Deprecated
         public Set<ConfigKey<?>> findKeys(Predicate<? super ConfigKey<?>>
filter) {
    +        return findKeys(filter, KeyFindingMode.PRESENT_NOT_RESOLVED);
    +    }
    +
    +    @Override
    +    public Set<ConfigKey<?>> findKeysDeclared(Predicate<? super ConfigKey<?>>
filter) {
    +        return findKeys(filter, KeyFindingMode.DECLARED_OR_PRESENT);
    +    }
    +
    +    @Override
    +    public Set<ConfigKey<?>> findKeysPresent(Predicate<? super ConfigKey<?>>
filter) {
    +        return findKeys(filter, KeyFindingMode.PRESENT_BUT_RESOLVED);
    +    }
    +
    +    protected enum KeyFindingMode { DECLARED_OR_PRESENT, PRESENT_BUT_RESOLVED, PRESENT_NOT_RESOLVED
}
    --- End diff --
    
    agree


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message