You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tamaya.apache.org by Anatole Tresch <an...@apache.org> on 2014/12/29 17:59:15 UTC
Priority and different override policies / Filtering
Whereas overrides are simple with this mechanism. I am asking how we want
to do other aggregation types, or filtering of values.
*On the API side* filtering is always simple, since we have the functional
extension points (UnaryOperator<Configuration>), where we can easily filter
the whole configuration, and the adapters for filtering single entries on
access.
But let's assume the following use case:
*We have a system low level configuration S, which also contains a few
entries, I do not want to see on application config A. Given our priority
based assembly this is not possible, since I only can override the values
from my parent sources, but never remove them.*
Thinking on this the following ideas come to my mind:
1) *add PropertySource filters to my chain. I could use the same
priorities. The bad thing is that it is not clear if the filter should be
active also, when no source with a similar priority is active and if so if
it should be before or after, so this will not work.*
*2) I could define a PropertySource to be filtering, so it is able not only
to override, but also to remove entries. This "filter" can be activated or
deactivated depending on the current context. Given that (if we have set a
correct priority value), all works fine.*
*3) I could define a separate filter layer which is allowed to filter the
entries, before they are published (after all overrides were done). This
would probably be transparently be hooked into the "Configuration Layer",
which takes the current property sources and creates the final map of
properties. Then on the final Map the filter service is operating before
any data is handed out to the callers.*
I think (3) is the best solution here. Nevertheless we should think on how
this can be done the best way and how the SPI here would look like. Also I
think, we might have several filters active, e.g. one for logging, one for
admins, one which considers the current user's role (aka views), ...
So ideas are welcome ;)
Best,
Anatole