Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Problems with offline caching

Avatar

Level 2

In a recent AIR 2.6 application I use the offline caching feature of LCDS 3.1

The application itself uses a Java 6 / Spring 3 / JPA 1 / Hibernate stack (custom code, not using LC model driven development). For offline support, I started with the sample code from the LCDS 3.1 documentation which works ok in most cases - at least, if I fetch collections when online, then go to offline mode and fetch the same collections from the cache. This works fine and the SQLite data base gets created correctly.

However, as soon as I start calling fill() on a DataService in offline mode on a collection that has *not* been fetched before or try to load an lazy association which has not been fetched before, the DataService "hangs" in terms of that the AsyncToken returned by that fill() method never fires a result or fault event.

The last thing that happens in the client is

  [DEBUG] mx.data.SQLDBCache SQLDBCache - before select: SELECT id,data FROM [ORGANIZATION_FAVSOrganization]

and that’s it. In this case I don’t get any further feedback and the DataService does not create a result or fault event, it does not even time out. Not sure if this is by design or not but as I’m listening for result/faults event to display/hide progress indicators gives me a lot of headaches on how to control them in offline mode.

Any ideas?

Thanks,
Dirk

7 Replies

Avatar

Level 1

Dirk,

  Could you please send me a snippet of your code for offline?

  Also if you could send me a sqllite database that is being stored.

  This will help me figure out what is going on.

   You can either post your zip file or send it directly to me (hsee@adobe.com)

Thanks

Harry

Avatar

Former Community Member

same problem here..

is there any update on this?

thanks much!

Avatar

Level 1

Ranjeet,

  I am working with DIrk to narrow down his problem. In LCDS 3.1 the new feature of offline was added.

  As a part of the offline feature there is a sub feature called offlineAdapter. You can look at the documentation at this site.
(http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Developing/WS4ba8596dc6a25eff5fb1bf7c1271f8f6997-7ffa.html).

  Is you problem exactly the same as Dirk?

  If not, could you please send me a snippet of your code for offline?

  Also if you could send me a sqllite database that is being stored.

  This will help me figure out what is going on.

   You can either post your zip file or send it directly to me (hsee@adobe.com)

Thanks

Harry

Avatar

Former Community Member

Harry, thank you for your immed response.

I think I might have posted my problem under a wrong thread. I am facing this issue for older version of LCDS which I downloaded couple of years back.. it says ES 2.6 and am still a bit confused about the version numbers.

That being said, my problem is exactly the same. Everything works fine when LCDS server is reachable. However when offline, Fill() just does not call any of the handlers.

In case if you can still help:

Here is the DS definition:

public class UsersDataService extends EventDispatcher implements IFITDataService

{

private var mDS:DataServiceWrapper;

private var mAllUsers:ArrayCollection;

public function UsersDataService()

{

mDS = new DataServiceWrapper("UserInfo");

mDS.cacheID = "allusers"

mAllUsers = new ArrayCollection();

mDS.addEventListener(DataServiceFaultEvent.FAULT,OnFault);

mDS.autoConnect = true;

}

public function getAllUsers(locationId:String):void

{

mDS.addEventListener(ResultEvent.RESULT, OnResult);

if(mDS.isCollectionManaged(mAllUsers))

{

mDS.refreshCollection(mAllUsers);

}

else

{

mDS.fill(mAllUsers, locationId);

}

}

public function getUser(userName:String):void

{

mDS.addEventListener(ResultEvent.RESULT, OnResult);

mDS.getItem({ID:userName});

}

public function OnResult(event:ResultEvent):void

{

mDS.removeEventListener(ResultEvent.RESULT, OnResult);

trace(event)

var dsEvent:DataServiceEvent = new DataServiceEvent(DataServiceEvent.Result)

dsEvent.user = event.result

dispatchEvent(dsEvent);

}

public function OnFault(event:FaultEvent):void

{

trace(event)

}

public function getData(locationId:String):void

{

getAllUsers(locationId);

}

public function refresh():void

{

if(mDS.isCollectionManaged(mAllUsers))

{

mDS.addEventListener(ResultEvent.RESULT, OnResult);

mDS.refreshCollection(mAllUsers);

}

else

{

getAllUsers(FITSession.regLocationID);

}

}

public function get users():ArrayCollection

{

return mAllUsers

}

public function get connected():Boolean

{

return mDS.connected;

}

}

I am also attaching the 'allusers' db

Thanks much!

Avatar

Level 1

Ranjeet,

  I do not see the following in the code snippet that you sent.

         ds.fallBackToLocalFill = true;

  This is need to retrieve the data from the offline cache.

  Please try it.

-Harry

Avatar

Former Community Member

That method is not available in my version of client side LCDS libraries.

Thanks

Avatar

Level 1

You have an much older version of data services.

The offline feature is that version was a 1.0 release.

Can you update a newer version?