felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bulu <b...@romandie.com>
Subject Re: Dependency Manager: registering FrameworkListener
Date Thu, 09 Oct 2014 07:02:41 GMT
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 (bulu@romandie.com) 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message