public Aggregate getAggregate(String relPath) throws RepositoryException { String[] pathElems = PathUtil.makePath((String[]) null, relPath); if (pathElems == null) { return this; } return getAggregate(pathElems, 0); }
public static String makePath(String parent, String relPath) { String[] ret = makePath(Text.explode(parent, '/'), relPath); return "/" + Text.implode(ret, "/"); }
public VaultFile getFile(VaultFile parent, String path) throws IOException, RepositoryException { if (path == null || path.equals("") || path.equals(".")) { return parent; } else if (path.equals("/")) { return getRoot(); } String[] pathElems = PathUtil.makePath((String[])null, path); for (int i=0; i<pathElems.length && parent != null; i++) { String elem = pathElems[i]; if (elem.equals("/")) { parent = getRoot(); } else if (elem.equals("..")) { parent = parent.getParent(); } else { parent = parent.getChild(elem); } } return parent; }
this.principalName = StringUtils.substringAfterLast(tmp, "/"); this.intermediatePath = PathUtil.makePath(getDefaultPath(), StringUtils.removeEnd(tmp, this.principalName)); } else { this.principalName = tmp;
protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception { String name = (String) cl.getValue(argLocalPath); String jcrPath = (String) cl.getValue(argJcrPath); VaultFile file; if (jcrPath == null) { jcrPath = Text.getName(name); if (jcrPath.equals("")) { jcrPath = name; } } File local = ctx.getVaultFsApp().getPlatformFile(name, true); VaultFile cwd = ctx.getVaultFsApp().getVaultFile("", true); file = cwd.getFileSystem().getFile(cwd, jcrPath); if (file == null) { // do add jcrPath = PathUtil.makePath(cwd.getPath(), jcrPath); doAdd(local, cwd, jcrPath); } else { doPut(local, file); } }