org.apache.jackrabbit.core
Interface HierarchyManager

All Known Implementing Classes:
CachingHierarchyManager, HierarchyManagerImpl, ZombieHierarchyManager

public interface HierarchyManager

The HierarchyManager interface ...


Method Summary
 int getDepth(ItemId id)
          Returns the depth of the specified item which is equivalent to getPath(id).getAncestorCount().
 Name getName(ItemId id)
          Returns the name of the specified item.
 Name getName(NodeId id, NodeId parentId)
          Returns the name of the specified item, with the given parent id.
 Path getPath(ItemId id)
          Returns the path to the given item.
 int getRelativeDepth(NodeId ancestorId, ItemId descendantId)
          Returns the depth of the specified descendant relative to the given ancestor.
 int getShareRelativeDepth(NodeId ancestorId, ItemId descendantId)
          Returns the depth of the specified share-descendant relative to the given share-ancestor.
 boolean isAncestor(NodeId nodeId, ItemId itemId)
          Determines whether the node with the specified nodeId is an ancestor of the item denoted by the given itemId.
 boolean isShareAncestor(NodeId ancestor, NodeId descendant)
          Determines whether the node with the specified ancestor is a share ancestor of the item denoted by the given descendant.
 NodeId resolveNodePath(Path path)
          Resolves a path into a node id.
 ItemId resolvePath(Path path)
          Deprecated. As of JSR 283, a Path doesn't anymore uniquely identify an Item, therefore resolveNodePath(Path) and resolvePropertyPath(Path) should be used instead.
 PropertyId resolvePropertyPath(Path path)
          Resolves a path into a property id.
 

Method Detail

resolvePath

ItemId resolvePath(Path path)
                   throws RepositoryException
Deprecated. As of JSR 283, a Path doesn't anymore uniquely identify an Item, therefore resolveNodePath(Path) and resolvePropertyPath(Path) should be used instead.

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.

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

NodeId resolveNodePath(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.

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

PropertyId resolvePropertyPath(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.

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

getPath

Path getPath(ItemId id)
             throws ItemNotFoundException,
                    RepositoryException
Returns the path to the given item.

Parameters:
id -
Returns:
Throws:
ItemNotFoundException
RepositoryException

getName

Name getName(ItemId id)
             throws ItemNotFoundException,
                    RepositoryException
Returns the name of the specified item.

Parameters:
id - id of item whose name should be returned
Returns:
Throws:
ItemNotFoundException
RepositoryException

getName

Name getName(NodeId id,
             NodeId parentId)
             throws ItemNotFoundException,
                    RepositoryException
Returns the name of the specified item, with the given parent id. If the given item is not shareable, this is identical to getName(ItemId).

Parameters:
id - node id
parentId - parent node id
Returns:
name
Throws:
ItemNotFoundException
RepositoryException

getDepth

int getDepth(ItemId id)
             throws ItemNotFoundException,
                    RepositoryException
Returns the depth of the specified item which is equivalent to getPath(id).getAncestorCount(). The depth reflects the absolute hierarchy level.

Parameters:
id - item id
Returns:
the depth of the specified item
Throws:
ItemNotFoundException - if the specified id does not denote an existing item.
RepositoryException - if another error occurs

getRelativeDepth

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.

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

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)).

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 itemIdfalse otherwise
Throws:
ItemNotFoundException - if any of the specified id's does not denote an existing item.
RepositoryException - if another error occurs

isShareAncestor

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:

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

int getShareRelativeDepth(NodeId ancestorId,
                          ItemId descendantId)
                          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.

Parameters:
ancestorId - ancestor id
descendantId - 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


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.