jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1022909 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence: bundle/ pool/ util/
Date Fri, 15 Oct 2010 13:16:50 GMT
Author: jukka
Date: Fri Oct 15 13:16:50 2010
New Revision: 1022909

URL: http://svn.apache.org/viewvc?rev=1022909&view=rev
Log:
JCR-2762: Optimize bundle serialization

Avoid the extra byte in front of many names by writing out explicit counts before mixin types
and properties.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/AbstractBundlePersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleNames.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java?rev=1022909&r1=1022908&r2=1022909&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
Fri Oct 15 13:16:50 2010
@@ -16,6 +16,10 @@
  */
 package org.apache.jackrabbit.core.persistence.bundle;
 
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_MIXINTYPES;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_UUID;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.core.cache.ConcurrentCache;
@@ -40,8 +44,8 @@ import org.apache.jackrabbit.core.util.S
 import org.apache.jackrabbit.core.persistence.util.BLOBStore;
 import org.apache.jackrabbit.core.persistence.util.FileBasedIndex;
 import org.apache.jackrabbit.core.persistence.util.NodePropBundle;
+import org.apache.jackrabbit.core.persistence.util.NodePropBundle.PropertyEntry;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 import java.util.HashMap;
 import java.util.HashSet;
@@ -409,34 +413,37 @@ public abstract class AbstractBundlePers
     public PropertyState load(PropertyId id)
             throws NoSuchItemStateException, ItemStateException {
         NodePropBundle bundle = getBundle(id.getParentId());
-        if (bundle == null) {
-            throw new NoSuchItemStateException(id.toString());
-        }
-        PropertyState state = bundle.createPropertyState(this, id.getName());
-        if (state == null) {
-            // check if autocreated property state
-            if (id.getName().equals(NameConstants.JCR_UUID)) {
-                state = createNew(id);
+        if (bundle != null) {
+            PropertyState state = createNew(id);
+            PropertyEntry p = bundle.getPropertyEntry(id.getName());
+            if (p != null) {
+                state.setMultiValued(p.isMultiValued());
+                state.setType(p.getType());
+                state.setValues(p.getValues());
+                state.setModCount(p.getModCount());
+            } else if (id.getName().equals(JCR_UUID)) {
                 state.setType(PropertyType.STRING);
                 state.setMultiValued(false);
-                state.setValues(new InternalValue[]{InternalValue.create(id.getParentId().toString())});
-            } else if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)) {
-                state = createNew(id);
+                state.setValues(new InternalValue[] {
+                        InternalValue.create(id.getParentId().toString()) });
+            } else if (id.getName().equals(JCR_PRIMARYTYPE)) {
                 state.setType(PropertyType.NAME);
                 state.setMultiValued(false);
-                state.setValues(new InternalValue[]{InternalValue.create(bundle.getNodeTypeName())});
-            } else if (id.getName().equals(NameConstants.JCR_MIXINTYPES)) {
-                Set<Name> mixins = bundle.getMixinTypeNames();
-                state = createNew(id);
+                state.setValues(new InternalValue[] {
+                        InternalValue.create(bundle.getNodeTypeName()) });
+            } else if (id.getName().equals(JCR_MIXINTYPES)) {
                 state.setType(PropertyType.NAME);
                 state.setMultiValued(true);
-                state.setValues(InternalValue.create(mixins.toArray(new Name[mixins.size()])));
+                Set<Name> mixins = bundle.getMixinTypeNames();
+                state.setValues(InternalValue.create(
+                        mixins.toArray(new Name[mixins.size()])));
             } else {
                 throw new NoSuchItemStateException(id.toString());
             }
-            bundle.addProperty(state, getBlobStore());
+            return state;
+        } else {
+            throw new NoSuchItemStateException(id.toString());
         }
-        return state;
     }
 
     /**
@@ -446,7 +453,16 @@ public abstract class AbstractBundlePers
      */
     public boolean exists(PropertyId id) throws ItemStateException {
         NodePropBundle bundle = getBundle(id.getParentId());
-        return bundle != null && bundle.hasProperty(id.getName());
+        if (bundle != null) {
+            Name name = id.getName();
+            return bundle.hasProperty(name)
+                || JCR_PRIMARYTYPE.equals(name)
+                || (JCR_UUID.equals(name) && bundle.isReferenceable())
+                || (JCR_MIXINTYPES.equals(name)
+                        && !bundle.getMixinTypeNames().isEmpty());
+        } else {
+            return false;
+        }
     }
 
     /**
@@ -539,9 +555,9 @@ public abstract class AbstractBundlePers
             } else {
                 PropertyId id = (PropertyId) state.getId();
                 // skip redundant primaryType, mixinTypes and uuid properties
-                if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)
-                    || id.getName().equals(NameConstants.JCR_MIXINTYPES)
-                    || id.getName().equals(NameConstants.JCR_UUID)) {
+                if (id.getName().equals(JCR_PRIMARYTYPE)
+                    || id.getName().equals(JCR_MIXINTYPES)
+                    || id.getName().equals(JCR_UUID)) {
                     continue;
                 }
                 NodeId nodeId = id.getParentId();
@@ -587,9 +603,9 @@ public abstract class AbstractBundlePers
             if (!state.isNode()) {
                 PropertyId id = (PropertyId) state.getId();
                 // skip primaryType pr mixinTypes properties
-                if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)
-                    || id.getName().equals(NameConstants.JCR_MIXINTYPES)
-                    || id.getName().equals(NameConstants.JCR_UUID)) {
+                if (id.getName().equals(JCR_PRIMARYTYPE)
+                    || id.getName().equals(JCR_MIXINTYPES)
+                    || id.getName().equals(JCR_UUID)) {
                     continue;
                 }
                 NodeId nodeId = id.getParentId();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/AbstractBundlePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/AbstractBundlePersistenceManager.java?rev=1022909&r1=1022908&r2=1022909&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/AbstractBundlePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/AbstractBundlePersistenceManager.java
Fri Oct 15 13:16:50 2010
@@ -16,6 +16,10 @@
  */
 package org.apache.jackrabbit.core.persistence.pool;
 
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_MIXINTYPES;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.spi.commons.name.NameConstants.JCR_UUID;
+
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
@@ -37,6 +41,7 @@ import org.apache.jackrabbit.core.persis
 import org.apache.jackrabbit.core.persistence.util.BLOBStore;
 import org.apache.jackrabbit.core.persistence.util.FileBasedIndex;
 import org.apache.jackrabbit.core.persistence.util.NodePropBundle;
+import org.apache.jackrabbit.core.persistence.util.NodePropBundle.PropertyEntry;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ChangeLog;
 import org.apache.jackrabbit.core.state.ItemStateException;
@@ -47,7 +52,6 @@ import org.apache.jackrabbit.core.state.
 import org.apache.jackrabbit.core.util.StringIndex;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 /**
  * The <code>AbstractBundlePersistenceManager</code> acts as base for all
@@ -407,34 +411,37 @@ public abstract class AbstractBundlePers
      */
     public PropertyState load(PropertyId id) throws NoSuchItemStateException, ItemStateException
{
         NodePropBundle bundle = getBundle(id.getParentId());
-        if (bundle == null) {
-            throw new NoSuchItemStateException(id.toString());
-        }
-        PropertyState state = bundle.createPropertyState(this, id.getName());
-        if (state == null) {
-            // check if autocreated property state
-            if (id.getName().equals(NameConstants.JCR_UUID)) {
-                state = createNew(id);
+        if (bundle != null) {
+            PropertyState state = createNew(id);
+            PropertyEntry p = bundle.getPropertyEntry(id.getName());
+            if (p != null) {
+                state.setMultiValued(p.isMultiValued());
+                state.setType(p.getType());
+                state.setValues(p.getValues());
+                state.setModCount(p.getModCount());
+            } else if (id.getName().equals(JCR_UUID)) {
                 state.setType(PropertyType.STRING);
                 state.setMultiValued(false);
-                state.setValues(new InternalValue[]{InternalValue.create(id.getParentId().toString())});
-            } else if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)) {
-                state = createNew(id);
+                state.setValues(new InternalValue[] {
+                        InternalValue.create(id.getParentId().toString()) });
+            } else if (id.getName().equals(JCR_PRIMARYTYPE)) {
                 state.setType(PropertyType.NAME);
                 state.setMultiValued(false);
-                state.setValues(new InternalValue[]{InternalValue.create(bundle.getNodeTypeName())});
-            } else if (id.getName().equals(NameConstants.JCR_MIXINTYPES)) {
-                Set<Name> mixins = bundle.getMixinTypeNames();
-                state = createNew(id);
+                state.setValues(new InternalValue[] {
+                        InternalValue.create(bundle.getNodeTypeName()) });
+            } else if (id.getName().equals(JCR_MIXINTYPES)) {
                 state.setType(PropertyType.NAME);
                 state.setMultiValued(true);
-                state.setValues(InternalValue.create(mixins.toArray(new Name[mixins.size()])));
+                Set<Name> mixins = bundle.getMixinTypeNames();
+                state.setValues(InternalValue.create(
+                        mixins.toArray(new Name[mixins.size()])));
             } else {
                 throw new NoSuchItemStateException(id.toString());
             }
-            bundle.addProperty(state, getBlobStore());
+            return state;
+        } else {
+            throw new NoSuchItemStateException(id.toString());
         }
-        return state;
     }
 
     /**
@@ -444,7 +451,16 @@ public abstract class AbstractBundlePers
      */
     public boolean exists(PropertyId id) throws ItemStateException {
         NodePropBundle bundle = getBundle(id.getParentId());
-        return bundle != null && bundle.hasProperty(id.getName());
+        if (bundle != null) {
+            Name name = id.getName();
+            return bundle.hasProperty(name)
+                || JCR_PRIMARYTYPE.equals(name)
+                || (JCR_UUID.equals(name) && bundle.isReferenceable())
+                || (JCR_MIXINTYPES.equals(name)
+                        && !bundle.getMixinTypeNames().isEmpty());
+        } else {
+            return false;
+        }
     }
 
     /**
@@ -537,9 +553,9 @@ public abstract class AbstractBundlePers
             } else {
                 PropertyId id = (PropertyId) state.getId();
                 // skip redundant primaryType, mixinTypes and uuid properties
-                if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)
-                    || id.getName().equals(NameConstants.JCR_MIXINTYPES)
-                    || id.getName().equals(NameConstants.JCR_UUID)) {
+                if (id.getName().equals(JCR_PRIMARYTYPE)
+                    || id.getName().equals(JCR_MIXINTYPES)
+                    || id.getName().equals(JCR_UUID)) {
                     continue;
                 }
                 NodeId nodeId = id.getParentId();
@@ -585,9 +601,9 @@ public abstract class AbstractBundlePers
             if (!state.isNode()) {
                 PropertyId id = (PropertyId) state.getId();
                 // skip primaryType pr mixinTypes properties
-                if (id.getName().equals(NameConstants.JCR_PRIMARYTYPE)
-                    || id.getName().equals(NameConstants.JCR_MIXINTYPES)
-                    || id.getName().equals(NameConstants.JCR_UUID)) {
+                if (id.getName().equals(JCR_PRIMARYTYPE)
+                    || id.getName().equals(JCR_MIXINTYPES)
+                    || id.getName().equals(JCR_UUID)) {
                     continue;
                 }
                 NodeId nodeId = id.getParentId();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleNames.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleNames.java?rev=1022909&r1=1022908&r2=1022909&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleNames.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleNames.java
Fri Oct 15 13:16:50 2010
@@ -44,7 +44,7 @@ class BundleNames {
      */
     private static final Name[] NAME_ARRAY = {
         // WARNING: Only edit if you really know what you're doing!
-        null,
+
         // Most frequently used names
         NameConstants.NT_UNSTRUCTURED,
         NameConstants.NT_RESOURCE,

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java?rev=1022909&r1=1022908&r2=1022909&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleReader.java
Fri Oct 15 13:16:50 2010
@@ -151,27 +151,10 @@ class BundleReader {
         }
 
         // mixin types
-        Set<Name> mixinTypeNames = new HashSet<Name>();
-        Name name = readIndexedQName();
-        while (name != null) {
-            mixinTypeNames.add(name);
-            name = readIndexedQName();
-        }
-        bundle.setMixinTypeNames(mixinTypeNames);
+        readMixinTypes(bundle);
 
         // properties
-        name = readIndexedQName();
-        while (name != null) {
-            PropertyId pId = new PropertyId(id, name);
-            NodePropBundle.PropertyEntry pState = readPropertyEntry(pId);
-            // skip redundant primaryType, mixinTypes and uuid properties
-            if (!name.equals(NameConstants.JCR_PRIMARYTYPE)
-                && !name.equals(NameConstants.JCR_MIXINTYPES)
-                && !name.equals(NameConstants.JCR_UUID)) {
-                bundle.addProperty(pState);
-            }
-            name = readIndexedQName();
-        }
+        readProperties(bundle);
 
         // set referenceable flag
         bundle.setReferenceable(in.readBoolean());
@@ -192,6 +175,58 @@ class BundleReader {
         return bundle;
     }
 
+    private void readMixinTypes(NodePropBundle bundle) throws IOException {
+        if (version >= BundleBinding.VERSION_3) {
+            int n = readVarInt();
+            if (n == 0) {
+                bundle.setMixinTypeNames(Collections.<Name>emptySet());
+            } else if (n == 1) {
+                bundle.setMixinTypeNames(Collections.singleton(readName()));
+            } else {
+                Set<Name> mixins = new HashSet<Name>(n * 2);
+                for (int i = 0; i < n; i++) {
+                    mixins.add(readName());
+                }
+                bundle.setMixinTypeNames(mixins);
+            }
+        } else {
+            Name name = readIndexedQName();
+            if (name == null) {
+                bundle.setMixinTypeNames(Collections.<Name>emptySet());
+            } else {
+                Set<Name> mixinTypeNames = new HashSet<Name>();
+                do {
+                    mixinTypeNames.add(name);
+                    name = readIndexedQName();
+                } while (name != null);
+                bundle.setMixinTypeNames(mixinTypeNames);
+            }
+        }
+    }
+
+    private void readProperties(NodePropBundle bundle) throws IOException {
+        if (version >= BundleBinding.VERSION_3) {
+            int n = readVarInt();
+            for (int i = 0; i < n; i++) {
+                PropertyId id = new PropertyId(bundle.getId(), readName());
+                bundle.addProperty(readPropertyEntry(id));
+            }
+        } else {
+            Name name = readIndexedQName();
+            while (name != null) {
+                PropertyId pId = new PropertyId(bundle.getId(), name);
+                NodePropBundle.PropertyEntry pState = readPropertyEntry(pId);
+                // skip redundant primaryType, mixinTypes and uuid properties
+                if (!name.equals(NameConstants.JCR_PRIMARYTYPE)
+                        && !name.equals(NameConstants.JCR_MIXINTYPES)
+                        && !name.equals(NameConstants.JCR_UUID)) {
+                    bundle.addProperty(pState);
+                }
+                name = readIndexedQName();
+            }
+        }
+    }
+
     private void readSharedSet(NodePropBundle bundle) throws IOException {
         Set<NodeId> sharedSet;
         if (version >= BundleBinding.VERSION_3) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java?rev=1022909&r1=1022908&r2=1022909&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/BundleWriter.java
Fri Oct 15 13:16:50 2010
@@ -23,6 +23,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.util.Calendar;
+import java.util.Collection;
 import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Set;
@@ -35,8 +36,8 @@ import org.apache.jackrabbit.core.data.D
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.persistence.util.NodePropBundle.ChildNodeEntry;
+import org.apache.jackrabbit.core.persistence.util.NodePropBundle.PropertyEntry;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -95,28 +96,10 @@ class BundleWriter {
         writeNodeId(bundle.getParentId());
 
         // mixin types
-        for (Name name : bundle.getMixinTypeNames()) {
-            writeName(name);
-        }
-        writeName(null);
+        writeMixinTypes(bundle);
 
         // properties
-        for (Name pName : bundle.getPropertyNames()) {
-            // skip redundant primaryType, mixinTypes and uuid properties
-            if (pName.equals(NameConstants.JCR_PRIMARYTYPE)
-                || pName.equals(NameConstants.JCR_MIXINTYPES)
-                || pName.equals(NameConstants.JCR_UUID)) {
-                continue;
-            }
-            NodePropBundle.PropertyEntry pState = bundle.getPropertyEntry(pName);
-            if (pState == null) {
-                log.error("PropertyState missing in bundle: " + pName);
-            } else {
-                writeName(pName);
-                writeState(pState);
-            }
-        }
-        writeName(null);
+        writeProperties(bundle);
 
         // write uuid flag
         out.writeBoolean(bundle.isReferenceable());
@@ -134,6 +117,22 @@ class BundleWriter {
         bundle.setSize(out.size() - size);
     }
 
+    private void writeMixinTypes(NodePropBundle bundle) throws IOException {
+        Set<Name> mixins = bundle.getMixinTypeNames();
+        writeVarInt(mixins.size());
+        for (Name name : mixins) {
+            writeName(name);
+        }
+    }
+
+    private void writeProperties(NodePropBundle bundle) throws IOException {
+        Collection<PropertyEntry> properties = bundle.getPropertyEntries();
+        writeVarInt(properties.size());
+        for (PropertyEntry property : properties) {
+            writeState(property);
+        }
+    }
+
     private void writeChildNodeEntries(NodePropBundle bundle)
             throws IOException {
         List<ChildNodeEntry> chilren = bundle.getChildNodeEntries();
@@ -153,8 +152,9 @@ class BundleWriter {
     }
 
     /**
-     * Serializes a property entry. The serialization begins with a single
-     * byte that encodes the type and multi-valuedness of the property:
+     * Serializes a property entry. The serialization begins with the
+     * property name followed by a single byte that encodes the type and
+     * multi-valuedness of the property:
      * <pre>
      * +-------------------------------+
      * |   mv count    |     type      |
@@ -182,6 +182,8 @@ class BundleWriter {
      */
     private void writeState(NodePropBundle.PropertyEntry state)
             throws IOException {
+        writeName(state.getName());
+
         InternalValue[] values = state.getValues();
 
         int type = state.getType();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java?rev=1022909&r1=1022908&r2=1022909&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/NodePropBundle.java
Fri Oct 15 13:16:50 2010
@@ -177,25 +177,6 @@ public class NodePropBundle {
     }
 
     /**
-     * Creates a property state from the values of this bundle
-     * @param pMgr the persistence manager
-     * @param name the name of the new property
-     * @return the new property state
-     */
-    public PropertyState createPropertyState(PersistenceManager pMgr, Name name) {
-        PropertyEntry p = getPropertyEntry(name);
-        if (p == null) {
-            return null;
-        }
-        PropertyState ps = pMgr.createNew(new PropertyId(id, name));
-        ps.setMultiValued(p.isMultiValued());
-        ps.setType(p.getType());
-        ps.setValues(p.getValues());
-        ps.setModCount(p.getModCount());
-        return ps;
-    }
-
-    /**
      * Checks if this bundle is new.
      * @return <code>true</code> if this bundle is new;
      *         <code>false</code> otherwise.
@@ -322,6 +303,9 @@ public class NodePropBundle {
      * @param entry the enrty to add
      */
     public void addProperty(PropertyEntry entry) {
+        assert !NameConstants.JCR_PRIMARYTYPE.equals(entry.getName());
+        assert !NameConstants.JCR_MIXINTYPES.equals(entry.getName());
+        assert !NameConstants.JCR_UUID.equals(entry.getName());
         properties.put(entry.getName(), entry);
     }
 
@@ -346,10 +330,7 @@ public class NodePropBundle {
      *         <code>false</code> otherwise.
      */
     public boolean hasProperty(Name name) {
-        return properties.containsKey(name)
-                || name.equals(NameConstants.JCR_PRIMARYTYPE)
-                || (isReferenceable && name.equals(NameConstants.JCR_UUID))
-                || (mixinTypeNames.size() > 0 && name.equals(NameConstants.JCR_MIXINTYPES));
+        return properties.containsKey(name);
     }
 
     /**



Mime
View raw message