Jack has posted 1 posts at DZone. View Full User Profile

Generating Enterprise Class GWT Applications for Spring

08.06.2010
| 15498 views |
  • submit to reddit

MyEclipse for Spring 8.6

Genuitec and Skyway Software recently announced the production release of MyEclipse for Spring 8.6. The latest release expands upon a set of advanced accelerators for Spring development, providing new options for rapidly generating Adobe Flex, Spring MVC, Google Web Toolkit (GWT), Spring Web Flow and iPhone Web applications. The release also introduces a new set of Spring development editors, Code Assistants, that facilitate the annotation-based development of Spring and JAX-WS artifacts.

MyEclipse for Spring (ME4S) 8.6 now supports the generation of reusable software components based on your data model. Whether you are starting from RDBMS tables, POJOs, JPA Entities, or WSDLs, ME4S can give you a lot of great technology to use in your project. You can see these components put to use in a basic, running CRUD-based application right after you finish filling out a simple wizard, but a lot of the value really comes from being able to leverage all of this technology as you build out other parts of your project. If you have an existing project and you want to get out of the business of maintaining the JPA/DAO/Service layer by hand, ME4S can also take on this responsibility for you.

With the 8.6 release, we added a variety of new UI generation options because we are hearing consistently from Java developers that as they explore the use of technologies like Flex and Google Web Toolkit (GWT), it is sometimes hard to find great examples. Developers have told us that as they begin the process of evaluating these technologies, it would be nice to be able to demonstrate them running contextually against their own data for their internal and external partners. ME4S lets you take an existing data model from an application that needs to be modernized, and very quickly generate the basic services you need on the back end, as well as building out nice clean UI components that are tailored for your data model.

If you have built software using almost anything that ends in WT, you’ll know that a lot of the time is spent integrating the Windowing Toolkit UI components to the data model and setting up the application to use best practices for that UI technology. ME4S does a lot of this for you and as always, makes sure you have a running example at each stage of the process.

GWT

In this article, I am going to cover what is generated from the GWT generation capability in some detail. I will review the Spring back-end generation options at a high level, since this stack is used by all of our generated UI’s, and then dive into the Java code that is generated for the front-end. It is important to note, however, that the GWT front-end can also be generated to be agnostic to the persistence layer so that you can tie your GWT front-end to any back-end implementation that you wish.

Prerequisites

If you have not already read the ME4S tutorial on GWT Scaffolding, you should read it now here. This tutorial takes you step-by-step through the process of using the software to generate your GWT application. Once you are comfortable with this information, we can dive in a bit into the code that was actually generated.

Design Philosophy

The GWT integration in MyEclipse for Spring is targeted specifically at the GA version of GWT and the most widely adopted versions of Spring (both 2.5 and 3.0). We wanted to make sure that developers had tooling options that supported the technologies that are available to them right now for use in production applications. ME4S currently supports GWT 2.0.4, which is generally available at the time of the 8.6 release. We intend to support GWT 2.1 as quickly as possible as it moves towards general availability. The code that is generated from ME4S is intended to follow the best practices for GWT 2.0 as prescribed by Ray Ryan’s Google I/O presentation.

We also thought it was important to include as few 3rd party GWT projects as possible in the default implementation. There are a few great projects out there, and several great commercial GWT component providers, but we wanted to be sure that we didn’t make too many decisions for you in this case, and that what we built for GWT was based on what you could get straight from Google.

Summary of Goals

Goal Description
Use existing technology assets Java Beans, RDBMS, JPA, WSDL
MVP Architecture Follow a Model View Presenter Approach
UIBinder Define UI’s using GWT’s UIBinder
Command Pattern Encapsulate using commands as described in Ray Ryan’s Google I/O presentation
DTO Use Data Transfer objects to encapsulate the data that should be sent to the client, and to control relationship management
Loose and Lazy Relationships Promote a design pattern that defers the loading of related data until it is needed with loose Server based relationship management
Back End Agnostic Tie the GWT front end to an automatically generated Spring/JPA persistence layer, or just generate a Service stub and then hand code the persistence to integrate with any back end.
I18N Support Generate UI’s that are already set up to be localized
Client Bundles Use Client Bundles for optimization
Published at DZone with permission of its author, Jack Kennedy.

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