-
Notifications
You must be signed in to change notification settings - Fork 1
Node Types
Definition of what node types can define about nodes.
/:nodetypes/...
- // NOT YET super node types
- properties
- name
- type of the property (boolean, long, double, string, name-path reference?)
- required (t/f)
- index (t/f)
- // NOT YET: unique?
- allow additional properties (t/f) ?
- allowed child node types
(all names of core node types are prefixed with com.dc2f.dstore.)
- / (nodetype = RootNode)
- XXX (nodetype = NodeTypesFolder) (beinhaltet die core oder alle node typen)
- Node (nodetype = NodeType)
- properties: (are child nodes of type NodeTypeProperty)
- nodetype (type = string (reference to /:nodetypes/[name=xxx] ?))
- properties: (are child nodes of type NodeTypeProperty)
- NodeType (nodetype = NodeType)
- properties:
- name (type = string, required = true)
- required (type = boolean)
- properties:
- Node (nodetype = NodeType)
- XXX (nodetype = NodeTypesFolder) (beinhaltet die core oder alle node typen)
-
/:nodetypes/com.dc2f.blog.BlogEntry
- properties: title (type = string), body (type = string), slug (index = true)
-
properties:
- nodetype: com.dc2f.blog.BlogEntry
- title: My great blog entry
- body: blah blah
IMHO (HP) we should implement the 'nodetype' property just like any other node reference! and every node type definition is simply a normal node of type 'node type definition', no matter if it is below /:nodetypes/ or not. - we have to implement referential integrity anyway, so it makes sense that the 'nodetype' property is not some special case, but just another reference to a node of type (com.dc2f.nodetype.NodeTypeDefinition)
We need a way to allow two things: 1.) allow all node types and 2.) don't allow children.. there are a few possibilities
- null = no restriction (all node types can be added), empty collection = no children
- 'null' must not be returned, empty collection = no children allowed, [ (Base)NodeType ] allows all node types
i think i prefer not to return null under any circumstances and allow some kind of pseudo-inheritance were all node types at least extend from one (Base)NodeType.
should there be default values for properties? for example required / indexed for a node type definition - if it was never set, does this mean it is not defined wether it should be required or indexed, or do we assume that it is not required / indexed..
and if we have default values: do we store default values as "normal" values, or do we store null and fill in the default values when getting the properties?
imo we need a extension system asap for node types.. i have now implemented WorkingTreeNode.getChildrenByNodeType(String nodeType) which simply does a .equals() check for node types, but it would make more sense to actually check the type hierarchie if it matches to allow customizations of the types
- single inheritance vs. multi inheritance
- inheritance vs. composition
- should one node instance have one node type, or multiple?
- how to overwrite allowed children node types?
- maybe it makes sense to have a 'permitted child node types' and 'forbidden child node types' which either add or subtract from the allowed child node types, instead of completely overwriting it?