After more than ten months of development and nearly 900 individual improvements, Spring Roo 1.1.0 has been released (download here)! Coinciding with the Spring Roo 1.1.0 GA release, the Google Web Toolkit, SpringSource Tool Suite, AspectJ and AJDT teams have completed supporting GA releases so that you can enjoy the latest versions of these tools all working nicely together.
We’ve introduced so many new features in Spring Roo 1.1.0 that it’s difficult to decide what to highlight. Nevertheless, let’s take a brief tour over some of the goodies we’ve added for your Java programming pleasure.
Incremental Database Reverse Engineering
It’s now possible to reverse engineer an existing relational database and automatically create Roo entities with corresponding fields. But hasn’t it been possible to do that using JPA tools for a long time? Yes, absolutely. The key difference is Roo’s database reverse engineering is incremental. This means that when Roo reverse engineers a database, it places all of the fields it discovers into inter-type declarations (ITDs). This is consistent with the rest of Roo, and allows Roo to easily deliver round-trip maintenance of the reverse engineered entity. In particular, you can re-introspect a database repeatedly to identify any changes while ensuring any code you’ve written in the .java sources is preserved. Roo will even delete entities that no longer exist (unless of course you’ve asked Roo not to) and Roo automatically handles complex situations like composite primary keys (complete with identifier class creation and maintenance). Best of all, Roo’s reverse engineering feature completes without asking you a single question. This new feature brings the Roo usability experience to a task that until now had been tedious, time-consuming and yielded cluttered .java files that could not offer incremental refresh capabilities.
Incremental reverse engineering was the single most popular feature request we’ve ever had for Roo, earning some 129 community votes. It’s had a lot of testing through the 1.1.0 development cycle, and we’ve found the community’s feedback invaluable. We’ve even had people successfully reverse engineering schemas with over 440 tables, and we’ve tweaked Roo to deliver solid performance in such cases.
To produce a new project and reverse engineer a relational database, only three question-free commands are required (which all offer Roo’s normal tab assist to save you typing)
project --topLevelPackage com.foo.rootest persistence setup --provider HIBERNATE --database POSTGRES --userName rootest --password rootest database reverse engineer --package ~.domain --schema dbretest
Of course you can repeat the “database reverse engineer” command as frequently as you like, and Roo will carefully update your entities with only the changes that have taken place to the schema. If repeating the command, you don’t need to repeat the “package” or “schema” options, as Roo remembers those from your initial command.
In terms of JDBC drivers that Roo will need to connect to your database to perform the introspection, we’ve shipped drivers for some common production open source databases (eg Postgres, MySql) with the Roo distribution. If you have another database, just type “script install-jdbc-drivers.roo” and restart Roo to gain access to Oracle, Microsoft SQL Server, HSQLDB, H2, Derby etc.
Spring MVC Enhancements
We’ve incorporated your feedback from Roo 1.0 and significantly enhanced the Spring MVC capabilities available in Roo 1.1.0. For example, it’s now possible to automatically round-trip a JSPX file. What this means is you can now edit a scaffolded JSPX file at any time and in any way, and Roo will automatically detect what you have changed. If Roo needs to edit the file for some reason (eg you have added a new field to the entity, deleted one etc), Roo will merge its changes with any of your changes automatically and safely. If you have made any edits to a given HTML element, Roo will always leave your changes in place and they will take priority - just as you’d expect.
A related improvement to the JSPX round-tripping support is the far more elegant use of tag libraries to encapsulate markup creation. This means a 200 line JSPX file in Roo 1.0 is now just 12 lines in Roo 1.1.0. The repetition of markup has now been moved into a JSPX-based tag, allowing you to easily make edits that impact all pages in your application. Therefore, you now have easier maintenance, automatic round-trips, and concise, focused, clutter-free JSPX pages! You can read more about how all of this works in the Web MVC Add-On section of our reference guide.
Other enhancements to the Spring MVC support include the elimination of the URL rewrite filter, as this capability has now been baked into Spring itself. Extra localization packs can now be installed from third-party add-ons using the “web mvc install language” command. This is especially useful as it allows external developers to maintain the localization (we’ve even created an add-on creation command to make producing these localization add-ons easy).
The Spring MVC scaffolding now also supports embedding content from 16 social media sites. It’s as easy as using the new “web mvc embed” command to add content from the likes of YouTube, Google Video, Vimeo, Viddler, Screenr, UStream, LiveStream, Flickr, Picasa, Google Presentations, Scribd, SlideShare, Google Maps, Google Wave, Twitter and Wikinvest.
Rounding out these extensive improvements to the Spring MVC features is automatic JSON REST support. To see this in action, run the “script clinic.roo” command, followed by the “json all” command, create an owner using the web UI, and then use this command to list all of the owners:
curl -v -H ‘Accept: application/json’ -X GET http://localhost:8080/petclinic/owners/.
Google Web Toolkit (GWT) 2.1
We started collaborating with Google in late 2009, and our engineering teams have been working closely together to deliver an integrated set of developer technologies. During the Google I/O Day 1 Keynote in May 2010 we demonstrated our early work on Spring Roo and Google Web Toolkit interoperability. We’ve continued enhancing this interoperability, and now you can use Roo to build complete GWT applications that use the latest GWT 2.1 features such as RequestFactory, MVP framework, data-binding widgets etc.
Related to these features is the new Google plugin support in SpringSource Tool Suite 2.5.0. Not only does SpringSource Tool Suite have extensive Spring Roo 1.1.0 support (such as an embedded Roo shell), it also offers out-of-the-box support for Google Web Toolkit development through inclusion of the Google Plugin for Eclipse.
You can try out the latest GWT support by using our expenses sample. You can find this in the /samples directory of the Spring Roo download. Or you can simply create the project and run it via these commands
mkdir expenses cd expenses roo roo> script expenses.roo roo> quit mvn gwt:run
Google App Engine (GAE)
Also as part of the aforementioned collaboration with Google we’ve ensured Roo applications can be built for deployment to Google App Engine. GAE offers a scalable approach to building applications, and includes options such as a free usage quota and Google App Engine for Business.
Enhancements have also been made in SpringSource Tool Suite to better support Roo-created Google App Engine projects. For example, STS manages the lifecycle of the Data Nucleus 1 enhancer plugin that is necessary for GAE persistence. This all integrates with inbuilt support for m2eclipse, which is the typical way Roo projects are managed in Eclipse-based IDEs such as STS.
You can try out the latest GAE support by using the expenses-gae.roo sample script. Once again you can find this in Roo’s /samples distribution directory. You’ll see further improvements to our GAE support in the forthcoming Roo 1.1.1.
Apache Solr Search Server
Apache Solr is a search server based on Apache Lucene. Solr allows you to have a dedicated search server indexing your objects and query for them over a REST API (with JSONP support as well).
Roo 1.1.0 adds Solr integration, ensuring that whenever an entity is created, updated or deleted, the Solr search server is automatically notified. It also adds various Solr-related convenience methods to your entities, such as a
search(String) method that will automatically dispatch a free-text search query to your Solr server and locate matching entities. There are other similar search and index-management related methods also added to entities via a Roo ITD.
To learn how to setup your Solr server and use it in Roo-based applications, just visit the Solr section of the reference guide.
In Roo 1.1.0 we’ve added support for allowing any Java object to be easily converted to and from JSON representations. New methods such as
fromJson(String) and array-related JSON handling methods are automatically managed via a Roo ITD. Simply add a @RooJson annotation to your Java class and you’ll have this support automatically.
Most Java developers would have experienced the tedious task of maintaining the
serialVersionUID of your java.io.Serializable classes.
With Roo 1.1.0 you don’t need to worry about serialization warnings. Just pop @RooSerializable on your Java class and forget about it. Roo will implement Serializable for you, plus automatically maintain the version UID on your behalf.
Naturally we’ve kept up-to-date with the latest library versions so your Roo-based projects always have access to the latest features and bug fixes. Roo-based projects now default to new versions of
- JPA 2 (with the corresponding updates to the JPA implementations)
- Spring Framework
- Spring Security
- Spring Web Flow
- Apache ActiveMQ
We’ve continued to make usability improvements aimed at making your development fun and easy. Some of our latest usability enhancements include
- Console messages are now more meaningful, telling you, for example, which dependencies are being added to your pom.xml
- Command options are now case insensitively matched, ensuring you can type in a more relaxed manner (of course if you use TAB the case will always be correct)
- We now use dependency identifiers from Maven Central where possible (no more Enterprise Bundle Repository IDs as we had in Roo 1.0)
- Upgrades are now easier because Roo will automatically update the Roo annotation JAR to the current Roo version
- There's a new "flash message area" which displays status updates for long-running operations at the top of the Roo command window (where operating system supported; we recommend any Linux, Windows or OSX's iTerm shell for the best experience)
- Your operating system's window title will automatically show the Roo version or project identifier (not available on Windows at this time, but will be soon)
- OSGi-related messages are now logged for easier debugging
- Comments can now start with a "#" as per configuration file and shell script conventions
- TAB assist is now provided for "hint" topics
- There's now a reminder in the AspectJ ITD files not to edit them
- Enhanced Windows support of Cygwin and native Windows startup scripts
Roo is now built on OSGi
A major - yet largely indistinguishable - change between Roo 1.0 and 1.1.0 is the transition to an OSGi foundation. We’re using Apache Felix as our OSGi framework, together with Service Component Runtime (SCR) for component management, and OSGi Bundle Repository (OBR) for bundle resolution. These key changes occurred so we could ensure Roo’s add-on infrastructure would be based on a modular, proven, remote dependency-resolvable classpath management model. Modern IDEs such as Eclipse are also built on OSGi, so this approach for tooling modularity and extensibility is well established.
Related to this change we needed to “wrap” many of the dependencies that Roo itself requires to run. We therefore established a wrapping module that addresses this requirement, while also providing an example of the technique for Roo add-on developers.
Those interested in having a dig around Roo’s OSGi internals can do so interactively by typing “osgi” and pressing TAB. There are many new OSGi commands now included in Roo. Most of these will be of interest to add-on developers as opposed to normal Roo users. You can even dispatch commands directly to the Felix runtime by typing “osgi framework command” and then the normal Felix command.
Add-On Creation, Publication, RooBot and PGP Signature Security
One of the reasons we added OSGi support was so we could support a community of third-party add-ons developing around Roo. It’s one thing to write an add-on, but you also need an easy way for the community to locate an add-on of interest and install it. You also need a robust and proven security model so that only developers you trust can write add-ons that are installed onto your computer. You also need a way for add-on developers to be able to develop and host the add-on anywhere they like, while still offering them some sensible defaults so they can get results quickly.
To help people quickly start developing an add-on, we’ve added an add-on creator to Roo. Just use the new “addon create” command. This command won’t only create an add-on skeleton for you, but it will also configure it for out-of-the-box hosting on Google Code and ensure your project’s OSGi Bundle Repository (OBR) file is automatically updated when you use the deploy goals. The OBR file even uses “httppgp://” as the protocol so your add-on ties into our decentralized PGP-based security infrastructure. So you can go from an empty directory to a properly-hosted, OBR-listed, security model compatible add-on in just minutes.
Of course, you can give out the OBR repository URL to your friends and fans, and they can use the “osgi obr url add” command to add it. However, there’s a much better way. Just shoot an email with OBR repository URL to firstname.lastname@example.org. Our RooBot server will then visit your OBR file and regularly monitor it for changes. It will then update the roobot.xml file on http://spring-roo-repository.springsource.org with valid, security model compatible add-ons. All Roo instances will then discover your add-on, because they will have downloaded a copy of roobot.xml when they run.
Roo users can then install your add-on simply by typing the “addon install” command. TAB assist even completes your add-on’s name. Once they press ENTER, your OBR file will be added to their Roo installation and a download will be attempted. However, because of the httppgp:// protocol, Roo will only permit the download to complete if your PGP key is trusted by the user (or they’ve typed “pgp automatic trust” if they trust everybody).
Another way that Roo users can discover your add-on is to simply type a command your add-on offers. Roo will automatically list all known add-ons that offer that command. There’s also the “addon list” command to help people find your add-ons.
Other changes we’ve made in Roo 1.1.0 include
- Moving to Git
- Freshening up our web site
- Establishing a new logo
- Setting up the @SpringRoo Twitter ID and list of our engineers
- Giving away free kangaroos and t-shirts
If you’re new to Spring Roo and would like to take advantage of all these features, simply download Roo and follow the introductory chapter of the reference guide. We’ve also prepared upgrade notes for those existing users who’d like to upgrade their projects to this new version. You might also like to consider downloading SpringSource Tool Suite 2.5.0 (STS), as it has many Roo and Google-specific features that will make your development life easier. Indeed if you download STS, you can skip downloading Roo, as STS 2.5.0 embeds Roo 1.1.0 for your convenience.
Next month we’ll be releasing Roo 1.1.1. There’s quite a few little improvements we’re currently finishing off and including in Roo 1.1.1, so check back soon. Following @SpringRoo and the engineering team on Twitter is the easiest way to keep informed of development and new versions. We also encourage you to participate on the Spring Roo forum for advice and questions related to Roo. On the forums you’ll find help from a friendly Roo community, plus the engineers from the Roo and GWT teams.
We hope that you enjoy using Spring Roo 1.1.0 as much as we’ve enjoyed building it.