jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r812419 [1/3] - in /jackrabbit/sandbox/JCR-2170: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/...
Date Tue, 08 Sep 2009 09:47:15 GMT
Author: mreutegg
Date: Tue Sep  8 09:47:13 2009
New Revision: 812419

URL: http://svn.apache.org/viewvc?rev=812419&view=rev
Log:
JCR-2170: Remove PropDefId and NodeDefId
- consolidate ItemDef/QItemDefinition, see JCR-2296

Removed:
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDef.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefImpl.java
Modified:
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java   (contents, props changed)
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefId.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/PropertyTypeRegistry.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DefaultProtectedPropertyImporter.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ProtectedPropertyImporter.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/CyclicNodeTypeRegistrationTest.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeDefinitionImpl.java
    jackrabbit/sandbox/JCR-2170/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QPropertyDefinitionImpl.java

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java Tue Sep  8 09:47:13 2009
@@ -18,7 +18,6 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Calendar;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -62,6 +61,9 @@
 import org.apache.jackrabbit.core.version.InternalVersionManager;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QItemDefinition;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
@@ -725,7 +727,7 @@
         // 4. node type constraints
 
         if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
-            NodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
+            QItemDefinition parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
             // make sure parent node is not protected
             if (parentDef.isProtected()) {
                 throw new ConstraintViolationException(
@@ -735,7 +737,7 @@
             // make sure there's an applicable definition for new child node
             EffectiveNodeType entParent = getEffectiveNodeType(parentState);
             entParent.checkAddNodeConstraints(nodeName, nodeTypeName, ntReg);
-            NodeDef newNodeDef =
+            QNodeDefinition newNodeDef =
                     findApplicableNodeDefinition(nodeName, nodeTypeName,
                             parentState);
 
@@ -756,7 +758,7 @@
                     log.debug(msg);
                     throw new RepositoryException(msg, ise);
                 }
-                NodeDef conflictingTargetDef =
+                QNodeDefinition conflictingTargetDef =
                         ntReg.getNodeDef(conflictingState.getDefinitionId());
                 // check same-name sibling setting of both target and existing node
                 if (!conflictingTargetDef.allowsSameNameSiblings()
@@ -900,12 +902,12 @@
         // 4. node type constraints
 
         if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
-            NodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
+            QItemDefinition parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
             if (parentDef.isProtected()) {
                 throw new ConstraintViolationException(safeGetJCRPath(parentId)
                         + ": cannot remove child node of protected parent node");
             }
-            NodeDef targetDef = ntReg.getNodeDef(targetState.getDefinitionId());
+            QItemDefinition targetDef = ntReg.getNodeDef(targetState.getDefinitionId());
             if (targetDef.isMandatory()) {
                 throw new ConstraintViolationException(safeGetJCRPath(targetPath)
                         + ": cannot remove mandatory node");
@@ -1265,7 +1267,7 @@
         if (genValues != null) {
             prop.setValues(genValues);
         } else if (def.getDefaultValues() != null) {
-            prop.setValues(def.getDefaultValues());
+            prop.setValues(InternalValue.create(def.getDefaultValues()));
         }
 
         // now add new property entry to parent
@@ -1442,7 +1444,7 @@
             throws PathNotFoundException, ConstraintViolationException,
             RepositoryException {
         NodeState node = getNodeState(nodePath);
-        NodeDef parentDef = ntReg.getNodeDef(node.getDefinitionId());
+        QItemDefinition parentDef = ntReg.getNodeDef(node.getDefinitionId());
         if (parentDef.isProtected()) {
             throw new ConstraintViolationException(safeGetJCRPath(nodePath)
                     + ": node is protected");
@@ -1774,7 +1776,7 @@
                  * todo FIXME delegate to 'node type instance handler'
                  */
                 PropDefId defId = srcChildState.getDefinitionId();
-                PropDef def = ntReg.getPropDef(defId);
+                QPropertyDefinition def = ntReg.getPropDef(defId);
                 if (def.getDeclaringNodeType().equals(NameConstants.MIX_LOCKABLE)) {
                     // skip properties defined by mix:lockable
                     continue;
@@ -1842,7 +1844,7 @@
             throws RepositoryException {
 
         PropDefId defId = srcState.getDefinitionId();
-        PropDef def = ntReg.getPropDef(defId);
+        QPropertyDefinition def = ntReg.getPropDef(defId);
 
         PropertyState newState = stateMgr.createNew(propName, parentId);
 

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Tue Sep  8 09:47:13 2009
@@ -48,12 +48,10 @@
 import org.apache.jackrabbit.core.id.ItemId;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
-import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeTypeConflictException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
-import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.apache.jackrabbit.core.nodetype.PropertyDefinitionImpl;
 import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.security.authorization.Permission;
@@ -69,6 +67,8 @@
 import org.apache.jackrabbit.core.version.InternalVersionManager;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
@@ -444,9 +444,9 @@
                 }
 
                 // mandatory child properties
-                PropDef[] pda = ent.getMandatoryPropDefs();
+                QPropertyDefinition[] pda = ent.getMandatoryPropDefs();
                 for (int i = 0; i < pda.length; i++) {
-                    PropDef pd = pda[i];
+                    QPropertyDefinition pd = pda[i];
                     if (pd.getDeclaringNodeType().equals(NameConstants.MIX_VERSIONABLE)
                             || pd.getDeclaringNodeType().equals(NameConstants.MIX_SIMPLE_VERSIONABLE)) {
                         /**
@@ -465,9 +465,9 @@
                     }
                 }
                 // mandatory child nodes
-                NodeDef[] cnda = ent.getMandatoryNodeDefs();
+                QItemDefinition[] cnda = ent.getMandatoryNodeDefs();
                 for (int i = 0; i < cnda.length; i++) {
-                    NodeDef cnd = cnda[i];
+                    QItemDefinition cnd = cnda[i];
                     if (!nodeState.hasChildNodeEntry(cnd.getName())) {
                         String msg = itemMgr.safeGetJCRPath(id)
                                 + ": mandatory child node " + cnd.getName()

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java Tue Sep  8 09:47:13 2009
@@ -43,6 +43,9 @@
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QItemDefinition;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -190,7 +193,7 @@
                 ntReg.getEffectiveNodeType(nodeState.getNodeTypeName());
         // effective node type (primary type incl. mixins)
         EffectiveNodeType entPrimaryAndMixins = getEffectiveNodeType(nodeState);
-        NodeDef def = ntReg.getNodeDef(nodeState.getDefinitionId());
+        QNodeDefinition def = ntReg.getNodeDef(nodeState.getDefinitionId());
 
         // check if primary type satisfies the 'required node types' constraint
         Name[] requiredPrimaryTypes = def.getRequiredPrimaryTypes();
@@ -204,9 +207,9 @@
             }
         }
         // mandatory properties
-        PropDef[] pda = entPrimaryAndMixins.getMandatoryPropDefs();
+        QPropertyDefinition[] pda = entPrimaryAndMixins.getMandatoryPropDefs();
         for (int i = 0; i < pda.length; i++) {
-            PropDef pd = pda[i];
+            QPropertyDefinition pd = pda[i];
             if (!nodeState.hasPropertyName(pd.getName())) {
                 String msg = safeGetJCRPath(nodeState.getNodeId())
                         + ": mandatory property " + pd.getName()
@@ -216,9 +219,9 @@
             }
         }
         // mandatory child nodes
-        NodeDef[] cnda = entPrimaryAndMixins.getMandatoryNodeDefs();
+        QItemDefinition[] cnda = entPrimaryAndMixins.getMandatoryNodeDefs();
         for (int i = 0; i < cnda.length; i++) {
-            NodeDef cnd = cnda[i];
+            QItemDefinition cnd = cnda[i];
             if (!nodeState.hasChildNodeEntry(cnd.getName())) {
                 String msg = safeGetJCRPath(nodeState.getNodeId())
                         + ": mandatory child node " + cnd.getName()
@@ -246,7 +249,7 @@
      */
     public void validate(PropertyState propState)
             throws ConstraintViolationException, RepositoryException {
-        PropDef def = ntReg.getPropDef(propState.getDefinitionId());
+        QPropertyDefinition def = ntReg.getPropDef(propState.getDefinitionId());
         InternalValue[] values = propState.getValues();
         int type = PropertyType.UNDEFINED;
         for (int i = 0; i < values.length; i++) {
@@ -515,7 +518,7 @@
      *                                      could be found
      * @throws RepositoryException          if another error occurs
      */
-    public PropDef findApplicablePropertyDefinition(Name name,
+    public QPropertyDefinition findApplicablePropertyDefinition(Name name,
                                                     int type,
                                                     NodeState parentState)
             throws RepositoryException, ConstraintViolationException {

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Tue Sep  8 09:47:13 2009
@@ -71,7 +71,6 @@
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
-import org.apache.jackrabbit.core.nodetype.ItemDef;
 import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.core.nodetype.NodeDefinitionImpl;
@@ -92,6 +91,7 @@
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
@@ -422,7 +422,7 @@
             InternalValue[] genValues = session.getNodeTypeInstanceHandler()
                     .computeSystemGeneratedPropertyValues(data.getNodeState(), propDef);
             if (genValues == null) {
-                genValues = propDef.getDefaultValues();
+                genValues = InternalValue.create(propDef.getDefaultValues());
             }
             if (genValues != null) {
                 propState.setValues(genValues);
@@ -3691,12 +3691,12 @@
             onRedefine(defId);
         }
 
-        Set<ItemDef> oldDefs = new HashSet<ItemDef>(Arrays.asList(entOld.getAllItemDefs()));
-        Set<ItemDef> newDefs = new HashSet<ItemDef>(Arrays.asList(entNew.getAllItemDefs()));
-        Set<ItemDef> allDefs = new HashSet<ItemDef>(Arrays.asList(entAll.getAllItemDefs()));
+        Set<QItemDefinition> oldDefs = new HashSet<QItemDefinition>(Arrays.asList(entOld.getAllItemDefs()));
+        Set<QItemDefinition> newDefs = new HashSet<QItemDefinition>(Arrays.asList(entNew.getAllItemDefs()));
+        Set<QItemDefinition> allDefs = new HashSet<QItemDefinition>(Arrays.asList(entAll.getAllItemDefs()));
 
         // added child item definitions
-        Set<ItemDef> addedDefs = new HashSet<ItemDef>(newDefs);
+        Set<QItemDefinition> addedDefs = new HashSet<QItemDefinition>(newDefs);
         addedDefs.removeAll(oldDefs);
 
         // referential integrity check
@@ -3832,8 +3832,8 @@
 
         // create items that are defined as auto-created by the new primary node
         // type and at the same time were not present with the old nt
-        for (Iterator<ItemDef> iter = addedDefs.iterator(); iter.hasNext();) {
-            ItemDef def = iter.next();
+        for (Iterator<QItemDefinition> iter = addedDefs.iterator(); iter.hasNext();) {
+            QItemDefinition def = iter.next();
             if (def.isAutoCreated()) {
                 if (def.definesNode()) {
                     NodeDefinitionImpl ndi = ntMgr.getNodeDefinition(((NodeDef) def).getId());

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java Tue Sep  8 09:47:13 2009
@@ -19,10 +19,10 @@
 import java.util.Calendar;
 import java.util.Set;
 
-import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 /**
@@ -60,7 +60,7 @@
      * @return the computed values
      */
     public InternalValue[] computeSystemGeneratedPropertyValues(NodeState parent, 
-                                                                PropDef def) {
+                                                                QPropertyDefinition def) {
 
         InternalValue[] genValues = null;
 

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java Tue Sep  8 09:47:13 2009
@@ -19,6 +19,9 @@
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QValueConstraint;
+import org.apache.jackrabbit.spi.QItemDefinition;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,9 +54,9 @@
     // (through inheritance) included node types.
     private final TreeSet<Name> allNodeTypes;
     // map of named item definitions (maps name to list of definitions)
-    private final HashMap<Name, List<ItemDef>> namedItemDefs;
+    private final HashMap<Name, List<QItemDefinition>> namedItemDefs;
     // list of unnamed item definitions (i.e. residual definitions)
-    private final ArrayList<ItemDef> unnamedItemDefs;
+    private final ArrayList<QItemDefinition> unnamedItemDefs;
 
     // flag indicating whether any included node type supports orderable child nodes
     private boolean orderableChildNodes;
@@ -67,8 +70,8 @@
         mergedNodeTypes = new TreeSet<Name>();
         inheritedNodeTypes = new TreeSet<Name>();
         allNodeTypes = new TreeSet<Name>();
-        namedItemDefs = new HashMap<Name, List<ItemDef>>();
-        unnamedItemDefs = new ArrayList<ItemDef>();
+        namedItemDefs = new HashMap<Name, List<QItemDefinition>>();
+        unnamedItemDefs = new ArrayList<QItemDefinition>();
         orderableChildNodes = false;
         primaryItemName = null;
     }
@@ -104,7 +107,7 @@
         // map of all item definitions (maps id to definition)
         // used to effectively detect ambiguous child definitions where
         // ambiguity is defined in terms of definition identity
-        HashMap<Object, ItemDef> itemDefIds = new HashMap<Object, ItemDef>();
+        HashMap<Object, QItemDefinition> itemDefIds = new HashMap<Object, QItemDefinition>();
 
         NodeDef[] cnda = ntd.getChildNodeDefs();
         for (NodeDef aCnda : cnda) {
@@ -130,9 +133,9 @@
             } else {
                 // named node definition
                 Name name = aCnda.getName();
-                List<ItemDef> defs = ent.namedItemDefs.get(name);
+                List<QItemDefinition> defs = ent.namedItemDefs.get(name);
                 if (defs == null) {
-                    defs = new ArrayList<ItemDef>();
+                    defs = new ArrayList<QItemDefinition>();
                     ent.namedItemDefs.put(name, defs);
                 }
                 if (defs.size() > 0) {
@@ -140,7 +143,7 @@
                      * there already exists at least one definition with that
                      * name; make sure none of them is auto-create
                      */
-                    for (ItemDef def : defs) {
+                    for (QItemDefinition def : defs) {
                         if (aCnda.isAutoCreated() || def.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions for '"
@@ -177,9 +180,9 @@
             } else {
                 // named property definition
                 Name name = aPda.getName();
-                List<ItemDef> defs = ent.namedItemDefs.get(name);
+                List<QItemDefinition> defs = ent.namedItemDefs.get(name);
                 if (defs == null) {
-                    defs = new ArrayList<ItemDef>();
+                    defs = new ArrayList<QItemDefinition>();
                     ent.namedItemDefs.put(name, defs);
                 }
                 if (defs.size() > 0) {
@@ -187,7 +190,7 @@
                      * there already exists at least one definition with that
                      * name; make sure none of them is auto-create
                      */
-                    for (ItemDef def : defs) {
+                    for (QItemDefinition def : defs) {
                         if (aPda.isAutoCreated() || def.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions for '"
@@ -276,52 +279,52 @@
         return allNodeTypes.toArray(new Name[allNodeTypes.size()]);
     }
 
-    public ItemDef[] getAllItemDefs() {
+    public QItemDefinition[] getAllItemDefs() {
         if (namedItemDefs.size() == 0 && unnamedItemDefs.size() == 0) {
-            return ItemDef.EMPTY_ARRAY;
+            return QItemDefinition.EMPTY_ARRAY;
         }
-        ArrayList<ItemDef> defs = new ArrayList<ItemDef>(namedItemDefs.size() + unnamedItemDefs.size());
-        for (List<ItemDef> itemDefs : namedItemDefs.values()) {
+        ArrayList<QItemDefinition> defs = new ArrayList<QItemDefinition>(namedItemDefs.size() + unnamedItemDefs.size());
+        for (List<QItemDefinition> itemDefs : namedItemDefs.values()) {
             defs.addAll(itemDefs);
         }
         defs.addAll(unnamedItemDefs);
         if (defs.size() == 0) {
-            return ItemDef.EMPTY_ARRAY;
+            return QItemDefinition.EMPTY_ARRAY;
         }
-        return defs.toArray(new ItemDef[defs.size()]);
+        return defs.toArray(new QItemDefinition[defs.size()]);
     }
 
-    public ItemDef[] getNamedItemDefs() {
+    public QItemDefinition[] getNamedItemDefs() {
         if (namedItemDefs.size() == 0) {
-            return ItemDef.EMPTY_ARRAY;
+            return QItemDefinition.EMPTY_ARRAY;
         }
-        ArrayList<ItemDef> defs = new ArrayList<ItemDef>(namedItemDefs.size());
-        for (List<ItemDef> itemDefs : namedItemDefs.values()) {
+        ArrayList<QItemDefinition> defs = new ArrayList<QItemDefinition>(namedItemDefs.size());
+        for (List<QItemDefinition> itemDefs : namedItemDefs.values()) {
             defs.addAll(itemDefs);
         }
         if (defs.size() == 0) {
-            return ItemDef.EMPTY_ARRAY;
+            return QItemDefinition.EMPTY_ARRAY;
         }
-        return defs.toArray(new ItemDef[defs.size()]);
+        return defs.toArray(new QItemDefinition[defs.size()]);
     }
 
-    public ItemDef[] getUnnamedItemDefs() {
+    public QItemDefinition[] getUnnamedItemDefs() {
         if (unnamedItemDefs.size() == 0) {
-            return ItemDef.EMPTY_ARRAY;
+            return QItemDefinition.EMPTY_ARRAY;
         }
-        return unnamedItemDefs.toArray(new ItemDef[unnamedItemDefs.size()]);
+        return unnamedItemDefs.toArray(new QItemDefinition[unnamedItemDefs.size()]);
     }
 
     public boolean hasNamedItemDef(Name name) {
         return namedItemDefs.containsKey(name);
     }
 
-    public ItemDef[] getNamedItemDefs(Name name) {
-        List<ItemDef> defs = namedItemDefs.get(name);
+    public QItemDefinition[] getNamedItemDefs(Name name) {
+        List<QItemDefinition> defs = namedItemDefs.get(name);
         if (defs == null || defs.size() == 0) {
-            return ItemDef.EMPTY_ARRAY;
+            return QItemDefinition.EMPTY_ARRAY;
         }
-        return defs.toArray(new ItemDef[defs.size()]);
+        return defs.toArray(new QItemDefinition[defs.size()]);
     }
 
     public NodeDef[] getAllNodeDefs() {
@@ -329,13 +332,13 @@
             return NodeDef.EMPTY_ARRAY;
         }
         ArrayList<NodeDef> defs = new ArrayList<NodeDef>(namedItemDefs.size() + unnamedItemDefs.size());
-        for (ItemDef def : unnamedItemDefs) {
+        for (QItemDefinition def : unnamedItemDefs) {
             if (def.definesNode()) {
                 defs.add((NodeDef) def);
             }
         }
-        for (List<ItemDef> list: namedItemDefs.values()) {
-            for (ItemDef def : list) {
+        for (List<QItemDefinition> list: namedItemDefs.values()) {
+            for (QItemDefinition def : list) {
                 if (def.definesNode()) {
                     defs.add((NodeDef) def);
                 }
@@ -347,13 +350,13 @@
         return defs.toArray(new NodeDef[defs.size()]);
     }
 
-    public NodeDef[] getNamedNodeDefs() {
+    public QItemDefinition[] getNamedNodeDefs() {
         if (namedItemDefs.size() == 0) {
             return NodeDef.EMPTY_ARRAY;
         }
         ArrayList<NodeDef> defs = new ArrayList<NodeDef>(namedItemDefs.size());
-        for (List<ItemDef> list : namedItemDefs.values()) {
-            for (ItemDef def : list) {
+        for (List<QItemDefinition> list : namedItemDefs.values()) {
+            for (QItemDefinition def : list) {
                 if (def.definesNode()) {
                     defs.add((NodeDef) def);
                 }
@@ -365,13 +368,13 @@
         return defs.toArray(new NodeDef[defs.size()]);
     }
 
-    public NodeDef[] getNamedNodeDefs(Name name) {
-        List<ItemDef> list = namedItemDefs.get(name);
+    public QItemDefinition[] getNamedNodeDefs(Name name) {
+        List<QItemDefinition> list = namedItemDefs.get(name);
         if (list == null || list.size() == 0) {
             return NodeDef.EMPTY_ARRAY;
         }
         ArrayList<NodeDef> defs = new ArrayList<NodeDef>(list.size());
-        for (ItemDef def : list) {
+        for (QItemDefinition def : list) {
             if (def.definesNode()) {
                 defs.add((NodeDef) def);
             }
@@ -387,7 +390,7 @@
             return NodeDef.EMPTY_ARRAY;
         }
         ArrayList<NodeDef> defs = new ArrayList<NodeDef>(unnamedItemDefs.size());
-        for (ItemDef def : unnamedItemDefs) {
+        for (QItemDefinition def : unnamedItemDefs) {
             if (def.definesNode()) {
                 defs.add((NodeDef) def);
             }
@@ -405,8 +408,8 @@
             return NodeDef.EMPTY_ARRAY;
         }
         ArrayList<NodeDef> defs = new ArrayList<NodeDef>(namedItemDefs.size());
-        for (List<ItemDef> list : namedItemDefs.values()) {
-            for (ItemDef def : list) {
+        for (List<QItemDefinition> list : namedItemDefs.values()) {
+            for (QItemDefinition def : list) {
                 if (def.definesNode() && def.isAutoCreated()) {
                     defs.add((NodeDef) def);
                 }
@@ -423,13 +426,13 @@
             return PropDef.EMPTY_ARRAY;
         }
         ArrayList<PropDef> defs = new ArrayList<PropDef>(namedItemDefs.size() + unnamedItemDefs.size());
-        for (ItemDef def : unnamedItemDefs) {
+        for (QItemDefinition def : unnamedItemDefs) {
             if (!def.definesNode()) {
                 defs.add((PropDef) def);
             }
         }
-        for (List<ItemDef> list: namedItemDefs.values()) {
-            for (ItemDef def : list) {
+        for (List<QItemDefinition> list: namedItemDefs.values()) {
+            for (QItemDefinition def : list) {
                 if (!def.definesNode()) {
                     defs.add((PropDef) def);
                 }
@@ -441,13 +444,13 @@
         return defs.toArray(new PropDef[defs.size()]);
     }
 
-    public PropDef[] getNamedPropDefs() {
+    public QPropertyDefinition[] getNamedPropDefs() {
         if (namedItemDefs.size() == 0) {
             return PropDef.EMPTY_ARRAY;
         }
         ArrayList<PropDef> defs = new ArrayList<PropDef>(namedItemDefs.size());
-        for (List<ItemDef> list : namedItemDefs.values()) {
-            for (ItemDef def : list) {
+        for (List<QItemDefinition> list : namedItemDefs.values()) {
+            for (QItemDefinition def : list) {
                 if (!def.definesNode()) {
                     defs.add((PropDef) def);
                 }
@@ -460,12 +463,12 @@
     }
 
     public PropDef[] getNamedPropDefs(Name name) {
-        List<ItemDef> list = namedItemDefs.get(name);
+        List<QItemDefinition> list = namedItemDefs.get(name);
         if (list == null || list.size() == 0) {
             return PropDef.EMPTY_ARRAY;
         }
         ArrayList<PropDef> defs = new ArrayList<PropDef>(list.size());
-        for (ItemDef def : list) {
+        for (QItemDefinition def : list) {
             if (!def.definesNode()) {
                 defs.add((PropDef) def);
             }
@@ -481,7 +484,7 @@
             return PropDef.EMPTY_ARRAY;
         }
         ArrayList<PropDef> defs = new ArrayList<PropDef>(unnamedItemDefs.size());
-        for (ItemDef def : unnamedItemDefs) {
+        for (QItemDefinition def : unnamedItemDefs) {
             if (!def.definesNode()) {
                 defs.add((PropDef) def);
             }
@@ -499,8 +502,8 @@
             return PropDef.EMPTY_ARRAY;
         }
         ArrayList<PropDef> defs = new ArrayList<PropDef>(namedItemDefs.size());
-        for (List<ItemDef> list : namedItemDefs.values()) {
-            for (ItemDef def : list) {
+        for (List<QItemDefinition> list : namedItemDefs.values()) {
+            for (QItemDefinition def : list) {
                 if (!def.definesNode() && def.isAutoCreated()) {
                     defs.add((PropDef) def);
                 }
@@ -519,8 +522,8 @@
             return PropDef.EMPTY_ARRAY;
         }
         ArrayList<PropDef> defs = new ArrayList<PropDef>(namedItemDefs.size());
-        for (List<ItemDef> list : namedItemDefs.values()) {
-            for (ItemDef def : list) {
+        for (List<QItemDefinition> list : namedItemDefs.values()) {
+            for (QItemDefinition def : list) {
                 if (!def.definesNode() && def.isMandatory()) {
                     defs.add((PropDef) def);
                 }
@@ -539,8 +542,8 @@
             return NodeDef.EMPTY_ARRAY;
         }
         ArrayList<NodeDef> defs = new ArrayList<NodeDef>(namedItemDefs.size());
-        for (List<ItemDef> list : namedItemDefs.values()) {
-            for (ItemDef def : list) {
+        for (List<QItemDefinition> list : namedItemDefs.values()) {
+            for (QItemDefinition def : list) {
                 if (def.definesNode() && def.isMandatory()) {
                     defs.add((NodeDef) def);
                 }
@@ -591,7 +594,7 @@
      *                                      by the the specified values
      * @throws RepositoryException          if another error occurs
      */
-    public static void checkSetPropertyValueConstraints(PropDef pd,
+    public static void checkSetPropertyValueConstraints(QPropertyDefinition pd,
                                                         InternalValue[] values)
             throws ConstraintViolationException, RepositoryException {
         // check multi-value flag
@@ -661,7 +664,7 @@
                 throw new ConstraintViolationException(nodeTypeName + " is mixin.");
             }
         }
-        NodeDef nd = getApplicableChildNodeDef(name, nodeTypeName, ntReg);
+        QItemDefinition nd = getApplicableChildNodeDef(name, nodeTypeName, ntReg);
         if (nd.isProtected()) {
             throw new ConstraintViolationException(name + " is protected");
         }
@@ -694,8 +697,8 @@
         }
 
         // try named node definitions first
-        ItemDef[] defs = getNamedItemDefs(name);
-        for (ItemDef def : defs) {
+        QItemDefinition[] defs = getNamedItemDefs(name);
+        for (QItemDefinition def : defs) {
             if (def.definesNode()) {
                 NodeDef nd = (NodeDef) def;
                 Name[] types = nd.getRequiredPrimaryTypes();
@@ -886,9 +889,9 @@
          * as there might be multiple definitions with the same name and we
          * don't know which one is applicable, we check all of them
          */
-        ItemDef[] defs = getNamedItemDefs(name);
+        QItemDefinition[] defs = getNamedItemDefs(name);
         if (defs != null) {
-            for (ItemDef def : defs) {
+            for (QItemDefinition def : defs) {
                 if (def.isMandatory()) {
                     throw new ConstraintViolationException("can't remove mandatory item");
                 }
@@ -908,9 +911,9 @@
          * as there might be multiple definitions with the same name and we
          * don't know which one is applicable, we check all of them
          */
-        ItemDef[] defs = getNamedNodeDefs(name);
+        QItemDefinition[] defs = getNamedNodeDefs(name);
         if (defs != null) {
-            for (ItemDef def : defs) {
+            for (QItemDefinition def : defs) {
                 if (def.isMandatory()) {
                     throw new ConstraintViolationException("can't remove mandatory node");
                 }
@@ -930,9 +933,9 @@
          * as there might be multiple definitions with the same name and we
          * don't know which one is applicable, we check all of them
          */
-        ItemDef[] defs = getNamedPropDefs(name);
+        QItemDefinition[] defs = getNamedPropDefs(name);
         if (defs != null) {
-            for (ItemDef def : defs) {
+            for (QItemDefinition def : defs) {
                 if (def.isMandatory()) {
                     throw new ConstraintViolationException("can't remove mandatory property");
                 }
@@ -992,18 +995,18 @@
         }
 
         // named item definitions
-        ItemDef[] defs = other.getNamedItemDefs();
-        for (ItemDef def : defs) {
+        QItemDefinition[] defs = other.getNamedItemDefs();
+        for (QItemDefinition def : defs) {
             if (includesNodeType(def.getDeclaringNodeType())) {
                 // ignore redundant definitions
                 continue;
             }
             Name name = def.getName();
-            List<ItemDef> existingDefs = namedItemDefs.get(name);
+            List<QItemDefinition> existingDefs = namedItemDefs.get(name);
             if (existingDefs != null) {
                 if (existingDefs.size() > 0) {
                     // there already exists at least one definition with that name
-                    for (ItemDef existingDef : existingDefs) {
+                    for (QItemDefinition existingDef : existingDefs) {
                         // make sure none of them is auto-create
                         if (def.isAutoCreated() || existingDef.isAutoCreated()) {
                             // conflict
@@ -1020,8 +1023,8 @@
                         if (def.definesNode() == existingDef.definesNode()) {
                             if (!def.definesNode()) {
                                 // property definition
-                                PropDef pd = (PropDef) def;
-                                PropDef epd = (PropDef) existingDef;
+                                QPropertyDefinition pd = (QPropertyDefinition) def;
+                                QPropertyDefinition epd = (QPropertyDefinition) existingDef;
                                 // compare type & multiValued flag
                                 if (pd.getRequiredType() == epd.getRequiredType()
                                         && pd.isMultiple() == epd.isMultiple()) {
@@ -1051,7 +1054,7 @@
                     }
                 }
             } else {
-                existingDefs = new ArrayList<ItemDef>();
+                existingDefs = new ArrayList<QItemDefinition>();
                 namedItemDefs.put(name, existingDefs);
             }
             existingDefs.add(def);
@@ -1059,18 +1062,18 @@
 
         // residual item definitions
         defs = other.getUnnamedItemDefs();
-        for (ItemDef def : defs) {
+        for (QItemDefinition def : defs) {
             if (includesNodeType(def.getDeclaringNodeType())) {
                 // ignore redundant definitions
                 continue;
             }
-            for (ItemDef existing : unnamedItemDefs) {
+            for (QItemDefinition existing : unnamedItemDefs) {
                 // compare with existing definition
                 if (def.definesNode() == existing.definesNode()) {
                     if (!def.definesNode()) {
                         // property definition
-                        PropDef pd = (PropDef) def;
-                        PropDef epd = (PropDef) existing;
+                        QPropertyDefinition pd = (QPropertyDefinition) def;
+                        QPropertyDefinition epd = (QPropertyDefinition) existing;
                         // compare type & multiValued flag
                         if (pd.getRequiredType() == epd.getRequiredType()
                                 && pd.isMultiple() == epd.isMultiple()) {
@@ -1085,8 +1088,8 @@
                         }
                     } else {
                         // child node definition
-                        NodeDef nd = (NodeDef) def;
-                        NodeDef end = (NodeDef) existing;
+                        QNodeDefinition nd = (QNodeDefinition) def;
+                        QNodeDefinition end = (QNodeDefinition) existing;
                         // compare required & default primary types
                         if (Arrays.equals(nd.getRequiredPrimaryTypes(), end.getRequiredPrimaryTypes())
                                 && (nd.getDefaultPrimaryType() == null
@@ -1146,8 +1149,8 @@
         clone.inheritedNodeTypes.addAll(inheritedNodeTypes);
         clone.allNodeTypes.addAll(allNodeTypes);
         for (Name name : namedItemDefs.keySet()) {
-            List<ItemDef> list = namedItemDefs.get(name);
-            clone.namedItemDefs.put(name, new ArrayList<ItemDef>(list));
+            List<QItemDefinition> list = namedItemDefs.get(name);
+            clone.namedItemDefs.put(name, new ArrayList<QItemDefinition>(list));
         }
         clone.unnamedItemDefs.addAll(unnamedItemDefs);
         clone.orderableChildNodes = orderableChildNodes;

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ItemDefinitionImpl.java Tue Sep  8 09:47:13 2009
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QItemDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -28,7 +29,7 @@
 
 /**
  * This class implements the <code>ItemDefinition</code> interface.
- * All method calls are delegated to the wrapped {@link ItemDef},
+ * All method calls are delegated to the wrapped {@link QItemDefinition},
  * performing the translation from <code>Name</code>s to JCR names
  * (and vice versa) where necessary.
  */
@@ -58,7 +59,7 @@
     /**
      * The wrapped item definition.
      */
-    protected final ItemDef itemDef;
+    protected final QItemDefinition itemDef;
 
     /**
      * Package private constructor
@@ -67,7 +68,7 @@
      * @param ntMgr      node type manager
      * @param resolver   name resolver
      */
-    ItemDefinitionImpl(ItemDef itemDef, NodeTypeManagerImpl ntMgr,
+    ItemDefinitionImpl(QItemDefinition itemDef, NodeTypeManagerImpl ntMgr,
                        NamePathResolver resolver) {
         this.itemDef = itemDef;
         this.ntMgr = ntMgr;

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDef.java Tue Sep  8 09:47:13 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 
 /**
  * <code>NodeDef</code> is the internal representation of
@@ -25,7 +25,7 @@
  *
  * @see javax.jcr.nodetype.NodeDefinition
  */
-public interface NodeDef extends ItemDef {
+public interface NodeDef extends QNodeDefinition {
 
     NodeDef[] EMPTY_ARRAY = new NodeDef[0];
 
@@ -35,25 +35,4 @@
      * @return an identifier for this node definition.
      */
     NodeDefId getId();
-
-    /**
-     * Returns the name of the default primary type.
-     *
-     * @return the name of the default primary type.
-     */
-    Name getDefaultPrimaryType();
-
-    /**
-     * Returns the array of names of the required primary types.
-     *
-     * @return the array of names of the required primary types.
-     */
-    Name[] getRequiredPrimaryTypes();
-
-    /**
-     * Reports whether this node can have same-name siblings.
-     *
-     * @return the 'allowsSameNameSiblings' flag.
-     */
-    boolean allowsSameNameSiblings();
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefId.java Tue Sep  8 09:47:13 2009
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.nodetype;
 
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 
 import java.io.Serializable;
 import java.util.Arrays;
@@ -45,7 +46,7 @@
      *
      * @param def <code>NodeDef</code> to create identifier for
      */
-    NodeDefId(NodeDef def) {
+    NodeDefId(QNodeDefinition def) {
         if (def == null) {
             throw new IllegalArgumentException("NodeDef argument can not be null");
         }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefImpl.java Tue Sep  8 09:47:13 2009
@@ -18,33 +18,13 @@
 
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeDefinition;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.QNodeDefinitionImpl;
 
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
 /**
  * This class implements the <code>NodeDef</code> interface and additionally
  * provides setter methods for the various node definition attributes.
  */
-public class NodeDefImpl extends ItemDefImpl implements NodeDef {
-
-    /**
-     * The name of the default primary type.
-     */
-    private Name defaultPrimaryType;
-
-    /**
-     * The names of the required primary types.
-     */
-    private Set<Name> requiredPrimaryTypes;
-
-    /**
-     * The 'allowsSameNameSiblings' flag.
-     */
-    private boolean allowsSameNameSiblings;
+public class NodeDefImpl extends QNodeDefinitionImpl implements NodeDef {
 
     /**
      * The identifier of this node definition. The identifier is lazily computed
@@ -57,40 +37,16 @@
      * Default constructor.
      */
     public NodeDefImpl() {
-        defaultPrimaryType = null;
-        requiredPrimaryTypes = new HashSet<Name>();
-        requiredPrimaryTypes.add(NameConstants.NT_BASE);
-        allowsSameNameSiblings = false;
+        super();
         id = null;
     }
 
     public NodeDefImpl(QNodeDefinition nd) {
         super(nd);
-        defaultPrimaryType = nd.getDefaultPrimaryType();
-        requiredPrimaryTypes = new HashSet<Name>(Arrays.asList(nd.getRequiredPrimaryTypes()));
-        allowsSameNameSiblings = nd.allowsSameNameSiblings();
         id = null;
     }
 
     /**
-     * Returns the QNodeDefinition for this NodeDef
-     * @return the QNodeDefinition
-     */
-    public QNodeDefinition getQNodeDefinition() {
-        return new QNodeDefinitionImpl(
-                getName(),
-                getDeclaringNodeType(),
-                isAutoCreated(),
-                isMandatory(),
-                getOnParentVersion(),
-                isProtected(),
-                getDefaultPrimaryType(),
-                getRequiredPrimaryTypes(),
-                allowsSameNameSiblings()
-        );
-    }
-
-    /**
      * Sets the name of default primary type.
      *
      * @param defaultNodeType
@@ -98,7 +54,7 @@
     public void setDefaultPrimaryType(Name defaultNodeType) {
         // reset id field in order to force lazy recomputation of identifier
         id = null;
-        this.defaultPrimaryType = defaultNodeType;
+        super.setDefaultPrimaryType(defaultNodeType);
     }
 
     /**
@@ -107,13 +63,9 @@
      * @param requiredPrimaryTypes
      */
     public void setRequiredPrimaryTypes(Name[] requiredPrimaryTypes) {
-        if (requiredPrimaryTypes == null) {
-            throw new IllegalArgumentException("requiredPrimaryTypes can not be null");
-        }
         // reset id field in order to force lazy recomputation of identifier
         id = null;
-        this.requiredPrimaryTypes.clear();
-        this.requiredPrimaryTypes.addAll(Arrays.asList(requiredPrimaryTypes));
+        super.setRequiredPrimaryTypes(requiredPrimaryTypes);
     }
 
     /**
@@ -124,7 +76,7 @@
     public void setAllowsSameNameSiblings(boolean allowsSameNameSiblings) {
         // reset id field in order to force lazy recomputation of identifier
         id = null;
-        this.allowsSameNameSiblings = allowsSameNameSiblings;
+        super.setAllowsSameNameSiblings(allowsSameNameSiblings);
     }
 
     //------------------------------------------------< ItemDefImpl overrides >
@@ -197,77 +149,4 @@
         }
         return id;
     }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Name getDefaultPrimaryType() {
-        return defaultPrimaryType;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Name[] getRequiredPrimaryTypes() {
-        if (requiredPrimaryTypes.isEmpty()) {
-            return Name.EMPTY_ARRAY;
-        }
-        return requiredPrimaryTypes.toArray(
-                new Name[requiredPrimaryTypes.size()]);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean allowsSameNameSiblings() {
-        return allowsSameNameSiblings;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return always <code>true</code>
-     */
-    public boolean definesNode() {
-        return true;
-    }
-
-    //-------------------------------------------< java.lang.Object overrides >
-    /**
-     * Compares two node definitions for equality. Returns <code>true</code>
-     * if the given object is a node defintion and has the same attributes
-     * as this node definition.
-     *
-     * @param obj the object to compare this node definition with
-     * @return <code>true</code> if the object is equal to this node definition,
-     *         <code>false</code> otherwise
-     * @see Object#equals(Object)
-     */
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof NodeDefImpl) {
-            NodeDefImpl other = (NodeDefImpl) obj;
-            return super.equals(obj)
-                    && requiredPrimaryTypes.equals(other.requiredPrimaryTypes)
-                    && (defaultPrimaryType == null
-                            ? other.defaultPrimaryType == null
-                            : defaultPrimaryType.equals(other.defaultPrimaryType))
-                    && allowsSameNameSiblings == other.allowsSameNameSiblings;
-        }
-        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;
-    }
-
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionImpl.java Tue Sep  8 09:47:13 2009
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.core.nodetype;
 
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QItemDefinition;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.slf4j.Logger;
@@ -47,7 +49,7 @@
      * @param ntMgr      node type manager
      * @param resolver   name resolver
      */
-    NodeDefinitionImpl(NodeDef nodeDef, NodeTypeManagerImpl ntMgr,
+    NodeDefinitionImpl(QItemDefinition nodeDef, NodeTypeManagerImpl ntMgr,
                        NamePathResolver resolver) {
         super(nodeDef, ntMgr, resolver);
     }
@@ -66,7 +68,7 @@
      * {@inheritDoc}
      */
     public NodeType getDefaultPrimaryType() {
-        Name ntName = ((NodeDef) itemDef).getDefaultPrimaryType();
+        Name ntName = ((QNodeDefinition) itemDef).getDefaultPrimaryType();
         if (ntName == null) {
             return null;
         }
@@ -89,7 +91,7 @@
         if (ntMgr == null) {
             return null;
         }
-        Name[] ntNames = ((NodeDef) itemDef).getRequiredPrimaryTypes();
+        Name[] ntNames = ((QNodeDefinition) itemDef).getRequiredPrimaryTypes();
         try {
             if (ntNames == null || ntNames.length == 0) {
                 // return "nt:base"
@@ -112,7 +114,7 @@
      * {@inheritDoc}
      */
     public boolean allowsSameNameSiblings() {
-        return ((NodeDef) itemDef).allowsSameNameSiblings();
+        return ((QNodeDefinition) itemDef).allowsSameNameSiblings();
     }
 
     //--------------------------------------------------< new JSR 283 methods >
@@ -134,7 +136,7 @@
      * @since JCR 2.0
      */
     public String[] getRequiredPrimaryTypeNames() {
-        Name[] ntNames = ((NodeDef) itemDef).getRequiredPrimaryTypes();
+        Name[] ntNames = ((QNodeDefinition) itemDef).getRequiredPrimaryTypes();
         try {
             if (ntNames == null || ntNames.length == 0) {
                 // return "nt:base"
@@ -170,7 +172,7 @@
      * @since JCR 2.0
      */
     public String getDefaultPrimaryTypeName() {
-        Name ntName = ((NodeDef) itemDef).getDefaultPrimaryType();
+        Name ntName = ((QNodeDefinition) itemDef).getDefaultPrimaryType();
         if (ntName == null) {
             return null;
         }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java Tue Sep  8 09:47:13 2009
@@ -101,17 +101,6 @@
      * @return the QNodeTypeDefintion
      */
     public QNodeTypeDefinition getQNodeTypeDefinition() {
-        QNodeDefinition[] qNodeDefs = new QNodeDefinition[nodeDefs.size()];
-        int i=0;
-        for (NodeDef nd: nodeDefs) {
-            qNodeDefs[i++] = ((NodeDefImpl) nd).getQNodeDefinition();
-        }
-        QPropertyDefinition[] qPropDefs = new QPropertyDefinition[propDefs.size()];
-        i=0;
-        for (PropDef pd: propDefs) {
-            qPropDefs[i++] = ((PropDefImpl) pd).getQPropertyDefinition();
-        }
-
         return new QNodeTypeDefinitionImpl(
                 getName(),
                 getSupertypes(),
@@ -121,8 +110,8 @@
                 isQueryable(),
                 hasOrderableChildNodes(),
                 getPrimaryItemName(),
-                qPropDefs,
-                qNodeDefs
+                propDefs.toArray(new QPropertyDefinition[propDefs.size()]),
+                nodeDefs.toArray(new QNodeDefinition[nodeDefs.size()])
         );
     }
 
@@ -144,7 +133,7 @@
             // supertypes
             dependencies.addAll(Arrays.asList(supertypes));
             // child node definitions
-            for (NodeDef nd: nodeDefs) {
+            for (QNodeDefinition nd: nodeDefs) {
                 // default primary type
                 Name ntName = nd.getDefaultPrimaryType();
                 if (ntName != null && !name.equals(ntName)) {
@@ -159,7 +148,7 @@
                 }
             }
             // property definitions
-            for (PropDef pd : propDefs) {
+            for (QPropertyDefinition pd : propDefs) {
                 // [WEAK]REFERENCE value constraints
                 if (pd.getRequiredType() == PropertyType.REFERENCE
                         || pd.getRequiredType() == PropertyType.WEAKREFERENCE) {

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java Tue Sep  8 09:47:13 2009
@@ -27,6 +27,9 @@
 import javax.jcr.PropertyType;
 
 import org.apache.jackrabbit.spi.QValueConstraint;
+import org.apache.jackrabbit.spi.QItemDefinition;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 
 /**
  * A <code>NodeTypeDefDiff</code> represents the result of the comparison of
@@ -269,8 +272,8 @@
         while (iter.hasNext()) {
             Map.Entry entry = (Map.Entry) iter.next();
             PropDefId id = (PropDefId) entry.getKey();
-            PropDef def1 = (PropDef) entry.getValue();
-            PropDef def2 = (PropDef) defs2.get(id);
+            QPropertyDefinition def1 = (QPropertyDefinition) entry.getValue();
+            QPropertyDefinition def2 = (QPropertyDefinition) defs2.get(id);
             PropDefDiff diff = new PropDefDiff(def1, def2);
             if (diff.getType() > maxType) {
                 maxType = diff.getType();
@@ -287,7 +290,7 @@
         while (iter.hasNext()) {
             Map.Entry entry = (Map.Entry) iter.next();
             PropDefId id = (PropDefId) entry.getKey();
-            PropDef def = (PropDef) entry.getValue();
+            QPropertyDefinition def = (QPropertyDefinition) entry.getValue();
             PropDefDiff diff = new PropDefDiff(null, def);
             if (diff.getType() > maxType) {
                 maxType = diff.getType();
@@ -328,8 +331,8 @@
         while (iter.hasNext()) {
             Map.Entry entry = (Map.Entry) iter.next();
             NodeDefId id = (NodeDefId) entry.getKey();
-            NodeDef def1 = (NodeDef) entry.getValue();
-            NodeDef def2 = (NodeDef) defs2.get(id);
+            QItemDefinition def1 = (QItemDefinition) entry.getValue();
+            QItemDefinition def2 = (QItemDefinition) defs2.get(id);
             ChildNodeDefDiff diff = new ChildNodeDefDiff(def1, def2);
             if (diff.getType() > maxType) {
                 maxType = diff.getType();
@@ -346,7 +349,7 @@
         while (iter.hasNext()) {
             Map.Entry entry = (Map.Entry) iter.next();
             NodeDefId id = (NodeDefId) entry.getKey();
-            NodeDef def = (NodeDef) entry.getValue();
+            QItemDefinition def = (QItemDefinition) entry.getValue();
             ChildNodeDefDiff diff = new ChildNodeDefDiff(null, def);
             if (diff.getType() > maxType) {
                 maxType = diff.getType();
@@ -408,11 +411,11 @@
     //--------------------------------------------------------< inner classes >
 
     abstract class ChildItemDefDiff {
-        protected final ItemDef oldDef;
-        protected final ItemDef newDef;
+        protected final QItemDefinition oldDef;
+        protected final QItemDefinition newDef;
         protected int type;
 
-        ChildItemDefDiff(ItemDef oldDef, ItemDef newDef) {
+        ChildItemDefDiff(QItemDefinition oldDef, QItemDefinition newDef) {
             this.oldDef = oldDef;
             this.newDef = newDef;
             init();
@@ -495,7 +498,7 @@
                 operationString = "NONE";
             }
 
-            ItemDef itemDefinition = (oldDef != null) ? oldDef : newDef;
+            QItemDefinition itemDefinition = (oldDef != null) ? oldDef : newDef;
 
             return getClass().getName() + "[itemName="
                     + itemDefinition.getName() + ", type=" + typeString
@@ -506,16 +509,16 @@
 
     public class PropDefDiff extends ChildItemDefDiff {
 
-        PropDefDiff(PropDef oldDef, PropDef newDef) {
+        PropDefDiff(QPropertyDefinition oldDef, QPropertyDefinition newDef) {
             super(oldDef, newDef);
         }
 
-        public PropDef getOldDef() {
-            return (PropDef) oldDef;
+        public QPropertyDefinition getOldDef() {
+            return (QPropertyDefinition) oldDef;
         }
 
-        public PropDef getNewDef() {
-            return (PropDef) newDef;
+        public QPropertyDefinition getNewDef() {
+            return (QPropertyDefinition) newDef;
         }
 
         protected void init() {
@@ -584,16 +587,16 @@
 
     public class ChildNodeDefDiff extends ChildItemDefDiff {
 
-        ChildNodeDefDiff(NodeDef oldDef, NodeDef newDef) {
+        ChildNodeDefDiff(QItemDefinition oldDef, QItemDefinition newDef) {
             super(oldDef, newDef);
         }
 
-        public NodeDef getOldDef() {
-            return (NodeDef) oldDef;
+        public QNodeDefinition getOldDef() {
+            return (QNodeDefinition) oldDef;
         }
 
-        public NodeDef getNewDef() {
-            return (NodeDef) newDef;
+        public QNodeDefinition getNewDef() {
+            return (QNodeDefinition) newDef;
         }
 
         protected void init() {

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java Tue Sep  8 09:47:13 2009
@@ -18,6 +18,8 @@
 
 import javax.jcr.nodetype.NodeTypeDefinition;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -163,7 +165,7 @@
      * {@inheritDoc}
      */
     public NodeDefinition[] getDeclaredChildNodeDefinitions() {
-        NodeDef[] cnda = ntd.getChildNodeDefs();
+        QItemDefinition[] cnda = ntd.getChildNodeDefs();
         NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length];
         for (int i = 0; i < cnda.length; i++) {
             nodeDefs[i] = new NodeDefinitionImpl(cnda[i], null, resolver);
@@ -175,7 +177,7 @@
      * {@inheritDoc}
      */
     public PropertyDefinition[] getDeclaredPropertyDefinitions() {
-        PropDef[] pda = ntd.getPropertyDefs();
+        QPropertyDefinition[] pda = ntd.getPropertyDefs();
         PropertyDefinition[] propDefs = new PropertyDefinition[pda.length];
         for (int i = 0; i < pda.length; i++) {
             propDefs[i] = new PropertyDefinitionImpl(pda[i], null, resolver, valueFactory);

Propchange: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefinitionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java Tue Sep  8 09:47:13 2009
@@ -34,6 +34,7 @@
 import org.apache.jackrabbit.core.data.DataStore;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.nodetype.AbstractNodeType;
@@ -427,7 +428,7 @@
         }
         try {
             Name name = resolver.getQName(propertyName);
-            PropDef def;
+            QPropertyDefinition def;
             try {
                 // try to get definition that matches the given value type
                 def = ent.getApplicablePropertyDef(name, value.getType(), false);
@@ -498,7 +499,7 @@
                     return false;
                 }
             }
-            PropDef def;
+            QPropertyDefinition def;
             try {
                 // try to get definition that matches the given value type
                 def = ent.getApplicablePropertyDef(name, type, true);

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java Tue Sep  8 09:47:13 2009
@@ -59,6 +59,8 @@
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.QValueConstraint;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
@@ -67,6 +69,7 @@
 import org.apache.jackrabbit.spi.commons.nodetype.compact.CompactNodeTypeDefReader;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
@@ -161,7 +164,7 @@
         synchronized (ndCache) {
             NodeDefinitionImpl ndi = ndCache.get(id);
             if (ndi == null) {
-                NodeDef nd = ntReg.getNodeDef(id);
+                QItemDefinition nd = ntReg.getNodeDef(id);
                 if (nd != null) {
                     ndi = new NodeDefinitionImpl(nd, this, session);
                     ndCache.put(id, ndi);
@@ -179,7 +182,7 @@
         synchronized (pdCache) {
             PropertyDefinitionImpl pdi = pdCache.get(id);
             if (pdi == null) {
-                PropDef pd = ntReg.getPropDef(id);
+                QPropertyDefinition pd = ntReg.getPropDef(id);
                 if (pd != null) {
                     pdi = new PropertyDefinitionImpl(pd, this, session, valueFactory);
                     pdCache.put(id, pdi);
@@ -700,7 +703,7 @@
                 name = ndefs[i].getName();
                 if (name != null) {
                     if (name.equals("*")) {
-                        qndef.setName(ItemDef.ANY_NAME);
+                        qndef.setName(NameConstants.ANY_NAME);
                     } else {
                         try {
                             qndef.setName(session.getQName(name));
@@ -760,7 +763,7 @@
                 name = pdefs[i].getName();
                 if (name != null) {
                     if (name.equals("*")) {
-                        qpdef.setName(ItemDef.ANY_NAME);
+                        qpdef.setName(NameConstants.ANY_NAME);
                     } else {
                         try {
                             qpdef.setName(session.getQName(name));

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java Tue Sep  8 09:47:13 2009
@@ -47,9 +47,11 @@
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
 import org.apache.jackrabbit.core.util.Dumpable;
-import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QValueConstraint;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.slf4j.Logger;
@@ -69,8 +71,6 @@
     private static final String CUSTOM_NODETYPES_RESOURCE_NAME =
             "custom_nodetypes.xml";
 
-    // file system where node type registrations are persisted
-    private final FileSystem ntStore;
     /**
      * resource holding custom node type definitions which are represented as
      * nodes in the repository; it is needed in order to make the registrations
@@ -561,7 +561,7 @@
      * @param id node def id
      * @return the node definition for the given id.
      */
-    public NodeDef getNodeDef(NodeDefId id) {
+    public QNodeDefinition getNodeDef(NodeDefId id) {
         return nodeDefs.get(id);
     }
 
@@ -633,12 +633,12 @@
                     }
                 }
                 ps.println("\t\tValueConstraints\t" + constraints.toString());
-                InternalValue[] defVals = aPd.getDefaultValues();
+                QValue[] defVals = aPd.getDefaultValues();
                 StringBuffer defaultValues = new StringBuffer();
                 if (defVals == null) {
                     defaultValues.append("<null>");
                 } else {
-                    for (InternalValue defVal : defVals) {
+                    for (QValue defVal : defVals) {
                         if (defaultValues.length() > 0) {
                             defaultValues.append(", ");
                         }
@@ -721,9 +721,8 @@
     protected NodeTypeRegistry(NamespaceRegistry nsReg, FileSystem ntStore)
             throws RepositoryException {
         this.nsReg = nsReg;
-        this.ntStore = ntStore;
         customNodeTypesResource =
-                new FileSystemResource(this.ntStore, CUSTOM_NODETYPES_RESOURCE_NAME);
+                new FileSystemResource(ntStore, CUSTOM_NODETYPES_RESOURCE_NAME);
         try {
             // make sure path to resource exists
             if (!customNodeTypesResource.exists()) {
@@ -1183,8 +1182,8 @@
             }
         }
 
-        NodeDef[] nodeDefs = childNodeENT.getAutoCreateNodeDefs();
-        for (NodeDef nodeDef : nodeDefs) {
+        QNodeDefinition[] nodeDefs = childNodeENT.getAutoCreateNodeDefs();
+        for (QNodeDefinition nodeDef : nodeDefs) {
             Name dnt = nodeDef.getDefaultPrimaryType();
             Name definingNT = nodeDef.getDeclaringNodeType();
             try {
@@ -1525,8 +1524,8 @@
         checkNamespace(ntd.getPrimaryItemName(), nsReg);
 
         // validate property definitions
-        PropDef[] pda = ntd.getPropertyDefs();
-        for (PropDef pd : pda) {
+        QPropertyDefinition[] pda = ntd.getPropertyDefs();
+        for (QPropertyDefinition pd : pda) {
             /**
              * sanity check:
              * make sure declaring node type matches name of node type definition
@@ -1557,10 +1556,10 @@
              * check default values:
              * make sure type of value is consistent with required property type
              */
-            InternalValue[] defVals = pd.getDefaultValues();
+            QValue[] defVals = pd.getDefaultValues();
             if (defVals != null && defVals.length != 0) {
                 int reqType = pd.getRequiredType();
-                for (InternalValue defVal : defVals) {
+                for (QValue defVal : defVals) {
                     if (reqType == PropertyType.UNDEFINED) {
                         reqType = defVal.getType();
                     } else {
@@ -1590,7 +1589,7 @@
             if (constraints != null && constraints.length > 0) {
                 if (defVals != null && defVals.length > 0) {
                     // check value constraints on every value
-                    for (InternalValue defVal : defVals) {
+                    for (QValue defVal : defVals) {
                         // constraints are OR-ed together
                         boolean satisfied = false;
                         ConstraintViolationException cve = null;
@@ -1638,8 +1637,8 @@
         }
 
         // validate child-node definitions
-        NodeDef[] cnda = ntd.getChildNodeDefs();
-        for (NodeDef cnd : cnda) {
+        QNodeDefinition[] cnda = ntd.getChildNodeDefs();
+        for (QNodeDefinition cnd : cnda) {
             /**
              * sanity check:
              * make sure declaring node type matches name of node type definition

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDef.java Tue Sep  8 09:47:13 2009
@@ -16,8 +16,7 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.spi.QValueConstraint;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
 
 /**
  * <code>PropDef</code> is the internal representation of
@@ -26,7 +25,7 @@
  *
  * @see javax.jcr.nodetype.PropertyDefinition
  */
-public interface PropDef extends ItemDef {
+public interface PropDef extends QPropertyDefinition {
 
     PropDef[] EMPTY_ARRAY = new PropDef[0];
 
@@ -36,54 +35,4 @@
      * @return an identifier for this property definition.
      */
     PropDefId getId();
-
-    /**
-     * Returns the required type.
-     *
-     * @return the required type.
-     */
-    int getRequiredType();
-
-    /**
-     * Returns the array of value constraints.
-     *
-     * @return the array of value constraints.
-     */
-    QValueConstraint[] getValueConstraints();
-
-    /**
-     * Returns the array of default values.
-     *
-     * @return the array of default values.
-     */
-    InternalValue[] getDefaultValues();
-
-    /**
-     * Reports whether this property can have multiple values.
-     *
-     * @return the 'multiple' flag.
-     */
-    boolean isMultiple();
-
-    /**
-     * Returns the array of available query operators.
-     *
-     * @return the array of query operators.
-     */
-    String[] getAvailableQueryOperators();
-
-    /**
-     * Reports whether this property is full-text searchable.
-     *
-     * @return the 'fullTextSearchable' flag.
-     */
-    boolean isFullTextSearchable();
-
-    /**
-     * Reports whether this property is query-orderable.
-     *
-     * @return the 'queryOrderable' flag.
-     */
-    boolean isQueryOrderable();
-
 }

Modified: jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefId.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefId.java?rev=812419&r1=812418&r2=812419&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefId.java (original)
+++ jackrabbit/sandbox/JCR-2170/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropDefId.java Tue Sep  8 09:47:13 2009
@@ -18,6 +18,8 @@
 
 import java.io.Serializable;
 
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+
 /**
  * <code>PropDefId</code> serves as identifier for a given <code>PropDef</code>.
  *
@@ -45,7 +47,7 @@
      *
      * @param def <code>PropDef</code> to create identifier for
      */
-    PropDefId(PropDef def) {
+    PropDefId(QPropertyDefinition def) {
         if (def == null) {
             throw new IllegalArgumentException("PropDef argument can not be null");
         }



Mime
View raw message