org.hippoecm.hst.configuration.model
Class HstNodeImpl

java.lang.Object
  extended by org.hippoecm.hst.configuration.model.HstNodeImpl
All Implemented Interfaces:
HstNode
Direct Known Subclasses:
HstSiteConfigurationRootNodeImpl, HstSiteRootNodeImpl

public class HstNodeImpl
extends Object
implements HstNode

A HstNodeImpl is a node that during initialization fetches everything it needs, after which, it detaches its backing content provider. A HstNodeImpl is suitable for (event) caching.


Constructor Summary
HstNodeImpl(boolean inherited, HstNodeImpl node, HstNode parent)
          This is a copy constructor.
HstNodeImpl(HstNodeImpl node, HstNode parent)
          This is a copy constructor.
HstNodeImpl(javax.jcr.Node jcrNode, HstNode parent, boolean loadChilds)
           
 
Method Summary
 void addNode(String name, HstNode hstNode)
          add a child hstNode with name.
protected  HstNode createNew(javax.jcr.Node jcrNode, HstNode parent, boolean loadChilds)
           
 Map<String,HstNode> getChildren()
           
 HstNode getNode(String relPath)
           
 List<HstNode> getNodes()
           
 List<HstNode> getNodes(String configNodeTypeName)
           
 String getNodeTypeName()
           
 HstNode getParent()
           
 ValueProvider getValueProvider()
           
 boolean isInherited()
           
 boolean isStale()
           
protected  void loadChilds(javax.jcr.Node jcrNode, HstNode parent)
           
 void markStale()
          marks the HstNode as stale: The JCRValueProvider is out-of-date
 void removeNode(String name)
          removes child node with name and does nothing if not present
 void setJCRValueProvider(JCRValueProvider valueProvider)
          sets the new valueProvider
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HstNodeImpl

public HstNodeImpl(javax.jcr.Node jcrNode,
                   HstNode parent,
                   boolean loadChilds)
            throws HstNodeException
Throws:
HstNodeException

HstNodeImpl

public HstNodeImpl(HstNodeImpl node,
                   HstNode parent)
This is a copy constructor. A copy of node is created Note: This deep copy does NOT copy the parent field, as this constructor is used to copy descendant structures. Also it does not make a kind of clone of the JCRValueProvider: that one is still shared. It is something between a deep and shallow copy: The descendant are copied. Inherited is marked as false

Parameters:
node -

HstNodeImpl

public HstNodeImpl(boolean inherited,
                   HstNodeImpl node,
                   HstNode parent)
This is a copy constructor. A copy of node is created Note: This deep copy does NOT copy the parent field, as this constructor is used to copy descendant structures. Also it does not make a kind of clone of the JCRValueProvider: that one is still shared. It is something between a deep and shallow copy: The descendant are copied If inherited equals true, the HstNode's are marked as inherited.

Parameters:
node -
Method Detail

loadChilds

protected void loadChilds(javax.jcr.Node jcrNode,
                          HstNode parent)
                   throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

createNew

protected HstNode createNew(javax.jcr.Node jcrNode,
                            HstNode parent,
                            boolean loadChilds)
                     throws HstNodeException
Throws:
HstNodeException

getValueProvider

public ValueProvider getValueProvider()
Specified by:
getValueProvider in interface HstNode
Returns:
the value provider for this HstNode

getChildren

public Map<String,HstNode> getChildren()

getNode

public HstNode getNode(String relPath)
                throws IllegalArgumentException
Specified by:
getNode in interface HstNode
Parameters:
relPath - a path that does not start with a slash, for example 'foo' or 'foo/bar'
Returns:
the descendant node at relPath or null if it does not exist
Throws:
IllegalArgumentException - if relPath is not a valid relPath

addNode

public void addNode(String name,
                    HstNode hstNode)
Description copied from interface: HstNode
add a child hstNode with name. If there already exists an HstNode with name equal name, the existing HstNode is replaced. Since the HstNode's are used for the HST config model that does not support same name sibblings this is not a problem

Specified by:
addNode in interface HstNode

removeNode

public void removeNode(String name)
Description copied from interface: HstNode
removes child node with name and does nothing if not present

Specified by:
removeNode in interface HstNode

getNodes

public List<HstNode> getNodes()
Specified by:
getNodes in interface HstNode
Returns:
List<HstNode> of all the child nodes

getNodes

public List<HstNode> getNodes(String configNodeTypeName)
Specified by:
getNodes in interface HstNode
Returns:
List<HstNode> of all the child nodes with HstNode.getNodeTypeName() equals to nodeTypeName

getNodeTypeName

public String getNodeTypeName()
Specified by:
getNodeTypeName in interface HstNode
Returns:
the node type of the backing provider

getParent

public HstNode getParent()
Specified by:
getParent in interface HstNode
Returns:
the parent of this HstNode or null when there is no parent.

markStale

public void markStale()
Description copied from interface: HstNode
marks the HstNode as stale: The JCRValueProvider is out-of-date

Specified by:
markStale in interface HstNode

isStale

public boolean isStale()
Specified by:
isStale in interface HstNode
Returns:
true when this HstNode is stale

isInherited

public boolean isInherited()
Specified by:
isInherited in interface HstNode
Returns:
true when this HstNode is inherited

setJCRValueProvider

public void setJCRValueProvider(JCRValueProvider valueProvider)
Description copied from interface: HstNode
sets the new valueProvider

Specified by:
setJCRValueProvider in interface HstNode

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2012 Hippo. All Rights Reserved.