I have helped the TwelveMonkeys image manipulation library[1] with OSGi
support.  However, when I try using I see that only the image reader
services are exported from the bundles.

I need help figuring out why the image writer services aren't exported.

I need advice on the maven-bundle-plugin config.
  
TwelveMonkeys hooks into the JRE ImageIO API using the Java Service
Provider Interface (SPI)[2].

I handle the SPI services by using the OSGi ServiceLoader Mediator mechanism[3].

My changes to TwelveMonkeys[4] consists of maven-bundle-plugin config,
adding package export/imports and Require-Capability and
Provide-Capability headers for the OSGi service loader mediator.

I use apache Aries SPI Fly[5] at runtime to load the services.

In Apache Karaf, when I look at a bundle that should provide two
services (javax.imageio.spi.ImageReaderSpi and javax.imageio.spi.ImageWriterSpi)
it provides only javax.imageio.spi.ImageReaderSpi:
 https://gist.github.com/steinarb/5c84fef1e76976e276681f6f0b697e35

This is what I'm trying to do to provide the services:
 
https://github.com/haraldk/TwelveMonkeys/blob/master/imageio/imageio-jpeg/pom.xml#L43

However this results in the following MANIFEST.MF:
 
https://gist.github.com/steinarb/5256d998721f0c9dd33d25c100bc420d#file-gistfile1-txt-L32

Note the "~=" between osgi.serviceloader and "javax.imageio.spi.ImageWriterSpi"

Does that means "exclude" rather than "include"?

And if so: what should the maven-bundle-config look like to provide both 
services?

Thanks!

- Steinar

References:
 [1] <https://github.com/haraldk/TwelveMonkeys>
 [2] <https://www.baeldung.com/java-spi>
 [3] <https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.loader.html>
 [4] <https://github.com/haraldk/TwelveMonkeys/pull/814>
 [5] <https://aries.apache.org/documentation/modules/spi-fly.html>

Reply via email to