You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by th...@apache.org on 2009/05/08 18:20:58 UTC

svn commit: r773041 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ persistence/bundle/util/ state/

Author: thomasm
Date: Fri May  8 16:20:57 2009
New Revision: 773041

URL: http://svn.apache.org/viewvc?rev=773041&view=rev
Log:
JCR-2087 Upgrade to Java 5 as the base platform

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateMap.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateStore.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NameSet.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateIterator.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java Fri May  8 16:20:57 2009
@@ -440,7 +440,7 @@
                 return iter.hasNext();
             }
 
-            public Object next() {
+            public NodeState next() {
                 return nextNodeState();
             }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/BundleBinding.java Fri May  8 16:20:57 2009
@@ -39,7 +39,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import javax.jcr.PropertyType;
@@ -105,7 +104,7 @@
         bundle.setNodeDefId(NodeDefId.valueOf(in.readUTF()));
 
         // mixin types
-        Set mixinTypeNames = new HashSet();
+        Set<Name> mixinTypeNames = new HashSet<Name>();
         Name name = readIndexedQName(in);
         while (name != null) {
             mixinTypeNames.add(name);
@@ -146,7 +145,7 @@
         }
 
         // read shared set, since version 2.0
-        Set sharedSet = new HashSet();
+        Set<NodeId> sharedSet = new HashSet<NodeId>();
         if (version >= VERSION_2) {
             // shared set (list of parent uuids)
             NodeId parentId = readID(in);
@@ -278,16 +277,13 @@
         out.writeUTF(bundle.getNodeDefId().toString());
 
         // mixin types
-        Iterator iter = bundle.getMixinTypeNames().iterator();
-        while (iter.hasNext()) {
-            writeIndexedQName(out, (Name) iter.next());
+        for (Name name : bundle.getMixinTypeNames()) {
+            writeIndexedQName(out, name);
         }
         writeIndexedQName(out, null);
 
         // properties
-        iter = bundle.getPropertyNames().iterator();
-        while (iter.hasNext()) {
-            Name pName = (Name) iter.next();
+        for (Name pName : bundle.getPropertyNames()) {
             // skip redundant primaryType, mixinTypes and uuid properties
             if (pName.equals(NameConstants.JCR_PRIMARYTYPE)
                 || pName.equals(NameConstants.JCR_MIXINTYPES)
@@ -308,9 +304,7 @@
         out.writeBoolean(bundle.isReferenceable());
 
         // child nodes (list of uuid/name pairs)
-        iter = bundle.getChildNodeEntries().iterator();
-        while (iter.hasNext()) {
-            NodePropBundle.ChildNodeEntry entry = (NodePropBundle.ChildNodeEntry) iter.next();
+        for (NodePropBundle.ChildNodeEntry entry : bundle.getChildNodeEntries()) {
             writeID(out, entry.getId());  // uuid
             writeQName(out, entry.getName());   // name
         }
@@ -320,9 +314,8 @@
         writeModCount(out, bundle.getModCount());
 
         // write shared set
-        iter = bundle.getSharedSet().iterator();
-        while (iter.hasNext()) {
-            writeID(out, (NodeId) iter.next());
+        for (NodeId nodeId: bundle.getSharedSet()) {
+            writeID(out, nodeId);
         }
         writeID(out, null);
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/NodePropBundle.java Fri May  8 16:20:57 2009
@@ -73,7 +73,7 @@
     /**
      * the mixintype names
      */
-    private Set mixinTypeNames;
+    private Set<Name> mixinTypeNames;
 
     /**
      * the nodedef id
@@ -88,7 +88,7 @@
     /**
      * the properties
      */
-    private HashMap properties = new HashMap();
+    private HashMap<Name, PropertyEntry> properties = new HashMap<Name, PropertyEntry>();
 
     /**
      * flag that indicates if this bundle is new
@@ -114,7 +114,7 @@
      * Shared set, consisting of the parent ids of this shareable node. This
      * entry is <code>null</code> if this node is not shareable.
      */
-    private Set sharedSet;
+    private Set<NodeId> sharedSet;
 
     /**
      * Creates a "new" bundle with the given id
@@ -151,11 +151,9 @@
         nodeDefId = state.getDefinitionId();
         isReferenceable = state.hasPropertyName(NameConstants.JCR_UUID);
         modCount = state.getModCount();
-        List list = state.getChildNodeEntries();
-        Iterator iter = list.iterator();
+        List<org.apache.jackrabbit.core.state.ChildNodeEntry> list = state.getChildNodeEntries();
         childNodeEntries.clear();
-        while (iter.hasNext()) {
-            org.apache.jackrabbit.core.state.ChildNodeEntry cne = (org.apache.jackrabbit.core.state.ChildNodeEntry) iter.next();
+        for (org.apache.jackrabbit.core.state.ChildNodeEntry cne : list) {
             addChildNodeEntry(cne.getName(), cne.getId());
         }
         sharedSet = state.getSharedSet();
@@ -173,9 +171,7 @@
         state.setMixinTypeNames(mixinTypeNames);
         state.setDefinitionId(nodeDefId);
         state.setModCount(modCount);
-        Iterator iter = childNodeEntries.iterator();
-        while (iter.hasNext()) {
-            ChildNodeEntry e = (ChildNodeEntry) iter.next();
+        for (ChildNodeEntry e : childNodeEntries) {
             state.addChildNodeEntry(e.getName(), e.getId());
         }
         state.setPropertyNames(properties.keySet());
@@ -189,9 +185,8 @@
         if (isReferenceable) {
             state.addPropertyName(NameConstants.JCR_UUID);
         }
-        iter = sharedSet.iterator();
-        while (iter.hasNext()) {
-            state.addShare((NodeId) iter.next());
+        for (NodeId nodeId : sharedSet) {
+            state.addShare(nodeId);
         }
         return state;
     }
@@ -276,7 +271,7 @@
      * Returns the mixin type names of this bundle.
      * @return the mixin type names of this bundle.
      */
-    public Set getMixinTypeNames() {
+    public Set<Name> getMixinTypeNames() {
         return mixinTypeNames;
     }
 
@@ -284,7 +279,7 @@
      * Sets the mixin type names
      * @param mixinTypeNames the mixin type names
      */
-    public void setMixinTypeNames(Set mixinTypeNames) {
+    public void setMixinTypeNames(Set<Name> mixinTypeNames) {
         this.mixinTypeNames = mixinTypeNames;
     }
 
@@ -367,7 +362,7 @@
      * @param state the property state
      */
     public void addProperty(PropertyState state) {
-        PropertyEntry old = (PropertyEntry) properties.put(state.getName(), new PropertyEntry(state));
+        PropertyEntry old = properties.put(state.getName(), new PropertyEntry(state));
         if (old != null) {
             old.destroy(binding.getBlobStore());
         }
@@ -390,7 +385,7 @@
      * Returns a set of the property names.
      * @return a set of the property names.
      */
-    public Set getPropertyNames() {
+    public Set<Name> getPropertyNames() {
         return properties.keySet();
     }
 
@@ -398,7 +393,7 @@
      * Returns a collection of property entries.
      * @return a collection of property entries.
      */
-    public Collection getPropertyEntries() {
+    public Collection<PropertyEntry> getPropertyEntries() {
         return properties.values();
     }
 
@@ -408,14 +403,14 @@
      * @return the desired property entry or <code>null</code>
      */
     public PropertyEntry getPropertyEntry(Name name) {
-        return (PropertyEntry) properties.get(name);
+        return properties.get(name);
     }
 
     /**
      * Removes all property entries
      */
     public void removeAllProperties() {
-        Iterator iter = properties.keySet().iterator();
+        Iterator<Name> iter = properties.keySet().iterator();
         while (iter.hasNext()) {
             Name name = (Name) iter.next();
             removeProperty(name);
@@ -438,7 +433,7 @@
      * Sets the shared set of this bundle.
      * @return the shared set of this bundle.
      */
-    public Set getSharedSet() {
+    public Set<NodeId> getSharedSet() {
         return sharedSet;
     }
 
@@ -446,7 +441,7 @@
      * Sets the shared set.
      * @param sharedSet shared set
      */
-    public void setSharedSet(Set sharedSet) {
+    public void setSharedSet(Set<NodeId> sharedSet) {
         this.sharedSet = sharedSet;
     }
 
@@ -561,12 +556,12 @@
         /**
          * the blob ids
          */
-        private String[] blobIds = null;
+        private String[] blobIds;
 
         /**
          * the mod count
          */
-        private short modCount = 0;
+        private short modCount;
 
         /**
          * Creates a new property entry with the given id.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntries.java Fri May  8 16:20:57 2009
@@ -40,7 +40,7 @@
  * <code>ChildNodeEntries</code> also provides an unmodifiable
  * <code>List</code> view.
  */
-class ChildNodeEntries implements List, Cloneable {
+class ChildNodeEntries implements List<ChildNodeEntry>, Cloneable {
 
     /**
      * Insertion-ordered map of entries
@@ -68,17 +68,17 @@
         return (ChildNodeEntry) entries.get(id);
     }
 
-    List get(Name nodeName) {
+    List<ChildNodeEntry> get(Name nodeName) {
         Object obj = nameMap.get(nodeName);
         if (obj == null) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
         if (obj instanceof ArrayList) {
             // map entry is a list of siblings
-            return Collections.unmodifiableList((ArrayList) obj);
+            return Collections.unmodifiableList((ArrayList<ChildNodeEntry>) obj);
         } else {
             // map entry is a single child node entry
-            return Collections.singletonList(obj);
+            return Collections.singletonList((ChildNodeEntry) obj);
         }
     }
 
@@ -254,9 +254,9 @@
      * @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) {
+    List<ChildNodeEntry> removeAll(ChildNodeEntries other) {
         if (entries.isEmpty()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
         if (other.isEmpty()) {
             return this;
@@ -292,10 +292,10 @@
      * @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) {
+    List<ChildNodeEntry> retainAll(ChildNodeEntries other) {
         if (entries.isEmpty()
                 || other.isEmpty()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
 
         List result = new ArrayList();
@@ -333,8 +333,8 @@
         return true;
     }
 
-    public Object get(int index) {
-        return entries.getValue(index);
+    public ChildNodeEntry get(int index) {
+        return (ChildNodeEntry) entries.getValue(index);
     }
 
     public int indexOf(Object o) {
@@ -354,7 +354,7 @@
         return indexOf(o);
     }
 
-    public Iterator iterator() {
+    public Iterator<ChildNodeEntry> iterator() {
         return new EntriesIterator();
     }
 
@@ -407,11 +407,11 @@
         return a;
     }
 
-    public void add(int index, Object element) {
+    public void add(int index, ChildNodeEntry element) {
         throw new UnsupportedOperationException();
     }
 
-    public boolean add(Object o) {
+    public boolean add(ChildNodeEntry o) {
         throw new UnsupportedOperationException();
     }
 
@@ -427,7 +427,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public Object remove(int index) {
+    public ChildNodeEntry remove(int index) {
         throw new UnsupportedOperationException();
     }
 
@@ -443,7 +443,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public Object set(int index, Object element) {
+    public ChildNodeEntry set(int index, ChildNodeEntry element) {
         throw new UnsupportedOperationException();
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ChildNodeEntry.java Fri May  8 16:20:57 2009
@@ -27,7 +27,7 @@
  */
 public final class ChildNodeEntry {
 
-    private int hash = 0;
+    private int hash;
 
     private final Name name;
     private final int index; // 1-based index for same-name siblings

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateMap.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateMap.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateMap.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateMap.java Fri May  8 16:20:57 2009
@@ -25,7 +25,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -40,13 +39,13 @@
     /**
      * the map backing this <code>ItemStateStore</code> implementation
      */
-    protected final Map map;
+    protected final Map<ItemId, ItemState> map;
 
     /**
      * Creates a new HashMap-backed <code>ItemStateStore</code> implementation.
      */
     public ItemStateMap() {
-        this(new HashMap());
+        this(new HashMap<ItemId, ItemState>());
     }
 
     /**
@@ -54,28 +53,19 @@
      *
      * @param map <code>Map</code> implementation to be used as backing store.
      */
-    protected ItemStateMap(Map map) {
+    protected ItemStateMap(Map<ItemId, ItemState> map) {
         this.map = map;
     }
 
     //-------------------------------------------------------< ItemStateStore >
-    /**
-     * {@inheritDoc}
-     */
     public boolean contains(ItemId id) {
         return map.containsKey(id);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public ItemState get(ItemId id) {
-        return (ItemState) map.get(id);
+        return map.get(id);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public void put(ItemState state) {
         ItemId id = state.getId();
         if (map.containsKey(id)) {
@@ -84,58 +74,35 @@
         map.put(id, state);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public void remove(ItemId id) {
         map.remove(id);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public void clear() {
         map.clear();
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public boolean isEmpty() {
         return map.isEmpty();
     }
 
-    /**
-     * {@inheritDoc}
-     */
     public int size() {
         return map.size();
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public Set keySet() {
+    public Set<ItemId> keySet() {
         return Collections.unmodifiableSet(map.keySet());
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public Collection values() {
+    public Collection<ItemState> values() {
         return Collections.unmodifiableCollection(map.values());
     }
 
     //-------------------------------------------------------------< Dumpable >
-    /**
-     * {@inheritDoc}
-     */
     public void dump(PrintStream ps) {
         ps.println("map entries:");
         ps.println();
-        Iterator iter = keySet().iterator();
-        while (iter.hasNext()) {
-            ItemId id = (ItemId) iter.next();
+        for (ItemId id : keySet()) {
             ItemState state = get(id);
             dumpItemState(id, state, ps);
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateStore.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateStore.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateStore.java Fri May  8 16:20:57 2009
@@ -93,7 +93,7 @@
      *
      * @return a set view of the keys contained in this store.
      */
-    Set keySet();
+    Set<ItemId> keySet();
 
     /**
      * Returns an unmodifiable collection view of the values (i.e.
@@ -101,5 +101,5 @@
      *
      * @return a collection view of the values contained in this store.
      */
-    Collection values();
+    Collection<ItemState> values();
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NameSet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NameSet.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NameSet.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NameSet.java Fri May  8 16:20:57 2009
@@ -29,7 +29,7 @@
  * means this implementation will throw a {@link UnsupportedOperationException}
  * for all modifying methods specified by the {@link Set} interface.
  */
-final class NameSet implements Set, Cloneable {
+final class NameSet implements Set<Name>, Cloneable {
 
     /**
      * The name set cache instance.
@@ -60,7 +60,7 @@
      * @return <code>true</code> if the name is already present,
      *         <code>false</code> otherwise.
      */
-    boolean add(Name name) {
+    public boolean add(Name name) {
         if (names.size() > NUM_NAMES_THRESHOLD) {
             ensureModifiable();
             return names.add(name);
@@ -180,13 +180,6 @@
     /**
      * @throws UnsupportedOperationException always.
      */
-    public boolean add(Object o) {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * @throws UnsupportedOperationException always.
-     */
     public boolean remove(Object o) {
         throw new UnsupportedOperationException();
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java Fri May  8 16:20:57 2009
@@ -48,7 +48,7 @@
      * REFERENCE property can contain multiple references (if it's multi-valued)
      * to potentially the same target node.
      */
-    protected ArrayList references = new ArrayList();
+    protected ArrayList<PropertyId> references = new ArrayList<PropertyId>();
 
     /**
      * Package private constructor
@@ -90,7 +90,7 @@
     /**
      * @return the list of references
      */
-    public List getReferences() {
+    public List<PropertyId> getReferences() {
         return Collections.unmodifiableList(references);
     }
 
@@ -104,7 +104,7 @@
     /**
      * @param references
      */
-    public void addAllReferences(List references) {
+    public void addAllReferences(List<PropertyId> references) {
         this.references.addAll(references);
     }
 

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=773041&r1=773040&r2=773041&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 Fri May  8 16:20:57 2009
@@ -74,7 +74,7 @@
      * Shared set, consisting of the parent ids of this shareable node. This
      * entry is {@link Collections#EMPTY_SET} if this node is not shareable.
      */
-    private Set sharedSet = Collections.EMPTY_SET;
+    private Set<NodeId> sharedSet = Collections.emptySet();
 
     /**
      * Flag indicating whether we are using a read-write shared set.
@@ -197,7 +197,7 @@
      *
      * @return a set of the names of this node's mixin types.
      */
-    public synchronized Set getMixinTypeNames() {
+    public synchronized Set<Name> getMixinTypeNames() {
         return mixinTypeNames;
     }
 
@@ -206,7 +206,7 @@
      *
      * @param names set of names of mixin types
      */
-    public synchronized void setMixinTypeNames(Set names) {
+    public synchronized void setMixinTypeNames(Set<Name> names) {
         mixinTypeNames.replaceAll(names);
     }
 
@@ -322,7 +322,7 @@
      * @see #addChildNodeEntry
      * @see #removeChildNodeEntry
      */
-    public synchronized List getChildNodeEntries() {
+    public synchronized List<ChildNodeEntry> getChildNodeEntries() {
         return childNodeEntries;
     }
 
@@ -334,7 +334,7 @@
      * @see #addChildNodeEntry
      * @see #removeChildNodeEntry
      */
-    public synchronized List getChildNodeEntries(Name nodeName) {
+    public synchronized List<ChildNodeEntry> getChildNodeEntries(Name nodeName) {
         return childNodeEntries.get(nodeName);
     }
 
@@ -419,7 +419,7 @@
      * @param nodeEntries list of {@link ChildNodeEntry} or
      * a {@link ChildNodeEntries} list.
      */
-    public synchronized void setChildNodeEntries(List nodeEntries) {
+    public synchronized void setChildNodeEntries(List<ChildNodeEntry> nodeEntries) {
         if (nodeEntries instanceof ChildNodeEntries) {
             // optimization
             ChildNodeEntries entries = (ChildNodeEntries) nodeEntries;
@@ -440,7 +440,7 @@
      * @see #addPropertyName
      * @see #removePropertyName
      */
-    public synchronized Set getPropertyNames() {
+    public synchronized Set<Name> getPropertyNames() {
         return propertyNames;
     }
 
@@ -476,7 +476,7 @@
      * properties of this node.
      * @param propNames set of {@link Name}s.
      */
-    public synchronized void setPropertyNames(Set propNames) {
+    public synchronized void setPropertyNames(Set<Name> propNames) {
         propertyNames.replaceAll(propNames);
     }
 
@@ -512,7 +512,7 @@
             return false;
         }
         if (!sharedSetRW) {
-            sharedSet = new LinkedHashSet(sharedSet);
+            sharedSet = new LinkedHashSet<NodeId>(sharedSet);
             sharedSetRW = true;
         }
         return sharedSet.add(parentId);
@@ -534,11 +534,11 @@
      *
      * @return unmodifiable collection
      */
-    public Set getSharedSet() {
+    public Set<NodeId> getSharedSet() {
         if (sharedSet != Collections.EMPTY_SET) {
             return Collections.unmodifiableSet(sharedSet);
         }
-        return Collections.EMPTY_SET;
+        return Collections.emptySet();
     }
 
     /**
@@ -547,12 +547,12 @@
      *
      * @param set shared set
      */
-    public synchronized void setSharedSet(Set set) {
+    public synchronized void setSharedSet(Set<NodeId> set) {
         if (set != Collections.EMPTY_SET) {
-            sharedSet = new LinkedHashSet(set);
+            sharedSet = new LinkedHashSet<NodeId>(set);
             sharedSetRW = true;
         } else {
-            sharedSet = Collections.EMPTY_SET;
+            sharedSet = Collections.emptySet();
             sharedSetRW = false;
         }
     }
@@ -570,13 +570,13 @@
         // check first before making changes
         if (sharedSet.contains(parentId)) {
             if (!sharedSetRW) {
-                sharedSet = new LinkedHashSet(sharedSet);
+                sharedSet = new LinkedHashSet<NodeId>(sharedSet);
                 sharedSetRW = true;
             }
             sharedSet.remove(parentId);
             if (parentId.equals(this.parentId)) {
                 if (!sharedSet.isEmpty()) {
-                    this.parentId = (NodeId) sharedSet.iterator().next();
+                    this.parentId = sharedSet.iterator().next();
                 } else {
                     this.parentId = null;
                 }
@@ -594,13 +594,13 @@
      * @return set of <code>Name</code>s denoting the properties that have
      *         been added.
      */
-    public synchronized Set getAddedPropertyNames() {
+    public synchronized Set<Name> getAddedPropertyNames() {
         if (!hasOverlayedState()) {
             return propertyNames;
         }
 
         NodeState other = (NodeState) getOverlayedState();
-        HashSet set = new HashSet(propertyNames);
+        HashSet<Name> set = new HashSet<Name>(propertyNames);
         set.removeAll(other.propertyNames);
         return set;
     }
@@ -611,7 +611,7 @@
      *
      * @return list of added child node entries
      */
-    public synchronized List getAddedChildNodeEntries() {
+    public synchronized List<ChildNodeEntry> getAddedChildNodeEntries() {
         if (!hasOverlayedState()) {
             return childNodeEntries;
         }
@@ -628,13 +628,13 @@
      * @return set of <code>Name</code>s denoting the properties that have
      *         been removed.
      */
-    public synchronized Set getRemovedPropertyNames() {
+    public synchronized Set<Name> getRemovedPropertyNames() {
         if (!hasOverlayedState()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
 
         NodeState other = (NodeState) getOverlayedState();
-        HashSet set = new HashSet(other.propertyNames);
+        HashSet<Name> set = new HashSet<Name>(other.propertyNames);
         set.removeAll(propertyNames);
         return set;
     }
@@ -645,9 +645,9 @@
      *
      * @return list of removed child node entries
      */
-    public synchronized List getRemovedChildNodeEntries() {
+    public synchronized List<ChildNodeEntry> getRemovedChildNodeEntries() {
         if (!hasOverlayedState()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
 
         NodeState other = (NodeState) getOverlayedState();
@@ -660,32 +660,32 @@
      *
      * @return list of renamed child node entries
      */
-    public synchronized List getRenamedChildNodeEntries() {
+    public synchronized List<ChildNodeEntry> getRenamedChildNodeEntries() {
         if (!hasOverlayedState()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
 
         ChildNodeEntries otherChildNodeEntries =
                 ((NodeState) overlayedState).childNodeEntries;
 
         // do a lazy init
-        List renamed = null;
+        List<ChildNodeEntry> renamed = null;
 
-        for (Iterator iter = childNodeEntries.iterator(); iter.hasNext();) {
-            ChildNodeEntry cne = (ChildNodeEntry) iter.next();
+        for (Iterator<ChildNodeEntry> iter = childNodeEntries.iterator(); iter.hasNext();) {
+            ChildNodeEntry cne = 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 = new ArrayList<ChildNodeEntry>();
                 }
                 renamed.add(cne);
             }
         }
 
         if (renamed == null) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         } else {
             return renamed;
         }
@@ -719,9 +719,9 @@
      *
      * @return list of reordered child node enties.
      */
-    public synchronized List getReorderedChildNodeEntries() {
+    public synchronized List<ChildNodeEntry> getReorderedChildNodeEntries() {
         if (!hasOverlayedState()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
 
         ChildNodeEntries otherChildNodeEntries =
@@ -729,16 +729,16 @@
 
         if (childNodeEntries.isEmpty()
                 || otherChildNodeEntries.isEmpty()) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
 
         // build intersections of both collections,
         // each preserving their relative order
-        List ours = childNodeEntries.retainAll(otherChildNodeEntries);
-        List others = otherChildNodeEntries.retainAll(childNodeEntries);
+        List<ChildNodeEntry> ours = childNodeEntries.retainAll(otherChildNodeEntries);
+        List<ChildNodeEntry> others = otherChildNodeEntries.retainAll(childNodeEntries);
 
         // do a lazy init
-        List reordered = null;
+        List<ChildNodeEntry> reordered = null;
         // both entry lists now contain the set of nodes that have not
         // been removed or added, but they may have changed their position.
         for (int i = 0; i < ours.size();) {
@@ -750,7 +750,7 @@
             } else {
                 // reordered entry detected
                 if (reordered == null) {
-                    reordered = new ArrayList();
+                    reordered = new ArrayList<ChildNodeEntry>();
                 }
                 // Note that this check will not necessarily find the
                 // minimal reorder operations required to convert the overlayed
@@ -791,7 +791,7 @@
             }
         }
         if (reordered == null) {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         } else {
             return reordered;
         }
@@ -802,12 +802,12 @@
      *
      * @return the set of shares that were added. Set of {@link NodeId}s.
      */
-    public synchronized Set getAddedShares() {
+    public synchronized Set<NodeId> getAddedShares() {
         if (!hasOverlayedState() || !isShareable()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
         NodeState other = (NodeState) getOverlayedState();
-        HashSet set = new HashSet(sharedSet);
+        HashSet<NodeId> set = new HashSet<NodeId>(sharedSet);
         set.removeAll(other.sharedSet);
         return set;
     }
@@ -817,12 +817,12 @@
      *
      * @return the set of shares that were removed. Set of {@link NodeId}s.
      */
-    public synchronized Set getRemovedShares() {
+    public synchronized Set<NodeId> getRemovedShares() {
         if (!hasOverlayedState() || !isShareable()) {
-            return Collections.EMPTY_SET;
+            return Collections.emptySet();
         }
         NodeState other = (NodeState) getOverlayedState();
-        HashSet set = new HashSet(other.sharedSet);
+        HashSet<NodeId> set = new HashSet<NodeId>(other.sharedSet);
         set.removeAll(sharedSet);
         return set;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateIterator.java?rev=773041&r1=773040&r2=773041&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateIterator.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateIterator.java Fri May  8 16:20:57 2009
@@ -23,7 +23,7 @@
  * <code>NodeStateIterator</code> extends the Iterator interface by the
  * respective NodeState methods.
  */
-public interface NodeStateIterator extends Iterator {
+public interface NodeStateIterator extends Iterator<NodeState> {
 
     /**
      * Returns the next node state of the iterator.