Class HierarchyManagerImpl

    • Constructor Detail

    • Method Detail

      • getRootNodeId

        public NodeId getRootNodeId()
      • resolvePath

        protected ItemId resolvePath​(org.apache.jackrabbit.spi.Path.Element[] elements,
                                     int next,
                                     ItemId id,
                                     int typesAllowed)
                              throws ItemStateException,
                                     org.apache.jackrabbit.spi.commons.conversion.MalformedPathException
        Internal implementation that iteratively resolves a path into an item.
        Parameters:
        elements - path elements
        next - index of next item in elements to inspect
        id - id of item at path elements[0]..elements[next - 1]
        typesAllowed - one of RETURN_ANY, RETURN_NODE or RETURN_PROPERTY
        Returns:
        id or null
        Throws:
        ItemStateException - if an intermediate item state is not found
        org.apache.jackrabbit.spi.commons.conversion.MalformedPathException - if building an intermediate path fails
      • hasItemState

        protected boolean hasItemState​(ItemId id)
        Determines whether an item state for a given item id exists.

        Low-level hook provided for specialized derived classes.

        Parameters:
        id - item id
        Returns:
        true if an item state exists, otherwise false
        See Also:
        ZombieHierarchyManager.hasItemState(ItemId)
      • getParentIds

        protected Set<NodeId> getParentIds​(ItemState state,
                                           boolean useOverlayed)
        Return all parents of a node. A shareable node has possibly more than one parent.
        Parameters:
        state - item state
        useOverlayed - whether to use overlayed state for shareable nodes
        Returns:
        set of parent NodeIds. If state has no parent, array has length 0.
      • getChildNodeEntry

        protected ChildNodeEntry getChildNodeEntry​(NodeState parent,
                                                   NodeId id)
        Returns the ChildNodeEntry of parent with the specified uuid or null if there's no such entry.

        Low-level hook provided for specialized derived classes.

        Parameters:
        parent - node state
        id - id of child node entry
        Returns:
        the ChildNodeEntry of parent with the specified uuid or null if there's no such entry.
        See Also:
        ZombieHierarchyManager.getChildNodeEntry(NodeState, NodeId)
      • getChildNodeEntry

        protected ChildNodeEntry getChildNodeEntry​(NodeState parent,
                                                   org.apache.jackrabbit.spi.Name name,
                                                   int index)
        Returns the ChildNodeEntry of parent with the specified name and index or null if there's no such entry.

        Low-level hook provided for specialized derived classes.

        Parameters:
        parent - node state
        name - name of child node entry
        index - index of child node entry
        Returns:
        the ChildNodeEntry of parent with the specified name and index or null if there's no such entry.
        See Also:
        ZombieHierarchyManager.getChildNodeEntry(NodeState, Name, int)
      • buildPath

        protected void buildPath​(org.apache.jackrabbit.spi.commons.name.PathBuilder builder,
                                 ItemState state,
                                 HierarchyManagerImpl.CycleDetector detector)
                          throws ItemStateException,
                                 RepositoryException
        Adds the path element of an item id to the path currently being built. Recursively invoked method that may be overridden by some subclass to either return cached responses or add response to cache. On exit, builder contains the path of state.
        Parameters:
        builder - builder currently being used
        state - item to find path of
        detector - path cycle detector
        Throws:
        ItemStateException
        RepositoryException
      • pathResolved

        protected void pathResolved​(ItemId id,
                                    org.apache.jackrabbit.spi.commons.name.PathBuilder builder)
                             throws org.apache.jackrabbit.spi.commons.conversion.MalformedPathException
        Called by resolvePath(org.apache.jackrabbit.spi.Path.Element[], int, ItemId, int). May be overridden by some subclass to process/cache intermediate state.
        Parameters:
        id - id of resolved item
        builder - path builder containing path resolved
        Throws:
        org.apache.jackrabbit.spi.commons.conversion.MalformedPathException - if the path contained in builder is malformed
      • resolvePath

        public final ItemId resolvePath​(org.apache.jackrabbit.spi.Path path)
                                 throws RepositoryException
        Resolves a path into an item id.

        If there is both a node and a property at the specified path, this method will return the id of the node.

        Note that, for performance reasons, this method returns null rather than throwing a PathNotFoundException if there's no item to be found at path.

        Specified by:
        resolvePath in interface HierarchyManager
        Parameters:
        path - path to resolve
        Returns:
        item id referred to by path or null if there's no item at path.
        Throws:
        RepositoryException - if an error occurs
      • resolveNodePath

        public NodeId resolveNodePath​(org.apache.jackrabbit.spi.Path path)
                               throws RepositoryException
        Resolves a path into a node id.

        Note that, for performance reasons, this method returns null rather than throwing a PathNotFoundException if there's no node to be found at path.

        Specified by:
        resolveNodePath in interface HierarchyManager
        Parameters:
        path - path to resolve
        Returns:
        node id referred to by path or null if there's no node at path.
        Throws:
        RepositoryException - if an error occurs
      • resolvePropertyPath

        public PropertyId resolvePropertyPath​(org.apache.jackrabbit.spi.Path path)
                                       throws RepositoryException
        Resolves a path into a property id.

        Note that, for performance reasons, this method returns null rather than throwing a PathNotFoundException if there's no property to be found at path.

        Specified by:
        resolvePropertyPath in interface HierarchyManager
        Parameters:
        path - path to resolve
        Returns:
        property id referred to by path or null if there's no property at path.
        Throws:
        RepositoryException - if an error occurs
      • getRelativeDepth

        public int getRelativeDepth​(NodeId ancestorId,
                                    ItemId descendantId)
                             throws ItemNotFoundException,
                                    RepositoryException
        Returns the depth of the specified descendant relative to the given ancestor. If ancestorId and descendantId denote the same item 0 is returned. If ancestorId does not denote an ancestor -1 is returned.
        Specified by:
        getRelativeDepth in interface HierarchyManager
        Parameters:
        ancestorId - ancestor id
        descendantId - descendant id
        Returns:
        the relative depth; -1 if ancestorId does not denote an ancestor of the item denoted by descendantId (or itself).
        Throws:
        ItemNotFoundException - if either of the specified id's does not denote an existing item.
        RepositoryException - if another error occurs
      • isAncestor

        public boolean isAncestor​(NodeId nodeId,
                                  ItemId itemId)
                           throws ItemNotFoundException,
                                  RepositoryException
        Determines whether the node with the specified nodeId is an ancestor of the item denoted by the given itemId. This is equivalent to getPath(nodeId).isAncestorOf(getPath(itemId)).
        Specified by:
        isAncestor in interface HierarchyManager
        Parameters:
        nodeId - node id
        itemId - item id
        Returns:
        true if the node with the specified nodeId is an ancestor of the item denoted by the given itemId; false otherwise
        Throws:
        ItemNotFoundException - if any of the specified id's does not denote an existing item.
        RepositoryException - if another error occurs
      • isShareAncestor

        public boolean isShareAncestor​(NodeId ancestor,
                                       NodeId descendant)
                                throws ItemNotFoundException,
                                       RepositoryException
        Determines whether the node with the specified ancestor is a share ancestor of the item denoted by the given descendant. This is true for two nodes A, B if either:
        • A is a (proper) ancestor of B
        • there is a non-empty sequence of nodes N1,... ,Nk such that A= N1 and B=Nk and Ni is the parent or a share-parent of Ni+1 (for every i in 1 ...k-1.
        Specified by:
        isShareAncestor in interface HierarchyManager
        Parameters:
        ancestor - node id
        descendant - item id
        Returns:
        true if the node denoted by ancestor is a share ancestor of the item denoted by descendant, false otherwise
        Throws:
        ItemNotFoundException - if any of the specified id's does not denote an existing item.
        RepositoryException - if another error occurs
      • getShareRelativeDepth

        public int getShareRelativeDepth​(NodeId ancestor,
                                         ItemId descendant)
                                  throws ItemNotFoundException,
                                         RepositoryException
        Returns the depth of the specified share-descendant relative to the given share-ancestor. If ancestor and descendant denote the same item, 0 is returned. If ancestor does not denote an share-ancestor -1 is returned.
        Specified by:
        getShareRelativeDepth in interface HierarchyManager
        Parameters:
        ancestor - ancestor id
        descendant - descendant id
        Returns:
        the relative depth; -1 if ancestor does not denote a share-ancestor of the item denoted by descendant (or itself).
        Throws:
        ItemNotFoundException - if either of the specified id's does not denote an existing item.
        RepositoryException - if another error occurs