Search in sources :

Example 1 with LsRemoteEndSyncExternalEvent

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

the class LsRemoteOperation method execute.

@Override
public LsRemoteOperationResult execute() throws Exception {
    logger.log(Level.INFO, "");
    logger.log(Level.INFO, "Running 'Remote Status' at client " + config.getMachineName() + " ...");
    logger.log(Level.INFO, "--------------------------------------------");
    eventBus.post(new LsRemoteStartSyncExternalEvent(config.getLocalDir().getAbsolutePath()));
    TransferManager transferManager = createTransferManager(loadedTransferManager);
    List<DatabaseRemoteFile> knownDatabases = localDatabase.getKnownDatabases();
    List<DatabaseRemoteFile> unknownRemoteDatabases = listUnknownRemoteDatabases(transferManager, knownDatabases);
    transferManager.disconnect();
    boolean hasChanges = unknownRemoteDatabases.size() > 0;
    eventBus.post(new LsRemoteEndSyncExternalEvent(config.getLocalDir().getAbsolutePath(), hasChanges));
    return new LsRemoteOperationResult(new ArrayList<>(unknownRemoteDatabases));
}
Also used : TransferManager(org.syncany.plugins.transfer.TransferManager) DatabaseRemoteFile(org.syncany.plugins.transfer.files.DatabaseRemoteFile) LsRemoteStartSyncExternalEvent(org.syncany.operations.daemon.messages.LsRemoteStartSyncExternalEvent) LsRemoteEndSyncExternalEvent(org.syncany.operations.daemon.messages.LsRemoteEndSyncExternalEvent)

Aggregations

LsRemoteEndSyncExternalEvent (org.syncany.operations.daemon.messages.LsRemoteEndSyncExternalEvent)1 LsRemoteStartSyncExternalEvent (org.syncany.operations.daemon.messages.LsRemoteStartSyncExternalEvent)1 TransferManager (org.syncany.plugins.transfer.TransferManager)1 DatabaseRemoteFile (org.syncany.plugins.transfer.files.DatabaseRemoteFile)1