|
|
|
|
Re: Configure broker URL automatically [message #1747360 is a reply to message #1746805] |
Sun, 13 November 2016 13:43   |
Eclipse User |
|
|
|
Thank you for you answer.
Now I'm trying to deploy a simple web bundle which would receive the new MQTT configurations via REST and set it via ConfigurationService.
I'm looking at the org.eclipse.kura.web project as an example for this but trying a simplified approach. Unfortunately it looks like my bundles activate method is not called.
My OSGI-INF/web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
activate="activate"
configuration-policy="require"
deactivate="deactivate"
modified="updated"
name="my.project.RestConfigurator">
<implementation class="my.project.RestConfigurator"/>
<property name="servlet.alias.root" value="/configurator"/>
<reference name="HttpService"
bind="setHttpService"
unbind="unsetHttpService"
interface="org.osgi.service.http.HttpService"/>
<property name="app.root" type="String" value="/configurator"/>
<property name="service.pid" type="String" value="my.project.RestConfigurator"/>
<service>
<provide interface="my.project.RestConfigurator"/>
</service>
</scr:component>
MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: my.project
Bundle-SymbolicName: my.project;singleton:=true
Bundle-Version: 1.0.0.qualifier
Service-Component: OSGI-INF/*.xml
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: javax.servlet;version="2.6.0",
javax.servlet.http;version="2.6.0",
org.eclipse.kura.configuration;version="[1.0,2.0)",
org.eclipse.kura.configuration.metatype;version="[1.0,2.0)",
org.eclipse.kura.core.configuration;version="[1.0,2.0)",
org.eclipse.kura.core.configuration.metatype;version="[1.0,2.0)",
org.eclipse.kura.core.configuration.util;version="[1.0,2.0)",
org.eclipse.kura.core.net.util;version="[1.0,2.0)",
org.osgi.framework;version="1.7.0",
org.osgi.service.http,
org.slf4j;version="1.6.4"
I also have these methods in my activator class:
public void setHttpService(HttpService httpService) {
s_logger.info("Setting HttpService...");
this.m_httpService = httpService;
}
public void unsetHttpService(HttpService httpService) {
s_logger.info("Unsetting HttpService...");
this.m_httpService = null;
}
Does anyone have any idea what could cause that my activator method is not called (I know its not because I have a comment in the beginning of it)?
Also, the setHttpService method is not called...
[Updated on: Sun, 13 November 2016 13:44] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04867 seconds