Let me reverse the question: what would be a newer/better way and how should that be implemented. I mean I can see somebody writing a whiteboard style handler and donating it to (for example) Felix. Is that what you would like, or??
On 09 Oct 2014, at 9:02 am, Bulu <[email protected]> wrote: > Hello Marcel > Yes I already knew the standard way you describe. I just wanted to clarify > whether a newer/better method existed. > > Thanks again for your answer. > Philipp > > On 08.10.2014 11:24, Marcel Offermans wrote: >> 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] >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

