Package de.grey.ownsync.facade

Examples of de.grey.ownsync.facade.OwnSyncResult


    public OwnSyncResult sync() throws OwnSyncException, FileSystemException
    {
        FolderState folderStateA = null;
        FolderState folderStateB = null;
        OwnSyncResult result = new OwnSyncResult();

        long allStart = System.currentTimeMillis();
        System.out.println("\nSynchronizing folder:\n\t\t" + FileUtils.getAbsolutePath(configuration.getFolderAConfiguration().getSyncFolder()));
        System.out.println("with folder:\n\t\t" + FileUtils.getAbsolutePath(configuration.getFolderBConfiguration().getSyncFolder()));
       
        try
        {
            OwnSyncStatus.setMessage("");
            OwnSyncStatus.setMessage("");

            folderStateA = new FolderState(configuration.getFolderAConfiguration());

            OwnSyncStatus.setMessage("");

            folderStateB = new FolderState(configuration.getFolderBConfiguration());

            OwnSyncStatus.setMessage("");
            OwnSyncStatus.setMessage("");

            long start = System.currentTimeMillis();
            OwnSyncStatus.setMessage("Calculating actions");
            FolderSynchronizer synchronizer = new FolderSynchronizer(folderStateA, folderStateB);
            synchronizer.evaluateActions(result);
            result.writeMessage(OwnSyncResult.EVALUATED);
            OwnSyncStatus.setMessage("Calculating actions");
            OwnSyncStatus.appendToMessage(" took " + DataFormatter.getTimeString(System.currentTimeMillis() - start));

            OwnSyncStatus.setMessage("");
            OwnSyncStatus.setMessage("");
           
            if (configuration.useTestModus)
            {
                OwnSyncStatus.setMessage("TestModus activated, no files or folders will be modified.");
                result.writeMessage(OwnSyncResult.EVALUATED);
               
                System.out.println("TestModus activated, no files or folders will be modified.");
                result.printlnMessage(OwnSyncResult.EVALUATED);
               
                FileUtils.calculateMinimumLastModifiedDelta(configuration.getFolderAConfiguration(), configuration.getFolderBConfiguration());
            }
            else
            {
                synchronizer.executeActions(result);
               
                if (!configuration.useTestModus && result.isAnyActionFailed())
                {
                    result.writeMessage(OwnSyncResult.FAILED);
                    result.printlnMessage(OwnSyncResult.FAILED);
                    OwnSyncStatus.setMessage("");
                }
                if (!configuration.useTestModus && !result.isNoActionAvailabe())
                {
                    result.writeMessage(OwnSyncResult.EXECUTED);
                    result.printlnMessage(OwnSyncResult.EXECUTED);
                }
            }
           
            OwnSyncStatus.setMessage("");
            OwnSyncStatus.setMessage("");
View Full Code Here

TOP

Related Classes of de.grey.ownsync.facade.OwnSyncResult

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.