|
Re: Way to update configuration values set by OSGI-INF/metatype/xxx.xml using class interface [message #1652649 is a reply to message #1651585] |
Fri, 06 March 2015 00:06 |
David Woodard Messages: 420 Registered: July 2014 |
Senior Member |
|
|
Hello,
I am not sure I understand your question. Let me explain what is happening and maybe that will help. The values defined in the OSGI-INF/metatype/*.xml file are part of the OSGi Metatype Service specification. They are accessed along with the ComponentContext when the bundle starts or is updated. For example, your bundle would have these methods:
private static Map<String, Object> m_properties;
protected void activate(ComponentContext ctx, Map<String, Object> properties) {
m_properties = properties;
}
protected void updated(ComponentContext ctx, Map<String, Object> properties) {
m_properties = properties;
}
When you click "Apply" with the web UI, you are using the ConfigurationService [1] to update the selected bundle. The values displayed on the web form come from the metatype XML file. So, if you are trying to update a bundle without the web UI, I would take a look at the ConfigurationService updateConfiguration method.
[1] http://download.eclipse.org/kura/releases/1.1.0/docs/apidocs/org/eclipse/kura/configuration/ConfigurationService.html
Thanks,
--Dave
|
|
|
|
|
|
Re: Way to update configuration values set by OSGI-INF/metatype/xxx.xml using class interface [message #1700822 is a reply to message #1656559] |
Tue, 07 July 2015 12:52 |
Marco Balzarin Messages: 22 Registered: May 2015 |
Junior Member |
|
|
Sorry if i resume this old topic, but also i'm trying to use the ConfigurationService. I have followed step by step the previous post of Alessandro, but seems that in my bundle something is missing, because OSGi is not able to inject this service.
In the OSGi console, if i run the "ls" command, my bundle is indicated as "unsatisfied". Pasted below is the output of "comp" command on the bundle in question:
Dynamic information :
*The component is NOT satisfied
The following references are not satisfied:
Reference[name = ConfigurationService, interface = org.eclipse.kura.configuration.ConfigurationService, policy = static, cardinality = 1..1, target = null, bind = setConfigurationService, unbind = unsetConfigurationService]
What can i do?
|
|
|
|
Re: Way to update configuration values set by OSGI-INF/metatype/xxx.xml using class interface [message #1701073 is a reply to message #1701049] |
Thu, 09 July 2015 08:14 |
Marco Balzarin Messages: 22 Registered: May 2015 |
Junior Member |
|
|
Yes, the only bundle marked as unsatisfied is the one that tries to get injected the configuration service. The only exceptions that i found on the Kura log files, are several NullPointerException occurred when the bundle have tried to use the ConfigurationService (which is null becouse not initialized by OSGi).
I'm not pasting my source code and my service.xml becaouse are exactly the same posted by Alessandro.
I don't know, maybe am i missing some dependencies? In my manifest, i'm importing both the packages org.eclipse.kura.configuration and org.eclipse.kura.core.configuration..
[Updated on: Thu, 09 July 2015 08:15] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.19906 seconds