felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.W. Janssen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-5355) Allow to use properties having dots with configuration proxies
Date Wed, 28 Sep 2016 17:46:20 GMT

    [ https://issues.apache.org/jira/browse/FELIX-5355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15530356#comment-15530356

J.W. Janssen commented on FELIX-5355:

[~djencks]: I wasn't aware of a OSGi standard aside from DS specifying how things should be
I'm not sure I see your point in the metatype annotations: if you generate it *based* on the
DM configuration type, then the naming of those properties shouldn't be of any issue? 

> Allow to use properties having dots with configuration proxies
> --------------------------------------------------------------
>                 Key: FELIX-5355
>                 URL: https://issues.apache.org/jira/browse/FELIX-5355
>             Project: Felix
>          Issue Type: Improvement
>          Components: Dependency Manager
>    Affects Versions: org.apache.felix.dependencymanager-r8
>            Reporter: Pierre De Rop
>            Assignee: Pierre De Rop
>            Priority: Minor
>             Fix For: org.apache.felix.dependencymanager-r9
>         Attachments: FELIX-5355.patch
> Recently, a new feature has been introduced in DM to allow injecting type-safe configuration
proxies when a ConfigurationDependency is used (see FELIX-5177).
> The principle is to deduce the name of a given property from a corresponding method name
of the configuration proxy interface.
> However, in some cases, you have some component depending on some configuration with
properties having some dots ("."), and this character can't be used in java methods. Of course,
the properties can be renamed to new names without dots, but in some cases, when you want
to use configuration proxies on some legacy components, you often can't modify the existing
configuration properties.
> So, I would like to propose the attached patch which allows the support of dots in properties.
the patch does the same done by DS: it maps the "\_" charater to ".". And if the property
contains "\_" character, then you can use a double "__" underscore:
> For example, assuming you have the two properties in the configuration:
> {code}
> foo.param1=123
> foo_param2=456
> {code}
> then you can use the following method names:
> {code}
>     public interface MyConfig {
>         public String getFoo_param1(); // maps to "foo.param1"
>         public String getFoo__param2(); // maps to "foo_param2"
>    }
> {code}
> Is there any objections if I commit the attached patch ?
> thanks.

This message was sent by Atlassian JIRA

View raw message