Wednesday, August 16, 2006

Modules in the open-source EL4J framework

EL4J is to a large extent a collection of existing J2EE frameworks. Spring is the most important of the contained frameworks.

One interesting feature of EL4J are modules. They allow to split an application in smaller pieces. EL4J itself also uses modules to split its features in more handy chunks. A module is similar to an eclipse plugin or to a maven project (in fact, an EL4J module is both mapped to an eclipse plugin and a maven module).

A module in EL4J contains (1) code, (2) predefined configuration and (3) dependencies. You can make dependencies on other modules or on jar files. When a module m1 uses another module m2, the module m1 has acces to all the content (code, config and dependencies) of module m2. This works transitively, i.e. if m2 depends on a module m3, m1 has also access to m2.

Sample use: Adding simple performance tracking
Why are modules useful? Let's assume you have an application with the module app. If you want to setup the performance interceptor to automatically time the duration of all calls to certain spring beans, you just make a dependency from your application to the module "light-statistics". From then on, you can access performance information via JMX.
Under the hood, the module light-statistics sets up the JAMON performance interceptor, adds it by default to all spring beans (you can override this) and makes the information available in JMX. No need to configure anything or know more about the working of the module light statistics. By default, all is setup for you.
In case you are not happy with the default, you can change anything. But simple things are simple to set up.

Here's a sample setup of modules:
















In your applications, you make a dependency on all EL4J modules you need (above the module YourApplication needs the modules Security and WebTools. In this way, you automatically setup the things that are tedious to set up: jar-dependencies and the default configuration.

Are you afraid that EL4J loads configuration "magically"? You don't have to use this feature, we just recommend it for simplicity. For your application context, you specify the place from where configuration should be loaded from (as always in spring). By convention, we put configuration we recommend to always use for a given module in a directory called mandatory. The location we recommend to add to the list of locations to load configurations from is "classpath*:mandatory/*.xml". Spring then includes all the default configuration automatically. You also have the possibility to exclude a location in case you do not need it.

Monday, August 14, 2006

We need a well-integrated set of best-of-breed tools for J2EE development

For simple, non-heterogeneous environments, IT-analysts often recommend using the .NET framework as development platform, rather than the J2EE. They say that .NET is simpler and more productive.
This bugs me, because I prefer the Java platform and because I favor the more open community around the J2EE. Great innovation occurs in the J2EE open source world. We also have the better IDEs.

However, when I recommend how to use the J2EE myself, I enumerate many different tools (just to name a few: Spring, Hibernate or Ibatis, Axis, Maven, Ant, JUnit, Log4j, Acegi), from different sources. It is often far from obvious what frameworks one should choose, there are just too many out there (consider e.g. the web framework domain). The integration of these frameworks is also done anew too many times.

EL4J, the open-source project I work on, has the goal to improve this situation. It combines leading J2EE tools, provides sample applications and adds some features of its own. It was already used in 16 projects so far. http://EL4J.sf.net

How do you estimate the situation in the J2EE development world?