Hi,

Am Freitag, den 25.04.2008, 18:23 +0200 schrieb Alexander Saar:
> If you are only using parts of  
> these frameworks, you can add the packages you need as private  
> packages and the maven bundle plugin will add them to the bundle.

This is actually a good idea for small dependencies and allows for the
encapsulation of them. We do this in Apache Felix SCR for example for
the XML parser. No other bundles knows about this parser so there is
also no version conflict etc.

>  You  
> may encounter errors that one or more packages are missing even if  
> they are not used. Such issues can be solved by adding them as dynamic  
> imports. In that case they will only be imported when they are  
> available (and used).

Whether you use DynamicImport-Package or Import-Package with the
required:=optional directive depends on the use case: Generally if you
know the dependency will never be resolved you might want to choose the
latter. For example for sun.* dependencies.

If you know, that a dependency might be usefull and might be resolved
sometime in the future, you might used the DynamicImport-Package. But
generally I would suggest to not use this as it comes at a price: Each
access to a package, which is not already wired is checked against the
DynamicImport-Package. There is one use in Bundles, where you don't know
imports before hand. Those bundles generally to class loadding stuff,
like the JSP support of Sling.

Regards
Felix

Reply via email to