Question

I want to create an OSGi (Equinox) bundle that contains a script engine (JSR-223 compliant) and use it in another bundle via ScriptEngineManager.getEngineFactories().

However the service discovery mechanism of Java Scripting API (jar file service discovery) fails to discover scripting engines in installed bundles.

I already saw few answers on the topic, which suggested using Apache Felix or Apache Sling since they have a solution. However I am wondering if the Equinox implementation has a way to handle the problem?

Was it helpful?

Solution

Well, OSGi 5 will support it, it's called the Service Loader Mediator. That will effectively bridge the OSGi services with the java.util serviceloader.

Apache Aries has an implementation of it called Spi-Fly which should work. I guess it is more targeted at Felix but usually the OSGi implementations are pretty compatible.

To be honest though, I've never gone to the bottom of this one, so I can't speak from personal experience.

Good luck, Frank

OTHER TIPS

I have implemented a solution based on one of the answers from Is OSGi fundamentally incompatible with JSR-223 Scripting Language Discovery? using OSGiScriptEngineManager and friends and that works pretty well.

The big problem then can be to find proper JSR 223 implementations for the scripting languages in question :-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top