Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/340#discussion_r80092029
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
 ---
    @@ -20,65 +20,212 @@
     
     import java.util.Collections;
     import java.util.LinkedHashMap;
    +import java.util.List;
     import java.util.Map;
    +import java.util.Set;
     import java.util.concurrent.Future;
     
    +import javax.annotation.Nonnull;
    +import javax.annotation.Nullable;
    +
    +import org.apache.brooklyn.api.mgmt.ExecutionContext;
    +import org.apache.brooklyn.api.objs.BrooklynObject;
    +import org.apache.brooklyn.config.ConfigInheritance;
    +import org.apache.brooklyn.config.ConfigInheritances;
    +import 
org.apache.brooklyn.config.ConfigInheritances.BasicConfigValueAtContainer;
     import org.apache.brooklyn.config.ConfigKey;
    -import org.apache.brooklyn.config.ConfigMap;
     import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
    +import org.apache.brooklyn.config.ConfigMap.ConfigMapWithInheritance;
    +import org.apache.brooklyn.config.ConfigValueAtContainer;
    +import org.apache.brooklyn.core.config.BasicConfigInheritance;
    +import org.apache.brooklyn.core.config.ConfigKeys;
    +import org.apache.brooklyn.core.config.ConfigKeys.InheritanceContext;
    +import org.apache.brooklyn.core.config.Sanitizer;
     import org.apache.brooklyn.core.config.StructuredConfigKey;
    -import 
org.apache.brooklyn.core.entity.internal.ConfigMapViewWithStringKeys;
    +import org.apache.brooklyn.core.objs.BrooklynObjectInternal;
    +import org.apache.brooklyn.util.collections.MutableList;
    +import org.apache.brooklyn.util.collections.MutableMap;
    +import org.apache.brooklyn.util.collections.MutableSet;
    +import org.apache.brooklyn.util.core.config.ConfigBag;
     import org.apache.brooklyn.util.core.flags.TypeCoercions;
    +import org.apache.brooklyn.util.core.internal.ConfigKeySelfExtracting;
     import org.apache.brooklyn.util.core.task.DeferredSupplier;
    +import org.apache.brooklyn.util.exceptions.ReferenceWithError;
    +import org.apache.brooklyn.util.guava.Maybe;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
    -public abstract class AbstractConfigMapImpl implements ConfigMap {
    +import com.google.common.base.Function;
    +import com.google.common.base.Predicate;
    +import com.google.common.collect.Iterables;
    +
    +public abstract class AbstractConfigMapImpl<TContainer extends 
BrooklynObject> implements ConfigMapWithInheritance<TContainer> {
    +
    +    /*
    +     * Changed Sept 2016 so that keys can determine inheritance strategy 
at every level in the hierarchy,
    +     * and signifcantly refactored to share code among subclasses, adding 
Location as a subclass.
    +     */
     
         private static final Logger LOG = 
LoggerFactory.getLogger(AbstractConfigMapImpl.class);
         
    -    protected final ConfigMapViewWithStringKeys mapViewWithStringKeys = 
new ConfigMapViewWithStringKeys(this);
    +    @SuppressWarnings("deprecation")
    +    protected final transient 
org.apache.brooklyn.core.entity.internal.ConfigMapViewWithStringKeys 
mapViewWithStringKeys = new 
org.apache.brooklyn.core.entity.internal.ConfigMapViewWithStringKeys(this);
    +
    +    protected TContainer bo;
         
         /**
          * Map of configuration information that is defined at start-up time 
for the entity. These
          * configuration parameters are shared and made accessible to the 
"children" of this
          * entity.
          */
    -    protected Map<ConfigKey<?>,Object> ownConfig = 
Collections.synchronizedMap(new LinkedHashMap<ConfigKey<?>, Object>());
    +    protected final Map<ConfigKey<?>,Object> ownConfig;
    +    
    +    protected AbstractConfigMapImpl(TContainer bo) {
    +        // Not using ConcurrentMap, because want to (continue to) allow 
null values.
    +        // Could use ConcurrentMapAcceptingNullVals (with the associated 
performance hit on entrySet() etc).
    +        this(bo, Collections.synchronizedMap(new 
LinkedHashMap<ConfigKey<?>, Object>()));
    +    }
    +    protected AbstractConfigMapImpl(TContainer bo, Map<ConfigKey<?>, 
Object> storage) {
    +        this.bo = bo;
    +        this.ownConfig = storage;
    +    }
     
    +    public TContainer getContainer() {
    +        return bo;
    +    }
    +    
    +    protected final BrooklynObjectInternal getBrooklynObject() {
    +        return (BrooklynObjectInternal)bo;
    +    }
    +    
         public <T> T getConfig(ConfigKey<T> key) {
    -        return getConfig(key, null);
    +        return getConfigImpl(key, false).getWithoutError().get();
         }
         
         public <T> T getConfig(HasConfigKey<T> key) {
    -        return getConfig(key.getConfigKey(), null);
    +        return getConfigImpl(key.getConfigKey(), 
false).getWithoutError().get();
         }
         
    -    public <T> T getConfig(HasConfigKey<T> key, T defaultValue) {
    -        return getConfig(key.getConfigKey(), defaultValue);
    +    @Override
    +    public Maybe<Object> getConfigLocalRaw(ConfigKey<?> key) {
    +        return getConfigRaw(key, false);
    +    }
    +
    +    protected abstract ExecutionContext getExecutionContext(BrooklynObject 
bo);
    +    protected abstract void postLocalEvaluate(ConfigKey<?> key, 
BrooklynObject bo, Maybe<?> rawValue, Maybe<?> resolvedValue);
    --- End diff --
    
    oops that is a bug, must have deleted the call!  great spot


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

Reply via email to