On 6/21/10 14:57, Kelvin Chan wrote:
Hi guys,
I just started with OSGi/Felix and went through a lot of reading over the
weekend regarding classloading/osgi/felix. I still don't have a clear idea of
how to incorporate an external library into my app.
I understand that OSGi do class loading through Import-Package, no more linear
class loading like in an traditional Java app. That means if a bundle does not
specify what packages it want to import, it will not be available to that
bundle. On the other hand, everything on classpath, if specified by
Import-Package, will be available to a bundle. (did I get that right?)
A bundle can only see stuff it imports as long as there is someone else
exporting it. For class path packages, the system bundle (i.e., the
framework) will export everything in the JRE by default. If you have
some other non-JRE packages on the class path that you want bundles to
be able to import, then you must add them to the
org.osgi.framework.system.packages.extra property in the
conf/config.properties file.
The ultimate goal here is to reuse felix.jar as a host and import a 3rd party
jar so that one of the bundle can use it. (is this even the right approach?)
What's the best way to do this?
The best approach is to create a bundle out of the third-party JAR file
and install it into the framework along with your bundle. If this isn't
possible (or desired), then you can add it to the class path and export
it from the system bundle as described above.
-> richard
If there's already write-up on this one and I happen to miss it, please point
me to the right place.
Thanks,
kel
NOTICE: This communication is intended only for the use of the person or entity
named above and may contain information that is confidential or legally
privileged. If you are not the intended recipient named above or a person
responsible for delivering messages or communication to the intended recipient,
you are hereby notified that any use, distribution, or copying of this
communication or any of the information contained in it is strictly prohibited.
If you have this communication in error, please notify me immediately by
telephone and then destroy or delete this communication, or return it to me by
mail if requested. Thank you for your attention and cooperation.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]