Thursday, 5 February 2015

skysail: Turning models into RESTful applications

Sometime in 2011, I had this idea to "write something with OSGi".

What I had in mind was a kind of minimal system providing some default services (well, logging, persistence, whatever) together with a concept of how smaller "applications" could be plugged in
with little effort, utilizing these default services. A little bit like a smartphone together with its apps ;)

I had quite a bit of experience with Eclipse RCP, so this is why I started using Eclipse PDE for development. I mad some progress and thought things were looking good.
But the more bundles I had, the harder it was to get them started properly. Using start levels I was able to get things working somehow, but this didn't feel right. Especially when it comes to the dynamic nature of OSGi, ordering shouldn't matter.

In the meantime, I switched to the maven bnd plugin as I was pulling my hair out too often to get things done with Eclipse PDE. And I switched from equinox to felix, it just felt more pure.

I also started utilizing restlet to define a RESTful API for my little apps. Loved it and still do! Fortunately, sometime in 2013, I read the book "Building Modular Cloud Apps with OSGi " by Paul Bakker and Bert Ertman which convinced me to give bndtools another try. Oh my good, what a relieve. OSGi development never felt so good!

One last thing was really getting on my nerves: JPA Integration to talk to databases. There are a lot issues to solve to get things done properly, and somehow I managed it. But, start levels again! I was using flyway to setup and migrate the database, but this meant that I needed to know about the bundles with entities in advance and make sure that things were handled in the proper order.

Then I found out about orientdb. And I just threw out all JPA related stuff, nice!

By now, I have a proof-of-concept implementation of what I call a business server: A modular system running on the server-side, exposing business models as applications, utilizing common
services like persistence, validation, documentation, sanitization and so on.

If you like, have a look at the little page I set up for this project (called 'skysail'): You'll find a little Getting-Started Guide explaining some of the ideas together with a Todo-Model in various stages of development - which can be executed as a corresponding RESTful web application.

Here's the link ;)

Stay tuned!