Tuesday, February 19, 2008

JBoss Microcontainer usage in JBoss Portlet Container

I planned to rewrite the life cycle support in our JBoss Portlet Container product a couple of months ago, I have started that task for a couple of days. The main reason is the addition of portlet filters which introduce a life cycle of the different container objects a bit more complex than what it used to be in the past.

 The current code only manages the portlet application and portlet container with a trivial one to many relationships between application and container.

 The rewrite will introduce the portlet filter object having a one to many relationship with the application and also a one to many relationship with a subset of the containers according to what the application developer describes in the portlet descriptor file.

 So far we have not used directly any state machine framework to manage that. The main reason is that we use JBoss MC in the JBoss Portlet Container product and we use the good old JBoss Microkernel in JBoss AS 4.2.

 One could argue that I should write my own stuff to manage that. Indeed even if it is not very hard to do and that a set of good test cases would help to achieve something reliable it would miss one crucial feature which is the interaction with the environment. Indeed we need to be able to make a portlet container or a portlet application able to depend on some service for instance and have that dependency managed by the hosting environment.

 Another motivation for the rewrite is to expose outside of the container a set of managed object that represent the applications, the containers exposing only a subset of the concerns:
  • Life cycle management wired to the MC and not directly to the container obviously
  • Expose runtime meta data like portlet info
 In the implementation using JBoss MC, I have been able to simplify a couple of stuff thanks to an interesting feature called deployment callback. It allows to install/uninstall (a special kind of injection but with no managed dependency) all the beans (that's how JBoss MC names its POJO citizens) having a certain class. So this feature allowed me to remove a bunch of wiring code and simplify my stuff.

 The documentation is very good although it is missing some parts, but it's ok as I don't need those part (yet... Mark and Ales if you read me :-) ).

 The integration of our build with Maven improves also a lot about my understanding of JBoss MC, since Idea is able to download sources which helps to understand the kernel API stuff.

 Once I am done with that, I should work on getting the CC/PP portlet feature implemented and than I'll try to upgrade the JBoss MC version to the one matching JBoss AS 5 Beta 4. I'll try to keep you informed about that.

No comments: