For those who’ve been following my GitHub activity, you might have noticed I pushed some big updates on my Vaadin Engine project. The project will become a fully functioning starting point to develop Vaadin and Spring powered applications on Google App Engine. Right now it has integrated most of the Spring Security bits you’ll need in most projects and it has a basic but very functional approach at internationalization (i18n). All you need to get started is Maven and Eclipse.
This post is a follow up and addition to
The intent of the project is to create a high-level framework for developing a general CRUD Vaadin applications on Google AppEngine. The problem with such frameworks is that they tend to be too tailored at one application. I hope I can avoid that, but please let me know if there’s functionality missing and I’ll see what I can do. I know there are a few Vaadin frameworks available that offer lower level functions. I’ve decided not to use them for various reasons (not compatible with AppEngine, my intended application architecture was too different, etc.).
Vaadin-Engine is split into two parts:
- The core which has all the functionality and is your dependency if you want to use the project.
- A demo application to show how to use everything.
The architecture of the application is based on rich domain objects and you’ll find the following parts:
- A domain model (currently only has a User object)
- A GUI layer, consisting of Vaadin components (currently the most basic main window and a login popup)
- The Vaadin application that handles some of the crosscutting concerns (i18n and user management)
Vaadin Engine Security
I’ve chosen to go with Spring Security because it allows you to plug in a number of existing security providers. It also allows many Java developers to work with familiar API’s. The application uses a very simple Spring config and handles the authentication internally:
- Login is done programmatically so the login form can be a nice Vaadin form inside the application.
- The Vaadin user object of the application is filled to nicely integrate into Vaadin’s application structure.
- Role- and user-based authentication is done via function objects that guard different functionality.
Note: initially I wanted to use Spring Security’s annotation driven security, but this turned out to be too much a hassle. A second advantage is that the security function objects also allow for a better and stronger typed interface.
Try it out
To try it out yourself, you’ll need Git (GitHub’s tutorial is short but very clear), Eclipse and the Google AppEngine plugins for Eclipse.
Next up open Git bash in a directory where you want to get the project:
git clone email@example.com:pbackx/PoweredByReindeer.git
mvn clean install
Start Eclipse and import the existing projects (there should be two projects imported, you won’t see the parent project).
Right click on the vaadin-engine-demo project and Run As > Web Application (*).
When the server is started point your browser to http://localhost:8888/ and you should see a login button.
Two logins are available: jimi / jimispassword and bob / bobspassword. Jimi is an admin and will have an admin function (that does nothing but show a message), Bob isn’t able to see this function (right now he can only log out of the application).
Enjoy, and please comment with suggestions and problems.
(*) The first time you run the application, AppEngine will ask for a webapp directory. You can permanently solve this by going into the demo project properties. Choose Google > Web Application. Select “This project has a WAR directory”. Now click on the “Browse …” button and select src > main > webapp. This should permanently solve this pop-up. If any one knows how to set this property via the Maven build file, please let me know how.
I am going to eat my own dogfood and integrate this in my own Vaadin powered application for Flemish entrepreneurs.