X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.core%2Fsrc%2Forg%2Fargeo%2Fsync%2Ffs%2FPathSync.java;h=151194da6bbcb140793ff788ee71ac79b40784c3;hb=438237c2b8c995d4f9562d53bfe4ea63c4442054;hp=99d5de81fb23da18fe679a1cfaa9251bef4c2891;hpb=9885228c89ca6da1835c1c3e098c92589d76301e;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.core/src/org/argeo/sync/fs/PathSync.java b/org.argeo.core/src/org/argeo/sync/fs/PathSync.java index 99d5de81f..151194da6 100644 --- a/org.argeo.core/src/org/argeo/sync/fs/PathSync.java +++ b/org.argeo.core/src/org/argeo/sync/fs/PathSync.java @@ -6,19 +6,15 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.spi.FileSystemProvider; -import java.time.ZonedDateTime; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.argeo.jackrabbit.fs.DavexFsProvider; import org.argeo.ssh.Sftp; import org.argeo.sync.SyncException; -import org.argeo.util.LangUtils; +/** Synchronises two paths. */ public class PathSync implements Runnable { - private final static Log log = LogFactory.getLog(PathSync.class); - private final URI sourceUri, targetUri; + private boolean delete = false; public PathSync(URI sourceUri, URI targetUri) { this.sourceUri = sourceUri; @@ -30,11 +26,8 @@ public class PathSync implements Runnable { try { Path sourceBasePath = createPath(sourceUri); Path targetBasePath = createPath(targetUri); - SyncFileVisitor syncFileVisitor = new SyncFileVisitor(sourceBasePath, targetBasePath); - ZonedDateTime begin = ZonedDateTime.now(); + SyncFileVisitor syncFileVisitor = new SyncFileVisitor(sourceBasePath, targetBasePath, delete); Files.walkFileTree(sourceBasePath, syncFileVisitor); - if (log.isDebugEnabled()) - log.debug("Sync from " + sourceBasePath + " to " + targetBasePath + " took " + LangUtils.since(begin)); } catch (Exception e) { e.printStackTrace(); } @@ -57,8 +50,4 @@ public class PathSync implements Runnable { throw new SyncException("URI scheme not supported for " + uri); return path; } - - static enum Arg { - to, from; - } }