Extending Java application with user plugins
I am interested in extending my application with plug-ins. I made the Application to download videos from websites but it needs a valid URL to do this. The users coul开发者_StackOverflow中文版d create a new plug-in for specific URL/domain and feed my application with valid URL.
I was doing this using jar files and URLClassLoaders. The problem with this approach is, that loaded classes have elevated privileges when they should only have permission to read from an URL.
Which is the best way to extend Java Application with plug-ins?
OSGi might be the way to go, but it might also be a bit too advanced/complex for what you want to do. I used JPF in a small project a couple of years ago. I liked it.
http://jpf.sourceforge.net/
Check out OSGi, this is what eclipse uses to manage plugins. There are various implementations to choose from--eclipse has its own. OSGi will manage the classloader issues that can be complex.
精彩评论