On Monday 29 May 2006 05:17, Daniel Fagerstrom wrote: > > Is it possible to have an OSGi bundle which exports classes of two jars? > > A bundle is packaged as a jar, so it is not possible for two separate > jars. A bundle can contain internal jars that are added to the bundle > internal classpath.
There is no problems to export packages from the Jars that resides inside the bundle jar. ANd no problems that several jars are having the same packages inside, as these are then part of the same OSGi classloader. > There is something called fragments in R4 where a > fragment bundle can add optional things to another bundle. I haven't > studied the details about them though. Fragments essentially works like this; A Fragment can say "Hey, I should be part of bundle ABC", and then the classloader of ABC will append the packages that the Fragment provides. The Fragment will stay inside ABC until ABC is uninstalled, even if the fragment is stopped and uninstalled. Typical use case is Fragments adding Localization, simply by providing the properties files needed with the correct name. So, here is another case where the classloader have no problem of merging content from different jars. Now, for those interested; Check out what happens if you sign and seal a Jar in the standard JDK... Food for thought, and an issue for the security paranoid. Cheers Niclas
