|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.HierarchyManagerImpl
public class HierarchyManagerImpl
HierarchyManagerImpl ...
| Field Summary | |
|---|---|
protected ItemStateManager |
provider
|
protected NodeId |
rootNodeId
|
| Constructor Summary | |
|---|---|
HierarchyManagerImpl(NodeId rootNodeId,
ItemStateManager provider)
|
|
| Method Summary | |
|---|---|
protected void |
buildPath(PathBuilder builder,
ItemState state)
Adds the path element of an item id to the path currently being built. |
protected ChildNodeEntry |
getChildNodeEntry(NodeState parent,
Name name,
int index)
Returns the ChildNodeEntry of parent with the
specified name and index or null
if there's no such entry. |
protected ChildNodeEntry |
getChildNodeEntry(NodeState parent,
NodeId id)
Returns the ChildNodeEntry of parent with the
specified uuid or null if there's no such entry. |
int |
getDepth(ItemId id)
Returns the depth of the specified item which is equivalent to getPath(id).getAncestorCount(). |
protected ItemState |
getItemState(ItemId id)
Return an item state, given its item id. |
Name |
getName(ItemId itemId)
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. |
protected NodeId |
getParentId(ItemState state)
Returns the parentUUID of the given item. |
protected Set<NodeId> |
getParentIds(ItemState state,
boolean useOverlayed)
Return all parents of a node. |
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. |
NodeId |
getRootNodeId()
|
int |
getShareRelativeDepth(NodeId ancestor,
ItemId descendant)
Returns the depth of the specified share-descendant relative to the given share-ancestor. |
protected boolean |
hasItemState(ItemId id)
Determines whether an item state for a given item id exists. |
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. |
protected void |
pathResolved(ItemId id,
PathBuilder builder)
Called by resolvePath(org.apache.jackrabbit.spi.Path.Element[], int, ItemId, int). |
NodeId |
resolveNodePath(Path path)
Resolves a path into a node id. |
protected ItemId |
resolvePath(Path.Element[] elements,
int next,
ItemId id,
int typesAllowed)
Internal implementation that iteratively resolves a path into an item. |
ItemId |
resolvePath(Path path)
Resolves a path into an item id. |
protected ItemId |
resolvePath(Path path,
int typesAllowed)
Internal implementation of resolvePath(Path) that will either
resolve to a node or a property. |
PropertyId |
resolvePropertyPath(Path path)
Resolves a path into a property id. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final NodeId rootNodeId
protected final ItemStateManager provider
| Constructor Detail |
|---|
public HierarchyManagerImpl(NodeId rootNodeId,
ItemStateManager provider)
| Method Detail |
|---|
public NodeId getRootNodeId()
protected ItemId resolvePath(Path.Element[] elements,
int next,
ItemId id,
int typesAllowed)
throws ItemStateException,
MalformedPathException
elements - path elementsnext - index of next item in elements to inspectid - id of item at path elements[0]..elements[next - 1]typesAllowed - one of RETURN_ANY, RETURN_NODE
or RETURN_PROPERTY
null
ItemStateException - if an intermediate item state is not found
MalformedPathException - if building an intermediate path fails
protected ItemState getItemState(ItemId id)
throws NoSuchItemStateException,
ItemStateException
id - item id
NoSuchItemStateException - if the item does not exist
ItemStateException - if an error occursZombieHierarchyManager.getItemState(ItemId)protected boolean hasItemState(ItemId id)
id - item id
true if an item state exists, otherwise
falseZombieHierarchyManager.hasItemState(ItemId)protected NodeId getParentId(ItemState state)
parentUUID of the given item.
Low-level hook provided for specialized derived classes.
state - item state
parentUUID of the given itemZombieHierarchyManager.getParentId(ItemState)
protected Set<NodeId> getParentIds(ItemState state,
boolean useOverlayed)
state - item stateuseOverlayed - whether to use overlayed state for shareable nodes
NodeIds. If state has no parent,
array has length 0.
protected ChildNodeEntry getChildNodeEntry(NodeState parent,
NodeId id)
ChildNodeEntry of parent with the
specified uuid or null if there's no such entry.
Low-level hook provided for specialized derived classes.
parent - node stateid - id of child node entry
ChildNodeEntry of parent with
the specified uuid or null if there's
no such entry.ZombieHierarchyManager.getChildNodeEntry(NodeState, NodeId)
protected ChildNodeEntry getChildNodeEntry(NodeState parent,
Name name,
int index)
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.
parent - node statename - name of child node entryindex - index of child node entry
ChildNodeEntry of parent with
the specified name and index or
null if there's no such entry.ZombieHierarchyManager.getChildNodeEntry(NodeState, Name, int)
protected void buildPath(PathBuilder builder,
ItemState state)
throws ItemStateException,
RepositoryException
builder contains the path of state.
builder - builder currently being usedstate - item to find path of
ItemStateException
RepositoryException
protected ItemId resolvePath(Path path,
int typesAllowed)
throws RepositoryException
resolvePath(Path) that will either
resolve to a node or a property. Should be overridden by a subclass
that can resolve an intermediate path into an ItemId. This
subclass can then invoke resolvePath(org.apache.jackrabbit.spi.Path.Element[], int, ItemId, int)
with a value of next greater than 1.
path - path to resolvetypesAllowed - one of RETURN_ANY, RETURN_NODE
or RETURN_PROPERTY
null
RepositoryException - if an error occurs
protected void pathResolved(ItemId id,
PathBuilder builder)
throws MalformedPathException
resolvePath(org.apache.jackrabbit.spi.Path.Element[], int, ItemId, int).
May be overridden by some subclass to process/cache intermediate state.
id - id of resolved itembuilder - path builder containing path resolved
MalformedPathException - if the path contained in builder
is malformed
public final ItemId resolvePath(Path path)
throws RepositoryException
null
rather than throwing a PathNotFoundException if there's no
item to be found at path.
resolvePath in interface HierarchyManagerpath - path to resolve
path or null
if there's no item at path.
RepositoryException - if an error occurs
public NodeId resolveNodePath(Path path)
throws RepositoryException
null
rather than throwing a PathNotFoundException if there's no
node to be found at path.
resolveNodePath in interface HierarchyManagerpath - path to resolve
path or null
if there's no node at path.
RepositoryException - if an error occurs
public PropertyId resolvePropertyPath(Path path)
throws RepositoryException
null
rather than throwing a PathNotFoundException if there's no
property to be found at path.
resolvePropertyPath in interface HierarchyManagerpath - path to resolve
path or null
if there's no property at path.
RepositoryException - if an error occurs
public Path getPath(ItemId id)
throws ItemNotFoundException,
RepositoryException
getPath in interface HierarchyManagerItemNotFoundException
RepositoryException
public Name getName(ItemId itemId)
throws ItemNotFoundException,
RepositoryException
getName in interface HierarchyManageritemId - id of item whose name should be returned
ItemNotFoundException
RepositoryException
public Name getName(NodeId id,
NodeId parentId)
throws ItemNotFoundException,
RepositoryException
HierarchyManager.getName(ItemId).
getName in interface HierarchyManagerid - node idparentId - parent node id
ItemNotFoundException
RepositoryException
public int getDepth(ItemId id)
throws ItemNotFoundException,
RepositoryException
getPath(id).getAncestorCount(). The depth reflects the
absolute hierarchy level.
getDepth in interface HierarchyManagerid - item id
ItemNotFoundException - if the specified id does not
denote an existing item.
RepositoryException - if another error occurs
public int getRelativeDepth(NodeId ancestorId,
ItemId descendantId)
throws ItemNotFoundException,
RepositoryException
ancestorId and descendantId
denote the same item 0 is returned. If ancestorId does not
denote an ancestor -1 is returned.
getRelativeDepth in interface HierarchyManagerancestorId - ancestor iddescendantId - descendant id
ancestorId does not
denote an ancestor of the item denoted by descendantId
(or itself).
ItemNotFoundException - if either of the specified id's does not
denote an existing item.
RepositoryException - if another error occurs
public boolean isAncestor(NodeId nodeId,
ItemId itemId)
throws ItemNotFoundException,
RepositoryException
nodeId
is an ancestor of the item denoted by the given itemId.
This is equivalent to
getPath(nodeId).isAncestorOf(getPath(itemId)).
isAncestor in interface HierarchyManagernodeId - node iditemId - item id
true if the node with the specified
nodeId is an ancestor of the item denoted by the
given itemIdfalse otherwise
ItemNotFoundException - if any of the specified id's does not
denote an existing item.
RepositoryException - if another error occurs
public boolean isShareAncestor(NodeId ancestor,
NodeId descendant)
throws ItemNotFoundException,
RepositoryException
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 BN1,...
,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.
isShareAncestor in interface HierarchyManagerancestor - node iddescendant - item id
true if the node denoted by ancestor
is a share ancestor of the item denoted by descendant,
false otherwise
ItemNotFoundException - if any of the specified id's does not
denote an existing item.
RepositoryException - if another error occurs
public int getShareRelativeDepth(NodeId ancestor,
ItemId descendant)
throws ItemNotFoundException,
RepositoryException
ancestor and descendant
denote the same item, 0 is returned. If ancestor
does not denote an share-ancestor -1 is returned.
getShareRelativeDepth in interface HierarchyManagerancestor - ancestor iddescendant - descendant id
-1 if ancestor does
not denote a share-ancestor of the item denoted by descendant
(or itself).
ItemNotFoundException - if either of the specified id's does not
denote an existing item.
RepositoryException - if another error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||