-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made the project OSGI compliant #13
Conversation
Thank you! I have merged this pull request, but didn't include the unneeded Did you get the ServiceLoader for the SPIs to work under OSGi? |
Hi Stian, |
Hi, Nicolas Fortin |
Thanks, @nicolas-f - feel free to contribute your results to issue #16 ! Here's some relevant OSGi testing framework I used in Apache Jena using pax: https://github.com/apache/jena/tree/master/apache-jena-osgi/jena-osgi-test |
See also the release candidate 1.3.1 at #17 - feel free to test it and vote! |
Hello, I resolved the service exports of SPI through SPI-Provider and Provide-Capability manifest tag. With the usage of Apache Aries. https://github.com/nicolas-f/h2database/blob/georaster_patch/h2/src/main/META-INF/MANIFEST.MF#L66 However I'm facing problems in the SPI consumer side. ImageIO does not found provider in other bundles.. |
Hello, I tried the 1.3.1 bundle, but got missing exported package: sun.security.action. What do you suggest? My ideas are:
|
Thanks for testing! I am not sure if sun.security.action is required or optional, I guess we Depending on sun.* sounds bad, but then again this code came from sun :)
|
Thanks for quick reply! Package sun.security.action is mandatory. Setting it as optional allows to bypass the export-import osgi startup check, but the provider mechanism doesn't work (as expected). I tried to programatically instantiate an image reader (TIFFImageReader for my case), but its implementation package (com.github.jaiimageio.impl.plugins.tiff) is not exported as well. |
Thanks for having a go at my speculations :-) my apologies if I'm getting
my class names wrong as I'm typing this late at night on a tablet on the
train from Arlanda airport to Stockholm. :-)
Would it work to set the Thread.setContectClassLoader to yourself (which
can require something from jai-imageio-core), or are we stuck because the
ServiceLoader is instantiated within javax.image ? I believe you can pass
in a class loader.. Perhaps getClass().getClassLoader() would do the trick?
Otherwise we would need to expose the impls as you said, or an alternative
service registry instantiation.. Or perhaps marking up as proper OSGi
services (which would then miss out the built in ones like JPEG reader, but
we could list those in the xml)
|
I made the project OSGi compliant in order to be able to use it in an OSGi environment.