Monday, April 6, 2015

Apache Cayenne, Tomcat, Wicket and CXF together on docker and shippable

Yafra provides since Apache Cayenne 2.x an example of how Apache Cayenne can be used within some J2EE tools.

Till now it was always time consuming to build a running example which can be reproduced quickly by anyone else. But with services like Docker and Shippable it changed.

Shippable is an internet service which allows you to automate the build. With public repositories like a github repository it is free of charge. Every time you push changes to your github repository it will trigger a build on Shippable. The Shippable build makes use of the maven setup. Of course you can build it as well on your local desktop. The build includes as well unit tests and code coverage reports. Shippable uses docker for the build process which makes it very nice to combine with your own dockers.

Docker is a kind of virtual operating system, but not like a full VM, it re uses existing linux resources. Installation of docker is simple and getting a new image is as simple as executing docker pull xxxx. Docker makes use of the Linux Namespace feature. I personally see this development as replacement of existing VM technologies which still have too much overhead. Of course it restricts you on linux, however for yafra there is no dependency on an operating system, all applications/examples run on every operating system.

The Yafra Java examples makes use of relational databases (MySQL and Derby are used but other can easily be enabled). It provides a HTML client created with Apache Wicket. It provides EJB3 services using Apache OpenEJB/Tomee. It offers as well Web Services and RESTful API through Apache CXF.

A fat client exists using Eclipse RCP and EJB3, however this was archived and I'm doing a rewrite with an Eclipse RCP e4 client using RESTful API. Currently the RCP client has no network access to the RESTful server, however it runs and can be build with maven and tycho.

The full example shows how easy it is to work with Cayenne and still having a very readable code.

Follow the quick install on the Yafra Wiki to get it up and running with docker and see how things are working. The idea is to get a full example which runs and which you can apply to start up your own application.

Yafra Wiki: https://github.com/yafraorg/yafra/wiki

Yafra Quick Start: https://github.com/yafraorg/yafra/wiki/Quick-Start-Java

Yafra Projects: https://github.com/yafraorg/yafra/wiki/Projects