org.apache.jackrabbit.jcr2spi.hierarchy
Class HierarchyManagerImpl

java.lang.Object
  extended by org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl
All Implemented Interfaces:
HierarchyManager

public class HierarchyManagerImpl
extends Object
implements HierarchyManager

HierarchyManagerImpl implements the HierarchyManager interface.


Constructor Summary
HierarchyManagerImpl(TransientItemStateFactory isf, IdFactory idFactory, PathFactory pathFactory)
           
 
Method Summary
 void dispose()
          Dispose this HierarchyManager
 int getDepth(HierarchyEntry hierarchyEntry)
          Returns the depth of the specified item.
 NodeEntry getNodeEntry(NodeId nodeId)
          Resolves a itemId into a HierarchyEntry.
 NodeEntry getNodeEntry(Path qPath)
          Resolves a path into a NodeEntry.
 NodeState getNodeState(Path qPath)
          Retrieves the NodeEntry corresponding to the given path and resolves it to the underlying NodeState.
 PropertyEntry getPropertyEntry(Path qPath)
          Resolves a path into a PropertyEntry.
 PropertyEntry getPropertyEntry(PropertyId propertyId)
          Resolves a propertyId into a PropertyEntry.
 PropertyState getPropertyState(Path qPath)
          Retrieves the PropertyEntry corresponding to the given path and resolves it to the underlying PropertyState.
 int getRelativeDepth(NodeEntry ancestor, HierarchyEntry descendant)
          Returns the depth of the specified descendant relative to the given ancestor.
 NodeEntry getRootEntry()
           
 HierarchyEntry lookup(ItemId workspaceItemId)
          Lookup of HierarchyEntry by its workspace Id that may be different if a entry (or any of its ancestors) has been transiently moved or reordered.
 HierarchyEntry lookup(Path workspacePath)
          Lookup of HierarchyEntry by its workspace path that may be different if a entry (or any of its ancestors) has been transiently moved or reordered.
 void setResolver(NamePathResolver resolver)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HierarchyManagerImpl

public HierarchyManagerImpl(TransientItemStateFactory isf,
                            IdFactory idFactory,
                            PathFactory pathFactory)
Method Detail

setResolver

public void setResolver(NamePathResolver resolver)

dispose

public void dispose()
Description copied from interface: HierarchyManager
Dispose this HierarchyManager

Specified by:
dispose in interface HierarchyManager
See Also:
HierarchyManager.dispose()

getRootEntry

public NodeEntry getRootEntry()
Specified by:
getRootEntry in interface HierarchyManager
Returns:
the root entry.
See Also:
HierarchyManager.getRootEntry()

lookup

public HierarchyEntry lookup(ItemId workspaceItemId)
Description copied from interface: HierarchyManager
Lookup of HierarchyEntry by its workspace Id that may be different if a entry (or any of its ancestors) has been transiently moved or reordered.

If the Hierarchy already lists the entry with the given workspaceItemId it is returned otherwise null. See HierarchyManager.getNodeEntry(NodeId) or HierarchyManager.getPropertyEntry(PropertyId) for methods that resolves the ItemId including lookup in the persistence layer if the entry has not been loaded yet.

Specified by:
lookup in interface HierarchyManager
Returns:
the HierarchyEntry with the given workspaceItemId.
See Also:
HierarchyManager.lookup(ItemId)

lookup

public HierarchyEntry lookup(Path workspacePath)
Description copied from interface: HierarchyManager
Lookup of HierarchyEntry by its workspace path that may be different if a entry (or any of its ancestors) has been transiently moved or reordered.

If the Hierarchy already lists the entry with the given path it is returned otherwise null. See HierarchyManager.getNodeEntry(Path) or HierarchyManager.getPropertyEntry(Path) for methods that resolves the path including lookup in the persistence layer if the entry has not been loaded yet.

Specified by:
lookup in interface HierarchyManager
Returns:
the HierarchyEntry with the given workspacePath.
See Also:
HierarchyManager.lookup(Path)

getNodeEntry

public NodeEntry getNodeEntry(NodeId nodeId)
                       throws ItemNotFoundException,
                              RepositoryException
Description copied from interface: HierarchyManager
Resolves a itemId into a HierarchyEntry.

Specified by:
getNodeEntry in interface HierarchyManager
Returns:
Throws:
PathNotFoundException
RepositoryException
ItemNotFoundException
See Also:
HierarchyManager.getNodeEntry(NodeId)

getNodeEntry

public NodeEntry getNodeEntry(Path qPath)
                       throws PathNotFoundException,
                              RepositoryException
Description copied from interface: HierarchyManager
Resolves a path into a NodeEntry.

Specified by:
getNodeEntry in interface HierarchyManager
Returns:
Throws:
PathNotFoundException
RepositoryException
See Also:
HierarchyManager.getNodeEntry(Path)

getPropertyEntry

public PropertyEntry getPropertyEntry(PropertyId propertyId)
                               throws ItemNotFoundException,
                                      RepositoryException
Description copied from interface: HierarchyManager
Resolves a propertyId into a PropertyEntry.

Specified by:
getPropertyEntry in interface HierarchyManager
Returns:
Throws:
PathNotFoundException
RepositoryException
ItemNotFoundException
See Also:
HierarchyManager.getPropertyEntry(PropertyId)

getPropertyEntry

public PropertyEntry getPropertyEntry(Path qPath)
                               throws PathNotFoundException,
                                      RepositoryException
Description copied from interface: HierarchyManager
Resolves a path into a PropertyEntry.

Specified by:
getPropertyEntry in interface HierarchyManager
Returns:
Throws:
PathNotFoundException
RepositoryException
See Also:
HierarchyManager.getPropertyEntry(Path)

getNodeState

public NodeState getNodeState(Path qPath)
                       throws PathNotFoundException,
                              RepositoryException
Description copied from interface: HierarchyManager
Retrieves the NodeEntry corresponding to the given path and resolves it to the underlying NodeState.

Specified by:
getNodeState in interface HierarchyManager
Returns:
Throws:
PathNotFoundException
RepositoryException
See Also:
HierarchyManager.getNodeState(Path)

getPropertyState

public PropertyState getPropertyState(Path qPath)
                               throws PathNotFoundException,
                                      RepositoryException
Description copied from interface: HierarchyManager
Retrieves the PropertyEntry corresponding to the given path and resolves it to the underlying PropertyState.

Specified by:
getPropertyState in interface HierarchyManager
Returns:
Throws:
PathNotFoundException
RepositoryException
See Also:
HierarchyManager.getPropertyState(Path)

getDepth

public int getDepth(HierarchyEntry hierarchyEntry)
             throws ItemNotFoundException,
                    RepositoryException
Description copied from interface: HierarchyManager
Returns the depth of the specified item. The depth reflects the absolute hierarchy level.

Specified by:
getDepth in interface HierarchyManager
Returns:
the depth of the specified item
Throws:
RepositoryException - if another error occurs
ItemNotFoundException
See Also:
HierarchyManager.getDepth(HierarchyEntry)

getRelativeDepth

public int getRelativeDepth(NodeEntry ancestor,
                            HierarchyEntry descendant)
                     throws ItemNotFoundException,
                            RepositoryException
Description copied from interface: HierarchyManager
Returns the depth of the specified descendant relative to the given ancestor. If ancestor and descendant denote the same item 0 is returned. If ancestor does not denote an ancestor -1 is returned.

Specified by:
getRelativeDepth in interface HierarchyManager
Parameters:
ancestor - NodeEntry that must be an ancestor of the descendant
descendant - HierarchyEntry
Returns:
the relative depth; -1 if ancestor does not denote an 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.
See Also:
HierarchyManager.getRelativeDepth(NodeEntry, HierarchyEntry)


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