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.
There are two models for defining URIs.
- Well-defined URI -- The URI is defined by the SyncService
- Dynamic URI -- The URI is defined when something creates a new SyncUnit
Some examples will most likely help here. Let's consider first the case of a Sync Engine that will sync calendar information to a server. There is only one type (a calendar) that needs to sync, and there is only one server that this data will be sync'd with. Therefore, there is only one URI that needs to exist to identify the Calendar sync to this server. The URI could simply be Calendar
. However, since the URI must be unique within the platform, further qualifying it with your bundle id would be better, such as com.mycompany.pim-Calendar
. Since this is just a String, the formatting is not important. The SyncService interface defines a method to get the URIs. In this particular case, the SyncService implementation will return the one known URI, and the SyncService implementation would reject any attempt to add and/or update a new SUSyncData that does not contain the known URI.
A second case might be a Sync Engine that is capable of syncing files to servers. The Sync Engine doesn't care about the file contents, it just deals with the file as binary data. The user of this Sync Engine can at any point add new files to sync. Therefore, at the lower code level, when a user wants to sync a new file, a new URI must be defined, as the Sync Engine and the SyncService do not a priori know the list of files that need to be sync'ed. In this particular case, the SyncService implementation can add new SUSyncData units, and the list of URIs will be dependent upon the set of SUSyncData that have been created.
Parent topic: Implementing SyncService: XPD622