org.apache.jackrabbit.core
Interface HierarchyManager

All Known Implementing Classes:
HierarchyManagerImpl

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().
 QName getName(ItemId id)
          Returns the name of the specified item.
 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.
 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.
 ItemId resolvePath(Path path)
          Resolves a path into an item id.
 

Method Detail

resolvePath

public ItemId resolvePath(Path path)
                   throws PathNotFoundException,
                          RepositoryException
Resolves a path into an item id.

Parameters:
path -
Returns:
Throws:
PathNotFoundException
RepositoryException

getPath

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

Parameters:
id -
Returns:
Throws:
ItemNotFoundException
RepositoryException

getName

public QName 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

getDepth

public 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

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.

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

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


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