cschneider / Karaf-Tutorial

http://cschneider.github.io/Karaf-Tutorial/
Apache License 2.0
271 stars 305 forks source link

How can I get BundleChanged being called from BundleListener interface? #45

Closed laurentkvb closed 6 years ago

laurentkvb commented 6 years ago

Hello again,

I am trying to implement the BundleListener interface to retrieve bundle changes. I am trying to get it work, but my onChanged() method does not seem to get called. Maybe it is because it is not being implemented in an "Activator" class. I have no clue.

I would like to get the latest bundle changes because I want to develop an application where bundles can be installed as plugins at runtime. I thought by using the BundleListener interface, I could sort of authorize the Bundles that can be installed in my Apache Karaf environment.

Excerpt from Blueprint.xml

<bean id="MyBundleListener" class="com.hallo.service.MyBundleListener"/>

My class

public class MyBundleListener implements BundleListener {

@Override
public void bundleChanged(BundleEvent event) {
    System.out.println("Hello World MyBundleListener ");
}

}