You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "David Jencks (JIRA)" <ji...@apache.org> on 2019/04/18 20:55:00 UTC

[jira] [Closed] (FELIX-6105) [DS] SCR does not add the component bundle location to the Configuration objects

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

David Jencks closed FELIX-6105.
-------------------------------

> [DS] SCR does not add the component bundle location to the Configuration objects
> --------------------------------------------------------------------------------
>
>                 Key: FELIX-6105
>                 URL: https://issues.apache.org/jira/browse/FELIX-6105
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>            Reporter: Esin Yakub
>            Priority: Major
>
> The SCR runtime does not set the bundle location of the configuration consuming component to the Configuration object. This is the case in the ManagedService-s and makes them more resilient to any external actions.
> With Felix SCR currently if you have a component requiring a configuration PID (the component is activated successfully) and you get the configuration PID using the ConfigurationAdmin service without specifying "null" for the bundle location you will end up sending a ConfigurationEvent.CM_LOCATION_CHANGED event which in hand will trigger a component destruction.
> Sample service:
> {code:java}
> import org.osgi.service.component.annotations.Activate;
> import org.osgi.service.component.annotations.Component;
> import org.osgi.service.component.annotations.ConfigurationPolicy;
> import org.osgi.service.component.annotations.Deactivate;
> @Component(
>         configurationPid = "com.softwareag.dummy.pid",
>         configurationPolicy = ConfigurationPolicy.REQUIRE,
>         immediate = true)
> public class Dummy{
>     @Activate
>     public void activate() {
>         System.out.println("Dummy is active");
>     }
>     @Deactivate
>     public void deactivate() {
>         System.out.println("Dummy is deactivated");
>     }
> }
> {code}
> Sample snippet for consumer:
> {code:java}
> ...
> Configuration ssoConf = configAdmin.getConfiguration("com.softwareag.dummy.pid");
> System.out.println("Bundle location for the dummy configuration is: " + ssoConf.getBundleLocation());
> }
> {code}
> If the bundle location in the configuration is null the second snippet sets the bundle location and deactivates the component.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)