jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r943301 [2/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
Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.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/NodePropBundle.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java
Tue May 11 21:32:42 2010
@@ -32,8 +32,6 @@ import org.apache.jackrabbit.core.persis
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.nodetype.PropDefId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.slf4j.Logger;
@@ -76,11 +74,6 @@ public class NodePropBundle {
     private Set mixinTypeNames;
 
     /**
-     * the nodedef id
-     */
-    private NodeDefId nodeDefId;
-
-    /**
      * the child node entries
      */
     private LinkedList childNodeEntries = new LinkedList();
@@ -148,7 +141,6 @@ public class NodePropBundle {
         parentId = state.getParentId();
         nodeTypeName = state.getNodeTypeName();
         mixinTypeNames = state.getMixinTypeNames();
-        nodeDefId = state.getDefinitionId();
         isReferenceable = state.hasPropertyName(NameConstants.JCR_UUID);
         modCount = state.getModCount();
         List list = state.getChildNodeEntries();
@@ -171,7 +163,6 @@ public class NodePropBundle {
         state.setParentId(parentId);
         state.setNodeTypeName(nodeTypeName);
         state.setMixinTypeNames(mixinTypeNames);
-        state.setDefinitionId(nodeDefId);
         state.setModCount(modCount);
         Iterator iter = childNodeEntries.iterator();
         while (iter.hasNext()) {
@@ -208,7 +199,6 @@ public class NodePropBundle {
             return null;
         }
         PropertyState ps = pMgr.createNew(new PropertyId(id, name));
-        ps.setDefinitionId(p.getPropDefId());
         ps.setMultiValued(p.isMultiValued());
         ps.setType(p.getType());
         ps.setValues(p.getValues());
@@ -289,22 +279,6 @@ public class NodePropBundle {
     }
 
     /**
-     * Returns the node def id of this bundle.
-     * @return the node def id.
-     */
-    public NodeDefId getNodeDefId() {
-        return nodeDefId;
-    }
-
-    /**
-     * Sets the node def id.
-     * @param nodeDefId the node def id.
-     */
-    public void setNodeDefId(NodeDefId nodeDefId) {
-        this.nodeDefId = nodeDefId;
-    }
-
-    /**
      * Checks if this bundle is referenceable.
      * @return <code>true</code> if this bundle is referenceable;
      *         <code>false</code> otherwise.
@@ -554,11 +528,6 @@ public class NodePropBundle {
         private boolean multiValued;
 
         /**
-         * the propedef id
-         */
-        private PropDefId propDefId;
-
-        /**
          * the blob ids
          */
         private String[] blobIds = null;
@@ -586,7 +555,6 @@ public class NodePropBundle {
             values = state.getValues();
             type = state.getType();
             multiValued = state.isMultiValued();
-            propDefId = state.getDefinitionId();
             modCount = state.getModCount();
             if (type == PropertyType.BINARY) {
                 blobIds = new String[values.length];
@@ -658,22 +626,6 @@ public class NodePropBundle {
         }
 
         /**
-         * Returns the propdef id.
-         * @return the propdef id.
-         */
-        public PropDefId getPropDefId() {
-            return propDefId;
-        }
-
-        /**
-         * Sets the propdef id
-         * @param propDefId the propdef id
-         */
-        public void setPropDefId(PropDefId propDefId) {
-            this.propDefId = propDefId;
-        }
-
-        /**
          * Returns the n<sup>th</sup> blob id.
          * @param n the index of the blob id
          * @return the blob id

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
Tue May 11 21:32:42 2010
@@ -84,7 +84,7 @@ public final class Serializer {
             out.write(state.getParentId().getUUID().getRawBytes());
         }
         // definitionId
-        out.writeUTF(state.getDefinitionId().toString());
+        out.writeUTF("");
         // mixin types
         Collection c = state.getMixinTypeNames();
         out.writeInt(c.size()); // count
@@ -133,8 +133,7 @@ public final class Serializer {
             state.setParentId(new NodeId(new UUID(uuidBytes)));
         }
         // definitionId
-        s = in.readUTF();
-        state.setDefinitionId(NodeDefId.valueOf(s));
+        in.readUTF();
         // mixin types
         int count = in.readInt();   // count
         Set set = new HashSet(count);
@@ -185,7 +184,7 @@ public final class Serializer {
         // multiValued
         out.writeBoolean(state.isMultiValued());
         // definitionId
-        out.writeUTF(state.getDefinitionId().toString());
+        out.writeUTF("");
         // modCount
         out.writeShort(state.getModCount());
         // values
@@ -262,8 +261,7 @@ public final class Serializer {
         boolean multiValued = in.readBoolean();
         state.setMultiValued(multiValued);
         // definitionId
-        String s = in.readUTF();
-        state.setDefinitionId(PropDefId.valueOf(s));
+        in.readUTF();
         // modCount
         short modCount = in.readShort();
         state.setModCount(modCount);
@@ -273,7 +271,7 @@ public final class Serializer {
         for (int i = 0; i < count; i++) {
             InternalValue val;
             if (type == PropertyType.BINARY) {
-                s = in.readUTF();   // value (i.e. blobId)
+                String s = in.readUTF();   // value (i.e. blobId)
                 // special handling required for binary value:
                 // the value stores the id of the BLOB data
                 // in the BLOB store
@@ -305,7 +303,7 @@ public final class Serializer {
                 int len = in.readInt(); // lenght of byte[]
                 byte[] bytes = new byte[len];
                 in.readFully(bytes); // byte[]
-                s = new String(bytes, ENCODING);
+                String s = new String(bytes, ENCODING);
                 val = InternalValue.valueOf(s, type);
             }
             values[i] = val;

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java
Tue May 11 21:32:42 2010
@@ -24,8 +24,6 @@ import org.apache.jackrabbit.core.fs.Fil
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
 import org.apache.jackrabbit.core.fs.local.LocalFileSystem;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.nodetype.PropDefId;
 import org.apache.jackrabbit.core.persistence.AbstractPersistenceManager;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
@@ -90,7 +88,6 @@ public class XMLPersistenceManager exten
     private static final String UUID_ATTRIBUTE = "uuid";
     private static final String NODETYPE_ATTRIBUTE = "nodeType";
     private static final String PARENTUUID_ATTRIBUTE = "parentUUID";
-    private static final String DEFINITIONID_ATTRIBUTE = "definitionId";
     private static final String MODCOUNT_ATTRIBUTE = "modCount";
 
     private static final String MIXINTYPES_ELEMENT = "mixinTypes";
@@ -246,10 +243,6 @@ public class XMLPersistenceManager exten
             state.setParentId(NodeId.valueOf(parentUUID));
         }
 
-        // definition id
-        String definitionId = walker.getAttribute(DEFINITIONID_ATTRIBUTE);
-        state.setDefinitionId(NodeDefId.valueOf(definitionId));
-
         // modification count
         String modCount = walker.getAttribute(MODCOUNT_ATTRIBUTE);
         state.setModCount(Short.parseShort(modCount));
@@ -327,10 +320,6 @@ public class XMLPersistenceManager exten
         String multiValued = walker.getAttribute(MULTIVALUED_ATTRIBUTE);
         state.setMultiValued(Boolean.getBoolean(multiValued));
 
-        // definition id
-        String definitionId = walker.getAttribute(DEFINITIONID_ATTRIBUTE);
-        state.setDefinitionId(PropDefId.valueOf(definitionId));
-
         // modification count
         String modCount = walker.getAttribute(MODCOUNT_ATTRIBUTE);
         state.setModCount(Short.parseShort(modCount));
@@ -570,7 +559,6 @@ public class XMLPersistenceManager exten
                 writer.write("<" + NODE_ELEMENT + " "
                         + UUID_ATTRIBUTE + "=\"" + id.getUUID() + "\" "
                         + PARENTUUID_ATTRIBUTE + "=\"" + parentId + "\" "
-                        + DEFINITIONID_ATTRIBUTE + "=\"" + state.getDefinitionId().toString()
+ "\" "
                         + MODCOUNT_ATTRIBUTE + "=\"" + state.getModCount() + "\" "
                         + NODETYPE_ATTRIBUTE + "=\"" + encodedNodeType + "\">\n");
 
@@ -658,7 +646,6 @@ public class XMLPersistenceManager exten
                         + NAME_ATTRIBUTE + "=\"" + Text.encodeIllegalXMLCharacters(state.getName().toString())
+ "\" "
                         + PARENTUUID_ATTRIBUTE + "=\"" + state.getParentId().getUUID() +
"\" "
                         + MULTIVALUED_ATTRIBUTE + "=\"" + Boolean.toString(state.isMultiValued())
+ "\" "
-                        + DEFINITIONID_ATTRIBUTE + "=\"" + state.getDefinitionId().toString()
+ "\" "
                         + MODCOUNT_ATTRIBUTE + "=\"" + state.getModCount() + "\" "
                         + TYPE_ATTRIBUTE + "=\"" + typeName + "\">\n");
                 // values

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Tue May 11 21:32:42 2010
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.core.state
 
 import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.spi.Name;
 
 import java.util.ArrayList;
@@ -56,11 +55,6 @@ public class NodeState extends ItemState
     private NodeId parentId;
 
     /**
-     * id of this node's definition
-     */
-    private NodeDefId defId;
-
-    /**
      * insertion-ordered collection of ChildNodeEntry objects
      */
     private ChildNodeEntries childNodeEntries = new ChildNodeEntries();
@@ -127,7 +121,6 @@ public class NodeState extends ItemState
             parentId = nodeState.parentId;
             nodeTypeName = nodeState.nodeTypeName;
             mixinTypeNames = (NameSet) nodeState.mixinTypeNames.clone();
-            defId = nodeState.defId;
             propertyNames = (NameSet) nodeState.propertyNames.clone();
             childNodeEntries = (ChildNodeEntries) nodeState.childNodeEntries.clone();
             if (syncModCount) {
@@ -211,24 +204,6 @@ public class NodeState extends ItemState
     }
 
     /**
-     * Returns the id of the definition applicable to this node state.
-     *
-     * @return the id of the definition
-     */
-    public NodeDefId getDefinitionId() {
-        return defId;
-    }
-
-    /**
-     * Sets the id of the definition applicable to this node state.
-     *
-     * @param defId the id of the definition
-     */
-    public void setDefinitionId(NodeDefId defId) {
-        this.defId = defId;
-    }
-
-    /**
      * Determines if there are any child node entries.
      *
      * @return <code>true</code> if there are child node entries,

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
Tue May 11 21:32:42 2010
@@ -51,11 +51,6 @@ public class PropertyState extends ItemS
     private boolean multiValued;
 
     /**
-     * the property definition id
-     */
-    private PropDefId defId;
-
-    /**
      * Constructs a new property state that is initially connected to an
      * overlayed state.
      *
@@ -92,7 +87,6 @@ public class PropertyState extends ItemS
             PropertyState propState = (PropertyState) state;
             id = propState.id;
             type = propState.type;
-            defId = propState.defId;
             values = propState.values;
             multiValued = propState.multiValued;
             if (syncModCount) {
@@ -183,24 +177,6 @@ public class PropertyState extends ItemS
     }
 
     /**
-     * Returns the id of the definition applicable to this property state.
-     *
-     * @return the id of the definition
-     */
-    public PropDefId getDefinitionId() {
-        return defId;
-    }
-
-    /**
-     * Sets the id of the definition applicable to this property state.
-     *
-     * @param defId the id of the definition
-     */
-    public void setDefinitionId(PropDefId defId) {
-        this.defId = defId;
-    }
-
-    /**
      * Sets the value(s) of this property.
      *
      * @param values the new values

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
Tue May 11 21:32:42 2010
@@ -23,6 +23,7 @@ import org.apache.jackrabbit.core.ItemId
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.ZombieHierarchyManager;
+import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.util.Dumpable;
@@ -782,7 +783,7 @@ public class SessionItemStateManager
      *
      * @return attic
      */
-    ItemStateManager getAttic() {
+    public ItemStateManager getAttic() {
         if (attic == null) {
             attic = new AtticItemStateManager();
         }
@@ -861,14 +862,19 @@ public class SessionItemStateManager
                                 }
 
                                 public boolean allowsSameNameSiblings(NodeId id) {
-                                    NodeState ns;
                                     try {
-                                        ns = (NodeState) getItemState(id);
-                                    } catch (ItemStateException e) {
+                                        NodeState ns = (NodeState) getItemState(id);
+                                        NodeState parent = (NodeState) getItemState(ns.getParentId());
+                                        Name name = parent.getChildNodeEntry(id).getName();
+                                        EffectiveNodeType ent = ntReg.getEffectiveNodeType(
+                                                parent.getNodeTypeName(),
+                                                parent.getMixinTypeNames());
+                                        NodeDef def = ent.getApplicableChildNodeDef(name,
ns.getNodeTypeName(), ntReg);
+                                        return def != null ? def.allowsSameNameSiblings()
: false;
+                                    } catch (Exception e) {
+                                        log.warn("Unable to get node definition", e);
                                         return false;
                                     }
-                                    NodeDef def = ntReg.getNodeDef(ns.getDefinitionId());
-                                    return def != null ? def.allowsSameNameSiblings() : false;
                                 }
                             };
                     if (NodeStateMerger.merge((NodeState) transientState, context)) {

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Tue May 11 21:32:42 2010
@@ -622,20 +622,30 @@ public class SharedItemStateManager
                                         }
 
                                         public boolean allowsSameNameSiblings(NodeId id)
{
-                                            NodeState ns;
                                             try {
-                                                if (local.has(id)) {
-                                                    ns = (NodeState) local.get(id);
-                                                } else {
-                                                    ns = (NodeState) getItemState(id);
-                                                }
-                                            } catch (ItemStateException e) {
+                                                NodeState ns = getNodeState(id);
+                                                NodeState parent = getNodeState(ns.getParentId());
+                                                Name name = parent.getChildNodeEntry(id).getName();
+                                                EffectiveNodeType ent = ntReg.getEffectiveNodeType(
+                                                        parent.getNodeTypeName(),
+                                                        parent.getMixinTypeNames());
+                                                NodeDef def = ent.getApplicableChildNodeDef(name,
ns.getNodeTypeName(), ntReg);
+                                                return def != null ? def.allowsSameNameSiblings()
: false;
+                                            } catch (Exception e) {
+                                                log.warn("Unable to get node definition",
e);
                                                 return false;
                                             }
-                                            NodeDef def = ntReg.getNodeDef(ns.getDefinitionId());
-                                            return def != null ? def.allowsSameNameSiblings()
: false;
                                         }
-                                    };
+
+                                        protected NodeState getNodeState(NodeId id)
+                                                throws ItemStateException {
+                                            if (local.has(id)) {
+                                                return (NodeState) local.get(id);
+                                            } else {
+                                                return (NodeState) getItemState(id);
+                                            }
+                                        }
+                            };
 
                             merged = NodeStateMerger.merge((NodeState) state, context);
                         }
@@ -1286,8 +1296,6 @@ public class SharedItemStateManager
             log.error(msg, cve);
             throw new ItemStateException(msg, cve);
         }
-        rootState.setDefinitionId(nodeDefId);
-        jcrSystemState.setDefinitionId(jcrSystemDefId);
 
         // create jcr:primaryType property on root node state
         rootState.addPropertyName(propDef.getName());
@@ -1296,7 +1304,6 @@ public class SharedItemStateManager
         prop.setValues(new InternalValue[]{InternalValue.create(NameConstants.REP_ROOT)});
         prop.setType(propDef.getRequiredType());
         prop.setMultiValued(propDef.isMultiple());
-        prop.setDefinitionId(propDef.getId());
 
         // create jcr:primaryType property on jcr:system node state
         jcrSystemState.addPropertyName(propDef.getName());
@@ -1305,7 +1312,6 @@ public class SharedItemStateManager
         primaryTypeProp.setValues(new InternalValue[]{InternalValue.create(NameConstants.REP_SYSTEM)});
         primaryTypeProp.setType(propDef.getRequiredType());
         primaryTypeProp.setMultiValued(propDef.isMultiple());
-        primaryTypeProp.setDefinitionId(propDef.getId());
 
         // add child node entry for jcr:system node
         rootState.addChildNodeEntry(NameConstants.JCR_SYSTEM, RepositoryImpl.SYSTEM_ROOT_NODE_ID);

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
Tue May 11 21:32:42 2010
@@ -20,10 +20,8 @@ import org.apache.jackrabbit.core.NodeId
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.PropertyImpl;
 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.NodeTypeRegistry;
-import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
@@ -263,9 +261,6 @@ public class NodeStateEx {
             propState.setType(type);
             propState.setMultiValued(multiValued);
 
-            PropDef pd = getEffectiveNodeType().getApplicablePropertyDef(name, type, multiValued);
-            propState.setDefinitionId(pd.getId());
-
             // need to store nodestate
             nodeState.addPropertyName(name);
             if (nodeState.getStatus() == ItemState.STATUS_EXISTING) {
@@ -451,10 +446,6 @@ public class NodeStateEx {
         }
         NodeState state = stateMgr.createNew(id, nodeTypeName, parentId);
 
-        NodeDef cnd =
-                getEffectiveNodeType().getApplicableChildNodeDef(name, nodeTypeName, ntReg);
-        state.setDefinitionId(cnd.getId());
-
         // create Node instance wrapping new node state
         NodeStateEx node = new NodeStateEx(stateMgr, ntReg, state, name);
         node.setPropertyValue(NameConstants.JCR_PRIMARYTYPE, InternalValue.create(nodeTypeName));

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
Tue May 11 21:32:42 2010
@@ -35,13 +35,11 @@ import org.apache.jackrabbit.core.state.
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.state.LocalItemStateManager;
-import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.SharedItemStateManager;
 import org.apache.jackrabbit.core.state.ISMLocking;
-import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.ISMLocking.ReadLock;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
@@ -143,12 +141,8 @@ public class VersionManagerImpl extends 
             if (!pMgr.exists(rootId)) {
                 NodeState root = pMgr.createNew(rootId);
                 root.setParentId(rootParentId);
-                root.setDefinitionId(ntReg.getEffectiveNodeType(NameConstants.REP_SYSTEM).getApplicableChildNodeDef(
-                        NameConstants.JCR_VERSIONSTORAGE, NameConstants.REP_VERSIONSTORAGE,
ntReg).getId());
                 root.setNodeTypeName(NameConstants.REP_VERSIONSTORAGE);
                 PropertyState pt = pMgr.createNew(new PropertyId(rootId, NameConstants.JCR_PRIMARYTYPE));
-                pt.setDefinitionId(ntReg.getEffectiveNodeType(NameConstants.REP_SYSTEM).getApplicablePropertyDef(
-                        NameConstants.JCR_PRIMARYTYPE, PropertyType.NAME, false).getId());
                 pt.setMultiValued(false);
                 pt.setType(PropertyType.NAME);
                 pt.setValues(new InternalValue[]{InternalValue.create(NameConstants.REP_VERSIONSTORAGE)});

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
Tue May 11 21:32:42 2010
@@ -21,7 +21,6 @@ import org.apache.jackrabbit.core.NodeId
 import org.apache.jackrabbit.core.PropertyId;
 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.NodeTypeConflictException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.nodetype.PropDef;
@@ -37,7 +36,6 @@ import org.apache.jackrabbit.core.state.
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.util.WeakIdentityCollection;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -257,12 +255,10 @@ public abstract class AbstractVISProvide
                                                     Name name, int type,
                                                     boolean multiValued)
             throws RepositoryException {
-        PropDef def = getApplicablePropertyDef(parent, name, type, multiValued);
         PropertyId id = new PropertyId(parent.getNodeId(), name);
         VirtualPropertyState prop = new VirtualPropertyState(id);
         prop.setType(type);
         prop.setMultiValued(multiValued);
-        prop.setDefinitionId(def.getId());
         return prop;
     }
 
@@ -272,26 +268,12 @@ public abstract class AbstractVISProvide
     public VirtualNodeState createNodeState(VirtualNodeState parent, Name name,
                                             NodeId id, Name nodeTypeName)
             throws RepositoryException {
-
-        NodeDefId def;
-        try {
-            def = getApplicableChildNodeDef(parent, name, nodeTypeName).getId();
-        } catch (RepositoryException re) {
-            // hack, use nt:unstructured as parent
-            NodeTypeRegistry ntReg = getNodeTypeRegistry();
-            EffectiveNodeType ent = ntReg.getEffectiveNodeType(NameConstants.NT_UNSTRUCTURED);
-            NodeDef cnd = ent.getApplicableChildNodeDef(name, nodeTypeName, ntReg);
-            ntReg.getNodeDef(cnd.getId());
-            def = cnd.getId();
-        }
-
         // create a new node state
         VirtualNodeState state;
         if (id == null) {
             id = new NodeId(UUID.randomUUID());
         }
         state = new VirtualNodeState(this, parent.getNodeId(), id, nodeTypeName, new Name[0]);
-        state.setDefinitionId(def);
 
         cache(state);
         return state;

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
Tue May 11 21:32:42 2010
@@ -170,7 +170,8 @@ public class PropInfo {
             // a property with that name already exists...
             PropertyId idExisting = new PropertyId(node.getNodeId(), name);
             prop = (PropertyState) itemOps.getItemState(idExisting);
-            def = ntReg.getPropDef(prop.getDefinitionId());
+            def = itemOps.findApplicablePropertyDefinition(
+                    prop.getName(), prop.getType(), prop.isMultiValued(), node);
             if (def.isProtected()) {
                 // skip protected property
                 log.debug("skipping protected property "

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=943301&r1=943300&r2=943301&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
Tue May 11 21:32:42 2010
@@ -425,7 +425,8 @@ public class WorkspaceImporter implement
                         parent.getChildNodeEntry(nodeName, 1);
                 NodeId idExisting = entry.getId();
                 NodeState existing = (NodeState) itemOps.getItemState(idExisting);
-                NodeDef def = ntReg.getNodeDef(existing.getDefinitionId());
+                NodeDef def = itemOps.findApplicableNodeDefinition(
+                        nodeName, existing.getNodeTypeName(), parent);
 
                 if (!def.allowsSameNameSiblings()) {
                     // existing doesn't allow same-name siblings,



Mime
View raw message