public WorkResult execute(final CopyActionProcessingStream stream) { final Set<RelativePath> visited = new HashSet<RelativePath>(); WorkResult didWork = delegate.execute(new CopyActionProcessingStream() { public void process(final CopyActionProcessingStreamAction action) { stream.process(new CopyActionProcessingStreamAction() { public void processFile(FileCopyDetailsInternal details) { visited.add(details.getRelativePath()); action.processFile(details); } }); } }); SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited, preserveSpec); MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix(); walker.visit(fileVisitor); visited.clear(); return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork); }
public WorkResult execute(final CopyActionProcessingStream stream) { final Set<RelativePath> visited = new HashSet<RelativePath>(); WorkResult didWork = delegate.execute(new CopyActionProcessingStream() { public void process(final CopyActionProcessingStreamAction action) { stream.process(new CopyActionProcessingStreamAction() { public void processFile(FileCopyDetailsInternal details) { visited.add(details.getRelativePath()); action.processFile(details); } }); } }); SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited); MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix(); walker.visit(fileVisitor); visited.clear(); return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork); }
public CopyFileVisitorImpl(CopySpecResolver spec, CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) { this.copySpecResolver = spec; this.action = action; this.instantiator = instantiator; this.fileSystem = fileSystem; }
public WorkResult execute(final CopyActionProcessingStream stream) { final Set<RelativePath> visitedFiles = new HashSet<RelativePath>(); return delegate.execute(new CopyActionProcessingStream() { public void process(final CopyActionProcessingStreamAction action) { stream.process(new CopyActionProcessingStreamAction() { public void processFile(FileCopyDetailsInternal details) { if (!details.isDirectory()) { DuplicatesStrategy strategy = details.getDuplicatesStrategy(); if (!visitedFiles.add(details.getRelativePath())) { if (strategy == DuplicatesStrategy.EXCLUDE) { return; } else if (strategy == DuplicatesStrategy.FAIL) { throw new DuplicateFileCopyingException(String.format("Encountered duplicate path \"%s\" during copy operation configured with DuplicatesStrategy.FAIL", details.getRelativePath())); } else if (strategy == DuplicatesStrategy.WARN) { LOGGER.warn("Encountered duplicate path \"{}\" during copy operation configured with DuplicatesStrategy.WARN", details.getRelativePath()); } } } action.processFile(details); } }); } }); }
public CopySpecActionImpl(CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) { this.action = action; this.instantiator = instantiator; this.fileSystem = fileSystem; }
public void process(final CopyActionProcessingStreamAction action) { spec.walk(new CopySpecActionImpl(action, instantiator, fileSystem)); }
public CopyFileVisitorImpl(CopySpecInternal spec, CopyActionProcessingStreamAction action, Instantiator instantiator, FileSystem fileSystem) { this.spec = spec; this.action = action; this.instantiator = instantiator; this.fileSystem = fileSystem; }
void process(CopyActionProcessingStreamAction action);