org.apache.jackrabbit.jcr2spi.hierarchy
Interface HierarchyEntry

All Known Subinterfaces:
NodeEntry, PropertyEntry
All Known Implementing Classes:
NodeEntryImpl, PropertyEntryImpl

public interface HierarchyEntry

HierarchyEntry...


Method Summary
 void calculateStatus()
          Calculates the status of the underlying ItemState: any pending changes to the underlying ItemState are applied.
 void complete(Operation transientOperation)
          Clean up this entry upon Operation.undo() or Operation.persisted().
 boolean denotesNode()
          True if this HierarchyEntry would resolve to a NodeState.
 long getGeneration()
          The required generation of this HierarchyEntry .
 ItemState getItemState()
          If this HierarchyEntry has already been resolved before (see isAvailable()), that ItemState is returned.
 Name getName()
           
 NodeEntry getParent()
          Returns the NodeEntry being parent to this HierarchyEntry.
 Path getPath()
           
 int getStatus()
          If this HierarchyEntry provides an underlying ItemState this method returns the status of that state, otherwise it returns Status._UNDEFINED_.
 Path getWorkspacePath()
           
 void invalidate(boolean recursive)
          Invalidates the underlying ItemState if available and if it is not transiently modified.
 boolean isAvailable()
          Returns true if the referenced ItemState is available.
 void reload(boolean recursive)
          Reloads this hierarchy entry and the corresponding ItemState, if this entry has already been resolved.
 void remove()
          Removes this HierarchyEntry from its parent and sets the status of the underlying ItemState to Status.REMOVED or to Status.STALE_DESTROYED, respectively.
 void revert()
          Traverses the hierarchy and reverts all transient modifications such as adding, modifying or removing item states.
 void setItemState(ItemState state)
          Set the ItemState this hierarchyEntry will be resolved to.
 void transientRemove()
          Traverses the hierarchy and marks all available item states as transiently removed.
 

Method Detail

denotesNode

boolean denotesNode()
True if this HierarchyEntry would resolve to a NodeState.

Returns:

getName

Name getName()
Returns:
the name of this hierarchy entry.

getPath

Path getPath()
             throws RepositoryException
Returns:
the path of this hierarchy entry.
Throws:
RepositoryException

getWorkspacePath

Path getWorkspacePath()
                      throws RepositoryException
Returns:
If this entry has not been modified this method returns the same as getPath(). In case of moved items this method return the original path as it is present on the persistent layer.
Throws:
RepositoryException

getParent

NodeEntry getParent()
Returns the NodeEntry being parent to this HierarchyEntry.

Returns:
the parent HierarchyEntry

getStatus

int getStatus()
If this HierarchyEntry provides an underlying ItemState this method returns the status of that state, otherwise it returns Status._UNDEFINED_.

Returns:
Status of the ItemState or Status._UNDEFINED_ if this entry has not been resolved yet.
See Also:
ItemState.getStatus()

isAvailable

boolean isAvailable()
Returns true if the referenced ItemState is available. That is, the referenced ItemState has already been resolved.
Note, that the validity of the ItemState is not checked.

Returns:
true if the ItemState is available; otherwise false.
See Also:
getItemState()

getItemState

ItemState getItemState()
                       throws ItemNotFoundException,
                              RepositoryException
If this HierarchyEntry has already been resolved before (see isAvailable()), that ItemState is returned. Note however, that the validity of the State is not asserted.
If the entry has not been resolved yet an attempt is made to resolve this entry, which may fail if there exists no accessible ItemState or if the corresponding state has been removed in the mean time.

Returns:
the referenced ItemState.
Throws:
ItemNotFoundException - if the ItemState does not exist anymore.
RepositoryException - If an error occurs while retrieving the ItemState.

setItemState

void setItemState(ItemState state)
Set the ItemState this hierarchyEntry will be resolved to.

Parameters:
state -

invalidate

void invalidate(boolean recursive)
Invalidates the underlying ItemState if available and if it is not transiently modified. If the recursive flag is true, also invalidates the child entries recursively.
Note, that in contrast to reload(boolean) this method only sets the status of this item state to Status.INVALIDATED and does not actually update it with the persistent state in the repository.


calculateStatus

void calculateStatus()
Calculates the status of the underlying ItemState: any pending changes to the underlying ItemState are applied.


revert

void revert()
            throws RepositoryException
Traverses the hierarchy and reverts all transient modifications such as adding, modifying or removing item states. 'Existing' item states are reverted to their initial state and their status is reset to Status.EXISTING.

Throws:
RepositoryException - if an error occurs.

reload

void reload(boolean recursive)
Reloads this hierarchy entry and the corresponding ItemState, if this entry has already been resolved. If 'recursive' the complete hierarchy below this entry is reloaded as well.

Parameters:
recursive -

transientRemove

void transientRemove()
                     throws InvalidItemStateException,
                            RepositoryException
Traverses the hierarchy and marks all available item states as transiently removed. They will change their status to either Status.EXISTING_REMOVED if the item is existing in the persistent storage or Status.REMOVED if the item has been transiently added before. In the latter case, the corresponding HierarchyEntries can be removed as well from their parent.

Throws:
InvalidItemStateException - if this entry has been removed in the mean time.
RepositoryException - if an error occurs while removing any of the item states e.g. an item state is not valid anymore.

remove

void remove()
Removes this HierarchyEntry from its parent and sets the status of the underlying ItemState to Status.REMOVED or to Status.STALE_DESTROYED, respectively. If this entry is a NodeEntry all descending ItemStates must get their status changed as well.


complete

void complete(Operation transientOperation)
              throws RepositoryException
Clean up this entry upon Operation.undo() or Operation.persisted().

Parameters:
transientOperation -
Throws:
RepositoryException

getGeneration

long getGeneration()
The required generation of this HierarchyEntry . This is used by the ItemInfoCache to determine wheter an item info in the cache is up to date or not. That is whether the generation of the item info in the cache is the same or more recent as the required generation of this entry.



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