New Posts New Posts RSS Feed: Offline consideration and Sandbox editing mode ?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Offline consideration and Sandbox editing mode ?

 Post Reply Post Reply
Author
nazbrok View Drop Down
Newbie
Newbie
Avatar

Joined: 26-Jan-2011
Location: Paris
Posts: 21
Post Options Post Options   Quote nazbrok Quote  Post ReplyReply Direct Link To This Post Topic: Offline consideration and Sandbox editing mode ?
    Posted: 04-Oct-2011 at 4:18am
Hi,

I read the recent post http://drc.ideablade.com/xwiki/bin/view/Documentation/offline-best-practices and I wonder how is it possible follow these guide while using a sandbox for all the editing/creation ?

For the sandbox mode I have to create a New EntityManager which will apply the changes in base. If I need to have only one EntityManager while being Offline, how can I have a sandbox  ? Is is forbidden to use  a Sandbox while being offline ? If not, could you explain me how to do it ?

regards,



Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 10-Oct-2011 at 8:49pm
It's possible to still have sandboxes. You'll have to treat the central offline cache as a pass-through cache. The individual sandboxes will delegate query and save operations to the central offline manager. The purpose of the offline manager is to be a mirror of your datasource. Everything that is queried from the datasource should be queried into the offline manager and then imported into the sandbox. Similar for the save, the offline manager should be implemented as a write-through cache.
 
So, if the app is online, the offline manager keeps track of everything any of the sandboxes query, so that if suddenly you lose connection, the offline manager has a copy of everything that has been queried so far. New sandboxes that spin up simply query from the offline manager if they can't reach the server.
 
For the save, if the app is online, the saves go directly through to the server. If the app is offline, the offline manager keeps the changed entities until it can sync them back to the server.
 
It's quite a bit of work to get this all working and you'll have to implement logic to make sure all the caches stay coherent. When I implemented this, I basically created new query and save extension methods that encapsulated all this pass-through logic.  
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down