jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1299279 - in /jackrabbit/sandbox/jackrabbit-microkernel/src: main/java/org/apache/jackrabbit/ main/java/org/apache/jackrabbit/state/ test/java/org/apache/jackrabbit/
Date Sat, 10 Mar 2012 22:04:08 GMT
Author: mduerig
Date: Sat Mar 10 22:04:08 2012
New Revision: 1299279

URL: http://svn.apache.org/viewvc?rev=1299279&view=rev
Log:
Microkernel based prototype of JCR implementation (WIP)
- refactor 

Added:
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PropertyStateImpl.java
Modified:
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/ChangeTree.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PersistentNodeState.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/TransientNodeState.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java?rev=1299279&r1=1299278&r2=1299279&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
Sat Mar 10 22:04:08 2012
@@ -26,7 +26,7 @@ import org.apache.jackrabbit.oak.model.P
 import org.apache.jackrabbit.spi.commons.iterator.Iterators;
 import org.apache.jackrabbit.spi.commons.iterator.Predicate;
 import org.apache.jackrabbit.spi.commons.iterator.Transformer;
-import org.apache.jackrabbit.state.PersistentNodeState.PropertyStateImpl;
+import org.apache.jackrabbit.state.PropertyStateImpl;
 import org.apache.jackrabbit.state.TransientNodeState;
 import org.apache.jackrabbit.utils.ItemNameMatcher;
 import org.apache.jackrabbit.utils.NodeIteratorAdapter;

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/ChangeTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/ChangeTree.java?rev=1299279&r1=1299278&r2=1299279&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/ChangeTree.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/ChangeTree.java
Sat Mar 10 22:04:08 2012
@@ -27,7 +27,6 @@ import org.apache.jackrabbit.oak.model.P
 import org.apache.jackrabbit.spi.commons.iterator.Iterators;
 import org.apache.jackrabbit.spi.commons.iterator.Predicate;
 import org.apache.jackrabbit.spi.commons.iterator.Transformer;
-import org.apache.jackrabbit.state.PersistentNodeState.PropertyStateImpl;
 
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PersistentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PersistentNodeState.java?rev=1299279&r1=1299278&r2=1299279&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PersistentNodeState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PersistentNodeState.java
Sat Mar 10 22:04:08 2012
@@ -8,7 +8,6 @@ import org.apache.jackrabbit.json.Unesca
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.model.AbstractChildNodeEntry;
 import org.apache.jackrabbit.oak.model.AbstractNodeState;
-import org.apache.jackrabbit.oak.model.AbstractPropertyState;
 import org.apache.jackrabbit.oak.model.ChildNodeEntry;
 import org.apache.jackrabbit.oak.model.NodeState;
 import org.apache.jackrabbit.oak.model.PropertyState;
@@ -58,12 +57,12 @@ public class PersistentNodeState extends
             @Override
             public Iterator<PropertyState> iterator() {
                 return Iterators.transformIterator(props.iterator(),
-                        new Transformer<Entry<String, JsonValue>, PropertyState>()
{
-                            @Override
-                            public PropertyState transform(Entry<String, JsonValue>
entry) {
-                                return createPropertyState(entry.getKey(), entry.getValue());
-                            }
-                        });
+                    new Transformer<Entry<String, JsonValue>, PropertyState>()
{
+                        @Override
+                        public PropertyState transform(Entry<String, JsonValue> entry)
{
+                            return createPropertyState(entry.getKey(), entry.getValue());
+                        }
+                    });
             }
         };
     }
@@ -132,8 +131,18 @@ public class PersistentNodeState extends
         return new PropertyStateImpl(name, jsonObject);
     }
 
-    private ChildNodeEntry createChildNodeEntry(String name) {
-        return new ChildNodeEntryImpl(name);
+    private ChildNodeEntry createChildNodeEntry(final String name) {
+        return new AbstractChildNodeEntry() {
+            @Override
+            public String getName() {
+                return name;
+            }
+
+            @Override
+            public NodeState getNode() {
+                return new PersistentNodeState(microkernel, revision, path.concat(name));
+            }
+        };
     }
 
     private static long toLong(JsonValue count) {
@@ -150,46 +159,4 @@ public class PersistentNodeState extends
         }
     }
 
-    public static class PropertyStateImpl extends AbstractPropertyState {
-        private final String name;
-        private final JsonValue value;
-
-        public PropertyStateImpl(String name, JsonValue value) {
-            this.name = name;
-            this.value = value;
-        }
-
-        public JsonValue getValue() {
-            return value;
-        }
-
-        @Override
-        public String getName() {
-            return name;
-        }
-
-        @Override
-        public String getEncodedValue() {
-            return value.toJson();
-        }
-    }
-
-    private class ChildNodeEntryImpl extends AbstractChildNodeEntry {
-        private final String name;
-
-        public ChildNodeEntryImpl(String name) {
-            this.name = name;
-        }
-
-        @Override
-        public String getName() {
-            return name;
-        }
-
-        @Override
-        public NodeState getNode() {
-            return new PersistentNodeState(microkernel, revision, path.concat(name));
-        }
-    }
-
 }

Added: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PropertyStateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PropertyStateImpl.java?rev=1299279&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PropertyStateImpl.java
(added)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/PropertyStateImpl.java
Sat Mar 10 22:04:08 2012
@@ -0,0 +1,28 @@
+package org.apache.jackrabbit.state;
+
+import org.apache.jackrabbit.json.JsonValue;
+import org.apache.jackrabbit.oak.model.AbstractPropertyState;
+
+public class PropertyStateImpl extends AbstractPropertyState {
+    private final String name;
+    private final JsonValue value;
+
+    public PropertyStateImpl(String name, JsonValue value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    public JsonValue getValue() {
+        return value;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String getEncodedValue() {
+        return value.toJson();
+    }
+}

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/TransientNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/TransientNodeState.java?rev=1299279&r1=1299278&r2=1299279&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/TransientNodeState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/TransientNodeState.java
Sat Mar 10 22:04:08 2012
@@ -31,7 +31,6 @@ import org.apache.jackrabbit.spi.commons
 import org.apache.jackrabbit.spi.commons.iterator.Predicate;
 import org.apache.jackrabbit.spi.commons.iterator.Transformer;
 import org.apache.jackrabbit.state.ChangeTree.NodeDelta;
-import org.apache.jackrabbit.state.PersistentNodeState.PropertyStateImpl;
 
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
@@ -141,13 +140,13 @@ public class TransientNodeState {
 
         // fixme: this is not safe against concurrent modifications. Either copy delta or
make NodeDelta immutable
         Iterator<PropertyState> propertyEntries =
-                Iterators.filterIterator(propertyStates.iterator(),
-                        new Predicate<PropertyState>() {
-                            @Override
-                            public boolean evaluate(PropertyState state) {
-                                return !state.getName().startsWith(":") && !delta.hasProperty(state.getName());
-                            }
-                        });
+            Iterators.filterIterator(propertyStates.iterator(),
+                    new Predicate<PropertyState>() {
+                        @Override
+                        public boolean evaluate(PropertyState state) {
+                            return !state.getName().startsWith(":") && !delta.hasProperty(state.getName());
+                        }
+                    });
 
         return Iterators.iteratorChain(propertyEntries, delta.getPropertyStates());
     }

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java?rev=1299279&r1=1299278&r2=1299279&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java
Sat Mar 10 22:04:08 2012
@@ -267,7 +267,6 @@ public class RepositoryTest {
         PropertyIterator properties = node.getProperties();
         while (properties.hasNext()) {
             Property p = properties.nextProperty();
-            System.out.println(p.getName() + ":" + p.toString());
             assertTrue(propertyNames.remove(p.getName()));
             if (p.isMultiple()) {
                 for (Value v : p.getValues()) {



Mime
View raw message