From the spec: "A FrameworkListener object is registered with the Framework
using the BundleContext.addFrameworkListener method.”
So it is not whiteboard-style (it pre-dates the whiteboard pattern afaik).
In DM I would do:
in the init:
dm.add(createComponent().setImplementation(Comp.class));
and then the component:
public class Comp implements FrameworkListener {
private volatile BundleContext m_context;
public void start() {
m_context.addFrameworkListener(this);
}
public void stop() {
m_context.removeFrameworkListener(this);
}
// implement the FrameworkListener methods here
}
of course it would also be possible to create a whiteboard style handler for
this (just like one exists to handle Servlets for HttpService)…
Greetings, Marcel
On 8 Oct 2014 at 10:06:01 , Bulu ([email protected]) wrote:
Hello all
I'm declaring a component using DM which gets created when all
dependencies are met. This component should also get notified of
framework events and thus implements FrameworkListener.
Does the OSGi framework also use a whiteboard pattern for delivering
these events, meaning I only need to publish my component as a
FrameworkListener.class service and it will get called by the framework
when needed?
If not, is there an elegant way of registering it using DM?
Thanks & regards
Philipp
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]