info.magnolia.jcr.wrapper
Class ExtendingNodeWrapper

java.lang.Object
  extended by info.magnolia.jcr.wrapper.DelegateNodeWrapper
      extended by info.magnolia.jcr.wrapper.ChildWrappingNodeWrapper
          extended by info.magnolia.jcr.wrapper.ExtendingNodeWrapper
All Implemented Interfaces:
NodeWrapperFactory, Cloneable, javax.jcr.Item, javax.jcr.Node

public class ExtendingNodeWrapper
extends ChildWrappingNodeWrapper

This wrapper allows extending other nodes (mainly useful to extend configurations). A node can define a property with the name 'extends'. Its value is either an absolute or relative path. The merge is then performed as follows:

The mechanism supports multiple inheritances as such:

See Also:
InheritanceNodeWrapper} a class supporting content inheritance.

Field Summary
protected static String EXTENDING_NODE_PROPERTY
           
protected static String EXTENDING_NODE_PROPERTY_OVERRIDE
           
 
Fields inherited from class info.magnolia.jcr.wrapper.DelegateNodeWrapper
wrapped
 
Fields inherited from interface javax.jcr.Node
JCR_CHILD_NODE_DEFINITION, JCR_CONTENT, JCR_FROZEN_NODE, JCR_PROPERTY_DEFINITION, JCR_ROOT_VERSION, JCR_VERSION_LABELS
 
Constructor Summary
  ExtendingNodeWrapper(javax.jcr.Node wrappedNode)
          Default constructor.
  ExtendingNodeWrapper(javax.jcr.Node wrappedNode, boolean failOnError)
          Call directly for test purposes only.
protected ExtendingNodeWrapper(javax.jcr.Node wrappedNode, javax.jcr.Node extendedNode)
          Does not support the extends property but chains the two nodes directly.
 
Method Summary
 javax.jcr.Node getNode(String relPath)
           
 javax.jcr.NodeIterator getNodes()
           
 javax.jcr.NodeIterator getNodes(String namePattern)
           
 javax.jcr.NodeIterator getNodes(String[] nameGlobs)
           
 javax.jcr.PropertyIterator getProperties()
           
 javax.jcr.PropertyIterator getProperties(String namePattern)
           
 javax.jcr.PropertyIterator getProperties(String[] nameGlobs)
           
 javax.jcr.Property getProperty(String relPath)
           
 javax.jcr.Node getWrappedNode()
           
 boolean hasNode(String relPath)
           
 boolean hasProperty(String relPath)
           
 boolean isExtending()
          Check if node extends another.
 void setWrappedNode(javax.jcr.Node node)
           
 javax.jcr.Node wrapNode(javax.jcr.Node node)
           
 
Methods inherited from class info.magnolia.jcr.wrapper.ChildWrappingNodeWrapper
addNode, addNode, wrapNodeIterator
 
Methods inherited from class info.magnolia.jcr.wrapper.DelegateNodeWrapper
accept, addMixin, canAddMixin, cancelMerge, checkin, checkout, clone, deepUnwrap, doneMerge, followLifecycleTransition, getAllowedLifecycleTransistions, getAncestor, getBaseVersion, getCorrespondingNodePath, getDefinition, getDepth, getIdentifier, getIndex, getLock, getMixinNodeTypes, getName, getParent, getPath, getPrimaryItem, getPrimaryNodeType, getReferences, getReferences, getSession, getSharedSet, getUUID, getVersionHistory, getWeakReferences, getWeakReferences, hasNodes, hasProperties, holdsLock, initClone, isCheckedOut, isLocked, isModified, isNew, isNode, isNodeType, isSame, lock, merge, orderBefore, refresh, remove, removeMixin, removeShare, removeSharedSet, restore, restore, restore, restoreByLabel, save, setPrimaryType, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, toString, unlock, update
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXTENDING_NODE_PROPERTY

protected static final String EXTENDING_NODE_PROPERTY
See Also:
Constant Field Values

EXTENDING_NODE_PROPERTY_OVERRIDE

protected static final String EXTENDING_NODE_PROPERTY_OVERRIDE
See Also:
Constant Field Values
Constructor Detail

ExtendingNodeWrapper

public ExtendingNodeWrapper(javax.jcr.Node wrappedNode)
Default constructor.


ExtendingNodeWrapper

public ExtendingNodeWrapper(javax.jcr.Node wrappedNode,
                            boolean failOnError)
Call directly for test purposes only.


ExtendingNodeWrapper

protected ExtendingNodeWrapper(javax.jcr.Node wrappedNode,
                               javax.jcr.Node extendedNode)
Does not support the extends property but chains the two nodes directly. Each node is wrapped internally to ensure that each of them support the extends property for themselves.

Method Detail

hasNode

public boolean hasNode(String relPath)
                throws javax.jcr.RepositoryException
Specified by:
hasNode in interface javax.jcr.Node
Overrides:
hasNode in class DelegateNodeWrapper
Throws:
javax.jcr.RepositoryException

getNode

public javax.jcr.Node getNode(String relPath)
                       throws javax.jcr.PathNotFoundException,
                              javax.jcr.RepositoryException
Specified by:
getNode in interface javax.jcr.Node
Overrides:
getNode in class ChildWrappingNodeWrapper
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

getNodes

public javax.jcr.NodeIterator getNodes()
                                throws javax.jcr.RepositoryException
Specified by:
getNodes in interface javax.jcr.Node
Overrides:
getNodes in class ChildWrappingNodeWrapper
Throws:
javax.jcr.RepositoryException

getNodes

public javax.jcr.NodeIterator getNodes(String[] nameGlobs)
                                throws javax.jcr.RepositoryException
Specified by:
getNodes in interface javax.jcr.Node
Overrides:
getNodes in class ChildWrappingNodeWrapper
Throws:
javax.jcr.RepositoryException

getNodes

public javax.jcr.NodeIterator getNodes(String namePattern)
                                throws javax.jcr.RepositoryException
Specified by:
getNodes in interface javax.jcr.Node
Overrides:
getNodes in class ChildWrappingNodeWrapper
Throws:
javax.jcr.RepositoryException

hasProperty

public boolean hasProperty(String relPath)
                    throws javax.jcr.RepositoryException
Specified by:
hasProperty in interface javax.jcr.Node
Overrides:
hasProperty in class DelegateNodeWrapper
Throws:
javax.jcr.RepositoryException

getProperty

public javax.jcr.Property getProperty(String relPath)
                               throws javax.jcr.PathNotFoundException,
                                      javax.jcr.RepositoryException
Specified by:
getProperty in interface javax.jcr.Node
Overrides:
getProperty in class DelegateNodeWrapper
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

getProperties

public javax.jcr.PropertyIterator getProperties()
                                         throws javax.jcr.RepositoryException
Specified by:
getProperties in interface javax.jcr.Node
Overrides:
getProperties in class DelegateNodeWrapper
Throws:
javax.jcr.RepositoryException

getProperties

public javax.jcr.PropertyIterator getProperties(String[] nameGlobs)
                                         throws javax.jcr.RepositoryException
Specified by:
getProperties in interface javax.jcr.Node
Overrides:
getProperties in class DelegateNodeWrapper
Throws:
javax.jcr.RepositoryException

getProperties

public javax.jcr.PropertyIterator getProperties(String namePattern)
                                         throws javax.jcr.RepositoryException
Specified by:
getProperties in interface javax.jcr.Node
Overrides:
getProperties in class DelegateNodeWrapper
Throws:
javax.jcr.RepositoryException

wrapNode

public javax.jcr.Node wrapNode(javax.jcr.Node node)
Specified by:
wrapNode in interface NodeWrapperFactory
Overrides:
wrapNode in class ChildWrappingNodeWrapper

getWrappedNode

public javax.jcr.Node getWrappedNode()
Overrides:
getWrappedNode in class DelegateNodeWrapper

setWrappedNode

public void setWrappedNode(javax.jcr.Node node)
Overrides:
setWrappedNode in class DelegateNodeWrapper

isExtending

public boolean isExtending()
Check if node extends another.



Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.