org.modeshape.jcr.cache

## Interface CachedNode

- All Known Subinterfaces:
    MutableCachedNode
  All Known Implementing Classes:
    LazyCachedNode, SessionNode

      public interface CachedNode

  A representation of a node as stored within the cache.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `CachedNode.Properties`
    `static class` | `CachedNode.ReferenceType`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<NodeKey>` | `getAdditionalParentKeys(NodeCache cache)` Get the keys for all of the nodes (other than the `primary parent`) under which this node appears.
    `ChildReferences` | `getChildReferences(NodeCache cache)` Get the set of child references for this node.
    `int` | `getDepth(NodeCache cache)` Get the depth of this node.
    `NodeKey` | `getKey()` Get the key for the node.
    `Set<Name>` | `getMixinTypes(NodeCache cache)` Get the set of mixin types for this node.
    `Name` | `getName(NodeCache cache)` Get the name for this node, without any same-name-sibiling (SNS) index.
    `NodeKey` | `getParentKey(NodeCache cache)` Get the node key for this node's primary parent within this workspace.
    `NodeKey` | `getParentKeyInAnyWorkspace(NodeCache cache)` Get the node key for this node's primary parent in any workspace.
    `Path` | `getPath(NodeCache cache)` Get the path to this node.
    `Path` | `getPath(PathCache pathCache)` Get the path to this node.
    `Map<String,Set<String>>` | `getPermissions(NodeCache cache)` Gets the map of privileges by principal name which are in effect for this node.
    `Name` | `getPrimaryType(NodeCache cache)` Get the primary type for this node.
    `Iterator<Property>` | `getProperties(Collection<?> namePatterns, NodeCache cache)` Get an iterator over all of the properties of this node that have names matching at least one of the supplied patterns.
    `Iterator<Property>` | `getProperties(NodeCache cache)` Get an iterator over all of the node's properties.
    `CachedNode.Properties` | `getPropertiesByName(NodeCache cache)` Get the properties collection.
    `Property` | `getProperty(Name name, NodeCache cache)` Get the property with the given name.
    `int` | `getPropertyCount(NodeCache cache)` Determine the number of properties that this node contains.
    `Set<NodeKey>` | `getReferrers(NodeCache cache, CachedNode.ReferenceType type)` Get the keys of the nodes that have JCR REFERENCE and/or WEAK_REFERENCE properties pointing to this node.
    `Path.Segment` | `getSegment(NodeCache cache)` Get the path segment for this node.
    `boolean` | `hasACL(NodeCache cache)` Determine if there is an access control list for this node only, not taking into account any possible parents.
    `boolean` | `hasProperties(NodeCache cache)` Determine if the node contains one or more properties.
    `boolean` | `hasProperty(Name name, NodeCache cache)` Determine if the node contains a property with the specified name.
    `boolean` | `isAtOrBelow(NodeCache cache, Path path)` Determine if this node is effectively at or below the supplied path.
    `boolean` | `isExternal(NodeCache cache)` Determine if this node belongs to an external source (via federation) or is local to the repository.
    `boolean` | `isQueryable(NodeCache cache)` Determine if this node should be indexed and therefore available for querying.

- - ### Method Detail

    - #### getKey

          NodeKey getKey()

      Get the key for the node.
      Returns:
        the node's key; never null

    - #### getName

          Name getName(NodeCache cache)

      Get the name for this node, without any same-name-sibiling (SNS) index.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the name; never null, but the root node will have a zero-length name
      Throws:
        `NodeNotFoundInParentException` - if this node no longer exists inside the parent node (and perhaps in no other parent)
        `NodeNotFoundException` - if this node no longer exists
      See Also:
        `getSegment(NodeCache)`, `getPath(NodeCache)`

    - #### getSegment

          Path.Segment getSegment(NodeCache cache)

      Get the path segment for this node. The segment consists of a name and a same-name-sibling (SNS) index.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the segment; never null, but the root node will have a zero-length name
      Throws:
        `NodeNotFoundInParentException` - if this node no longer exists inside the parent node (and perhaps in no other parent)
        `NodeNotFoundException` - if this node no longer exists
      See Also:
        `getName(NodeCache)`, `getPath(NodeCache)`

    - #### getPath

          Path getPath(NodeCache cache)
                       throws NodeNotFoundException

      Get the path to this node.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the node's path; never null with at least one segment for all nodes except the root node
      Throws:
        `NodeNotFoundInParentException` - if this node no longer exists inside the parent node (and perhaps in no other parent)
        `NodeNotFoundException` - if this node no longer exists
      See Also:
        `getName(NodeCache)`, `getSegment(NodeCache)`

    - #### getPath

          Path getPath(PathCache pathCache)
                       throws NodeNotFoundException

      Get the path to this node.
      Parameters:
        `pathCache` - the cache of paths that can be used to compute the path for any node; may not be null
      Returns:
        the node's path; never null with at least one segment for all nodes except the root node
      Throws:
        `NodeNotFoundInParentException` - if this node no longer exists inside the parent node (and perhaps in no other parent)
        `NodeNotFoundException` - if this node no longer exists
      See Also:
        `getName(NodeCache)`, `getSegment(NodeCache)`

    - #### getDepth

          int getDepth(NodeCache cache)
                       throws NodeNotFoundException

      Get the depth of this node. The depth is equivalent to the number of segments in the node's path (0 for the root node, 1 for "`/foo`", 2 for "`/foo/bar`", etc.), although this method will likely compute the depth more efficiently that finding the path and asking for the number of segments.

      The depth is calculated based upon the primary parent (and `primary path`). This is, although shared nodes are accessible at multiple paths, only the primary path is used to determine the depth of the node.

      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the depth of this node; 0 for the root, or a positive number for all other nodes
      Throws:
        `NodeNotFoundException` - if this node no longer exists

    - #### getParentKey

          NodeKey getParentKey(NodeCache cache)

      Get the node key for this node's primary parent within this workspace.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the parent's key; null if this is the root node or it has been removed from the document by someone else

    - #### getParentKeyInAnyWorkspace

          NodeKey getParentKeyInAnyWorkspace(NodeCache cache)

      Get the node key for this node's primary parent in any workspace.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the parent's key; null if this is the root node or it has been removed from the document by someone else

    - #### getAdditionalParentKeys

          Set<NodeKey> getAdditionalParentKeys(NodeCache cache)

      Get the keys for all of the nodes (other than the `primary parent`) under which this node appears.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the immutable set of keys to the additional parents, excluding the primary parent

    - #### getPrimaryType

          Name getPrimaryType(NodeCache cache)

      Get the primary type for this node.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the primary type name; never null

    - #### getMixinTypes

          Set<Name> getMixinTypes(NodeCache cache)

      Get the set of mixin types for this node.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the immutable list of mixin type names; never null but possibly empty

    - #### getPropertyCount

          int getPropertyCount(NodeCache cache)

      Determine the number of properties that this node contains.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the number of properties; never negative

    - #### hasProperties

          boolean hasProperties(NodeCache cache)

      Determine if the node contains one or more properties.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        true if the node has at least one property, or false otherwise

    - #### hasProperty

          boolean hasProperty(Name name,
                            NodeCache cache)

      Determine if the node contains a property with the specified name.
      Parameters:
        `name` - the name of the property
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        true if the node has the named property, or false otherwise

    - #### getProperty

          Property getProperty(Name name,
                             NodeCache cache)

      Get the property with the given name.
      Parameters:
        `name` - the name of the property
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the property, or null if the property does not exist on this node
      Throws:
        `NodeNotFoundException` - if this node no longer exists

    - #### getPropertiesByName

          CachedNode.Properties getPropertiesByName(NodeCache cache)

      Get the properties collection.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the properties; never null but possibly empty

    - #### getProperties

          Iterator<Property> getProperties(NodeCache cache)

      Get an iterator over all of the node's properties.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the property iterator; never null but possibly empty

    - #### getProperties

          Iterator<Property> getProperties(Collection<?> namePatterns,
                                         NodeCache cache)

      Get an iterator over all of the properties of this node that have names matching at least one of the supplied patterns.
      Parameters:
        `namePatterns` - the regex patterns or string literals describing the names
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the property iterator; never null but possibly empty

    - #### getChildReferences

          ChildReferences getChildReferences(NodeCache cache)

      Get the set of child references for this node. Note that each child reference will need to be resolved by the caller.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        the representation of the children of this node; never null but possibly empty

    - #### getReferrers

          Set<NodeKey> getReferrers(NodeCache cache,
                                  CachedNode.ReferenceType type)

      Get the keys of the nodes that have JCR REFERENCE and/or WEAK_REFERENCE properties pointing to this node.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
        `type` - the flag specifying whether nodes with REFERENCE properties and/or WEAK reference properties should be included in the result; may not be null
      Returns:
        the set of keys to the nodes that have a reference to this node; never null but possibly empty

    - #### isAtOrBelow

          boolean isAtOrBelow(NodeCache cache,
                            Path path)

      Determine if this node is effectively at or below the supplied path. Note that because of `additional parents`, a node has multiple effective paths.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
        `path` - the path to be used for comparison; may not be null
      Returns:
        true if this node can be considered at or below the supplied path; or false otherwise

    - #### isQueryable

          boolean isQueryable(NodeCache cache)

      Determine if this node should be indexed and therefore available for querying. By default, every node is queryable, so only in certain cases can a node be made non-queryable.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        `true` if the node should be indexed, `false` otherwise

    - #### hasACL

          boolean hasACL(NodeCache cache)

      Determine if there is an access control list for this node only, not taking into account any possible parents.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        `true` if this node has an ACL, `false` otherwise

    - #### getPermissions

          Map<String,Set<String>> getPermissions(NodeCache cache)

      Gets the map of privileges by principal name which are in effect for this node. This will not look at any of the parent nodes.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        a `Map` which contains a set of permission names keyed by principal name or `null` if no privileges are in effect for this node(i.e. this node does not have an ACL). An empty `Map` means a node which has an ACL, but does not have any permissions.

    - #### isExternal

          boolean isExternal(NodeCache cache)

      Determine if this node belongs to an external source (via federation) or is local to the repository.
      Parameters:
        `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
      Returns:
        `true` if the node is local, `false` otherwise.

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.