ModeShape Distribution 3.0.0.Alpha4

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
static class CachedNode.ReferenceType
           
 
Method Summary
 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.
 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.
 Path getPath(NodeCache cache)
          Get the path to 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.
 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 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.
 

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
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
See Also:
getName(NodeCache), getPath(NodeCache)

getPath

Path getPath(NodeCache cache)
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
See Also:
getName(NodeCache), getSegment(NodeCache)

getParentKey

NodeKey getParentKey(NodeCache cache)
Get the node key for this node's primary parent.

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

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

ModeShape Distribution 3.0.0.Alpha4

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