Class CachingHierarchyManager

    • Field Detail

      • DEFAULT_UPPER_LIMIT

        public static final int DEFAULT_UPPER_LIMIT
        Default upper limit of cached states
        See Also:
        Constant Field Values
    • Constructor Detail

      • CachingHierarchyManager

        public CachingHierarchyManager​(NodeId rootNodeId,
                                       ItemStateManager provider)
        Create a new instance of this class.
        Parameters:
        rootNodeId - root node id
        provider - item state manager
    • Method Detail

      • enableConsistencyChecks

        public void enableConsistencyChecks​(boolean enable)
        Enable or disable consistency checks in this instance.
        Parameters:
        enable - true to enable consistency checks; false to disable
      • buildPath

        protected void buildPath​(org.apache.jackrabbit.spi.commons.name.PathBuilder builder,
                                 ItemState state,
                                 HierarchyManagerImpl.CycleDetector detector)
                          throws ItemStateException,
                                 RepositoryException
        Adds the path element of an item id to the path currently being built. Recursively invoked method that may be overridden by some subclass to either return cached responses or add response to cache. On exit, builder contains the path of state.

        Overridden method tries to find a mapping for the intermediate item state and add its path elements to the builder currently being used. If no mapping is found, the item is cached instead after the base implementation has been invoked.

        Overrides:
        buildPath in class HierarchyManagerImpl
        Parameters:
        builder - builder currently being used
        state - item to find path of
        detector - path cycle detector
        Throws:
        ItemStateException
        RepositoryException
      • stateCreated

        public void stateCreated​(ItemState created)
        Called when an ItemState has successfully been created (i.e. its underlying persistent state was created).
        Specified by:
        stateCreated in interface ItemStateListener
        Parameters:
        created - the ItemState that has been 'created'
      • stateModified

        public void stateModified​(ItemState modified)
        Called when an ItemState has successfully been modified (i.e. its underlying persistent state has changed).
        Specified by:
        stateModified in interface ItemStateListener
        Parameters:
        modified - the ItemState that has been 'modified'
      • nodeModified

        public void nodeModified​(NodeState modified)
        Called when a node has been modified, typically as a result of removal or addition of a child node.

        Please note, that this method is not called if ItemStateListener.stateModified(ItemState) was called. If path information is cached for modified, this iterates over all child nodes in the path map, evicting the ones that do not (longer) exist in the underlying NodeState.

        Specified by:
        nodeModified in interface NodeStateListener
        Parameters:
        modified - node state that changed
      • stateDestroyed

        public void stateDestroyed​(ItemState destroyed)
        Called when an ItemState has successfully been removed (i.e. its underlying persistent state has been destroyed).
        Specified by:
        stateDestroyed in interface ItemStateListener
        Parameters:
        destroyed - the ItemState that has been 'destroyed'
      • stateDiscarded

        public void stateDiscarded​(ItemState discarded)
        Called when an ItemState has been discarded (i.e. it has been rendered 'invalid').
        Specified by:
        stateDiscarded in interface ItemStateListener
        Parameters:
        discarded - the ItemState that has been discarded
        See Also:
        ItemState.discard()
      • nodeAdded

        public void nodeAdded​(NodeState state,
                              org.apache.jackrabbit.spi.Name name,
                              int index,
                              NodeId id)
        Called when a child node has been added
        Specified by:
        nodeAdded in interface NodeStateListener
        Parameters:
        state - node state that changed
        name - name of node that was added
        index - index of new node
        id - id of new node
      • nodesReplaced

        public void nodesReplaced​(NodeState state)
        Called when the children nodes were replaced by other nodes, typically as result of a reorder operation.

        Iterate over all cached children of this state and verify each child's position.

        Specified by:
        nodesReplaced in interface NodeStateListener
        Parameters:
        state - node state that changed
      • nodeRemoved

        public void nodeRemoved​(NodeState state,
                                org.apache.jackrabbit.spi.Name name,
                                int index,
                                NodeId id)
        Called when a child node has been removed
        Specified by:
        nodeRemoved in interface NodeStateListener
        Parameters:
        state - node state that changed
        name - name of node that was removed
        index - index of removed node
        id - id of removed node
      • toString

        public String toString()
        Dump contents of path map and elements included to a string.
        Overrides:
        toString in class Object