jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1299598 - in /jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit: NodeImpl.java state/TransientNodeState.java
Date Mon, 12 Mar 2012 09:49:03 GMT
Author: mduerig
Date: Mon Mar 12 09:49:02 2012
New Revision: 1299598

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

Modified:
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/TransientNodeState.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=1299598&r1=1299597&r2=1299598&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
Mon Mar 12 09:49:02 2012
@@ -57,6 +57,8 @@ import java.math.BigDecimal;
 import java.util.Calendar;
 import java.util.Iterator;
 
+import static org.apache.jackrabbit.utils.Iterators.filter;
+
 public class NodeImpl extends ItemImpl implements Node {
     private final TransientNodeState state;
 
@@ -304,11 +306,12 @@ public class NodeImpl extends ItemImpl i
 
     @Override
     public NodeIterator getNodes(final String namePattern) throws RepositoryException {
-        Iterator<TransientNodeState> childNodeStates = state.getChildNodeStates(new
Predicate<TransientNodeState>() {
-            @Override
-            public boolean evaluate(TransientNodeState state) {
-                return ItemNameMatcher.matches(state.getName(), namePattern);
-            }
+        Iterator<TransientNodeState> childNodeStates = filter(state.getChildNodeStates(),
+            new Predicate<TransientNodeState>() {
+                @Override
+                public boolean evaluate(TransientNodeState state) {
+                    return ItemNameMatcher.matches(state.getName(), namePattern);
+                }
         });
 
         return new NodeIteratorAdapter(nodeIterator(childNodeStates));
@@ -316,11 +319,12 @@ public class NodeImpl extends ItemImpl i
 
     @Override
     public NodeIterator getNodes(final String[] nameGlobs) throws RepositoryException {
-        Iterator<TransientNodeState> childNodeStates = state.getChildNodeStates(new
Predicate<TransientNodeState>() {
-            @Override
-            public boolean evaluate(TransientNodeState state) {
-                return ItemNameMatcher.matches(state.getName(), nameGlobs);
-            }
+        Iterator<TransientNodeState> childNodeStates = filter(state.getChildNodeStates(),
+            new Predicate<TransientNodeState>() {
+                @Override
+                public boolean evaluate(TransientNodeState state) {
+                    return ItemNameMatcher.matches(state.getName(), nameGlobs);
+                }
         });
 
         return new NodeIteratorAdapter(nodeIterator(childNodeStates));
@@ -349,7 +353,7 @@ public class NodeImpl extends ItemImpl i
 
     @Override
     public PropertyIterator getProperties(final String namePattern) throws RepositoryException
{
-        Iterator<PropertyState> properties = state.getProperties(
+        Iterator<PropertyState> properties = filter(state.getProperties(),
             new Predicate<PropertyState>() {
                 @Override
                 public boolean evaluate(PropertyState entry) {
@@ -362,13 +366,13 @@ public class NodeImpl extends ItemImpl i
 
     @Override
     public PropertyIterator getProperties(final String[] nameGlobs) throws RepositoryException
{
-        Iterator<PropertyState> propertyNames = state.getProperties(
-                new Predicate<PropertyState>() {
-                    @Override
-                    public boolean evaluate(PropertyState entry) {
-                        return ItemNameMatcher.matches(entry.getName(), nameGlobs);
-                    }
-                });
+        Iterator<PropertyState> propertyNames = filter(state.getProperties(),
+            new Predicate<PropertyState>() {
+                @Override
+                public boolean evaluate(PropertyState entry) {
+                    return ItemNameMatcher.matches(entry.getName(), nameGlobs);
+                }
+        });
 
         return new PropertyIteratorAdapter(propertyIterator(propertyNames));
 }

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=1299598&r1=1299597&r2=1299598&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
Mon Mar 12 09:49:02 2012
@@ -139,10 +139,6 @@ public class TransientNodeState {
         return chain(unmodifiedStates, modifiedStates);
     }
 
-    public Iterator<TransientNodeState> getChildNodeStates(Predicate<TransientNodeState>
condition) {
-        return filter(getChildNodeStates(), condition);
-    }
-
     public boolean hasProperties() {
         return getProperties().hasNext();
     }
@@ -164,10 +160,6 @@ public class TransientNodeState {
         return chain(propertyEntries, delta.getPropertyStates());
     }
 
-    public Iterator<PropertyState> getProperties(Predicate<PropertyState> condition)
{
-        return filter(getProperties(), condition);
-    }
-
     public JsonValue getPropertyValue(String name) throws ItemNotFoundException {
         JsonValue value = getPropertyValueOrNull(name);
         if (value == null) {



Mime
View raw message