jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r816343 [4/4] - in /jackrabbit/trunk: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ jackrabbit-...
Date Thu, 17 Sep 2009 19:20:36 GMT
Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java Thu Sep 17 19:20:33 2009
@@ -35,16 +35,17 @@
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
 import org.apache.jackrabbit.commons.cnd.CndImporter;
 import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
-import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
-import org.apache.jackrabbit.core.nodetype.PropDef;
-import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.value.InternalValueFactory;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NameFactory;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
 import org.apache.jackrabbit.test.AbstractJCRTest;
@@ -130,16 +131,16 @@
      * @param propertyName property name, or <code>null</code>
      * @return property definition
      */
-    private PropDef getPropDef(String typeName, String propertyName) {
+    private QPropertyDefinition getPropDef(String typeName, String propertyName) {
         Name name;
         if (propertyName != null) {
             name = FACTORY.create(TEST_NAMESPACE, propertyName);
         } else {
-            name = PropDef.ANY_NAME;
+            name = NameConstants.ANY_NAME;
         }
 
         NodeTypeDef def = getNodeType(typeName);
-        PropDef[] defs = def.getPropertyDefs();
+        QPropertyDefinition[] defs = def.getPropertyDefs();
         for (int i = 0; i < defs.length; i++) {
             if (name.equals(defs[i].getName())) {
                 return defs[i];
@@ -157,9 +158,9 @@
      * @param index default value index
      * @return default value
      */
-    private String getDefaultValue(PropDef def, int index) {
+    private String getDefaultValue(QPropertyDefinition def, int index) {
         try {
-            InternalValue[] values = def.getDefaultValues();
+            QValue[] values = def.getDefaultValues();
             NamespaceResolver nsResolver = new AdditionalNamespaceResolver(registry);
             NamePathResolver resolver = new DefaultNamePathResolver(nsResolver);
             ValueFactoryQImpl factory = new ValueFactoryQImpl(InternalValueFactory.getInstance(), resolver);
@@ -178,11 +179,11 @@
      * @param nodeName child node name
      * @return child node definition
      */
-    private NodeDef getChildNode(String typeName, String nodeName) {
+    private QNodeDefinition getChildNode(String typeName, String nodeName) {
         Name name = FACTORY.create(TEST_NAMESPACE, nodeName);
 
         NodeTypeDef def = getNodeType(typeName);
-        NodeDef[] defs = def.getChildNodeDefs();
+        QNodeDefinition[] defs = def.getChildNodeDefs();
         for (int i = 0; i < defs.length; i++) {
             if (name.equals(defs[i].getName())) {
                 return defs[i];
@@ -240,7 +241,7 @@
                 def.getPrimaryItemName());
         assertEquals("itemNodeType propertyDefs",
                 10, def.getPropertyDefs().length);
-        PropDef pdef = getPropDef("itemNodeType", null);
+        QPropertyDefinition pdef = getPropDef("itemNodeType", null);
         assertTrue("itemNodeType wildcard property", pdef.definesResidual());
     }
 
@@ -319,7 +320,7 @@
 
     /** Test for the empty item definition. */
     public void testEmptyItem() {
-        PropDef def = getPropDef("itemNodeType", "emptyItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "emptyItem");
         assertEquals("emptyItem autoCreate",
                 false, def.isAutoCreated());
         assertEquals("emptyItem mandatory",
@@ -332,56 +333,56 @@
 
     /** Test for the <code>autoCreated</code> item definition attribute. */
     public void testAutoCreateItem() {
-        PropDef def = getPropDef("itemNodeType", "autoCreatedItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "autoCreatedItem");
         assertEquals("autoCreatedItem autoCreated",
                 true, def.isAutoCreated());
     }
 
     /** Test for the <code>mandatory</code> item definition attribute. */
     public void testMandatoryItem() {
-        PropDef def = getPropDef("itemNodeType", "mandatoryItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "mandatoryItem");
         assertEquals("mandatoryItem mandatory",
                 true, def.isMandatory());
     }
 
     /** Test for the <code>copy</code> parent version action. */
     public void testCopyItem() {
-        PropDef def = getPropDef("itemNodeType", "copyItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "copyItem");
         assertEquals("copyItem onParentVersion",
                 OnParentVersionAction.COPY, def.getOnParentVersion());
     }
 
     /** Test for the <code>version</code> parent version action. */
     public void testVersionItem() {
-        PropDef def = getPropDef("itemNodeType", "versionItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "versionItem");
         assertEquals("versionItem onParentVersion",
                 OnParentVersionAction.VERSION, def.getOnParentVersion());
     }
 
     /** Test for the <code>initialize</code> parent version action. */
     public void testInitializeItem() {
-        PropDef def = getPropDef("itemNodeType", "initializeItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "initializeItem");
         assertEquals("initializeItem onParentVersion",
                 OnParentVersionAction.INITIALIZE, def.getOnParentVersion());
     }
 
     /** Test for the <code>compute</code> parent version action. */
     public void testComputeItem() {
-        PropDef def = getPropDef("itemNodeType", "computeItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "computeItem");
         assertEquals("computeItem onParentVersion",
                 OnParentVersionAction.COMPUTE, def.getOnParentVersion());
     }
 
     /** Test for the <code>abort</code> parent version action. */
     public void testAbortItem() {
-        PropDef def = getPropDef("itemNodeType", "abortItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "abortItem");
         assertEquals("abortItem onParentVersion",
                 OnParentVersionAction.ABORT, def.getOnParentVersion());
     }
 
     /** Test for the <code>protected</code> item definition attribute. */
     public void testProtectedItem() {
-        PropDef def = getPropDef("itemNodeType", "protectedItem");
+        QPropertyDefinition def = getPropDef("itemNodeType", "protectedItem");
         assertEquals("protectedItem protected",
                 true, def.isProtected());
     }
@@ -395,33 +396,33 @@
 
     /** Test for the empty property definition. */
     public void testEmptyProperty() {
-        PropDef def = getPropDef("propertyNodeType", "emptyProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "emptyProperty");
         assertEquals("emptyProperty requiredType",
                 PropertyType.UNDEFINED, def.getRequiredType());
         assertEquals("emptyProperty multiple",
                 false, def.isMultiple());
-        assertEquals("emptyProperty defaultValues",
-                0, def.getDefaultValues().length);
+        assertNull("emptyProperty defaultValues",
+                def.getDefaultValues());
         assertEquals("emptyProperty valueConstraints",
                 0, def.getValueConstraints().length);
     }
 
     /** Test for the <code>binary</code> property definition type. */
     public void testBinaryProperty() {
-        PropDef def = getPropDef("propertyNodeType", "binaryProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "binaryProperty");
         assertEquals("binaryProperty requiredType",
                 PropertyType.BINARY, def.getRequiredType());
         assertEquals("binaryProperty valueConstraints",
                 1, def.getValueConstraints().length);
         assertEquals("binaryProperty valueConstraints[0]",
                 "[0,)", (def.getValueConstraints())[0].getString());
-        assertEquals("binaryProperty defaultValues",
-                0, def.getDefaultValues().length);
+        assertNull("binaryProperty defaultValues",
+                def.getDefaultValues());
     }
 
     /** Test for the <code>boolean</code> property definition type. */
     public void testBooleanProperty() {
-        PropDef def = getPropDef("propertyNodeType", "booleanProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "booleanProperty");
         assertEquals("booleanProperty requiredType",
                 PropertyType.BOOLEAN, def.getRequiredType());
         assertEquals("booleanProperty valueConstraints",
@@ -438,7 +439,7 @@
 
     /** Test for the <code>date</code> property definition type. */
     public void testDateProperty() {
-        PropDef def = getPropDef("propertyNodeType", "dateProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "dateProperty");
         assertEquals("dateProperty requiredType",
                 PropertyType.DATE, def.getRequiredType());
         assertEquals("dateProperty valueConstraints",
@@ -454,7 +455,7 @@
 
     /** Test for the <code>double</code> property definition type. */
     public void testDoubleProperty() {
-        PropDef def = getPropDef("propertyNodeType", "doubleProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "doubleProperty");
         assertEquals("doubleProperty requiredType",
                 PropertyType.DOUBLE, def.getRequiredType());
         assertEquals("doubleProperty valueConstraints",
@@ -473,7 +474,7 @@
 
     /** Test for the <code>long</code> property definition type. */
     public void testLongProperty() {
-        PropDef def = getPropDef("propertyNodeType", "longProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "longProperty");
         assertEquals("longProperty requiredType",
                 PropertyType.LONG, def.getRequiredType());
         assertEquals("longProperty valueConstraints",
@@ -492,7 +493,7 @@
 
     /** Test for the <code>name</code> property definition type. */
     public void testNameProperty() {
-        PropDef def = getPropDef("propertyNodeType", "nameProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "nameProperty");
         assertEquals("nameProperty requiredType",
                 PropertyType.NAME, def.getRequiredType());
         assertEquals("nameProperty valueConstraints",
@@ -508,7 +509,7 @@
 
     /** Test for the <code>path</code> property definition type. */
     public void testPathProperty() {
-        PropDef def = getPropDef("propertyNodeType", "pathProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "pathProperty");
         assertEquals("pathProperty requiredType",
                 PropertyType.PATH, def.getRequiredType());
         assertEquals("pathProperty valueConstraints",
@@ -516,13 +517,13 @@
         assertEquals("pathProperty valueConstraints[0]",
                 "{}\t{http://www.apache.org/jackrabbit/test}testPath",
                 (def.getValueConstraints())[0].getString());
-        assertEquals("pathProperty defaultValues",
-                0, def.getDefaultValues().length);
+        assertNull("pathProperty defaultValues",
+                def.getDefaultValues());
     }
 
     /** Test for the <code>path</code> property definition type. */
     public void testPathProperty1() {
-        PropDef def = getPropDef("propertyNodeType", "pathProperty1");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "pathProperty1");
         assertEquals("pathProperty requiredType",
                 PropertyType.PATH, def.getRequiredType());
         assertEquals("pathProperty valueConstraints",
@@ -530,13 +531,13 @@
         assertEquals("pathProperty valueConstraints[0]",
                 "{}\t{http://www.apache.org/jackrabbit/test}testPath\t{}*",
                 (def.getValueConstraints())[0].getString());
-        assertEquals("pathProperty defaultValues",
-                0, def.getDefaultValues().length);
+        assertNull("pathProperty defaultValues",
+                def.getDefaultValues());
     }
 
     /** Test for the <code>path</code> property definition type. */
     public void testPathProperty2() {
-        PropDef def = getPropDef("propertyNodeType", "pathProperty2");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "pathProperty2");
         assertEquals("pathProperty requiredType",
                 PropertyType.PATH, def.getRequiredType());
         assertEquals("pathProperty valueConstraints",
@@ -544,13 +545,13 @@
         assertEquals("pathProperty valueConstraints[0]",
                 "{http://www.apache.org/jackrabbit/test}testPath\t{}*",
                 (def.getValueConstraints())[0].getString());
-        assertEquals("pathProperty defaultValues",
-                0, def.getDefaultValues().length);
+        assertNull("pathProperty defaultValues",
+                def.getDefaultValues());
     }
 
     /** Test for the <code>reference</code> property definition type. */
     public void testReferenceProperty() {
-        PropDef def = getPropDef("propertyNodeType", "referenceProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "referenceProperty");
         assertEquals("referenceProperty requiredType",
                 PropertyType.REFERENCE, def.getRequiredType());
         assertEquals("referenceProperty valueConstraints",
@@ -558,13 +559,13 @@
         assertEquals("referenceProperty valueConstraints[0]",
                 "{http://www.jcp.org/jcr/nt/1.0}base",
                 (def.getValueConstraints())[0].getString());
-        assertEquals("referenceProperty defaultValues",
-                0, def.getDefaultValues().length);
+        assertNull("referenceProperty defaultValues",
+                def.getDefaultValues());
     }
 
     /** Test for the <code>string</code> property definition type. */
     public void testStringProperty() {
-        PropDef def = getPropDef("propertyNodeType", "stringProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "stringProperty");
         assertEquals("stringProperty requiredType",
                 PropertyType.STRING, def.getRequiredType());
         assertEquals("stringProperty valueConstraints",
@@ -582,7 +583,7 @@
 
     /** Test for the <code>multiple</code> property definition attribute. */
     public void testMultipleProperty() {
-        PropDef def = getPropDef("propertyNodeType", "multipleProperty");
+        QPropertyDefinition def = getPropDef("propertyNodeType", "multipleProperty");
         assertEquals("multipleProperty multiple",
                 true, def.isMultiple());
     }
@@ -596,7 +597,7 @@
 
     /** Test for the empty child node definition. */
     public void testEmptyNode() {
-        NodeDef def = getChildNode("childNodeType", "emptyNode");
+        QNodeDefinition def = getChildNode("childNodeType", "emptyNode");
         assertEquals("emptyNode allowsSameNameSiblings",
                 false, def.allowsSameNameSiblings());
         assertEquals("emptyNode defaultPrimaryType",
@@ -605,14 +606,14 @@
 
     /** Test for the <code>allowsSameNameSiblings</code> child node attribute. */
     public void testSiblingNode() {
-        NodeDef def = getChildNode("childNodeType", "siblingNode");
+        QNodeDefinition def = getChildNode("childNodeType", "siblingNode");
         assertEquals("siblingNode allowsSameNameSiblings",
                 true, def.allowsSameNameSiblings());
     }
 
     /** Test for the <code>defaultPrimaryType</code> child node attribute. */
     public void testDefaultTypeNode() {
-        NodeDef def = getChildNode("childNodeType", "defaultTypeNode");
+        QNodeDefinition def = getChildNode("childNodeType", "defaultTypeNode");
         assertEquals("defaultTypeNode defaultPrimaryType",
                 FACTORY.create(Name.NS_NT_URI, "base"),
                 def.getDefaultPrimaryType());
@@ -620,7 +621,7 @@
 
     /** Test for the <code>requiredPrimaryTypes</code> child node attributes. */
     public void testRequiredTypeNode() {
-        NodeDef def = getChildNode("childNodeType", "requiredTypeNode");
+        QNodeDefinition def = getChildNode("childNodeType", "requiredTypeNode");
         assertEquals("requiredTypeNode requiredPrimaryTypes",
                 2, def.getRequiredPrimaryTypes().length);
         Name[] types = def.getRequiredPrimaryTypes();

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java Thu Sep 17 19:20:33 2009
@@ -20,7 +20,6 @@
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 
 import java.io.Serializable;
 
@@ -32,12 +31,6 @@
 public abstract class QItemDefinitionImpl implements QItemDefinition, Serializable {
 
     /**
-     * The special wildcard name used as the name of residual item definitions.
-     * TODO don't rely on specific factory impl
-     */
-    public static final Name ANY_NAME = NameFactoryImpl.getInstance().create("", "*");
-
-    /**
      * The name of the child item.
      */
     private final Name name;

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java Thu Sep 17 19:20:33 2009
@@ -21,6 +21,8 @@
 
 import java.util.Arrays;
 import java.util.TreeSet;
+import java.util.Set;
+import java.util.HashSet;
 
 /**
  * <code>QNodeDefinitionImpl</code> implements a <code>QNodeDefinition</code>.
@@ -35,8 +37,7 @@
     /**
      * The names of the required primary types.
      */
-    private final Name[] requiredPrimaryTypes;
-
+    private final Set<Name> requiredPrimaryTypes = new HashSet<Name>();
     /**
      * The 'allowsSameNameSiblings' flag.
      */
@@ -77,7 +78,7 @@
         super(name, declaringNodeType, isAutoCreated, isMandatory,
                 onParentVersion, isProtected);
         this.defaultPrimaryType = defaultPrimaryType;
-        this.requiredPrimaryTypes = requiredPrimaryTypes;
+        this.requiredPrimaryTypes.addAll(Arrays.asList(requiredPrimaryTypes));
         this.allowsSameNameSiblings = allowsSameNameSiblings;
     }
 
@@ -93,7 +94,7 @@
      * {@inheritDoc}
      */
     public Name[] getRequiredPrimaryTypes() {
-        return requiredPrimaryTypes;
+        return requiredPrimaryTypes.toArray(new Name[requiredPrimaryTypes.size()]);
     }
 
     /**
@@ -130,7 +131,8 @@
         if (obj instanceof QNodeDefinition) {
             QNodeDefinition other = (QNodeDefinition) obj;
             return super.equals(obj)
-                    && Arrays.equals(requiredPrimaryTypes, other.getRequiredPrimaryTypes())
+                    && requiredPrimaryTypes.equals(new HashSet<Name>(
+                            Arrays.asList(other.getRequiredPrimaryTypes())))
                     && (defaultPrimaryType == null
                             ? other.getDefaultPrimaryType() == null
                             : defaultPrimaryType.equals(other.getDefaultPrimaryType()))

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java Thu Sep 17 19:20:33 2009
@@ -25,6 +25,7 @@
 import org.apache.jackrabbit.spi.QValueFactory;
 import org.apache.jackrabbit.spi.QValueConstraint;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
@@ -40,23 +41,28 @@
 import java.util.HashSet;
 import java.util.Collections;
 import java.util.Arrays;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.Set;
 import java.io.Serializable;
 
 /**
  * <code>QNodeTypeDefinitionImpl</code> implements a serializable SPI node
  * type definition.
  */
-public class QNodeTypeDefinitionImpl implements QNodeTypeDefinition, Serializable {
+public class QNodeTypeDefinitionImpl implements QNodeTypeDefinition, Serializable, Cloneable {
+
+    private static final long serialVersionUID = -4065300714874671511L;
 
     /**
      * The name of the node definition.
      */
-    private final Name name;
+    private Name name;
 
     /**
      * The names of the declared super types of this node type definition.
      */
-    private final Name[] supertypes;
+    private Name[] supertypes;
 
     /**
      * The names of the supported mixins on this node type (or <code>null</code>)
@@ -66,38 +72,37 @@
     /**
      * Indicates whether this is a mixin node type definition.
      */
-    private final boolean isMixin;
+    private boolean isMixin;
 
     /**
      * Indicates whether this is an abstract node type definition.
      */
-    private final boolean isAbstract;
+    private boolean isAbstract;
 
     /**
      * Indicates whether this is a queryable node type definition.
      */
-    private final boolean isQueryable;
+    private boolean isQueryable;
 
     /**
      * Indicates whether this node type definition has orderable child nodes.
      */
-    private final boolean hasOrderableChildNodes;
+    private boolean hasOrderableChildNodes;
 
     /**
      * The name of the primary item or <code>null</code> if none is defined.
      */
-    private final Name primaryItemName;
+    private Name primaryItemName;
 
     /**
-     * The list of property definitions.
+     * The list of child node definitions.
      */
-    private final QPropertyDefinition[] propertyDefs;
+    private final Set<QPropertyDefinition> propertyDefs;
 
     /**
-     * The list of child node definitions.
+     * The list of property definitions.
      */
-    private final QNodeDefinition[] childNodeDefs;
-
+    private final Set<QNodeDefinition> childNodeDefs;
     /**
      * Unmodifiable collection of dependent node type <code>Name</code>s.
      * @see #getDependencies()
@@ -105,6 +110,14 @@
     private transient Collection<Name> dependencies;
 
     /**
+     * Default constructor.
+     */
+    public QNodeTypeDefinitionImpl() {
+        this(null, Name.EMPTY_ARRAY, null, false, false, true, false, null,
+                QPropertyDefinition.EMPTY_ARRAY, QNodeDefinition.EMPTY_ARRAY);
+    }
+
+    /**
      * Copy constructor.
      *
      * @param nt the node type definition.
@@ -143,7 +156,6 @@
                                    QPropertyDefinition[] declaredPropDefs,
                                    QNodeDefinition[] declaredNodeDefs) {
         this.name = name;
-        this.supertypes = supertypes;
         this.supportedMixins = supportedMixins;
         this.isMixin = isMixin;
         this.isAbstract = isAbstract;
@@ -152,6 +164,7 @@
         this.primaryItemName = primaryItemName;
         this.propertyDefs = getSerializablePropertyDefs(declaredPropDefs);
         this.childNodeDefs = getSerializableNodeDefs(declaredNodeDefs);
+        setSupertypes(supertypes); // make sure supertypes are sorted
     }
 
     /**
@@ -194,7 +207,105 @@
                 createQNodeDefinitions(name, def.getDeclaredChildNodeDefinitions(), resolver));
     }
 
+    /**
+     * Sets the name of the node type being defined.
+     *
+     * @param name The name of the node type.
+     */
+    public void setName(Name name) {
+        this.name = name;
+    }
+
+    /**
+     * Sets the supertypes.
+     *
+     * @param names the names of the supertypes.
+     */
+    public void setSupertypes(Name[] names) {
+        resetDependencies();
+        // Optimize common cases (zero or one supertypes)
+        if (names.length == 0) {
+            supertypes = Name.EMPTY_ARRAY;
+        } else if (names.length == 1) {
+            supertypes = new Name[] { names[0] };
+        } else {
+            // Sort and remove duplicates
+            SortedSet<Name> types = new TreeSet<Name>();
+            types.addAll(Arrays.asList(names));
+            supertypes = types.toArray(new Name[types.size()]);
+        }
+    }
+
+    /**
+     * Sets the mixin flag.
+     *
+     * @param mixin flag
+     */
+    public void setMixin(boolean mixin) {
+        this.isMixin = mixin;
+    }
+
+    /**
+     * Sets the orderableChildNodes flag.
+     *
+     * @param orderableChildNodes flag
+     */
+    public void setOrderableChildNodes(boolean orderableChildNodes) {
+        this.hasOrderableChildNodes = orderableChildNodes;
+    }
+
+    /**
+     * Sets the 'abstract' flag.
+     *
+     * @param abstractStatus flag
+     */
+    public void setAbstract(boolean abstractStatus) {
+        this.isAbstract = abstractStatus;
+    }
+
+    /**
+     * Sets the 'queryable' flag.
+     *
+     * @param queryable flag
+     */
+    public void setQueryable(boolean queryable) {
+        this.isQueryable = queryable;
+    }
+
+    /**
+     * Sets the name of the primary item (one of the child items of the node's
+     * of this node type)
+     *
+     * @param primaryItemName The name of the primary item.
+     */
+    public void setPrimaryItemName(Name primaryItemName) {
+        this.primaryItemName = primaryItemName;
+    }
+
+    /**
+     * Sets the property definitions.
+     *
+     * @param defs An array of <code>QPropertyDefinition</code> objects.
+     */
+    public void setPropertyDefs(QPropertyDefinition[] defs) {
+        resetDependencies();
+        propertyDefs.clear();
+        propertyDefs.addAll(Arrays.asList(defs));
+    }
+
+    /**
+     * Sets the child node definitions.
+     *
+     * @param defs An array of <code>QNodeDefinition</code> objects
+     */
+    public void setChildNodeDefs(QNodeDefinition[] defs) {
+        resetDependencies();
+        childNodeDefs.clear();
+        childNodeDefs.addAll(Arrays.asList(defs));
+    }
+
     //------------------------------------------------< QNodeTypeDefinition >---
+
     /**
      * {@inheritDoc}
      */
@@ -206,9 +317,12 @@
      * {@inheritDoc}
      */
     public Name[] getSupertypes() {
-        Name[] sTypes = new Name[supertypes.length];
-        System.arraycopy(supertypes, 0, sTypes, 0, supertypes.length);
-        return sTypes;
+        if (supertypes.length > 0
+                || isMixin() || NameConstants.NT_BASE.equals(getName())) {
+            return supertypes;
+        } else {
+            return new Name[] { NameConstants.NT_BASE };
+        }
     }
 
     /**
@@ -250,24 +364,20 @@
      * {@inheritDoc}
      */
     public QPropertyDefinition[] getPropertyDefs() {
-        QPropertyDefinition[] pDefs = new QPropertyDefinition[propertyDefs.length];
-        System.arraycopy(propertyDefs, 0, pDefs, 0, propertyDefs.length);
-        return pDefs;
+        return propertyDefs.toArray(new QPropertyDefinition[propertyDefs.size()]);
     }
 
     /**
      * {@inheritDoc}
      */
     public QNodeDefinition[] getChildNodeDefs() {
-        QNodeDefinition[] cnDefs = new QNodeDefinition[childNodeDefs.length];
-        System.arraycopy(childNodeDefs, 0, cnDefs, 0, childNodeDefs.length);
-        return cnDefs;
+        return childNodeDefs.toArray(new QNodeDefinition[childNodeDefs.size()]);
     }
 
     /**
      * {@inheritDoc}
      */
-    public Collection getDependencies() {
+    public Collection<Name> getDependencies() {
         if (dependencies == null) {
             Collection<Name> deps = new HashSet<Name>();
             // supertypes
@@ -320,46 +430,92 @@
         }
     }
     
+    //-------------------------------------------< java.lang.Object overrides >
+
+    public QNodeTypeDefinitionImpl clone() {
+        try {
+            // todo: itemdefs should be cloned as well, since mutable
+            return (QNodeTypeDefinitionImpl) super.clone();
+        } catch (CloneNotSupportedException e) {
+            // does not happen, this class is cloneable
+            throw new InternalError();
+        }
+    }
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof QNodeTypeDefinitionImpl) {
+            QNodeTypeDefinitionImpl other = (QNodeTypeDefinitionImpl) obj;
+            return (name == null ? other.name == null : name.equals(other.name))
+                    && (primaryItemName == null ? other.primaryItemName == null : primaryItemName.equals(other.primaryItemName))
+                    && Arrays.equals(getSupertypes(), other.getSupertypes())
+                    && isMixin == other.isMixin
+                    && hasOrderableChildNodes == other.hasOrderableChildNodes
+                    && isAbstract == other.isAbstract
+                    && isQueryable == other.isQueryable
+                    && propertyDefs.equals(other.propertyDefs)
+                    && childNodeDefs.equals(other.childNodeDefs);
+        }
+        return false;
+    }
+
+    /**
+     * Returns zero to satisfy the Object equals/hashCode contract.
+     * This class is mutable and not meant to be used as a hash key.
+     *
+     * @return always zero
+     * @see Object#hashCode()
+     */
+    public int hashCode() {
+        return 0;
+    }
+
     //-------------------------------< internal >-------------------------------
 
+    private void resetDependencies() {
+        dependencies = null;
+    }
+
     /**
-     * Returns an array of serializable property definitions for
+     * Returns a set of serializable property definitions for
      * <code>propDefs</code>.
      *
      * @param propDefs the SPI property definitions.
-     * @return an array of serializable property definitions.
+     * @return a set of serializable property definitions.
      */
-    private static QPropertyDefinition[] getSerializablePropertyDefs(
+    private static Set<QPropertyDefinition> getSerializablePropertyDefs(
             QPropertyDefinition[] propDefs) {
-        QPropertyDefinition[] serDefs = new QPropertyDefinition[propDefs.length];
-        for (int i = 0; i < propDefs.length; i++) {
-            if (propDefs[i] instanceof Serializable) {
-                serDefs[i] = propDefs[i];
+        Set<QPropertyDefinition> defs = new HashSet<QPropertyDefinition>();
+        for (QPropertyDefinition pd : propDefs) {
+            if (pd instanceof Serializable) {
+                defs.add(pd);
             } else {
-                serDefs[i] = new QPropertyDefinitionImpl(propDefs[i]);
+                defs.add(pd);
             }
         }
-        return serDefs;
+        return defs;
     }
 
     /**
-     * Returns an array of serializable node definitions for
+     * Returns a set of serializable node definitions for
      * <code>nodeDefs</code>.
      *
      * @param nodeDefs the node definitions.
-     * @return an array of serializable node definitions.
+     * @return a set of serializable node definitions.
      */
-    private static QNodeDefinition[] getSerializableNodeDefs(
+    private static Set<QNodeDefinition> getSerializableNodeDefs(
             QNodeDefinition[] nodeDefs) {
-        QNodeDefinition[] serDefs = new QNodeDefinition[nodeDefs.length];
-        for (int i = 0; i < nodeDefs.length; i++) {
-            if (nodeDefs[i] instanceof Serializable) {
-                serDefs[i] = nodeDefs[i];
+        Set<QNodeDefinition> defs = new HashSet<QNodeDefinition>();
+        for (QNodeDefinition nd : nodeDefs) {
+            if (nd instanceof Serializable) {
+                defs.add(nd);
             } else {
-                serDefs[i] = new QNodeDefinitionImpl(nodeDefs[i]);
+                defs.add(new QNodeDefinitionImpl(nd));
             }
         }
-        return serDefs;
+        return defs;
     }
 
     private static Name[] getNames(String[] jcrNames, NamePathResolver resolver) throws NamespaceException, IllegalNameException {
@@ -381,8 +537,8 @@
         QPropertyDefinition[] declaredPropDefs = new QPropertyDefinition[pds.length];
         for (int i = 0; i < pds.length; i++) {
             PropertyDefinition propDef = pds[i];
-            Name name = propDef.getName().equals(QItemDefinitionImpl.ANY_NAME.getLocalName())
-                    ? QItemDefinitionImpl.ANY_NAME
+            Name name = propDef.getName().equals(NameConstants.ANY_NAME.getLocalName())
+                    ? NameConstants.ANY_NAME
                     : resolver.getQName(propDef.getName());
             // check if propDef provides declaring node type and if it matches 'this' one.
             if (propDef.getDeclaringNodeType() != null) {
@@ -429,8 +585,8 @@
         QNodeDefinition[] declaredNodeDefs = new QNodeDefinition[nds.length];
         for (int i = 0; i < nds.length; i++) {
             NodeDefinition nodeDef = nds[i];
-            Name name = nodeDef.getName().equals(QItemDefinitionImpl.ANY_NAME.getLocalName())
-                    ? QItemDefinitionImpl.ANY_NAME
+            Name name = nodeDef.getName().equals(NameConstants.ANY_NAME.getLocalName())
+                    ? NameConstants.ANY_NAME
                     : resolver.getQName(nodeDef.getName());
             // check if propDef provides declaring node type and if it matches 'this' one.
             if (nodeDef.getDeclaringNodeType() != null) {

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java Thu Sep 17 19:20:33 2009
@@ -63,7 +63,17 @@
         super(itemDef, ntMgr, resolver);
     }
 
+    /**
+     * Returns the wrapped node definition.
+     *
+     * @return the wrapped node definition.
+     */
+    public QNodeDefinition unwrap() {
+        return (QNodeDefinition) itemDef;
+    }
+
     //-------------------------------------------------------< NodeDefinition >
+
     /**
      * {@inheritDoc}
      */

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java Thu Sep 17 19:20:33 2009
@@ -72,7 +72,17 @@
         this.valueFactory = valueFactory;
     }
 
+    /**
+     * Returns the wrapped property definition.
+     *
+     * @return the wrapped property definition.
+     */
+    public QPropertyDefinition unwrap() {
+        return (QPropertyDefinition) itemDef;
+    }
+
     //-------------------------------------------------< PropertyDefinition >---
+
     /**
      * {@inheritDoc}
      */

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QDefinitionBuilderFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QDefinitionBuilderFactory.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QDefinitionBuilderFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QDefinitionBuilderFactory.java Thu Sep 17 19:20:33 2009
@@ -327,10 +327,6 @@
 
         @Override
         public void build() {
-            if (builder.getRequiredPrimaryTypes() == null) {
-                builder.addRequiredPrimaryType(NameConstants.NT_BASE);
-            }
-
             ntd.childNodeDefs.add(builder.build());
         }
     }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QItemDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QItemDefinitionBuilder.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QItemDefinitionBuilder.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QItemDefinitionBuilder.java Thu Sep 17 19:20:33 2009
@@ -17,21 +17,23 @@
 package org.apache.jackrabbit.spi.commons.nodetype;
 
 import javax.jcr.nodetype.ItemDefinition;
+import javax.jcr.version.OnParentVersionAction;
 
 import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 /**
  * A builder for {@link QItemDefinition}.
  */
 public abstract class QItemDefinitionBuilder {
 
-    private Name name;
-    private Name declaringType;
-    private boolean isAutocreated;
-    private int onParentVersion;
-    private boolean isProtected;
-    private boolean isMandatory;
+    private Name name = NameConstants.ANY_NAME;
+    private Name declaringType = null;
+    private boolean isAutocreated = false;
+    private int onParentVersion = OnParentVersionAction.COPY;
+    private boolean isProtected = false;
+    private boolean isMandatory = false;
 
     /**
      * @param name  the name of the child item definition being build

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QNodeDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QNodeDefinitionBuilder.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QNodeDefinitionBuilder.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QNodeDefinitionBuilder.java Thu Sep 17 19:20:33 2009
@@ -16,13 +16,14 @@
  */
 package org.apache.jackrabbit.spi.commons.nodetype;
 
-import java.util.List;
-import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Set;
+import java.util.HashSet;
 
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.commons.QNodeDefinitionImpl;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 /**
  * A builder for a {@link QNodeDefinition}.
@@ -30,7 +31,7 @@
 public class QNodeDefinitionBuilder extends QItemDefinitionBuilder {
 
     private Name defaultPrimaryType;
-    private List<Name> requiredPrimaryTypes;
+    private Set<Name> requiredPrimaryTypes = new HashSet<Name>();
     private boolean allowsSameNameSiblings;
 
     /**
@@ -55,9 +56,6 @@
      * @param name the name of a required primary type.
      */
     public void addRequiredPrimaryType(Name name) {
-        if (requiredPrimaryTypes == null) {
-            requiredPrimaryTypes = new ArrayList<Name>();
-        }
         requiredPrimaryTypes.add(name);
     }
 
@@ -66,10 +64,9 @@
      *              definition being built.
      */
     public void setRequiredPrimaryTypes(Name[] names) {
-        if (names == null) {
-            requiredPrimaryTypes = null;
-        } else {
-            requiredPrimaryTypes = new ArrayList<Name>(Arrays.asList(names));
+        requiredPrimaryTypes.clear();
+        if (names != null) {
+            requiredPrimaryTypes.addAll(Arrays.asList(names));
         }
     }
 
@@ -78,8 +75,8 @@
      *         definition being built.
      */
     public Name[] getRequiredPrimaryTypes() {
-        if (requiredPrimaryTypes == null) {
-            return null;
+        if (requiredPrimaryTypes.isEmpty()) {
+            return new Name[]{NameConstants.NT_BASE};
         } else {
             return requiredPrimaryTypes.toArray(new Name[requiredPrimaryTypes.size()]);
         }
@@ -111,7 +108,10 @@
      *                               instance.
      */
     public QNodeDefinition build() throws IllegalStateException {
-        return new QNodeDefinitionImpl(getName(), getDeclaringNodeType(), getAutoCreated(), getMandatory(), getOnParentVersion(), getProtected(), getDefaultPrimaryType(), getRequiredPrimaryTypes(), getAllowsSameNameSiblings());
+        return new QNodeDefinitionImpl(getName(), getDeclaringNodeType(),
+                getAutoCreated(), getMandatory(), getOnParentVersion(),
+                getProtected(), getDefaultPrimaryType(),
+                getRequiredPrimaryTypes(), getAllowsSameNameSiblings());
     }
 
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QPropertyDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QPropertyDefinitionBuilder.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QPropertyDefinitionBuilder.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/QPropertyDefinitionBuilder.java Thu Sep 17 19:20:33 2009
@@ -21,6 +21,7 @@
 import java.util.Arrays;
 
 import javax.jcr.nodetype.PropertyDefinition;
+import javax.jcr.PropertyType;
 
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
@@ -33,10 +34,10 @@
  */
 public class QPropertyDefinitionBuilder extends QItemDefinitionBuilder {
 
-    private int requiredType;
+    private int requiredType = PropertyType.UNDEFINED;
     private List<QValueConstraint> valueConstraints = new ArrayList<QValueConstraint>();
     private List<QValue> defaultValues;
-    private boolean isMultiple;
+    private boolean isMultiple = false;
     private boolean fullTextSearchable = true;
     private boolean queryOrderable = true;
     private String[] queryOperators = Operator.getAllQueryOperators();

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeDefinitionImpl.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeDefinitionImpl.java Thu Sep 17 19:20:33 2009
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.Name;
 
 import javax.jcr.nodetype.NodeDefinition;
@@ -44,7 +45,7 @@
     QNodeDefinitionImpl(NodeDefinition nodeDef,
                         NamePathResolver resolver)
             throws NameException, NamespaceException {
-        super(nodeDef.getName().equals(ANY_NAME.getLocalName()) ? ANY_NAME : resolver.getQName(nodeDef.getName()),
+        super(nodeDef.getName().equals(NameConstants.ANY_NAME.getLocalName()) ? NameConstants.ANY_NAME : resolver.getQName(nodeDef.getName()),
                 nodeDef.getDeclaringNodeType() != null ? resolver.getQName(nodeDef.getDeclaringNodeType().getName()) : null,
                 nodeDef.isAutoCreated(), nodeDef.isMandatory(),
                 nodeDef.getOnParentVersion(), nodeDef.isProtected(),

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QPropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QPropertyDefinitionImpl.java?rev=816343&r1=816342&r2=816343&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QPropertyDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QPropertyDefinitionImpl.java Thu Sep 17 19:20:33 2009
@@ -18,19 +18,15 @@
 
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.QValueFactory;
-import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.QValueConstraint;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
-import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
 import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.PropertyType;
-import javax.jcr.NamespaceException;
 
 /**
  * <code>QPropertyDefinitionImpl</code> implements a property
@@ -53,7 +49,7 @@
                             NamePathResolver resolver,
                             QValueFactory qValueFactory)
             throws RepositoryException, NameException {
-        super(propDef.getName().equals(ANY_NAME.getLocalName()) ? ANY_NAME : resolver.getQName(propDef.getName()),
+        super(propDef.getName().equals(NameConstants.ANY_NAME.getLocalName()) ? NameConstants.ANY_NAME : resolver.getQName(propDef.getName()),
                 resolver.getQName(propDef.getDeclaringNodeType().getName()),
                 propDef.isAutoCreated(),
                 propDef.isMandatory(),
@@ -91,21 +87,4 @@
         }
         return defaultValues;
     }
-
-    /**
-     * Convert String jcr names to Name objects.
-     *
-     * @param aqos
-     * @param resolver
-     * @return
-     * @throws NamespaceException
-     * @throws IllegalNameException
-     */
-    private static Name[] convertQueryOperators(String[] aqos, NamePathResolver resolver) throws NamespaceException, IllegalNameException {
-        Name[] names = new Name[aqos.length];
-        for (int i = 0; i < aqos.length; i++) {
-            names[i] = resolver.getQName(aqos[i]);
-        }
-        return names;
-    }
 }



Mime
View raw message