Ken Rimple heads Chariot Solutions' training and mentoring programs, and has developed and/or delivered courseware and seminars in a variety of technologies such as Maven, OSGi, Groovy, Grails and Spring. Throughout his career, Ken has always made it a priority to teach others what he has learned. Ken has served as the technical co-chair of both the Fall Forecast 2008 Cloud Computing Conference and the 2009 - 2012 Emerging Technologies for the Enterprise conferences. He hosts a popular podcast, the Chariot TechCast, and has led or participated in projects written in Java since Java 1.0.2. Ken taught the first Philadelphia-area Sun Introduction to Java course in the late 1990s. He is the co-author (along with Srini Penchikala) of Spring Roo in Action for Manning Publications. He is also an avid photographer and jazz drummer. Ken is a DZone MVB and is not an employee of DZone and has posted 35 posts at DZone. You can read more from them at their website. View Full User Profile

Roo (in the) Corner - new features in trunk...

10.23.2011
| 3694 views |
  • submit to reddit

I've been spending my time readying Roo in Action for publication. Turns out, the Roo team had other ideas - including lots of new things you may want to be aware of if you are looking to support Roo 1.2 once it is released.

Keep in mind these changes are in-flight. If you don't need to work on trunk, DO NOT WORK ON TRUNK. This is something other platform afficianados do - for example, the Rails development community commonly calls this working on the "edge". So, let's get edgy.

There are some really, really cool things in here. I've seen them move toward opening up for all modes of development - some want JSF, so there is a JSF add-on. They use PrimeFaces, and a dialog motif for adding new elements. I'm sure they will tweak this as it goes along, but it looks more like the GWT or Flex mode of editing I saw before.

Breaking Changes (so far) - you may need to edit your code - I know I have to for now, but this is a temporary pain for some consistency gain within Roo.


  • @RooEntity -> @RooJpaActiveRecord

  • @RooWebScaffold - now a .scaffold. package after .controller.

  • @RooConversionService - now a .converter. package after .controller.


Additions


  • New @RooEquals - and a shell command for equals - this has been here for a little while, but is something that can be of use when defining models or other objects that need to be compared. You can exclude fields from the factoring of the comparison.

  • new entity flags (recent anyway) to set entity name, table, and other attributes on entities - this is great, and includes the ability to define transaction manager names for cases where you are working with multiple JDBC datasources - nice! Also, it lets you specify the entity manager - so if you have two persistence units to separate transaction managers (reporting database -vs- transactions) you have that option. Again, not a huge deal, but lets you stay within Roo to get things done, without digging into code for a configuration option. You can even set the table name, entity name, etc...

  • New settings for the json command - --deepSerialize and --rootName - I am not sure if these have been here long, but they are good to know about.

  • New —packaging element in project - includes POM or JAR right now. Also includes --parent. This could be great, as I think they are going to implement multi-pom support in Roo 1.2. We'll stay tuned on that, and perhaps write a quick blog entry on what we've found.

  • New support for database dot com - a new database provider - I don't know much about it.

  • New date field support for both dateTimeFormatPattern AND dateFormat - I am unsure that the scaffold would deal with dateTimeFormatPattern.

  • JSF scaffolding in place - uses PrimeFaces for the widgets - this is interesting, and has a different look and feel, native to PrimeFaces. But, it does exactly the same work as the scaffold in MVC. So, if you're looking at complexities and benefits of each, go for it. The CI build server is here, and you just need to follow these rules to get it to use trunk.


It was so easy to switch between JSF and MVC for my testing, I used these two scripts:

Roo with MVC
project --topLevelPackage foo.bar.mvc --packaging JAR --projectName mvcrules
jpa setup --database HYPERSONIC_PERSISTENT --provider OPENJPA
entity jpa --class ~.model.Course --testAutomatically
field string --fieldName name
field date --fieldName runDate --type java.util.Date --dateFormat SHORT
web mvc setup<br>web mvc all --package ~.mvc
quit

Roo with JSF

project --topLevelPackage foo.bar.jsf.sortarules --packaging JAR --projectName jsfsortarules
jpa setup --database HYPERSONIC_PERSISTENT --provider OPENJPA
entity jpa --class ~.model.Course --testAutomatically
field string --fieldName namefield date --fieldName runDate --type java.util.Date --dateFormat SHORT
web mvc setupweb mvc all --package ~.mvc
quit

I will attempt to update this article as I find new things... No promises, as the primary artifact is the book. But hopefully this is a warning shot across the bow that change is indeed a-coming.

 

From http://www.rimple.com/tech/2011/10/18/roo-in-the-corner-new-features-in-trunk.html

Published at DZone with permission of Ken Rimple, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: