Examples of RepoSyncResults


Examples of org.rhq.core.domain.content.RepoSyncResults

            report.addNewPackage(details);
            Map<ContentProviderPackageDetailsKey, PackageVersionContentSource> previous;
            previous = new HashMap<ContentProviderPackageDetailsKey, PackageVersionContentSource>();

            // merge the report!
            RepoSyncResults results = new RepoSyncResults(repo);
            results = repoManager.persistRepoSyncResults(results);
            assert results != null;

            results = contentSourceManager.mergePackageSyncReport(contentSource, repo, report, previous, results);
            assert results != null;
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

            inCS = contentSourceManager.getPackageVersionsFromContentSource(overlord, contentSourceId, pc);
            assert inCS != null;
            assert inCS.size() == 0 : inCS;

            // need this to pass to merge
            RepoSyncResults results = new RepoSyncResults(repo);
            results = repoManager.persistRepoSyncResults(results);
            assert results != null;

            // this report will add a mapping to PV->CS
            PackageSyncReport report = new PackageSyncReport();
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

            // just make sure there are no package versions yet
            assert 0 == contentSourceManager.getPackageVersionCountFromContentSource(overlord, contentSourceId);
            assert 0 == repoManager.getPackageVersionCountFromRepo(overlord, repoId);

            // need this to pass to merge
            RepoSyncResults results = new RepoSyncResults(repo);
            results = repoManager.persistRepoSyncResults(results);
            assert results != null;

            // this report will add a mapping to PV->CS
            PackageSyncReport report = new PackageSyncReport();
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

            details.setFileSize(0L); // under the covers this ends up allowing us to create a package bits of size 0
            report.addNewPackage(details);
            Map<ContentProviderPackageDetailsKey, PackageVersionContentSource> previous;
            previous = new HashMap<ContentProviderPackageDetailsKey, PackageVersionContentSource>();

            RepoSyncResults results = new RepoSyncResults(repo);
            results = repoManager.persistRepoSyncResults(results);
            assert results != null;

            contentSourceManager.mergePackageSyncReport(contentSource, repo, report, previous, results);
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

        distributionSource.synchronizeDistribution(repo.getName(), distReport, distDetails);

        log.info("Synchronize Distributions: [" + repo.getName() + "]: got sync report from adapter=[" + distReport
            + "] (" + (System.currentTimeMillis() - start) + ")ms");

        RepoSyncResults syncResults = contentSourceManager.mergeDistributionSyncReport(source, distReport, tracker
            .getRepoSyncResults());
        tracker.setRepoSyncResults(syncResults);
        tracker.getProgressWatcher().finishWork(provider.getSyncProgressWeight().getDistribtutionBitsWeight());
        return tracker;
    }
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

            + " packages to sync");

        // Merge in the results of the synchronization
        // --------------------------------------------
        start = System.currentTimeMillis();
        RepoSyncResults syncResults = contentSourceManager.mergePackageSyncReport(source, repo, report, keyPVCSMap,
            tracker.getRepoSyncResults());
        tracker.setRepoSyncResults(syncResults);
        log.info("Synchronize Packages: [" + source.getName() + "]: merged sync report=("
            + (System.currentTimeMillis() - start) + ")ms");
        return tracker;
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

        ThreadUtil.checkInterrupted();

        log.error("Synchronize Advisory: [" + source.getName() + "]: got sync report from adapter=[" + advReport
            + "] (" + (System.currentTimeMillis() - start) + ")ms");

        RepoSyncResults syncResults = contentSourceManager.mergeAdvisorySyncReport(source, advReport, tracker
            .getRepoSyncResults());
        ThreadUtil.checkInterrupted();

        log.error("Synchronize Advisory: [" + source.getName() + "]: finished mergeAdvisorySyncReport ("
            + (System.currentTimeMillis() - start) + ")ms");
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

        StringBuilder progress = new StringBuilder();
        progress.append(new Date()).append(": ");
        progress.append("Start synchronization of Repository [").append(repo.getName()).append("]\n");
        progress.append(new Date()).append(": ");
        progress.append("Getting currently known list of content source packages...\n");
        SyncTracker tracker = new SyncTracker(new RepoSyncResults(repo), new ProgressWatcher());
        tracker.setResults(progress.toString());
        tracker.setRepoSyncResults(repoManager.persistRepoSyncResults(tracker.getRepoSyncResults()));
        log.debug("synchronizeRepo :: inProgress");
        tracker = updatePercentComplete(tracker, repoManager);

        if (tracker.getRepoSyncResults() == null) {
            log.info("Repository [" + repo.getName()
                + "] is already currently being synchronized - this sync request will be ignored.");
            return false;
        }

        boolean syncCancelled = false;
        try {
            ThreadUtil.checkInterrupted();

            // 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);
                }
                // Check for cancellation after each content source.
                ThreadUtil.checkInterrupted();
            }

            // Sync distro metadata.
            log.debug("synchronizeRepo :: synchronizeDistributionMetadata");
            for (ContentSource source : repo.getContentSources()) {
                try {
                    ContentProvider provider = getIsolatedContentProvider(source.getId());
                    if (provider instanceof DistributionSource) {
                        DistributionSourceSynchronizer distroSourceSyncer = new DistributionSourceSynchronizer(
                            repo, source, provider);
                        tracker = updateSyncStatus(tracker, ContentSyncStatus.DISTROMETADATA);
                        tracker = distroSourceSyncer.synchronizeDistributionMetadata(tracker);
                        tracker = updatePercentComplete(tracker, repoManager);
                    }
                } catch (Exception e) {
                    processSyncException(e, tracker, repo, source, repoManager);
                }
                // Check for cancellation after each content source.
                ThreadUtil.checkInterrupted();
            }

            // Sync distro bits.
            log.debug("synchronizeRepo :: synchronizeDistributionBits");
            for (ContentSource source : repo.getContentSources()) {
                try {
                    ContentProvider provider = getIsolatedContentProvider(source.getId());
                    if (provider instanceof DistributionSource) {
                        DistributionSourceSynchronizer distroSourceSyncer = new DistributionSourceSynchronizer(
                            repo, source, provider);
                        tracker = updateSyncStatus(tracker, ContentSyncStatus.DISTROBITS);
                        tracker = distroSourceSyncer.synchronizeDistributionBits(tracker);
                        tracker = updatePercentComplete(tracker, repoManager);
                    }
                    ThreadUtil.checkInterrupted();
                } catch (Exception e) {
                    processSyncException(e, tracker, repo, source, repoManager);
                }
                // Check for cancellation after each content source.
                ThreadUtil.checkInterrupted();
            }

            // Sync advisory metadata.
            log.debug("synchronizeRepo :: synchronizeAdvisoryMetadata");
            for (ContentSource source : repo.getContentSources()) {
                try {

                    ContentProvider provider = getIsolatedContentProvider(source.getId());
                    if (provider instanceof AdvisorySource) {
                        tracker = updateSyncStatus(tracker, ContentSyncStatus.ADVISORYMETADATA);
                        AdvisorySourceSynchronizer advisorySourceSyncer = new AdvisorySourceSynchronizer(repo, source,
                            provider);
                        tracker = advisorySourceSyncer.synchronizeAdvisoryMetadata(tracker);
                        tracker = updatePercentComplete(tracker, repoManager);
                    }
                } catch (Exception e) {
                    processSyncException(e, tracker, repo, source, repoManager);
                }
                // Check for cancellation after each content source.
                ThreadUtil.checkInterrupted();
            }

            // Update status to finished.
            if (tracker.getRepoSyncResults().getStatus() != ContentSyncStatus.FAILURE) {
                tracker.getRepoSyncResults().setStatus(ContentSyncStatus.SUCCESS);
            }
            tracker = updateSyncStatus(tracker, tracker.getRepoSyncResults().getStatus());

            progress = new StringBuilder();
            progress.append("\n");
            progress.append(tracker.getRepoSyncResults().getResults());
            progress.append("\n");
            progress.append(new Date()).append(": ");
            progress.append("Repository [").append(repo.getName()).append("] ");
            progress.append("completed syncing with ");
            progress.append((tracker.getRepoSyncResults().getStatus() == ContentSyncStatus.FAILURE) ? "one or more" : "no");
            progress.append(" errors.\n");
            tracker.setResults(progress.toString());
           
            log.debug("synchronizeRepo :: " + tracker.getRepoSyncResults().getStatus());
        } catch (InterruptedException e) {
            RepoSyncResults recentResults = repoManager.getMostRecentSyncResults(overlord, repo.getId());
            log.debug("Caught InterruptedException during sync of repo with id [" + repoId + "].");
            progress.append("\n ** Cancelled syncing **");
            tracker.setResults(progress.toString());
            tracker.getProgressWatcher().resetToZero();
            tracker = updatePercentComplete(tracker, repoManager);
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

        StringBuilder progress = new StringBuilder();
        log.error("Error while synchronizing repo [" + repo + "] with content source [" + source
            + "]. Synchronization of the repo will continue for any other associated content sources.", e);

        // Try to reload the results in case it was updated by the SLSB before the exception happened.
        RepoSyncResults reloadedResults = repoManager.getRepoSyncResults(tracker.getRepoSyncResults().getId());
        if (reloadedResults != null) {
            tracker.setRepoSyncResults(reloadedResults);
            if (tracker.getRepoSyncResults().getResults() != null) {
                progress = new StringBuilder(tracker.getRepoSyncResults().getResults());
            }
View Full Code Here

Examples of org.rhq.core.domain.content.RepoSyncResults

        throws InterruptedException {
        RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
        SubjectManagerLocal subjMgr = LookupUtil.getSubjectManager();
        Subject overlord = subjMgr.getOverlord();
        int repoId = tracker.getRepoId();
        RepoSyncResults cancelCheck = repoManager.getMostRecentSyncResults(overlord, repoId);
        if (cancelCheck.getStatus() == ContentSyncStatus.CANCELLING) {
            throw new InterruptedException();
        }
        RepoSyncResults results = tracker.getRepoSyncResults();
        results.setStatus(status);
        results = repoManager.mergeRepoSyncResults(results);
        tracker.setRepoSyncResults(results);
        return tracker;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.