The latest specifications did not add any API here to help you. For now
you would have to continue to use the reflection trick. At least now you
have API to get the bundle's actual class loader.
Tom
From: "Guillaume Sauthier (OW2)" <[email protected]>
To: OSGi Developer Mail List <[email protected]>,
Date: 01/11/2012 10:34 AM
Subject: [osgi-dev] Re: Weaving service
I know that we can use WovenClass.getBundleWiring().getClassLoader() to get
the CLassLoader of the Bundle, and then use the good old reflection tricks
to call the defineClass() method, but is there any other way (cleaner) to
add new class into the OSGi classloader ?
--G
2012/1/10 Guillaume Sauthier (OW2) <[email protected]>
Hi all
I'm working on an EJB3 container (EasyBeans) that is using ASM to
generate and modify class files of the EJBs.
It is also working in an OSGi environment, with EjbJars having OSGi
metadatas in the Manifest. At the moment, we still have to pre-define the
list of additionally imported packages (consequence of the ASM bytecode
enhancement).
We want to take advantage of the WeavingHook service that looks like to
be designed for that kind of use case.
Nevertheless, looking at the API, it seems that it is designed to only
allow byte code modification.
Is there a way to introduce in the classloader the newly created (from
scratch) bytecode of a class ?
Thanks
--G
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev