You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by Valentin Aitken <va...@cloudsoftcorp.com> on 2016/05/24 19:40:43 UTC
Merge Map values in Location config
Hi all,
I'd like to bring to your attention a PR which I made about treating
location configuration
and in feature possibly Entity and other configurations.
https://github.com/apache/brooklyn-server/pull/151
I introduced a CollectionHelpersTest.mergeMapsAndTheirInnerMapValues(Map
aMap, Map bMap) method which can be used for other use cases as well.
It is a helper which extends the MutableMap#put(key, newValue) and
ConfigBag#putAll(ConfigBag newConfig) functionality.
It goes one level deeper and for the values which are of type Map it
merges the value from bMap to the corresponding Map value in aMap.
Check CollectionHelpersTest in the PR if I didn't explain well.
To achieve what I described in [1] for locations configuration I did the
following:
- modified the ConfigBag.newInstanceExtending(final ConfigBag configBag,
Map<?,?> optionalAdditionalValues)
which is used in JcloudsLocation#obtain and
FixedListMachineProvisioningLocation#obtain
- modified AbstractLocation#addToLocalBag(Map flags) to merge
provisioning.properties values instead overriding with values from there.
Can you please share your thoughts about this feature?
Best,
Valentin.
[1]
https://github.com/bostko/brooklyn-server/blob/d53da63f35cca594ecc16ef7c9c4fed4d231a97e/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java#L68-L93
Re: Merge Map values in Location config
Posted by Aled Sage <al...@gmail.com>.
Hi Valentin,
As per the discussion in you PR #151, I think this has been superseded
by the discussion in the thread "[PROPOSAL] merging config keys".
There is now a jira issue [1] and a PR [2] for it.
I'd appreciate through thoughts as to whether that PR meets your
requirements.
Aled
On 24/05/2016 20:40, Valentin Aitken wrote:
> Hi all,
>
> I'd like to bring to your attention a PR which I made about treating
> location configuration
> and in feature possibly Entity and other configurations.
>
> https://github.com/apache/brooklyn-server/pull/151
>
> I introduced a
> CollectionHelpersTest.mergeMapsAndTheirInnerMapValues(Map aMap, Map
> bMap) method which can be used for other use cases as well.
> It is a helper which extends the MutableMap#put(key, newValue) and
> ConfigBag#putAll(ConfigBag newConfig) functionality.
> It goes one level deeper and for the values which are of type Map it
> merges the value from bMap to the corresponding Map value in aMap.
> Check CollectionHelpersTest in the PR if I didn't explain well.
>
> To achieve what I described in [1] for locations configuration I did
> the following:
> - modified the ConfigBag.newInstanceExtending(final ConfigBag
> configBag, Map<?,?> optionalAdditionalValues)
> which is used in JcloudsLocation#obtain and
> FixedListMachineProvisioningLocation#obtain
> - modified AbstractLocation#addToLocalBag(Map flags) to merge
> provisioning.properties values instead overriding with values from there.
>
> Can you please share your thoughts about this feature?
>
> Best,
> Valentin.
>
> [1]
> https://github.com/bostko/brooklyn-server/blob/d53da63f35cca594ecc16ef7c9c4fed4d231a97e/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java#L68-L93
>