jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: rev 47157 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype
Date Fri, 24 Sep 2004 13:42:03 GMT
Author: stefan
Date: Fri Sep 24 06:42:02 2004
New Revision: 47157

Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/EffectiveNodeType.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/NodeTypeDefStore.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/NodeTypeRegistry.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/PropDef.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/PropertyDefImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/builtin_nodetypes.xml
Log:
fixing/changing xml representation of node type definitions

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/EffectiveNodeType.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/EffectiveNodeType.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/EffectiveNodeType.java	Fri Sep 24 06:42:02 2004
@@ -347,14 +347,16 @@
 	    throw new ConstraintViolationException("the property is not multi-valued");
 	}
 
-	// check value constraint
-	ValueConstraint constraint = pd.getValueConstraint();
-	if (constraint != null) {
-	    if (values == null || values.length == 0) {
-		constraint.check(null);
-	    } else {
-		for (int i = 0; i < values.length; i++) {
-		    constraint.check(values[i]);
+	// check value constraints
+	ValueConstraint[] constraints = pd.getValueConstraints();
+	if (constraints != null && constraints.length != 0) {
+	    for (int i = 0; i < constraints.length; i++) {
+		if (values == null || values.length == 0) {
+		    constraints[i].check(null);
+		} else {
+		    for (int j = 0; j < values.length; j++) {
+			constraints[i].check(values[j]);
+		    }
 		}
 	    }
 	}

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/NodeTypeDefStore.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/NodeTypeDefStore.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/NodeTypeDefStore.java	Fri Sep 24 06:42:02 2004
@@ -21,8 +21,11 @@
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jdom.Namespace;
+import org.jdom.filter.Filter;
+import org.jdom.filter.ContentFilter;
 import org.jdom.input.SAXBuilder;
 import org.jdom.output.XMLOutputter;
+import org.jdom.output.Format;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.PropertyType;
@@ -42,16 +45,19 @@
 class NodeTypeDefStore {
     private static Logger log = Logger.getLogger(NodeTypeDefStore.class);
 
-    private static final String ROOT_ELEMENT_NAME = "nodeTypes";
-    private static final String NODETYPE_ELEMENT_NAME = "nodeType";
+    private static final String ROOT_ELEMENT = "nodeTypes";
+    private static final String NODETYPE_ELEMENT = "nodeType";
     private static final String NAME_ATTRIBUTE = "name";
     private static final String MIXIN_ATTRIBUTE = "mixin";
     private static final String ORDERABLECHILDNODES_ATTRIBUTE = "orderableChildNodes";
-    private static final String SUPERTYPES_ATTRIBUTE = "supertypes";
-    private static final String PROPERTYDEF_ELEMENT_NAME = "propertyDef";
+    private static final String SUPERTYPES_ELEMENT = "supertypes";
+    private static final String SUPERTYPE_ELEMENT = "supertype";
+    private static final String PROPERTYDEF_ELEMENT = "propertyDef";
     private static final String TYPE_ATTRIBUTE = "type";
-    private static final String VALUECONSTRAINT_ATTRIBUTE = "valueConstraint";
-    private static final String DEFAULTVALUES_ATTRIBUTE = "defaultValues";
+    private static final String VALUECONSTRAINTS_ELEMENT = "valueConstraints";
+    private static final String VALUECONSTRAINT_ELEMENT = "valueConstraint";
+    private static final String DEFAULTVALUES_ELEMENT = "defaultValues";
+    private static final String DEFAULTVALUE_ELEMENT = "defaultValue";
     private static final String AUTOCREATE_ATTRIBUTE = "autoCreate";
     private static final String MANDATORY_ATTRIBUTE = "mandatory";
     private static final String PROTECTED_ATTRIBUTE = "protected";
@@ -59,8 +65,9 @@
     private static final String MULTIPLE_ATTRIBUTE = "multiple";
     private static final String SAMENAMESIBS_ATTRIBUTE = "sameNameSibs";
     private static final String ONPARENTVERSION_ATTRIBUTE = "onParentVersion";
-    private static final String CHILDNODEDEF_ELEMENT_NAME = "childNodeDef";
-    private static final String REQUIREDPRIMARYTYPES_ATTRIBUTE = "requiredPrimaryTypes";
+    private static final String CHILDNODEDEF_ELEMENT = "childNodeDef";
+    private static final String REQUIREDPRIMARYTYPES_ELEMENT = "requiredPrimaryTypes";
+    private static final String REQUIREDPRIMARYTYPE_ELEMENT = "requiredPrimaryType";
     private static final String DEFAULTPRIMARYTYPE_ATTRIBUTE = "defaultPrimaryType";
 
     // map of node type names and node type definitions
@@ -87,9 +94,9 @@
 	    Document doc = builder.build(in);
 	    root = doc.getRootElement();
 	} catch (JDOMException jde) {
-	    String error = "internal error: failed to parse persistent node type definitions";
-	    log.error(error);
-	    throw new RepositoryException(error);
+	    String msg = "internal error: failed to parse persistent node type definitions";
+	    log.error(msg, jde);
+	    throw new RepositoryException(msg, jde);
 	}
 	// read namespace declarations of root element
 	Iterator nsIter = root.getAdditionalNamespaces().iterator();
@@ -121,7 +128,7 @@
 	};
 
 	// read definitions
-	Iterator iter = root.getChildren(NODETYPE_ELEMENT_NAME).iterator();
+	Iterator iter = root.getChildren(NODETYPE_ELEMENT).iterator();
 	while (iter.hasNext()) {
 	    NodeTypeDef ntDef = readDef((Element) iter.next(), nsResolver);
 	    add(ntDef);
@@ -136,7 +143,7 @@
      */
     void store(OutputStream out, NamespaceRegistryImpl nsReg)
 	    throws IOException, RepositoryException {
-	Element root = new Element(ROOT_ELEMENT_NAME);
+	Element root = new Element(ROOT_ELEMENT);
 
 	// namespace declarations
 	String[] prefixes = nsReg.getPrefixes();
@@ -153,12 +160,12 @@
 	Iterator iter = all().iterator();
 	while (iter.hasNext()) {
 	    NodeTypeDef ntd = (NodeTypeDef) iter.next();
-	    Element ntElem = new Element(NODETYPE_ELEMENT_NAME);
+	    Element ntElem = new Element(NODETYPE_ELEMENT);
 	    writeDef(ntd, ntElem, nsReg);
 	    root.addContent(ntElem);
 	}
 
-	XMLOutputter serializer = new XMLOutputter("\t", true);
+	XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());
 	serializer.output(new Document(root), out);
     }
 
@@ -212,36 +219,49 @@
 	    throws InvalidNodeTypeDefException {
 	String sntName = ntElem.getAttributeValue(NAME_ATTRIBUTE);
 	NodeTypeDef ntDef = new NodeTypeDef();
+
 	// name
 	QName qntName;
 	try {
 	    qntName = QName.fromJCRName(sntName, nsResolver);
 	} catch (BaseException e) {
-	    throw new InvalidNodeTypeDefException("invalid node type name:" + sntName, e);
+	    String msg = "invalid serialized node type definition [" + sntName + "]: invalid node type name: " + sntName;
+	    log.error(msg, e);
+	    throw new InvalidNodeTypeDefException(msg, e);
 	}
 	ntDef.setName(qntName);
 
 	// supertypes
-	String supertypes = ntElem.getAttributeValue(SUPERTYPES_ATTRIBUTE);
-	if (supertypes != null && supertypes.length() > 0) {
-	    String[] sta = supertypes.split(",\\s*");
-	    QName[] qNames = new QName[sta.length];
-	    for (int i = 0; i < sta.length; i++) {
-		try {
-		    qNames[i] = QName.fromJCRName(sta[i], nsResolver);
-		} catch (BaseException e) {
-		    throw new InvalidNodeTypeDefException("invalid supertype name:" + sta[i], e);
+	ArrayList list = new ArrayList();
+	Element typesElem = ntElem.getChild(SUPERTYPES_ELEMENT);
+	if (typesElem != null) {
+	    Iterator iter = typesElem.getChildren(SUPERTYPE_ELEMENT).iterator();
+	    while (iter.hasNext()) {
+		Element typeElem = (Element) iter.next();
+		Filter filter = new ContentFilter(ContentFilter.TEXT | ContentFilter.CDATA);
+		List content = typeElem.getContent(filter);
+		if (!content.isEmpty()) {
+		    String name = typeElem.getTextTrim();
+		    try {
+			list.add(QName.fromJCRName(name, nsResolver));
+		    } catch (BaseException e) {
+			String msg = "invalid serialized node type definition [" + sntName + "]: invalid supertype: " + name;
+			log.error(msg, e);
+			throw new InvalidNodeTypeDefException(msg, e);
+		    }
 		}
 	    }
-	    if (sta.length > 0) {
-		ntDef.setSupertypes(qNames);
+	    if (!list.isEmpty()) {
+		ntDef.setSupertypes((QName[]) list.toArray(new QName[list.size()]));
 	    }
 	}
+
 	// mixin
 	String mixin = ntElem.getAttributeValue(MIXIN_ATTRIBUTE);
 	if (mixin != null && mixin.length() > 0) {
 	    ntDef.setMixin(Boolean.valueOf(mixin).booleanValue());
 	}
+
 	// orderableChildNodes
 	String orderableChildNodes = ntElem.getAttributeValue(ORDERABLECHILDNODES_ATTRIBUTE);
 	if (orderableChildNodes != null && orderableChildNodes.length() > 0) {
@@ -249,8 +269,8 @@
 	}
 
 	// property definitions
-	ArrayList list = new ArrayList();
-	Iterator iter = ntElem.getChildren(PROPERTYDEF_ELEMENT_NAME).iterator();
+	list.clear();
+	Iterator iter = ntElem.getChildren(PROPERTYDEF_ELEMENT).iterator();
 	while (iter.hasNext()) {
 	    Element elem = (Element) iter.next();
 	    PropDef pd = new PropDef();
@@ -262,7 +282,9 @@
 		try {
 		    pd.setName(QName.fromJCRName(propName, nsResolver));
 		} catch (BaseException e) {
-		    throw new InvalidNodeTypeDefException("invalid property name:" + propName, e);
+		    String msg = "invalid serialized node type definition [" + sntName + "]: invalid property name: " + propName;
+		    log.error(msg, e);
+		    throw new InvalidNodeTypeDefException(msg, e);
 		}
 	    }
 	    // type
@@ -273,34 +295,58 @@
 		    type = PropertyType.valueFromName(typeName);
 		    pd.setRequiredType(type);
 		} catch (IllegalArgumentException e) {
-		    String error = "invalid serialized node type definition: invalid type " + typeName;
-		    log.error(error);
-		    throw new InvalidNodeTypeDefException(error);
+		    String msg = "invalid serialized node type definition [" + sntName + "]: invalid type: " + typeName;
+		    log.error(msg, e);
+		    throw new InvalidNodeTypeDefException(msg, e);
+		}
+	    }
+	    // valueConstraints
+	    Element constraintsElem = elem.getChild(VALUECONSTRAINTS_ELEMENT);
+	    if (constraintsElem != null) {
+		ArrayList list1 = new ArrayList();
+		Iterator iter1 = constraintsElem.getChildren(VALUECONSTRAINT_ELEMENT).iterator();
+		while (iter1.hasNext()) {
+		    Element constraintElem = (Element) iter1.next();
+		    Filter filter = new ContentFilter(ContentFilter.TEXT | ContentFilter.CDATA);
+		    List content = constraintElem.getContent(filter);
+		    if (!content.isEmpty()) {
+			String constraint = constraintElem.getTextTrim();
+			try {
+			    list1.add(ValueConstraint.create(type, constraint));
+			} catch (InvalidConstraintException e) {
+			    String msg = "invalid serialized node type definition [" + sntName + "]: invalid constraint: " + constraint;
+			    log.error(msg, e);
+			    throw new InvalidNodeTypeDefException(msg, e);
+			}
+		    }
 		}
-	    }
-	    // valueConstraint
-	    String valueConstraint = elem.getAttributeValue(VALUECONSTRAINT_ATTRIBUTE);
-	    if (valueConstraint != null && valueConstraint.length() > 0) {
-		try {
-		    pd.setValueConstraint(ValueConstraint.create(type, valueConstraint));
-		} catch (InvalidConstraintException e) {
-		    String error = "invalid serialized node type definition: invalid constraint " + valueConstraint;
-		    log.error(error, e);
-		    throw new InvalidNodeTypeDefException(error, e);
+		if (!list1.isEmpty()) {
+		    pd.setValueConstraints((ValueConstraint[]) list1.toArray(new ValueConstraint[list1.size()]));
 		}
 	    }
 	    // defaultValues
-	    // @todo provide escaping for separator character within single value or change xml representation for defaultValues
-	    String defaultValues = elem.getAttributeValue(DEFAULTVALUES_ATTRIBUTE);
-	    if (defaultValues != null && defaultValues.length() > 0) {
+	    Element defValuesElem = elem.getChild(DEFAULTVALUES_ELEMENT);
+	    if (defValuesElem != null) {
 		int defValType = (type == PropertyType.UNDEFINED) ? PropertyType.STRING : type;
-		String[] dva = defaultValues.split(",\\s*");
-		InternalValue[] defVals = new InternalValue[dva.length];
-		for (int i = 0; i < dva.length; i++) {
-		    defVals[i] = InternalValue.valueOf(dva[i], defValType);
+		ArrayList list1 = new ArrayList();
+		Iterator iter1 = defValuesElem.getChildren(DEFAULTVALUE_ELEMENT).iterator();
+		while (iter1.hasNext()) {
+		    Element valueElem = (Element) iter1.next();
+		    Filter filter = new ContentFilter(ContentFilter.TEXT | ContentFilter.CDATA);
+		    List content = valueElem.getContent(filter);
+		    if (!content.isEmpty()) {
+			String defValue = valueElem.getTextTrim();
+			try {
+			    list1.add(InternalValue.valueOf(defValue, defValType));
+			} catch (IllegalArgumentException e) {
+			    String msg = "invalid serialized node type definition [" + sntName + "]: invalid defaultValue: " + defValue;
+			    log.error(msg, e);
+			    throw new InvalidNodeTypeDefException(msg, e);
+			}
+		    }
 		}
-		if (defVals.length > 0) {
-		    pd.setDefaultValues(defVals);
+		if (!list1.isEmpty()) {
+		    pd.setDefaultValues((InternalValue[]) list1.toArray(new InternalValue[list1.size()]));
 		}
 	    }
 	    // autoCreate
@@ -319,9 +365,9 @@
 		try {
 		    pd.setOnParentVersion(OnParentVersionAction.valueFromName(onVersion));
 		} catch (IllegalArgumentException e) {
-		    String error = "invalid serialized node type definition: invalid onVersion " + onVersion;
-		    log.error(error);
-		    throw new InvalidNodeTypeDefException(error);
+		    String msg = "invalid serialized node type definition [" + sntName + "]: invalid onVersion: " + onVersion;
+		    log.error(msg, e);
+		    throw new InvalidNodeTypeDefException(msg, e);
 		}
 	    }
 	    // protected
@@ -348,7 +394,7 @@
 
 	// child-node definitions
 	list.clear();
-	iter = ntElem.getChildren(CHILDNODEDEF_ELEMENT_NAME).iterator();
+	iter = ntElem.getChildren(CHILDNODEDEF_ELEMENT).iterator();
 	while (iter.hasNext()) {
 	    Element elem = (Element) iter.next();
 	    ChildNodeDef cnd = new ChildNodeDef();
@@ -360,23 +406,33 @@
 		try {
 		    cnd.setName(QName.fromJCRName(nodeName, nsResolver));
 		} catch (BaseException e) {
-		    throw new InvalidNodeTypeDefException("invalid child node name:" + nodeName, e);
+		    String msg = "invalid serialized node type definition [" + sntName + "]: invalid child node name: " + nodeName;
+		    log.error(msg, e);
+		    throw new InvalidNodeTypeDefException(msg, e);
 		}
 	    }
 	    // requiredPrimaryTypes
-	    String requiredPrimaryTypes = elem.getAttributeValue(REQUIREDPRIMARYTYPES_ATTRIBUTE);
-	    if (requiredPrimaryTypes != null && requiredPrimaryTypes.length() > 0) {
-		String[] sta = requiredPrimaryTypes.split(",\\s*");
-		QName[] qNames = new QName[sta.length];
-		for (int i = 0; i < sta.length; i++) {
-		    try {
-			qNames[i] = QName.fromJCRName(sta[i], nsResolver);
-		    } catch (BaseException e) {
-			throw new InvalidNodeTypeDefException("invalid requiredPrimaryType:" + sta[i], e);
+	    Element reqTtypesElem = elem.getChild(REQUIREDPRIMARYTYPES_ELEMENT);
+	    if (reqTtypesElem != null) {
+		ArrayList list1 = new ArrayList();
+		Iterator iter1 = reqTtypesElem.getChildren(REQUIREDPRIMARYTYPE_ELEMENT).iterator();
+		while (iter1.hasNext()) {
+		    Element typeElem = (Element) iter1.next();
+		    Filter filter = new ContentFilter(ContentFilter.TEXT | ContentFilter.CDATA);
+		    List content = typeElem.getContent(filter);
+		    if (!content.isEmpty()) {
+			String name = typeElem.getTextTrim();
+			try {
+			    list1.add(QName.fromJCRName(name, nsResolver));
+			} catch (BaseException e) {
+			    String msg = "invalid serialized node type definition [" + sntName + "]: invalid requiredPrimaryType: " + name;
+			    log.error(msg, e);
+			    throw new InvalidNodeTypeDefException(msg, e);
+			}
 		    }
 		}
-		if (sta.length > 0) {
-		    cnd.setRequiredPrimaryTypes(qNames);
+		if (!list1.isEmpty()) {
+		    cnd.setRequiredPrimaryTypes((QName[]) list1.toArray(new QName[list1.size()]));
 		}
 	    }
 	    // defaultPrimaryType
@@ -385,7 +441,9 @@
 		try {
 		    cnd.setDefaultPrimaryType(QName.fromJCRName(defaultPrimaryType, nsResolver));
 		} catch (BaseException e) {
-		    throw new InvalidNodeTypeDefException("invalid defaultPrimaryType:" + defaultPrimaryType, e);
+		    String msg = "invalid serialized node type definition [" + sntName + "]: invalid defaultPrimaryType: " + defaultPrimaryType;
+		    log.error(msg, e);
+		    throw new InvalidNodeTypeDefException(msg, e);
 		}
 	    }
 	    // autoCreate
@@ -404,9 +462,9 @@
 		try {
 		    cnd.setOnParentVersion(OnParentVersionAction.valueFromName(onVersion));
 		} catch (IllegalArgumentException e) {
-		    String error = "invalid serialized node type definition: invalid onVersion " + onVersion;
-		    log.error(error);
-		    throw new InvalidNodeTypeDefException(error);
+		    String msg = "invalid serialized node type definition [" + sntName + "]: invalid onVersion: " + onVersion;
+		    log.error(msg, e);
+		    throw new InvalidNodeTypeDefException(msg, e);
 		}
 	    }
 	    // protected
@@ -439,18 +497,22 @@
 	try {
 	    // name
 	    ntElem.setAttribute(NAME_ATTRIBUTE, ntd.getName().toJCRName(nsResolver));
+
 	    // supertypes
-	    StringBuffer supertypes = new StringBuffer();
 	    QName[] qNames = ntd.getSupertypes();
-	    for (int i = 0; i < qNames.length; i++) {
-		if (supertypes.length() > 0) {
-		    supertypes.append(",");
+	    if (qNames.length != 0) {
+		Element typesElem = new Element(SUPERTYPES_ELEMENT);
+		ntElem.addContent(typesElem);
+		for (int i = 0; i < qNames.length; i++) {
+		    Element typeElem = new Element(SUPERTYPE_ELEMENT);
+		    typesElem.addContent(typeElem);
+		    typeElem.setText(qNames[i].toJCRName(nsResolver));
 		}
-		supertypes.append(qNames[i].toJCRName(nsResolver));
 	    }
-	    ntElem.setAttribute(SUPERTYPES_ATTRIBUTE, supertypes.toString());
+
 	    // mixin
 	    ntElem.setAttribute(MIXIN_ATTRIBUTE, Boolean.toString(ntd.isMixin()));
+
 	    // orderableChildNodes
 	    ntElem.setAttribute(ORDERABLECHILDNODES_ATTRIBUTE, Boolean.toString(ntd.hasOrderableChildNodes()));
 
@@ -458,7 +520,7 @@
 	    PropDef[] pda = ntd.getPropertyDefs();
 	    for (int i = 0; i < pda.length; i++) {
 		PropDef pd = pda[i];
-		Element elem = new Element(PROPERTYDEF_ELEMENT_NAME);
+		Element elem = new Element(PROPERTYDEF_ELEMENT);
 		ntElem.addContent(elem);
 
 		// name
@@ -466,23 +528,28 @@
 		elem.setAttribute(NAME_ATTRIBUTE, name);
 		// type
 		elem.setAttribute(TYPE_ATTRIBUTE, PropertyType.nameFromValue(pd.getRequiredType()));
-		// valueConstraint
-		String valueConstraint = pd.getValueConstraint() == null ? "" : pd.getValueConstraint().getDefinition();
-		elem.setAttribute(VALUECONSTRAINT_ATTRIBUTE, valueConstraint);
+		// valueConstraints
+		ValueConstraint[] vca = pd.getValueConstraints();
+		if (vca != null && vca.length != 0) {
+		    Element constraintsElem = new Element(VALUECONSTRAINTS_ELEMENT);
+		    elem.addContent(constraintsElem);
+		    for (int j = 0; j < vca.length; j++) {
+			Element constraintElem = new Element(VALUECONSTRAINTS_ELEMENT);
+			constraintsElem.addContent(constraintElem);
+			constraintElem.setText(vca[j].getDefinition());
+		    }
+		}
 		// defaultValues
-		// @todo provide escaping for separator character within single value or change xml representation for defaultValues
 		InternalValue[] defVals = pd.getDefaultValues();
-		StringBuffer defaultValues = new StringBuffer();
-		if (defVals != null) {
-		    for (int n = 0; n < defVals.length; n++) {
-			if (defaultValues.length() > 0) {
-			    defaultValues.append(",");
-			}
-			defaultValues.append(defVals[n].toString());
+		if (defVals != null && defVals.length != 0) {
+		    Element valuesElem = new Element(DEFAULTVALUES_ELEMENT);
+		    elem.addContent(valuesElem);
+		    for (int j = 0; j < defVals.length; j++) {
+			Element valueElem = new Element(DEFAULTVALUE_ELEMENT);
+			valuesElem.addContent(valueElem);
+			valueElem.setText(defVals[j].toString());
 		    }
 		}
-
-		elem.setAttribute(DEFAULTVALUES_ATTRIBUTE, defaultValues.toString());
 		// autoCreate
 		String autoCreate = elem.getAttributeValue(AUTOCREATE_ATTRIBUTE);
 		if (autoCreate != null && autoCreate.length() > 0) {
@@ -504,22 +571,23 @@
 	    ChildNodeDef[] nda = ntd.getChildNodeDefs();
 	    for (int i = 0; i < nda.length; i++) {
 		ChildNodeDef nd = nda[i];
-		Element elem = new Element(CHILDNODEDEF_ELEMENT_NAME);
+		Element elem = new Element(CHILDNODEDEF_ELEMENT);
 		ntElem.addContent(elem);
 
 		// name
 		String name = nd.getName() == null ? "" : nd.getName().toJCRName(nsResolver);
 		elem.setAttribute(NAME_ATTRIBUTE, name);
 		// requiredPrimaryTypes
-		StringBuffer requiredPrimaryTypes = new StringBuffer();
 		qNames = nd.getRequiredPrimaryTypes();
-		for (int j = 0; j < qNames.length; j++) {
-		    if (requiredPrimaryTypes.length() > 0) {
-			requiredPrimaryTypes.append(",");
+		if (qNames.length != 0) {
+		    Element typesElem = new Element(REQUIREDPRIMARYTYPES_ELEMENT);
+		    elem.addContent(typesElem);
+		    for (int j = 0; j < qNames.length; j++) {
+			Element typeElem = new Element(REQUIREDPRIMARYTYPE_ELEMENT);
+			typesElem.addContent(typeElem);
+			typeElem.setText(qNames[j].toJCRName(nsResolver));
 		    }
-		    requiredPrimaryTypes.append(qNames[j].toJCRName(nsResolver));
 		}
-		elem.setAttribute(REQUIREDPRIMARYTYPES_ATTRIBUTE, requiredPrimaryTypes.toString());
 		// defaultPrimaryType
 		String defaultPrimaryType = nd.getDefaultPrimaryType() == null ? "" : nd.getDefaultPrimaryType().toJCRName(nsResolver);
 		elem.setAttribute(DEFAULTPRIMARYTYPE_ATTRIBUTE, defaultPrimaryType);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/NodeTypeRegistry.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/NodeTypeRegistry.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/NodeTypeRegistry.java	Fri Sep 24 06:42:02 2004
@@ -16,13 +16,13 @@
 package org.apache.jackrabbit.jcr.core.nodetype;
 
 import org.apache.commons.collections.ReferenceMap;
-import org.apache.log4j.Logger;
+import org.apache.jackrabbit.jcr.core.InternalValue;
 import org.apache.jackrabbit.jcr.core.NamespaceRegistryImpl;
 import org.apache.jackrabbit.jcr.core.QName;
-import org.apache.jackrabbit.jcr.core.InternalValue;
 import org.apache.jackrabbit.jcr.fs.FileSystem;
 import org.apache.jackrabbit.jcr.fs.FileSystemException;
 import org.apache.jackrabbit.jcr.fs.FileSystemResource;
+import org.apache.log4j.Logger;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
@@ -485,17 +485,23 @@
 		log.error(reason);
 		throw new InvalidNodeTypeDefException(reason);
 	    }
-	    ValueConstraint constraint = pd.getValueConstraint();
-	    if (constraint != null && pd.getDefaultValues() != null) {
-		// check that default values satisfy value constraint
-		InternalValue[] vals = pd.getDefaultValues();
-		for (int j = 0; j < vals.length; j++) {
-		    try {
-			constraint.check(vals[j]);
-		    } catch (ConstraintViolationException cve) {
-			String msg = "default value of property " + (pd.getName() == null ? "[null]" : pd.getName().toString()) + " does not satisfy value constraint " + constraint.getDefinition();
-			log.error(msg, cve);
-			throw new InvalidNodeTypeDefException(msg, cve);
+	    ValueConstraint[] constraints = pd.getValueConstraints();
+	    InternalValue[] defVals = pd.getDefaultValues();
+	    if (constraints != null && constraints.length != 0
+		    && defVals != null && defVals.length != 0) {
+		// check that default values satisfy value constraints
+		for (int j = 0; j < constraints.length; j++) {
+		    for (int k = 0; k < defVals.length; k++) {
+			try {
+			    constraints[j].check(defVals[k]);
+			} catch (ConstraintViolationException cve) {
+			    String msg = "default value of property "
+				    + (pd.getName() == null ? "[null]" : pd.getName().toString())
+				    + " does not satisfy value constraint "
+				    + constraints[j].getDefinition();
+			    log.error(msg, cve);
+			    throw new InvalidNodeTypeDefException(msg, cve);
+			}
 		    }
 		}
 	    }
@@ -649,7 +655,6 @@
     }
 
     /**
-     *
      * @return
      */
     public ChildNodeDef getRootNodeDef() {
@@ -1093,7 +1098,19 @@
 		ps.println("\t\tName\t\t" + pd[i].getName());
 		String type = pd[i].getRequiredType() == 0 ? "null" : PropertyType.nameFromValue(pd[i].getRequiredType());
 		ps.println("\t\tRequiredType\t\t" + type);
-		ps.println("\t\tValueConstraint\t" + ((pd[i].getValueConstraint() == null) ? "null" : pd[i].getValueConstraint().getDefinition()));
+		ValueConstraint[] vca = pd[i].getValueConstraints();
+		StringBuffer constraints = new StringBuffer();
+		if (vca == null) {
+		    constraints.append("<null>");
+		} else {
+		    for (int n = 0; n < vca.length; n++) {
+			if (constraints.length() > 0) {
+			    constraints.append(", ");
+			}
+			constraints.append(vca[n].getDefinition());
+		    }
+		}
+		ps.println("\t\tValueConstraints\t" + constraints.toString());
 		InternalValue[] defVals = pd[i].getDefaultValues();
 		StringBuffer defaultValues = new StringBuffer();
 		if (defVals == null) {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/PropDef.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/PropDef.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/PropDef.java	Fri Sep 24 06:42:02 2004
@@ -29,7 +29,7 @@
 public class PropDef extends ChildItemDef {
 
     private int requiredType = PropertyType.UNDEFINED;
-    private ValueConstraint valueConstraint = null;
+    private ValueConstraint[] valueConstraints = new ValueConstraint[0];
     private InternalValue[] defaultValues = null;
     private boolean multiple = false;
 
@@ -47,7 +47,7 @@
 	    PropDef other = (PropDef) obj;
 	    return super.equals(obj)
 		    && requiredType == other.requiredType
-		    && (valueConstraint == null ? other.valueConstraint == null : valueConstraint.equals(other.valueConstraint))
+		    && Arrays.equals(valueConstraints, other.valueConstraints)
 		    && Arrays.equals(defaultValues, other.defaultValues)
 		    && multiple == other.multiple;
 	}
@@ -62,10 +62,10 @@
     }
 
     /**
-     * @param valueConstraint
+     * @param valueConstraints
      */
-    public void setValueConstraint(ValueConstraint valueConstraint) {
-	this.valueConstraint = valueConstraint;
+    public void setValueConstraints(ValueConstraint valueConstraints[]) {
+	this.valueConstraints = valueConstraints;
     }
 
     /**
@@ -92,8 +92,8 @@
     /**
      * @return
      */
-    public ValueConstraint getValueConstraint() {
-	return valueConstraint;
+    public ValueConstraint[] getValueConstraints() {
+	return valueConstraints;
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/PropertyDefImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/PropertyDefImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/PropertyDefImpl.java	Fri Sep 24 06:42:02 2004
@@ -86,10 +86,11 @@
      * @see PropertyDef#getValueConstraint
      */
     public String getValueConstraint() {
-	if (propDef.getValueConstraint() == null) {
+	ValueConstraint[] constraints = propDef.getValueConstraints();
+	if (constraints == null || constraints.length == 0) {
 	    return null;
 	} else {
-	    return propDef.getValueConstraint().getDefinition();
+	    return constraints[0].getDefinition();
 	}
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/builtin_nodetypes.xml
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/builtin_nodetypes.xml	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/jcr/core/nodetype/builtin_nodetypes.xml	Fri Sep 24 06:42:02 2004
@@ -18,19 +18,20 @@
  -->
 <!DOCTYPE nodeTypes [
 	<!ELEMENT nodeTypes (nodeType)*>
-		<!ELEMENT nodeType (propertyDef|childNodeDef)*>
+		<!ELEMENT nodeType (supertypes?|propertyDef*|childNodeDef*)>
+
 		<!ATTLIST nodeType
 			name CDATA #REQUIRED
 			mixin (true|false) #REQUIRED
  			orderableChildNodes (true|false) #REQUIRED
-			supertypes CDATA #REQUIRED
 		>
-		<!ELEMENT propertyDef (#PCDATA)>
+		<!ELEMENT supertypes (supertype+)>
+		<!ELEMENT supertype (CDATA)>
+
+		<!ELEMENT propertyDef (valueConstraints?|defaultValues?)>
 		<!ATTLIST propertyDef
 			name CDATA #REQUIRED
 			type (String|Date|Path|Name|Reference|Binary|Double|Long|Boolean|undefined) #REQUIRED
-			valueConstraint CDATA #REQUIRED
-			defaultValues CDATA #REQUIRED
 			autoCreate (true|false) #REQUIRED
 			mandatory (true|false) #REQUIRED
 			onParentVersion (COPY|VERSION|INITIALIZE|COMPUTE|IGNORE|ABORT) #REQUIRED
@@ -38,10 +39,14 @@
 			primaryItem (true|false) #REQUIRED
 			multiple  (true|false) #REQUIRED
 		>
-		<!ELEMENT childNodeDef (#PCDATA)>
+		<!ELEMENT valueConstraints (valueConstraint+)>
+		<!ELEMENT valueConstraint (CDATA)>
+		<!ELEMENT defaultValues (defaultValue+)>
+		<!ELEMENT defaultValue (CDATA)>
+
+		<!ELEMENT childNodeDef (requiredPrimaryTypes)>
 		<!ATTLIST childNodeDef
 			name CDATA #REQUIRED
-			requiredPrimaryTypes CDATA #REQUIRED
 			defaultPrimaryType  CDATA #REQUIRED
 			autoCreate (true|false) #REQUIRED
 			mandatory (true|false) #REQUIRED
@@ -50,109 +55,224 @@
 			primaryItem (true|false) #REQUIRED
 			sameNameSibs (true|false) #REQUIRED
 		>
+		<!ELEMENT requiredPrimaryTypes (requiredPrimaryType+)>
+		<!ELEMENT requiredPrimaryType (CDATA)>
 ]>
 <nodeTypes
     xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
     xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
     xmlns:jcr="http://www.jcp.org/jcr/1.0">
 
-    <!-- primary types !-->
-    <nodeType name="nt:base" mixin="false" orderableChildNodes="false" supertypes="">
-	<propertyDef name="jcr:primaryType" type="Name" valueConstraint="" defaultValues="" autoCreate="true" mandatory="true" onParentVersion="COMPUTE" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:mixinTypes" type="Name" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="COMPUTE" protected="true" primaryItem="false" multiple="true"/>
-    </nodeType>
-    <nodeType name="nt:unstructured" mixin="false" orderableChildNodes="true" supertypes="nt:base">
-	<childNodeDef name="" requiredPrimaryTypes="nt:base" defaultPrimaryType="nt:unstructured" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" sameNameSibs="true"/>
-	<propertyDef name="" type="undefined" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
-	<propertyDef name="" type="undefined" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-    </nodeType>
-    <nodeType name="nt:hierarchyNode" mixin="false" orderableChildNodes="false" supertypes="nt:base">
-	<propertyDef name="jcr:created" type="Date" valueConstraint="" defaultValues="" autoCreate="true" mandatory="true" onParentVersion="INITIALIZE" protected="true" primaryItem="false" multiple="false"/>
-    </nodeType>
-    <nodeType name="nt:file" mixin="false" orderableChildNodes="false" supertypes="nt:hierarchyNode">
-	<childNodeDef name="jcr:content" requiredPrimaryTypes="nt:base" defaultPrimaryType="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="true" sameNameSibs="false"/>
-    </nodeType>
-    <nodeType name="nt:mimeResource" mixin="false" orderableChildNodes="false" supertypes="nt:base,mix:referenceable">
-	<propertyDef name="jcr:encoding" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:mimeType" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:data" type="Binary" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="true" multiple="false"/>
-	<propertyDef name="jcr:lastModified" type="Date" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COMPUTE" protected="false" primaryItem="false" multiple="false"/>
-    </nodeType>
-    <nodeType name="nt:folder" mixin="false" orderableChildNodes="false" supertypes="nt:hierarchyNode">
-	<childNodeDef name="" requiredPrimaryTypes="nt:hierarchyNode" defaultPrimaryType="" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="false"/>
-    </nodeType>
-    <nodeType name="nt:nodeType" mixin="false" orderableChildNodes="false" supertypes="nt:base">
-	<propertyDef name="jcr:nodeTypeName" type="Name" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:supertypes" type="Name" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
-	<propertyDef name="jcr:isMixin" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:orderableChildNodes" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<childNodeDef name="jcr:propertyDef" requiredPrimaryTypes="nt:propertyDef" defaultPrimaryType="nt:propertyDef" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="true"/>
-	<childNodeDef name="jcr:childNodeDef" requiredPrimaryTypes="nt:childNodeDef" defaultPrimaryType="nt:childNodeDef" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="true"/>
-    </nodeType>
-    <nodeType name="nt:propertyDef" mixin="false" orderableChildNodes="false" supertypes="nt:base">
-	<propertyDef name="jcr:name" type="Name" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:type" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:valueConstraint" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:defaultValues" type="undefined" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:autoCreate" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:mandatory" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:onParentVersion" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:protected" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:primaryItem" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:multiple" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-    </nodeType>
-    <nodeType name="nt:childNodeDef" mixin="false" orderableChildNodes="false" supertypes="nt:base">
-	<propertyDef name="jcr:name" type="Name" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:requiredPrimaryTypes" type="String" valueConstraint="" defaultValues="nt:base" autoCreate="true" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
-	<propertyDef name="jcr:defaultPrimaryType" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:autoCreate" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:mandatory" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:onParentVersion" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:protected" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:primaryItem" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:sameNameSibs" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-    </nodeType>
-    <nodeType name="nt:versionHistory" mixin="false" orderableChildNodes="false" supertypes="nt:base,mix:referenceable">
-	<childNodeDef name="jcr:rootVersion" requiredPrimaryTypes="nt:version" defaultPrimaryType="nt:version" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" sameNameSibs="false"/>
-	<childNodeDef name="" requiredPrimaryTypes="nt:version" defaultPrimaryType="nt:version" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" sameNameSibs="false"/>
-    </nodeType>
-    <nodeType name="nt:frozenVersionableChild" mixin="false" orderableChildNodes="false" supertypes="nt:base">
-	<propertyDef name="jcr:versionHistory" type="Reference" valueConstraint="nt:versionHistory" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:baseVersion" type="Reference" valueConstraint="nt:version" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
-    </nodeType>
-    <nodeType name="nt:frozen" mixin="false" orderableChildNodes="false" supertypes="nt:base">
-	<propertyDef name="jcr:frozenPrimaryType" type="Name" valueConstraint="" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:frozenMixinTypes" type="Name" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
-	<propertyDef name="jcr:frozenUUID" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="" type="undefined" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
-	<propertyDef name="" type="undefined" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
-	<childNodeDef name="" requiredPrimaryTypes="nt:base" defaultPrimaryType="nt:frozen" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" sameNameSibs="true"/>
-    </nodeType>
-    <nodeType name="nt:version" mixin="false" orderableChildNodes="false" supertypes="nt:frozen,mix:referenceable">
-	<propertyDef name="jcr:versionLabels" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
-	<propertyDef name="jcr:created" type="Date" valueConstraint="" defaultValues="" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:predecessors" type="Reference" valueConstraint="nt:version" defaultValues="" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
-	<propertyDef name="jcr:successors" type="Reference" valueConstraint="nt:version" defaultValues="" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
-    </nodeType>
-    <nodeType name="nt:query" mixin="false" orderableChildNodes="false" supertypes="nt:base">
-	<propertyDef name="jcr:statement" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:language" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+    <!-- primary types -->
+    <nodeType name="nt:base" mixin="false" orderableChildNodes="false">
+	<propertyDef name="jcr:primaryType" type="Name" autoCreate="true" mandatory="true" onParentVersion="COMPUTE" protected="true" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:mixinTypes" type="Name" autoCreate="false" mandatory="false" onParentVersion="COMPUTE" protected="true" primaryItem="false" multiple="true"/>
+    </nodeType>
+    <nodeType name="nt:unstructured" mixin="false" orderableChildNodes="true">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	</supertypes>
+	<childNodeDef name="" defaultPrimaryType="nt:unstructured" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" sameNameSibs="true">
+	    <requiredPrimaryTypes>
+		<requiredPrimaryType>nt:base</requiredPrimaryType>
+	    </requiredPrimaryTypes>
+	</childNodeDef>
+	<propertyDef name="" type="undefined" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
+	<propertyDef name="" type="undefined" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+    </nodeType>
+    <nodeType name="nt:hierarchyNode" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	</supertypes>
+	<propertyDef name="jcr:created" type="Date" autoCreate="true" mandatory="true" onParentVersion="INITIALIZE" protected="true" primaryItem="false" multiple="false"/>
+    </nodeType>
+    <nodeType name="nt:file" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:hierarchyNode</supertype>
+	</supertypes>
+	<childNodeDef name="jcr:content" defaultPrimaryType="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="true" sameNameSibs="false">
+	    <requiredPrimaryTypes>
+		<requiredPrimaryType>nt:base</requiredPrimaryType>
+	    </requiredPrimaryTypes>
+	</childNodeDef>
+    </nodeType>
+    <nodeType name="nt:mimeResource" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	    <supertype>mix:referenceable</supertype>
+	</supertypes>
+	<propertyDef name="jcr:encoding" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:mimeType" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:data" type="Binary" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="true" multiple="false"/>
+	<propertyDef name="jcr:lastModified" type="Date" autoCreate="false" mandatory="true" onParentVersion="COMPUTE" protected="false" primaryItem="false" multiple="false"/>
+    </nodeType>
+    <nodeType name="nt:folder" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:hierarchyNode</supertype>
+	</supertypes>
+	<childNodeDef name="" defaultPrimaryType="" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="false">
+	    <requiredPrimaryTypes>
+		<requiredPrimaryType>nt:hierarchyNode</requiredPrimaryType>
+	    </requiredPrimaryTypes>
+	</childNodeDef>
+    </nodeType>
+    <nodeType name="nt:nodeType" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	</supertypes>
+	<propertyDef name="jcr:nodeTypeName" type="Name" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:supertypes" type="Name" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true"/>
+	<propertyDef name="jcr:isMixin" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:orderableChildNodes" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<childNodeDef name="jcr:propertyDef" defaultPrimaryType="nt:propertyDef" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="true">
+	    <requiredPrimaryTypes>
+		<requiredPrimaryType>nt:propertyDef</requiredPrimaryType>
+	    </requiredPrimaryTypes>
+	</childNodeDef>
+ 	<childNodeDef name="jcr:childNodeDef" defaultPrimaryType="nt:childNodeDef" autoCreate="false" mandatory="false" onParentVersion="VERSION" protected="false" primaryItem="false" sameNameSibs="true">
+	     <requiredPrimaryTypes>
+		 <requiredPrimaryType>nt:childNodeDef</requiredPrimaryType>
+	     </requiredPrimaryTypes>
+	 </childNodeDef>
+    </nodeType>
+    <nodeType name="nt:propertyDef" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	</supertypes>
+	<propertyDef name="jcr:name" type="Name" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:type" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:valueConstraint" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:defaultValues" type="undefined" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:autoCreate" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:mandatory" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:onParentVersion" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:protected" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:primaryItem" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:multiple" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+    </nodeType>
+    <nodeType name="nt:childNodeDef" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	</supertypes>
+	<propertyDef name="jcr:name" type="Name" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:requiredPrimaryTypes" type="String" autoCreate="true" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="true">
+	    <defaultValues>
+		<defaultValue>nt:base</defaultValue>
+	    </defaultValues>
+	</propertyDef>
+	<propertyDef name="jcr:defaultPrimaryType" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:autoCreate" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:mandatory" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:onParentVersion" type="String" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:protected" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:primaryItem" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:sameNameSibs" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+    </nodeType>
+    <nodeType name="nt:versionHistory" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	    <supertype>mix:referenceable</supertype>
+	</supertypes>
+	<childNodeDef name="jcr:rootVersion" defaultPrimaryType="nt:version" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" sameNameSibs="false">
+	    <requiredPrimaryTypes>
+		<requiredPrimaryType>nt:version</requiredPrimaryType>
+	    </requiredPrimaryTypes>
+	</childNodeDef>
+ 	<childNodeDef name="" defaultPrimaryType="nt:version" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" sameNameSibs="false">
+	     <requiredPrimaryTypes>
+		 <requiredPrimaryType>nt:version</requiredPrimaryType>
+	     </requiredPrimaryTypes>
+	 </childNodeDef>
+    </nodeType>
+    <nodeType name="nt:frozenVersionableChild" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	</supertypes>
+	<propertyDef name="jcr:versionHistory" type="Reference" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false">
+	    <valueConstraints>
+		<valueConstraint>nt:versionHistory</valueConstraint>
+	    </valueConstraints>
+	</propertyDef>
+	<propertyDef name="jcr:baseVersion" type="Reference" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false">
+	    <valueConstraints>
+		<valueConstraint>nt:version</valueConstraint>
+	    </valueConstraints>
+	</propertyDef>
+    </nodeType>
+    <nodeType name="nt:frozen" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	</supertypes>
+	<propertyDef name="jcr:frozenPrimaryType" type="Name" autoCreate="false" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:frozenMixinTypes" type="Name" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
+	<propertyDef name="jcr:frozenUUID" type="String" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
+	<propertyDef name="" type="undefined" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
+	<propertyDef name="" type="undefined" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
+	<childNodeDef name="" defaultPrimaryType="nt:frozen" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" sameNameSibs="true">
+	    <requiredPrimaryTypes>
+		<requiredPrimaryType>nt:base</requiredPrimaryType>
+	    </requiredPrimaryTypes>
+	</childNodeDef>
+    </nodeType>
+    <nodeType name="nt:version" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:frozen</supertype>
+	    <supertype>mix:referenceable</supertype>
+	</supertypes>
+	<propertyDef name="jcr:versionLabels" type="String" autoCreate="false" mandatory="false" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true"/>
+	<propertyDef name="jcr:created" type="Date" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:predecessors" type="Reference" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true">
+	    <valueConstraints>
+		<valueConstraint>nt:version</valueConstraint>
+	    </valueConstraints>
+	</propertyDef>
+	<propertyDef name="jcr:successors" type="Reference" autoCreate="true" mandatory="true" onParentVersion="ABORT" protected="true" primaryItem="false" multiple="true">
+	    <valueConstraints>
+		<valueConstraint>nt:version</valueConstraint>
+	    </valueConstraints>
+	</propertyDef>
+    </nodeType>
+    <nodeType name="nt:query" mixin="false" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>nt:base</supertype>
+	</supertypes>
+	<propertyDef name="jcr:statement" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:language" type="String" autoCreate="false" mandatory="false" onParentVersion="COPY" protected="false" primaryItem="false" multiple="false"/>
     </nodeType>
 
-    <!-- mixin types !-->
-    <nodeType name="mix:accessControllable" mixin="true" orderableChildNodes="false" supertypes="">
+    <!-- mixin types -->
+    <nodeType name="mix:accessControllable" mixin="true" orderableChildNodes="false">
     </nodeType>
-    <nodeType name="mix:lockable" mixin="true" orderableChildNodes="false" supertypes="">
-	<propertyDef name="jcr:lockOwner" type="String" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:lockIsDeep" type="Boolean" valueConstraint="" defaultValues="" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false"/>
-    </nodeType>
-    <nodeType name="mix:referenceable" mixin="true" orderableChildNodes="false" supertypes="">
-	<propertyDef name="jcr:uuid" type="String" valueConstraint="" defaultValues="" autoCreate="true" mandatory="true" onParentVersion="INITIALIZE" protected="true" primaryItem="false" multiple="false"/>
-    </nodeType>
-    <nodeType name="mix:versionable" mixin="true" orderableChildNodes="false" supertypes="mix:referenceable">
-	<propertyDef name="jcr:versionHistory" type="Reference" valueConstraint="nt:versionHistory" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:baseVersion" type="Reference" valueConstraint="nt:version" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:isCheckedOut" type="Boolean" valueConstraint="" defaultValues="true" autoCreate="false" mandatory="true" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false"/>
-	<propertyDef name="jcr:predecessors" type="Reference" valueConstraint="nt:version" defaultValues="" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="true" primaryItem="false" multiple="true"/>
+    <nodeType name="mix:lockable" mixin="true" orderableChildNodes="false">
+	<propertyDef name="jcr:lockOwner" type="String" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false"/>
+	<propertyDef name="jcr:lockIsDeep" type="Boolean" autoCreate="false" mandatory="false" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false"/>
+    </nodeType>
+    <nodeType name="mix:referenceable" mixin="true" orderableChildNodes="false">
+	<propertyDef name="jcr:uuid" type="String" autoCreate="true" mandatory="true" onParentVersion="INITIALIZE" protected="true" primaryItem="false" multiple="false"/>
+    </nodeType>
+    <nodeType name="mix:versionable" mixin="true" orderableChildNodes="false">
+	<supertypes>
+	    <supertype>mix:referenceable</supertype>
+	</supertypes>
+	<propertyDef name="jcr:versionHistory" type="Reference" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="true" primaryItem="false" multiple="false">
+	    <valueConstraints>
+		<valueConstraint>nt:versionHistory</valueConstraint>
+	    </valueConstraints>
+	</propertyDef>
+	<propertyDef name="jcr:baseVersion" type="Reference" autoCreate="false" mandatory="true" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false">
+	    <valueConstraints>
+		<valueConstraint>nt:version</valueConstraint>
+	    </valueConstraints>
+	</propertyDef>
+	<propertyDef name="jcr:isCheckedOut" type="Boolean" autoCreate="false" mandatory="true" onParentVersion="IGNORE" protected="true" primaryItem="false" multiple="false">
+	    <defaultValues>
+		<defaultValue>true</defaultValue>
+	    </defaultValues>
+	</propertyDef>
+	<propertyDef name="jcr:predecessors" type="Reference" autoCreate="false" mandatory="true" onParentVersion="COPY" protected="true" primaryItem="false" multiple="true">
+	    <valueConstraints>
+		<valueConstraint>nt:version</valueConstraint>
+	    </valueConstraints>
+	</propertyDef>
     </nodeType>
 </nodeTypes>

Mime
View raw message