Automation responses can be cached. This basically means that the JSON response sent by the Nuxeo server is stored on the local filesystem and is associated with a DB record that maintains metadata. The extra metadata in the SQL DB are used to be able to match a response with the corresponding request. The DB also contains the informations to be able to reconstruct the request, so that the cache can be refreshed.
Compared to the "standard Automation Client API", when calling an operation you can specify expected caching behavior.
DocRef docRef = new PathRef("/"); // Call with no CacheBehavior => default to CacheBehavior.STORE session.newRequest("Document.GetChildren").setInput(docRef).execute(); // Call with CacheBehavior.STORE => will cache the response session.newRequest("Document.GetChildren").setInput(docRef).execute(CacheBehavior.STORE); // Force refresh (try to fetch from server, store to cache) session.newRequest("Document.GetChildren").setInput(docRef).execute(CacheBehavior.FORCE_REFRESH);
This cache stores document deltaset (changes done in the document). This includes newly created documents that do only exist in local.
The TransientState manager is mainly updated via events (
AndroidTransientStateManager is a
This design helps making the TransientState management as transparent as possible. When a Document is created or update in local, a event is sent : TransientStateManager stores the delta. When the create/update operation has been processed by the server a new event will be fired and the TransientStateManager will delete the local storage.
To reflect the synchronization status, the Document has a
getStatusFlag() that returns an Enum:
"new"means that the document only exists in local for now,
"updated"means that the document hold local modifications that have not yet been pushed to the server,
""means that the document is synchronized with the server,
"conflict"means that the push on the server resulted in a conflict,
TransientStateManager exposes an API to automatically fetch and merge deltasets on a List of Documents, but in most of the cases this is already encapsulated by the DocumentProviders.
This caches keeps track of the Create/Update/Delete operations that are pending and should be sent to the server when network is accessible. Each cached operation is indirectly linked to a set of TransientState. In addition, pending Request can have dependencies:
- dependencies between update requests,
- dependencies with pending Uploads.
Deferred Updates system is exposed via
DeferredUpdateManager service interface. This service can be used to send an update request:
String execDeferredUpdate(OperationRequest request, AsyncCallback<Object> cb, OperationType opType, boolean executeNow);