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.
Some code will make the following call
SyncManager sm = SyncManagerFactory.getSyncManager();
FileSyncUnit template = (FileSyncUnit)sm.createSyncUnit( "com.ibm.filesync" );
and will be returned a SyncUnit object. In fact, the SyncUnit object returned will be of a specific concrete implementation, and the caller, by virtue of knowing that they were asking for a specific type (com.ibm.filesync
), will know that the returned SyncUnit will in fact be an instance of FileSyncUnit. The returned FileSyncUnit is also the 'default' definition of a FileSyncUnit, meaning that any specifics have not been filled in. The Sync Manager documentation may term this a template for creating concrete instances of FileSyncUnits. So how did we get back a FileSyncUnit from this call?
- The SyncManager will locate the SyncService responsible for the com.ibm.filesync type
- The SyncManager will call the SyncService.createDefaultSyncData() method to obtain a default instance (FileSyncUnitData) of the engine data for this type
- The SyncManager will locate the TypeService responsible for the com.ibm.filesync type
- The SyncManager will call the TypeService.createSyncUnit( "com.ibm.filesync", SyncUnitCore ) method to create a default(template) instance of the FileSyncUnit. (The SyncUnitCore will contain among other things a reference to the default SUSyncData for this SyncService)
- The SyncManager will return the FileSyncUnit to the caller.
Parent topic: Implementing SyncService: XPD621