Online/offline data sync with Adobe AIR

This is a bit of a progress report. Bit light on actual wisdom, sorry – check back later for that.

I’ve been playing with Adobe AIR as a way to develop cross-platform intermittently online applications. I’ve already got a fully fledged Java domain model using Spring and Hibernate, so for the server side Spring’s BlazeDS integration is a real godsend – and it really is as easy to set up as it looks in the Adobe evangelist’s easy as falling off a log video. Flash Builder is pretty neat too, so all is good.

Local data storage is no drama, so one box left to tick – syncing offline data when we get back online.

There are some products that help with this:
Adobe’s LiveCycle Data Services – a vast, enterprise-grade JEE app. Not ruling it out, but hey, I just want to sync a couple of records – this is going to be a very lightweight app.
WebORB – OK, I’m a Tomcat noob, but I failed to get this running in two of three possible installation modes. The one that did work, the prepackaged install, doesn’t even let you change the server port. Guess what – 8080 is already taken (who would have thought?). I don’t want to diss WebORB, but between my install problems and the fact that I really don’t need or want another server, I’m moving on for now.
Farata’s Clear Toolkit. Does anyone else find Sourceforge to be a complete PITA? Every second download fails. In this case *every* download failed. Life is too short to spend it looking at a page full of blinking ads.

OK, so I’ve parked the off-the-shelf idea until I’ve built up a bit more desperation. So how hard can it be to code this up from scratch? The server side is taken care of, all I need is the client-side code.

With SQLite on the client side, the term “database replication” springs to mind. On reflection, though, what I have on the client side is really just a cache, not a database in the business sense of the word. A write-though fault-tolerant cache with pluggable fetch and store strategies would fit the bill nicely. There must be a ton of those already out there, right?

Wrong. Not for AS3, anyway. Please ping me if you know of one.

So that leaves me with two options:

  1. Futz around with native process calls and try to package something like ehCache with my app. Is ehCache really going to work on a phone? I’m nervous.
  2. Write an AS3 cache myself. Now, I have the deepest respect for anyone who has written a bug-free caching system – that’s a very select bunch of people. So I’m still nervous.

Of course the third option is that my Google chops are rubbish and some kind reader will post one of those humiliating “if you looked for 0.7 seconds you would have found this” comments. Here’s hoping.