public Path getNormalizedPath() throws RepositoryException { if (parent != null) { return parent.getNormalizedPath(); } else { return this; } }
public Path getNormalizedPath() throws RepositoryException { if (parent != null) { return parent.getNormalizedPath(); } else { return this; } }
/** * @see PathFactory#create(Path, Name, int, boolean) */ public Path create(Path parent, Name name, int index, boolean normalize) throws IllegalArgumentException, RepositoryException { if (RootPath.NAME.equals(name)) { throw new IllegalArgumentException(); } Path path = new NamePath(parent, name, index); if (normalize) { return path.getNormalizedPath(); } else { return path; } }
/** * @see PathFactory#create(Path, Name, int, boolean) */ public Path create(Path parent, Name name, int index, boolean normalize) throws IllegalArgumentException, RepositoryException { if (RootPath.NAME.equals(name)) { throw new IllegalArgumentException(); } Path path = new NamePath(parent, name, index); if (normalize) { return path.getNormalizedPath(); } else { return path; } }
/** * @see PathFactory#create(Path, Name, boolean) */ public Path create(Path parent, Name name, boolean normalize) throws RepositoryException { List elements = new ArrayList(); elements.addAll(Arrays.asList(parent.getElements())); elements.add(createElement(name)); Builder pb = new Builder(elements); Path path = pb.getPath(); if (normalize) { return path.getNormalizedPath(); } else { return path; } }
public Path getNormalizedPath() throws RepositoryException { if (isNormalized()) { return this; } else { // parent is guaranteed to be !null Path normalized = parent.getNormalizedPath(); if (normalized.denotesCurrent()) { normalized = null; // special case: ./a } return new NamePath(normalized, name, index); } }
public Path getNormalizedPath() throws RepositoryException { if (isNormalized()) { return this; } else { // parent is guaranteed to be !null Path normalized = parent.getNormalizedPath(); if (normalized.denotesCurrent()) { normalized = null; // special case: ./a } return new NamePath(normalized, name, index); } }
/** * @see Session#nodeExists(String) */ @Override public boolean nodeExists(String absPath) throws RepositoryException { checkIsAlive(); Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.nodeExists(qPath); }
private Path getAbsolutePath(PathResolver resolver, String path) throws RepositoryException { try { Path qpath = resolver.getQPath(path).getNormalizedPath(); if (!qpath.isAbsolute()) { throw new RepositoryException("Path is not absolute: " + path); } return qpath; } catch (NameException e) { throw new RepositoryException("Path is invalid: " + path, e); } }
private Path getAbsolutePath(PathResolver resolver, String path) throws RepositoryException { try { Path qpath = resolver.getQPath(path).getNormalizedPath(); if (!qpath.isAbsolute()) { throw new RepositoryException("Path is not absolute: " + path); } return qpath; } catch (NameException e) { throw new RepositoryException("Path is invalid: " + path, e); } }
/** * @see Session#propertyExists(String) */ @Override public boolean propertyExists(String absPath) throws RepositoryException { checkIsAlive(); Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.propertyExists(qPath); }
/** * @see Session#propertyExists(String) */ @Override public boolean propertyExists(String absPath) throws RepositoryException { checkIsAlive(); Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.propertyExists(qPath); }
/** * @see Session#nodeExists(String) */ @Override public boolean nodeExists(String absPath) throws RepositoryException { checkIsAlive(); Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.nodeExists(qPath); }
/** * @see javax.jcr.Session#itemExists(String) */ @Override public boolean itemExists(String absPath) throws RepositoryException { checkIsAlive(); Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.nodeExists(qPath) || itemMgr.propertyExists(qPath); }
/** * @see Session#getProperty(String) */ @Override public Property getProperty(String absPath) throws RepositoryException { checkIsAlive(); try { Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.getProperty(qPath); } catch (AccessDeniedException ade) { throw new PathNotFoundException(absPath); } }
/** * @see javax.jcr.Session#itemExists(String) */ @Override public boolean itemExists(String absPath) throws RepositoryException { checkIsAlive(); Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.nodeExists(qPath) || itemMgr.propertyExists(qPath); }
/** * @see Session#getNode(String) */ @Override public Node getNode(String absPath) throws RepositoryException { checkIsAlive(); try { Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.getNode(qPath); } catch (AccessDeniedException ade) { throw new PathNotFoundException(absPath); } }
/** * @see Session#getProperty(String) */ @Override public Property getProperty(String absPath) throws RepositoryException { checkIsAlive(); try { Path qPath = getQPath(absPath).getNormalizedPath(); ItemManager itemMgr = getItemManager(); return itemMgr.getProperty(qPath); } catch (AccessDeniedException ade) { throw new PathNotFoundException(absPath); } }
public Path getNormalizedPath() throws RepositoryException { if (isNormalized()) { return this; } else { // parent is guaranteed to be !null Path normalized = parent.getNormalizedPath(); if (normalized.denotesParent()) { return new ParentPath(normalized); // special case: ../.. } else if (normalized.denotesCurrent()) { return new ParentPath(null); // special case: ./.. } else { return normalized.getAncestor(1); } } }
public NodeImpl getImportTargetNode() throws RepositoryException { try { Path p = session.getQPath(parentAbsPath).getNormalizedPath(); if (!p.isAbsolute()) { throw new RepositoryException("not an absolute path: " + parentAbsPath); } return session.getItemManager().getNode(p); } catch (NameException e) { String msg = parentAbsPath + ": invalid path"; throw new RepositoryException(msg, e); } catch (AccessDeniedException ade) { throw new PathNotFoundException(parentAbsPath); } }