[ 
https://issues.apache.org/jira/browse/FELIX-222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478103
 ] 

Clement Escoffier commented on FELIX-222:
-----------------------------------------

In my mind, the difference between ManagedServiceFactory & ManagedService is 
that the first one create instances (i.e. service provider) while the second 
one configure an existing instance. In iPOJO, the difference is when the 
updated method is called. On a ManagedServiceFactory targetting an existing 
instance, the instance is killed and recreated with the new configuration. When 
the updated method is called on the ManagedService, the instance is not 
stopped, the new configuration is apply "on the fly".

I does not know this details about the config admin. That means, that iPOJO 
cannot expose ManagedService if the is parent factory is exposed. I don't have 
a solution on the shelf, we can do the following items :
First, I need to ask on the osgi-dev mailing list if the propagation must or 
must not be implemented, or if it can be enable/disable.
Secondly, the configurable="true" should propagate the received (instance) 
configuration to service registration. (Perhaps should we change configurable 
in propagation). It keeps the problem of the instance recreation.

If you see another stategy, it is welcome.

> iPOJO should automatically propagate configuration properties as service 
> properties, per CM spec.
> -------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-222
>                 URL: https://issues.apache.org/jira/browse/FELIX-222
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>         Environment: Not relevant.
>            Reporter: Steven E. Harris
>
> The Configuration Admin Service Specification advises in Section 104.4.3, 
> Property Propagation, that:
>   An implementation of a Managed Service should copy all the properties of 
> the Dictionary object
>   argument in updated(Dictionary), known or unknown, into its service 
> registration properties
>   using ServiceRegistration.setProperties.
> It looks like iPOJO does some of this propagation for a ManagedService in 
> ConfigurationHandler.updated() around line 256, apparently only propagating 
> the properties not known as "configurable properties". However, I think this 
> reading of the specification may be too literal, in that iPOJO does not do 
> the same propagation of the initial properties provided to a 
> ManagedServiceFactory.
> ComponentManager implements ManagedServiceFactory. In its updated(String, 
> Dictionary) method, it calls on createComponentInstance(), which then calls 
> on InstanceManager.configure(), which lets each Handler take its turn 
> configuring the new instance. Of particular interest here is 
> ProvidedServiceHandler.configure(). It only exposes properties defined in 
> <property> elements inside the <provides> element of a component metadata 
> specification. Any properties provided in the initial configuration not 
> defined beforehand in the metadata are ignored and not published as service 
> properties.
> The CM specification does note:
>   A configuration target service may ignore any configuration properties it
>   does not recognize, or it may change the values of the configuration 
> properties
>   before these properties are registered. Configuration properties in the
>   Framework service registry are not strictly related to the configuration
>   information.
> This seems to contradict the advice in the first paragraph, perhaps just 
> clarifying that compliance is not mandatory. What would be useful is some 
> directive on the <provides> element that would allow all unknown 
> configuration properties to be propagated as service properties. At present, 
> this propagation must be done manually by defining each service property 
> under the <provides> element, which makes it impossible to ever propagate an 
> unknown configuration property.
> Finally, though the CM specification does talk about "a Managed Service" and 
> mentions the single-argument updated(Dictionary) method, the rest of the text 
> in Section 104.4.3 sounds as though it's describing how both ManagedService 
> and ManagedServiceFactory should work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to