jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r683257 [1/2] - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/ main/java/org/apache/jackrabbit/core/observation/ main/java/org/apache/jackrabbit/core/persistence/bundle/util/ main/java/org/apache/jackrabbit/...
Date Wed, 06 Aug 2008 13:17:03 GMT
Author: mreutegg
Date: Wed Aug  6 06:17:00 2008
New Revision: 683257

URL: http://svn.apache.org/viewvc?rev=683257&view=rev
Log:
JCR-1710: Promote ChildNodeEntry and ChildNodeEntries to top level classes.

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java   (with props)
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java Wed Aug  6 06:17:00 2008
@@ -34,6 +34,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.UpdatableItemStateManager;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.util.ReferenceChangeTracker;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.version.VersionManager;
@@ -765,7 +766,7 @@
                 // there's already a node with that name...
 
                 // get definition of existing conflicting node
-                NodeState.ChildNodeEntry entry = parentState.getChildNodeEntry(nodeName, 1);
+                ChildNodeEntry entry = parentState.getChildNodeEntry(nodeName, 1);
                 NodeState conflictingState;
                 NodeId conflictingId = entry.getId();
                 try {
@@ -1667,7 +1668,7 @@
             ArrayList tmp = new ArrayList(targetState.getChildNodeEntries());
             // remove from tail to avoid problems with same-name siblings
             for (int i = tmp.size() - 1; i >= 0; i--) {
-                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) tmp.get(i);
+                ChildNodeEntry entry = (ChildNodeEntry) tmp.get(i);
                 NodeId nodeId = entry.getId();
                 try {
                     NodeState nodeState = (NodeState) stateMgr.getItemState(nodeId);
@@ -1826,7 +1827,7 @@
             // copy child nodes
             Iterator iter = srcState.getChildNodeEntries().iterator();
             while (iter.hasNext()) {
-                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+                ChildNodeEntry entry = (ChildNodeEntry) iter.next();
                 Path srcChildPath = PathFactoryImpl.getInstance().create(srcPath, entry.getName(), true);
                 if (!srcAccessMgr.isGranted(srcChildPath, Permission.READ)) {
                     continue;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java Wed Aug  6 06:17:00 2008
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.NodeStateListener;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.util.Dumpable;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
@@ -312,7 +313,7 @@
                 Iterator iter = elements[i].getChildren();
                 while (iter.hasNext()) {
                     PathMap.Element child = (PathMap.Element) iter.next();
-                    NodeState.ChildNodeEntry cne = modified.getChildNodeEntry(
+                    ChildNodeEntry cne = modified.getChildNodeEntry(
                             child.getName(), child.getNormalizedIndex());
                     if (cne == null) {
                         // Item does not exist, remove
@@ -412,7 +413,7 @@
                         continue;
                     }
                     NodeId childId = childEntry.getId();
-                    NodeState.ChildNodeEntry cne = state.getChildNodeEntry(childId);
+                    ChildNodeEntry cne = state.getChildNodeEntry(childId);
                     if (cne == null) {
                         /* Child no longer in parent node state, so remove it */
                         evict(child, false);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java Wed Aug  6 06:17:00 2008
@@ -27,10 +27,10 @@
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
-import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.PathBuilder;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
@@ -38,7 +38,6 @@
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.ItemNotFoundException;
-import javax.jcr.NamespaceException;
 import javax.jcr.RepositoryException;
 
 /**
@@ -113,7 +112,7 @@
             }
             NodeState parentState = (NodeState) getItemState(parentId);
             if ((typeExpected & RETURN_NODE) != 0) {
-                NodeState.ChildNodeEntry nodeEntry =
+                ChildNodeEntry nodeEntry =
                         getChildNodeEntry(parentState, name, index);
                 if (nodeEntry != null) {
                     id = nodeEntry.getId();
@@ -222,7 +221,7 @@
      *         no such entry.
      * @see ZombieHierarchyManager#getChildNodeEntry(NodeState, NodeId)
      */
-    protected NodeState.ChildNodeEntry getChildNodeEntry(NodeState parent,
+    protected ChildNodeEntry getChildNodeEntry(NodeState parent,
                                                          NodeId id) {
         return parent.getChildNodeEntry(id);
     }
@@ -242,7 +241,7 @@
      *         <code>null</code> if there's no such entry.
      * @see ZombieHierarchyManager#getChildNodeEntry(NodeState, Name, int)
      */
-    protected NodeState.ChildNodeEntry getChildNodeEntry(NodeState parent,
+    protected ChildNodeEntry getChildNodeEntry(NodeState parent,
                                                          Name name,
                                                          int index) {
         return parent.getChildNodeEntry(name, index);
@@ -281,7 +280,7 @@
         if (state.isNode()) {
             NodeState nodeState = (NodeState) state;
             NodeId id = nodeState.getNodeId();
-            NodeState.ChildNodeEntry entry = getChildNodeEntry(parent, id);
+            ChildNodeEntry entry = getChildNodeEntry(parent, id);
             if (entry == null) {
                 String msg = "failed to build path of " + state.getId() + ": "
                         + parent.getNodeId() + " has no child entry for "
@@ -458,7 +457,7 @@
             throw new RepositoryException(msg, ise);
         }
 
-        NodeState.ChildNodeEntry entry =
+        ChildNodeEntry entry =
                 getChildNodeEntry(parentState, id);
         if (entry == null) {
             String msg = "failed to resolve name of " + id;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Wed Aug  6 06:17:00 2008
@@ -31,6 +31,7 @@
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.SessionItemStateManager;
 import org.apache.jackrabbit.core.state.StaleItemStateException;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.version.VersionManager;
 import org.apache.jackrabbit.spi.Name;
@@ -392,7 +393,7 @@
                     NodeState nState = (NodeState) itemState;
                     for (Iterator it = nState.getAddedChildNodeEntries().iterator();
                          it.hasNext() && isGranted;) {
-                        Name nodeName = ((NodeState.ChildNodeEntry) it.next()).getName();
+                        Name nodeName = ((ChildNodeEntry) it.next()).getName();
                         isGranted = accessMgr.isGranted(path, nodeName, Permission.ADD_NODE);
                     }
                     for (Iterator it = nState.getAddedPropertyNames().iterator();
@@ -993,8 +994,8 @@
                                             for (Iterator cneIt =
                                                     parent.getRenamedChildNodeEntries().iterator();
                                                  cneIt.hasNext();) {
-                                                NodeState.ChildNodeEntry cne =
-                                                        (NodeState.ChildNodeEntry) cneIt.next();
+                                                ChildNodeEntry cne =
+                                                        (ChildNodeEntry) cneIt.next();
                                                 if (cne.getId().equals(nodeState.getId())) {
                                                     // node has been renamed,
                                                     // add parent to dependencies
@@ -1015,16 +1016,16 @@
                     for (Iterator cneIt =
                             nodeState.getRemovedChildNodeEntries().iterator();
                          cneIt.hasNext();) {
-                        NodeState.ChildNodeEntry cne =
-                                (NodeState.ChildNodeEntry) cneIt.next();
+                        ChildNodeEntry cne =
+                                (ChildNodeEntry) cneIt.next();
                         dependentIDs.add(cne.getId());
                     }
                     // added child node entries
                     for (Iterator cneIt =
                             nodeState.getAddedChildNodeEntries().iterator();
                          cneIt.hasNext();) {
-                        NodeState.ChildNodeEntry cne =
-                                (NodeState.ChildNodeEntry) cneIt.next();
+                        ChildNodeEntry cne =
+                                (ChildNodeEntry) cneIt.next();
                         dependentIDs.add(cne.getId());
                     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java Wed Aug  6 06:17:00 2008
@@ -30,6 +30,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.SessionItemStateManager;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.util.Dumpable;
 import org.apache.jackrabbit.core.version.VersionHistoryImpl;
 import org.apache.jackrabbit.core.version.VersionImpl;
@@ -151,7 +152,7 @@
             // fallback: try finding applicable definition
             NodeImpl parent = (NodeImpl) getItem(state.getParentId());
             NodeState parentState = (NodeState) parent.getItemState();
-            NodeState.ChildNodeEntry cne = parentState.getChildNodeEntry(state.getNodeId());
+            ChildNodeEntry cne = parentState.getChildNodeEntry(state.getNodeId());
             def = parent.getApplicableChildNodeDefinition(cne.getName(), state.getNodeTypeName());
             state.setDefinitionId(def.unwrap().getId());
         }
@@ -561,7 +562,7 @@
         Iterator iter = ((NodeState) data.getState()).getChildNodeEntries().iterator();
 
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             // make sure any of the properties can be read.
             if (canRead(entry.getId())) {
                 return true;
@@ -592,7 +593,7 @@
         Iterator iter = ((NodeState) data.getState()).getChildNodeEntries().iterator();
 
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             // delay check for read-access until item is being built
             // thus avoid duplicate check
             childIds.add(entry.getId());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Wed Aug  6 06:17:00 2008
@@ -36,6 +36,7 @@
 import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.version.DateVersionSelector;
 import org.apache.jackrabbit.core.version.InternalFreeze;
@@ -207,7 +208,7 @@
                     if (index == 0) {
                         index = 1;
                     }
-                    NodeState.ChildNodeEntry cne =
+                    ChildNodeEntry cne =
                             thisState.getChildNodeEntry(pe.getName(), index);
                     if (cne != null) {
                         return cne.getId();
@@ -588,7 +589,7 @@
         if (index == 0) {
             index = 1;
         }
-        NodeState.ChildNodeEntry entry =
+        ChildNodeEntry entry =
                 thisState.getChildNodeEntry(nodeName, index);
         if (entry == null) {
             String msg = "failed to remove child " + nodeName + " of "
@@ -646,8 +647,8 @@
             ArrayList tmp = new ArrayList(thisState.getChildNodeEntries());
             // remove from tail to avoid problems with same-name siblings
             for (int i = tmp.size() - 1; i >= 0; i--) {
-                NodeState.ChildNodeEntry entry =
-                        (NodeState.ChildNodeEntry) tmp.get(i);
+                ChildNodeEntry entry =
+                        (ChildNodeEntry) tmp.get(i);
                 // recursively remove child node
                 NodeId childId = entry.getId();
                 //NodeImpl childNode = (NodeImpl) itemMgr.getItem(childId);
@@ -774,7 +775,7 @@
 
         // check for name collisions
         NodeState thisState = data.getNodeState();
-        NodeState.ChildNodeEntry cne = thisState.getChildNodeEntry(nodeName, 1);
+        ChildNodeEntry cne = thisState.getChildNodeEntry(nodeName, 1);
         if (cne != null) {
             // there's already a child node entry with that name;
             // check same-name sibling setting of new node
@@ -1230,7 +1231,7 @@
         ArrayList list = new ArrayList(thisState.getChildNodeEntries());
         // start from tail to avoid problems with same-name siblings
         for (int i = list.size() - 1; i >= 0; i--) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) list.get(i);
+            ChildNodeEntry entry = (ChildNodeEntry) list.get(i);
             NodeImpl node = (NodeImpl) itemMgr.getItem(entry.getId());
             // check if node has been defined by mixin type (or one of its supertypes)
             NodeTypeImpl declaringNT = (NodeTypeImpl) node.getDefinition().getDeclaringNodeType();
@@ -1437,7 +1438,7 @@
         if (index == 0) {
             index = 1;
         }
-        NodeState.ChildNodeEntry cne = thisState.getChildNodeEntry(name, index);
+        ChildNodeEntry cne = thisState.getChildNodeEntry(name, index);
         if (cne == null) {
             throw new ItemNotFoundException();
         }
@@ -1479,7 +1480,7 @@
         if (index == 0) {
             index = 1;
         }
-        NodeState.ChildNodeEntry cne = thisState.getChildNodeEntry(name, index);
+        ChildNodeEntry cne = thisState.getChildNodeEntry(name, index);
         if (cne == null) {
             return false;
         }
@@ -1821,7 +1822,7 @@
         ArrayList list = new ArrayList(data.getNodeState().getChildNodeEntries());
         int srcInd = -1, destInd = -1;
         for (int i = 0; i < list.size(); i++) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) list.get(i);
+            ChildNodeEntry entry = (ChildNodeEntry) list.get(i);
             if (srcInd == -1) {
                 if (entry.getName().equals(srcName.getName())
                         && (entry.getIndex() == srcName.getIndex()
@@ -1909,7 +1910,7 @@
         // => backup list of child node entries beforehand in order
         // to restore it afterwards
         NodeState state = data.getNodeState();
-        NodeState.ChildNodeEntry cneExisting = state.getChildNodeEntry(id);
+        ChildNodeEntry cneExisting = state.getChildNodeEntry(id);
         if (cneExisting == null) {
             throw new ItemNotFoundException(safeGetJCRPath()
                     + ": no child node entry with id " + id);
@@ -1939,7 +1940,7 @@
             // but preserving original position
             state.removeAllChildNodeEntries();
             for (Iterator iter = cneList.iterator(); iter.hasNext();) {
-                NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) iter.next();
+                ChildNodeEntry cne = (ChildNodeEntry) iter.next();
                 if (cne.getId().equals(id)) {
                     // replace entry with different name
                     state.addChildNodeEntry(nodeName, id);
@@ -2002,7 +2003,7 @@
             throw new ConstraintViolationException(msg, re);
         }
         NodeState thisState = data.getNodeState();
-        NodeState.ChildNodeEntry cne = thisState.getChildNodeEntry(name, 1);
+        ChildNodeEntry cne = thisState.getChildNodeEntry(name, 1);
         if (cne != null) {
             // there's already a child node entry with that name;
             // check same-name sibling setting of new node
@@ -3060,7 +3061,7 @@
         try {
             NodeState parent =
                     (NodeState) stateMgr.getItemState(parentId);
-            NodeState.ChildNodeEntry parentEntry =
+            ChildNodeEntry parentEntry =
                     parent.getChildNodeEntry(getNodeId());
             return parentEntry.getIndex();
         } catch (ItemStateException ise) {
@@ -3257,7 +3258,7 @@
         Path parentPath = parentNode.getPrimaryPath();
         PathBuilder builder = new PathBuilder(parentPath);
 
-        NodeState.ChildNodeEntry entry = ((NodeState) parentNode.getItemState()).
+        ChildNodeEntry entry = ((NodeState) parentNode.getItemState()).
                 getChildNodeEntry(getNodeId());
         if (entry == null) {
             String msg = "failed to build path of " + id + ": "
@@ -4908,7 +4909,7 @@
         ArrayList list = new ArrayList(thisState.getChildNodeEntries());
         // start from tail to avoid problems with same-name siblings
         for (int i = list.size() - 1; i >= 0; i--) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) list.get(i);
+            ChildNodeEntry entry = (ChildNodeEntry) list.get(i);
             try {
                 NodeState nodeState =
                         (NodeState) stateMgr.getItemState(entry.getId());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java Wed Aug  6 06:17:00 2008
@@ -23,6 +23,7 @@
 import org.apache.jackrabbit.core.nodetype.NodeDefinitionImpl;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.security.user.UserManagerImpl;
 import org.apache.jackrabbit.core.security.authorization.acl.ACLEditor;
 
@@ -69,7 +70,7 @@
             // check for name collisions
             // TODO: improve. copied from NodeImpl
             NodeState thisState = (NodeState) parentImpl.getItemState();
-            NodeState.ChildNodeEntry cne = thisState.getChildNodeEntry(name, 1);
+            ChildNodeEntry cne = thisState.getChildNodeEntry(name, 1);
             if (cne != null) {
                 // there's already a child node entry with that name;
                 // check same-name sibling setting of new node

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java Wed Aug  6 06:17:00 2008
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.spi.Name;
 
 import java.util.Iterator;
@@ -95,14 +96,14 @@
      * <p/>
      * Also allows for removed/renamed child node entries.
      */
-    protected NodeState.ChildNodeEntry getChildNodeEntry(NodeState parent,
+    protected ChildNodeEntry getChildNodeEntry(NodeState parent,
                                                          Name name,
                                                          int index) {
         // check removed child node entries first
         Iterator iter = parent.getRemovedChildNodeEntries().iterator();
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry entry =
-                    (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry =
+                    (ChildNodeEntry) iter.next();
             if (entry.getName().equals(name)
                     && entry.getIndex() == index) {
                 return entry;
@@ -118,13 +119,13 @@
      * <p/>
      * Also allows for removed child node entries.
      */
-    protected NodeState.ChildNodeEntry getChildNodeEntry(NodeState parent,
+    protected ChildNodeEntry getChildNodeEntry(NodeState parent,
                                                          NodeId id) {
         // check removed child node entries first
         Iterator iter = parent.getRemovedChildNodeEntries().iterator();
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry entry =
-                    (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry =
+                    (ChildNodeEntry) iter.next();
             if (entry.getId().equals(id)) {
                 return entry;
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java Wed Aug  6 06:17:00 2008
@@ -27,6 +27,7 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
@@ -219,9 +220,9 @@
                         }
                         if (parent != null) {
                             // check if node has been renamed
-                            NodeState.ChildNodeEntry moved = null;
+                            ChildNodeEntry moved = null;
                             for (Iterator removedNodes = parent.getRemovedChildNodeEntries().iterator(); removedNodes.hasNext();) {
-                                NodeState.ChildNodeEntry child = (NodeState.ChildNodeEntry) removedNodes.next();
+                                ChildNodeEntry child = (ChildNodeEntry) removedNodes.next();
                                 if (child.getId().equals(n.getNodeId())) {
                                     // found node re-added with different name
                                     moved = child;
@@ -273,14 +274,14 @@
                     // create a node removed and a node added event for every
                     // reorder
                     for (Iterator ro = reordered.iterator(); ro.hasNext();) {
-                        NodeState.ChildNodeEntry child = (NodeState.ChildNodeEntry) ro.next();
+                        ChildNodeEntry child = (ChildNodeEntry) ro.next();
                         Name name = child.getName();
                         int index = (child.getIndex() != 1) ? child.getIndex() : 0;
                         Path parentPath = getPath(n.getNodeId(), hmgr);
                         Path.Element addedElem = PathFactoryImpl.getInstance().create(name, index).getNameElement();
                         // get removed index
                         NodeState overlayed = (NodeState) n.getOverlayedState();
-                        NodeState.ChildNodeEntry entry = overlayed.getChildNodeEntry(child.getId());
+                        ChildNodeEntry entry = overlayed.getChildNodeEntry(child.getId());
                         if (entry == null) {
                             throw new ItemStateException("Unable to retrieve old child index for item: " + child.getId());
                         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ItemStateBinding.java Wed Aug  6 06:17:00 2008
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.util.StringIndex;
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.NodeId;
@@ -269,7 +270,7 @@
         c = state.getChildNodeEntries();
         out.writeInt(c.size()); // count
         for (Iterator iter = c.iterator(); iter.hasNext();) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             writeQName(out, entry.getName());   // name
             writeID(out, entry.getId());  // uuid
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java Wed Aug  6 06:17:00 2008
@@ -155,7 +155,7 @@
         Iterator iter = list.iterator();
         childNodeEntries.clear();
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) iter.next();
+            org.apache.jackrabbit.core.state.ChildNodeEntry cne = (org.apache.jackrabbit.core.state.ChildNodeEntry) iter.next();
             addChildNodeEntry(cne.getName(), cne.getId());
         }
         sharedSet = state.getSharedSet();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/util/Serializer.java Wed Aug  6 06:17:00 2008
@@ -25,6 +25,7 @@
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.BLOBFileValue;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
@@ -103,7 +104,7 @@
         c = state.getChildNodeEntries();
         out.writeInt(c.size()); // count
         for (Iterator iter = c.iterator(); iter.hasNext();) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             out.writeUTF(entry.getName().toString());   // name
             out.write(entry.getId().getUUID().getRawBytes());    // uuid
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/xml/XMLPersistenceManager.java Wed Aug  6 06:17:00 2008
@@ -34,6 +34,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.persistence.PMContext;
 import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.persistence.util.BLOBStore;
 import org.apache.jackrabbit.core.persistence.util.FileSystemBLOBStore;
 import org.apache.jackrabbit.core.persistence.util.ResourceBasedBLOBStore;
@@ -598,7 +599,7 @@
                 writer.write("\t<" + NODES_ELEMENT + ">\n");
                 iter = state.getChildNodeEntries().iterator();
                 while (iter.hasNext()) {
-                    NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+                    ChildNodeEntry entry = (ChildNodeEntry) iter.next();
                     writer.write("\t\t<" + NODE_ELEMENT + " "
                             + NAME_ATTRIBUTE + "=\"" + Text.encodeIllegalXMLCharacters(entry.getName().toString()) + "\" "
                             + UUID_ATTRIBUTE + "=\"" + entry.getId().getUUID().toString() + "\">\n");

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/OnWorkspaceInconsistency.java Wed Aug  6 06:17:00 2008
@@ -19,6 +19,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
@@ -50,7 +51,7 @@
                                            QueryHandler handler,
                                            Path path,
                                            NodeState node,
-                                           NodeState.ChildNodeEntry child)
+                                           ChildNodeEntry child)
                 throws RepositoryException, ItemStateException {
             NamePathResolver resolver = new DefaultNamePathResolver(
                     handler.getContext().getNamespaceRegistry());
@@ -130,6 +131,6 @@
                                                 QueryHandler handler,
                                                 Path path,
                                                 NodeState node,
-                                                NodeState.ChildNodeEntry child)
+                                                ChildNodeEntry child)
             throws ItemStateException, RepositoryException;
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AggregateRuleImpl.java Wed Aug  6 06:17:00 2008
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.ItemStateException;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.util.Text;
@@ -329,7 +330,7 @@
                 // last segment -> add to collector if node type matches
                 Iterator it = cne.iterator();
                 while (it.hasNext()) {
-                    NodeId id = ((NodeState.ChildNodeEntry) it.next()).getId();
+                    NodeId id = ((ChildNodeEntry) it.next()).getId();
                     NodeState ns = (NodeState) ism.getItemState(id);
                     if (nodeTypeName == null || ns.getNodeTypeName().equals(nodeTypeName)) {
                         collector.add(ns);
@@ -340,7 +341,7 @@
                 offset++;
                 Iterator it = cne.iterator();
                 while (it.hasNext()) {
-                    NodeId id = ((NodeState.ChildNodeEntry) it.next()).getId();
+                    NodeId id = ((ChildNodeEntry) it.next()).getId();
                     resolve((NodeState) ism.getItemState(id), collector, offset);
                 }
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ChildAxisQuery.java Wed Aug  6 06:17:00 2008
@@ -24,6 +24,7 @@
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.query.LocationStepQueryNode;
 import org.apache.jackrabbit.uuid.UUID;
@@ -448,7 +449,7 @@
                             NodeState state = (NodeState) itemMgr.getItemState(id);
                             Iterator entries = state.getChildNodeEntries().iterator();
                             while (entries.hasNext()) {
-                                NodeId childId = ((NodeState.ChildNodeEntry) entries.next()).getId();
+                                NodeId childId = ((ChildNodeEntry) entries.next()).getId();
                                 Term uuidTerm = new Term(FieldNames.UUID, childId.getUUID().toString());
                                 TermDocs docs = reader.termDocs(uuidTerm);
                                 try {
@@ -483,7 +484,7 @@
                             // only select last
                             List childNodes = state.getChildNodeEntries();
                             if (childNodes.size() == 0
-                                    || !((NodeState.ChildNodeEntry) childNodes.get(childNodes.size() - 1))
+                                    || !((ChildNodeEntry) childNodes.get(childNodes.size() - 1))
                                         .getId().equals(id)) {
                                 return false;
                             }
@@ -491,7 +492,7 @@
                             List childNodes = state.getChildNodeEntries();
                             if (position < 1
                                     || childNodes.size() < position
-                                    || !((NodeState.ChildNodeEntry) childNodes.get(position - 1)).getId().equals(id)) {
+                                    || !((ChildNodeEntry) childNodes.get(position - 1)).getId().equals(id)) {
                                 return false;
                             }
                         }
@@ -500,7 +501,7 @@
                         // specified position
                         if (position == LocationStepQueryNode.LAST) {
                             // only select last
-                            NodeState.ChildNodeEntry entry =
+                            ChildNodeEntry entry =
                                     state.getChildNodeEntry(id);
                             if (entry == null) {
                                 // no such child node, probably deleted meanwhile
@@ -510,13 +511,13 @@
                                 Name name = entry.getName();
                                 List childNodes = state.getChildNodeEntries(name);
                                 if (childNodes.size() == 0
-                                        || !((NodeState.ChildNodeEntry) childNodes.get(childNodes.size() - 1))
+                                        || !((ChildNodeEntry) childNodes.get(childNodes.size() - 1))
                                             .getId().equals(id)) {
                                     return false;
                                 }
                             }
                         } else {
-                            NodeState.ChildNodeEntry entry =
+                            ChildNodeEntry entry =
                                     state.getChildNodeEntry(id);
                             if (entry == null) {
                                 // no such child node, probably has been deleted meanwhile

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java Wed Aug  6 06:17:00 2008
@@ -19,6 +19,7 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.ItemStateException;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.uuid.UUID;
 import org.apache.lucene.index.IndexReader;
@@ -231,12 +232,12 @@
             while (node.getParentId() != null) {
                 NodeId parentId = node.getParentId();
                 NodeState parent = (NodeState) stateMgr.getItemState(parentId);
-                NodeState.ChildNodeEntry entry = parent.getChildNodeEntry(node.getNodeId());
+                ChildNodeEntry entry = parent.getChildNodeEntry(node.getNodeId());
                 elements.add(entry);
                 node = parent;
             }
             for (int i = elements.size() - 1; i > -1; i--) {
-                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) elements.get(i);
+                ChildNodeEntry entry = (ChildNodeEntry) elements.get(i);
                 path.append('/').append(entry.getName().getLocalName());
                 if (entry.getIndex() > 1) {
                     path.append('[').append(entry.getIndex()).append(']');

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexingConfigurationImpl.java Wed Aug  6 06:17:00 2008
@@ -24,6 +24,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.HierarchyManagerImpl;
@@ -840,8 +841,8 @@
                 nodeStates = new AbstractIteratorDecorator(
                         context.getChildNodeEntries().iterator()) {
                     public Object next() {
-                        NodeState.ChildNodeEntry cne =
-                                (NodeState.ChildNodeEntry) super.next();
+                        ChildNodeEntry cne =
+                                (ChildNodeEntry) super.next();
                         try {
                             return ism.getItemState(cne.getId());
                         } catch (ItemStateException e) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java Wed Aug  6 06:17:00 2008
@@ -23,6 +23,7 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.uuid.Constants;
 import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.util.Timer;
@@ -1037,7 +1038,7 @@
         checkVolatileCommit();
         List children = node.getChildNodeEntries();
         for (Iterator it = children.iterator(); it.hasNext();) {
-            NodeState.ChildNodeEntry child = (NodeState.ChildNodeEntry) it.next();
+            ChildNodeEntry child = (ChildNodeEntry) it.next();
             Path childPath = PATH_FACTORY.create(path, child.getName(),
                     child.getIndex(), false);
             NodeState childState = null;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java Wed Aug  6 06:17:00 2008
@@ -24,6 +24,7 @@
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.BLOBFileValue;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.extractor.TextExtractor;
@@ -188,7 +189,7 @@
                         FieldNames.PARENT, node.getParentId().toString(),
                         Field.Store.YES, Field.Index.NO_NORMS, Field.TermVector.NO));
                 NodeState parent = (NodeState) stateProvider.getItemState(node.getParentId());
-                NodeState.ChildNodeEntry child = parent.getChildNodeEntry(node.getNodeId());
+                ChildNodeEntry child = parent.getChildNodeEntry(node.getNodeId());
                 if (child == null) {
                     // this can only happen when jackrabbit
                     // is running in a cluster.

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java?rev=683257&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java Wed Aug  6 06:17:00 2008
@@ -0,0 +1,506 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.state;
+
+import org.apache.commons.collections.map.LinkedMap;
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.spi.Name;
+
+import java.util.List;
+import java.util.HashMap;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Collection;
+import java.util.ListIterator;
+
+/**
+ * <code>ChildNodeEntries</code> represents an insertion-ordered
+ * collection of <code>ChildNodeEntry</code>s that also maintains
+ * the index values of same-name siblings on insertion and removal.
+ * <p/>
+ * <code>ChildNodeEntries</code> also provides an unmodifiable
+ * <code>List</code> view.
+ */
+class ChildNodeEntries implements List, Cloneable {
+
+    // insertion-ordered map of entries (key=NodeId, value=entry)
+    private LinkedMap entries;
+    // map used for lookup by name
+    // (key=name, value=either a single entry or a list of sns entries)
+    private HashMap nameMap;
+
+    ChildNodeEntries() {
+        entries = new LinkedMap();
+        nameMap = new HashMap();
+    }
+
+    ChildNodeEntry get(NodeId id) {
+        return (ChildNodeEntry) entries.get(id);
+    }
+
+    List get(Name nodeName) {
+        Object obj = nameMap.get(nodeName);
+        if (obj == null) {
+            return Collections.EMPTY_LIST;
+        }
+        if (obj instanceof ArrayList) {
+            // map entry is a list of siblings
+            return Collections.unmodifiableList((ArrayList) obj);
+        } else {
+            // map entry is a single child node entry
+            return Collections.singletonList(obj);
+        }
+    }
+
+    ChildNodeEntry get(Name nodeName, int index) {
+        if (index < 1) {
+            throw new IllegalArgumentException("index is 1-based");
+        }
+
+        Object obj = nameMap.get(nodeName);
+        if (obj == null) {
+            return null;
+        }
+        if (obj instanceof ArrayList) {
+            // map entry is a list of siblings
+            ArrayList siblings = (ArrayList) obj;
+            if (index <= siblings.size()) {
+                return (ChildNodeEntry) siblings.get(index - 1);
+            }
+        } else {
+            // map entry is a single child node entry
+            if (index == 1) {
+                return (ChildNodeEntry) obj;
+            }
+        }
+        return null;
+    }
+
+    ChildNodeEntry add(Name nodeName, NodeId id) {
+        List siblings = null;
+        int index = 0;
+        Object obj = nameMap.get(nodeName);
+        if (obj != null) {
+            if (obj instanceof ArrayList) {
+                // map entry is a list of siblings
+                siblings = (ArrayList) obj;
+                if (siblings.size() > 0) {
+                    // reuse immutable Name instance from 1st same name sibling
+                    // in order to help gc conserving memory
+                    nodeName = ((ChildNodeEntry) siblings.get(0)).getName();
+                }
+            } else {
+                // map entry is a single child node entry,
+                // convert to siblings list
+                siblings = new ArrayList();
+                siblings.add(obj);
+                nameMap.put(nodeName, siblings);
+            }
+            index = siblings.size();
+        }
+
+        index++;
+
+        ChildNodeEntry entry = new ChildNodeEntry(nodeName, id, index);
+        if (siblings != null) {
+            siblings.add(entry);
+        } else {
+            nameMap.put(nodeName, entry);
+        }
+        entries.put(id, entry);
+
+        return entry;
+    }
+
+    void addAll(List entriesList) {
+        Iterator iter = entriesList.iterator();
+        while (iter.hasNext()) {
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
+            // delegate to add(Name, String) to maintain consistency
+            add(entry.getName(), entry.getId());
+        }
+    }
+
+    public ChildNodeEntry remove(Name nodeName, int index) {
+        if (index < 1) {
+            throw new IllegalArgumentException("index is 1-based");
+        }
+
+        Object obj = nameMap.get(nodeName);
+        if (obj == null) {
+            return null;
+        }
+
+        if (obj instanceof ChildNodeEntry) {
+            // map entry is a single child node entry
+            if (index != 1) {
+                return null;
+            }
+            ChildNodeEntry removedEntry = (ChildNodeEntry) obj;
+            nameMap.remove(nodeName);
+            entries.remove(removedEntry.getId());
+            return removedEntry;
+        }
+
+        // map entry is a list of siblings
+        List siblings = (ArrayList) obj;
+        if (index > siblings.size()) {
+            return null;
+        }
+
+        // remove from siblings list
+        ChildNodeEntry removedEntry = (ChildNodeEntry) siblings.remove(index - 1);
+        // remove from ordered entries map
+        entries.remove(removedEntry.getId());
+
+        // update indices of subsequent same-name siblings
+        for (int i = index - 1; i < siblings.size(); i++) {
+            ChildNodeEntry oldEntry = (ChildNodeEntry) siblings.get(i);
+            ChildNodeEntry newEntry = new ChildNodeEntry(nodeName, oldEntry.getId(), oldEntry.getIndex() - 1);
+            // overwrite old entry with updated entry in siblings list
+            siblings.set(i, newEntry);
+            // overwrite old entry with updated entry in ordered entries map
+            entries.put(newEntry.getId(), newEntry);
+        }
+
+        // clean up name lookup map if necessary
+        if (siblings.size() == 0) {
+            // no more entries with that name left:
+            // remove from name lookup map as well
+            nameMap.remove(nodeName);
+        } else if (siblings.size() == 1) {
+            // just one entry with that name left:
+            // discard siblings list and update name lookup map accordingly
+            nameMap.put(nodeName, siblings.get(0));
+        }
+
+        // we're done
+        return removedEntry;
+    }
+
+    /**
+     * Removes the child node entry refering to the node with the given id.
+     *
+     * @param id id of node whose entry is to be removed.
+     * @return the removed entry or <code>null</code> if there is no such entry.
+     */
+    ChildNodeEntry remove(NodeId id) {
+        ChildNodeEntry entry = (ChildNodeEntry) entries.get(id);
+        if (entry != null) {
+            return remove(entry.getName(), entry.getIndex());
+        }
+        return entry;
+    }
+
+    /**
+     * Removes the given child node entry.
+     *
+     * @param entry entry to be removed.
+     * @return the removed entry or <code>null</code> if there is no such entry.
+     */
+    public ChildNodeEntry remove(ChildNodeEntry entry) {
+        return remove(entry.getName(), entry.getIndex());
+    }
+
+    /**
+     * Removes all child node entries
+     */
+    public void removeAll() {
+        nameMap.clear();
+        entries.clear();
+    }
+
+    /**
+     * Returns a list of <code>ChildNodeEntry</code>s who do only exist in
+     * <code>this</code> but not in <code>other</code>.
+     * <p/>
+     * Note that two entries are considered identical in this context if
+     * they have the same name and uuid, i.e. the index is disregarded
+     * whereas <code>ChildNodeEntry.equals(Object)</code> also compares
+     * the index.
+     *
+     * @param other entries to be removed
+     * @return a new list of those entries that do only exist in
+     *         <code>this</code> but not in <code>other</code>
+     */
+    List removeAll(ChildNodeEntries other) {
+        if (entries.isEmpty()) {
+            return Collections.EMPTY_LIST;
+        }
+        if (other.isEmpty()) {
+            return this;
+        }
+
+        List result = new ArrayList();
+        Iterator iter = iterator();
+        while (iter.hasNext()) {
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
+            ChildNodeEntry otherEntry = other.get(entry.getId());
+            if (entry == otherEntry) {
+                continue;
+            }
+            if (otherEntry == null
+                    || !entry.getName().equals(otherEntry.getName())) {
+                result.add(entry);
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * Returns a list of <code>ChildNodeEntry</code>s who do exist in
+     * <code>this</code> <i>and</i> in <code>other</code>.
+     * <p/>
+     * Note that two entries are considered identical in this context if
+     * they have the same name and uuid, i.e. the index is disregarded
+     * whereas <code>ChildNodeEntry.equals(Object)</code> also compares
+     * the index.
+     *
+     * @param other entries to be retained
+     * @return a new list of those entries that do exist in
+     *         <code>this</code> <i>and</i> in <code>other</code>
+     */
+    List retainAll(ChildNodeEntries other) {
+        if (entries.isEmpty()
+                || other.isEmpty()) {
+            return Collections.EMPTY_LIST;
+        }
+
+        List result = new ArrayList();
+        Iterator iter = iterator();
+        while (iter.hasNext()) {
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
+            ChildNodeEntry otherEntry = other.get(entry.getId());
+            if (entry == otherEntry) {
+                result.add(entry);
+            } else if (otherEntry != null
+                    && entry.getName().equals(otherEntry.getName())) {
+                result.add(entry);
+            }
+        }
+
+        return result;
+    }
+
+    //-------------------------------------------< unmodifiable List view >
+    public boolean contains(Object o) {
+        if (o instanceof ChildNodeEntry) {
+            return entries.containsKey(((ChildNodeEntry) o).getId());
+        } else {
+            return false;
+        }
+    }
+
+    public boolean containsAll(Collection c) {
+        Iterator iter = c.iterator();
+        while (iter.hasNext()) {
+            if (!contains(iter.next())) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public Object get(int index) {
+        return entries.getValue(index);
+    }
+
+    public int indexOf(Object o) {
+        if (o instanceof ChildNodeEntry) {
+            return entries.indexOf(((ChildNodeEntry) o).getId());
+        } else {
+            return -1;
+        }
+    }
+
+    public boolean isEmpty() {
+        return entries.isEmpty();
+    }
+
+    public int lastIndexOf(Object o) {
+        // entries are unique
+        return indexOf(o);
+    }
+
+    public Iterator iterator() {
+        return new EntriesIterator();
+    }
+
+    public ListIterator listIterator() {
+        return new EntriesIterator();
+    }
+
+    public ListIterator listIterator(int index) {
+        if (index < 0 || index >= entries.size()) {
+            throw new IndexOutOfBoundsException();
+        }
+        ListIterator iter = new EntriesIterator();
+        while (index-- > 0) {
+            iter.next();
+        }
+        return iter;
+    }
+
+    public int size() {
+        return entries.size();
+    }
+
+    public List subList(int fromIndex, int toIndex) {
+        // @todo FIXME does not fulfill the contract of List.subList(int,int)
+        return Collections.unmodifiableList(new ArrayList(this).subList(fromIndex, toIndex));
+    }
+
+    public Object[] toArray() {
+        ChildNodeEntry[] array = new ChildNodeEntry[size()];
+        return toArray(array);
+    }
+
+    public Object[] toArray(Object[] a) {
+        if (!a.getClass().getComponentType().isAssignableFrom(ChildNodeEntry.class)) {
+            throw new ArrayStoreException();
+        }
+        if (a.length < size()) {
+            a = new ChildNodeEntry[size()];
+        }
+        MapIterator iter = entries.mapIterator();
+        int i = 0;
+        while (iter.hasNext()) {
+            iter.next();
+            a[i] = entries.getValue(i);
+            i++;
+        }
+        while (i < a.length) {
+            a[i++] = null;
+        }
+        return a;
+    }
+
+    public void add(int index, Object element) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean add(Object o) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean addAll(Collection c) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean addAll(int index, Collection c) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+    public Object remove(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean remove(Object o) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean removeAll(Collection c) {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean retainAll(Collection c) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Object set(int index, Object element) {
+        throw new UnsupportedOperationException();
+    }
+
+    //------------------------------------------------< Cloneable support >
+    /**
+     * Returns a shallow copy of this <code>ChildNodeEntries</code> instance;
+     * the entries themselves are not cloned.
+     *
+     * @return a shallow copy of this instance.
+     */
+    protected Object clone() {
+        ChildNodeEntries clone = new ChildNodeEntries();
+        clone.entries = (LinkedMap) entries.clone();
+        clone.nameMap = new HashMap(nameMap.size());
+        for (Iterator it = nameMap.keySet().iterator(); it.hasNext();) {
+            Object key = it.next();
+            Object obj = nameMap.get(key);
+            if (obj instanceof ArrayList) {
+                // clone List
+                obj = ((ArrayList) obj).clone();
+            }
+            clone.nameMap.put(key, obj);
+        }
+        return clone;
+    }
+
+    //----------------------------------------------------< inner classes >
+    class EntriesIterator implements ListIterator {
+
+        private final OrderedMapIterator mapIter;
+
+        EntriesIterator() {
+            mapIter = entries.orderedMapIterator();
+        }
+
+        public boolean hasNext() {
+            return mapIter.hasNext();
+        }
+
+        public Object next() {
+            mapIter.next();
+            return mapIter.getValue();
+        }
+
+        public boolean hasPrevious() {
+            return mapIter.hasPrevious();
+        }
+
+        public int nextIndex() {
+            return entries.indexOf(mapIter.getKey()) + 1;
+        }
+
+        public Object previous() {
+            mapIter.previous();
+            return mapIter.getValue();
+        }
+
+        public int previousIndex() {
+            return entries.indexOf(mapIter.getKey()) - 1;
+        }
+
+        public void add(Object o) {
+            throw new UnsupportedOperationException();
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+        public void set(Object o) {
+            throw new UnsupportedOperationException();
+        }
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java?rev=683257&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java Wed Aug  6 06:17:00 2008
@@ -0,0 +1,92 @@
+/*
+ * $URL:$
+ * $Id:$
+ *
+ * Copyright 1997-2008 Day Management AG
+ * Barfuesserplatz 6, 4001 Basel, Switzerland
+ * All Rights Reserved.
+ *
+ * This software is the confidential and proprietary information of
+ * Day Management AG, ("Confidential Information"). You shall not
+ * disclose such Confidential Information and shall use it only in
+ * accordance with the terms of the license agreement you entered into
+ * with Day.
+ */
+package org.apache.jackrabbit.core.state;
+
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.core.NodeId;
+
+/**
+ * <code>ChildNodeEntry</code> specifies the name, index (in the case of
+ * same-name siblings) and the UUID of a child node entry.
+ * <p/>
+ * <code>ChildNodeEntry</code> instances are immutable.
+ */
+public final class ChildNodeEntry {
+
+    private int hash = 0;
+
+    private final Name name;
+    private final int index; // 1-based index for same-name siblings
+    private final NodeId id;
+
+    ChildNodeEntry(Name name, NodeId id, int index) {
+        if (name == null) {
+            throw new IllegalArgumentException("name can not be null");
+        }
+        this.name = name;
+
+        if (id == null) {
+            throw new IllegalArgumentException("id can not be null");
+        }
+        this.id = id;
+
+        if (index < 1) {
+            throw new IllegalArgumentException("index is 1-based");
+        }
+        this.index = index;
+    }
+
+    public NodeId getId() {
+        return id;
+    }
+
+    public Name getName() {
+        return name;
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    //---------------------------------------< java.lang.Object overrides >
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof ChildNodeEntry) {
+            ChildNodeEntry other = (ChildNodeEntry) obj;
+            return (name.equals(other.name) && id.equals(other.id)
+                    && index == other.index);
+        }
+        return false;
+    }
+
+    public String toString() {
+        return name.toString() + "[" + index + "] -> " + id;
+    }
+
+    public int hashCode() {
+        // ChildNodeEntry is immutable, we can store the computed hash code value
+        int h = hash;
+        if (h == 0) {
+            h = 17;
+            h = 37 * h + name.hashCode();
+            h = 37 * h + id.hashCode();
+            h = 37 * h + index;
+            hash = h;
+        }
+        return h;
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message