felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Offermans <marcel.offerm...@luminis.nl>
Subject Re: Dependency Manager: registering FrameworkListener
Date Wed, 08 Oct 2014 09:24:29 GMT
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  


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message