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 (JIRA)" <ji...@apache.org> on 2017/03/05 23:32:32 UTC

[jira] [Resolved] (TAMAYA-252) Use PropertyValue also as SPI for listing of properties in a PropertySource

     [ https://issues.apache.org/jira/browse/TAMAYA-252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anatole Tresch resolved TAMAYA-252.
-----------------------------------
    Resolution: Fixed

> Use PropertyValue also as SPI for listing of properties in a PropertySource
> ---------------------------------------------------------------------------
>
>                 Key: TAMAYA-252
>                 URL: https://issues.apache.org/jira/browse/TAMAYA-252
>             Project: Tamaya
>          Issue Type: Improvement
>          Components: API, Core
>    Affects Versions: 0.2-incubating
>            Reporter: Anatole Tresch
>            Assignee: Anatole Tresch
>            Priority: Critical
>              Labels: API, Meta-Values, Multi-Values
>             Fix For: 0.3-incubating
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> As of now accessing multiple properties (aka the Map) from a {{PropertySource}} returns {{Map<String,String>}}. This has several drawbacks:
> * When combining maps from multiple sources it may not always be clear, which properties belong to which source, especially when meta-properties are added as well. This quite probably ends up in  mix of meta-properties.
> * The exact formatting of meta-properties can be delayed as well, since with {{PropertyValue}} a multi-value capable abstraction is already in place.
> * Similarly combining values from multiple property sources is simpler because it is possible to more easily add meta-data entries, which may be necessary, e.g. when evaluating collection entries.
> * This also allows evaluation of the raw values (single or all) to be extracted into a separate SPI: This could be added transparently as a core SPI, so the API is not affected here.
> The disadvantage is that this change *breaks the current PropertySource interface*. Similarly it is also useful to adapt *PropertyValueCombinationPolicy and PropertyFilter* to operate on {{PropertyValue·}} instead of {{Map<String,String}}.
> Proposed API change:
> *Old:*
> {noformat}
> public interface PropertySource{
>   [...]
>   Map<String,String> getProperties();
> }
> public interface PropertyValueCombinationPolicy{
>   Map<String,String> collect(Map<String,String> currentValue, String key, 
>                                               PropertySource propertySource);
> }
> public interface PropertyFilter{
>   String filterProperty(String value, FilterContext context);
> }
> {noformat}
> *New:*
> {noformat}
> public interface PropertySource{
>   [...]
>   Map<String,PropertyValue> getProperties();
> }
> public interface PropertyFilter{
>   PropertyValue filterProperty(PropertyValue value, FilterContext context);
> }
> public interface PropertyValueCombinationPolicy{
>   PropertyValue collect(PropertyValue currentValue, String key, 
>                                      PropertySource propertySource);
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)