Why Grails instead of JRails

The JRuby team has accomplished an amazing thing, running Ruby on Rails with JRuby. So is Grails dead? No! Why should someone then use Grails and not JRuby on Rails? Ruby is a very nice and clean language, Rails has a lot of extensions and documentation. But Groovy is more similar to Java, like Java on steroids, is tighter integrated and has more appeal to Java developers. But to quote Oracle "at the end what you generate with Grails is a J2EE app, web container managed and deployed. You can manage it in the same way you manage any other J2EE app." via InfoQ.

Update: I really like Ruby 🙂 I've written a Ruby OR Mapper called Ruby.RDO and a web framework called Ruby.RO more than 4 years ago which focused on ease of use and components (think tapestry).

XmlResourceBundle added to Messages

I have added a XmlResourceBundle to cintoo Messages.

<properties>
<property key="mykey">myvalue</property>
</properties>

The greatest benefits with XML are that you can easier use encodings in XML files than in the default Java properties bundles. And you can use XML-based tools for bundle creation and management. The bundle also shows the direction Messages is going. Easy adobtable to your project requirements.
The XmlResourceBundle is easy to extend. As an example for another Xml properties
format I chose one from Cocoon.

The format is different from the default properties xml format in Messages, so some adaptions are needed.

<categories>
<message key="mykey">myvalue</message>
</categories>

Messages xml uses Apache Jakarta Digester. We have to tell Digester how to map the xl tags to the properties class.

public class CocoonXmlResourceBundle extends XmlResourceBundle {
public CocoonXmlResourceBundle(String baseName, Locale locale) {
super(baseName, locale);
}

protected Digester configure(Digester digester) {
digester.addObjectCreate("catalogue/message", Property.class);
digester.addSetNext("catalogue/message", "addProperty", "cintoo.messages.bundle.xml.Property");
digester.addBeanPropertySetter("catalogue/message", "value");
digester.addSetProperties("catalogue/message", "key", "key");
return digester;
}
}

That's it. And it's as easy to adapt XmlResourceBundle to other formats.

Beware MacOS X Java developers

At least all of those as stupid as I am. When developing cintoo Messages I got biten (again!) by the MacOS filesystem not being case sensitive. All tests worked fine but on the integration server (thanks pulse guys for providing your software, it helps) which is running on Linux the tests wouldn't work. My bundle files were called test_de_de.properties which worked on MacOS X but not on Linux, where they have to be called test_de_DE.properties. Well well, write once ... 😉

Of course I recognized this after a long debugging session which even drove me to download the JDK source. Sigh.