jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r943301 [1/2] - in /jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ lock/ nodetype/ nodetype/virtual/ persistence/ persistence/bundle/ persistence/bundle/util/ persistence/util/ persistence/xml/ state/ v...
Date Tue, 11 May 2010 21:32:44 GMT
Author: jukka
Date: Tue May 11 21:32:42 2010
New Revision: 943301

URL: http://svn.apache.org/viewvc?rev=943301&view=rev
Log:
1.6: Reimplemented most of the JCR-2170 changes in the 1.6 branch.

Modified:
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AbstractNodeData.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemData.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeData.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeDataRef.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyData.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AbstractNodeData.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AbstractNodeData.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AbstractNodeData.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AbstractNodeData.java Tue May 11 21:32:42 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.core;
 
+import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.NodeDefinition;
 import org.apache.jackrabbit.core.state.NodeState;
 
@@ -31,10 +32,10 @@ public abstract class AbstractNodeData e
      * Create a new instance of this class.
      *
      * @param state node state
-     * @param definition node definition
+     * @param itemMgr item manager
      */
-    protected AbstractNodeData(NodeState state, NodeDefinition definition) {
-        super(state, definition);
+    protected AbstractNodeData(NodeState state, ItemManager itemMgr) {
+        super(state, itemMgr);
 
         if (state.isShareable()) {
             this.primaryParentId = state.getParentId();
@@ -64,7 +65,7 @@ public abstract class AbstractNodeData e
      *
      * @return node definition
      */
-    public NodeDefinition getNodeDefinition() {
+    public NodeDefinition getNodeDefinition() throws RepositoryException {
         return (NodeDefinition) getDefinition();
     }
 

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java Tue May 11 21:32:42 2010
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.core.nodety
 import org.apache.jackrabbit.core.nodetype.NodeTypeConflictException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.nodetype.PropDef;
-import org.apache.jackrabbit.core.nodetype.PropDefId;
 import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.security.authorization.Permission;
 import org.apache.jackrabbit.core.state.ItemState;
@@ -104,7 +103,9 @@ public class BatchedItemOperations exten
                                  LockManager lockMgr,
                                  SessionImpl session,
                                  HierarchyManager hierMgr) throws RepositoryException {
-        super(ntReg, hierMgr, session, lockMgr, session.getAccessManager(), session.getRetentionRegistry());
+        super(ntReg, hierMgr, session, lockMgr,
+                session.getAccessManager(), session.getRetentionRegistry(),
+                session.getItemManager());
         this.stateMgr = stateMgr;
         this.session = session;
     }
@@ -426,12 +427,6 @@ public class BatchedItemOperations exten
         // add to new parent
         destParentState.addChildNodeEntry(destName.getName(), newState.getNodeId());
 
-        // change definition (id) of new node
-        NodeDef newNodeDef =
-                findApplicableNodeDefinition(destName.getName(),
-                        srcState.getNodeTypeName(), destParentState);
-        newState.setDefinitionId(newNodeDef.getId());
-
         // adjust references that refer to uuid's which have been mapped to
         // newly generated uuid's on copy/clone
         Iterator iter = refTracker.getProcessedReferences();
@@ -584,12 +579,6 @@ public class BatchedItemOperations exten
             destParent.addChildNodeEntry(destName.getName(), target.getNodeId());
         }
 
-        // change definition (id) of target node
-        NodeDef newTargetDef =
-                findApplicableNodeDefinition(destName.getName(),
-                        target.getNodeTypeName(), destParent);
-        target.setDefinitionId(newTargetDef.getId());
-
         // store states
         stateMgr.store(target);
         if (renameOnly) {
@@ -720,7 +709,7 @@ public class BatchedItemOperations exten
         // 4. node type constraints
 
         if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
-            NodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
+            NodeDef parentDef = itemMgr.getDefinition(parentState).unwrap();
             // make sure parent node is not protected
             if (parentDef.isProtected()) {
                 throw new ConstraintViolationException(
@@ -752,7 +741,7 @@ public class BatchedItemOperations exten
                     throw new RepositoryException(msg, ise);
                 }
                 NodeDef conflictingTargetDef =
-                        ntReg.getNodeDef(conflictingState.getDefinitionId());
+                        itemMgr.getDefinition(conflictingState).unwrap();
                 // check same-name sibling setting of both target and existing node
                 if (!conflictingTargetDef.allowsSameNameSiblings()
                         || !newNodeDef.allowsSameNameSiblings()) {
@@ -895,12 +884,12 @@ public class BatchedItemOperations exten
         // 4. node type constraints
 
         if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
-            NodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
+            NodeDef parentDef = itemMgr.getDefinition(parentState).unwrap();
             if (parentDef.isProtected()) {
                 throw new ConstraintViolationException(safeGetJCRPath(parentId)
                         + ": cannot remove child node of protected parent node");
             }
-            NodeDef targetDef = ntReg.getNodeDef(targetState.getDefinitionId());
+            NodeDef targetDef = itemMgr.getDefinition(targetState).unwrap();
             if (targetDef.isMandatory()) {
                 throw new ConstraintViolationException(safeGetJCRPath(targetPath)
                         + ": cannot remove mandatory node");
@@ -1123,7 +1112,6 @@ public class BatchedItemOperations exten
         if (mixinNames != null && mixinNames.length > 0) {
             node.setMixinTypeNames(new HashSet(Arrays.asList(mixinNames)));
         }
-        node.setDefinitionId(def.getId());
 
         // now add new child node entry to parent
         parent.addChildNodeEntry(nodeName, id);
@@ -1248,7 +1236,6 @@ public class BatchedItemOperations exten
         // create property
         PropertyState prop = stateMgr.createNew(propName, parent.getNodeId());
 
-        prop.setDefinitionId(def.getId());
         if (def.getRequiredType() != PropertyType.UNDEFINED) {
             prop.setType(def.getRequiredType());
         } else if (type != PropertyType.UNDEFINED) {
@@ -1441,7 +1428,7 @@ public class BatchedItemOperations exten
             throws PathNotFoundException, ConstraintViolationException,
             RepositoryException {
         NodeState node = getNodeState(nodePath);
-        NodeDef parentDef = ntReg.getNodeDef(node.getDefinitionId());
+        NodeDef parentDef = itemMgr.getDefinition(node).unwrap();
         if (parentDef.isProtected()) {
             throw new ConstraintViolationException(safeGetJCRPath(nodePath)
                     + ": node is protected");
@@ -1751,7 +1738,6 @@ public class BatchedItemOperations exten
             newState = stateMgr.createNew(id, srcState.getNodeTypeName(), destParentId);
             // copy node state
             newState.setMixinTypeNames(srcState.getMixinTypeNames());
-            newState.setDefinitionId(srcState.getDefinitionId());
             if (shareable) {
                 // initialize shared set
                 newState.addShare(destParentId);
@@ -1829,15 +1815,16 @@ public class BatchedItemOperations exten
                  *
                  * todo FIXME delegate to 'node type instance handler'
                  */
-                PropDefId defId = srcChildState.getDefinitionId();
-                PropDef def = ntReg.getPropDef(defId);
+                PropDef def = ent.getApplicablePropertyDef(
+                        srcChildState.getName(), srcChildState.getType(),
+                        srcChildState.isMultiValued());
                 if (NameConstants.MIX_LOCKABLE.equals(def.getDeclaringNodeType())) {
                     // skip properties defined by mix:lockable
                     continue;
                 }
 
                 PropertyState newChildState =
-                        copyPropertyState(srcChildState, id, propName);
+                        copyPropertyState(srcChildState, id, propName, def);
 
                 if (versionable && flag == COPY) {
                     /**
@@ -1899,20 +1886,17 @@ public class BatchedItemOperations exten
      * @param srcState
      * @param parentId
      * @param propName
+     * @param def property definition
      * @return
      * @throws RepositoryException
      */
     private PropertyState copyPropertyState(PropertyState srcState,
                                             NodeId parentId,
-                                            Name propName)
+                                            Name propName,
+                                            PropDef def)
             throws RepositoryException {
-
-        PropDefId defId = srcState.getDefinitionId();
-        PropDef def = ntReg.getPropDef(defId);
-
         PropertyState newState = stateMgr.createNew(propName, parentId);
 
-        newState.setDefinitionId(defId);
         newState.setType(srcState.getType());
         newState.setMultiValued(srcState.isMultiValued());
         InternalValue[] values = srcState.getValues();
@@ -1924,8 +1908,8 @@ public class BatchedItemOperations exten
              *
              * todo FIXME delegate to 'node type instance handler'
              */
-            if (def.getDeclaringNodeType().equals(NameConstants.MIX_REFERENCEABLE)
-                    && propName.equals(NameConstants.JCR_UUID)) {
+            if (propName.equals(NameConstants.JCR_UUID)
+                    && def.getDeclaringNodeType().equals(NameConstants.MIX_REFERENCEABLE)) {
                 // set correct value of jcr:uuid property
                 newState.setValues(new InternalValue[]{InternalValue.create(parentId.getUUID().toString())});
             } else {

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemData.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemData.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemData.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemData.java Tue May 11 21:32:42 2010
@@ -16,8 +16,11 @@
  */
 package org.apache.jackrabbit.core;
 
+import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ItemDefinition;
 import org.apache.jackrabbit.core.state.ItemState;
+import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.PropertyState;
 
 /**
  * Data object referenced by different <code>ItemImpl</code> instances that
@@ -37,17 +40,20 @@ public abstract class ItemData {
     /** Status */
     private int status;
 
+    /** The item manager. */
+    private ItemManager itemMgr;
+
     /**
      * Create a new instance of this class.
      *
      * @param state item state
-     * @param definition item definition
+     * @param itemMgr item manager
      */
-    protected ItemData(ItemState state, ItemDefinition definition) {
+    protected ItemData(ItemState state, ItemManager itemMgr) {
         this.id = state.getId();
         this.state = state;
-        this.definition = definition;
         this.status = ItemImpl.STATUS_NORMAL;
+        this.itemMgr = itemMgr;
     }
 
     /**
@@ -83,7 +89,14 @@ public abstract class ItemData {
      *
      * @return item definition
      */
-    public ItemDefinition getDefinition() {
+    public ItemDefinition getDefinition() throws RepositoryException {
+        if (definition == null && itemMgr != null) {
+            if (isNode()) {
+                definition = itemMgr.getDefinition((NodeState) state);
+            } else {
+                definition = itemMgr.getDefinition((PropertyState) state);
+            }
+        }
         return definition;
     }
 

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Tue May 11 21:32:42 2010
@@ -371,9 +371,9 @@ public abstract class ItemImpl implement
             ItemState itemState = (ItemState) dirtyIter.next();
             ItemDefinition def;
             if (itemState.isNode()) {
-                def = ntMgr.getNodeDefinition(((NodeState) itemState).getDefinitionId());
+                def = itemMgr.getDefinition((NodeState) itemState);
             } else {
-                def = ntMgr.getPropertyDefinition(((PropertyState) itemState).getDefinitionId());
+                def = itemMgr.getDefinition((PropertyState) itemState);
             }
             /* check permissions for non-protected items. protected items are
                only added through API methods which need to assert that
@@ -572,9 +572,9 @@ public abstract class ItemImpl implement
             ItemState itemState = (ItemState) removedIter.next();
             ItemDefinition def;
             if (itemState.isNode()) {
-                def = ntMgr.getNodeDefinition(((NodeState) itemState).getDefinitionId());
+                def = itemMgr.getDefinition((NodeState) itemState);
             } else {
-                def = ntMgr.getPropertyDefinition(((PropertyState) itemState).getDefinitionId());
+                def = itemMgr.getDefinition((PropertyState) itemState);
             }
             if (!def.isProtected()) {
                 Path path = stateMgr.getAtticAwareHierarchyMgr().getPath(itemState.getId());

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java Tue May 11 21:32:42 2010
@@ -17,8 +17,13 @@
 package org.apache.jackrabbit.core;
 
 import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
+import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.core.nodetype.NodeDefinitionImpl;
+import org.apache.jackrabbit.core.nodetype.NodeTypeConflictException;
+import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
+import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.apache.jackrabbit.core.nodetype.PropDefId;
 import org.apache.jackrabbit.core.nodetype.PropertyDefinitionImpl;
 import org.apache.jackrabbit.core.security.AccessManager;
@@ -82,12 +87,12 @@ public class ItemManager implements Dump
 
     private static Logger log = LoggerFactory.getLogger(ItemManager.class);
 
-    private final NodeDefinition rootNodeDef;
+    private final NodeDefinitionImpl rootNodeDef;
     private final NodeId rootNodeId;
 
     protected final SessionImpl session;
 
-    private final ItemStateManager itemStateProvider;
+    private final SessionItemStateManager sism;
     private final HierarchyManager hierMgr;
 
     /**
@@ -103,17 +108,18 @@ public class ItemManager implements Dump
     /**
      * Creates a new per-session instance <code>ItemManager</code> instance.
      *
-     * @param itemStateProvider the item state provider associated with
+     * @param sism              the item state manager associated with
      *                          the new instance
      * @param hierMgr           the hierarchy manager
      * @param session           the session associated with the new instance
      * @param rootNodeDef       the definition of the root node
      * @param rootNodeId        the id of the root node
      */
-    protected ItemManager(SessionItemStateManager itemStateProvider, HierarchyManager hierMgr,
-                          SessionImpl session, NodeDefinition rootNodeDef,
-                          NodeId rootNodeId) {
-        this.itemStateProvider = itemStateProvider;
+    protected ItemManager(
+            SessionItemStateManager sism, HierarchyManager hierMgr,
+            SessionImpl session, NodeDefinitionImpl rootNodeDef,
+            NodeId rootNodeId) {
+        this.sism = sism;
         this.hierMgr = hierMgr;
         this.session = session;
         this.rootNodeDef = rootNodeDef;
@@ -141,7 +147,7 @@ public class ItemManager implements Dump
             SessionItemStateManager itemStateProvider,
             HierarchyManager hierMgr,
             SessionImpl session,
-            NodeDefinition rootNodeDef,
+            NodeDefinitionImpl rootNodeDef,
             NodeId rootNodeId) {
         ItemManager mgr = new ItemManager(itemStateProvider, hierMgr,
                 session, rootNodeDef, rootNodeId);
@@ -159,47 +165,81 @@ public class ItemManager implements Dump
         shareableNodesCache.clear();
     }
 
-    private NodeDefinition getDefinition(NodeState state)
+    NodeDefinitionImpl getDefinition(NodeState state)
             throws RepositoryException {
-        NodeDefId defId = state.getDefinitionId();
-        NodeDefinitionImpl def = session.getNodeTypeManager().getNodeDefinition(defId);
-        if (def == null) {
-            /**
-             * todo need proper way of handling inconsistent/corrupt definition
-             * e.g. 'flag' items that refer to non-existent definitions
-             */
-            log.warn("node at " + safeGetJCRPath(state.getNodeId())
-                    + " has invalid definitionId (" + defId + ")");
+        if (state.getNodeId().equals(rootNodeId)) {
+            // special handling required for root node
+            return rootNodeDef;
+        }
 
-            // fallback: try finding applicable definition
-            NodeImpl parent = (NodeImpl) getItem(state.getParentId());
-            NodeState parentState = (NodeState) parent.getItemState();
-            ChildNodeEntry cne = parentState.getChildNodeEntry(state.getNodeId());
-            def = parent.getApplicableChildNodeDefinition(cne.getName(), state.getNodeTypeName());
-            state.setDefinitionId(def.unwrap().getId());
+        NodeId parentId = state.getParentId();
+        if (parentId == null) {
+            // removed state has parentId set to null
+            // get from overlayed state
+            parentId = state.getOverlayedState().getParentId();
+        }
+
+        NodeState parentState = null;
+        try {
+            NodeImpl parent = (NodeImpl) getItem(parentId);
+            parentState = parent.getNodeState();
+            if (state.getParentId() == null) {
+                // indicates state has been removed, must use
+                // overlayed state of parent, otherwise child node entry
+                // cannot be found
+                parentState = (NodeState) parentState.getOverlayedState();
+            }
+        } catch (ItemNotFoundException e) {
+            // parent probably removed, get it from attic. see below
+        }
+
+        if (parentState == null) {
+            try {
+                // use overlayed state if available
+                parentState = (NodeState) sism.getAttic().getItemState(
+                        parentId).getOverlayedState();
+            } catch (ItemStateException ex) {
+                throw new RepositoryException(ex);
+            }
+        }
+
+        // get child node entry
+        ChildNodeEntry cne = parentState.getChildNodeEntry(state.getNodeId());
+        NodeTypeRegistry ntReg = session.getNodeTypeManager().getNodeTypeRegistry();
+        try {
+            EffectiveNodeType ent = ntReg.getEffectiveNodeType(
+                    parentState.getNodeTypeName(), parentState.getMixinTypeNames());
+            NodeDef def = ent.getApplicableChildNodeDef(
+                    cne.getName(), state.getNodeTypeName(), ntReg);
+            return session.getNodeTypeManager().getNodeDefinition(def);
+        } catch (NodeTypeConflictException e) {
+            throw new RepositoryException(e);
         }
-        return def;
     }
 
-    private PropertyDefinition getDefinition(PropertyState state)
+    PropertyDefinitionImpl getDefinition(PropertyState state)
             throws RepositoryException {
-        PropDefId defId = state.getDefinitionId();
-        PropertyDefinitionImpl def = session.getNodeTypeManager().getPropertyDefinition(defId);
-        if (def == null) {
-            /**
-             * todo need proper way of handling inconsistent/corrupt definition
-             * e.g. 'flag' items that refer to non-existent definitions
-             */
-            log.warn("property at " + safeGetJCRPath(state.getPropertyId())
-                    + " has invalid definitionId (" + defId + ")");
-
-            // fallback: try finding applicable definition
+        try {
             NodeImpl parent = (NodeImpl) getItem(state.getParentId());
-            def = parent.getApplicablePropertyDefinition(
+            return parent.getApplicablePropertyDefinition(
                     state.getName(), state.getType(), state.isMultiValued(), true);
-            state.setDefinitionId(def.unwrap().getId());
+        } catch (ItemNotFoundException e) {
+            // parent probably removed, get it from attic
+        }
+        try {
+            NodeState parent = (NodeState) sism.getAttic().getItemState(
+                    state.getParentId()).getOverlayedState();
+            NodeTypeRegistry ntReg = session.getNodeTypeManager().getNodeTypeRegistry();
+            EffectiveNodeType ent = ntReg.getEffectiveNodeType(
+                    parent.getNodeTypeName(), parent.getMixinTypeNames());
+            PropDef def = ent.getApplicablePropertyDef(
+                    state.getName(), state.getType(), state.isMultiValued());
+            return session.getNodeTypeManager().getPropertyDefinition(def);
+        } catch (ItemStateException e) {
+            throw new RepositoryException(e);
+        } catch (NodeTypeConflictException e) {
+            throw new RepositoryException(e);
         }
-        return def;
     }
 
     /**
@@ -219,7 +259,7 @@ public class ItemManager implements Dump
             session.sanityCheck();
 
             // shortcut: check if state exists for the given item
-            if (!itemStateProvider.hasItemState(itemId)) {
+            if (!sism.hasItemState(itemId)) {
                 return false;
             }
             ItemData data = getItemData(itemId, path, true);
@@ -301,7 +341,7 @@ public class ItemManager implements Dump
             // NOTE: permission check & caching within createItemData
             ItemState state;
             try {
-                state = itemStateProvider.getItemState(itemId);
+                state = sism.getItemState(itemId);
             } catch (NoSuchItemStateException nsise) {
                 throw new ItemNotFoundException(itemId.toString());
             } catch (ItemStateException ise) {
@@ -339,8 +379,7 @@ public class ItemManager implements Dump
         if (state == null) {
             throw new InvalidItemStateException(data.getId() + ": the item does not exist anymore");
         }
-        if (state.getStatus() == ItemState.STATUS_NEW &&
-                !data.getDefinition().isProtected()) {
+        if (state.getStatus() == ItemState.STATUS_NEW) {
             // NEW items can always be read as long they have been added
             // through the API and NOT by the system (i.e. protected props).
             return true;
@@ -706,13 +745,13 @@ public class ItemManager implements Dump
         ItemId id = state.getId();
         if (id.equals(rootNodeId)) {
             // special handling required for root node
-            data = new NodeData((NodeState) state, rootNodeDef);
+            data = new NodeData((NodeState) state, this);
         } else if (state.isNode()) {
             NodeState nodeState = (NodeState) state;
-            data = new NodeData(nodeState, getDefinition(nodeState));
+            data = new NodeData(nodeState, this);
         } else {
             PropertyState propertyState = (PropertyState) state;
-            data = new PropertyData(propertyState, getDefinition(propertyState));
+            data = new PropertyData(propertyState, this);
         }
         // make sure read-perm. is granted before returning the data.
         if (permissionCheck && !canRead(data, path)) {

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java Tue May 11 21:32:42 2010
@@ -128,6 +128,8 @@ public class ItemValidator {
 
     protected final RetentionRegistry retentionReg;
 
+    protected final ItemManager itemMgr;
+
     /**
      * Creates a new <code>ItemValidator</code> instance.
      *
@@ -138,7 +140,9 @@ public class ItemValidator {
     public ItemValidator(NodeTypeRegistry ntReg,
                          HierarchyManager hierMgr,
                          SessionImpl session) throws RepositoryException {
-        this(ntReg, hierMgr, session, session.getLockManager(), session.getAccessManager(), session.getRetentionRegistry());
+        this(ntReg, hierMgr, session, session.getLockManager(),
+                session.getAccessManager(), session.getRetentionRegistry(),
+                session.getItemManager());
     }
 
     /**
@@ -150,19 +154,22 @@ public class ItemValidator {
      * @param lockMgr    lockMgr
      * @param accessMgr  accessMgr
      * @param retentionReg
+     * @param itemMgr    the item manager
      */
     public ItemValidator(NodeTypeRegistry ntReg,
                          HierarchyManager hierMgr,
                          PathResolver resolver,
                          LockManager lockMgr,
                          AccessManager accessMgr,
-                         RetentionRegistry retentionReg) {
+                         RetentionRegistry retentionReg,
+                         ItemManager itemMgr) {
         this.ntReg = ntReg;
         this.hierMgr = hierMgr;
         this.resolver = resolver;
         this.lockMgr = lockMgr;
         this.accessMgr = accessMgr;
         this.retentionReg = retentionReg;
+        this.itemMgr = itemMgr;
     }
 
     /**
@@ -188,7 +195,7 @@ public class ItemValidator {
                 ntReg.getEffectiveNodeType(nodeState.getNodeTypeName());
         // effective node type (primary type incl. mixins)
         EffectiveNodeType entPrimaryAndMixins = getEffectiveNodeType(nodeState);
-        NodeDef def = ntReg.getNodeDef(nodeState.getDefinitionId());
+        NodeDef def = itemMgr.getDefinition(nodeState).unwrap();
 
         // check if primary type satisfies the 'required node types' constraint
         Name[] requiredPrimaryTypes = def.getRequiredPrimaryTypes();
@@ -244,7 +251,7 @@ public class ItemValidator {
      */
     public void validate(PropertyState propState)
             throws ConstraintViolationException, RepositoryException {
-        PropDef def = ntReg.getPropDef(propState.getDefinitionId());
+        PropDef def = itemMgr.getDefinition(propState).unwrap();
         InternalValue[] values = propState.getValues();
         int type = PropertyType.UNDEFINED;
         for (int i = 0; i < values.length; i++) {

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeData.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeData.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeData.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeData.java Tue May 11 21:32:42 2010
@@ -30,9 +30,9 @@ class NodeData extends AbstractNodeData 
      * Create a new instance of this class.
      *
      * @param state node state
-     * @param definition node definition
+     * @param itemMgr item manager
      */
-    NodeData(NodeState state, NodeDefinition definition) {
-        super(state, definition);
+    NodeData(NodeState state, ItemManager itemMgr) {
+        super(state, itemMgr);
     }
 }

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeDataRef.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeDataRef.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeDataRef.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeDataRef.java Tue May 11 21:32:42 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.core;
 
+import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ItemDefinition;
 import org.apache.jackrabbit.core.state.ItemState;
 
@@ -65,7 +66,7 @@ class NodeDataRef extends AbstractNodeDa
      *
      * This implementation returns the definition of the referenced data object.
      */
-    public ItemDefinition getDefinition() {
+    public ItemDefinition getDefinition() throws RepositoryException {
         return data.getDefinition();
     }
 

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Tue May 11 21:32:42 2010
@@ -21,7 +21,6 @@ import org.apache.jackrabbit.commons.ite
 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;
 import org.apache.jackrabbit.core.nodetype.NodeTypeConflictException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
@@ -143,6 +142,15 @@ public class NodeImpl extends ItemImpl i
     }
 
     /**
+     * Returns the node-state associated with this node.
+     *
+     * @return state associated with this node
+     */
+    NodeState getNodeState() {
+        return data.getNodeState();
+    }
+
+    /**
      * Returns the id of the property at <code>relPath</code> or <code>null</code>
      * if no property exists at <code>relPath</code>.
      * <p/>
@@ -466,7 +474,6 @@ public class NodeImpl extends ItemImpl i
                             ItemState.STATUS_NEW);
             propState.setType(type);
             propState.setMultiValued(def.isMultiple());
-            propState.setDefinitionId(def.unwrap().getId());
             // compute system generated values if necessary
             InternalValue[] genValues =
                     computeSystemGeneratedPropertyValues(name, def);
@@ -499,7 +506,6 @@ public class NodeImpl extends ItemImpl i
     }
 
     protected synchronized NodeImpl createChildNode(Name name,
-                                                    NodeDefinitionImpl def,
                                                     NodeTypeImpl nodeType,
                                                     NodeId id)
             throws RepositoryException {
@@ -512,7 +518,6 @@ public class NodeImpl extends ItemImpl i
             nodeState =
                     stateMgr.createTransientNodeState(id, nodeType.getQName(),
                             getNodeId(), ItemState.STATUS_NEW);
-            nodeState.setDefinitionId(def.unwrap().getId());
         } catch (ItemStateException ise) {
             String msg = "failed to add child node " + name + " to " + this;
             log.debug(msg);
@@ -551,8 +556,10 @@ public class NodeImpl extends ItemImpl i
         NodeDefinition[] nda = nodeType.getAutoCreatedNodeDefinitions();
         for (int i = 0; i < nda.length; i++) {
             NodeDefinitionImpl nd = (NodeDefinitionImpl) nda[i];
-            node.createChildNode(nd.getQName(), nd,
-                    (NodeTypeImpl) nd.getDefaultPrimaryType(), null);
+            node.createChildNode(
+                    nd.getQName(),
+                    (NodeTypeImpl) nd.getDefaultPrimaryType(),
+                    null);
         }
 
         return node;
@@ -619,13 +626,12 @@ public class NodeImpl extends ItemImpl i
         }
     }
 
-    protected void onRedefine(NodeDefId defId) throws RepositoryException {
+    protected void onRedefine(NodeDef def) throws RepositoryException {
         NodeDefinitionImpl newDef =
-                session.getNodeTypeManager().getNodeDefinition(defId);
+                session.getNodeTypeManager().getNodeDefinition(def);
         // modify the state of 'this', i.e. the target node
-        NodeState thisState = (NodeState) getOrCreateTransientItemState();
-        // set id of new definition
-        thisState.setDefinitionId(defId);
+        getOrCreateTransientItemState();
+        // set new definition
         data.setDefinition(newDef);
     }
 
@@ -799,7 +805,7 @@ public class NodeImpl extends ItemImpl i
         session.getValidator().checkModify(this, options, Permission.NONE);
 
         // now do create the child node
-        return createChildNode(nodeName, def, nodeType, id);
+        return createChildNode(nodeName, nodeType, id);
     }
 
     private void setMixinTypesProperty(Set mixinNames) throws RepositoryException {
@@ -879,7 +885,7 @@ public class NodeImpl extends ItemImpl i
         NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
         NodeDef cnd = getEffectiveNodeType().getApplicableChildNodeDef(
                 nodeName, nodeTypeName, ntMgr.getNodeTypeRegistry());
-        return ntMgr.getNodeDefinition(cnd.getId());
+        return ntMgr.getNodeDefinition(cnd);
     }
 
     /**
@@ -915,7 +921,7 @@ public class NodeImpl extends ItemImpl i
                         propertyName, PropertyType.UNDEFINED, multiValued);
             }
         }
-        return session.getNodeTypeManager().getPropertyDefinition(pd.getId());
+        return session.getNodeTypeManager().getPropertyDefinition(pd);
     }
 
     protected void makePersistent() throws InvalidItemStateException {
@@ -948,8 +954,6 @@ public class NodeImpl extends ItemImpl i
             persistentState.setNodeTypeName(transientState.getNodeTypeName());
             // mixin types
             persistentState.setMixinTypeNames(transientState.getMixinTypeNames());
-            // id of definition
-            persistentState.setDefinitionId(transientState.getDefinitionId());
             // child node entries
             persistentState.setChildNodeEntries(transientState.getChildNodeEntries());
             // property entries
@@ -985,7 +989,6 @@ public class NodeImpl extends ItemImpl i
         thisState.setParentId(transientState.getParentId());
         thisState.setNodeTypeName(transientState.getNodeTypeName());
         thisState.setMixinTypeNames(transientState.getMixinTypeNames());
-        thisState.setDefinitionId(transientState.getDefinitionId());
         thisState.setChildNodeEntries(transientState.getChildNodeEntries());
         thisState.setPropertyNames(transientState.getPropertyNames());
         thisState.setSharedSet(transientState.getSharedSet());
@@ -1083,7 +1086,7 @@ public class NodeImpl extends ItemImpl i
                 // or existing mixin's
                 NodeTypeImpl declaringNT = (NodeTypeImpl) nd.getDeclaringNodeType();
                 if (!entExisting.includesNodeType(declaringNT.getQName())) {
-                    createChildNode(nd.getQName(), nd, (NodeTypeImpl) nd.getDefaultPrimaryType(), null);
+                    createChildNode(nd.getQName(), (NodeTypeImpl) nd.getDefaultPrimaryType(), null);
                 }
             }
         } catch (RepositoryException re) {
@@ -1191,7 +1194,7 @@ public class NodeImpl extends ItemImpl i
                 Name propName = (Name) iter.next();
                 PropertyState propState = (PropertyState) stateMgr.getItemState(new PropertyId(thisState.getNodeId(), propName));
                 // check if property has been defined by mixin type (or one of its supertypes)
-                PropertyDefinition def = ntMgr.getPropertyDefinition(propState.getDefinitionId());
+                PropertyDefinition def = itemMgr.getDefinition(propState);
                 NodeTypeImpl declaringNT = (NodeTypeImpl) def.getDeclaringNodeType();
                 if (!entResulting.includesNodeType(declaringNT.getQName())) {
                     // the resulting effective node type doesn't include the
@@ -1220,7 +1223,7 @@ public class NodeImpl extends ItemImpl i
                                                 pdi.getRequiredType(),
                                                 session.getValueFactory());
                                 // redefine property
-                                prop.onRedefine(pdi.unwrap().getId());
+                                prop.onRedefine(pdi.unwrap());
                                 // set converted values
                                 prop.setValue(values);
                             } else {
@@ -1231,13 +1234,13 @@ public class NodeImpl extends ItemImpl i
                                                 pdi.getRequiredType(),
                                                 session.getValueFactory());
                                 // redefine property
-                                prop.onRedefine(pdi.unwrap().getId());
+                                prop.onRedefine(pdi.unwrap());
                                 // set converted values
                                 prop.setValue(value);
                             }
                         } else {
                             // redefine property
-                            prop.onRedefine(pdi.unwrap().getId());
+                            prop.onRedefine(pdi.unwrap());
                         }
                     } catch (ValueFormatException vfe) {
                         // value conversion failed, remove it
@@ -1255,7 +1258,7 @@ public class NodeImpl extends ItemImpl i
             for (int i = list.size() - 1; i >= 0; i--) {
                 ChildNodeEntry entry = (ChildNodeEntry) list.get(i);
                 NodeState nodeState = (NodeState) stateMgr.getItemState(entry.getId());
-                NodeDefinition def = ntMgr.getNodeDefinition(nodeState.getDefinitionId());
+                NodeDefinition def = itemMgr.getDefinition(nodeState);
                 // check if node has been defined by mixin type (or one of its supertypes)
                 NodeTypeImpl declaringNT = (NodeTypeImpl) def.getDeclaringNodeType();
                 if (!entResulting.includesNodeType(declaringNT.getQName())) {
@@ -1273,7 +1276,7 @@ public class NodeImpl extends ItemImpl i
                                 entry.getName(),
                                 nodeState.getNodeTypeName());
                         // redefine node
-                        node.onRedefine(ndi.unwrap().getId());
+                        node.onRedefine(ndi.unwrap());
                     } catch (ConstraintViolationException cve) {
                         // no suitable definition found for this child node,
                         // remove it
@@ -4757,18 +4760,18 @@ public class NodeImpl extends ItemImpl i
         }
 
         // get applicable definition for this node using new primary type
-        NodeDefId defId;
+        NodeDef nodeDef;
         try {
             NodeImpl parent = (NodeImpl) getParent();
-            defId = parent.getApplicableChildNodeDefinition(getQName(), ntName).unwrap().getId();
+            nodeDef = parent.getApplicableChildNodeDefinition(getQName(), ntName).unwrap();
         } catch (RepositoryException re) {
             String msg = this + ": no applicable definition found in parent node's node type";
             log.debug(msg);
             throw new ConstraintViolationException(msg, re);
         }
 
-        if (!defId.equals(state.getDefinitionId())) {
-            onRedefine(defId);
+        if (!nodeDef.equals(itemMgr.getDefinition(state).unwrap())) {
+            onRedefine(nodeDef);
         }
 
         Set oldDefs = new HashSet(Arrays.asList(entOld.getAllItemDefs()));
@@ -4813,7 +4816,7 @@ public class NodeImpl extends ItemImpl i
                 PropertyState propState =
                         (PropertyState) stateMgr.getItemState(
                                 new PropertyId(thisState.getNodeId(), propName));
-                if (!allDefs.contains(ntReg.getPropDef(propState.getDefinitionId()))) {
+                if (!allDefs.contains(itemMgr.getDefinition(propState))) {
                     // try to find new applicable definition first and
                     // redefine property if possible
                     try {
@@ -4837,7 +4840,7 @@ public class NodeImpl extends ItemImpl i
                                                 pdi.getRequiredType(),
                                                 session.getValueFactory());
                                 // redefine property
-                                prop.onRedefine(pdi.unwrap().getId());
+                                prop.onRedefine(pdi.unwrap());
                                 // set converted values
                                 prop.setValue(values);
                             } else {
@@ -4848,13 +4851,13 @@ public class NodeImpl extends ItemImpl i
                                                 pdi.getRequiredType(),
                                                 session.getValueFactory());
                                 // redefine property
-                                prop.onRedefine(pdi.unwrap().getId());
+                                prop.onRedefine(pdi.unwrap());
                                 // set converted values
                                 prop.setValue(value);
                             }
                         } else {
                             // redefine property
-                            prop.onRedefine(pdi.unwrap().getId());
+                            prop.onRedefine(pdi.unwrap());
                         }
                         // update collection of added definitions
                         addedDefs.remove(pdi.unwrap());
@@ -4881,7 +4884,7 @@ public class NodeImpl extends ItemImpl i
             ChildNodeEntry entry = (ChildNodeEntry) list.get(i);
             try {
                 NodeState nodeState = (NodeState) stateMgr.getItemState(entry.getId());
-                if (!allDefs.contains(ntReg.getNodeDef(nodeState.getDefinitionId()))) {
+                if (!allDefs.contains(itemMgr.getDefinition(nodeState).unwrap())) {
                     // try to find new applicable definition first and
                     // redefine node if possible
                     try {
@@ -4895,7 +4898,7 @@ public class NodeImpl extends ItemImpl i
                                 entry.getName(),
                                 nodeState.getNodeTypeName());
                         // redefine node
-                        node.onRedefine(ndi.unwrap().getId());
+                        node.onRedefine(ndi.unwrap());
                         // update collection of added definitions
                         addedDefs.remove(ndi.unwrap());
                     } catch (ConstraintViolationException cve) {
@@ -4917,10 +4920,10 @@ public class NodeImpl extends ItemImpl i
             ItemDef def = (ItemDef) iter.next();
             if (def.isAutoCreated()) {
                 if (def.definesNode()) {
-                    NodeDefinitionImpl ndi = ntMgr.getNodeDefinition(((NodeDef) def).getId());
-                    createChildNode(ndi.getQName(), ndi, (NodeTypeImpl) ndi.getDefaultPrimaryType(), null);
+                    NodeDefinitionImpl ndi = ntMgr.getNodeDefinition((NodeDef) def);
+                    createChildNode(ndi.getQName(), (NodeTypeImpl) ndi.getDefaultPrimaryType(), null);
                 } else {
-                    PropertyDefinitionImpl pdi = ntMgr.getPropertyDefinition(((PropDef) def).getId());
+                    PropertyDefinitionImpl pdi = ntMgr.getPropertyDefinition((PropDef) def);
                     createChildProperty(pdi.getQName(), pdi.getRequiredType(), pdi);
                 }
             }

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyData.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyData.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyData.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyData.java Tue May 11 21:32:42 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.core;
 
+import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.PropertyDefinition;
 import org.apache.jackrabbit.core.state.PropertyState;
 
@@ -28,10 +29,10 @@ public class PropertyData extends ItemDa
      * Create a new instance of this class.
      *
      * @param state associated property state
-     * @param definition associated property definition
+     * @param itemMgr item manager
      */
-    PropertyData(PropertyState state, PropertyDefinition definition) {
-        super(state, definition);
+    PropertyData(PropertyState state, ItemManager itemMgr) {
+        super(state, itemMgr);
     }
 
     /**
@@ -48,7 +49,7 @@ public class PropertyData extends ItemDa
      *
      * @return property definition
      */
-    public PropertyDefinition getPropertyDefinition() {
+    public PropertyDefinition getPropertyDefinition() throws RepositoryException {
         return (PropertyDefinition) getDefinition();
     }
 }

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java Tue May 11 21:32:42 2010
@@ -21,7 +21,7 @@ import org.apache.jackrabbit.core.state.
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.value.BLOBFileValue;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.core.nodetype.PropDefId;
+import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.apache.jackrabbit.core.nodetype.PropertyDefinitionImpl;
 import org.apache.jackrabbit.core.security.authorization.Permission;
 import org.apache.jackrabbit.spi.Path;
@@ -131,7 +131,6 @@ public class PropertyImpl extends ItemIm
                 throw new InvalidItemStateException(msg);
             }
             // copy state from transient state
-            persistentState.setDefinitionId(transientState.getDefinitionId());
             persistentState.setType(transientState.getType());
             persistentState.setMultiValued(transientState.isMultiValued());
             persistentState.setValues(transientState.getValues());
@@ -156,19 +155,14 @@ public class PropertyImpl extends ItemIm
             stateMgr.disconnectTransientItemState(thisState);
         }
         // reapply transient changes
-        thisState.setDefinitionId(transientState.getDefinitionId());
         thisState.setType(transientState.getType());
         thisState.setMultiValued(transientState.isMultiValued());
         thisState.setValues(transientState.getValues());
     }
 
-    protected void onRedefine(PropDefId defId) throws RepositoryException {
+    protected void onRedefine(PropDef def) throws RepositoryException {
         PropertyDefinitionImpl newDef =
-                session.getNodeTypeManager().getPropertyDefinition(defId);
-        // modify the state of 'this', i.e. the target property
-        PropertyState thisState = (PropertyState) getOrCreateTransientItemState();
-        // set id of new definition
-        thisState.setDefinitionId(defId);
+                session.getNodeTypeManager().getPropertyDefinition(def);
         data.setDefinition(newDef);
     }
 

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ProtectedItemModifier.java Tue May 11 21:32:42 2010
@@ -89,7 +89,7 @@ public abstract class ProtectedItemModif
             }
         }
 
-        return parentImpl.createChildNode(name, def, nodeType, null);
+        return parentImpl.createChildNode(name, nodeType, null);
     }
 
     protected Property setProperty(NodeImpl parentImpl, Name name, Value value) throws RepositoryException {

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java Tue May 11 21:32:42 2010
@@ -1127,7 +1127,7 @@ public class SessionImpl extends Abstrac
         }
 
         // change definition of target
-        targetNode.onRedefine(newTargetDef.unwrap().getId());
+        targetNode.onRedefine(newTargetDef.unwrap());
     }
 
     /**

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java Tue May 11 21:32:42 2010
@@ -20,7 +20,6 @@ import EDU.oswego.cs.dl.util.concurrent.
 import org.apache.commons.collections.map.LinkedMap;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.ItemValidator;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.PropertyId;
@@ -34,7 +33,6 @@ import org.apache.jackrabbit.core.cluste
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
-import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.apache.jackrabbit.core.observation.EventImpl;
 import org.apache.jackrabbit.core.observation.SynchronousEventListener;
 import org.apache.jackrabbit.core.state.ItemStateException;
@@ -822,7 +820,6 @@ public class LockManagerImpl implements 
         SessionImpl editingSession = (SessionImpl) node.getSession();
         WorkspaceImpl wsp = (WorkspaceImpl) editingSession.getWorkspace();
         UpdatableItemStateManager stateMgr = wsp.getItemStateManager();
-        ItemValidator helper = new ItemValidator(editingSession.getNodeTypeManager().getNodeTypeRegistry(), wsp.getHierarchyManager(), editingSession);
 
         synchronized (stateMgr) {
             if (stateMgr.inEditMode()) {
@@ -836,9 +833,7 @@ public class LockManagerImpl implements 
 
                 PropertyState propState;
                 if (!nodeState.hasPropertyName(NameConstants.JCR_LOCKOWNER)) {
-                    PropDef def = helper.findApplicablePropertyDefinition(NameConstants.JCR_LOCKOWNER, PropertyType.STRING, false, nodeState);
                     propState = stateMgr.createNew(NameConstants.JCR_LOCKOWNER, nodeId);
-                    propState.setDefinitionId(def.getId());
                     propState.setType(PropertyType.STRING);
                     propState.setMultiValued(false);
                 } else {
@@ -849,9 +844,7 @@ public class LockManagerImpl implements 
                 stateMgr.store(nodeState);
 
                 if (!nodeState.hasPropertyName(NameConstants.JCR_LOCKISDEEP)) {
-                    PropDef def = helper.findApplicablePropertyDefinition(NameConstants.JCR_LOCKISDEEP, PropertyType.BOOLEAN, false, nodeState);
                     propState = stateMgr.createNew(NameConstants.JCR_LOCKISDEEP, nodeId);
-                    propState.setDefinitionId(def.getId());
                     propState.setType(PropertyType.BOOLEAN);
                     propState.setMultiValued(false);
                 } else {

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java Tue May 11 21:32:42 2010
@@ -28,9 +28,11 @@ import javax.jcr.nodetype.NoSuchNodeType
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeSet;
 
 /**
@@ -94,16 +96,16 @@ public class EffectiveNodeType implement
         ent.mergedNodeTypes.add(ntName);
         ent.allNodeTypes.add(ntName);
 
-        // map of all item definitions (maps id to definition)
+        // all item definitions
         // used to effectively detect ambiguous child definitions where
         // ambiguity is defined in terms of definition identity
-        HashMap itemDefIds = new HashMap();
+        Set itemDefs = new HashSet();
 
         NodeDef[] cnda = ntd.getChildNodeDefs();
         for (int i = 0; i < cnda.length; i++) {
             // check if child node definition would be ambiguous within
             // this node type definition
-            if (itemDefIds.containsKey(cnda[i].getId())) {
+            if (itemDefs.contains(cnda[i])) {
                 // conflict
                 String msg;
                 if (cnda[i].definesResidual()) {
@@ -115,7 +117,7 @@ public class EffectiveNodeType implement
                 log.debug(msg);
                 throw new NodeTypeConflictException(msg);
             } else {
-                itemDefIds.put(cnda[i].getId(), cnda[i]);
+                itemDefs.add(cnda[i]);
             }
             if (cnda[i].definesResidual()) {
                 // residual node definition
@@ -151,7 +153,7 @@ public class EffectiveNodeType implement
         for (int i = 0; i < pda.length; i++) {
             // check if property definition would be ambiguous within
             // this node type definition
-            if (itemDefIds.containsKey(pda[i].getId())) {
+            if (itemDefs.contains(pda[i])) {
                 // conflict
                 String msg;
                 if (pda[i].definesResidual()) {
@@ -163,7 +165,7 @@ public class EffectiveNodeType implement
                 log.debug(msg);
                 throw new NodeTypeConflictException(msg);
             } else {
-                itemDefIds.put(pda[i].getId(), pda[i]);
+                itemDefs.add(pda[i]);
             }
             if (pda[i].definesResidual()) {
                 // residual property definition

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDefDiff.java Tue May 11 21:32:42 2010
@@ -236,13 +236,13 @@ public class NodeTypeDefDiff {
         PropDef[] pda1 = oldDef.getPropertyDefs();
         HashMap defs1 = new HashMap();
         for (int i = 0; i < pda1.length; i++) {
-            defs1.put(pda1[i].getId(), pda1[i]);
+            defs1.put(new PropDefId(pda1[i]), pda1[i]);
         }
 
         PropDef[] pda2 = newDef.getPropertyDefs();
         HashMap defs2 = new HashMap();
         for (int i = 0; i < pda2.length; i++) {
-            defs2.put(pda2[i].getId(), pda2[i]);
+            defs2.put(new PropDefId(pda2[i]), pda2[i]);
         }
 
         /**
@@ -295,13 +295,13 @@ public class NodeTypeDefDiff {
         NodeDef[] cnda1 = oldDef.getChildNodeDefs();
         HashMap defs1 = new HashMap();
         for (int i = 0; i < cnda1.length; i++) {
-            defs1.put(cnda1[i].getId(), cnda1[i]);
+            defs1.put(new NodeDefId(cnda1[i]), cnda1[i]);
         }
 
         NodeDef[] cnda2 = newDef.getChildNodeDefs();
         HashMap defs2 = new HashMap();
         for (int i = 0; i < cnda2.length; i++) {
-            defs2.put(cnda2[i].getId(), cnda2[i]);
+            defs2.put(new NodeDefId(cnda2[i]), cnda2[i]);
         }
 
         /**

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java Tue May 11 21:32:42 2010
@@ -123,7 +123,7 @@ public class NodeTypeImpl implements Nod
         NodeDef[] cnda = ent.getAutoCreateNodeDefs();
         NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length];
         for (int i = 0; i < cnda.length; i++) {
-            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i].getId());
+            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i]);
         }
         return nodeDefs;
     }
@@ -141,7 +141,7 @@ public class NodeTypeImpl implements Nod
         PropDef[] pda = ent.getAutoCreatePropDefs();
         PropertyDefinition[] propDefs = new PropertyDefinition[pda.length];
         for (int i = 0; i < pda.length; i++) {
-            propDefs[i] = ntMgr.getPropertyDefinition(pda[i].getId());
+            propDefs[i] = ntMgr.getPropertyDefinition(pda[i]);
         }
         return propDefs;
     }
@@ -159,7 +159,7 @@ public class NodeTypeImpl implements Nod
         PropDef[] pda = ent.getMandatoryPropDefs();
         PropertyDefinition[] propDefs = new PropertyDefinition[pda.length];
         for (int i = 0; i < pda.length; i++) {
-            propDefs[i] = ntMgr.getPropertyDefinition(pda[i].getId());
+            propDefs[i] = ntMgr.getPropertyDefinition(pda[i]);
         }
         return propDefs;
     }
@@ -177,7 +177,7 @@ public class NodeTypeImpl implements Nod
         NodeDef[] cnda = ent.getMandatoryNodeDefs();
         NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length];
         for (int i = 0; i < cnda.length; i++) {
-            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i].getId());
+            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i]);
         }
         return nodeDefs;
     }
@@ -343,7 +343,7 @@ public class NodeTypeImpl implements Nod
         NodeDef[] cnda = ntd.getChildNodeDefs();
         NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length];
         for (int i = 0; i < cnda.length; i++) {
-            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i].getId());
+            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i]);
         }
         return nodeDefs;
     }
@@ -391,7 +391,7 @@ public class NodeTypeImpl implements Nod
         NodeDef[] cnda = ent.getAllNodeDefs();
         NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length];
         for (int i = 0; i < cnda.length; i++) {
-            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i].getId());
+            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i]);
         }
         return nodeDefs;
     }
@@ -403,7 +403,7 @@ public class NodeTypeImpl implements Nod
         PropDef[] pda = ent.getAllPropDefs();
         PropertyDefinition[] propDefs = new PropertyDefinition[pda.length];
         for (int i = 0; i < pda.length; i++) {
-            propDefs[i] = ntMgr.getPropertyDefinition(pda[i].getId());
+            propDefs[i] = ntMgr.getPropertyDefinition(pda[i]);
         }
         return propDefs;
     }
@@ -601,7 +601,7 @@ public class NodeTypeImpl implements Nod
         PropDef[] pda = ntd.getPropertyDefs();
         PropertyDefinition[] propDefs = new PropertyDefinition[pda.length];
         for (int i = 0; i < pda.length; i++) {
-            propDefs[i] = ntMgr.getPropertyDefinition(pda[i].getId());
+            propDefs[i] = ntMgr.getPropertyDefinition(pda[i]);
         }
         return propDefs;
     }

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java Tue May 11 21:32:42 2010
@@ -137,7 +137,7 @@ public class NodeTypeManagerImpl impleme
 
         rootNodeDef =
             new NodeDefinitionImpl(ntReg.getRootNodeDef(), this, session);
-        ndCache.put(rootNodeDef.unwrap().getId(), rootNodeDef);
+        ndCache.put(rootNodeDef.unwrap(), rootNodeDef);
     }
 
     /**
@@ -148,36 +148,30 @@ public class NodeTypeManagerImpl impleme
     }
 
     /**
-     * @param id
+     * @param def internal node definition
      * @return the node definition
      */
-    public NodeDefinitionImpl getNodeDefinition(NodeDefId id) {
+    public NodeDefinitionImpl getNodeDefinition(NodeDef def) {
         synchronized (ndCache) {
-            NodeDefinitionImpl ndi = (NodeDefinitionImpl) ndCache.get(id);
+            NodeDefinitionImpl ndi = (NodeDefinitionImpl) ndCache.get(def);
             if (ndi == null) {
-                NodeDef nd = ntReg.getNodeDef(id);
-                if (nd != null) {
-                    ndi = new NodeDefinitionImpl(nd, this, session);
-                    ndCache.put(id, ndi);
-                }
+                ndi = new NodeDefinitionImpl(def, this, session);
+                ndCache.put(def, ndi);
             }
             return ndi;
         }
     }
 
     /**
-     * @param id
+     * @param def internal property definition
      * @return the property definition
      */
-    public PropertyDefinitionImpl getPropertyDefinition(PropDefId id) {
+    public PropertyDefinitionImpl getPropertyDefinition(PropDef def) {
         synchronized (pdCache) {
-            PropertyDefinitionImpl pdi = (PropertyDefinitionImpl) pdCache.get(id);
+            PropertyDefinitionImpl pdi = (PropertyDefinitionImpl) pdCache.get(def);
             if (pdi == null) {
-                PropDef pd = ntReg.getPropDef(id);
-                if (pd != null) {
-                    pdi = new PropertyDefinitionImpl(pd, this, session);
-                    pdCache.put(id, pdi);
-                }
+                pdi = new PropertyDefinitionImpl(def, this, session);
+                pdCache.put(def, pdi);
             }
             return pdi;
         }

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java Tue May 11 21:32:42 2010
@@ -567,14 +567,6 @@ public class NodeTypeRegistry implements
     }
 
     /**
-     * @param id
-     * @return the property definition for the given id.
-     */
-    public PropDef getPropDef(PropDefId id) {
-        return (PropDef) propDefs.get(id);
-    }
-
-    /**
      * Add a <code>NodeTypeRegistryListener</code>
      *
      * @param listener the new listener to be informed on (un)registration
@@ -619,7 +611,7 @@ public class NodeTypeRegistry implements
             PropDef[] pd = ntd.getPropertyDefs();
             for (int i = 0; i < pd.length; i++) {
                 ps.print("\tPropertyDefinition");
-                ps.println(" (declared in " + pd[i].getDeclaringNodeType() + ") id=" + pd[i].getId());
+                ps.println(" (declared in " + pd[i].getDeclaringNodeType() + ")");
                 ps.println("\t\tName\t\t" + (pd[i].definesResidual() ? "*" : pd[i].getName().toString()));
                 String type = pd[i].getRequiredType() == 0 ? "null" : PropertyType.nameFromValue(pd[i].getRequiredType());
                 ps.println("\t\tRequiredType\t" + type);
@@ -658,7 +650,7 @@ public class NodeTypeRegistry implements
             NodeDef[] nd = ntd.getChildNodeDefs();
             for (int i = 0; i < nd.length; i++) {
                 ps.print("\tNodeDefinition");
-                ps.println(" (declared in " + nd[i].getDeclaringNodeType() + ") id=" + nd[i].getId());
+                ps.println(" (declared in " + nd[i].getDeclaringNodeType() + ")");
                 ps.println("\t\tName\t\t" + (nd[i].definesResidual() ? "*" : nd[i].getName().toString()));
                 Name[] reqPrimaryTypes = nd[i].getRequiredPrimaryTypes();
                 if (reqPrimaryTypes != null && reqPrimaryTypes.length > 0) {
@@ -748,7 +740,7 @@ public class NodeTypeRegistry implements
 
         // setup definition of root node
         rootNodeDef = createRootNodeDef();
-        nodeDefs.put(rootNodeDef.getId(), rootNodeDef);
+        nodeDefs.put(new NodeDefId(rootNodeDef), rootNodeDef);
 
         // load and register pre-defined (i.e. built-in) node types
         builtInNTDefs = new NodeTypeDefStore();
@@ -1235,11 +1227,11 @@ public class NodeTypeRegistry implements
         // store property & child node definitions of new node type by id
         PropDef[] pda = ntd.getPropertyDefs();
         for (int i = 0; i < pda.length; i++) {
-            propDefs.put(pda[i].getId(), pda[i]);
+            propDefs.put(new PropDefId(pda[i]), pda[i]);
         }
         NodeDef[] nda = ntd.getChildNodeDefs();
         for (int i = 0; i < nda.length; i++) {
-            nodeDefs.put(nda[i].getId(), nda[i]);
+            nodeDefs.put(new NodeDefId(nda[i]), nda[i]);
         }
 
         return ent;
@@ -1321,11 +1313,11 @@ public class NodeTypeRegistry implements
             // store property & child node definitions of new node type by id
             PropDef[] pda = ntd.getPropertyDefs();
             for (int i = 0; i < pda.length; i++) {
-                propDefs.put(pda[i].getId(), pda[i]);
+                propDefs.put(new PropDefId(pda[i]), pda[i]);
             }
             NodeDef[] nda = ntd.getChildNodeDefs();
             for (int i = 0; i < nda.length; i++) {
-                nodeDefs.put(nda[i].getId(), nda[i]);
+                nodeDefs.put(new NodeDefId(nda[i]), nda[i]);
             }
         }
 
@@ -1344,11 +1336,11 @@ public class NodeTypeRegistry implements
         // remove property & child node definitions
         PropDef[] pda = ntd.getPropertyDefs();
         for (int i = 0; i < pda.length; i++) {
-            propDefs.remove(pda[i].getId());
+            propDefs.remove(new PropDefId(pda[i]));
         }
         NodeDef[] nda = ntd.getChildNodeDefs();
         for (int i = 0; i < nda.length; i++) {
-            nodeDefs.remove(nda[i].getId());
+            nodeDefs.remove(new NodeDefId(nda[i]));
         }
     }
 

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/virtual/VirtualNodeTypeStateProvider.java Tue May 11 21:32:42 2010
@@ -75,9 +75,6 @@ public class VirtualNodeTypeStateProvide
      */
     protected VirtualNodeState createRootNodeState() throws RepositoryException {
         VirtualNodeState root = new VirtualNodeState(this, parentId, rootNodeId, NameConstants.REP_NODETYPES, null);
-        NodeDefId id = ntReg.getEffectiveNodeType(NameConstants.REP_SYSTEM).getApplicableChildNodeDef(
-                NameConstants.JCR_NODETYPES, NameConstants.REP_NODETYPES, ntReg).getId();
-        root.setDefinitionId(id);
         Name[] ntNames = ntReg.getRegisteredNodeTypes();
         for (int i = 0; i < ntNames.length; i++) {
             NodeTypeDef ntDef = ntReg.getNodeTypeDef(ntNames[i]);

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PersistenceCopier.java Tue May 11 21:32:42 2010
@@ -136,7 +136,6 @@ public class PersistenceCopier {
             // Copy the node state
             NodeState targetNode = target.createNew(sourceNode.getNodeId());
             targetNode.setParentId(sourceNode.getParentId());
-            targetNode.setDefinitionId(sourceNode.getDefinitionId());
             targetNode.setNodeTypeName(sourceNode.getNodeTypeName());
             targetNode.setMixinTypeNames(sourceNode.getMixinTypeNames());
             targetNode.setPropertyNames(sourceNode.getPropertyNames());
@@ -154,7 +153,6 @@ public class PersistenceCopier {
                 PropertyId id = new PropertyId(sourceNode.getNodeId(), name);
                 PropertyState sourceState = source.load(id);
                 PropertyState targetState = target.createNew(id);
-                targetState.setDefinitionId(sourceState.getDefinitionId());
                 targetState.setType(sourceState.getType());
                 targetState.setMultiValued(sourceState.isMultiValued());
                 InternalValue[] values = sourceState.getValues();

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java Tue May 11 21:32:42 2010
@@ -31,7 +31,6 @@ import org.apache.jackrabbit.core.state.
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.NamespaceRegistryImpl;
-import org.apache.jackrabbit.core.nodetype.PropDefId;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.persistence.IterablePersistenceManager;
 import org.apache.jackrabbit.core.persistence.PMContext;
@@ -110,15 +109,6 @@ public abstract class AbstractBundlePers
     /** the cache of non-existent bundles */
     private LRUNodeIdCache missing;
 
-    /** definition id of the jcr:uuid property */
-    private PropDefId idJcrUUID;
-
-    /** definition id of the jcr:primaryType property */
-    private PropDefId idJcrPrimaryType;
-
-    /** definition id of the jcr:mixinTypes property */
-    private PropDefId idJcrMixinTypes;
-
     /** the persistence manager context */
     protected PMContext context;
 
@@ -410,18 +400,6 @@ public abstract class AbstractBundlePers
         // init bundle cache
         bundles = new BundleCache(bundleCacheSize);
         missing = new LRUNodeIdCache();
-
-        // init property definitions
-        if (context.getNodeTypeRegistry() != null) {
-            idJcrUUID = context.getNodeTypeRegistry()
-                .getEffectiveNodeType(NameConstants.MIX_REFERENCEABLE)
-                .getApplicablePropertyDef(NameConstants.JCR_UUID, PropertyType.STRING, false)
-                .getId();
-            idJcrPrimaryType = context.getNodeTypeRegistry().getEffectiveNodeType(NameConstants.NT_BASE).getApplicablePropertyDef(
-                    NameConstants.JCR_PRIMARYTYPE, PropertyType.NAME, false).getId();
-            idJcrMixinTypes = context.getNodeTypeRegistry().getEffectiveNodeType(NameConstants.NT_BASE).getApplicablePropertyDef(
-                    NameConstants.JCR_MIXINTYPES, PropertyType.NAME, true).getId();
-        }
     }
     
     /**
@@ -466,20 +444,17 @@ public abstract class AbstractBundlePers
             if (id.getName().equals(NameConstants.JCR_UUID)) {
                 state = createNew(id);
                 state.setType(PropertyType.STRING);
-                state.setDefinitionId(idJcrUUID);
                 state.setMultiValued(false);
                 state.setValues(new InternalValue[]{InternalValue.create(id.getParentId().getUUID().toString())});
             } else if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)) {
                 state = createNew(id);
                 state.setType(PropertyType.NAME);
-                state.setDefinitionId(idJcrPrimaryType);
                 state.setMultiValued(false);
                 state.setValues(new InternalValue[]{InternalValue.create(bundle.getNodeTypeName())});
             } else if (id.getName().equals(NameConstants.JCR_MIXINTYPES)) {
                 Set mixins = bundle.getMixinTypeNames();
                 state = createNew(id);
                 state.setType(PropertyType.NAME);
-                state.setDefinitionId(idJcrMixinTypes);
                 state.setMultiValued(true);
                 state.setValues(InternalValue.create((Name[]) mixins.toArray(new Name[mixins.size()])));
             } else {

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java Tue May 11 21:32:42 2010
@@ -27,8 +27,6 @@ import org.apache.jackrabbit.core.util.S
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.value.BLOBFileValue;
 import org.apache.jackrabbit.core.data.DataStore;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.nodetype.PropDefId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
@@ -102,7 +100,7 @@ public class BundleBinding extends ItemS
         bundle.setParentId(readID(in));
 
         // definitionId
-        bundle.setNodeDefId(NodeDefId.valueOf(in.readUTF()));
+        in.readUTF();
 
         // mixin types
         Set mixinTypeNames = new HashSet();
@@ -275,7 +273,7 @@ public class BundleBinding extends ItemS
         writeID(out, bundle.getParentId());
 
         // definitionId
-        out.writeUTF(bundle.getNodeDefId().toString());
+        out.writeUTF("");
 
         // mixin types
         Iterator iter = bundle.getMixinTypeNames().iterator();
@@ -350,7 +348,7 @@ public class BundleBinding extends ItemS
         // multiValued
         entry.setMultiValued(in.readBoolean());
         // definitionId
-        entry.setPropDefId(PropDefId.valueOf(in.readUTF()));
+        in.readUTF();
         // values
         int count = in.readInt();   // count
         InternalValue[] values = new InternalValue[count];
@@ -592,7 +590,7 @@ public class BundleBinding extends ItemS
         // multiValued
         out.writeBoolean(state.isMultiValued());
         // definitionId
-        out.writeUTF(state.getPropDefId().toString());
+        out.writeUTF("");
         // values
         InternalValue[] values = state.getValues();
         out.writeInt(values.length); // count

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java (original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java Tue May 11 21:32:42 2010
@@ -26,7 +26,6 @@ import org.apache.jackrabbit.core.util.S
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.data.DataStore;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
@@ -200,7 +199,7 @@ public class ItemStateBinding {
         // parentUUID
         state.setParentId(readID(in));
         // definitionId
-        state.setDefinitionId(NodeDefId.valueOf(in.readUTF()));
+        in.readUTF();
 
         // mixin types
         int count = in.readInt();   // count
@@ -252,7 +251,7 @@ public class ItemStateBinding {
         // parentUUID
         writeID(out, state.getParentId());
         // definitionId
-        out.writeUTF(state.getDefinitionId().toString());
+        out.writeUTF("");
         // mixin types
         Collection c = state.getMixinTypeNames();
         out.writeInt(c.size()); // count



Mime
View raw message