A Java Plugin Framework Wishlist
Yes, there are times that I am jealous of the apparent simplicity of php driven sites. Take for instance Drupal, I really like all the functionality it has. I know there has been a ton of work and support to get Drupal where it is today, but the thing that makes me really jealous is there plugin framework. Anyone can write a plugin and distribute it to other Drupal users. This just seems so simple. And if you look at other php systems like Joomla, they all have similar plugin/module frameworks. So where is the java equivilant?
Now from a technical aspect, I understand why it is easier to write a plugin system in php. Since php is a scripting language, everything happens at runtime, there is no pre-compile stage. With java, everything has to be compiled first before deploying it. So in java, it is a little harder to add things at runtime that have not been pre-compiled with the rest of your app. There are definitely ways around this, it just is a big nightmare to handle all the different configuration settings to make it work.
I’ve looked at a few existing java projects that use plugins, Hudson, Magnolia and OpenCMS. All of them work, I just haven’t fully immersed myself enough to completely understand how each of the different systems work. With java, unlike php, you will sooner or later have to address dependency management and how to organize all the different versions of jars that get thrown into your app. This goes back to handling all configuration of all your different plugins.
So finally, to my wish list. What I would love to have is a basic framework that accepts different plugins that will ultimately build an app. An easy example is for a simple website. I would want one module for the admin section, one module for blogs, one module for message boards, one module for commets. I think you get the picture. Everything is modular, this way you can just stack together your modules to create the functionality of your site.
In my research, OSGi almost looks like what I am looking for. I say almost, because one of the requirements I have is to make it easy to use within a servlet container. With OSGi, your servlet container is actually a module itself. To me, this just adds another layer into the stack. And I most developers already know how to use a servlet container, so I don’t want to make them learn how to use OSGi.
Now to my wishlist of what I want the plugin framework to do:
1. Be able to assign a plugin to act like a servlet filter
This functionality is used to do things before or after a web request. You could use this to intercept incoming request parameters and do something with it, like set a cookie based on the refering source of the request.
2. Be able to register new url actions
I want to be able to add new pages to the site. So I would need to add all the actions associated with view a blog for instance. This would include both the page logic and the view layer (images, templates, etc).
3. Be able to assign plugins to a specific lifecycle phase
This is just like “hooks” in php. Say I want certain logic to fire every time I save something or run some special code when the page is rendered.
So there you have it. Sounds simple right? Well, hopefully I can find something that will meet my needs, otherwise I may have to start writing my own.
September 1st, 2009 at 11:44 am
Actually, OSGi already does this.
You can either (a) start up an OSGi engine inside a Servlet, thus deploying it as a war to an existing setup, or (b) bring up the OSGi servlet handler to slow you to install servlets (and URL prefixes) into an existing app.
Once up, in either case it’s fairly trivial to define services which enable your app to be built in a modular fashion. You can use vanilla OSGi services, the Eclipse extension registry, or combinations of both.
And if that doesn’t suit your exact needs, it’s simple enough to write a bundle that does handle it; for example, the declarative services and blueprint service take sone of these out if your hands and Into the realms of Spring-like functionality.
November 30th, 2009 at 7:15 am
I am looking for a similar solution too. I have experience of drupal, so I know how excellent plugin framework it has. you can do almost any thing.. infact most of parts of core drupal comes as core plugins. I too was thinking tht where is the java alternative.
February 7th, 2011 at 10:01 am
Howdy, what a good information and facts in your web-site listed here %BLOGTITLE% Regards, Gus Tuohey
April 19th, 2011 at 3:12 pm
thanks for article!
July 5th, 2011 at 12:46 pm
I was just reading your blog and I realized that what your wrighting is so true! People should think more often about this subject because this is to important to forget. Btw your site is really hard to read on my blackberry. The screen looks very small and some words are placed outside of the borders. But besides that.. your blog is really top notch. Keep it up
July 21st, 2011 at 8:52 pm
It’s arduous to find educated folks on this topic, however you sound like you know what you’re talking about! Thanks
February 25th, 2012 at 4:32 am
Измена#a#измена мужа как простить измену мужа и измена мужа как себя вести#/a# .
March 16th, 2012 at 12:13 pm
original xbox 360…
Dear fellow texters, Due to Globeline problems, we’re experiencing delayed messages. This is the reason who are only now I would like to greet you a Merry Christmas….