karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steinar Bang ...@dod.no>
Subject How's config connected to a bundle
Date Wed, 06 Dec 2017 19:43:27 GMT
How's karaf config connected to a bundle?

I tried matching on bundle name.  Ie. I have a bundle with symbolic-name
no.priv.bang.sonar.sonar-collector-webhook so I tried creating a config
with a PID identical to this, ie.
 config:edit no.priv.bang.sonar.sonar-collector-webhook
 config:property-set sonar.collector.jdbc.url "jdbc:postgresql:///sonarcollector"
 config:property-set sonar.collector.jdbc.user "karaf"
 config:update

but the resulting config isn't fed to a component in the bundle.  All I
get there, is the stuff sett in the attributes.

Ie. what I received in the activate method is this:
 {alias=/sonar-collector, component.name=no.priv.bang.sonar.collector.webhook.SonarCollectorServlet,
component.id=2}

I tried adding the pid like I found in this example:
 https://github.com/paremus/hello-examples/blob/37c9b2b1ac430227f0d92bf336be6cf5a59c079a/helloworld/helloworld-ds/src/main/java/com/example/hello/impl/GreetingImpl.java#L19
ie. like so:
 @Component(service={Servlet.class}, property={"alias=/sonar-collector"}, configurationPid
= "no.priv.bang.sonar.sonar-collector-webhook" )
 public class SonarCollectorServlet extends HttpServlet {
    ...
    @Activate
    public void activate(Map<String, Object> config) {
    ...
but that didn't help.

The config can be found but show up as without a null BundleLocation:
 karaf@root()> config:list "(service.pid=no.priv.bang.sonar.sonar-collector-webhook)"
 ----------------------------------------------------------------
 Pid:            no.priv.bang.sonar.sonar-collector-webhook
 BundleLocation: null
 Properties:
    service.pid = no.priv.bang.sonar.sonar-collector-webhook
    sonar.collector.jdbc.url = jdbc:postgresql:///sonarcollector
    sonar.collector.jdbc.user = karaf
 karaf@root()>

Would it have helped if my bundle had shown up in the BundleLocation?
What does it take to get a bundle there?

Thanks!


- Steinar


Mime
View raw message