Alessandro Mottadelli <[EMAIL PROTECTED]> wrote on 02/15/2007 09:14:53 AM:
> BJ Hargrave wrote: > > You can't. You can only export packages that your bundle contains. If your > > bundle imports a package, then your bundle cannot also export it. > > > > BJ Hargrave > > > mmmmm..... why this limitation? It would be very useful to reexport a > package if the dependencies between bundles are expressed via > require-bundle (the "normal" eclipse way). > If I have a plugin A that requires plugin B and I decide to take some > package out of B to be able to distribute them independently it would be > nice not to change the plugin A and simply reexport from B packages that > are now elsewhere. > > Am I missing something? Well if you are using Require-Bundle and not Import-Package, then it is a different game. When you use Import-Package, you are dependent upon the pakcage and not some bundle that might provide it. So the importing bundle will wire directly to the exporting bundle for that package. So reexport is of no value, since the importer can directly wire to the other bundle exporting the package. If however your are using Require-Bundle, then your bundle A only knows about bundle B and is dependent on bundle B to provide all the packages bundle A needs. So if bundle B is refactores and no longer contains some package the bundle A needs, then either bundle A must change to obtain the package from elsewhere or bundle B must change to obtain and reexport that package (this means bundle B will need to require bundle C and reexport). This is the brittleness of Require-Bundle and why it should only be used with great care. Bundle A should not really care what bundle provides the packages it needs. It should only care that somebody does provide them. Require-Bundle may be the "normal" Eclipse way but only because (a), that was all they had prior to moving to OSGi in 3.0 and (b) it is much easier for developers to use then import-package. This is a tooling issue and PDE has been steadily improving in this area since 3.0. > > regards, > A.Mottadelli BJ Hargrave Senior Technical Staff Member, IBM OSGi Fellow and CTO of the OSGi Alliance [EMAIL PROTECTED] office: +1 386 848 1781 mobile: +1 386 848 3788