[ 
http://issues.apache.org/jira/browse/GRFT-23?page=comments#action_12313369 ] 

Sandro Boehme commented on GRFT-23:
-----------------------------------

Beside others, there a two dependencies when registering a
node type in Jackrabbit:
o Supertypes must exist and be registered
and 
o Default node type in child-node definitions must exist and be registered

I will call those conditions just "dependencies" now.

++ resolving the dependency tree ++
This creates a tree of dependencies. Because you need to register the dependent 
node types one after another before the current node type can be registered 
completely. You can recursively step down the tree until there are no 
dependencies anymore. Then you can completely register the last node type. This 
solves a dependency of the parent node type
you came from. 
In this situation you can step up to the parent node type. 
All other dependencies of that node type and the other parent node types can be 
resolved the same way: Step down until it can be registered and step up and 
register if all dependencies are solved.

++ resolving circular dependencies ++
A dependent node type can be of the same node type like the current node type. 
E.g. if you currently want to register a node type "folder" which has a child 
node
"first child folder" and this child node has the default node type "folder".
This turns the tree of dependencies in a graph and creates a circular 
dependency. The reason is, as you try to register the node type "folder", the 
dependency (child node's default node type "folder") already needs to be 
registered.

Of course the circular dependency can also occur from a dependency further down 
the tree:
The described registration procedure can create a path of node types to 
register. Because you need to step
deeper to the next branch when dependencies need to be resolved. In this 
process you can hit three types
of node types:
a) node types which are completely registered
b) node types whose dependencies are partially solved (one in the currently 
processed path of node types)
c) not touched node types
In the case you hit type a) this would resolve a dependency.
In the case you hit type c) this would mean you need to resolve the not touched 
node type.
In the case you hit type b) you have a graph of node types and a circular 
dependency.

The solution is pretty simple. When you want to register the node type you can 
first register it without any dependencies. If you then are in the 
"c)"-Situation you have a node type which is registered and because of this, it 
is not a dependency anymore. If all dependencies of a nodetype are solved you 
can reregister the node type completely with all dependencies.

> node type registration component
> --------------------------------
>
>          Key: GRFT-23
>          URL: http://issues.apache.org/jira/browse/GRFT-23
>      Project: Graffito
>         Type: New Feature
>   Components: JCR-Mapping
>     Reporter: Sandro Boehme
>     Assignee: Sandro Boehme

>
> It registers the node types of the mapping model.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to