|
Page Edited :
FELIX :
Injecting the bundle context
Injecting the bundle context has been edited by Clement Escoffier (Apr 05, 2008). Content:Injecting the bundle context in a POJOIt is sometimes useful to inject the bundle context in your POJO. Then, your POJO is able to deal with the OSGi environment as regular OSGi applications. It is possible to a POJO to get its bundle context. A POJO can receive its bundle context as an argument of its constructor. The next code snippet shows an example: public class ASimplePOJO{ private BundleContext context; public ASimplePOJO(BundleContext bc) { context = bc; // do something... }} As you see on the previous snippet, the bundle context is injected in the POJO. Then the POJO can use it as a 'normal' bundle context. The POJO code can:
|
Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request
Unsubscribe or edit your notifications preferences
Unsubscribe or edit your notifications preferences
