donderdag 30 december 2010

Spring Roo

A couple of days ago I started with Roo, just to see what it is and how difficult it is to master. The first time I read something about Roo was on a Google blog announcing it's compliance with GWT. That was when I got interested, cause I'd done something with GWT, and found it very easy to use. The second time I saw something about Roo was at the Dev day in Munich. I went like that's just some nice and powerful tool and it looked very easy to use. The next day download STS but didn't have the time trying it out.

Now I've been using it for a few days, found it nice and easy to work with. Especially when you don't have to worry about did I test everything or doing only good weather test and skipping the bad because they will work anyway. It makes test for you when you ask it to. It even modifies the toString function of a class so you don't have to. By using AspectJ it creates lots of stuff automatically so you don't have to worry about something like the annoying getters and setters. If you want you can do them yourself but most of the times I'm just to lazy to do that so I'm using the autocomplete functionality of Eclipse.

There are only a few thing I need to figure out. One for instance is how to find the AspectJ files I wanna what's in the. A second thing when using GWT is that it makes for all the classes some kind of fill in possibility. When connecting to some Google services I don't want the user to make his own connections. And then there is the site I definitely need to figure out how to make that more slick, come to think of it one thing I didn't test is what the mobile classes do within the project. If these make a mobile site or something like that, that would be awesome.

Building a "standard" Roo app with STS:
Make a Roo project and then issue these command in the RooShell in STS

  • persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
  • entity --class ~.Timer --testAutomatically
  • field string --fieldName message --notNull
  • controller all --package ~.web
  • selenium test --controller ~.web.TimerController
  • perform tests
  • perform package
Then right-click on the project and choose run on server

Building a GWT and Google Roo App with STS:
First make sure you have the plugins installed. If not go to the dashboard on the bottom of the dashboard there are two/three tabs click on the one that says Extensions.
Then find and check everything from Google, this way you have also the datanucleus plugin installed.
After this make a Roo project and issues the following commands which are very similar to the ones above:
  • persistence setup --provider DATANUCLEUS --database HYPERSONIC_IN_MEMORY
  • entity --class ~.Timer --testAutomatically
  • field string --fieldName message --notNull
  • gwt setup
Now right-click the project and run as web-application.

These are the basic steps to get you going.