jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r998331 - in /jackrabbit/branches/1.6: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/
Date Fri, 17 Sep 2010 21:21:18 GMT
Author: jukka
Date: Fri Sep 17 21:21:17 2010
New Revision: 998331

URL: http://svn.apache.org/viewvc?rev=998331&view=rev
Log:
1.6: Merged revision 958604 (JCR-2579)

Modified:
    jackrabbit/branches/1.6/   (props changed)
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java

Propchange: jackrabbit/branches/1.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 17 21:21:17 2010
@@ -1,4 +1,5 @@
 /jackrabbit/branches/1.5:794012,794100,794102
 /jackrabbit/branches/1.x:801262-801983,812129,812371
-/jackrabbit/branches/2.0:899183,900703
-/jackrabbit/trunk:770143-773197,773483,773525-773555,773584,773588,773828,773835-775756,775833,775836,775840,775868,775981,775986,776036,776256,776310,776313,776321-776322,776332,776356-776357,776362,776373,776650-776693,776737,776757,776776-776777,777024,777029,777034,777478,777509,777541,777548,777936,778445,778613,778616,778621,778645,778720,778802,779032,779040,779068-779071,779074,779076,779081,779084,779086-779088,779090-779092,779094-779096,779101,779223,779225,779227-779228,779230,779233-779234,779460,779475-779476,779504,779550,779552,779555,779561,779563,779583,779590,779618,779621-779622,779624,779642,779654,779657-779659,779661,779936,780006,780010,780025,780085,780985,780989,780993,781017,781051,781054,781294-781300,781305-781311,781318,781328,781338,781344,781347,781369,781372,781377,781416-781417,781423,782621-782622,782644,782646,782652,782669,782675,782677,782683,782694,782921,782925,782930,782936,783002,783004-783005,783042-783043,783239,783243,783245,78327
 8,783304,783319-783321,783324,783326-783327,783330-783333,783337-783338,783340-783341,783343,783345-783347,783356,783359,783383,783386,783412,783435,783444,783447,783523,783688,783703,783708,783710,783719,783757,783759,783761,783786,783809,784011,784013,784039,784058,784060-784061,784090-784091,784106,784108-784109,784111,784117-784120,784124,784163,784261,784680,784691,784696,784760,784824,785112,785116,785157,785169,785209,785492,785517,785519,785529,785533,785535,785539-785540,785545,785580,785589-785590,785592,785594,785597,785602,785627,785629,785631,785635,785645,785668,785711,785725,785777,785863,785981,786003,786019,786028,786062,786075,786089-786090,786093-786094,786144,786146-786147,786149,786167,786280,786295,786319,786329-786330,786336,786409,786419,786423,786480,786485,786492,786513,786562,786565,786680,786685,787183,787219,787241,787942,787952,787964,787996,788002,788012-788013,788350-788351,788443,788446,788450,789245,789257,789269-789270,789279,789307,789312,
 789324,789338,789347,789485,789629,789809,789986,790054,790056,790065-790066,790068,790070-790071,790118,790127,790153,790235-790236,790528,790537,790541,790557-790558,790568,790590,790600,790603,790629,790814,790826,790834,790887,790892,790901,790930,790939,791180,791253,791255,791438-791439,791441,791452,791457,791475,791492,791505,791520,791527,791737,791832,791884,791906,792102,792109,792118,792138,792152,792155-792156,792160,792162,792167-792168,792175,792180-792181,792211,792214,792218,792437,792453,792464,792467,792469,792485,792488,792496,792498,792508-792509,792547-792548,792588-792589,792849,792894-792895,792912,792932,792934,792968,793012-793013,793015-793016,793018,793046-793047,793072,793180,793238,793240,793243,793283,793484-793485,793507,793559,793571,793830,793836,793840,794162,794190,794193,794253,794278,794293-794294,794302,794304,794323,794329,794600,794617,794633,794641,794644,794652,794674,794702,794718,794743,794783,794994,795046,795049,795082,795096,79
 5136,795138,795841-795842,795854,795866,796584,796586,796757,796845,796855,796876,796899,796955,796957,797094,797139,797158,797386,797399,797410,797414,797416-797417,797424,797470,797484,797488-797489,797539,797549,797634,797662,797836,798141,798183,798196,798209,798306,798834,798844,798847-798848,798889-798890,798940,798958,799188,799284,799550,799595,799599,799610,800269,800464,800466,800478,800483,800715,800807,800829,800854,800862-800863,801104,801125-801126,801128,801135,801169,801210,801213,801226,801241,801968,801973,802691,802754,811001,812102,812369,815233,816124,818482,819491,820925,825772,829015,830575,830665,881283,889133,892253,899181,900702,923277,923597,925982,926324,927393,933646,935557,936668,944258,953585,955843,955852
+/jackrabbit/branches/2.0:899183,900703,958604
+/jackrabbit/branches/2.1:955314
+/jackrabbit/trunk:770143-773197,773483,773525-773555,773584,773588,773828,773835-775756,775833,775836,775840,775868,775981,775986,776036,776256,776310,776313,776321-776322,776332,776356-776357,776362,776373,776650-776693,776737,776757,776776-776777,777024,777029,777034,777478,777509,777541,777548,777936,778445,778613,778616,778621,778645,778720,778802,779032,779040,779068-779071,779074,779076,779081,779084,779086-779088,779090-779092,779094-779096,779101,779223,779225,779227-779228,779230,779233-779234,779460,779475-779476,779504,779550,779552,779555,779561,779563,779583,779590,779618,779621-779622,779624,779642,779654,779657-779659,779661,779936,780006,780010,780025,780085,780985,780989,780993,781017,781051,781054,781294-781300,781305-781311,781318,781328,781338,781344,781347,781369,781372,781377,781416-781417,781423,782621-782622,782644,782646,782652,782669,782675,782677,782683,782694,782921,782925,782930,782936,783002,783004-783005,783042-783043,783239,783243,783245,78327
 8,783304,783319-783321,783324,783326-783327,783330-783333,783337-783338,783340-783341,783343,783345-783347,783356,783359,783383,783386,783412,783435,783444,783447,783523,783688,783703,783708,783710,783719,783757,783759,783761,783786,783809,784011,784013,784039,784058,784060-784061,784090-784091,784106,784108-784109,784111,784117-784120,784124,784163,784261,784680,784691,784696,784760,784824,785112,785116,785157,785169,785209,785492,785517,785519,785529,785533,785535,785539-785540,785545,785580,785589-785590,785592,785594,785597,785602,785627,785629,785631,785635,785645,785668,785711,785725,785777,785863,785981,786003,786019,786028,786062,786075,786089-786090,786093-786094,786144,786146-786147,786149,786167,786280,786295,786319,786329-786330,786336,786409,786419,786423,786480,786485,786492,786513,786562,786565,786680,786685,787183,787219,787241,787942,787952,787964,787996,788002,788012-788013,788350-788351,788443,788446,788450,789245,789257,789269-789270,789279,789307,789312,
 789324,789338,789347,789485,789629,789809,789986,790054,790056,790065-790066,790068,790070-790071,790118,790127,790153,790235-790236,790528,790537,790541,790557-790558,790568,790590,790600,790603,790629,790814,790826,790834,790887,790892,790901,790930,790939,791180,791253,791255,791438-791439,791441,791452,791457,791475,791492,791505,791520,791527,791737,791832,791884,791906,792102,792109,792118,792138,792152,792155-792156,792160,792162,792167-792168,792175,792180-792181,792211,792214,792218,792437,792453,792464,792467,792469,792485,792488,792496,792498,792508-792509,792547-792548,792588-792589,792849,792894-792895,792912,792932,792934,792968,793012-793013,793015-793016,793018,793046-793047,793072,793180,793238,793240,793243,793283,793484-793485,793507,793559,793571,793830,793836,793840,794162,794190,794193,794253,794278,794293-794294,794302,794304,794323,794329,794600,794617,794633,794641,794644,794652,794674,794702,794718,794743,794783,794994,795046,795049,795082,795096,79
 5136,795138,795841-795842,795854,795866,796584,796586,796757,796845,796855,796876,796899,796955,796957,797094,797139,797158,797386,797399,797410,797414,797416-797417,797424,797470,797484,797488-797489,797539,797549,797634,797662,797836,798141,798183,798196,798209,798306,798834,798844,798847-798848,798889-798890,798940,798958,799188,799284,799550,799595,799599,799610,800269,800464,800466,800478,800483,800715,800807,800829,800854,800862-800863,801104,801125-801126,801128,801135,801169,801210,801213,801226,801241,801968,801973,802691,802754,811001,812102,812369,815233,816124,818482,819491,820925,825772,829015,830575,830665,881283,889133,892253,899181,900702,923277,923597,925982,926324,927393,933646,935557,936668,944258,953585,955307,955843,955852

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java?rev=998331&r1=998330&r2=998331&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
Fri Sep 17 21:21:17 2010
@@ -17,30 +17,23 @@
 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.core.util.EmptyLinkedMap;
 import org.apache.jackrabbit.spi.Name;
 
+import java.util.Iterator;
 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;
 import java.util.Map;
 
 /**
  * <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 {
+class ChildNodeEntries implements Cloneable {
 
     /**
      * Insertion-ordered map of entries
@@ -259,11 +252,11 @@ class ChildNodeEntries implements List, 
             return Collections.EMPTY_LIST;
         }
         if (other.isEmpty()) {
-            return this;
+            return list();
         }
 
         List result = new ArrayList();
-        Iterator iter = iterator();
+        Iterator iter = entries.values().iterator();
         while (iter.hasNext()) {
             ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             ChildNodeEntry otherEntry = other.get(entry.getId());
@@ -299,7 +292,7 @@ class ChildNodeEntries implements List, 
         }
 
         List result = new ArrayList();
-        Iterator iter = iterator();
+        Iterator iter = entries.values().iterator();
         while (iter.hasNext()) {
             ChildNodeEntry entry = (ChildNodeEntry) iter.next();
             ChildNodeEntry otherEntry = other.get(entry.getId());
@@ -315,138 +308,37 @@ class ChildNodeEntries implements List, 
     }
 
     //-----------------------------------------------< 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 List list() {
+        return new ArrayList(entries.values());
     }
 
-    public ListIterator listIterator(int index) {
-        if (index < 0 || index >= entries.size()) {
-            throw new IndexOutOfBoundsException();
-        }
-        ListIterator iter = new EntriesIterator();
-        while (index-- > 0) {
-            iter.next();
+    public List getRenamedEntries(ChildNodeEntries that) {
+        List renamed = Collections.emptyList();
+        Iterator iterator = entries.values().iterator();
+        while (iterator.hasNext()) {
+            ChildNodeEntry entry = (ChildNodeEntry) iterator.next();
+            ChildNodeEntry other = that.get(entry.getId());
+            if (other != null && !entry.getName().equals(other.getName())) {
+                // child node entry with same id but different name exists in
+                // overlaid and this state => renamed entry detected
+                if (renamed.isEmpty()) {
+                    renamed = new ArrayList();
+                }
+                renamed.add(entry);
+            }
         }
-        return iter;
+        return renamed;
     }
 
     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();
-    }
-
     //-------------------------------------------< java.lang.Object overrides >
     public boolean equals(Object obj) {
         if (this == obj) {
@@ -527,51 +419,4 @@ class ChildNodeEntries implements List, 
         }
     }
 
-    //--------------------------------------------------------< 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();
-        }
-    }
 }

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=998331&r1=998330&r2=998331&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Fri Sep 17 21:21:17 2010
@@ -23,7 +23,6 @@ import org.apache.jackrabbit.spi.Name;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
@@ -298,7 +297,7 @@ public class NodeState extends ItemState
      * @see #removeChildNodeEntry
      */
     public synchronized List getChildNodeEntries() {
-        return childNodeEntries;
+        return childNodeEntries.list();
     }
 
     /**
@@ -606,7 +605,7 @@ public class NodeState extends ItemState
      */
     public synchronized List getAddedChildNodeEntries() {
         if (!hasOverlayedState()) {
-            return childNodeEntries;
+            return childNodeEntries.list();
         }
 
         NodeState other = (NodeState) getOverlayedState();
@@ -655,32 +654,10 @@ public class NodeState extends ItemState
      */
     public synchronized List getRenamedChildNodeEntries() {
         if (!hasOverlayedState()) {
-            return Collections.EMPTY_LIST;
-        }
-
-        ChildNodeEntries otherChildNodeEntries =
-                ((NodeState) overlayedState).childNodeEntries;
-
-        // do a lazy init
-        List renamed = null;
-
-        for (Iterator iter = childNodeEntries.iterator(); iter.hasNext();) {
-            ChildNodeEntry cne = (ChildNodeEntry) iter.next();
-            ChildNodeEntry cneOther = otherChildNodeEntries.get(cne.getId());
-            if (cneOther != null && !cne.getName().equals(cneOther.getName())) {
-                // child node entry with same id but different name exists in
-                // overlayed and this state => renamed entry detected
-                if (renamed == null) {
-                    renamed = new ArrayList();
-                }
-                renamed.add(cne);
-            }
-        }
-
-        if (renamed == null) {
-            return Collections.EMPTY_LIST;
+            return childNodeEntries.getRenamedEntries(
+                    ((NodeState) overlayedState).childNodeEntries);
         } else {
-            return renamed;
+            return Collections.emptyList();
         }
     }
 
@@ -753,7 +730,7 @@ public class NodeState extends ItemState
                 if (i + 1 < ours.size()) {
                     // if entry is the next in the other list then probably
                     // the other entry at position <code>i</code> was reordered
-                    if (entry.getId().equals(((ChildNodeEntry) others.get(i + 1)).getId()))
{
+                    if (((ChildNodeEntry) entry).getId().equals(((ChildNodeEntry) others.get(i
+ 1)).getId())) {
                         // scan for the uuid of the other entry in our list
                         for (int j = i; j < ours.size(); j++) {
                             if (((ChildNodeEntry) ours.get(j)).getId().equals(other.getId()))
{

Modified: jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=998331&r1=998330&r2=998331&view=diff
==============================================================================
--- jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
(original)
+++ jackrabbit/branches/1.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
Fri Sep 17 21:21:17 2010
@@ -157,10 +157,10 @@ class InternalVersionHistoryImpl extends
         rootVersion = createVersionInstance(NameConstants.JCR_ROOTVERSION);
 
         // get version entries
-        ChildNodeEntry[] children = (ChildNodeEntry[])
-            node.getState().getChildNodeEntries().toArray();
-        for (int i = 0; i < children.length; i++) {
-            ChildNodeEntry child = children[i];
+        Iterator iterator =
+            node.getState().getChildNodeEntries().iterator();
+        while (iterator.hasNext()) {
+            ChildNodeEntry child = (ChildNodeEntry) iterator.next();
             if (child.getName().equals(NameConstants.JCR_VERSIONLABELS)) {
                 continue;
             }



Mime
View raw message