Search in sources :

Example 6 with FolderTO

use of org.syncany.config.to.FolderTO in project syncany by syncany.

the class WatchServer method startWatchOperations.

private void startWatchOperations(Map<File, FolderTO> newWatchedFolderTOs) throws ConfigException, ServiceAlreadyStartedException {
    for (Map.Entry<File, FolderTO> folderEntry : newWatchedFolderTOs.entrySet()) {
        File localDir = folderEntry.getKey();
        try {
            Config watchConfig = ConfigHelper.loadConfig(localDir);
            if (watchConfig != null) {
                logger.log(Level.INFO, "- Starting watch operation at " + localDir + " ...");
                WatchOperationOptions watchOptions = folderEntry.getValue().getWatchOptions();
                if (watchOptions == null) {
                    watchOptions = new WatchOperationOptions();
                }
                WatchRunner watchRunner = new WatchRunner(watchConfig, watchOptions, daemonConfig.getPortTO());
                watchRunner.start();
                watchOperations.put(localDir, watchRunner);
            } else {
                logger.log(Level.INFO, "- CANNOT start watch, because no config found at " + localDir + " ...");
            }
        } catch (Exception e) {
            logger.log(Level.SEVERE, "  + Cannot start watch operation at " + localDir + ". IGNORING.", e);
        }
    }
}
Also used : WatchOperationOptions(org.syncany.operations.watch.WatchOperationOptions) Config(org.syncany.config.Config) FolderTO(org.syncany.config.to.FolderTO) Map(java.util.Map) TreeMap(java.util.TreeMap) File(java.io.File) ConfigException(org.syncany.config.ConfigException)

Example 7 with FolderTO

use of org.syncany.config.to.FolderTO in project syncany by syncany.

the class DaemonOperationResultTest method setUp.

@Before
public void setUp() {
    folder = new FolderTO("test");
    watchList = new ArrayList<FolderTO>();
    watchList.add(folder);
    result = new DaemonOperationResult(DaemonResultCode.OK, watchList);
}
Also used : FolderTO(org.syncany.config.to.FolderTO) Before(org.junit.Before)

Aggregations

FolderTO (org.syncany.config.to.FolderTO)7 File (java.io.File)4 Before (org.junit.Before)2 DaemonConfigTO (org.syncany.config.to.DaemonConfigTO)2 WatchOperationOptions (org.syncany.operations.watch.WatchOperationOptions)2 Predicate (com.google.common.base.Predicate)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Config (org.syncany.config.Config)1 ConfigException (org.syncany.config.ConfigException)1 DaemonOperationResult (org.syncany.operations.daemon.DaemonOperationResult)1