On 25/04/07, Aggelos Mpimpoudis <[EMAIL PROTECTED]> wrote:
Hello,
Well, I am sorry for my naive question but in this old email,is Mehta
means that he can't use external libraries in his bundles because
everything that is imported into a bundle, needs to be a bundle itself?
Basically, your Import-Packages are resolved against the Export-Packages
from other bundles. This doesn't mean you can't embed a jarfile inside your
bundle, but if you do then you need to add it to your Bundle-ClassPath.
The benefit of wrapping a jar as a single bundle is that it can be shared and
used by other bundles, but there are times when it makes sense to provide
a set of jarfiles as a single bundle, or if you want to hide an implementation
dependency.
I am new to OSGi, that's why I am asking.
I wrote a simple bundle, that imports a library (something with gsm
modem communication for the record). In manifest file (in eclipse) is
reported an error about not importing a package, that I use at my source
code (the lib for the sms's). So I conclude from all this that whatever
you import as 3rd party library must be another bundle(!?) But this is
Packages that you use inside your bundle must come from either another
bundle (via Import-Packages), your Bundle-ClassPath, or from the system
classpath (such as java.* packages).
( you can still access other classes dynamically, if you are given access
to the relevant classloader, for example via a service method parameter )
BTW, if you export a package, it's good practice to also import it in case
another bundle provides the same package. If you don't import then your
package may end up in a separate class space.
( http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html )
somehow weird, on the contrary of what the specification reports! At the
r3 book, look at page 588 at the Bundle-Classpath Section. Isn't this
the section that describes this exact situation? Xmmm
I am really sorry if I am asking nonsense..... :-[ :-[ :-[ :-[
There is always a starting point :-P
I've provided some scripts + maven tools for quickly wrapping bundles, etc.
available from http://wiki.ops4j.org/confluence/display/ops4j/Pax+Construct
It uses the maven-bundle-plugin (which in turn uses Bnd) to do the bundling.
Best Regards,
Aggelos Mpimpoudis
Nikunj Mehta wrote:
> Hi folks,
>
> I have had one nasty practical problem with OSGi. Every time I find
> the need for a third party library, I have to figure out how to get it
> bundle-ized. On top of that, I am using Maven, which means I need to
> get a Maven-ized, bundle-ized version of the library. While doing this
> once is not such a big deal, it has acted as a major deterrent in
> using external libraries.
>
> How do people overcome this problem? Can OSGi provide a standard
> solution to this major barrier to adoption?
>
> Thanks,
> Nikunj
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> http://www2.osgi.org/mailman/listinfo/osgi-dev
>
--
Dept. of Informatics & Telecommunications, University of Athens
Athens, Greece
GSM +306942075153 / Msn: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev
--
Cheers, Stuart
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev