private void suppressPaths(String... relativePaths) throws ProvisioningException { for (String relativePath : relativePaths) { fsDiff.suppress(relativePath); } }
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 static FsEntryFactory getDefaultFsEntryFactory() { return FsEntryFactory.getInstance().filterGalleonPaths(); }
public void suppress(String relativePath) throws ProvisioningException { final FsEntry[] fsEntries = modified.get(relativePath); if(fsEntries != null) { fsEntries[0].diffSuppress(); fsEntries[1].diffSuppress(); return; } final FsEntry entry = getEntry(relativePath); if(entry == null) { throw new ProvisioningException("Failed to locate " + relativePath + " in the diff"); } entry.diffSuppress(); }
private static void collectPath(FsEntry entry, StringBuilder buf) { if(entry.parent == null) { return; } collectPath(entry.parent, buf); if(buf.length() > 0) { buf.append('/'); } buf.append(entry.getName()); }
public void excludePackage(StateDiffPlugin plugin, FPID fpid, String name, String... relativePaths) throws ProvisioningException { getFpcBuilder(fpid).excludePackage(name); suppressPaths(relativePaths); }
public FsEntry forPath(Path p) throws ProvisioningException { final FsEntry entry = new FsEntry(null, p); if(entry.dir) { try { initChildren(entry); } catch (IOException e) { throw new ProvisioningException(Errors.fsEntryInit(p), e); } } return entry; }
private FsDiff(FsEntry original, FsEntry other) throws ProvisioningException { this.original = original; this.other = other; doDiff(original, other); }
public void updateConfig(ProvisionedConfig updatedConfig, String... relativePaths) throws ProvisioningException { updateConfig(ProvisionedFeatureDiffCallback.DEFAULT, updatedConfig, relativePaths); }
public static FsEntryFactory getInstance() { return new FsEntryFactory(); }
public FsEntry(FsEntry parent, String name, byte[] hash) { this.parent = parent; this.name = name; this.hash = hash; this.dir = false; this.p = null; if(parent != null) { depth = parent.depth + 1; parent.addChild(this); } else { depth = 0; } }
public static FsDiff diff(FsEntry original, FsEntry other) throws ProvisioningException { return new FsDiff(original, other); }
public void addConfig(ProvisionedConfig config, String... relativePaths) throws ProvisioningException { addConfig(ProvisionedFeatureDiffCallback.DEFAULT, config, relativePaths); }
private boolean isFiltered(FsEntry parent, String childName) { if(pathFilters.isEmpty()) { return false; } for(PathFilter filter : pathFilters) { if(filter.matches(parent, childName)) { return true; } } return false; }
void diffAdded() { diffStatus = ADDED; if(!children.isEmpty()) { for(FsEntry child : children.values()) { child.diffAdded(); } } }
void diffRemoved() { diffStatus = REMOVED; if(!children.isEmpty()) { for(FsEntry child : children.values()) { child.diffRemoved(); } } }
public String getRelativePath() { if (relativePath == null) { final StringBuilder buf = new StringBuilder(); collectPath(this, buf); if(dir) { buf.append('/'); } relativePath = buf.toString(); } return relativePath; }
public boolean includesPath(String relativePath) { if(relativePath.charAt(0) == '/') { relativePath = relativePath.substring(1); } return includesPath(relativePath.split("/")); }
public void init(ProvisionedConfig config) throws ProvisioningException { reset(); model = config.getModel(); name = config.getName(); init = true; config.handle(this); init = false; }