-
Notifications
You must be signed in to change notification settings - Fork 168
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
Configure OSGi bundling #216
Conversation
I guess we could benefit from more OSGi experience here, so I'll mention some folks. @klcodanr Hey, you did some OSGi wrapping for Rome. Would love to hear your opinion. @lewismc @sebastian-nagel @buckett Hey, you commented on #130. I guess you're interested in this PR as well. |
@mishako admittedly I am no expert in this area either! |
Hi guys, I can take a look on that tomorrow if you want. |
@lewismc Thanks, Pax Exam turned out to be a really good library. Now my tests cover all three Rome bundles: mishako/rome-osgi-test/tree/master/src/test/java/com/rometools/rome/osgi. @jbonofre Great! I guess the main question to you could be whether the bundles from this PR are a good replacement for the one you made. |
I wrote some tests for the custom module use case to assert the behavior I described above. I'm going to merge this pull request soon. Please let me know if you have any concerns. |
I have absolutely no OSGi experience, so feel free to merge it ;) |
Fixes #204
I don’t expect this pull request to be merged as is. I am by no means an expert in OSGi. But I did spend quite some time figuring this out and I think it works. Please review and ask questions if anything is unclear.
I configured three bundles as depicted below. Boxes are bundles, inside are maven modules. The changes are spread between four repos: current, rometools/rome-parent#2, rometools/rome-modules#38 and rometools/rome-fetcher#20.
Why bundle rome-modules together with rome?
Because Rome has a fragile class loading system for modules. Basically
rome
classes need to loadrome-modules
classes. It’s not easily achievable in OSGi if they are in separate bundles. So the idea is that if you needrome-modules
, you use the bundle that contains bothrome
androme-modules
.How will it work with custom modules?
Well, it won’t. Neither it used to. The problem is that you want Rome to load classes from an arbitrary external bundle. One possible solution is to pass your
ClassLoader
to Rome. Luckily Rome has ConfigurableClassLoader. Unfortunately Rome will use the configuredClassLoader
to load everything, where "everything" includes Rome classes and resources. This is something that can be fixed though.Have you tested it?
Yes. I ran it in Karaf. I also wrote
an automated test. It includes only basic feed parsing, but can be extendedautomated tests.