private void persistDirHashes(Path hashes, FsEntry entry, List<FsEntry> dirs) throws ProvisioningException { final Path target = hashes.resolve(entry.getRelativePath()); try { Files.createDirectory(target); } catch (IOException e) { throw new ProvisioningException(Errors.hashesNotPersisted(), e); } if (entry.hasChildren()) { persistChildHashes(hashes, entry, dirs, target); } }
private static void addEntries(FsEntry entry, List<Change> changes, char tag) { if (entry.hasChildren()) { for (FsEntry child : entry.getChildren()) { addEntries(child, changes, tag); } } else { changes.add(new Change(entry.getRelativePath(), tag)); } }
private void persistHashes(ProvisioningRuntime runtime) throws ProvisioningException { final long startTime = System.nanoTime(); final FsEntry root = getDefaultFsEntryFactory().forPath(runtime.getStagedDir()); if (root.hasChildren()) { final Path hashes = LayoutUtils.getHashesDir(runtime.getStagedDir()); try { Files.createDirectories(hashes); } catch (IOException e) { throw new ProvisioningException("Failed to persist hashes", e); } final List<FsEntry> dirs = new ArrayList<>(); persistChildHashes(hashes, root, dirs, hashes); if(!dirs.isEmpty()) { for(int i = dirs.size() - 1; i >= 0; --i) { persistDirHashes(hashes, dirs.get(i), dirs); } } } if(log.isVerboseEnabled()) { final long timeMs = (System.nanoTime() - startTime) / 1000000; final long timeSec = timeMs / 1000; log.print("Hashing took %d.%d seconds", timeSec, (timeMs - timeSec * 1000)); } }
if (originalEntry.hasChildren()) { final Map<String, FsEntry> otherChildren = otherEntry.cloneChildren(); for (FsEntry originalChild : originalEntry.getChildren()) { } else if(otherEntry.hasChildren()) { for (FsEntry otherChild : otherEntry.getChildren()) { otherChild.diffAdded();