org.jboss.dna.jcr
Interface JcrNodeTypeSource

All Known Implementing Classes:
CndNodeTypeSource

public interface JcrNodeTypeSource

Interface for any potential provider of JcrNodeType definitions, the DNA implementation of NodeType. Possible sources of node type definitions include CND files, repository metadata, and mock types for testing.

See Also:
JcrWorkspace.getNodeTypeManager()

Method Summary
 Graph getNodeTypes()
          Returns the node type information to be registered in graph form.
 

Method Detail

getNodeTypes

Graph getNodeTypes()
Returns the node type information to be registered in graph form. The graph has a very specific required format.

The root node of the graph should have zero or more children. Each child of the root node represents a type to be registered and the name of the node should be the name of the node type to be registered. Additionally, any facets of the node type that are specified should be set in a manner consistent with the JCR specification for the nt:nodeType built-in node type. The jcr:primaryType property does not need to be set on these nodes, but the nodes must be semantically valid as if the jcr:primaryType property was set.

Each node type node may have zero or more children, each with the name jcr:propertyDefinition or jcr:childNodeDefinition, as per the definition of the nt:nodeType built-in type. Each property definition and child node definition must obey the semantics of jcr:propertyDefinition and jcr:childNodeDefinition respectively However these nodes also do not need to have the jcr:primaryType property set.

For example, one valid graph is:

 <root>
 +---- test:testMixinType
        +--- jcr:nodeTypeName               =  test:testMixinType  (PROPERTY)
        +--- jcr:isMixin                    =  true                (PROPERTY)    
        +--- jcr:childNodeDefinition                               (CHILD NODE)
        |     +--- jcr:name                 =  test:childNodeA     (PROPERTY)
        |     +--- jcr:mandatory            =  true                (PROPERTY)
        |     +--- jcr:autoCreated          =  true                (PROPERTY)
        |     +--- jcr:defaultPrimaryType   =  nt:base             (PROPERTY)
        |     +--- jcr:requiredPrimaryTypes =  nt:base             (PROPERTY)
        +--- jcr:propertyDefinition                                (CHILD NODE)
              +--- jcr:name                 =  test:propertyA      (PROPERTY)
              +--- jcr:multiple             =  true                (PROPERTY)
              +--- jcr:requiredType         =  String              (PROPERTY)
 
This graph (when registered) would create a mixin node named "test:testMixinType" with a mandatory, autocreated child node named "test:childNodeA" with a default and required primary type of "nt:base" and a multi-valued string property named "test:propertyA".

Returns:
a graph with the semantics noted above


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