jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1444176 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
Date Fri, 08 Feb 2013 18:17:48 GMT
Author: jukka
Date: Fri Feb  8 18:17:47 2013
New Revision: 1444176

URL: http://svn.apache.org/r1444176
Log:
OAK-593: Segment-based MK

Implement iteration over properties and child nodes

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java?rev=1444176&r1=1444175&r2=1444176&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
Fri Feb  8 18:17:47 2013
@@ -20,15 +20,21 @@ import static com.google.common.base.Pre
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry;
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder;
+import org.apache.jackrabbit.oak.plugins.segment.MapRecord.Entry;
+import org.apache.jackrabbit.oak.spi.state.AbstractNodeState;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
 
-class SegmentNodeState implements NodeState {
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+
+class SegmentNodeState extends AbstractNodeState {
 
     private final SegmentReader reader;
 
@@ -62,8 +68,15 @@ class SegmentNodeState implements NodeSt
 
     @Override @Nonnull
     public Iterable<? extends PropertyState> getProperties() {
-        // TODO Auto-generated method stub
-        return null;
+        return Iterables.transform(
+                properties.getEntries(reader),
+                new Function<MapRecord.Entry, PropertyState>() {
+                    @Override @Nullable
+                    public PropertyState apply(@Nullable Entry input) {
+                        return new SegmentPropertyState(
+                                reader, input.getKey(), input.getValue());
+                    }
+                });
     }
 
     @Override
@@ -90,14 +103,28 @@ class SegmentNodeState implements NodeSt
 
     @Override
     public Iterable<String> getChildNodeNames() {
-        // TODO Auto-generated method stub
-        return null;
+        return Iterables.transform(
+                childNodes.getEntries(reader),
+                new Function<MapRecord.Entry, String>() {
+                    @Override @Nullable
+                    public String apply(@Nullable Entry input) {
+                        return input.getKey();
+                    }
+                });
     }
 
     @Override @Nonnull
     public Iterable<? extends ChildNodeEntry> getChildNodeEntries() {
-        // TODO Auto-generated method stub
-        return null;
+        return Iterables.transform(
+                childNodes.getEntries(reader),
+                new Function<MapRecord.Entry, ChildNodeEntry>() {
+                    @Override @Nullable
+                    public ChildNodeEntry apply(@Nullable Entry input) {
+                        return new MemoryChildNodeEntry(
+                                input.getKey(),
+                                new SegmentNodeState(reader, input.getValue()));
+                    }
+                });
     }
 
     @Override @Nonnull
@@ -105,10 +132,4 @@ class SegmentNodeState implements NodeSt
         return new MemoryNodeBuilder(this);
     }
 
-    @Override
-    public void compareAgainstBaseState(NodeState base, NodeStateDiff diff) {
-        // TODO Auto-generated method stub
-        
-    }
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java?rev=1444176&r1=1444175&r2=1444176&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
Fri Feb  8 18:17:47 2013
@@ -32,12 +32,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Random;
 
-import org.junit.Assert;
 import org.junit.Test;
 
 import com.google.common.base.Charsets;
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterators;
 import com.google.common.collect.Maps;
 
 public class RecordTest {



Mime
View raw message