You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2009/09/18 18:12:59 UTC

svn commit: r816695 - /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/

Author: reschke
Date: Fri Sep 18 16:12:58 2009
New Revision: 816695

URL: http://svn.apache.org/viewvc?rev=816695&view=rev
Log:
JCR-2087: parametrize generic types

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java Fri Sep 18 16:12:58 2009
@@ -20,9 +20,9 @@
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.spi.Name;
 
+import java.util.Iterator;
 import java.util.Set;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -33,7 +33,7 @@
 
     private static Logger log = LoggerFactory.getLogger(ChildNodeAttic.class);
 
-    private Set attic = new HashSet();
+    private Set<NodeEntryImpl> attic = new HashSet<NodeEntryImpl>();
 
     ChildNodeAttic() {
     }
@@ -43,8 +43,7 @@
     }
 
     boolean contains(Name name, int index) {
-        for (Iterator it = attic.iterator(); it.hasNext();) {
-            NodeEntryImpl ne = (NodeEntryImpl) it.next();
+        for (NodeEntryImpl ne : attic) {
             if (ne.matches(name, index)) {
                 return true;
             }
@@ -53,8 +52,7 @@
     }
 
     boolean contains(Name name, int index, String uniqueId) {
-        for (Iterator it = attic.iterator(); it.hasNext();) {
-            NodeEntryImpl ne = (NodeEntryImpl) it.next();
+        for (NodeEntryImpl ne : attic) {
             if (uniqueId != null && uniqueId.equals(ne.getUniqueID())) {
                 return true;
             } else if (ne.matches(name, index)) {
@@ -65,10 +63,9 @@
         return false;
     }
 
-    List get(Name name) {
-        List l = new ArrayList();
-        for (Iterator it = attic.iterator(); it.hasNext();) {
-            NodeEntryImpl ne = (NodeEntryImpl) it.next();
+    List<NodeEntryImpl> get(Name name) {
+        List<NodeEntryImpl> l = new ArrayList<NodeEntryImpl>();
+        for (NodeEntryImpl ne : attic) {
             if (ne.matches(name)) {
                 l.add(ne);
             }
@@ -83,8 +80,7 @@
      * @return
      */
     NodeEntry get(Name name, int index) {
-        for (Iterator it = attic.iterator(); it.hasNext();) {
-            NodeEntryImpl ne = (NodeEntryImpl) it.next();
+        for (NodeEntryImpl ne : attic) {
             if (ne.matches(name, index)) {
                 return ne;
             }
@@ -102,8 +98,7 @@
         if (uniqueId == null) {
             throw new IllegalArgumentException();
         }
-        for (Iterator it = attic.iterator(); it.hasNext();) {
-            NodeEntryImpl ne = (NodeEntryImpl) it.next();
+        for (NodeEntryImpl ne : attic) {
             if (uniqueId.equals(ne.getUniqueID())) {
                 return ne;
             }
@@ -123,7 +118,7 @@
         return false;
     }
 
-    Iterator iterator() {
+    Iterator<NodeEntryImpl> iterator() {
         return attic.iterator();
     }
     

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntries.java Fri Sep 18 16:12:58 2009
@@ -53,7 +53,7 @@
      *
      * @return Iterator over all NodeEntry object
      */
-    Iterator iterator();
+    Iterator<NodeEntry> iterator();
 
     /**
      * Returns a <code>List</code> of <code>NodeEntry</code>s for the
@@ -63,7 +63,7 @@
      * @param nodeName the child node name.
      * @return same name sibling nodes with the given <code>nodeName</code>.
      */
-    List get(Name nodeName);
+    List<NodeEntry> get(Name nodeName);
 
     /**
      * Returns the <code>NodeEntry</code> with the given

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java Fri Sep 18 16:12:58 2009
@@ -78,13 +78,13 @@
       * and the complete list will be retrieved only to answer {@link #iterator()}
       * if the passed boolean is <code>true</code>.
       */
-     ChildNodeEntriesImpl(NodeEntry parent, EntryFactory factory, Iterator childNodeInfos) {
+     ChildNodeEntriesImpl(NodeEntry parent, EntryFactory factory, Iterator<ChildInfo> childNodeInfos) {
          this.parent = parent;
          this.factory = factory;
 
          if (childNodeInfos != null) {
              while (childNodeInfos.hasNext()) {
-                 ChildInfo ci = (ChildInfo) childNodeInfos.next();
+                 ChildInfo ci = childNodeInfos.next();
                  NodeEntry entry = factory.createNodeEntry(parent, ci.getName(), ci.getUniqueID());
                  add(entry, ci.getIndex());
              }
@@ -137,7 +137,7 @@
         }
 
         NodeId id = parent.getWorkspaceId();
-        Iterator childNodeInfos = factory.getItemStateFactory().getChildNodeInfos(id);
+        Iterator<ChildInfo> childNodeInfos = factory.getItemStateFactory().getChildNodeInfos(id);
         update(childNodeInfos);
     }
 
@@ -158,11 +158,11 @@
      * @see org.apache.jackrabbit.jcr2spi.operation.Move
      * @see org.apache.jackrabbit.jcr2spi.operation.ReorderNodes
      */
-    synchronized void update(Iterator childNodeInfos) {
+    synchronized void update(Iterator<ChildInfo> childNodeInfos) {
         // insert missing entries and reorder all if necessary.
         LinkedEntries.LinkNode prevLN = null;
         while (childNodeInfos.hasNext()) {
-            ChildInfo ci = (ChildInfo) childNodeInfos.next();
+            ChildInfo ci = childNodeInfos.next();
             LinkedEntries.LinkNode ln = entriesByName.getLinkNode(ci.getName(), ci.getIndex(), ci.getUniqueID());
             if (ln == null) {
                 // add missing at the correct position.
@@ -188,10 +188,10 @@
     /**
      * @see ChildNodeEntries#iterator()
      */
-    public Iterator iterator() {
-        List l = new ArrayList(entries.size());
-        for (Iterator it = entries.linkNodeIterator(); it.hasNext();) {
-            l.add(((LinkedEntries.LinkNode)it.next()).getNodeEntry());
+    public Iterator<NodeEntry> iterator() {
+        List<NodeEntry> l = new ArrayList<NodeEntry>(entries.size());
+        for (Iterator<LinkedEntries.LinkNode> it = entries.linkNodeIterator(); it.hasNext();) {
+            l.add(it.next().getNodeEntry());
         }
         return Collections.unmodifiableList(l).iterator();
     }
@@ -199,7 +199,7 @@
     /**
      * @see ChildNodeEntries#get(Name)
      */
-    public List get(Name nodeName) {
+    public List<NodeEntry> get(Name nodeName) {
         return entriesByName.getList(nodeName);
     }
 
@@ -220,9 +220,7 @@
         if (uniqueID == null || nodeName == null) {
             throw new IllegalArgumentException();
         }
-        Iterator cneIter = get(nodeName).iterator();
-        while (cneIter.hasNext()) {
-            NodeEntry cne = (NodeEntry) cneIter.next();
+        for (NodeEntry cne : get(nodeName)) {
             if (uniqueID.equals(cne.getUniqueID())) {
                 return cne;
             }
@@ -413,8 +411,8 @@
                 // determine the new position of the reordered node regarding
                 // his siblings.
                 position = 0;
-                for (Iterator it = entries.linkNodeIterator(); it.hasNext(); ) {
-                    LinkedEntries.LinkNode ln = (LinkedEntries.LinkNode) it.next();
+                for (Iterator<LinkedEntries.LinkNode> it = entries.linkNodeIterator(); it.hasNext(); ) {
+                    LinkedEntries.LinkNode ln = it.next();
                     if (ln == beforeLN) {
                         break;
                     } else if (ln != insertLN && insertName.equals(ln.qName)) {
@@ -462,8 +460,8 @@
                     // determine the new position of the reordered node regarding
                     // his siblings.
                     position = 0;
-                    for (Iterator it = entries.linkNodeIterator(); it.hasNext(); ) {
-                        LinkedEntries.LinkNode ln = (LinkedEntries.LinkNode) it.next();
+                    for (Iterator<LinkedEntries.LinkNode> it = entries.linkNodeIterator(); it.hasNext(); ) {
+                        LinkedEntries.LinkNode ln = it.next();
                         if (insertName.equals(ln.qName) && (ln != insertLN)) {
                             position++;
                         }
@@ -502,8 +500,8 @@
          * @return the matching <code>LinkNode</code> or <code>null</code>
          */
         private LinkedEntries.LinkNode getLinkNode(NodeEntry nodeEntry) {
-            for (Iterator it = linkNodeIterator(); it.hasNext();) {
-                LinkedEntries.LinkNode ln = (LinkedEntries.LinkNode) it.next();
+            for (Iterator<LinkedEntries.LinkNode> it = linkNodeIterator(); it.hasNext();) {
+                LinkedEntries.LinkNode ln = it.next();
                 if (ln.getNodeEntry() == nodeEntry) {
                     return ln;
                 }
@@ -608,7 +606,7 @@
         /**
          * @return iterator over all LinkNode entries in this list.
          */
-        private Iterator linkNodeIterator() {
+        private Iterator<LinkedEntries.LinkNode> linkNodeIterator() {
             return new LinkNodeIterator();
         }
 
@@ -650,7 +648,7 @@
                 // create a new NodeEntry in order to avoid returning null.
                 if (ne == null && this != header) {
                     ne = factory.createNodeEntry(parent, qName, null);
-                    super.setValue(new SoftReference(ne));
+                    super.setValue(new SoftReference<NodeEntry>(ne));
                 }
                 return ne;
             }
@@ -685,7 +683,7 @@
         }
 
         //----------------------------------------------------------------------
-        private class LinkNodeIterator implements Iterator {
+        private class LinkNodeIterator implements Iterator<LinkedEntries.LinkNode> {
 
             private LinkedEntries.LinkNode next = ((LinkedEntries.LinkNode) header).getNextLinkNode();
             private final int expectedModCount = modCount;
@@ -695,7 +693,7 @@
                 return next != header;
             }
 
-            public Object next() {
+            public LinkedEntries.LinkNode next() {
                 checkModCount();
                 if (!hasNext()) {
                     throw new NoSuchElementException();
@@ -725,8 +723,8 @@
      */
     private static class NameMap {
 
-        private final Map snsMap = new HashMap();
-        private final Map nameMap = new HashMap();
+        private final Map<Name, List> snsMap = new HashMap<Name, List>();
+        private final Map<Name, LinkedEntries.LinkNode> nameMap = new HashMap<Name, LinkedEntries.LinkNode>();
 
         /**
          * Return true if more than one NodeEnty with the given name exists.
@@ -751,9 +749,9 @@
             if (val != null) {
                 return ((LinkedEntries.LinkNode) val).getNodeEntry();
             } else {
-                List l = (List) snsMap.get(qName);
+                List l = snsMap.get(qName);
                 if (l != null) {
-                    List nodeEntries = new ArrayList(l.size());
+                    List<NodeEntry> nodeEntries = new ArrayList<NodeEntry>(l.size());
                     for (Iterator it = l.iterator(); it.hasNext();) {
                         LinkedEntries.LinkNode ln = (LinkedEntries.LinkNode) it.next();
                         nodeEntries.add(ln.getNodeEntry());
@@ -772,16 +770,16 @@
          * @param name
          * @return list of entries or an empty list.
          */
-        public List getList(Name name) {
+        public List<NodeEntry> getList(Name name) {
             Object obj = get(name);
             if (obj == null) {
-                return Collections.EMPTY_LIST;
+                return Collections.emptyList();
             } else if (obj instanceof List) {
-                List l = new ArrayList((List)obj);
+                List<NodeEntry> l = new ArrayList<NodeEntry>((List)obj);
                 return Collections.unmodifiableList(l);
             } else {
                 // NodeEntry
-                return Collections.singletonList(obj);
+                return Collections.singletonList((NodeEntry)obj);
             }
         }
 
@@ -807,12 +805,12 @@
                 throw new IllegalArgumentException("Illegal index " + index);
             }
 
-            LinkedEntries.LinkNode val = (LinkedEntries.LinkNode) nameMap.get(name);
+            LinkedEntries.LinkNode val = nameMap.get(name);
             if (val != null) {
                 return (index == Path.INDEX_DEFAULT) ? val : null;
             } else {
                 // look in snsMap
-                List l = (List) snsMap.get(name);
+                List l = snsMap.get(name);
                 int pos = index - 1; // Index of NodeEntry is 1-based
                 return (l != null && pos < l.size()) ? (LinkedEntries.LinkNode) l.get(pos) : null;
             }
@@ -823,14 +821,14 @@
                 // -> try if any entry matches.
                 // if none matches it be might that entry doesn't have uniqueID
                 // set yet -> search without uniqueID
-                LinkedEntries.LinkNode val = (LinkedEntries.LinkNode) nameMap.get(name);
+                LinkedEntries.LinkNode val = nameMap.get(name);
                 if (val != null) {
                     if (uniqueID.equals(val.getNodeEntry().getUniqueID())) {
                         return val;
                     }
                 } else {
                     // look in snsMap
-                    List l = (List) snsMap.get(name);
+                    List l = snsMap.get(name);
                     if (l != null) {
                         for (Iterator it = l.iterator(); it.hasNext();) {
                             LinkedEntries.LinkNode ln = (LinkedEntries.LinkNode) it.next();
@@ -848,15 +846,15 @@
 
         public void put(Name name, int index, LinkedEntries.LinkNode value) {
             // if 'nameMap' already contains a single entry -> move it to snsMap
-            LinkedEntries.LinkNode single = (LinkedEntries.LinkNode) nameMap.remove(name);
-            List l;
+            LinkedEntries.LinkNode single = nameMap.remove(name);
+            List<LinkedEntries.LinkNode> l;
             if (single != null) {
-                l = new ArrayList();
+                l = new ArrayList<LinkedEntries.LinkNode>();
                 l.add(single);
                 snsMap.put(name, l);
             } else {
                 // if 'snsMap' already contains list
-                l = (List) snsMap.get(name);
+                l = snsMap.get(name);
             }
 
             if (l == null) {
@@ -874,18 +872,18 @@
         }
 
         public LinkedEntries.LinkNode remove(Name name, LinkedEntries.LinkNode value) {
-            Object rm = nameMap.remove(name);
+            LinkedEntries.LinkNode rm = nameMap.remove(name);
             if (rm == null) {
-                List l = (List) snsMap.get(name);
+                List l = snsMap.get(name);
                 if (l != null && l.remove(value)) {
                     rm = value;
                 }
             }
-            return ((LinkedEntries.LinkNode) rm);
+            return rm;
         }
 
         public void reorder(Name name, LinkedEntries.LinkNode insertValue, int position) {
-            List sns = (List) snsMap.get(name);
+            List sns = snsMap.get(name);
             if (sns == null) {
                 // no same name siblings -> no special handling required
                 return;
@@ -906,12 +904,12 @@
          * @param index
          * @return matching entry or <code>null</code>.
          */
-        private static NodeEntry findMatchingEntry(List siblings, int index) {
+        private static NodeEntry findMatchingEntry(List<NodeEntry> siblings, int index) {
             // shortcut if index can never match
             if (index > siblings.size()) {
                 return null;
             } else {
-                return (NodeEntry) siblings.get(index - 1);
+                return siblings.get(index - 1);
             }
         }
     }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntries.java Fri Sep 18 16:12:58 2009
@@ -48,14 +48,14 @@
      *
      * @return Collection of all <code>PropertyEntry</code> objects present.
      */
-    public Collection getPropertyEntries();
+    public Collection<PropertyEntry> getPropertyEntries();
 
     /**
      * Returns an unmodifiable collection containing all existing property names.
      *
      * @return Collection of <code>Name</code>
      */
-    public Collection getPropertyNames();
+    public Collection<Name> getPropertyNames();
 
     /**
      * Adds the new <code>PropertyEntry</code> to this <code>ChildPropertyEntries</code>.
@@ -70,7 +70,7 @@
      *
      * @param propertyEntries
      */
-    public void addAll(Collection propertyEntries);
+    public void addAll(Collection<PropertyEntry> propertyEntries);
 
     /**
      * Remove the collection entry with the given <code>Name</code>.

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildPropertyEntriesImpl.java Fri Sep 18 16:12:58 2009
@@ -21,7 +21,6 @@
 import org.apache.jackrabbit.spi.Name;
 
 import java.util.Map;
-import java.util.Iterator;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Set;
@@ -37,12 +36,12 @@
 
     private static Logger log = LoggerFactory.getLogger(ChildPropertyEntriesImpl.class);
 
-    private final Map properties;
+    private final Map<Name, Reference<PropertyEntry>> properties;
     private final NodeEntry parent;
     private final EntryFactory factory;
 
     ChildPropertyEntriesImpl(NodeEntry parent, EntryFactory factory) {
-        properties = new HashMap();
+        this.properties = new HashMap<Name, Reference<PropertyEntry>>();
         this.parent = parent;
         this.factory = factory;
     }
@@ -58,13 +57,13 @@
      * @see ChildPropertyEntries#get(Name)
      */
     public PropertyEntry get(Name propertyName) {
-        Object ref = properties.get(propertyName);
+        Reference<PropertyEntry> ref = properties.get(propertyName);
         if (ref == null) {
             // no entry exists with the given name
             return null;
         }
 
-        PropertyEntry entry = (PropertyEntry) ((Reference) ref).get();
+        PropertyEntry entry = ref.get();
         if (entry == null) {
             // entry has been g-collected -> create new entry and return it.
             entry = factory.createPropertyEntry(parent, propertyName);
@@ -76,11 +75,10 @@
     /**
      * @see ChildPropertyEntries#getPropertyEntries()
      */
-    public Collection getPropertyEntries() {
+    public Collection<PropertyEntry> getPropertyEntries() {
         synchronized (properties) {
-            Set entries = new HashSet(properties.size());
-            for (Iterator it = properties.keySet().iterator(); it.hasNext();) {
-                Name propName = (Name) it.next();
+            Set<PropertyEntry> entries = new HashSet<PropertyEntry>(properties.size());
+            for (Name propName : properties.keySet()) {
                 entries.add(get(propName));
             }
             return Collections.unmodifiableCollection(entries);
@@ -90,7 +88,7 @@
     /**
      * @see ChildPropertyEntries#getPropertyNames()
      */
-    public Collection getPropertyNames() {
+    public Collection<Name> getPropertyNames() {
         return Collections.unmodifiableCollection(properties.keySet());
     }
 
@@ -99,7 +97,7 @@
      */
     public void add(PropertyEntry propertyEntry) {
         synchronized (properties) {
-            Reference ref = new SoftReference(propertyEntry);
+            Reference<PropertyEntry> ref = new SoftReference<PropertyEntry>(propertyEntry);
             properties.put(propertyEntry.getName(), ref);
         }
     }
@@ -107,12 +105,9 @@
     /**
      * @see ChildPropertyEntries#addAll(Collection)
      */
-    public void addAll(Collection propertyEntries) {
-        for (Iterator it = propertyEntries.iterator(); it.hasNext();) {
-            Object pe = it.next();
-            if (pe instanceof PropertyEntry) {
-                add((PropertyEntry) pe);
-            }
+    public void addAll(Collection<PropertyEntry> propertyEntries) {
+        for (PropertyEntry pe : propertyEntries) {
+            add(pe);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryValidation.java Fri Sep 18 16:12:58 2009
@@ -39,10 +39,10 @@
      * @return <code>true</code> if one of the entries is valid; otherwise
      *         <code>false</code>.
      */
-    static boolean containsValidNodeEntry(Iterator nodeEntries) {
+    static boolean containsValidNodeEntry(Iterator<NodeEntry> nodeEntries) {
         boolean hasValid = false;
         while (nodeEntries.hasNext() && !hasValid) {
-            NodeEntry cne = (NodeEntry) nodeEntries.next();
+            NodeEntry cne = nodeEntries.next();
             hasValid = isValidNodeEntry(cne);
         }
         return hasValid;

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java Fri Sep 18 16:12:58 2009
@@ -31,9 +31,9 @@
 import javax.jcr.RepositoryException;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.Set;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -119,8 +119,8 @@
         // separately collect the add events
         Set<Event> addEvents = new HashSet<Event>();
 
-        for (Iterator it = events.iterator(); it.hasNext();) {
-            Event event = (Event) it.next();
+        for (Iterator<Event> it = events.iterator(); it.hasNext();) {
+            Event event = it.next();
             int type = event.getType();
             if (type == Event.NODE_REMOVED) {
                 // remember removed nodes separately for proper handling later on.
@@ -148,8 +148,8 @@
         boolean progress = true;
         while (!addEvents.isEmpty() && progress) {
             progress = false;
-            for (Iterator it = addEvents.iterator(); it.hasNext();) {
-                Event ev = (Event) it.next();
+            for (Iterator<Event> it = addEvents.iterator(); it.hasNext();) {
+                Event ev = it.next();
                 NodeId parentId = ev.getParentId();
                 HierarchyEntry parent = null;
                 if (parentId != null) {

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java Fri Sep 18 16:12:58 2009
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.NodeId;
@@ -180,7 +181,7 @@
      * @return iterator of <code>NodeEntry</code> objects
      * @throws RepositoryException If an unexpected error occurs.
      */
-    public Iterator getNodeEntries() throws RepositoryException;
+    public Iterator<NodeEntry> getNodeEntries() throws RepositoryException;
 
     /**
      * Returns a unmodifiable List of <code>NodeEntry</code>s with the
@@ -190,7 +191,7 @@
      * @return list of <code>NodeEntry</code> objects
      * @throws RepositoryException If an unexpected error occurs.
      */
-    public List getNodeEntries(Name nodeName) throws RepositoryException;
+    public List<NodeEntry> getNodeEntries(Name nodeName) throws RepositoryException;
 
     /**
      * Creates or updates the <code>ChildNodeEntries</code> of this node.
@@ -198,7 +199,7 @@
      * @param childInfos
      * @throws RepositoryException
      */
-    public void setNodeEntries(Iterator childInfos) throws RepositoryException;
+    public void setNodeEntries(Iterator<ChildInfo> childInfos) throws RepositoryException;
 
     /**
      * Adds a child NodeEntry to this entry if it not yet present with this
@@ -266,7 +267,7 @@
      * @return an unmodifiable Iterator over those children that represent valid
      * PropertyEntries.
      */
-    public Iterator getPropertyEntries();
+    public Iterator<PropertyEntry> getPropertyEntries();
 
     /**
      * Add an existing <code>PropertyEntry</code> with the given name if it is
@@ -291,7 +292,7 @@
      * @throws ItemExistsException
      * @throws RepositoryException if an unexpected error occurs.
      */
-    public void setPropertyEntries(Collection propNames) throws ItemExistsException, RepositoryException;
+    public void setPropertyEntries(Collection<Name> propNames) throws ItemExistsException, RepositoryException;
 
     /**
      * Add a new, transient <code>PropertyEntry</code> to this <code>NodeEntry</code>

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java Fri Sep 18 16:12:58 2009
@@ -101,7 +101,7 @@
      * Map of properties which are deleted and have been re-created as transient
      * property with the same name.
      */
-    private final Map propertiesInAttic;
+    private final Map<Name, PropertyEntry> propertiesInAttic;
 
     /**
      * Upon transient 'move' ('rename') or 'reorder' of SNSs this
@@ -631,8 +631,8 @@
      */
     public synchronized Iterator getNodeEntries() throws RepositoryException {
         Collection entries = new ArrayList();
-        for (Iterator it = getCompleteChildNodeEntries().iterator(); it.hasNext();) {
-            NodeEntry entry = (NodeEntry) it.next();
+        for (Iterator<NodeEntry> it = getCompleteChildNodeEntries().iterator(); it.hasNext();) {
+            NodeEntry entry = it.next();
             if (EntryValidation.isValidNodeEntry(entry)) {
                 entries.add(entry);
             }
@@ -1326,7 +1326,7 @@
      * @return iterator over all children entries, that currently are loaded
      * with this NodeEntry
      */
-    private Iterator getAllChildEntries(boolean includeAttic) {
+    private Iterator<HierarchyEntry> getAllChildEntries(boolean includeAttic) {
         IteratorChain chain = new IteratorChain();
         // attic
         if (includeAttic) {

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java?rev=816695&r1=816694&r2=816695&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java Fri Sep 18 16:12:58 2009
@@ -44,7 +44,7 @@
     /**
      * Maps a String uniqueID to a {@link NodeEntry}.
      */
-    private final Map lookUp;
+    private final Map<String, NodeEntry> lookUp;
 
     /**
      * Creates a new <code>UniqueIdResolver</code>.
@@ -64,7 +64,7 @@
         if (uniqueId == null) {
             throw new IllegalArgumentException();
         }
-        return (NodeEntry) lookUp.get(uniqueId);
+        return lookUp.get(uniqueId);
     }
 
     public NodeEntry resolve(NodeId nodeId, NodeEntry rootEntry) throws ItemNotFoundException, RepositoryException {
@@ -94,7 +94,7 @@
                     NodeEntry entry = (NodeEntry) state.getHierarchyEntry();
                     String uniqueID = entry.getUniqueID();
                     if (uniqueID != null) {
-                        NodeEntry mapEntry = (NodeEntry) lookUp.get(uniqueID);
+                        NodeEntry mapEntry = lookUp.get(uniqueID);
                         if (mapEntry == entry) {
                             lookUp.remove(uniqueID);
                         } // else: removed entry is not present in lookup but
@@ -167,7 +167,7 @@
             // some other entry existed before with the same uniqueID
             if (!sameEntry((NodeEntry) previous, entry)) {
                 // if the new entry represents the externally moved/renamed
-                // correspondance of the previous the latter needs to marked
+                // correspondence of the previous the latter needs to marked
                 // removed/stale-destroyed.
                 // otherwise (both represent the same entry) the creation
                 // of entry is the result of gc of the node or any of the