brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <>
Subject [GitHub] brooklyn-server pull request #340: ConfigMap refactor, respecting inheritanc...
Date Thu, 22 Sep 2016 11:27:49 GMT
Github user ahgittin commented on a diff in the pull request:
    --- Diff: core/src/main/java/org/apache/brooklyn/core/config/internal/
    @@ -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 {
    +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.
          * 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<?>,
    +    }
    +    protected AbstractConfigMapImpl(TContainer bo, Map<ConfigKey<?>, Object>
storage) {
    + = bo;
    --- End diff --
    agree, have added note to that effect, once we've removed deprecated fields eg `entity`
which may be needed to populate `bo`

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