InSync: Automatic Offline Data Synchronization in AIR using LCDS 2.6

InSync: Automatic Offline Data Synchronization in AIR using LCDS 2.6

LCDS 2.6 allows you to build AIR applications with automatic offline data synchronization. This feature leverages the SQLite relational database system embedded in the AIR runtime, but the advantage is that the data synchronization process is entirely automatic: you don’t have to write SQL statements or synchronization logic to keep your local database in sync with your central database.

I have been getting a number of questions related to this feature, so I decided to build a sample application that demonstrates how it works.

In this application the synchronization process is implicit. When you are online, the cache (a SQLite database) is automatically updated along with the server database to make sure the user can go offline with the latest data without explicitly triggering a synchronization process. When you are offline, the changes are saved in the local cache. If the network becomes available while working in the application, the application will detect the network status change and automatically synchronize data (send your offline changes to the server, and get changes made by other users while you were offline).

Installation Instructions

  1. If you haven’t already done so, install LCDS 2.6.
  2. Unzip insync.zip
  3. Copy the content of the sampledb folder in the sampledb folder of your existing LCDS directory
  4. Copy the content of the tomcat folder in the tomcat folder of your existing LCDS directory
  5. Add the following destination to data-management-config.xml

    <destination id="insync">
        <adapter ref="java-dao" />
        <properties>
            <source>lcds.samples.contact.ContactAssembler</source>
            <scope>application</scope>
            <metadata>
                <identity property="contactId" undefined-value="0"/>
            </metadata>
        </properties>
    </destination>
    

  6. Restart the sample database: run sampledb.bat (Windows) or sampledb.sh (Unix) in the sampledb directory
  7. Restart your application server

Quick Tour

  1. Install and run the AIR application. Notice the green light in the status bar indicating that the application is in online mode.

    Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.

  2. Double click a contact to view the contact details.
  3. Modify the data in a few fields and click Save. Your server console indicates that the contact has been updated.
  4. Click the + button in the application title bar. Enter a first name, last name, etc and click Save. Your server console indicates that the contact has been updated.
  5. Shut down the server
  6. Notice that the green light turns grey to indicate that the application is now working in offline mode.
  7. Repeat steps 2 to 4 above: changes are saved locally. Notice that the offline status (not modified, created, or updated is displayed in the contact form (bottom left corner)
  8. Restart the server.
  9. The green light appears in that status bar as soon as the server is up and running. Notice that LCDS automatically detects the offline changes and sends them to the server.
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • LinkedIn
  • StumbleUpon
  • Twitter
This entry was posted in Air, Flex, LCDS, SQLite and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

53 Comments

  1. Posted August 9, 2010 at 2:49 pm | Permalink

    thanx so much

  2. Posted August 12, 2010 at 12:05 am | Permalink

    thanx so much

  3. mohsin
    Posted August 19, 2010 at 9:26 pm | Permalink

    is it possible using lcds can we store the data to mysql

10 Trackbacks

  1. By 17 Pens » links for 2008-05-20 on May 20, 2008 at 2:31 pm

    [...] InSync: Automatic Offline Data Synchronization in AIR using LCDS 2.6 : Christophe Coenraets (tags: lcds read air) Posted in del.icio.us [...]

  2. [...] Online/Offline Synchronizaton with AIR and LCDS at 360|Flex San Jose, but Christophe Coenraets just published a wicked example of how it works called InSync. Well worth checking out. This entry was posted on Tuesday, May 20th, 2008 at 5:26 pm and is [...]

  3. [...] then points us to a resource that can help. Using LCDS, Christophe Coenraets has just published a sample application called InSync (zip file) that shows developers how to build [...]

  4. [...] then points us to a resource that can help. Using LCDS, Christophe Coenraets has just published a sample application called InSync (zip file) that shows developers how to build [...]

  5. [...] Coenraets has an AIR demo for offline data syncing with LiveCycle [...]

  6. By pocker game holdem texas hold em on September 2, 2008 at 12:51 am

    pocker game holdem texas hold em…

    tenement,Gus Campbellsport grocer Crusoe,swampy …

  7. [...] got the slides for anyone who wants to jump in and try it out. I highly suggest checking out Christophe’s demo from which I drew a bunch of my inspiration. He’s implemented the functionality in Java while [...]

  8. [...] got the slides for anyone who wants to jump in and try it out. I highly suggest checking out Christophe’s demo from which I drew a bunch of my inspiration. He’s implemented the functionality in Java while [...]

  9. [...] are several resources describing in details this feature in detail and providing some samples – Cristophe Coenraets blog, an article on Inside RIA and the developer [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>