Search in sources :

Example 1 with StatusStartSyncExternalEvent

use of org.syncany.operations.daemon.messages.StatusStartSyncExternalEvent in project syncany by syncany.

the class StatusOperation method execute.

@Override
public StatusOperationResult execute() throws Exception {
    logger.log(Level.INFO, "");
    logger.log(Level.INFO, "Running 'Status' at client " + config.getMachineName() + " ...");
    logger.log(Level.INFO, "--------------------------------------------");
    if (options != null && options.isForceChecksum()) {
        logger.log(Level.INFO, "Force checksum ENABLED.");
    }
    if (options != null && !options.isDelete()) {
        logger.log(Level.INFO, "Delete missing files DISABLED.");
    }
    // Get local database
    logger.log(Level.INFO, "Querying current file tree from database ...");
    eventBus.post(new StatusStartSyncExternalEvent(config.getLocalDir().getAbsolutePath()));
    // Path to actual file version
    final Map<String, FileVersion> filesInDatabase = localDatabase.getCurrentFileTree();
    // Find local changes
    logger.log(Level.INFO, "Analyzing local folder " + config.getLocalDir() + " ...");
    ChangeSet localChanges = findLocalChanges(filesInDatabase);
    if (!localChanges.hasChanges()) {
        logger.log(Level.INFO, "- No changes to local database");
    }
    // Return result
    StatusOperationResult statusResult = new StatusOperationResult();
    statusResult.setChangeSet(localChanges);
    eventBus.post(new StatusEndSyncExternalEvent(config.getLocalDir().getAbsolutePath(), localChanges.hasChanges()));
    return statusResult;
}
Also used : FileVersion(org.syncany.database.FileVersion) StatusEndSyncExternalEvent(org.syncany.operations.daemon.messages.StatusEndSyncExternalEvent) StatusStartSyncExternalEvent(org.syncany.operations.daemon.messages.StatusStartSyncExternalEvent) ChangeSet(org.syncany.operations.ChangeSet)

Aggregations

FileVersion (org.syncany.database.FileVersion)1 ChangeSet (org.syncany.operations.ChangeSet)1 StatusEndSyncExternalEvent (org.syncany.operations.daemon.messages.StatusEndSyncExternalEvent)1 StatusStartSyncExternalEvent (org.syncany.operations.daemon.messages.StatusStartSyncExternalEvent)1