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

Felix Meschberger updated FELIX-2961:
-------------------------------------

    Affects Version/s:     (was:  scr-1.6.0)
                       scr annotations 1.5.0
           Issue Type: New Feature  (was: Bug)
              Summary: @Component annotation should support defining the name 
with a compile time constant (instead of just a constant value)  (was: SCR & 
ConfigurationAdmin : service.pid resolution)

Hmm, I see.

First of all: Thanks for the elaborate test case ! This makes it really easy to 
follow up with what you have in mind.

Ok, a comment first: I think we should really log a warning (if not breaking on 
error) if a property with the name "component.name" is being defined. The 
reason is that this property will always be overwritten by the actual component 
name and thus may never be provided by the developer.

Now, I think this is really a request for a new feature of the @Component 
annotation. Thus changing the issue type, affected versions and summary.

> @Component annotation should support defining the name with a compile time 
> constant (instead of just a constant value)
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2961
>                 URL: https://issues.apache.org/jira/browse/FELIX-2961
>             Project: Felix
>          Issue Type: New Feature
>          Components: Declarative Services (SCR)
>    Affects Versions: scr annotations 1.5.0
>            Reporter: Andrei Pozolotin
>
> hello!
> when I use config admin to control instaniation of scr component services, I 
> use this pattern:
> // 1) in config source bundle:
>                       Configuration config = 
> configAdmin.getConfiguration("ZZZ", null);
>                       Dictionary<String, String> props = 
> config.getProperties();
>                       config.update(props);
> //  2) in config target bundle:
> @Service
> @Component(name = "AAA", policy = ConfigurationPolicy.REQUIRE, immediate = 
> true)
> public class BucketPlugin implements PluginSpaceService {
>       @Property(name = "service.pid")
>       protected static final String PID = "ZZZ";
> // 3) despite the fact service.pid "looks good" in xml for the tagret 
> compenent:
>     <scr:component enabled="true" immediate="true" name="AAA" 
> configuration-policy="require">
>         <implementation class="com.ddfplus.core.space.BucketPlugin"/>
>         <service servicefactory="false">
>             <provide interface="com.ddfplus.api.plugin.PluginSpaceService"/>
>         </service>
>         <property name="service.pid" type="String" value="ZZZ"/>
> // 4) the scr fails to initialize the component; intitialzation works only 
> when 
> (scr.component.name == config.service.pid) and NOT when (config.service.pid 
> == scr.component.property.pid)
> // 5) if I look on the the config target in console (when I do manage to 
> inititialize it),
> it shows that again, actual service.pid comes from scr.component.name and not 
> from scr.component.property.service.pid
> thank you.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to