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.

5 thoughts on “Online/offline data sync with Adobe AIR

  1. “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.”

    Sounds like it’s time for you to walk among the select few.

    Keep it simple.

  2. @Marty
    Thanks for the pointer – had a quick look just now, looks like a nice approach to the client side. If there’s stuff in there to help syncing back to the server it’s not apparent from a quick read of the website, but I’ll download it and have a play.

    Thanks for the encouragement (takes a pull from a flagon of moonshine, wipes mouth with back of hand). I’ll get right onto it 🙂

  3. Ok, I realize this post is quite old now, but have you had any luck finding a solution to this? I’m currently looking for the same thing. Was thinking Coldfusion and Flex’s Syncmanager. CouchDB also looks nice but I’m not sure it fully works.

  4. Wow. Welcome to the blog, Mike. In a word, no. Not long after I wrote this post Flash was knifed in the back by Apple, and for reasons that continue to elude me a whole bunch of otherwise reasonable people decided that Javascript was a credible alternative. So, given that I was doing this project for love not money, I decided that clientside mobile development is just not a pleasant place to be right now and parked it.

    To be a bit more helpful: I agree that CouchDB shows promise, but I’ve never tried it in this scenario. Beyond that, if I *had* to do this today I’d be looking at the likes of PhoneGap et al.

Leave a Reply

Your email address will not be published. Required fields are marked *