felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: Embedding Felix
Date Wed, 05 Apr 2006 12:37:15 GMT
Bram de Kruijff wrote:
>  a few questions about embedding Felix into a 'larger' application. Hope
> I'm not offtopic? :)

Perfectly on topic.

> I am looking at starting and controlling a framework from another
> application. Starting is not an issue, but how to control it? For
> example let's asume that the containing application is
> org.apache.felix.main.Main. It can start the framework, but after that
> it has no control over it. At this point I would like to be able to have
> access to it to maybe install some bundles, access services, restart or
> shut it down. Knopflerfish provides access to the system bundle context,
> but with Felix there is no way to do this(?) 

Felix does provide access, just in a different way. The Felix.start() 
method allows you to pass in a list of BundleActivator instances, which 
effectively become part of the system bundle. When the system bundle is 
started it calls the start() method of all activator instances and 
likewise when the system bundle is stopped it calls the stop() method of 
all activator instances.

The activator instances passed into the Felix constructor will receive 
the system bundle's context.

> Must/should/could/would Felix support direct access by making the system
> bundle context accesible?

Yes. :-)

> What alternatives should I consider? Maybe a seperate management
> service, but how to locate/access it in a standard J2SE enviroment? JMX?

It is probably always better to try to create your app as standard 
bundles, since it will then run on any OSGi framework; however, 
sometimes embedding the framework into your app just makes more sense.

One of the goals of Felix is to be easily embedded, which is why Felix 
tries not to depend on globals (e.g., system properties) and tries to 
multiplex shared resources (e.g., URL stream handler factory).

Much work remains in this area. In the future, we will investigate other 
ways of improving embeddability of Felix, but it already is pretty 
reasonable now.

-> richard

View raw message