/** * {@inheritDoc} */ public final ItemId resolvePath(Path path) throws RepositoryException { // shortcut if (path.denotesRoot()) { return rootNodeId; } if (!path.isCanonical()) { String msg = "path is not canonical"; log.debug(msg); throw new RepositoryException(msg); } return resolvePath(path, RETURN_ANY); }
/** * {@inheritDoc} */ public final ItemId resolvePath(Path path) throws RepositoryException { // shortcut if (path.denotesRoot()) { return rootNodeId; } if (!path.isCanonical()) { String msg = "path is not canonical"; log.debug(msg); throw new RepositoryException(msg); } return resolvePath(path, RETURN_ANY); }
/** * Uses {@link NamePathResolver#getJCRPath(Path)} to convert the * <code>Path</code> present with this constraint into a JCR path. * * @see ValueConstraint#getDefinition(NamePathResolver) * @param resolver name-path resolver */ @Override public String getDefinition(NamePathResolver resolver) { try { String p = resolver.getJCRPath(path); if (!deep) { return p; } else if (path.denotesRoot()) { return p + "*"; } else { return p + "/*"; } } catch (NamespaceException e) { // should never get here, return raw definition as fallback return getString(); } }
/** * Uses {@link NamePathResolver#getJCRPath(Path)} to convert the * <code>Path</code> present with this constraint into a JCR path. * * @see ValueConstraint#getDefinition(NamePathResolver) * @param resolver name-path resolver */ @Override public String getDefinition(NamePathResolver resolver) { try { String p = resolver.getJCRPath(path); if (!deep) { return p; } else if (path.denotesRoot()) { return p + "*"; } else { return p + "/*"; } } catch (NamespaceException e) { // should never get here, return raw definition as fallback return getString(); } }
/** * @see HierarchyManager#getNodeEntry(Path) */ public NodeEntry getNodeEntry(Path qPath) throws PathNotFoundException, RepositoryException { NodeEntry rootEntry = getRootEntry(); // shortcut if (qPath.denotesRoot()) { return rootEntry; } if (!qPath.isCanonical()) { String msg = "Path is not canonical"; log.debug(msg); throw new RepositoryException(msg); } return rootEntry.getDeepNodeEntry(qPath); }
/** * @see HierarchyManager#getNodeEntry(Path) */ public NodeEntry getNodeEntry(Path qPath) throws PathNotFoundException, RepositoryException { NodeEntry rootEntry = getRootEntry(); // shortcut if (qPath.denotesRoot()) { return rootEntry; } if (!qPath.isCanonical()) { String msg = "Path is not canonical"; log.debug(msg); throw new RepositoryException(msg); } return rootEntry.getDeepNodeEntry(qPath); }
private Node getNode(NodeId id, SessionInfoImpl sessionInfo) throws ItemNotFoundException, PathNotFoundException, RepositoryException { Session session = sessionInfo.getSession(); Node n; if (id.getUniqueID() != null) { n = session.getNodeByIdentifier(id.getUniqueID()); } else { n = session.getRootNode(); } Path path = id.getPath(); if (path == null || path.denotesRoot()) { return n; } String jcrPath; jcrPath = sessionInfo.getNamePathResolver().getJCRPath(path); if (path.isAbsolute()) { jcrPath = jcrPath.substring(1, jcrPath.length()); } return n.getNode(jcrPath); }
/** * @see HierarchyManager#getPropertyEntry(Path) */ public PropertyEntry getPropertyEntry(Path qPath) throws PathNotFoundException, RepositoryException { // shortcut if (qPath.denotesRoot()) { throw new PathNotFoundException("The root path never points to a Property."); } if (!qPath.isCanonical()) { String msg = "Path is not canonical"; log.debug(msg); throw new RepositoryException(msg); } return getRootEntry().getDeepPropertyEntry(qPath); }
private Node getNode(NodeId id, SessionInfoImpl sessionInfo) throws ItemNotFoundException, PathNotFoundException, RepositoryException { Session session = sessionInfo.getSession(); Node n; if (id.getUniqueID() != null) { n = session.getNodeByIdentifier(id.getUniqueID()); } else { n = session.getRootNode(); } Path path = id.getPath(); if (path == null || path.denotesRoot()) { return n; } String jcrPath; jcrPath = sessionInfo.getNamePathResolver().getJCRPath(path); if (path.isAbsolute()) { jcrPath = jcrPath.substring(1, jcrPath.length()); } return n.getNode(jcrPath); }
/** * @see HierarchyManager#getPropertyEntry(Path) */ public PropertyEntry getPropertyEntry(Path qPath) throws PathNotFoundException, RepositoryException { // shortcut if (qPath.denotesRoot()) { throw new PathNotFoundException("The root path never points to a Property."); } if (!qPath.isCanonical()) { String msg = "Path is not canonical"; log.debug(msg); throw new RepositoryException(msg); } return getRootEntry().getDeepPropertyEntry(qPath); }
/** * @see RetentionRegistry#hasEffectiveRetention(org.apache.jackrabbit.spi.Path,boolean) */ public boolean hasEffectiveRetention(Path nodePath, boolean checkParent) throws RepositoryException { if (!initialized) { throw new IllegalStateException("Not initialized."); } if (retentionCnt <= 0) { return false; } RetentionPolicy rp = null; PathMap.Element<RetentionPolicyImpl> element = retentionMap.map(nodePath, true); if (element != null) { rp = element.get(); } if (rp == null && checkParent && (!nodePath.denotesRoot())) { element = retentionMap.map(nodePath.getAncestor(1), true); if (element != null) { rp = element.get(); } } return rp != null; }
/** * @see RetentionRegistry#hasEffectiveRetention(org.apache.jackrabbit.spi.Path,boolean) */ public boolean hasEffectiveRetention(Path nodePath, boolean checkParent) throws RepositoryException { if (!initialized) { throw new IllegalStateException("Not initialized."); } if (retentionCnt <= 0) { return false; } RetentionPolicy rp = null; PathMap.Element<RetentionPolicyImpl> element = retentionMap.map(nodePath, true); if (element != null) { rp = element.get(); } if (rp == null && checkParent && (!nodePath.denotesRoot())) { element = retentionMap.map(nodePath.getAncestor(1), true); if (element != null) { rp = element.get(); } } return rp != null; }
/** * This default implementation first calls {@link #checkSessionInfo(SessionInfo)} * with the <code>sessionInfo</code>, then lazily initializes {@link #rootNodeDefinition} * if <code>nodeId</code> denotes the root node; otherwise throws a * {@link UnsupportedRepositoryOperationException}. */ public QNodeDefinition getNodeDefinition(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException { checkSessionInfo(sessionInfo); if (nodeId.getUniqueID() == null && nodeId.getPath().denotesRoot()) { synchronized (this) { if (rootNodeDefinition == null) { rootNodeDefinition = createRootNodeDefinition(sessionInfo); } return rootNodeDefinition; } } throw new UnsupportedRepositoryOperationException(); }
/** * This default implementation first calls {@link #checkSessionInfo(SessionInfo)} * with the <code>sessionInfo</code>, then lazily initializes {@link #rootNodeDefinition} * if <code>nodeId</code> denotes the root node; otherwise throws a * {@link UnsupportedRepositoryOperationException}. */ public QNodeDefinition getNodeDefinition(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException { checkSessionInfo(sessionInfo); if (nodeId.getUniqueID() == null && nodeId.getPath().denotesRoot()) { synchronized (this) { if (rootNodeDefinition == null) { rootNodeDefinition = createRootNodeDefinition(sessionInfo); } return rootNodeDefinition; } } throw new UnsupportedRepositoryOperationException(); }
} else if (checkParent && !nodePath.denotesRoot() && element.hasPath(nodePath.getAncestor(1))) {
} else if (checkParent && !nodePath.denotesRoot() && element.hasPath(nodePath.getAncestor(1))) {
public Node perform(SessionContext context) throws RepositoryException { Path p = resolveRelativePath(relPath); NodeId id = getNodeId(p); if (id == null) { throw new PathNotFoundException(relPath); } // determine parent as mandated by path NodeId parentId = null; if (!p.denotesRoot()) { parentId = getNodeId(p.getAncestor(1)); } try { // if the node is shareable, it now returns the node // with the right parent if (parentId != null) { return itemMgr.getNode(id, parentId); } else { return (NodeImpl) itemMgr.getItem(id); } } catch (AccessDeniedException e) { throw new PathNotFoundException(relPath); } catch (ItemNotFoundException e) { throw new PathNotFoundException(relPath); } } public String toString() {
public Node perform(SessionContext context) throws RepositoryException { Path p = resolveRelativePath(relPath); NodeId id = getNodeId(p); if (id == null) { throw new PathNotFoundException(relPath); } // determine parent as mandated by path NodeId parentId = null; if (!p.denotesRoot()) { parentId = getNodeId(p.getAncestor(1)); } try { // if the node is shareable, it now returns the node // with the right parent if (parentId != null) { return itemMgr.getNode(id, parentId); } else { return (NodeImpl) itemMgr.getItem(id); } } catch (AccessDeniedException e) { throw new PathNotFoundException(relPath); } catch (ItemNotFoundException e) { throw new PathNotFoundException(relPath); } } public String toString() {
/** * @param path * @return * @throws PathNotFoundException * @throws AccessDeniedException * @throws RepositoryException */ public NodeImpl getNode(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException { NodeId id = hierMgr.resolveNodePath(path); if (id == null) { throw new PathNotFoundException(safeGetJCRPath(path)); } NodeId parentId = null; if (!path.denotesRoot()) { parentId = hierMgr.resolveNodePath(path.getAncestor(1)); } try { if (parentId == null) { return (NodeImpl) getItem(id, path, true); } // if the node is shareable, it now returns the node with the right // parent return getNode(id, parentId); } catch (ItemNotFoundException infe) { throw new PathNotFoundException(safeGetJCRPath(path)); } }
/** * @param path * @return * @throws PathNotFoundException * @throws AccessDeniedException * @throws RepositoryException */ public NodeImpl getNode(Path path) throws PathNotFoundException, AccessDeniedException, RepositoryException { NodeId id = hierMgr.resolveNodePath(path); if (id == null) { throw new PathNotFoundException(safeGetJCRPath(path)); } NodeId parentId = null; if (!path.denotesRoot()) { parentId = hierMgr.resolveNodePath(path.getAncestor(1)); } try { if (parentId == null) { return (NodeImpl) getItem(id, path, true); } // if the node is shareable, it now returns the node with the right // parent return getNode(id, parentId); } catch (ItemNotFoundException infe) { throw new PathNotFoundException(safeGetJCRPath(path)); } }