jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: NodeDefinition on Node ? what is expected
Date Thu, 22 Oct 2009 09:41:53 GMT
On Thu, Oct 22, 2009 at 10:11, sorel <johann.sorel@geomatys.fr> wrote:
> hello,
> I have been wondering for some time what is expected to be seen when we call
> getDefinition on a Node.
> The JCR definition is pretty minimal :
> "A node definition. Used in node type definitions."
> On the Node interface "getDefinition" we have :
> "Returns the node definition that applies to this node. In some cases there
> may appear to be more than one definition that could apply to this node.
> However, it is assumed that upon creation of this node, a single particular
> definition was used and it is /that/ definition that this method returns.
> How this governing definition is selected upon node creation from among
> others which may have been applicable is an implementation issue and is not
> covered by this specification. The |NodeDefinition| returned when this
> method is called on the root node of a workspace is also up to the
> implementation. "
> What I don't understand is that the node definition holds information for
> the children nodes and the parent node, but not the current node.
> The Javadoc is in contradiction since we create nodes by giving a NodeType :
> addNode(String relPath,String primaryNodeTypeName)
> So what Is expected in the NodeDefinition of a Node ?

A node type can define child nodes and properties, and these are
called node and property definitions. For existing nodes, you can get
the actually applied (child) node definition via node.getDefinition()
(comes from the parent's node type) and for properties, you get it via

See also sections 6.7.6 and 6.7.7 of the JCR 1.0 spec [1] and [2].

You can also get the definitions directly from a node type via
NodeType.getPropertyDefinitions(), NodeType.getChildNodeDefinitions()
and NodeType.getDeclaredChildNodeDefinitions() [3]. A NodeType can be
looked up by its name via

[1] http://www.day.com/specs/jcr/1.0/6.7.6_Property_Definitions.html
[2] http://www.day.com/specs/jcr/1.0/6.7.7_Child_Node_Definitions.html
[3] http://www.day.com/specs/jcr/1.0/6.7.11_Discovering_the_Definition_of_a_Node_Type.html


Alexander Klimetschek

View raw message