jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r827966 [13/15] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security...
Date Wed, 21 Oct 2009 11:38:44 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java Wed Oct 21 11:38:31 2009
@@ -16,40 +16,41 @@
  */
 package org.apache.jackrabbit.jcr2spi.nodetype;
 
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.InvalidNodeTypeDefinitionException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeTypeExistsException;
+import javax.jcr.version.OnParentVersionAction;
+
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.jackrabbit.jcr2spi.util.Dumpable;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.QValueConstraint;
 import org.apache.jackrabbit.spi.commons.nodetype.NodeTypeStorage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.InvalidNodeTypeDefinitionException;
-import javax.jcr.nodetype.NodeTypeExistsException;
-import javax.jcr.version.OnParentVersionAction;
-import java.io.PrintStream;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.TreeSet;
-import java.util.HashMap;
-
 /**
  * A <code>NodeTypeRegistry</code> ...
  */
@@ -65,9 +66,9 @@
     private final NodeTypeDefinitionMap registeredNTDefs;
 
     // set of property definitions
-    private final Set propDefs;
+    private final Set<QPropertyDefinition> propDefs;
     // set of node definitions
-    private final Set nodeDefs;
+    private final Set<QNodeDefinition> nodeDefs;
 
     /**
      * Object used to persist new nodetypes and modified nodetype definitions.
@@ -82,7 +83,8 @@
     /**
      * Listeners (soft references)
      */
-    private final Map listeners = Collections.synchronizedMap(new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.WEAK));
+    @SuppressWarnings("unchecked")
+    private final Map<NodeTypeRegistryListener, NodeTypeRegistryListener> listeners = Collections.synchronizedMap(new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.WEAK));
 
     /**
      * Create a new <code>NodeTypeRegistry</codes>
@@ -121,8 +123,8 @@
         //registeredNTDefs = new ConcurrentReaderHashMap();
         registeredNTDefs = new NodeTypeDefinitionMap();
 
-        propDefs = new HashSet();
-        nodeDefs = new HashSet();
+        propDefs = new HashSet<QPropertyDefinition>();
+        nodeDefs = new HashSet<QNodeDefinition>();
     }
 
     //---------------------------------------------------< NodeTypeRegistry >---
@@ -146,8 +148,8 @@
      * @see NodeTypeRegistry#getRegisteredNodeTypes()
      */
     public Name[] getRegisteredNodeTypes() throws RepositoryException {
-        Set qNames = registeredNTDefs.keySet();
-        return (Name[]) qNames.toArray(new Name[registeredNTDefs.size()]);
+        Set<Name> qNames = registeredNTDefs.keySet();
+        return qNames.toArray(new Name[registeredNTDefs.size()]);
     }
 
 
@@ -174,7 +176,7 @@
         }
 
         // validate new nodetype definitions
-        Map defMap = validator.validateNodeTypeDefs(ntDefs, registeredNTDefs);
+        Map<QNodeTypeDefinition, EffectiveNodeType> defMap = validator.validateNodeTypeDefs(ntDefs, registeredNTDefs);
         storage.registerNodeTypes(ntDefs.toArray(new QNodeTypeDefinition[ntDefs.size()]), allowUpdate);
 
         // update internal cache:
@@ -201,13 +203,13 @@
         for (Name ntName : nodeTypeNames) {
             // Best effort check for node types other than those to be
             // unregistered that depend on the given node types
-            Set dependents = registeredNTDefs.getDependentNodeTypes(ntName);
+            Set<Name> dependents = registeredNTDefs.getDependentNodeTypes(ntName);
             dependents.removeAll(nodeTypeNames);
             if (dependents.size() > 0) {
                 StringBuffer msg = new StringBuffer();
                 msg.append(ntName).append(" can not be removed because the following node types depend on it: ");
-                for (Iterator depIter = dependents.iterator(); depIter.hasNext();) {
-                    msg.append(depIter.next());
+                for (Name name : dependents) {
+                    msg.append(name);
                     msg.append(" ");
                 }
                 throw new RepositoryException(msg.toString());
@@ -223,8 +225,7 @@
         internalUnregister(nodeTypeNames);
 
         // notify listeners
-        for (Iterator iter = nodeTypeNames.iterator(); iter.hasNext();) {
-            Name ntName = (Name) iter.next();
+        for (Name ntName : nodeTypeNames) {
             notifyUnregistered(ntName);
         }
     }
@@ -234,7 +235,7 @@
      */
     public QNodeTypeDefinition getNodeTypeDefinition(Name nodeTypeName)
         throws NoSuchNodeTypeException {
-        QNodeTypeDefinition def = (QNodeTypeDefinition) registeredNTDefs.get(nodeTypeName);
+        QNodeTypeDefinition def = registeredNTDefs.get(nodeTypeName);
         if (def == null) {
             throw new NoSuchNodeTypeException("Nodetype " + nodeTypeName + " doesn't exist");
         }
@@ -258,24 +259,24 @@
     }
 
     /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(Name[], Map)
+     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(Name[], Map<Name, QNodeTypeDefinition>)
      */
-    public EffectiveNodeType getEffectiveNodeType(Name[] ntNames, Map ntdMap)
+    public EffectiveNodeType getEffectiveNodeType(Name[] ntNames, Map<Name, QNodeTypeDefinition> ntdMap)
         throws ConstraintViolationException, NoSuchNodeTypeException {
         return getEffectiveNodeType(ntNames, entCache, ntdMap);
     }
 
     /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(QNodeTypeDefinition, Map)
+     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(QNodeTypeDefinition, Map<Name, QNodeTypeDefinition>)
      */
-    public EffectiveNodeType getEffectiveNodeType(QNodeTypeDefinition ntd, Map ntdMap)
+    public EffectiveNodeType getEffectiveNodeType(QNodeTypeDefinition ntd, Map<Name, QNodeTypeDefinition> ntdMap)
             throws ConstraintViolationException, NoSuchNodeTypeException {
-        TreeSet mergedNodeTypes = new TreeSet();
-        TreeSet inheritedNodeTypes = new TreeSet();
-        TreeSet allNodeTypes = new TreeSet();
-        Map namedItemDefs = new HashMap();
-        List unnamedItemDefs = new ArrayList();
-        Set supportedMixins = null;
+        TreeSet<Name> mergedNodeTypes = new TreeSet<Name>();
+        TreeSet<Name> inheritedNodeTypes = new TreeSet<Name>();
+        TreeSet<Name> allNodeTypes = new TreeSet<Name>();
+        Map<Name, List<QItemDefinition>> namedItemDefs = new HashMap<Name, List<QItemDefinition>>();
+        List<QItemDefinition> unnamedItemDefs = new ArrayList<QItemDefinition>();
+        Set<Name> supportedMixins = null;
 
         Name ntName = ntd.getName();
         // prepare new instance
@@ -285,7 +286,7 @@
         Name[] smixins = ntd.getSupportedMixinTypes();
 
         if (smixins != null) {
-            supportedMixins = new HashSet();
+            supportedMixins = new HashSet<Name>();
             for (int i = 0; i < smixins.length; i++) {
                 supportedMixins.add(smixins[i]);
             }
@@ -294,7 +295,7 @@
         // map of all item definitions (maps id to definition)
         // used to effectively detect ambiguous child definitions where
         // ambiguity is defined in terms of definition identity
-        Set itemDefIds = new HashSet();
+        Set<QItemDefinition> itemDefIds = new HashSet<QItemDefinition>();
 
         QNodeDefinition[] cnda = ntd.getChildNodeDefs();
         for (int i = 0; i < cnda.length; i++) {
@@ -320,9 +321,9 @@
             } else {
                 // named node definition
                 Name name = cnda[i].getName();
-                List defs = (List) namedItemDefs.get(name);
+                List<QItemDefinition> defs = namedItemDefs.get(name);
                 if (defs == null) {
-                    defs = new ArrayList();
+                    defs = new ArrayList<QItemDefinition>();
                     namedItemDefs.put(name, defs);
                 }
                 if (defs.size() > 0) {
@@ -331,7 +332,7 @@
                      * name; make sure none of them is auto-create
                      */
                     for (int j = 0; j < defs.size(); j++) {
-                        QItemDefinition qDef = (QItemDefinition) defs.get(j);
+                        QItemDefinition qDef = defs.get(j);
                         if (cnda[i].isAutoCreated() || qDef.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions for '"
@@ -368,9 +369,9 @@
             } else {
                 // named property definition
                 Name name = pda[i].getName();
-                List defs = (List) namedItemDefs.get(name);
+                List<QItemDefinition> defs = namedItemDefs.get(name);
                 if (defs == null) {
-                    defs = new ArrayList();
+                    defs = new ArrayList<QItemDefinition>();
                     namedItemDefs.put(name, defs);
                 }
                 if (defs.size() > 0) {
@@ -379,7 +380,7 @@
                      * name; make sure none of them is auto-create
                      */
                     for (int j = 0; j < defs.size(); j++) {
-                        QItemDefinition qDef = (QItemDefinition) defs.get(j);
+                        QItemDefinition qDef = defs.get(j);
                         if (pda[i].isAutoCreated() || qDef.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions for '"
@@ -417,7 +418,7 @@
      */
     private EffectiveNodeType getEffectiveNodeType(Name ntName,
                                                    EffectiveNodeTypeCache entCache,
-                                                   Map ntdCache)
+                                                   Map<Name, QNodeTypeDefinition> ntdCache)
         throws NoSuchNodeTypeException {
         // 1. check if effective node type has already been built
         EffectiveNodeTypeCache.Key key = entCache.getKey(new Name[]{ntName});
@@ -427,7 +428,7 @@
         }
 
         // 2. make sure we've got the definition of the specified node type
-        QNodeTypeDefinition ntd = (QNodeTypeDefinition) ntdCache.get(ntName);
+        QNodeTypeDefinition ntd = ntdCache.get(ntName);
         if (ntd == null) {
             throw new NoSuchNodeTypeException(ntName.toString());
         }
@@ -458,7 +459,7 @@
      */
     private EffectiveNodeType getEffectiveNodeType(Name[] ntNames,
                                                    EffectiveNodeTypeCache entCache,
-                                                   Map ntdCache)
+                                                   Map<Name, QNodeTypeDefinition> ntdCache)
         throws ConstraintViolationException, NoSuchNodeTypeException {
 
         EffectiveNodeTypeCache.Key key = entCache.getKey(ntNames);
@@ -500,7 +501,7 @@
                      */
                     Name[] remainder = key.getNames();
                     for (int i = 0; i < remainder.length; i++) {
-                        QNodeTypeDefinition ntd = (QNodeTypeDefinition) ntdCache.get(remainder[i]);
+                        QNodeTypeDefinition ntd = ntdCache.get(remainder[i]);
                         EffectiveNodeType ent = getEffectiveNodeType(ntd, ntdCache);
                         // store new effective node type
                         entCache.put(ent);
@@ -533,10 +534,9 @@
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la =
                 new NodeTypeRegistryListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
         int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (NodeTypeRegistryListener) iter.next();
+        for (NodeTypeRegistryListener ntrl : listeners.values()) {
+            la[cnt++] = ntrl;
         }
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
@@ -551,10 +551,9 @@
     private void notifyReRegistered(Name ntName) {
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la = new NodeTypeRegistryListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
         int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (NodeTypeRegistryListener) iter.next();
+        for (NodeTypeRegistryListener ntrl : listeners.values()) {
+            la[cnt++] = ntrl;
         }
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
@@ -569,10 +568,9 @@
     private void notifyUnregistered(Name ntName) {
         // copy listeners to array to avoid ConcurrentModificationException
         NodeTypeRegistryListener[] la = new NodeTypeRegistryListener[listeners.size()];
-        Iterator iter = listeners.values().iterator();
         int cnt = 0;
-        while (iter.hasNext()) {
-            la[cnt++] = (NodeTypeRegistryListener) iter.next();
+        for (NodeTypeRegistryListener ntrl : listeners.values()) {
+            la[cnt++] = ntrl;
         }
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
@@ -581,11 +579,10 @@
         }
     }
 
-    private void internalRegister(Map defMap) {
-        for (Iterator it = defMap.entrySet().iterator(); it.hasNext(); ) {
-            Map.Entry entry = (Map.Entry)it.next();
-            QNodeTypeDefinition ntd = (QNodeTypeDefinition)entry.getKey();
-            internalRegister(ntd, (EffectiveNodeTypeImpl)entry.getValue());
+    private void internalRegister(Map<QNodeTypeDefinition, EffectiveNodeType> defMap) {
+        for (Map.Entry<QNodeTypeDefinition, EffectiveNodeType> entry : defMap.entrySet()) {
+            QNodeTypeDefinition ntd = entry.getKey();
+            internalRegister(ntd, entry.getValue());
         }
     }
 
@@ -616,7 +613,7 @@
     }
 
     private void internalUnregister(Name name) {
-        QNodeTypeDefinition ntd = (QNodeTypeDefinition) registeredNTDefs.remove(name);
+        QNodeTypeDefinition ntd = registeredNTDefs.remove(name);
         entCache.invalidate(name);
 
         if (ntd != null) {
@@ -662,10 +659,19 @@
      * Inner class representing the map of <code>QNodeTypeDefinition</code>s
      * that have been loaded yet.
      */
-    private class NodeTypeDefinitionMap implements Map, Dumpable {
+    private class NodeTypeDefinitionMap implements Map<Name, QNodeTypeDefinition>, Dumpable {
 
         // map of node type names and node type definitions
-        private final ConcurrentReaderHashMap nodetypeDefinitions = new ConcurrentReaderHashMap();
+        private final ConcurrentHashMap<Name, QNodeTypeDefinition> nodetypeDefinitions =
+            new ConcurrentHashMap<Name, QNodeTypeDefinition>();
+
+        private Collection<QNodeTypeDefinition> getValues() {
+            return nodetypeDefinitions.values();
+        }
+
+        private Set<Name> getKeySet() {
+            return nodetypeDefinitions.keySet();
+        }
 
         /**
          * Returns the names of those registered node types that have
@@ -678,16 +684,14 @@
          * @return a set of node type <code>Name</code>s
          * @throws NoSuchNodeTypeException
          */
-        private Set getDependentNodeTypes(Name nodeTypeName) throws NoSuchNodeTypeException {
+        private Set<Name> getDependentNodeTypes(Name nodeTypeName) throws NoSuchNodeTypeException {
             if (!nodetypeDefinitions.containsKey(nodeTypeName)) {
                 throw new NoSuchNodeTypeException(nodeTypeName.toString());
             }
             // get names of those node types that have dependencies on the
             // node type with the given nodeTypeName.
-            HashSet names = new HashSet();
-            Iterator iter = nodetypeDefinitions.values().iterator();
-            while (iter.hasNext()) {
-                QNodeTypeDefinition ntd = (QNodeTypeDefinition) iter.next();
+            HashSet<Name> names = new HashSet<Name>();
+            for (QNodeTypeDefinition ntd : getValues()) {
                 if (ntd.getDependencies().contains(nodeTypeName)) {
                     names.add(ntd.getName());
                 }
@@ -695,12 +699,12 @@
             return names;
         }
 
-        private void updateInternalMap(Iterator definitions) {
-            // since definition were retrieved from the storage, valiation
+        private void updateInternalMap(Iterator<QNodeTypeDefinition> definitions) {
+            // since definition were retrieved from the storage, validation
             // can be omitted -> register without building effective-nodetype.
             // TODO: check if correct
             while (definitions.hasNext()) {
-                internalRegister((QNodeTypeDefinition) definitions.next(), null);
+                internalRegister(definitions.next(), null);
             }
         }
 
@@ -731,67 +735,65 @@
             return get(((QNodeTypeDefinition)value).getName()) != null;
         }
 
-        public Set keySet() {
+        public Set<Name> keySet() {
             // to be aware of all (recently) registered nodetypes retrieve
             // complete set from the storage again and add missing / replace
             // existing definitions.
             try {
-                Iterator it = storage.getAllDefinitions();
+                Iterator<QNodeTypeDefinition> it = storage.getAllDefinitions();
                 updateInternalMap(it);
             } catch (RepositoryException e) {
                 log.error(e.getMessage());
             }
-            return nodetypeDefinitions.keySet();
+            return getKeySet();
         }
 
-        public Collection values() {
+        public Collection<QNodeTypeDefinition> values() {
             // make sure all node type definitions have been loaded.
             keySet();
             // and retrieve the collection containing all definitions.
-            return nodetypeDefinitions.values();
+            return getValues();
         }
 
-        public Object put(Object key, Object value) {
+        public QNodeTypeDefinition put(Name key, QNodeTypeDefinition value) {
             return nodetypeDefinitions.put(key, value);
         }
 
-        public void putAll(Map t) {
+        public void putAll(Map<? extends Name, ? extends QNodeTypeDefinition> t) {
             throw new UnsupportedOperationException("Implementation missing");
         }
 
-        public Set entrySet() {
+        public Set<Map.Entry<Name, QNodeTypeDefinition>> entrySet() {
             // make sure all node type definitions have been loaded.
             keySet();
             return nodetypeDefinitions.entrySet();
         }
 
-        public Object get(Object key) {
+        public QNodeTypeDefinition get(Object key) {
             if (!(key instanceof Name)) {
                 throw new IllegalArgumentException();
             }
-            QNodeTypeDefinition def = (QNodeTypeDefinition) nodetypeDefinitions.get(key);
+            QNodeTypeDefinition def = nodetypeDefinitions.get(key);
             if (def == null) {
                 try {
                     // node type does either not exist or hasn't been loaded yet
-                    Iterator it = storage.getDefinitions(new Name[] {(Name) key});
+                    Iterator<QNodeTypeDefinition> it = storage.getDefinitions(new Name[] {(Name) key});
                     updateInternalMap(it);
                 } catch (RepositoryException e) {
                     log.debug(e.getMessage());
                 }
             }
-            def = (QNodeTypeDefinition) nodetypeDefinitions.get(key);
+            def = nodetypeDefinitions.get(key);
             return def;
         }
 
-        public Object remove(Object key) {
-            return (QNodeTypeDefinition) nodetypeDefinitions.remove(key);
+        public QNodeTypeDefinition remove(Object key) {
+            return nodetypeDefinitions.remove(key);
         }
 
         //-------------------------------------------------------< Dumpable >---
         public void dump(PrintStream ps) {
-            Iterator iter = nodetypeDefinitions.values().iterator();
-            while (iter.hasNext()) {
-                QNodeTypeDefinition ntd = (QNodeTypeDefinition) iter.next();
+            for (QNodeTypeDefinition ntd : getValues()) {
                 ps.println(ntd.getName());
                 Name[] supertypes = ntd.getSupertypes();
                 ps.println("\tSupertypes");

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java Wed Oct 21 11:38:31 2009
@@ -18,7 +18,6 @@
 
 import java.util.Map;
 import java.util.HashMap;
-import java.util.Iterator;
 
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
@@ -118,12 +117,11 @@
     /**
      * @see javax.jcr.observation.Event#getInfo()
      */
-    public Map getInfo() throws RepositoryException {
-        Map<String, String> jcrInfo = new HashMap();
-        Map<Name, QValue> infos = event.getInfo();
-        for (Iterator<Name> it = event.getInfo().keySet().iterator(); it.hasNext(); ) {
-            Name key = it.next();
-            QValue value = infos.get(key);
+    public Map<String, String> getInfo() throws RepositoryException {
+        Map<String, String> jcrInfo = new HashMap<String, String>();
+        for (Map.Entry<Name, QValue> entry : event.getInfo().entrySet()) {
+            Name key = entry.getKey();
+            QValue value = entry.getValue();
             String strValue = null;
             if (value != null) {
                 strValue = ValueFormat.getJCRString(value, resolver);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java Wed Oct 21 11:38:31 2009
@@ -136,7 +136,7 @@
      * @inheritDoc
      */
     public EventListenerIterator getRegisteredEventListeners() throws RepositoryException {
-        Map activeListeners;
+        Map<EventListener, EventFilter> activeListeners;
         synchronized (subscriptions) {
             ensureReadOnlyMap();
             activeListeners = readOnlySubscriptions;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java Wed Oct 21 11:38:31 2009
@@ -33,9 +33,9 @@
 public abstract class AbstractOperation implements Operation {
 
     /**
-     * The collection of affected ItemIds.
+     * The collection of affected ItemStates.
      */
-    private final Collection affectedStates = new ArrayList();
+    private final Collection<ItemState> affectedStates = new ArrayList<ItemState>();
     protected int status;
 
     /**
@@ -51,8 +51,13 @@
     /**
      * @inheritDoc
      */
-    public Collection getAffectedItemStates() {
-        return (affectedStates.isEmpty()) ? Collections.EMPTY_LIST : Collections.unmodifiableCollection(affectedStates);
+    public Collection<ItemState> getAffectedItemStates() {
+    	if (affectedStates.isEmpty()) {
+    		return Collections.emptySet();
+    	}
+    	else {
+    		return Collections.unmodifiableCollection(affectedStates);
+    	}
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddNode.java Wed Oct 21 11:38:31 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.jcr2spi.operation;
 
+import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
@@ -46,7 +47,7 @@
     private final Name nodeTypeName;
     private final String uuid;
 
-    private List addedStates = new ArrayList();
+    private List<ItemState> addedStates = new ArrayList<ItemState>();
 
     private AddNode(NodeState parentState, Name nodeName, Name nodeTypeName, String uuid)
             throws RepositoryException {
@@ -110,11 +111,11 @@
         return uuid;
     }
 
-    public void addedState(List newStates) {
+    public void addedState(List<ItemState> newStates) {
         addedStates.addAll(newStates);
     }
 
-    public List getAddedStates() {
+    public List<ItemState> getAddedStates() {
         return addedStates;
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java Wed Oct 21 11:38:31 2009
@@ -77,9 +77,9 @@
         } catch (RepositoryException e) {
             log.debug("Failed to access Version history entry -> skip invalidation.", e);
         }
-        Iterator entries = ((NodeEntry) nodeState.getHierarchyEntry()).getPropertyEntries();
+        Iterator<PropertyEntry> entries = ((NodeEntry) nodeState.getHierarchyEntry()).getPropertyEntries();
         while (entries.hasNext()) {
-            PropertyEntry pe = (PropertyEntry) entries.next();
+            PropertyEntry pe = entries.next();
             pe.invalidate(false);
         }
         nodeState.getHierarchyEntry().invalidate(false);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java Wed Oct 21 11:38:31 2009
@@ -85,9 +85,9 @@
         }
         // non-recursive invalidation (but including all properties)
         NodeEntry nodeEntry = (NodeEntry) nodeState.getHierarchyEntry();
-        Iterator entries = nodeEntry.getPropertyEntries();
+        Iterator<PropertyEntry> entries = nodeEntry.getPropertyEntries();
         while (entries.hasNext()) {
-            PropertyEntry pe = (PropertyEntry) entries.next();
+            PropertyEntry pe = entries.next();
             pe.invalidate(false);
         }
         nodeEntry.invalidate(false);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java Wed Oct 21 11:38:31 2009
@@ -75,9 +75,9 @@
         }
         // non-recursive invalidation (but including all properties)
         NodeEntry nodeEntry = (NodeEntry) nodeState.getHierarchyEntry();
-        Iterator entries = nodeEntry.getPropertyEntries();
+        Iterator<PropertyEntry> entries = nodeEntry.getPropertyEntries();
         while (entries.hasNext()) {
-            PropertyEntry pe = (PropertyEntry) entries.next();
+            PropertyEntry pe = entries.next();
             pe.invalidate(false);
         }
         nodeEntry.invalidate(false);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java Wed Oct 21 11:38:31 2009
@@ -63,9 +63,9 @@
         status = STATUS_PERSISTED;
         // non-recursive invalidation but including all properties
         NodeEntry nodeEntry = nodeState.getNodeEntry();
-        Iterator entries = nodeEntry.getPropertyEntries();
+        Iterator<PropertyEntry> entries = nodeEntry.getPropertyEntries();
         while (entries.hasNext()) {
-            PropertyEntry pe = (PropertyEntry) entries.next();
+            PropertyEntry pe = entries.next();
             pe.invalidate(false);
         }
         nodeEntry.invalidate(false);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java Wed Oct 21 11:38:31 2009
@@ -20,6 +20,7 @@
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
+import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.NodeId;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,7 +47,7 @@
     private final boolean isShallow;
     private final VersionManager mgr;
 
-    private Iterator failedIds = null;
+    private Iterator<? extends ItemId> failedIds = null;
 
     private Merge(NodeState nodeState, String srcWorkspaceName, boolean bestEffort, boolean isShallow, VersionManager mgr) {
         this.nodeState = nodeState;
@@ -117,7 +118,7 @@
         return srcWorkspaceName == null;
     }
 
-    public void setFailedIds(Iterator failedIds) {
+    public void setFailedIds(Iterator<? extends ItemId> failedIds) {
         if (failedIds == null) {
             throw new IllegalArgumentException("IdIterator must not be null.");
         }
@@ -127,7 +128,7 @@
         this.failedIds = failedIds;
     }
 
-    public Iterator getFailedIds() {
+    public Iterator<? extends ItemId> getFailedIds() {
         if (failedIds == null) {
             throw new IllegalStateException("Merge operation has not been executed yet.");
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Operation.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Operation.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Operation.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Operation.java Wed Oct 21 11:38:31 2009
@@ -56,7 +56,7 @@
      *
      * @return collection of affected <code>ItemState</code>s.
      */
-    public Collection getAffectedItemStates();
+    public Collection<ItemState> getAffectedItemStates();
 
     /**
      * Informs this Operation that it has been successfully executed.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java Wed Oct 21 11:38:31 2009
@@ -61,18 +61,18 @@
 
     /**
      * Invalidates the <code>NodeState</code> that has been updated and all
-     * its decendants. Second, the parent state gets invalidated.
+     * its descendants. Second, the parent state gets invalidated.
      *
      * @see Operation#persisted()
      */
     public void persisted() {
         assert status == STATUS_PENDING;
         status = STATUS_PERSISTED;
-        // invaliate the versionable node as well (version related properties)
+        // Invalidate the versionable node as well (version related properties)
         if (versionableEntry != null) {
-            Iterator propEntries = versionableEntry.getPropertyEntries();
+            Iterator<PropertyEntry> propEntries = versionableEntry.getPropertyEntries();
             while (propEntries.hasNext()) {
-                PropertyEntry pe = (PropertyEntry) propEntries.next();
+                PropertyEntry pe = propEntries.next();
                 pe.invalidate(false);
             }
             versionableEntry.invalidate(false);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java Wed Oct 21 11:38:31 2009
@@ -69,9 +69,9 @@
         assert status == STATUS_PENDING;
         status = STATUS_PERSISTED;
         // non-recursive invalidation BUT including all properties
-        Iterator propEntries = ((NodeEntry) nodeState.getHierarchyEntry()).getPropertyEntries();
+        Iterator<PropertyEntry> propEntries = ((NodeEntry) nodeState.getHierarchyEntry()).getPropertyEntries();
         while (propEntries.hasNext()) {
-            PropertyEntry pe = (PropertyEntry) propEntries.next();
+            PropertyEntry pe = propEntries.next();
             pe.invalidate(false);
         }
         nodeState.getHierarchyEntry().invalidate(false);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPropertyValue.java Wed Oct 21 11:38:31 2009
@@ -106,13 +106,13 @@
     public static Operation create(PropertyState propState, QValue[] qValues,
                                    int valueType) throws RepositoryException {
         // compact array (purge null entries)
-        List list = new ArrayList();
+        List<QValue> list = new ArrayList<QValue>();
         for (int i = 0; i < qValues.length; i++) {
             if (qValues[i] != null) {
                 list.add(qValues[i]);
             }
         }
-        QValue[] cleanValues = (QValue[]) list.toArray(new QValue[list.size()]);
+        QValue[] cleanValues = list.toArray(new QValue[list.size()]);
         SetPropertyValue sv = new SetPropertyValue(propState, valueType, cleanValues);
         return sv;
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryManagerImpl.java Wed Oct 21 11:38:31 2009
@@ -16,16 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi.query;
 
-import org.apache.jackrabbit.jcr2spi.ItemManager;
-import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
-import org.apache.jackrabbit.jcr2spi.ManagerProvider;
-import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelFactoryImpl;
-import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
-import org.apache.jackrabbit.spi.commons.query.QueryObjectModelBuilderRegistry;
-import org.apache.jackrabbit.spi.commons.query.QueryObjectModelBuilder;
-import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
-
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -33,8 +23,18 @@
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.Query;
 import javax.jcr.query.QueryManager;
-import javax.jcr.query.qom.QueryObjectModelFactory;
 import javax.jcr.query.qom.QueryObjectModel;
+import javax.jcr.query.qom.QueryObjectModelFactory;
+
+import org.apache.jackrabbit.commons.query.QueryObjectModelBuilder;
+import org.apache.jackrabbit.commons.query.QueryObjectModelBuilderRegistry;
+import org.apache.jackrabbit.jcr2spi.ItemManager;
+import org.apache.jackrabbit.jcr2spi.ManagerProvider;
+import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelFactoryImpl;
+import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
 
 /**
  * This class implements the {@link QueryManager} interface.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryObjectModelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryObjectModelImpl.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryObjectModelImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryObjectModelImpl.java Wed Oct 21 11:38:31 2009
@@ -16,31 +16,31 @@
  */
 package org.apache.jackrabbit.jcr2spi.query;
 
-import javax.jcr.query.qom.QueryObjectModel;
-import javax.jcr.query.qom.Source;
-import javax.jcr.query.qom.Constraint;
-import javax.jcr.query.qom.Ordering;
-import javax.jcr.query.qom.Column;
-import javax.jcr.query.InvalidQueryException;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryResult;
-import javax.jcr.Session;
-import javax.jcr.RepositoryException;
-import javax.jcr.Node;
-import javax.jcr.ItemNotFoundException;
 import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Value;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.query.InvalidQueryException;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+import javax.jcr.query.qom.Column;
+import javax.jcr.query.qom.Constraint;
+import javax.jcr.query.qom.Ordering;
+import javax.jcr.query.qom.QueryObjectModel;
+import javax.jcr.query.qom.Source;
 import javax.jcr.version.VersionException;
 
-import org.apache.jackrabbit.jcr2spi.ManagerProvider;
+import org.apache.jackrabbit.commons.query.QueryObjectModelBuilderRegistry;
 import org.apache.jackrabbit.jcr2spi.ItemManager;
+import org.apache.jackrabbit.jcr2spi.ManagerProvider;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
 import org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelTree;
-import org.apache.jackrabbit.spi.commons.query.QueryObjectModelBuilderRegistry;
 
 /**
  * <code>QueryObjectModelImpl</code> implements the jcr2spi query object model.

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/AbstractItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/AbstractItemStateFactory.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/AbstractItemStateFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/AbstractItemStateFactory.java Wed Oct 21 11:38:31 2009
@@ -29,7 +29,7 @@
 
     private static Logger log = LoggerFactory.getLogger(AbstractItemStateFactory.class);
 
-    private final Set creationListeners = new HashSet();
+    private final Set<ItemStateCreationListener> creationListeners = new HashSet<ItemStateCreationListener>();
 
     //---------------------------------------------------< ItemStateFactory >---
     /**
@@ -59,7 +59,7 @@
      */
     private ItemStateCreationListener[] getListeners() {
         synchronized (creationListeners) {
-            return (ItemStateCreationListener[]) creationListeners.toArray(new ItemStateCreationListener[creationListeners.size()]);
+            return creationListeners.toArray(new ItemStateCreationListener[creationListeners.size()]);
         }
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java Wed Oct 21 11:38:31 2009
@@ -26,7 +26,6 @@
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ConstraintViolationException;
-import java.util.Iterator;
 import java.util.Set;
 import java.util.List;
 import java.util.ArrayList;
@@ -51,9 +50,9 @@
     /**
      * Set of operations
      */
-    private final Set operations;
+    private final Set<Operation> operations;
 
-    private final Set affectedStates;
+    private final Set<ItemState> affectedStates;
 
     /**
      * Create a new change log and populates it with operations and states
@@ -65,7 +64,7 @@
      * @throws InvalidItemStateException
      * @throws ConstraintViolationException
      */
-    ChangeLog(ItemState target, Set operations, Set affectedStates)
+    ChangeLog(ItemState target, Set<Operation> operations, Set<ItemState> affectedStates)
             throws InvalidItemStateException, ConstraintViolationException {
         this.target = target;
         this.operations = operations;
@@ -74,7 +73,7 @@
 
     //-----------------------------------------------< Inform the ChangeLog >---
     /**
-     * Call this method when this change log has been sucessfully persisted.
+     * Call this method when this change log has been successfully persisted.
      * This implementation will call {@link Operation#persisted() on the
      * individual operations followed by setting all remaining modified
      * states to EXISTING.
@@ -83,7 +82,7 @@
         List<NodeState> changedMixins = new ArrayList<NodeState>();
         List<NodeState> changedPrimaryTypes = new ArrayList<NodeState>();
 
-        Operation[] ops = (Operation[]) operations.toArray(new Operation[operations.size()]);
+        Operation[] ops = operations.toArray(new Operation[operations.size()]);
         for (int i = 0; i < ops.length; i++) {
             ops[i].persisted();
             if (ops[i] instanceof SetMixin) {
@@ -94,8 +93,7 @@
         }
         // process all remaining states that were not covered by the
         // operation persistence.
-        for (Iterator it = affectedStates.iterator(); it.hasNext();) {
-            ItemState state = (ItemState) it.next();
+        for (ItemState state : affectedStates) {
             HierarchyEntry he = state.getHierarchyEntry();
 
             switch (state.getStatus()) {
@@ -148,15 +146,14 @@
      * Revert the changes listed within this changelog
      */
     public void undo() throws RepositoryException {
-        Operation[] ops = (Operation[]) operations.toArray(new Operation[operations.size()]);
+        Operation[] ops = operations.toArray(new Operation[operations.size()]);
         for (int i = ops.length - 1; i >= 0; i--) {
             ops[i].undo();
         }
 
         // process all remaining states that were not covered by the
         // operation undo.
-        for (Iterator it = affectedStates.iterator(); it.hasNext();) {
-            ItemState state = (ItemState) it.next();
+        for (ItemState state : affectedStates) {
             switch (state.getStatus()) {
                 case Status.EXISTING_MODIFIED:
                 case Status.EXISTING_REMOVED:
@@ -200,14 +197,14 @@
     /**
      * @return set of operations.
      */
-    public Set getOperations() {
+    public Set<Operation> getOperations() {
         return operations;
     }
 
     /**
      * @return set of the affected states.
      */
-    public Set getAffectedStates() {
+    public Set<ItemState> getAffectedStates() {
         return affectedStates;
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java Wed Oct 21 11:38:31 2009
@@ -57,7 +57,7 @@
     /**
      * Listeners (weak references)
      */
-    private final transient Collection listeners = new WeakIdentityCollection(5);
+    private final transient Collection<ItemStateLifeCycleListener> listeners = new WeakIdentityCollection(5);
 
     /**
      * The <code>ItemStateFactory</code> which is used to create new
@@ -240,11 +240,11 @@
         } else {
             throw new IllegalArgumentException("Invalid new status " + Status.getName(newStatus) + " for state with status " + Status.getName(oldStatus));
         }
-        // notifiy listeners about status change
+        // Notify listeners about status change
         // copy listeners to array to avoid ConcurrentModificationException
         ItemStateLifeCycleListener[] la;
         synchronized (listeners) {
-            la = (ItemStateLifeCycleListener[]) listeners.toArray(new ItemStateLifeCycleListener[listeners.size()]);
+            la = listeners.toArray(new ItemStateLifeCycleListener[listeners.size()]);
         }
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
@@ -307,7 +307,7 @@
      *
      * @return iterator over <code>ItemStateLifeCycleListener</code>s.
      */
-    public Iterator getListeners() {
+    public Iterator<ItemStateLifeCycleListener> getListeners() {
         return Collections.unmodifiableCollection(listeners).iterator();
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateFactory.java Wed Oct 21 11:38:31 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.jcr2spi.state;
 
+import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.Name;
@@ -107,7 +108,7 @@
      * @throws ItemNotFoundException
      * @throws RepositoryException
      */
-    public Iterator getChildNodeInfos(NodeId nodeId) throws ItemNotFoundException, RepositoryException;
+    public Iterator<ChildInfo> getChildNodeInfos(NodeId nodeId) throws ItemNotFoundException, RepositoryException;
 
     /**
      * Returns the identifiers of all reference properties that  point to

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java Wed Oct 21 11:38:31 2009
@@ -145,7 +145,7 @@
 
                 // since 'mixinTypeNames' are modified upon save only, no special
                 // merging is required here. just reset the mixinTypeNames.
-                List mixN = Arrays.asList(nState.mixinTypeNames);
+                List<Name> mixN = Arrays.asList(nState.mixinTypeNames);
                 if (mixN.size() != mixinTypeNames.length || !mixN.containsAll(Arrays.asList(mixinTypeNames))) {
                     setMixinTypeNames(nState.mixinTypeNames);
                     modified = true;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java Wed Oct 21 11:38:31 2009
@@ -178,9 +178,9 @@
      * @throws RepositoryException
      */
     public void adjustReferences(ReferenceChangeTracker refTracker) throws ConstraintViolationException, RepositoryException {
-        Iterator it = refTracker.getReferences();
+        Iterator<PropertyState> it = refTracker.getReferences();
         while (it.hasNext()) {
-            PropertyState propState = (PropertyState) it.next();
+            PropertyState propState = it.next();
             boolean modified = false;
             QValue[] values = propState.getValues();
             QValue[] newVals = new QValue[values.length];
@@ -246,7 +246,7 @@
         NodeState parent = operation.getParentState();
         ItemDefinitionProvider defProvider = mgrProvider.getItemDefinitionProvider();
         QNodeDefinition def = defProvider.getQNodeDefinition(parent.getAllNodeTypeNames(), operation.getNodeName(), operation.getNodeTypeName());
-        List newStates = addNodeState(parent, operation.getNodeName(), operation.getNodeTypeName(), operation.getUuid(), def, options);
+        List<ItemState> newStates = addNodeState(parent, operation.getNodeName(), operation.getNodeTypeName(), operation.getUuid(), def, options);
         operation.addedState(newStates);
 
         transientStateMgr.addOperation(operation);
@@ -454,7 +454,7 @@
         return transientStateMgr.createNewPropertyState(propertyName, parent, pDef, values, propertyType);
     }
 
-    private List addNodeState(NodeState parent, Name nodeName, Name nodeTypeName,
+    private List<ItemState> addNodeState(NodeState parent, Name nodeName, Name nodeTypeName,
                               String uuid, QNodeDefinition definition, int options)
             throws RepositoryException, ConstraintViolationException, AccessDeniedException,
             UnsupportedRepositoryOperationException, NoSuchNodeTypeException,
@@ -478,7 +478,7 @@
             }
         }
 
-        List addedStates = new ArrayList();
+        List<ItemState> addedStates = new ArrayList<ItemState>();
 
         // create new nodeState. NOTE, that the uniqueID is not added to the
         // state for consistency between 'addNode' and importXML

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java Wed Oct 21 11:38:31 2009
@@ -18,6 +18,7 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.PropertyId;
@@ -33,6 +34,7 @@
 
 import java.util.Iterator;
 import java.util.Collections;
+import java.util.Set;
 
 /**
  * <code>TransientISFactory</code>...
@@ -134,7 +136,7 @@
      * @inheritDoc
      * @see ItemStateFactory#getChildNodeInfos(NodeId)
      */
-    public Iterator getChildNodeInfos(NodeId nodeId) throws ItemNotFoundException, RepositoryException {
+    public Iterator<ChildInfo> getChildNodeInfos(NodeId nodeId) throws ItemNotFoundException, RepositoryException {
         return workspaceStateFactory.getChildNodeInfos(nodeId);
     }
 
@@ -144,7 +146,8 @@
      */
     public Iterator<PropertyId> getNodeReferences(NodeState nodeState, Name propertyName, boolean weak) {
         if (nodeState.getStatus() == Status.NEW) {
-            return Collections.EMPTY_SET.iterator();
+            Set<PropertyId> t = Collections.emptySet();
+            return t.iterator();
         }
         return workspaceStateFactory.getNodeReferences(nodeState, propertyName, weak);
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java Wed Oct 21 11:38:31 2009
@@ -56,26 +56,26 @@
     /**
      * Added states
      */
-    private final Set addedStates = new LinkedHashSet();
+    private final Set<ItemState> addedStates = new LinkedHashSet<ItemState>();
 
     /**
      * Modified states
      */
-    private final Set modifiedStates = new LinkedHashSet();
+    private final Set<ItemState> modifiedStates = new LinkedHashSet<ItemState>();
 
     /**
      * Removed states
      */
-    private final Set removedStates = new LinkedHashSet();
+    private final Set<ItemState> removedStates = new LinkedHashSet<ItemState>();
     /**
      * Stale states
      */
-    private final Set staleStates = new LinkedHashSet();
+    private final Set<ItemState> staleStates = new LinkedHashSet<ItemState>();
 
     /**
      * Set of operations
      */
-    private Set operations = new LinkedHashSet();
+    private Set<Operation> operations = new LinkedHashSet<Operation>();
 
     /**
      *
@@ -86,7 +86,7 @@
     /**
      * @return the operations that have been recorded until now.
      */
-    Iterator getOperations() {
+    Iterator<Operation> getOperations() {
         return operations.iterator();
     }
 
@@ -110,14 +110,14 @@
     /**
      * Create the change log for the tree starting at <code>target</code>. This
      * includes a  check if the ChangeLog to be created is totally 'self-contained'
-     * and independant; items within the scope of this update operation (i.e.
+     * and independent; items within the scope of this update operation (i.e.
      * below the target) must not have dependencies outside of this tree (e.g.
      * moving a node requires that the target node including both old and new
      * parents are saved).
      *
      * @param target
      * @param throwOnStale Throws InvalidItemStateException if either the given
-     * <code>ItemState</code> or any of its decendants is stale and the flag is true.
+     * <code>ItemState</code> or any of its descendants is stale and the flag is true.
      * @return
      * @throws InvalidItemStateException if a stale <code>ItemState</code> is
      * encountered while traversing the state hierarchy. The <code>changeLog</code>
@@ -138,8 +138,8 @@
             throw new InvalidItemStateException(msg);
         }
 
-        Set ops = new LinkedHashSet();
-        Set affectedStates = new LinkedHashSet();
+        Set<Operation> ops = new LinkedHashSet<Operation>();
+        Set<ItemState> affectedStates = new LinkedHashSet<ItemState>();
 
         HierarchyEntry he = target.getHierarchyEntry();
         if (he.getParent() == null) {
@@ -160,8 +160,7 @@
             // not root entry:
             // - check if there is a stale state in the scope (save only)
             if (throwOnStale) {
-                for (Iterator it = staleStates.iterator(); it.hasNext();) {
-                    ItemState state = (ItemState) it.next();
+                for (ItemState state : staleStates) {
                     if (containedInTree(target, state)) {
                         String msg = "Cannot save changes: States has been modified externally.";
                         log.debug(msg);
@@ -189,11 +188,9 @@
             //   check if the affected states listed by the operations are all
             //   listed in the modified,removed or added states collected by this
             //   changelog.
-            for (Iterator it = operations.iterator(); it.hasNext();) {
-                Operation op = (Operation) it.next();
-                Collection opStates = op.getAffectedItemStates();
-                for (Iterator osIt = opStates.iterator(); osIt.hasNext();) {
-                    ItemState state = (ItemState) osIt.next();
+            for (Operation op : operations) {
+                Collection<ItemState> opStates = op.getAffectedItemStates();
+                for (ItemState state : opStates) {
                     if (affectedStates.contains(state)) {
                         // operation needs to be included
                         if (!affectedStates.containsAll(opStates)) {
@@ -289,7 +286,7 @@
      * @param subChangeLog
      */
     void dispose(ChangeLog subChangeLog) {
-        Set affectedStates = subChangeLog.getAffectedStates();
+        Set<ItemState> affectedStates = subChangeLog.getAffectedStates();
         addedStates.removeAll(affectedStates);
         modifiedStates.removeAll(affectedStates);
         removedStates.removeAll(affectedStates);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java Wed Oct 21 11:38:31 2009
@@ -23,6 +23,7 @@
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Collections;
+import java.util.Set;
 
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
@@ -33,6 +34,7 @@
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
+import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.Name;
@@ -88,7 +90,7 @@
             throws ItemNotFoundException, RepositoryException {
         // build new node state from server information
         try {
-            Iterator infos = service.getItemInfos(sessionInfo, nodeId);
+            Iterator<? extends ItemInfo> infos = service.getItemInfos(sessionInfo, nodeId);
             NodeState nodeState = createItemStates(nodeId, infos, entry, false);
 
             if (nodeState == null) {
@@ -106,7 +108,7 @@
      */
     public NodeState createDeepNodeState(NodeId nodeId, NodeEntry anyParent) throws ItemNotFoundException, RepositoryException {
         try {
-            Iterator infos = service.getItemInfos(sessionInfo, nodeId);
+            Iterator<? extends ItemInfo> infos = service.getItemInfos(sessionInfo, nodeId);
             return createItemStates(nodeId, infos, anyParent, true);
         } catch (PathNotFoundException e) {
             throw new ItemNotFoundException(e.getMessage());
@@ -152,7 +154,7 @@
      * @see ItemStateFactory#getChildNodeInfos(NodeId)
      * @param nodeId
      */
-    public Iterator getChildNodeInfos(NodeId nodeId)
+    public Iterator<ChildInfo> getChildNodeInfos(NodeId nodeId)
             throws ItemNotFoundException, RepositoryException {
         return service.getChildInfos(sessionInfo, nodeId);
     }
@@ -167,7 +169,8 @@
         if (entry.getUniqueID() == null
                 || !entry.hasPropertyEntry(NameConstants.JCR_UUID)) {
             // for sure not referenceable
-            return Collections.EMPTY_SET.iterator();
+            Set<PropertyId> t = Collections.emptySet();
+            return t.iterator();
         }
 
         // nodestate has a unique ID and is potentially mix:referenceable
@@ -176,7 +179,8 @@
             return service.getReferences(sessionInfo, entry.getWorkspaceId(), propertyName, weak);
         } catch (RepositoryException e) {
             log.debug("Unable to determine references to {}", nodeState);
-            return Collections.EMPTY_SET.iterator();
+            Set<PropertyId> t = Collections.emptySet();
+            return t.iterator();
         }
     }
 
@@ -191,7 +195,7 @@
      * @throws ItemNotFoundException
      * @throws RepositoryException
      */
-    private synchronized NodeState createItemStates(NodeId nodeId, Iterator itemInfos,
+    private synchronized NodeState createItemStates(NodeId nodeId, Iterator<? extends ItemInfo> itemInfos,
                                                     NodeEntry entry, boolean isDeep)
             throws ItemNotFoundException, RepositoryException {
         NodeState nodeState;
@@ -222,7 +226,7 @@
         // optimization results in about 25% speed up.
         NodeEntry approxParentEntry = nodeState.getNodeEntry();
         while (infos.hasNext()) {
-            ItemInfo info = (ItemInfo) infos.next();
+            ItemInfo info = infos.next();
             if (info.denotesNode()) {
                 approxParentEntry = createDeepNodeState((NodeInfo) info, approxParentEntry, infos).getNodeEntry();
             } else {
@@ -263,9 +267,9 @@
         }
 
         // update NodeEntry from the information present in the NodeInfo (prop entries)
-        List propNames = new ArrayList();
-        for (Iterator it = info.getPropertyIds(); it.hasNext(); ) {
-            PropertyId pId = (PropertyId) it.next();
+        List<Name> propNames = new ArrayList<Name>();
+        for (Iterator<PropertyId> it = info.getPropertyIds(); it.hasNext(); ) {
+            PropertyId pId = it.next();
             Name propertyName = pId.getName();
             propNames.add(propertyName);
         }
@@ -278,7 +282,7 @@
 
         // unless the child-info are omitted by the SPI impl -> make sure
         // the childentries the nodeentry are initialized or updated.
-        Iterator childInfos = info.getChildInfos();
+        Iterator<ChildInfo> childInfos = info.getChildInfos();
         if (childInfos != null) {
             entry.setNodeEntries(childInfos);
         }
@@ -448,7 +452,7 @@
                                                          Name name, int index,
                                                          ItemInfos infos) throws RepositoryException {
         if (infos != null) {
-            Iterator childInfos = infos.getChildInfos(parentEntry.getWorkspaceId());
+            Iterator<ChildInfo> childInfos = infos.getChildInfos(parentEntry.getWorkspaceId());
             if (childInfos != null) {
                 parentEntry.setNodeEntries(childInfos);
             }
@@ -531,13 +535,13 @@
     /**
      * Iterator
      */
-    private class ItemInfos implements Iterator {
+    private class ItemInfos implements Iterator<ItemInfo> {
 
-        private final List prefetchQueue = new ArrayList();
-        private final Map nodeInfos = new HashMap();
-        private final Iterator infos;
+        private final List<ItemInfo> prefetchQueue = new ArrayList<ItemInfo>();
+        private final Map<NodeId, NodeInfo> nodeInfos = new HashMap<NodeId, NodeInfo>();
+        private final Iterator<? extends ItemInfo> infos;
 
-        private ItemInfos(Iterator infos) {
+        private ItemInfos(Iterator<? extends ItemInfo> infos) {
             super();
             this.infos = infos;
         }
@@ -557,11 +561,11 @@
         /**
          * @see Iterator#next()
          */
-        public Object next() {
+        public ItemInfo next() {
             if (prefetchQueue.isEmpty()) {
                 throw new NoSuchElementException();
             } else {
-                Object next = prefetchQueue.remove(0);
+                ItemInfo next = prefetchQueue.remove(0);
                 if (next instanceof NodeInfo) {
                     nodeInfos.remove(((NodeInfo) next).getId());
                 }
@@ -584,10 +588,10 @@
          * has not been read yet, has already been processed (childInfo is up
          * to date) or does not provide child infos.
          */
-        private Iterator getChildInfos(NodeId parentId) {
-            NodeInfo nodeInfo = (NodeInfo) nodeInfos.get(parentId);
+        private Iterator<ChildInfo> getChildInfos(NodeId parentId) {
+            NodeInfo nodeInfo = nodeInfos.get(parentId);
             while (nodeInfo == null && prefetch()) {
-                nodeInfo = (NodeInfo) nodeInfos.get(parentId);
+                nodeInfo = nodeInfos.get(parentId);
             }
             return nodeInfo == null? null : nodeInfo.getChildInfos();
         }
@@ -597,7 +601,7 @@
          */
         private boolean prefetch() {
             if (infos.hasNext()) {
-                ItemInfo info = (ItemInfo) infos.next();
+                ItemInfo info = infos.next();
                 prefetchQueue.add(info);
                 if (info.denotesNode()) {
                     NodeInfo nodeInfo = (NodeInfo) info;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/ReferenceChangeTracker.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/ReferenceChangeTracker.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/ReferenceChangeTracker.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/ReferenceChangeTracker.java Wed Oct 21 11:38:31 2009
@@ -27,6 +27,8 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Simple helper class that can be used to keep track of uuid mappings
@@ -41,11 +43,11 @@
     /**
      * mapping <original uuid> to <new uuid> of mix:referenceable nodes
      */
-    private final HashMap uuidMap = new HashMap();
+    private final Map<String, String> uuidMap = new HashMap<String, String>();
     /**
      * list of processed reference properties that might need correction
      */
-    private final ArrayList references = new ArrayList();
+    private final List<PropertyState> references = new ArrayList<PropertyState>();
 
     /**
      * Creates a new instance.
@@ -91,7 +93,7 @@
             try {
                 String oldValue = oldReference.getString();
                 if (uuidMap.containsKey(oldValue)) {
-                    String newValue = uuidMap.get(oldValue).toString();
+                    String newValue = uuidMap.get(oldValue);
                     remapped = factory.create(newValue, PropertyType.REFERENCE);
                 }
             } catch (RepositoryException e) {
@@ -113,7 +115,7 @@
         }
     }
 
-    public Iterator getReferences() {
+    public Iterator<PropertyState> getReferences() {
         return references.iterator();
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java Wed Oct 21 11:38:31 2009
@@ -103,11 +103,11 @@
     public VersionIterator getAllVersions() throws RepositoryException {
         checkStatus();
         refreshEntry(vhEntry);
-        Iterator childIter = vhEntry.getNodeEntries();
-        List versionEntries = new ArrayList();
+        Iterator<NodeEntry> childIter = vhEntry.getNodeEntries();
+        List<NodeEntry> versionEntries = new ArrayList<NodeEntry>();
         // all child-nodes except from jcr:versionLabels point to Versions.
         while (childIter.hasNext()) {
-            NodeEntry entry = (NodeEntry) childIter.next();
+            NodeEntry entry = childIter.next();
             if (!NameConstants.JCR_VERSIONLABELS.equals(entry.getName())) {
                 versionEntries.add(entry);
             }
@@ -124,7 +124,7 @@
         // TODO: improve and use lazy loading of versions as needed.
         // TODO: change session.getNodeByUUID to Session.getNodeByIdentifier as soon as implemented
 
-        List versions = new ArrayList();
+        List<Version> versions = new ArrayList<Version>();
         Version rootV = getRootVersion();
         Node vn = session.getNodeByUUID(getVersionableUUID());
         Version v = vn.getBaseVersion();
@@ -247,7 +247,7 @@
         checkValidVersion(version);
         String vUUID = version.getUUID();
 
-        List vlabels = new ArrayList();
+        List<String> vlabels = new ArrayList<String>();
         Name[] qLabels = getQLabels();
         for (int i = 0; i < qLabels.length; i++) {
             String uuid = getVersionByLabel(qLabels[i]).getUUID();
@@ -255,7 +255,7 @@
                 vlabels.add(session.getNameResolver().getJCRName(qLabels[i]));
             }
         }
-        return (String[]) vlabels.toArray(new String[vlabels.size()]);
+        return vlabels.toArray(new String[vlabels.size()]);
     }
 
     /**
@@ -324,15 +324,15 @@
      */
     private Name[] getQLabels() throws RepositoryException {
         refreshEntry(labelNodeEntry);
-        List labelNames = new ArrayList();
-        for (Iterator it = labelNodeEntry.getPropertyEntries(); it.hasNext(); ) {
-            PropertyEntry pe = (PropertyEntry) it.next();
+        List<Name> labelNames = new ArrayList<Name>();
+        for (Iterator<PropertyEntry> it = labelNodeEntry.getPropertyEntries(); it.hasNext(); ) {
+            PropertyEntry pe = it.next();
             if (! NameConstants.JCR_PRIMARYTYPE.equals(pe.getName()) &&
                 ! NameConstants.JCR_MIXINTYPES.equals(pe.getName())) {
                 labelNames.add(pe.getName());
             }
         }
-        return (Name[]) labelNames.toArray(new Name[labelNames.size()]);
+        return labelNames.toArray(new Name[labelNames.size()]);
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java Wed Oct 21 11:38:31 2009
@@ -172,7 +172,7 @@
      * @see #resolveMergeConflict(NodeState,NodeState,boolean)
      * @see javax.jcr.Node#merge(String, boolean)
      */
-    public Iterator merge(NodeState nodeState, String workspaceName, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
+    public Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
 
     /**
      * @param nodeState
@@ -190,7 +190,7 @@
      * @see #resolveMergeConflict(NodeState,NodeState,boolean)
      * @see javax.jcr.Node#merge(String, boolean)
      */
-    public Iterator merge(NodeState nodeState, String workspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
+    public Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
 
 
     /**
@@ -239,7 +239,7 @@
      * @throws UnsupportedRepositoryOperationException
      * @throws RepositoryException
      */
-    public Iterator mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
+    public Iterator<NodeId> mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
 
     /**
      *

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java Wed Oct 21 11:38:31 2009
@@ -33,6 +33,7 @@
 import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Stack;
 
 /**
@@ -49,7 +50,7 @@
      * in the startElement method and is popped from the stack in the
      * endElement method.
      */
-    private final Stack stack = new Stack();
+    private final Stack<Importer.NodeInfo> stack = new Stack<Importer.NodeInfo>();
     // buffer used to merge adjacent character data
     private BufferedStringValue textHandler = new BufferedStringValue();
 
@@ -133,7 +134,7 @@
                         new Importer.NodeInfo(NameConstants.JCR_XMLTEXT, null, null, null);
                 Importer.TextValue[] values =
                         new Importer.TextValue[]{textHandler};
-                ArrayList props = new ArrayList();
+                List<Importer.PropInfo> props = new ArrayList<Importer.PropInfo>();
                 Importer.PropInfo prop =
                         new Importer.PropInfo(NameConstants.JCR_XMLCHARACTERS, PropertyType.STRING, values);
                 props.add(prop);
@@ -177,7 +178,7 @@
             Name nodeTypeName = null;
             Name[] mixinTypes = null;
 
-            ArrayList props = new ArrayList(atts.getLength());
+            List<Importer.PropInfo> props = new ArrayList<Importer.PropInfo>(atts.getLength());
             for (int i = 0; i < atts.getLength(); i++) {
                 if (atts.getURI(i).equals(Name.NS_XMLNS_URI)) {
                     // skip namespace declarations reported as attributes
@@ -287,7 +288,7 @@
         // process buffered character data
         processCharacters();
 
-        Importer.NodeInfo node = (Importer.NodeInfo) stack.peek();
+        Importer.NodeInfo node = stack.peek();
         try {
             // call Importer
             importer.endNode(node);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/Importer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/Importer.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/Importer.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/Importer.java Wed Oct 21 11:38:31 2009
@@ -41,7 +41,7 @@
      * context.
      * @throws RepositoryException
      */
-    void startNode(NodeInfo nodeInfo, List propInfos, NamePathResolver resolver)
+    void startNode(NodeInfo nodeInfo, List<PropInfo> propInfos, NamePathResolver resolver)
             throws RepositoryException;
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java?rev=827966&r1=827965&r2=827966&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java Wed Oct 21 11:38:31 2009
@@ -68,7 +68,6 @@
 import java.io.Reader;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Stack;
 import java.util.UUID;
@@ -86,7 +85,7 @@
     private final SessionImpl session;
     private final SessionItemStateManager stateMgr;
 
-    private final Stack parents;
+    private final Stack<NodeState> parents;
 
     private boolean importerClosed;
     private boolean sessionClosed;
@@ -131,7 +130,7 @@
             session.getValidator().checkIsWritable(importTarget, options);
 
             refTracker = new ReferenceChangeTracker();
-            parents = new Stack();
+            parents = new Stack<NodeState>();
             parents.push(importTarget);
         } catch (ItemNotFoundException e) {
             throw new PathNotFoundException(LogUtil.safeGetJCRPath(parentPath, session.getPathResolver()));
@@ -143,21 +142,21 @@
      * {@inheritDoc}
      */
     public void start() throws RepositoryException {
-        // explicitely set status of importer and start listening on session
+        // explicitly set status of importer and start listening on session
         setClosed(false);
     }
 
    /**
      * {@inheritDoc}
      */
-    public void startNode(NodeInfo nodeInfo, List propInfos, NamePathResolver resolver)
+    public void startNode(NodeInfo nodeInfo, List<PropInfo> propInfos, NamePathResolver resolver)
             throws RepositoryException {
        if (isClosed()) {
            // workspace-importer only: ignore if import has been aborted before.
            return;
        }
        checkSession();
-       NodeState parent = (NodeState) parents.peek();
+       NodeState parent = parents.peek();
        if (parent == null) {
            // parent node was skipped, skip this child node also
            parents.push(null); // push null onto stack for skipped node
@@ -226,9 +225,7 @@
        // node state may be 'null' if applicable def is protected
        if (nodeState != null) {
            // process properties
-           Iterator iter = propInfos.iterator();
-           while (iter.hasNext()) {
-               PropInfo pi = (PropInfo) iter.next();
+    	   for (PropInfo pi : propInfos) {
                importProperty(pi, nodeState, resolver);
            }
        }
@@ -632,7 +629,7 @@
      * @throws RepositoryException
      */
     private void checkIncludesMixReferenceable(Importer.NodeInfo nodeInfo) throws RepositoryException {
-        List l = new ArrayList();
+        List<Name> l = new ArrayList<Name>();
         l.add(nodeInfo.getNodeTypeName());
         Name[] mixinNames = nodeInfo.getMixinNames();
         if (mixinNames != null && mixinNames.length > 0) {
@@ -642,7 +639,7 @@
             // shortcut
             return;
         }
-        Name[] ntNames = (Name[]) l.toArray(new Name[l.size()]);
+        Name[] ntNames = l.toArray(new Name[l.size()]);
         EffectiveNodeType ent = session.getEffectiveNodeTypeProvider().getEffectiveNodeType(ntNames);
         if (!ent.includesNodeType(NameConstants.MIX_REFERENCEABLE)) {
             throw new ConstraintViolationException("XML defines jcr:uuid without defining import node to be referenceable.");



Mime
View raw message