jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r426067 - in /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ nodetype/ state/ version/ xml/
Date Thu, 27 Jul 2006 13:31:55 GMT
Author: mreutegg
Date: Thu Jul 27 06:31:54 2006
New Revision: 426067

URL: http://svn.apache.org/viewvc?rev=426067&view=rev
Log:
Extract ChildNodeEntry and convert to interface to allow alternative implementation

Added:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntry.java
  (with props)
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntryImpl.java
  (with props)
Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/CachingHierarchyManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/HierarchyManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ZombieHierarchyManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImporterImpl.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/CachingHierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/CachingHierarchyManager.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/CachingHierarchyManager.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/CachingHierarchyManager.java
Thu Jul 27 06:31:54 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.jcr2spi.state.ItemStateManager;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.NodeStateListener;
+import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
@@ -286,7 +287,7 @@
             Iterator iter = element.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
@@ -384,8 +385,8 @@
 
         Iterator iter = entries.iterator();
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry now = (NodeState.ChildNodeEntry) iter.next();
-            NodeState.ChildNodeEntry old =
+            ChildNodeEntry now = (ChildNodeEntry) iter.next();
+            ChildNodeEntry old =
                     ((NodeState) state.getOverlayedState()).getChildNodeEntry(now.getId());
 
             if (old == null) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/HierarchyManagerImpl.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/HierarchyManagerImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/HierarchyManagerImpl.java
Thu Jul 27 06:31:54 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
+import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.spi.NodeId;
@@ -127,7 +128,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);
     }
@@ -147,7 +148,7 @@
      *         <code>null</code> if there's no such entry.
      * @see ZombieHierarchyManager#getChildNodeEntry(NodeState, QName, int)
      */
-    protected NodeState.ChildNodeEntry getChildNodeEntry(NodeState parent,
+    protected ChildNodeEntry getChildNodeEntry(NodeState parent,
                                                          QName name,
                                                          int index) {
         return parent.getChildNodeEntry(name, index);
@@ -206,7 +207,7 @@
 
         if (parentState.hasChildNodeEntry(name, index)) {
             // child node
-            NodeState.ChildNodeEntry nodeEntry = getChildNodeEntry(parentState, name, index);
+            ChildNodeEntry nodeEntry = getChildNodeEntry(parentState, name, index);
             childId = nodeEntry.getId();
         } else if (parentState.hasPropertyName(name)) {
             // property
@@ -258,7 +259,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 "
@@ -371,7 +372,7 @@
                 throw new RepositoryException(msg, ise);
             }
 
-            NodeState.ChildNodeEntry entry =
+            ChildNodeEntry entry =
                     getChildNodeEntry(parentState, nodeId);
             if (entry == null) {
                 String msg = "failed to resolve name of " + nodeId;

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
Thu Jul 27 06:31:54 2006
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
+import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.jcr2spi.util.Dumpable;
 import org.apache.jackrabbit.jcr2spi.version.VersionHistoryImpl;
 import org.apache.jackrabbit.jcr2spi.version.VersionImpl;
@@ -274,7 +275,7 @@
 
     //--------------------------------------------------------< ItemManager >---
     /**
-     * @inheritdoc
+     * @inheritDoc
      */
     public void dispose() {
         itemCache.clear();
@@ -395,7 +396,7 @@
         Iterator iter = nodeState.getChildNodeEntries().iterator();
 
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             NodeId id = entry.getId();
             // check read access
             if (session.getAccessManager().canRead(id)) {
@@ -424,7 +425,7 @@
         Iterator iter = nodeState.getChildNodeEntries().iterator();
 
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             NodeId id = entry.getId();
             // check read access
             if (session.getAccessManager().canRead(id)) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Thu Jul 27 06:31:54 2006
@@ -34,6 +34,7 @@
 import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.NodeReferences;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator;
+import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeConflictException;
@@ -542,7 +543,7 @@
         }
         try {
             NodeState parent = (NodeState) itemStateMgr.getItemState(parentId);
-            NodeState.ChildNodeEntry parentEntry = parent.getChildNodeEntry(getNodeId());
+            ChildNodeEntry parentEntry = parent.getChildNodeEntry(getNodeId());
             return parentEntry.getIndex();
         } catch (ItemStateException ise) {
             // should never get here...
@@ -1279,9 +1280,9 @@
         List cne = getNodeState().getChildNodeEntries(nodeName);
         if (definition.allowsSameNameSiblings()) {
             // TODO: find proper solution. problem with same-name-siblings
-            childId = ((NodeState.ChildNodeEntry)cne.get(cne.size()-1)).getId();
+            childId = ((ChildNodeEntry)cne.get(cne.size()-1)).getId();
         } else {
-            childId = ((NodeState.ChildNodeEntry)cne.get(0)).getId();
+            childId = ((ChildNodeEntry)cne.get(0)).getId();
         }
         // finally retrieve the new node
         return (Node) itemMgr.getItem(childId);
@@ -1516,7 +1517,7 @@
                 if (pe.denotesName()) {
                     // check if node entry exists
                     int index = pe.getNormalizedIndex();
-                    NodeState.ChildNodeEntry cne = getNodeState().getChildNodeEntry(pe.getName(),
index);
+                    ChildNodeEntry cne = getNodeState().getChildNodeEntry(pe.getName(), index);
                     if (cne != null) {
                         targetId = cne.getId();
                     } // else: there's no child node with that name

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ZombieHierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ZombieHierarchyManager.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ZombieHierarchyManager.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ZombieHierarchyManager.java
Thu Jul 27 06:31:54 2006
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.jcr2spi.state.ItemStateManager;
 import org.apache.jackrabbit.jcr2spi.state.NoSuchItemStateException;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.name.QName;
@@ -97,13 +98,13 @@
      * <p/>
      * Also allows for removed/renamed child node entries.
      */
-    protected NodeState.ChildNodeEntry getChildNodeEntry(NodeState parent,
+    protected ChildNodeEntry getChildNodeEntry(NodeState parent,
                                                          QName 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/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
Thu Jul 27 06:31:54 2006
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.util.IteratorHelper;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
+import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.jcr2spi.util.Dumpable;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
@@ -194,7 +195,7 @@
                     // special case for root state
                     def = ntReg.getRootNodeDef();
                 } else {
-                    NodeState.ChildNodeEntry cne = parentState.getChildNodeEntry(nodeState.getNodeId());
+                    ChildNodeEntry cne = parentState.getChildNodeEntry(nodeState.getNodeId());
                     def = ntReg.getEffectiveNodeType(parentState.getNodeTypeNames()).getApplicableNodeDefinition(cne.getName(),
nodeState.getNodeTypeName());
                 }
             } catch (NodeTypeConflictException e) {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/CachingItemStateManager.java
Thu Jul 27 06:31:54 2006
@@ -322,7 +322,7 @@
     private static Path.PathElement getNameElement(NodeState parent, ItemState state)
             throws ItemStateException {
         if (state.isNode()) {
-            NodeState.ChildNodeEntry entry = parent.getChildNodeEntry((NodeId) state.getId());
+            ChildNodeEntry entry = parent.getChildNodeEntry((NodeId) state.getId());
             if (entry == null) {
                 throw new ItemStateException("No child node entry " +
                         state.getId() + " found in " + parent.getId());

Added: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntry.java?rev=426067&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntry.java
(added)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntry.java
Thu Jul 27 06:31:54 2006
@@ -0,0 +1,38 @@
+/*
+ * $URL:$
+ * $Id:$
+ *
+ * Copyright 1997-2005 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.jcr2spi.state;
+
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.name.QName;
+
+/**
+ * <code>ChildNodeEntry</code>...
+ *
+ * @author mreutegg
+ * @version $Rev:$, $Date:$
+ */
+public interface ChildNodeEntry {
+
+    /**
+     * the cvs/svn id
+     */
+    static final String CVS_ID = "$URL:$ $Rev:$ $Date:$";
+
+    NodeId getId();
+
+    QName getName();
+
+    int getIndex();
+}

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

Added: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntryImpl.java?rev=426067&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntryImpl.java
(added)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntryImpl.java
Thu Jul 27 06:31:54 2006
@@ -0,0 +1,95 @@
+/*
+ * 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.jcr2spi.state;
+
+import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.spi.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 ChildNodeEntryImpl implements ChildNodeEntry {
+
+    private int hash = 0;
+
+    private final QName name;
+    private final int index; // 1-based index for same-name siblings
+    private final NodeId id;
+
+    public ChildNodeEntryImpl(QName 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 < Path.INDEX_DEFAULT) {
+            throw new IllegalArgumentException("index is 1-based");
+        }
+        this.index = index;
+    }
+
+    public NodeId getId() {
+        return id;
+    }
+
+    public QName 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 ChildNodeEntryImpl) {
+            ChildNodeEntryImpl other = (ChildNodeEntryImpl) 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/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChildNodeEntryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
Thu Jul 27 06:31:54 2006
@@ -762,7 +762,7 @@
 
         } else if (parentState.hasChildNodeEntry(nodeName)) {
             // retrieve the existing node state that ev. conflicts with the new one.
-            NodeState.ChildNodeEntry entry = parentState.getChildNodeEntry(nodeName, 1);
+            ChildNodeEntry entry = parentState.getChildNodeEntry(nodeName, 1);
             NodeState conflictingState = getNodeState(entry.getId());
 
             QNodeDefinition conflictDef = conflictingState.getDefinition();

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
Thu Jul 27 06:31:54 2006
@@ -932,7 +932,7 @@
             }
             index++;
 
-            ChildNodeEntry entry = new ChildNodeEntry(nodeName, id, index);
+            ChildNodeEntry entry = new ChildNodeEntryImpl(nodeName, id, index);
             if (siblings != null) {
                 siblings.add(entry);
             } else {
@@ -987,7 +987,7 @@
             // 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);
+                ChildNodeEntry newEntry = new ChildNodeEntryImpl(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
@@ -1318,77 +1318,4 @@
         }
     }
 
-    /**
-     * <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 static final class ChildNodeEntry {
-
-        private int hash = 0;
-
-        private final QName name;
-        private final int index; // 1-based index for same-name siblings
-        private final NodeId id;
-
-        private ChildNodeEntry(QName 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 < Path.INDEX_DEFAULT) {
-                throw new IllegalArgumentException("index is 1-based");
-            }
-            this.index = index;
-        }
-
-        public NodeId getId() {
-            return id;
-        }
-
-        public QName 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;
-        }
-    }
 }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
Thu Jul 27 06:31:54 2006
@@ -866,13 +866,13 @@
                 // removed child node entries
                 Iterator cneIt = nodeState.getRemovedChildNodeEntries().iterator();
                 while (cneIt.hasNext()) {
-                    NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) cneIt.next();
+                    ChildNodeEntry cne = (ChildNodeEntry) cneIt.next();
                     dependentIDs.add(cne.getId());
                 }
                 // added child node entries
                 cneIt = nodeState.getAddedChildNodeEntries().iterator();
                 while (cneIt.hasNext()) {
-                    NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) cneIt.next();
+                    ChildNodeEntry cne = (ChildNodeEntry) cneIt.next();
                     dependentIDs.add(cne.getId());
                 }
 
@@ -975,7 +975,7 @@
         // perform the move (modifying states)
         // TODO: TO-BE-FIXED. Move with SPI id       
         boolean renameOnly = srcParent.getNodeId().equals(destParent.getNodeId());
-        NodeState.ChildNodeEntry cne = srcParent.getChildNodeEntry(srcState.getNodeId());
+        ChildNodeEntry cne = srcParent.getChildNodeEntry(srcState.getNodeId());
         QName srcName = cne.getName();
         int srcIndex = cne.getIndex();
         if (renameOnly) {
@@ -1100,7 +1100,7 @@
             // use temp array to avoid ConcurrentModificationException
             Iterator childNodes = new ArrayList(nState.getChildNodeEntries()).iterator();
             while (childNodes.hasNext()) {
-                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) childNodes.next();
+                ChildNodeEntry entry = (ChildNodeEntry) childNodes.next();
                 NodeState childState = validator.getNodeState(entry.getId());
                 // check if node has been defined by mixin type (or one of its supertypes)
                 QName declNtName = childState.getDefinition().getDeclaringNodeType();
@@ -1140,7 +1140,7 @@
         ArrayList list = new ArrayList(parent.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.getId().equals(srcId)) {
                     srcInd = i;
@@ -1423,7 +1423,7 @@
             Iterator tmpIter = new ArrayList(targetState.getChildNodeEntries()).iterator();
             // remove from tail to avoid problems with same-name siblings
             while (tmpIter.hasNext()) {
-                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) tmpIter.next();
+                ChildNodeEntry entry = (ChildNodeEntry) tmpIter.next();
                 try {
                     NodeState child = validator.getNodeState(entry.getId());
                     // remove child node

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
Thu Jul 27 06:31:54 2006
@@ -29,6 +29,7 @@
 import org.apache.jackrabbit.jcr2spi.operation.Remove;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
+import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.NoPrefixDeclaredException;
@@ -73,7 +74,7 @@
         // retrieve nodestate of the jcr:versionLabels node
         vhState = state;
         if (vhState.hasChildNodeEntry(QName.JCR_VERSIONLABELS)) {
-            NodeState.ChildNodeEntry lnEntry = vhState.getChildNodeEntry(QName.JCR_VERSIONLABELS,
Path.INDEX_DEFAULT);
+            ChildNodeEntry lnEntry = vhState.getChildNodeEntry(QName.JCR_VERSIONLABELS, Path.INDEX_DEFAULT);
             try {
                 labelNodeState = (NodeState) itemStateMgr.getItemState(lnEntry.getId());
             } catch (ItemStateException e) {
@@ -118,7 +119,7 @@
 
         // all child-nodes except from jcr:versionLabels point to Versions.
         while (childIter.hasNext()) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) childIter.next();
+            ChildNodeEntry entry = (ChildNodeEntry) childIter.next();
             if (!QName.JCR_VERSIONLABELS.equals(entry.getName())) {
                 versionIds.add(entry.getId());
             }
@@ -332,7 +333,7 @@
     private NodeId getVersionId(String versionName) throws VersionException, RepositoryException
{
         try {
             QName vQName = NameFormat.parse(versionName, session.getNamespaceResolver());
-            NodeState.ChildNodeEntry vEntry = vhState.getChildNodeEntry(vQName, Path.INDEX_DEFAULT);
+            ChildNodeEntry vEntry = vhState.getChildNodeEntry(vQName, Path.INDEX_DEFAULT);
             if (vEntry == null) {
                 throw new VersionException("Version '" + versionName + "' does not exist
in this version history.");
             } else {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImporterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImporterImpl.java?rev=426067&r1=426066&r2=426067&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImporterImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImporterImpl.java
Thu Jul 27 06:31:54 2006
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager;
+import org.apache.jackrabbit.jcr2spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.jcr2spi.SessionImpl;
 import org.apache.jackrabbit.jcr2spi.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.SessionListener;
@@ -173,7 +174,7 @@
            NodeState nodeState = null;
            if (parent.hasChildNodeEntry(nodeInfo.getName())) {
                // a node with that name already exists...
-               NodeState.ChildNodeEntry entry = parent.getChildNodeEntry(nodeInfo.getName(),
1);
+               ChildNodeEntry entry = parent.getChildNodeEntry(nodeInfo.getName(), 1);
                NodeState existing = validator.getNodeState(entry.getId());
                QNodeDefinition def = existing.getDefinition();
                if (!def.allowsSameNameSiblings()) {
@@ -453,9 +454,9 @@
             List cne = parent.getChildNodeEntries(nodeInfo.getName());
             if (def.allowsSameNameSiblings()) {
                 // TODO: find proper solution. problem with same-name-siblings
-                childId = ((NodeState.ChildNodeEntry)cne.get(cne.size()-1)).getId();
+                childId = ((ChildNodeEntry)cne.get(cne.size()-1)).getId();
             } else {
-                childId = ((NodeState.ChildNodeEntry)cne.get(0)).getId();
+                childId = ((ChildNodeEntry)cne.get(0)).getId();
             }
             NodeState nodeState = validator.getNodeState(childId);
             



Mime
View raw message