Package net.sourceforge.processdash.tool.bridge.report

Examples of net.sourceforge.processdash.tool.bridge.report.ResourceCollectionDiff


        long mostRecentLocalModTime = getMostRecentLocalModTime();
        downloadFiles(makeGetRequest(DOWNLOAD_ACTION,
            ResourceFilterFactory.LAST_MOD_PARAM, mostRecentLocalModTime));

        // now make a complete comparison of local-vs-remote changes.
        ResourceCollectionDiff diff = getDiff();
        applySyncFilter(diff, filter);
        pt.click("Computed local-vs-remote diff");
        if (diff == null || diff.noDifferencesFound())
            return false;

        // if any files are present only in our local collection (but not in
        // the remote collection), delete the local files.
        for (String resourceName : diff.getOnlyInA()) {
            logger.fine("deleting local resource " + resourceName);
            localCollection.deleteResource(resourceName);
        }

        // copy down files that are only present in the remote collection, as
        // well as any files that have changed
        List filesToDownload = new ArrayList();
        filesToDownload.addAll(diff.getOnlyInB());
        filesToDownload.addAll(diff.getDiffering());
        downloadFilesNamed(filesToDownload);

        pt.click("Copied down changes");
        return true;
    }
View Full Code Here


        if (userName == null)
            throw new NotLockedException();

        ProfTimer pt = new ProfTimer(logger, "ResourceBridgeClient.syncUp["
                + remoteUrl + "]");
        ResourceCollectionDiff diff = getDiff();
        applySyncFilter(diff, filter);
        pt.click("Computed local-vs-remote diff");
        if (diff == null || diff.noDifferencesFound()) {
            logger.finer("no changes to sync up");
            return false;
        }

        boolean madeChange = false;
        List<String> filesToDownload = new ArrayList<String>();

        // decide what to do for each file that is present only in the remote
        // collection (but not in our local collection)
        if (!diff.getOnlyInB().isEmpty()) {
            List<String> params = new ArrayList<String>();
            for (String resourceName : diff.getOnlyInB()) {
                if (isSyncDownOnly(resourceName)) {
                    filesToDownload.add(resourceName);
                } else {
                    logger.fine("deleting remote resource " + resourceName);
                    params.add(DELETE_FILE_PARAM);
                    params.add(resourceName);
                }
            }
            if (!params.isEmpty()) {
                doPostRequest(DELETE_ACTION, (Object[]) params.toArray());
                pt.click("Deleted remote resources");
                madeChange = true;
            }
        }

        // upload files that need to be created or updated in the remote
        // collection
        if (!diff.getOnlyInA().isEmpty() || !diff.getDiffering().isEmpty()) {
            List params = new ArrayList();
            for (String resourceName : diff.getOnlyInA()) {
                if (isSyncDownOnly(resourceName)) {
                    logger.fine("deleting local resource " + resourceName);
                    localCollection.deleteResource(resourceName);
                    madeChange = true;
                } else {
                    logger.fine("uploading new resource " + resourceName);
                    addFileUploadParamsWithBatching(params, resourceName);
                    madeChange = true;
                }
            }
            for (String resourceName : diff.getDiffering()) {
                if (isSyncDownOnly(resourceName)) {
                    filesToDownload.add(resourceName);
                } else {
                    logger.fine("uploading modified resource " + resourceName);
                    addFileUploadParamsWithBatching(params, resourceName);
View Full Code Here

        ResourceCollectionInfo localList = new ResourceListing(localCollection,
                ResourceFilterFactory.DEFAULT_FILTER);
        // finally, retrieve the list from the server and compare the two.
        ResourceCollectionInfo remoteList = XmlCollectionListing
                .parseListing(new BufferedInputStream(conn.getInputStream()));
        return new ResourceCollectionDiff(localList, remoteList);
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.tool.bridge.report.ResourceCollectionDiff

Copyright © 2018 www.massapicom. 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.