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 getRelativePath(String parent, String path) { return getRelativeFilePath(parent, path, "/"); }
/** * {@inheritDoc} */ public boolean includes(Node root, Node node, String path) throws RepositoryException { if (path == null) { path = node.getPath(); } return contentFilter.contains(node, path, PathUtil.getDepth(path) - root.getDepth()); }
/** * {@inheritDoc} */ public void close() throws IOException { if (pruneMissing) { for (ExportInfo.Entry e: exportInfo.getEntries().values()) { if (e.type == ExportInfo.Type.DELETE) { File file = new File(e.path); FileUtils.deleteQuietly(file); track("D", PathUtil.getRelativePath(localParent.getAbsolutePath(), e.path)); } } } }
String path = PathUtil.getPath(parent, name); if (name.length() == 0 || parent.hasNode(name)) { if (wspFilter.getImportMode(path) == ImportMode.MERGE) {
/** * Creates a new abstract artifact with the given repository name, * platform extension and and type. the parent artifact is only used for * generating the paths and is not linked to this artifact. * * @param parent the parent artifact or {@code null}. * @param repoRelPath the repository name * @param extension the platform extension * @param type type of the artifact */ protected AbstractArtifact(Artifact parent, String repoRelPath, String extension, ArtifactType type) { this.type = type; this.extension = extension; if (parent == null) { this.repoRelPath = repoRelPath; this.platRelPath = PlatformNameFormat.getPlatformPath(repoRelPath + extension); } else { this.repoRelPath = PathUtil.append(parent.getRelativePath(), repoRelPath); this.platRelPath = PathUtil.append(parent.getPlatformPath(), PlatformNameFormat.getPlatformPath(repoRelPath + extension)); } if (this.platRelPath.equals(this.repoRelPath)) { this.platRelPath = null; } }
/** * {@inheritDoc} */ public void close() throws IOException, RepositoryException { if (autoDeleteFiles) { for (ExportInfo.Entry e: exportInfo.getEntries().values()) { if (e.type == ExportInfo.Type.DELETE) { String relPath = PathUtil.getRelativePath(localParent.getPath(), e.path); try { Node node = localParent.getNode(relPath); node.remove(); track("D", relPath); } catch (RepositoryException e1) { track(e1, relPath); } } } } localParent.getSession().save(); }
String path = PathUtil.getPath(parent, primary.getRelativePath()); if (primary.getRelativePath().length() == 0 || parent.hasNode(primary.getRelativePath())) { mode = wspFilter.getImportMode(path); String path = PathUtil.getPath(newParent, newName); if (newName.length() == 0 || newParent.hasNode(newName)) { mode = wspFilter.getImportMode(path);
public static String makePath(String parent, String relPath) { String[] ret = makePath(Text.explode(parent, '/'), relPath); return "/" + Text.implode(ret, "/"); }
public static String getRelativeFilePath(String cwd, String path) { return getRelativeFilePath(cwd, path, Constants.FS_NATIVE); }
/** * {@inheritDoc} */ public boolean includes(Node root, Node parent, Property property, String path) throws RepositoryException { if (path == null) { path = property.getPath(); } return contentFilter.contains(property, path, PathUtil.getDepth(path) - root.getDepth()); }
String relPath = PathUtil.getRelativePath(repoPath, sc.repoPath); relPath = Text.getName(repoPath) + "/" + relPath; if (!relPath.equals(sc.isa.getRelativePath())) { String relPath = PathUtil.getRelativePath(change.repoPath, sc.repoPath); relPath = Text.getName(change.repoPath) + "/" + relPath; if (!relPath.equals(sc.isa.getRelativePath())) {
return null; String path = PathUtil.getPath(parent, primary.getRelativePath()); if (wspFilter.getImportMode(path) == ImportMode.MERGE) { ImportInfoImpl info = new ImportInfoImpl();
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; }
public String getCwdRelativePath(String path) { return PathUtil.getRelativeFilePath(cwd.getPath(), path); }
/** * {@inheritDoc} */ public boolean includes(Node root, Node node, String path) throws RepositoryException { if (path == null) { path = node.getPath(); } int depth = PathUtil.getDepth(path) - root.getDepth(); boolean isFile = root.isNodeType(JcrConstants.NT_FILE); if (depth == 0) { // should not happen, but ok. return true; } else if (depth == 1) { // on root level, we only allow "jcr:content" if it's a file if (isFile && node.getName().equals(JcrConstants.JCR_CONTENT)) { return true; } } else { // no sub nodes. } // only respect content filter if not empty return !contentFilter.isEmpty() && contentFilter.contains(node, path, depth); }
this.principalName = StringUtils.substringAfterLast(tmp, "/"); this.intermediatePath = PathUtil.makePath(getDefaultPath(), StringUtils.removeEnd(tmp, this.principalName)); } else { this.principalName = tmp;
public static File getRelativeFile(File parent, File file) { return new File(getRelativeFilePath(parent.getPath(), file.getPath())); }
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); } }
public String getLocation() { File cwd = parent.getContext().getCwd(); return PathUtil.getRelativeFilePath(cwd.getPath(), file.getPath()); } }