You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2016/10/19 15:13:57 UTC

svn commit: r1765658 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document: DocumentNodeState.java bundlor/BundlingHandler.java

Author: chetanm
Date: Wed Oct 19 15:13:57 2016
New Revision: 1765658

URL: http://svn.apache.org/viewvc?rev=1765658&view=rev
Log:
OAK-1312 - Bundle nodes into a document

Minimize the bundling logic overhead for non bundling case

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java?rev=1765658&r1=1765657&r2=1765658&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java Wed Oct 19 15:13:57 2016
@@ -220,7 +220,10 @@ public class DocumentNodeState extends A
     public Iterable<? extends PropertyState> getProperties() {
         //Filter out the meta properties related to bundling from
         //generic listing of props
-        return Iterables.filter(properties.values(), BundlorUtils.NOT_BUNDLOR_PROPS);
+        if (bundlingContext.isBundled()){
+            return Iterables.filter(properties.values(), BundlorUtils.NOT_BUNDLOR_PROPS);
+        }
+        return properties.values();
     }
 
     @Override
@@ -295,11 +298,15 @@ public class DocumentNodeState extends A
         return new Iterable<ChildNodeEntry>() {
             @Override
             public Iterator<ChildNodeEntry> iterator() {
-                //If all the children are bundled
-                if (bundlingContext.hasOnlyBundledChildren()){
-                    return getBundledChildren();
+                if (bundlingContext.isBundled()) {
+                    //If all the children are bundled
+                    if (bundlingContext.hasOnlyBundledChildren()){
+                        return getBundledChildren();
+                    }
+                    return Iterators.concat(getBundledChildren(), new ChildNodeEntryIterator());
                 }
-                return Iterators.concat(getBundledChildren(), new ChildNodeEntryIterator());
+
+                return new ChildNodeEntryIterator();
             }
         };
     }
@@ -809,21 +816,21 @@ public class DocumentNodeState extends A
         }
 
         public List<String> getBundledChildNodeNames(){
-            if (matcher.isMatch()) {
+            if (isBundled()) {
                 return BundlorUtils.getChildNodeNames(rootProperties.keySet(), matcher);
             }
             return Collections.emptyList();
         }
 
         private boolean hasBundledChildren(Matcher matcher){
-            if (matcher.isMatch()){
+            if (isBundled()){
                 return hasBundledProperty(rootProperties, matcher, DocumentBundlor.META_PROP_BUNDLED_CHILD);
             }
             return false;
         }
 
         private boolean hasNonBundledChildren(Matcher matcher){
-            if (matcher.isMatch()){
+            if (isBundled()){
                 return hasBundledProperty(rootProperties, matcher, DocumentBundlor.META_PROP_NON_BUNDLED_CHILD);
             }
             return false;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java?rev=1765658&r1=1765657&r2=1765658&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundlingHandler.java Wed Oct 19 15:13:57 2016
@@ -44,11 +44,11 @@ public class BundlingHandler {
     private final NodeState nodeState;
 
     public BundlingHandler(BundledTypesRegistry registry) {
-        this(registry, BundlingContext.NULL, ROOT_PATH, EMPTY_NODE);
+        this(checkNotNull(registry), BundlingContext.NULL, ROOT_PATH, EMPTY_NODE);
     }
 
     private BundlingHandler(BundledTypesRegistry registry, BundlingContext ctx, String path, NodeState nodeState) {
-        this.registry = checkNotNull(registry);
+        this.registry = registry;
         this.path = path;
         this.ctx = ctx;
         this.nodeState = nodeState;