Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Make project an OSGI bundle #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jlemay
Copy link

@jlemay jlemay commented Sep 19, 2018

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)

@@ -60,14 +62,6 @@ public void removeFileSet(Distribution distribution, IExtractedFileSet all) {
}
}

@Override
public boolean checkDistribution(Distribution distribution) throws IOException {
if (!LocalArtifactStore.checkArtifact(downloadConfig, distribution)) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looked to me the only reason you used the flapdoodle package was to use the LocalArtifactStore. It seemed to me though that this method was identical to the one in the flapdoodle ArtificatStore class. This means we can just extend the ArtifactStore and override the methods we want to override and remove the need to override the checkDistribution method. This allows us to remove the usage of the flapdoodle package and solve the split package problem.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smecsia it looks like all the checks have passed for the pull request. Are you able to review it and merge or offer suggestions? Thanks in advance!

@smecsia
Copy link
Member

smecsia commented Oct 19, 2018

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
Copy link
Author

jlemay commented Oct 19, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants