Defining URIs: XPD621
The URI is not a specific type. The URI is the unique identifier for a SyncUnit and its related SUSyncData. There is no specific format for the URI, but conceptually it might contain a resource and a target for the sync process. The Sync UI will only be available if there are valid URIs defined to sync.
Creating a SyncUnit: XPD621
Let's take a look at the task of creating a SyncUnit with valid URI (as having a SyncUnit with a valid URI is necessary for the Synchronization UI to display). We will use the same code snippet from above, but look at it from the point of view of the SyncService implementation.
Adding a SyncUnit: XPD621
At this point, there is no URI assigned to this SyncUnit. Since the SyncUnit object returned is a template, we need to fill in the template with its appropriate properties, such as the local file location, and the target server. Once this template is filled in, then we need to call the SyncManager to add a concrete instance of the SyncUnit based upon our completed template.
Managing SyncEventListeners: XPD621
The SyncService is called to add and remove event listeners. The required and optional events must be sent to each of the listeners. The SyncService can use the SyncEventSource class to assist with listener management. The SyncService is not required to use the SyncEventSource and can manage listeners and send notifications using its own implementation, however, the SyncEventSource will eliminate the need to implement your own logic.
Generating events: XPD621
When the service is called to sync, it must generate and send events to enable the scheduler and UI to work properly. Events are created using the SyncEventFactory. Event types are defined via the EventType class.
Managing the synchronization history: XPD621
The SyncService interface defines a method getSyncHistory
that returns an array of SyncHistory objects. The second parameter defines the number of history objects that should be returned. At present, the Synchronization UI only requests that one SyncHistory object be returned.