Hi Felix,

Thank you very much for this!

[  I regret that in my attempt to try to figure this out quickly I just 
double-posted on bndtools… Bad me! :-(  ]

So, you are confirming:
 * The first time getProperties() is called, it returns null (i.e. this is 
expected behaviour)
 * After update, getProperties() will only return the properties just set (i.e. 
this is expected behaviour)

So then, what is the right way to obtain the existing properties of a component 
(other than the ones I just set)? I was not successful when digging around the 
spec to find the answer.


Best,
=David




> On Sep 18, 2015, at 3:26 PM, Felix Meschberger <[email protected]> wrote:
> 
> Hi David
> 
>> Am 17.09.2015 um 11:29 schrieb David Leangen <[email protected]>:
>> 
>> 
>> Hi!
>> 
>> Using Felix SCR…
> 
> I think this is related to Felix Configuration Admin, though
> 
>> 
>> I am trying to obtain a component’s properties object by:
>> 
>> ConfigurationAdmin cm = {obtain the cm}
>> Configuration componentConfig = cm.getConfiguration( componentPid );
>> componentConfig.getProperties();
>> 
>> I can confirm that I am getting the correct Configuration object (when I add 
>> a property and update, it updates the component), however, I am getting a 
>> null result when I try to obtain the properties before doing an update, and 
>> an “incomplete” properties object after the update (containing only the 
>> service.pid property).
> 
> When calling getConfiguration for the first time for a given componentPid the 
> configuration is newly created and there are no properties. Which is why you 
> getProperties() returns null.
> 
> You have to first call update(Dictionary) to set the initial configuration. 
> After that getProperties() will return a Dictionary with the values just set.
> 
> Calling update() (the no arg variant) just causes the configuration to be 
> reloaded from persistence. Yet, for a new configuration which has never been 
> updated with update(Dictionary) this is essentially a no-op.
> 
> Mind you though: Calling getConfiguration(String) (the single argument 
> variant) binds the configuration to your calling bundle context. You might 
> want to consider using the getConfiguration(String pid, String 
> bundleLocation) variant to create a new configuration.
> 
> Regards
> Felix
> 
>> 
>> Am I misunderstanding what should happen? Or is my understanding correct, 
>> but I am for some reason not getting the correct result?
>> 
>> 
>> Thanks!
>> =David
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to