7.1 Implementing Synchronization Engine
Engine DLL
The engine can be implemented as a DLL with a very simple API.
Here is a possible C#/pseudo code implementation:
public class SynchronizationEngine { public Uri SourceEndpoint { get; set; } public Uri TargetEndpoint { get; set; } public Uri[] DiagUris { get; set; } public void RunPass() { // GET digest from TargetEndpoint/$syncDigest // POST digest to SourceEndpoint/$syncSource and get delta feed in response // POST delta feed to TargetEndpoint/$syncTarget and get result feed in response // POST response to all DiagUris } }
As this pseudo code demonstrates, the engine DLL will be a very simple component with a very small footprint. It should be easy for us to provide implementations for different execution environments (NET, Java, COM, Javascript).
Using the Engine DLL
Here is a typical C# method that instantiates the engine to run a synchronization pass:
public void RunSynchronizationEngine() { var engine = new SynchronizationEngine(); engine.SourceEndpoint = new Uri("http://www.example.com/sdata/app1/test/-/accounts"); engine.TargetEndpoint = new Uri("http://www.example.com/sdata/app2/test/-/accounts"); engine.DiagUris = new Uri[] { new Uri("http://www.example.com/sdata/eventManager/test/-/diagnoses") }; engine.RunPass(); }