yandex-qatools / postgresql-embedded

Embedded PostgreSQL Server
Other
493 stars 90 forks source link

Make project an OSGI bundle #143

Open jlemay opened 5 years ago

jlemay commented 5 years ago

I am looking to make use of this module in an osgi environment. Inorder to make use of this project in an osgi environment it needs to be an osgi bundle. This pull request makes this an osgi bundle. I also made a change to remove the de.flapdoodle.embed.process.store package since that package is exported by the flapdoodle dependency. OSGI has a problem when 2 bundles export the same package (it does not handle split packages well)

smecsia commented 5 years ago

Hi guys @alinbrici @jlemay thank you very much for your contribution. Sorry for the late reply, I'm not very much into this project at the moment. Why is this important to make it as an OSGI-ready source-code? Do you have an issue to bundle it as a library? You could indicate several packages as exported ones and this one in particular. I'm just trying to evaluate the necessity of such refactoring.

jlemay commented 5 years ago

I do want to bundle this as a library in an osgi container. The way osgi works is it uses the the list of exported packages and imported packages to wire the libraries together. If bundle A exports package P and bundle B imports package P, then bundle B will get the package from bundle A. The issue arrises when 2 bundles export the same package. So if bundle A exports package P and bundle C exports package P, then when B tries to resolve which bundle to get the package P from it doesn't know which bundle to get the package from (A or B).

This scenario happens because the flapdoodle dependency already exports the de.flapdoodle.embed.process.store package, so when this library also tries to export it the resolution of that package confuses the osgi container.