FrameworkUtil.getBundle(Foo.class).getBundleContext(); Regards JB
On 11/09/2018 13:43, Miroslav Beranič wrote: > Hi all, > > some junior question, but would like to make it correct way. > > Is it possible and if it is, how - to get access to BundleContext ( and > other OSGi environment ) from some plain Java object ? > > for example > > there is an Activator or a Compontent ( class with annotation @Component > ) that has code like: > > MyClass inst = new MyClass(); > inst.doSomeAction(); > > How would it be possible to get access to BundleContext from inside of > the method doSomeAction() ? > > ( this is related to my Scheduler work - as I would need access to > BundleContext from inside of a Quartz job, job is executed later on some > day - and even Karaf restart can happen ) > > > Kind Regards, > Miroslav > > > > -- > Miroslav Beranič > MIBESIS > +386(0)40/814-843 > [email protected] <mailto:[email protected]> > http://www.mibesis.si -- Jean-Baptiste Onofré [email protected] http://blog.nanthrax.net Talend - http://www.talend.com
