jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1170480 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: NodeImpl.java hierarchy/NodeEntryImpl.java state/NodeState.java util/StateUtility.java
Date Wed, 14 Sep 2011 08:58:33 GMT
Author: mduerig
Date: Wed Sep 14 08:58:32 2011
New Revision: 1170480

URL: http://svn.apache.org/viewvc?rev=1170480&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
refactor: eliminate StateUtility (WIP)

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=1170480&r1=1170479&r2=1170480&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Wed Sep 14 08:58:32 2011
@@ -710,13 +710,13 @@ public class NodeImpl extends ItemImpl i
         } else {
             try {
                 PropertyEntry pe = getNodeEntry().getPropertyEntry(NameConstants.JCR_MIXINTYPES);
-                if (pe != null) {
+                if (pe == null) {
+                    // prop entry has not been loaded yet -> not modified
+                    mixinValue = getNodeState().getMixinTypeNames();
+                } else {
                     // prop entry exists (and ev. has been transiently mod.)
                     // -> retrieve mixin types from prop
                     mixinValue = StateUtility.getMixinNames(pe.getPropertyState());
-                } else {
-                    // prop entry has not been loaded yet -> not modified
-                    mixinValue = getNodeState().getMixinTypeNames();
                 }
             } catch (RepositoryException e) {
                 // should never occur

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java?rev=1170480&r1=1170479&r2=1170480&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
Wed Sep 14 08:58:32 2011
@@ -900,7 +900,7 @@ public class NodeEntryImpl extends Hiera
                         child.invalidate(false);
                         // special cases: jcr:uuid and jcr:mixinTypes affect the
                         // parent (i.e. this NodeEntry)
-                        if (StateUtility.isUuidOrMixin(eventName)) {
+                        if (isUuidOrMixin(eventName)) {
                             notifyUUIDorMIXINModified((PropertyEntry) child);
                         }
                     }
@@ -965,6 +965,10 @@ public class NodeEntryImpl extends Hiera
 
     //-----------------------------------------------< private || protected >---
 
+    private static boolean isUuidOrMixin(Name propName) {
+        return NameConstants.JCR_UUID.equals(propName) || NameConstants.JCR_MIXINTYPES.equals(propName);
+    }
+
     /**
      * @param nodeName
      * @param uniqueID
@@ -991,7 +995,7 @@ public class NodeEntryImpl extends Hiera
 
         // if property-name is jcr:uuid or jcr:mixin this affects this entry
         // and the attached nodeState.
-        if (notifySpecial && StateUtility.isUuidOrMixin(propName)) {
+        if (notifySpecial && isUuidOrMixin(propName)) {
             notifyUUIDorMIXINModified(entry);
         }
         return entry;
@@ -1016,7 +1020,7 @@ public class NodeEntryImpl extends Hiera
             } // else: no such prop-entry. should not get here
 
             // special properties
-            if (StateUtility.isUuidOrMixin(propName)) {
+            if (isUuidOrMixin(propName)) {
                 notifyUUIDorMIXINRemoved(propName);
             }
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=1170480&r1=1170479&r2=1170480&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Wed Sep 14 08:58:32 2011
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.jcr2spi.st
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
-import org.apache.jackrabbit.jcr2spi.util.StateUtility;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
@@ -149,7 +148,7 @@ public class NodeState extends ItemState
     @Override
     public boolean revert() {
         // TODO: ev. reset the 'markModified' flag
-        if (StateUtility.isMovedState(this)) {
+        if (isMoved()) {
             try {
                 QNodeDefinition def = retrieveDefinition();
                 if (!def.equals(definition)) {
@@ -385,6 +384,8 @@ public class NodeState extends ItemState
         }
     }
 
+    //------------------------------------------< package private >---
+
     /**
      * Reorders the child node {@code insertNode} before the child node
      * {@code beforeNode}.
@@ -431,6 +432,12 @@ public class NodeState extends ItemState
         childState.markModified();
     }
 
+    //------------------------------------------< private >--- 
+
+    private boolean isMoved() {
+        return !isRoot() && getNodeEntry().isTransientlyMoved();
+    }
+
     private QNodeDefinition retrieveDefinition() throws RepositoryException {
         QNodeDefinition def;
         if (isRoot()) {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java?rev=1170480&r1=1170479&r2=1170480&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/StateUtility.java
Wed Sep 14 08:58:32 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi.util;
 
-import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
-import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.apache.jackrabbit.spi.Name;
@@ -63,17 +61,4 @@ public final class StateUtility {
         }
     }
 
-    public static boolean isUuidOrMixin(Name propName) {
-        return NameConstants.JCR_UUID.equals(propName) || NameConstants.JCR_MIXINTYPES.equals(propName);
-    }
-
-    public static boolean isMovedState(NodeState state) {
-        if (state.isRoot()) {
-            // the root state cannot be moved
-            return false;
-        } else {
-            NodeEntry ne = state.getNodeEntry();
-            return ne.isTransientlyMoved();
-        }
-    }
 }
\ No newline at end of file



Mime
View raw message