jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r683257 [2/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
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Wed Aug  6 06:17:00 2008
@@ -16,23 +16,17 @@
  */
 package org.apache.jackrabbit.core.state;
 
-import org.apache.commons.collections.MapIterator;
-import org.apache.commons.collections.OrderedMapIterator;
-import org.apache.commons.collections.map.LinkedMap;
 import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.spi.Name;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.ListIterator;
 import java.util.Set;
 
 /**
@@ -948,554 +942,4 @@
             listener.nodeRemoved(this, removed.getName(), removed.getIndex(), removed.getId());
         }
     }
-
-    //--------------------------------------------------------< inner classes >
-    /**
-     * <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.
-     */
-    private static 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();
-            }
-        }
-    }
-
-    /**
-     * <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 Name name;
-        private final int index; // 1-based index for same-name siblings
-        private final NodeId id;
-
-        private 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;
-        }
-    }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
Wed Aug  6 06:17:00 2008
@@ -103,8 +103,8 @@
 
                     for (Iterator iter = state.getAddedChildNodeEntries().iterator();
                          iter.hasNext();) {
-                        NodeState.ChildNodeEntry cne =
-                                (NodeState.ChildNodeEntry) iter.next();
+                        ChildNodeEntry cne =
+                                (ChildNodeEntry) iter.next();
 
                         if (context.isAdded(cne.getId())) {
                             // a new child node entry has been added to this state;
@@ -126,8 +126,8 @@
 
                     for (Iterator iter = state.getRemovedChildNodeEntries().iterator();
                          iter.hasNext();) {
-                        NodeState.ChildNodeEntry cne =
-                                (NodeState.ChildNodeEntry) iter.next();
+                        ChildNodeEntry cne =
+                                (ChildNodeEntry) iter.next();
                         if (context.isDeleted(cne.getId())) {
                             // a child node entry has been removed from this node state
                             removed.add(cne);
@@ -138,13 +138,13 @@
                     // re-apply changes made on this state
                     state.setChildNodeEntries(overlayedState.getChildNodeEntries());
                     for (Iterator iter = added.iterator(); iter.hasNext();) {
-                        NodeState.ChildNodeEntry cne =
-                                (NodeState.ChildNodeEntry) iter.next();
+                        ChildNodeEntry cne =
+                                (ChildNodeEntry) iter.next();
                         state.addChildNodeEntry(cne.getName(), cne.getId());
                     }
                     for (Iterator iter = removed.iterator(); iter.hasNext();) {
-                        NodeState.ChildNodeEntry cne =
-                                (NodeState.ChildNodeEntry) iter.next();
+                        ChildNodeEntry cne =
+                                (ChildNodeEntry) iter.next();
                         state.removeChildNodeEntry(cne.getId());
                     }
                 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalFrozenNodeImpl.java
Wed Aug  6 06:17:00 2008
@@ -21,8 +21,8 @@
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.state.ItemStateException;
-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.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;
@@ -171,8 +171,8 @@
                 Iterator iter = entries.iterator();
                 int i = 0;
                 while (iter.hasNext()) {
-                    NodeState.ChildNodeEntry entry =
-                            (NodeState.ChildNodeEntry) iter.next();
+                    ChildNodeEntry entry =
+                            (ChildNodeEntry) iter.next();
                     frozenNodes[i++] = (InternalFreeze) vMgr.getItem(entry.getId());
                 }
             } catch (RepositoryException e) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
Wed Aug  6 06:17:00 2008
@@ -21,7 +21,7 @@
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.NodeState.ChildNodeEntry;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionImpl.java
Wed Aug  6 06:17:00 2008
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.spi.Name;
@@ -118,7 +118,7 @@
      * {@inheritDoc}
      */
     public NodeId getFrozenNodeId() {
-        NodeState.ChildNodeEntry entry = node.getState().getChildNodeEntry(NameConstants.JCR_FROZENNODE,
1);
+        ChildNodeEntry entry = node.getState().getChildNodeEntry(NameConstants.JCR_FROZENNODE,
1);
         if (entry == null) {
             throw new InternalError("version has no frozen node: " + getId());
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
Wed Aug  6 06:17:00 2008
@@ -29,6 +29,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.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;
@@ -328,7 +329,7 @@
      */
     public boolean removeNode(Name name, int index) throws RepositoryException {
         try {
-            NodeState.ChildNodeEntry entry = nodeState.getChildNodeEntry(name, index);
+            ChildNodeEntry entry = nodeState.getChildNodeEntry(name, index);
             if (entry == null) {
                 return false;
             } else {
@@ -364,7 +365,7 @@
         // remove child nodes
         iter = state.getChildNodeEntries().iterator();
         while (iter.hasNext()) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+            ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             removeNode(entry.getId());
         }
         state.removeAllChildNodeEntries();
@@ -407,7 +408,7 @@
      * @throws RepositoryException
      */
     public NodeStateEx getNode(Name name, int index) throws RepositoryException {
-        NodeState.ChildNodeEntry entry = nodeState.getChildNodeEntry(name, index);
+        ChildNodeEntry entry = nodeState.getChildNodeEntry(name, index);
         if (entry == null) {
             return null;
         }
@@ -483,7 +484,7 @@
             List entries = nodeState.getChildNodeEntries();
             NodeStateEx[] children = new NodeStateEx[entries.size()];
             for (int i = 0; i < entries.size(); i++) {
-                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) entries.get(i);
+                ChildNodeEntry entry = (ChildNodeEntry) entries.get(i);
                 NodeState state = (NodeState) stateMgr.getItemState(entry.getId());
                 children[i] = new NodeStateEx(stateMgr, ntReg, state, entry.getName());
             }
@@ -529,7 +530,7 @@
             // now store all child node entries
             List nodes = state.getChildNodeEntries();
             for (int i = 0; i < nodes.size(); i++) {
-                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) nodes.get(i);
+                ChildNodeEntry entry = (ChildNodeEntry) nodes.get(i);
                 NodeState nstate = (NodeState) stateMgr.getItemState(entry.getId());
                 store(nstate);
             }
@@ -574,7 +575,7 @@
             // now reload all child node entries
             List nodes = state.getChildNodeEntries();
             for (int i = 0; i < nodes.size(); i++) {
-                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) nodes.get(i);
+                ChildNodeEntry entry = (ChildNodeEntry) nodes.get(i);
                 NodeState nstate = (NodeState) stateMgr.getItemState(entry.getId());
                 reload(nstate);
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
Wed Aug  6 06:17:00 2008
@@ -33,6 +33,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.ItemStateReferenceMap;
 import org.apache.jackrabbit.core.state.ItemStateListener;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.util.WeakIdentityCollection;
@@ -360,7 +361,7 @@
                 }
                 Iterator iter = state.getChildNodeEntries().iterator();
                 while (iter.hasNext()) {
-                    NodeState.ChildNodeEntry pe = (NodeState.ChildNodeEntry) iter.next();
+                    ChildNodeEntry pe = (ChildNodeEntry) iter.next();
                     invalidateItem(pe.getId(), true);
                 }
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
Wed Aug  6 06:17:00 2008
@@ -27,6 +27,7 @@
 import org.apache.jackrabbit.core.nodetype.PropDef;
 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.util.ReferenceChangeTracker;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.version.VersionManager;
@@ -238,7 +239,7 @@
             // child node entries (JCR-1055);
             // => backup list of child node entries beforehand in order
             // to restore it afterwards
-            NodeState.ChildNodeEntry cneConflicting = parent.getChildNodeEntry(nodeInfo.getId());
+            ChildNodeEntry cneConflicting = parent.getChildNodeEntry(nodeInfo.getId());
             List cneList = new ArrayList(parent.getChildNodeEntries());
             // do remove conflicting (recursive)
             itemOps.removeNodeState(conflicting);
@@ -264,7 +265,7 @@
                 // but preserving original position
                 parent.removeAllChildNodeEntries();
                 for (Iterator iter = cneList.iterator(); iter.hasNext();) {
-                    NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) iter.next();
+                    ChildNodeEntry cne = (ChildNodeEntry) iter.next();
                     if (cne.getId().equals(nodeInfo.getId())) {
                         // replace entry with different name
                         parent.addChildNodeEntry(nodeInfo.getName(), nodeInfo.getId());
@@ -410,7 +411,7 @@
             }
             if (parent.hasChildNodeEntry(nodeName)) {
                 // a node with that name already exists...
-                NodeState.ChildNodeEntry entry =
+                ChildNodeEntry entry =
                         parent.getChildNodeEntry(nodeName, 1);
                 NodeId idExisting = entry.getId();
                 NodeState existing = (NodeState) itemOps.getItemState(idExisting);

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java?rev=683257&r1=683256&r2=683257&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java
Wed Aug  6 06:17:00 2008
@@ -28,6 +28,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.NodeStateListener;
 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.name.NameConstants;
@@ -437,7 +438,7 @@
                 throws ItemStateException {
 
             NodeState oldParent = (NodeState) getItemState(child.getParentId());
-            NodeState.ChildNodeEntry cne = oldParent.getChildNodeEntry(child.getNodeId());
+            ChildNodeEntry cne = oldParent.getChildNodeEntry(child.getNodeId());
             if (cne == null) {
                 throw new ItemStateException(child.getNodeId().toString());
             }
@@ -462,7 +463,7 @@
 
             int srcIndex = -1, destIndex = -1;
             for (int i = 0; i < list.size(); i++) {
-                NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) list.get(i);
+                ChildNodeEntry cne = (ChildNodeEntry) list.get(i);
                 if (cne.getId().equals(src.getId())) {
                     srcIndex = i;
                 } else if (dest != null && cne.getId().equals(dest.getId())) {
@@ -507,7 +508,7 @@
          */
         public void renameNode(NodeState child, String newName) throws ItemStateException
{
             NodeState parent = (NodeState) getItemState(child.getParentId());
-            NodeState.ChildNodeEntry cne = parent.getChildNodeEntry(child.getNodeId());
+            ChildNodeEntry cne = parent.getChildNodeEntry(child.getNodeId());
             if (cne == null) {
                 throw new ItemStateException(child.getNodeId().toString());
             }



Mime
View raw message