@Override public boolean matchesPath(Path path) { return path.equals(rootPath) || PathUtil.hasRoot(path, rootPath); } };
public static boolean matchesPath(Path path, SelectiveTree<?> tree) { return path.equals(tree.getSubPath()) || PathUtil.hasRoot(path, tree.getSubPath()); }
public static String removePrefix(String rootPath, String extpath) { if (!hasRoot(extpath, rootPath)) { return extpath; } return cleanPath(cleanPath(extpath).substring(cleanPath(rootPath).length())); }
/** * @return true if the given path starts with the given root * * @param path test path * @param root root * */ public static boolean hasRoot(Path path, Path root) { return hasRoot(path.getPath(), root.getPath()); }
if (null != root && !PathUtil.hasRoot(propValue, root)) { if(clearValue) { data.remove(name);
/** * List all treeHandlers as directories which have the given path as a parent * @param path path * @return */ private Set<Resource<T>> listStackDirectory(Path path) { HashSet<Resource<T>> merge = new HashSet<Resource<T>>(); if (treeHandlerList.size() > 0) { for (SelectiveTree<T> treeHandler : treeHandlerList) { if (PathUtil.hasRoot(treeHandler.getSubPath(), path) && !PathUtil.equals( treeHandler.getSubPath(), path )) { String relativePath = PathUtil.removePrefix(path.getPath(), treeHandler.getSubPath().getPath()); String[] components = PathUtil.componentsFromPathString(relativePath); Path subpath = PathUtil.appendPath(path, components[0]); merge.add(new ResourceBase<T>(subpath, null, true)); } } } return merge; }
final String sshKeyResource = sshConnectionInfo.getPrivateKeyStoragePath(); if (null != sshKeyResource) { if (!PathUtil.hasRoot(sshKeyResource, "keys/")) { throw new BuilderException("SSH Private key path is expected to start with \"keys/\": " + sshKeyResource); if (!PathUtil.hasRoot(privateKeyPassphraseStoragePath, "keys")) { throw new BuilderException( "SSH Private key passphrase path is expected to start with \"keys/\": " + final String passwordStoragePath = sshConnectionInfo.getPasswordStoragePath(); if (null != passwordStoragePath) { if (!PathUtil.hasRoot(passwordStoragePath, "keys")) { throw new BuilderException("SSH Password storage path is expected to start with \"keys/\": " + passwordStoragePath);