Thursday, August 18, 2011

A simple Vaadin application for Google App Engine

Here is a very simple application written in Vaadin that can be installed on Google App Engine. This application uses the users API to log users in and out. It also saves users last login time in the database as an example on how to connect to database. It is built by Maven and separated in two different modules, Java codes and GAE stuff.

Browse the code here, or check it out on your machine using this command:
svn co simplegae

These are the steps to get it working on your own box, as outlined in the README file:
  1. Run in order to install appengine-local-runtime (not included in Maven repository).
  2. Run mvn clean install to compile the application.
  3. Run to run the application locally.
  4. Create a new AppEngine application (here).
  5. Modify ./simplegae-appengine/src/main/webapp/WEB-INF/appengine-web.xml and put in name and version number of your application.
  6. Run to deploy the application.
The provided scripts shouldn't put Windows users off, since they only run a sequence of simple commands.

One of the biggest impacts of moving to App Engine on your Vaadin application is the fact that your application will end up being serialized/deserialized between requests. As a prerequisite, all your classes must be Serializable. Unsupported features (like polymorphic queries) and some specific requirements (transactions and entity groups) should also be considered.