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]
>