Skip to content
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

Merged
merged 1 commit into from
Jan 16, 2016
Merged

Configure OSGi bundling #216

merged 1 commit into from
Jan 16, 2016

Conversation

mishako
Copy link
Member

@mishako mishako commented Jan 2, 2016

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.

1------------+  2--------------+  3--------------+
| rome       |  | rome         |  | rome-fetcher |
| rome-utils |  | rome-utils   |  +--------------+
+------------+  | rome-modules |
                +--------------+

Why bundle rome-modules together with rome?

Because Rome has a fragile class loading system for modules. Basically rome classes need to load rome-modules classes. It’s not easily achievable in OSGi if they are in separate bundles. So the idea is that if you need rome-modules, you use the bundle that contains both rome and rome-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 configured ClassLoader 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 extended automated tests.

@mishako
Copy link
Member Author

mishako commented Jan 2, 2016

@snoopdave @PatrickGotthard

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.
@jbonofre Hey, I see you created Rome bundle for Apache ServiceMix. What do you think about this PR?
@jsbournival Hey, you wrote an article on OSGi and Rome. What's your take on this?

@lewismc @sebastian-nagel @buckett Hey, you commented on #130. I guess you're interested in this PR as well.

@lewismc
Copy link

lewismc commented Jan 4, 2016

@mishako admittedly I am no expert in this area either!
I can offer you some further test resources when were implemented over in Apache Tika. I hope they are of value to you.

@jbonofre
Copy link

jbonofre commented Jan 4, 2016

Hi guys, I can take a look on that tomorrow if you want.

@mishako
Copy link
Member Author

mishako commented Jan 5, 2016

@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.

@mishako
Copy link
Member Author

mishako commented Jan 15, 2016

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.

@PatrickGotthard
Copy link
Member

I have absolutely no OSGi experience, so feel free to merge it ;)

mishako added a commit that referenced this pull request Jan 16, 2016
@mishako mishako merged commit 6cdf92d into rometools:master Jan 16, 2016
@mishako mishako deleted the maven-bundle-plugin branch January 16, 2016 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OSGi Manifest headers in 1.5.x again
4 participants