if (!(provider instanceof PackageSource)) {
// Nothing to do.
return tracker;
}
PackageSource packageSource = (PackageSource) provider;
// Load packages to send to package source
// --------------------------------------------
long start = System.currentTimeMillis();
List<PackageVersionContentSource> existingPVCS; // already know about this source
Set<ContentProviderPackageDetails> allDetails; // send to plugin
Map<ContentProviderPackageDetailsKey, PackageVersionContentSource> keyPVCSMap;
Subject overlord = subjectManager.getOverlord();
existingPVCS = contentSourceManager.getPackageVersionsFromContentSourceForRepo(overlord, source.getId(), repo
.getId());
int existingCount = existingPVCS.size();
keyPVCSMap = new HashMap<ContentProviderPackageDetailsKey, PackageVersionContentSource>(existingCount);
allDetails = new HashSet<ContentProviderPackageDetails>(existingCount);
translateDomainToDto(existingPVCS, allDetails, keyPVCSMap);
log.info("Synchronize Packages: [" + source.getName() + "]: loaded existing list of size=[" + existingCount
+ "] (" + (System.currentTimeMillis() - start) + ")ms");
// Ask source to do the sync
// --------------------------------------------
start = System.currentTimeMillis();
PackageSyncReport report = new PackageSyncReport();
packageSource.synchronizePackages(repo.getName(), report, allDetails);
tracker.setPackageSyncCount(report.getNewPackages().size() + report.getUpdatedPackages().size());
log.info("Synchronize Packages: [" + source.getName() + "]: got sync report from adapter=[" + report + "] ("
+ (System.currentTimeMillis() - start) + ")ms. Have: " + tracker.getPackageSyncCount()
+ " packages to sync");