I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Thursday, 14 January 2010

ROO - a spring and Maven based rapid development framework

I just discovered ROO. I tried it. But I had some problems running it under fedora with java 1.6 and maven 2.0.8. It seems that it need maven 2.0.9. The idea behind roo is to have a command line based system to develop. It is somewhat similar to Ruby on Rails. You issue commands and create and edit the entities that way. I give here an example of script:
project --topLevelPackage org.myexample persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT database properties list database properties set --key database.url --value jdbc:hsqldb:${user.home}/tmp/datasources/my-example database properties list
This first part of the script creates a project pom.xml (for maven) and sets the necessary properties for working with hibernate using an in memory database.
entity --class ~.domain.MyExample field string code --notNull --sizeMin 32 --sizeMax 32 field string firstName --sizeMax 65 field string lastName --sizeMax 65 field string email --sizeMax 65 field number age --type java.lang.Integer field date confirmed --type java.util.Date
This second party from the script creates an entity: MyExample. It also creates a number of fields: code, firstName, lastName, email. The next part of the script takes care of creating controllers and tests. The line:
controller scaffold ~.web.MyExampleController
creates a controller for CRUD operations. It also performs the tests to make sure it works correctly. Finally, it sets up the logging framework as well as the security framework.
test integration controller scaffold ~.web.MyExampleController selenium test --controller ~.web.MyExampleController perform test // (OPTION: quit, mvn tomcat:run, localhost:8080/myexample, mvn selenium:selenese) logging setup --level DEBUG --package WEB security setup
The next section creates a new controller class called: org.myexample.web.My2ndExampleController. It lists the finders and adds the finder to the class.
controller class --class ~.web.My2ndExampleController finder list --class ~.domain.MyExample --filter code,equ finder add --finderName findMyExamplesByCodeEquals perform eclipse
At the end the perform eclipse sets the system for using the system under eclipse.