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

Pierre De Rop updated FELIX-5355:
---------------------------------
    Description: 
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.


  was:
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.



> 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
(v6.3.4#6332)

Reply via email to