// Sync each of the content sources associated with the repo.
for (ContentSource source : repo.getContentSources()) {
try {
ContentProvider provider = getIsolatedContentProvider(source.getId());
SyncProgressWeight sw = provider.getSyncProgressWeight();
PackageSourceSynchronizer packageSourceSynchronizer = new PackageSourceSynchronizer(repo, source,
provider);
log.debug("synchronizeRepo :: synchronizePackageMetadata");
tracker = updateSyncStatus(tracker, ContentSyncStatus.PACKAGEMETADATA);
tracker = packageSourceSynchronizer.synchronizePackageMetadata(tracker);
} catch (Exception e) {
processSyncException(e, tracker, repo, source, repoManager);
}
}
ThreadUtil.checkInterrupted();
// Setup ProgressWatcher
for (ContentSource source : repo.getContentSources()) {
ContentProvider provider = getIsolatedContentProvider(source.getId());
SyncProgressWeight sw = provider.getSyncProgressWeight();
tracker.getProgressWatcher().addWork(sw.getPackageMetadataWeight());
tracker.addAdvisoryMetadataWork(provider);
tracker.getProgressWatcher().addWork(sw.getDistribtutionBitsWeight());
tracker.getProgressWatcher().addWork(sw.getDistribtutionMetadataWeight());
tracker.addPackageBitsWork(provider);
tracker.getProgressWatcher().finishWork(sw.getPackageMetadataWeight());
}
tracker = updatePercentComplete(tracker, repoManager);
// Sync package bits.
for (ContentSource source : repo.getContentSources()) {
// Don't let the entire sync fail if a single content source
// fails
try {
ContentProvider provider = getIsolatedContentProvider(source.getId());
if (provider instanceof PackageSource) {
PackageSourceSynchronizer packageSourceSyncer = new PackageSourceSynchronizer(repo, source,
provider);
log.debug("synchronizeRepo :: synchronizePackageBits");
tracker = updateSyncStatus(tracker, ContentSyncStatus.PACKAGEBITS);
tracker = packageSourceSyncer.synchronizePackageBits(tracker, provider);
tracker = updatePercentComplete(tracker, repoManager);
}
} catch (Exception e) {
processSyncException(e, tracker, repo, source, repoManager);
}