What is the best way to prepare a library to OSGi-compatible, but not force the 
use of OSGi (including forcing transitive dependencies)?

The library should be split into api / implementation and offered as a service, 
but it should be possible for those who do not use OSGi to obtain the 
implementation class from a factory. There should be no runtime dependency on 
the OSGi framework.

Are there any good examples out there that I could try to emulate?

If not, can anybody provide me with some advice?

My thought is to have:

 1. A public api package (for all cases)
 2. A private “factory” package (which for OSGi users would just be private and 
ignored, and for non-OSGi users would be the part of the library they would use 
to obtain the service class), and 
 3. An “internal” package that includes an Activator (in an OSGi environment 
this would provide the service implementation, for non-OSGi users it would be 

Thanks so much!!


OSGi Developer Mail List

Reply via email to