jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r915358 [1/2] - in /jackrabbit/trunk/jackrabbit-spi2dav/src: main/java/org/apache/jackrabbit/spi2dav/ main/java/org/apache/jackrabbit/spi2davex/ test/java/org/apache/jackrabbit/spi2dav/ test/java/org/apache/jackrabbit/spi2davex/
Date Tue, 23 Feb 2010 14:36:24 GMT
Author: angela
Date: Tue Feb 23 14:36:22 2010
New Revision: 915358

URL: http://svn.apache.org/viewvc?rev=915358&view=rev
Log:
JCR-2509 : Reduce number of compiler warning by adding @Override and generics where appropriate [step 3: jackrabbit-spi2dav]

in addition:
- minor improvements in comments, typos
- use foreach loops where possible
- remove redundant casts
- remove unused field in NodeInfoImp
- remove unused method in ReadTest
- add WeakReference test to BatchTest

Modified:
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdURICache.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ChildInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/GetMethod.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PostMethod.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PropertyInfoImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/ServiceStubImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CloneTest.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ConnectionTest.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CopyTest.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ExtensionTest.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ReadTest.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/RepositoryStubImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ServiceStubImpl.java

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/EventImpl.java Tue Feb 23 14:36:22 2010
@@ -88,10 +88,10 @@
                                                   NamePathResolver resolver,
                                                   QValueFactory qvFactory) {
         if (infoElement == null) {
-            return Collections.EMPTY_MAP;
+            return Collections.emptyMap();
         }
 
-        Map<Name, QValue> info = new HashMap();
+        Map<Name, QValue> info = new HashMap<Name, QValue>();
         ElementIterator it = DomUtil.getChildren(infoElement);
         while (it.hasNext()) {
             Element el = it.nextElement();
@@ -111,4 +111,4 @@
         }
         return info;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ExceptionConverter.java Tue Feb 23 14:36:22 2010
@@ -42,7 +42,7 @@
 
     private static Logger log = LoggerFactory.getLogger(ExceptionConverter.class);
 
-    // avoid instanciation
+    // avoid instantiation
     private ExceptionConverter() {}
 
     public static RepositoryException generate(DavException davExc) throws RepositoryException {
@@ -61,8 +61,8 @@
                             msg = DomUtil.getChildText(exc, "message", null);
                         }
                         if (DomUtil.hasChildElement(exc, "class", null)) {
-                            Class cl = Class.forName(DomUtil.getChildText(exc, "class", null));
-                            Constructor excConstr = cl.getConstructor(new Class[]{String.class});
+                            Class<?> cl = Class.forName(DomUtil.getChildText(exc, "class", null));
+                            Constructor<?> excConstr = cl.getConstructor(String.class);
                             if (excConstr != null) {
                                 Object o = excConstr.newInstance(new String[]{msg});
                                 if (o instanceof RepositoryException) {
@@ -113,4 +113,4 @@
                 return new RepositoryException(msg, davExc);
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdURICache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdURICache.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdURICache.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/IdURICache.java Tue Feb 23 14:36:22 2010
@@ -32,19 +32,19 @@
 
     private final String workspaceUri;
 
-    private Map idToUriCache = new HashMap();
-    private Map uriToIdCache = new HashMap();
+    private Map<ItemId, String> idToUriCache = new HashMap<ItemId, String>();
+    private Map<String, ItemId> uriToIdCache = new HashMap<String, ItemId>();
 
     IdURICache(String workspaceUri) {
         this.workspaceUri = workspaceUri;
     }
 
     public ItemId getItemId(String uri) {
-        return (ItemId) uriToIdCache.get(getCleanUri(uri));
+        return uriToIdCache.get(getCleanUri(uri));
     }
 
     public String getUri(ItemId itemId) {
-        return (String) idToUriCache.get(itemId);
+        return idToUriCache.get(itemId);
     }
 
     public boolean containsUri(String uri) {
@@ -67,7 +67,7 @@
 
     public void remove(String uri) {
         String cleanUri = getCleanUri(uri);
-        Object itemId = uriToIdCache.remove(cleanUri);
+        ItemId itemId = uriToIdCache.remove(cleanUri);
         if (itemId != null) {
             idToUriCache.remove(itemId);
         }
@@ -75,7 +75,7 @@
     }
 
     public void remove(ItemId itemId) {
-        Object uri = idToUriCache.remove(itemId);
+        String uri = idToUriCache.remove(itemId);
         if (uri != null) {
             uriToIdCache.remove(uri);
         }
@@ -89,4 +89,4 @@
             return uri;
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/ItemInfoImpl.java Tue Feb 23 14:36:22 2010
@@ -44,7 +44,7 @@
     ItemInfoImpl(DavPropertySet propSet, NamePathResolver resolver)
             throws NameException, NamespaceException {
 
-        DavProperty pathProp = propSet.get(ItemResourceConstants.JCR_PATH);
+        DavProperty<?> pathProp = propSet.get(ItemResourceConstants.JCR_PATH);
         String jcrPath = pathProp.getValue().toString();
         path = resolver.getQPath(jcrPath);
     }
@@ -55,4 +55,4 @@
     public Path getPath() {
         return path;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NamespaceResolverImpl.java Tue Feb 23 14:36:22 2010
@@ -35,8 +35,8 @@
 
     // TODO: TO_BE_FIXED. missing notification and subsequent reloading of namespaces causes this resolver to throw NameException
 
-    private Map prefixToURI = new HashMap();
-    private Map uriToPrefix = new HashMap();
+    private Map<String, String> prefixToURI = new HashMap<String, String>();
+    private Map<String, String> uriToPrefix = new HashMap<String, String>();
 
     void add(String prefix, String uri) {
         prefixToURI.put(prefix, uri);
@@ -48,7 +48,7 @@
         uriToPrefix.remove(uri);
     }
 
-    Map getNamespaces() {
+    Map<String, String> getNamespaces() {
         return Collections.unmodifiableMap(prefixToURI);
     }
     
@@ -57,7 +57,7 @@
      * @see NamespaceResolver#getURI(String)
      */
     public String getURI(String prefix) throws NamespaceException {
-        String uri = (String) prefixToURI.get(prefix);
+        String uri = prefixToURI.get(prefix);
         if (uri == null) {
             throw new NamespaceException(prefix + ": is not a registered namespace prefix.");
         }
@@ -68,10 +68,10 @@
      * @see org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver#getPrefix(String)
      */
     public String getPrefix(String uri) throws NamespaceException {
-        String prefix = (String) uriToPrefix.get(uri);
+        String prefix = uriToPrefix.get(uri);
         if (prefix == null) {
             throw new NamespaceException(uri + ": is not a registered namespace uri.");
         }
         return prefix;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/NodeInfoImpl.java Tue Feb 23 14:36:22 2010
@@ -50,9 +50,9 @@
     private final Name primaryNodeTypeName;
     private final Name[] mixinNodeTypeNames;
 
-    private final List references = new ArrayList();
-    private final List propertyIds = new ArrayList();
-    private List childInfos = null;
+    private final List<PropertyId> references = new ArrayList<PropertyId>();
+    private final List<PropertyId> propertyIds = new ArrayList<PropertyId>();
+    private List<ChildInfo> childInfos = null;
 
     public NodeInfoImpl(NodeId id, DavPropertySet propSet,
                         NamePathResolver resolver) throws RepositoryException, NameException {
@@ -61,7 +61,7 @@
         // set id
         this.id = id;
 
-        DavProperty indexProp = propSet.get(ItemResourceConstants.JCR_INDEX);
+        DavProperty<?> indexProp = propSet.get(ItemResourceConstants.JCR_INDEX);
         if (indexProp != null && indexProp.getValue() != null) {
             index = Integer.parseInt(indexProp.getValue().toString());
         } else {
@@ -71,9 +71,9 @@
         // retrieve properties
         try {
             if (propSet.contains(ItemResourceConstants.JCR_PRIMARYNODETYPE)) {
-                Iterator it = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_PRIMARYNODETYPE)).getNodeTypeNames().iterator();
+                Iterator<String> it = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_PRIMARYNODETYPE)).getNodeTypeNames().iterator();
                 if (it.hasNext()) {
-                    String jcrName = it.next().toString();
+                    String jcrName = it.next();
                     primaryNodeTypeName = resolver.getQName(jcrName);
                 } else {
                     throw new RepositoryException("Missing primary nodetype for node " + id + ".");
@@ -82,12 +82,10 @@
                 throw new RepositoryException("Missing primary nodetype for node " + id);
             }
             if (propSet.contains(ItemResourceConstants.JCR_MIXINNODETYPES)) {
-                Set mixinNames = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_MIXINNODETYPES)).getNodeTypeNames();
+                Set<String> mixinNames = new NodeTypeProperty(propSet.get(ItemResourceConstants.JCR_MIXINNODETYPES)).getNodeTypeNames();
                 mixinNodeTypeNames = new Name[mixinNames.size()];
-                Iterator it = mixinNames.iterator();
                 int i = 0;
-                while(it.hasNext()) {
-                    String jcrName = it.next().toString();
+                for (String jcrName : mixinNames) {
                     mixinNodeTypeNames[i] = resolver.getQName(jcrName);
                     i++;
                 }
@@ -122,14 +120,14 @@
     }
 
     public PropertyId[] getReferences() {
-        return (PropertyId[]) references.toArray(new PropertyId[references.size()]);
+        return references.toArray(new PropertyId[references.size()]);
     }
 
-    public Iterator getPropertyIds() {
+    public Iterator<PropertyId> getPropertyIds() {
         return propertyIds.iterator();
     }
 
-    public Iterator getChildInfos() {
+    public Iterator<ChildInfo> getChildInfos() {
         return (childInfos == null) ? null : childInfos.iterator();
     }
 
@@ -144,8 +142,8 @@
 
     void addChildInfo(ChildInfo childInfo) {
         if (childInfos == null) {
-            childInfos = new ArrayList();
+            childInfos = new ArrayList<ChildInfo>();
         }
         childInfos.add(childInfo);
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QItemDefinitionImpl.java Tue Feb 23 14:36:22 2010
@@ -114,17 +114,17 @@
         }
 
         if (itemDefElement.hasAttribute(AUTOCREATED_ATTRIBUTE)) {
-            autoCreated = Boolean.valueOf(itemDefElement.getAttribute(AUTOCREATED_ATTRIBUTE)).booleanValue();
+            autoCreated = Boolean.valueOf(itemDefElement.getAttribute(AUTOCREATED_ATTRIBUTE));
         } else {
             autoCreated = false;
         }
         if (itemDefElement.hasAttribute(MANDATORY_ATTRIBUTE)) {
-            mandatory = Boolean.valueOf(itemDefElement.getAttribute(MANDATORY_ATTRIBUTE)).booleanValue();
+            mandatory = Boolean.valueOf(itemDefElement.getAttribute(MANDATORY_ATTRIBUTE));
         } else {
             mandatory = false;
         }
         if (itemDefElement.hasAttribute(PROTECTED_ATTRIBUTE)) {
-            writeProtected = Boolean.valueOf(itemDefElement.getAttribute(PROTECTED_ATTRIBUTE)).booleanValue();
+            writeProtected = Boolean.valueOf(itemDefElement.getAttribute(PROTECTED_ATTRIBUTE));
         } else {
             writeProtected = false;
         }
@@ -197,6 +197,7 @@
      *         <code>false</code> otherwise
      * @see Object#equals(Object)
      */
+    @Override
     public boolean equals(Object obj) {
         if (this == obj) {
             return true;
@@ -220,6 +221,7 @@
      *
      * @return
      */
+    @Override
     public abstract int hashCode();
 
     //--------------------------------------------------------------------------

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeDefinitionImpl.java Tue Feb 23 14:36:22 2010
@@ -75,18 +75,18 @@
 
             Element reqPrimaryTypes = DomUtil.getChildElement(ndefElement, REQUIREDPRIMARYTYPES_ELEMENT, null);
             if (reqPrimaryTypes != null) {
-                List qNames = new ArrayList();
+                List<Name> qNames = new ArrayList<Name>();
                 ElementIterator it = DomUtil.getChildren(reqPrimaryTypes, REQUIREDPRIMARYTYPE_ELEMENT, null);
                 while (it.hasNext()) {
                     qNames.add(resolver.getQName(DomUtil.getTextTrim(it.nextElement())));
                 }
-                requiredPrimaryTypes = (Name[]) qNames.toArray(new Name[qNames.size()]);
+                requiredPrimaryTypes = qNames.toArray(new Name[qNames.size()]);
             } else {
                 requiredPrimaryTypes = new Name[] { NameConstants.NT_BASE };
             }
 
             if (ndefElement.hasAttribute(SAMENAMESIBLINGS_ATTRIBUTE)) {
-                allowsSameNameSiblings = Boolean.valueOf(ndefElement.getAttribute(SAMENAMESIBLINGS_ATTRIBUTE)).booleanValue();
+                allowsSameNameSiblings = Boolean.valueOf(ndefElement.getAttribute(SAMENAMESIBLINGS_ATTRIBUTE));
             } else {
                 allowsSameNameSiblings = false;
             }
@@ -137,6 +137,7 @@
      *         <code>false</code> otherwise
      * @see Object#equals(Object)
      */
+    @Override
     public boolean equals(Object obj) {
         if (this == obj) {
             return true;
@@ -158,6 +159,7 @@
      * 
      * @return
      */
+    @Override
     public int hashCode() {
         if (hashCode == 0) {
             // build hashCode (format: <declaringNodeType>/<name>/<requiredPrimaryTypes>)
@@ -174,10 +176,9 @@
             }
             sb.append('/');
             // set of required node type names, sorted in ascending order
-            TreeSet set = new TreeSet();
-            Name[] names = getRequiredPrimaryTypes();
-            for (int i = 0; i < names.length; i++) {
-                set.add(names[i]);
+            TreeSet<Name> set = new TreeSet<Name>();
+            for (Name name : getRequiredPrimaryTypes()) {
+                set.add(name);
             }
             sb.append(set.toString());
 

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java Tue Feb 23 14:36:22 2010
@@ -56,7 +56,7 @@
     private final Name primaryItemName;
     private final QPropertyDefinition[] propDefs;
     private final QNodeDefinition[] nodeDefs;
-    private Set dependencies;
+    private Set<Name> dependencies;
 
     private final boolean isAbstract;
     private final boolean isQueryable;
@@ -85,52 +85,52 @@
         Element child = DomUtil.getChildElement(ntdElement, SUPERTYPES_ELEMENT, null);
         if (child != null) {
             ElementIterator stIter = DomUtil.getChildren(child, SUPERTYPE_ELEMENT, null);
-            List qNames = new ArrayList();
+            List<Name> qNames = new ArrayList<Name>();
             while (stIter.hasNext()) {
                 Name st = resolver.getQName(DomUtil.getTextTrim(stIter.nextElement()));
                 qNames.add(st);
             }
-            supertypes = (Name[]) qNames.toArray(new Name[qNames.size()]);
+            supertypes = qNames.toArray(new Name[qNames.size()]);
         } else {
             supertypes = Name.EMPTY_ARRAY;
         }
         if (ntdElement.hasAttribute(ISMIXIN_ATTRIBUTE)) {
-            mixin = Boolean.valueOf(ntdElement.getAttribute(ISMIXIN_ATTRIBUTE)).booleanValue();
+            mixin = Boolean.valueOf(ntdElement.getAttribute(ISMIXIN_ATTRIBUTE));
         } else {
             mixin = false;
         }
         if (ntdElement.hasAttribute(HASORDERABLECHILDNODES_ATTRIBUTE)) {
-            orderableChildNodes = Boolean.valueOf(ntdElement.getAttribute(HASORDERABLECHILDNODES_ATTRIBUTE)).booleanValue();
+            orderableChildNodes = Boolean.valueOf(ntdElement.getAttribute(HASORDERABLECHILDNODES_ATTRIBUTE));
         } else {
             orderableChildNodes = false;
         }
         if (ntdElement.hasAttribute(ISABSTRACT_ATTRIBUTE)) {
-            isAbstract = Boolean.valueOf(ntdElement.getAttribute(ISABSTRACT_ATTRIBUTE)).booleanValue();
+            isAbstract = Boolean.valueOf(ntdElement.getAttribute(ISABSTRACT_ATTRIBUTE));
         } else {
             isAbstract = false;
         }
         if (ntdElement.hasAttribute(ISQUERYABLE_ATTRIBUTE)) {
-            isQueryable = Boolean.valueOf(ntdElement.getAttribute(ISQUERYABLE_ATTRIBUTE)).booleanValue();
+            isQueryable = Boolean.valueOf(ntdElement.getAttribute(ISQUERYABLE_ATTRIBUTE));
         } else {
             isQueryable = false;
         }
 
         // nodeDefinitions
         ElementIterator it = DomUtil.getChildren(ntdElement, CHILDNODEDEFINITION_ELEMENT, null);
-        List itemDefs = new ArrayList();
+        List<QNodeDefinition> nds = new ArrayList<QNodeDefinition>();
         while (it.hasNext()) {
-            itemDefs.add(new QNodeDefinitionImpl(name, it.nextElement(), resolver));
+            nds.add(new QNodeDefinitionImpl(name, it.nextElement(), resolver));
         }
-        nodeDefs = (QNodeDefinition[]) itemDefs.toArray(new QNodeDefinition[itemDefs.size()]);
+        nodeDefs = nds.toArray(new QNodeDefinition[nds.size()]);
 
 
         // propertyDefinitions
         it = DomUtil.getChildren(ntdElement, PROPERTYDEFINITION_ELEMENT, null);
-        itemDefs = new ArrayList();
+        List<QPropertyDefinition> pds = new ArrayList<QPropertyDefinition>();
         while (it.hasNext()) {
-            itemDefs.add(new QPropertyDefinitionImpl(name, it.nextElement(), resolver, qValueFactory));
+            pds.add(new QPropertyDefinitionImpl(name, it.nextElement(), resolver, qValueFactory));
         }
-        propDefs = (QPropertyDefinition[]) itemDefs.toArray(new QPropertyDefinition[itemDefs.size()]);
+        propDefs = pds.toArray(new QPropertyDefinition[pds.size()]);
         } catch (NameException e) {
             log.error(e.getMessage());
             throw new RepositoryException(e);
@@ -217,38 +217,37 @@
     /**
      * @see QNodeTypeDefinition#getDependencies() 
      */
-    public Collection getDependencies() {
+    public Collection<Name> getDependencies() {
         if (dependencies == null) {
-            dependencies = new HashSet();
+            dependencies = new HashSet<Name>();
             // supertypes
-            for (int i = 0; i < supertypes.length; i++) {
-                dependencies.add(supertypes[i]);
+            for (Name supertype : supertypes) {
+                dependencies.add(supertype);
             }
             // child node definitions
-            for (int i = 0; i < nodeDefs.length; i++) {
+            for (QNodeDefinition nodeDef : nodeDefs) {
                 // default primary type
-                Name ntName = nodeDefs[i].getDefaultPrimaryType();
+                Name ntName = nodeDef.getDefaultPrimaryType();
                 if (ntName != null && !name.equals(ntName)) {
                     dependencies.add(ntName);
                 }
                 // required primary type
-                Name[] ntNames = nodeDefs[i].getRequiredPrimaryTypes();
-                for (int j = 0; j < ntNames.length; j++) {
-                    if (ntNames[j] != null && !name.equals(ntNames[j])) {
-                        dependencies.add(ntNames[j]);
+                for (Name rpt : nodeDef.getRequiredPrimaryTypes()) {
+                    if (rpt != null && !name.equals(rpt)) {
+                        dependencies.add(rpt);
                     }
                 }
             }
             // property definitions
-            for (int i = 0; i < propDefs.length; i++) {
+            for (QPropertyDefinition propDef : propDefs) {
                 // [WEAK]REFERENCE value constraints
-                if (propDefs[i].getRequiredType() == PropertyType.REFERENCE
-                        || propDefs[i].getRequiredType() == PropertyType.WEAKREFERENCE) {
-                    QValueConstraint[] ca = propDefs[i].getValueConstraints();
+                if (propDef.getRequiredType() == PropertyType.REFERENCE
+                        || propDef.getRequiredType() == PropertyType.WEAKREFERENCE) {
+                    QValueConstraint[] ca = propDef.getValueConstraints();
                     if (ca != null) {
-                        for (int j = 0; j < ca.length; j++) {
+                        for (QValueConstraint vc : ca) {
                             // TODO: don't rely on a specific factory
-                            Name ntName = NameFactoryImpl.getInstance().create(ca[j].getString());
+                            Name ntName = NameFactoryImpl.getInstance().create(vc.getString());
                             if (!name.equals(ntName)) {
                                 dependencies.add(ntName);
                             }
@@ -264,6 +263,7 @@
     /**
      * @see Object#equals(Object) 
      */
+    @Override
     public boolean equals(Object obj) {
         if (this == obj) {
             return true;
@@ -288,6 +288,7 @@
      *
      * @see Object#hashCode()
      */
+    @Override
     public int hashCode() {
         // TODO: can be calculated for the definition is immutable
         return 0;

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java Tue Feb 23 14:36:22 2010
@@ -85,18 +85,18 @@
         }
 
         if (pdefElement.hasAttribute(MULTIPLE_ATTRIBUTE)) {
-            multiple = Boolean.valueOf(pdefElement.getAttribute(MULTIPLE_ATTRIBUTE)).booleanValue();
+            multiple = Boolean.valueOf(pdefElement.getAttribute(MULTIPLE_ATTRIBUTE));
         } else {
             multiple = false;
         }
 
         if (pdefElement.hasAttribute(FULL_TEXT_SEARCHABLE_ATTRIBUTE)) {
-            fullTextSearcheable = Boolean.valueOf(pdefElement.getAttribute(FULL_TEXT_SEARCHABLE_ATTRIBUTE)).booleanValue();
+            fullTextSearcheable = Boolean.valueOf(pdefElement.getAttribute(FULL_TEXT_SEARCHABLE_ATTRIBUTE));
         } else {
             fullTextSearcheable = false;
         }
         if (pdefElement.hasAttribute(QUERY_ORDERABLE_ATTRIBUTE)) {
-            queryOrderable = Boolean.valueOf(pdefElement.getAttribute(QUERY_ORDERABLE_ATTRIBUTE)).booleanValue();
+            queryOrderable = Boolean.valueOf(pdefElement.getAttribute(QUERY_ORDERABLE_ATTRIBUTE));
         } else {
             queryOrderable = false;
         }
@@ -106,7 +106,7 @@
             // No default value defined at all.
             defaultValues = null;
         } else {
-            List vs = new ArrayList();
+            List<QValue> vs = new ArrayList<QValue>();
             ElementIterator it = DomUtil.getChildren(child, DEFAULTVALUE_ELEMENT, null);
             while (it.hasNext()) {
                 String jcrVal = DomUtil.getText(it.nextElement());
@@ -123,7 +123,7 @@
                 }
                 vs.add(qValue);
             }
-            defaultValues = (QValue[]) vs.toArray(new QValue[vs.size()]);
+            defaultValues = vs.toArray(new QValue[vs.size()]);
         }
 
         child = DomUtil.getChildElement(pdefElement, VALUECONSTRAINTS_ELEMENT, null);
@@ -226,6 +226,7 @@
      *         <code>false</code> otherwise
      * @see Object#equals(Object)
      */
+    @Override
     public boolean equals(Object obj) {
         if (this == obj) {
             return true;
@@ -249,6 +250,7 @@
      *
      * @return
      */
+    @Override
     public int hashCode() {
         if (hashCode == 0) {
             // build hashCode (format: <declaringNodeType>/<name>/<requiredType>/<multiple>)
@@ -270,9 +272,9 @@
             sb.append('/');
             sb.append(queryOrderable ? 1 : 0);
             sb.append('/');
-            Set s = new HashSet(availableQueryOperators.length);
-            for (int i = 0; i < availableQueryOperators.length; i++) {
-                s.add(availableQueryOperators[i]);
+            Set<String> s = new HashSet<String>(availableQueryOperators.length);
+            for (String availableQueryOperator : availableQueryOperators) {
+                s.add(availableQueryOperator);
             }
             sb.append(s.toString());
 

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QueryResultRowImpl.java Tue Feb 23 14:36:22 2010
@@ -70,7 +70,7 @@
 
         String jcrPath = resolver.getJCRName(NameConstants.JCR_PATH);
         String jcrScore = resolver.getJCRName(NameConstants.JCR_SCORE);
-        DavProperty davProp = okSet.get(SearchResultProperty.SEARCH_RESULT_PROPERTY);
+        DavProperty<?> davProp = okSet.get(SearchResultProperty.SEARCH_RESULT_PROPERTY);
         SearchResultProperty resultProp = new SearchResultProperty(davProp, valueFactory);
         Value[] values = resultProp.getValues();
         String[] names = resultProp.getColumnNames();

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java Tue Feb 23 14:36:22 2010
@@ -54,6 +54,7 @@
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.Subscription;
+import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.commons.ChildInfoImpl;
 import org.apache.jackrabbit.spi.commons.EventBundleImpl;
 import org.apache.jackrabbit.spi.commons.EventFilterImpl;
@@ -224,10 +225,10 @@
     private final URIResolverImpl uriResolver;
 
     private final HostConfiguration hostConfig;
-    private final HashMap clients = new HashMap();
+    private final Map<SessionInfo, HttpClient> clients = new HashMap<SessionInfo, HttpClient>();
     private final HttpConnectionManager connectionManager;
 
-    private final Map nodeTypeDefinitions = new HashMap();
+    private final Map<Name, QNodeTypeDefinition> nodeTypeDefinitions = new HashMap<Name, QNodeTypeDefinition>();
 
     private Map<String, QValue[]> descriptors;
 
@@ -360,7 +361,7 @@
     }
     
     protected HttpClient getClient(SessionInfo sessionInfo) throws RepositoryException {
-        HttpClient client = (HttpClient) clients.get(sessionInfo);
+        HttpClient client = clients.get(sessionInfo);
         if (client == null) {
             client = new HttpClient(connectionManager);
             client.setHostConfiguration(hostConfig);
@@ -381,7 +382,7 @@
     }
 
     private void removeClient(SessionInfo sessionInfo) {
-        HttpClient cl = (HttpClient) clients.remove(sessionInfo);
+        HttpClient cl = clients.remove(sessionInfo);
         log.debug("Removed Client " + cl + " for SessionInfo " + sessionInfo);
     }
 
@@ -401,7 +402,7 @@
         NodeId parentId = null;
         if (propSet.contains(ItemResourceConstants.JCR_PARENT)) {
             HrefProperty parentProp = new HrefProperty(propSet.get(ItemResourceConstants.JCR_PARENT));
-            String parentHref = parentProp.getHrefs().get(0).toString();
+            String parentHref = parentProp.getHrefs().get(0);
             if (parentHref != null && parentHref.length() > 0) {
                 parentId = uriResolver.getNodeId(parentHref, sessionInfo);
             }
@@ -418,7 +419,7 @@
     }
 
     Name getQName(DavPropertySet propSet, NamePathResolver resolver) throws RepositoryException {
-        DavProperty nameProp = propSet.get(ItemResourceConstants.JCR_NAME);
+        DavProperty<?> nameProp = propSet.get(ItemResourceConstants.JCR_NAME);
         if (nameProp != null && nameProp.getValue() != null) {
             // not root node. Note that 'unespacing' is not required since
             // the jcr:name property does not provide the value in escaped form.
@@ -435,7 +436,7 @@
 
     int getIndex(DavPropertySet propSet) {
         int index = Path.INDEX_UNDEFINED;
-        DavProperty indexProp = propSet.get(ItemResourceConstants.JCR_INDEX);
+        DavProperty<?> indexProp = propSet.get(ItemResourceConstants.JCR_INDEX);
         if (indexProp != null && indexProp.getValue() != null) {
             index = Integer.parseInt(indexProp.getValue().toString());
         }
@@ -507,7 +508,7 @@
                 method.checkSuccess();
                 Document doc = method.getResponseBodyAsDocument();
 
-                descriptors = new HashMap();
+                descriptors = new HashMap<String, QValue[]>();
                 if (doc != null) {
                     Element rootElement = doc.getDocumentElement();
                     ElementIterator nsElems = DomUtil.getChildren(rootElement, ItemResourceConstants.XML_DESCRIPTOR, ItemResourceConstants.NAMESPACE);
@@ -515,7 +516,7 @@
                         Element elem = nsElems.nextElement();
                         String key = DomUtil.getChildText(elem, ItemResourceConstants.XML_DESCRIPTORKEY, ItemResourceConstants.NAMESPACE);
                         ElementIterator it = DomUtil.getChildren(elem, ItemResourceConstants.XML_DESCRIPTORVALUE, ItemResourceConstants.NAMESPACE);
-                        List<QValue> vs = new ArrayList();
+                        List<QValue> vs = new ArrayList<QValue>();
                         while (it.hasNext()) {
                             Element dv = it.nextElement();
                             String descriptor = DomUtil.getText(dv);
@@ -594,7 +595,7 @@
                     throw new LoginException("Login failed: Invalid workspace name '" + workspaceName + "'.");
                 }
             } else if (props.contains(DeltaVConstants.WORKSPACE)) {
-                String wspHref = new HrefProperty(props.get(DeltaVConstants.WORKSPACE)).getHrefs().get(0).toString();
+                String wspHref = new HrefProperty(props.get(DeltaVConstants.WORKSPACE)).getHrefs().get(0);
                 String wspName = Text.unescape(Text.getName(wspHref, true));
                 if (!wspName.equals(workspaceName)) {
                     throw new LoginException("Login failed: Invalid workspace name " + workspaceName);
@@ -643,17 +644,17 @@
             method = new PropFindMethod(uriResolver.getRepositoryUri(), nameSet, DEPTH_1);
             getClient(sessionInfo).executeMethod(method);
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
-            Set wspNames = new HashSet();
-            for (int i = 0; i < responses.length; i++) {
-                DavPropertySet props = responses[i].getProperties(DavServletResponse.SC_OK);
+            Set<String> wspNames = new HashSet<String>();
+            for (MultiStatusResponse response : responses) {
+                DavPropertySet props = response.getProperties(DavServletResponse.SC_OK);
                 if (props.contains(DeltaVConstants.WORKSPACE)) {
                     HrefProperty hp = new HrefProperty(props.get(DeltaVConstants.WORKSPACE));
-                    String wspHref = hp.getHrefs().get(0).toString();
+                    String wspHref = hp.getHrefs().get(0);
                     String name = Text.unescape(Text.getName(wspHref, true));
                     wspNames.add(name);
                 }
             }
-            return (String[]) wspNames.toArray(new String[wspNames.size()]);
+            return wspNames.toArray(new String[wspNames.size()]);
         } catch (IOException e) {
             throw new RepositoryException(e);
         } catch (DavException e) {
@@ -683,20 +684,20 @@
             if (responses.length < 1) {
                 throw new ItemNotFoundException("Unable to retrieve permissions for item " + saveGetIdString(itemId, sessionInfo));
             }
-            DavProperty p = responses[0].getProperties(DavServletResponse.SC_OK).get(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
+            DavProperty<?> p = responses[0].getProperties(DavServletResponse.SC_OK).get(SecurityConstants.CURRENT_USER_PRIVILEGE_SET);
             if (p == null) {
                 return false;
             }
             // build set of privileges from given actions. NOTE: since the actions
             // have no qualifying namespace, the {@link ItemResourceConstants#NAMESPACE}
             // is used.
-            Set requiredPrivileges = new HashSet();
-            for (int i = 0; i < actions.length; i++) {
-               requiredPrivileges.add(Privilege.getPrivilege(actions[i], ItemResourceConstants.NAMESPACE));
+            Set<Privilege> requiredPrivileges = new HashSet<Privilege>();
+            for (String action : actions) {
+                requiredPrivileges.add(Privilege.getPrivilege(action, ItemResourceConstants.NAMESPACE));
             }
             // build set of privileges granted to the current user.
             CurrentUserPrivilegeSetProperty privSet = new CurrentUserPrivilegeSetProperty(p);
-            Collection privileges = (Collection) privSet.getValue();
+            Collection<Privilege> privileges = privSet.getValue();
 
             // check privileges present against required privileges.
             return privileges.containsAll(requiredPrivileges);
@@ -754,7 +755,7 @@
             DavPropertySet propertySet = responses[0].getProperties(DavServletResponse.SC_OK);
 
             // check if definition matches the type of the id
-            DavProperty rType = propertySet.get(DavPropertyName.RESOURCETYPE);
+            DavProperty<?> rType = propertySet.get(DavPropertyName.RESOURCETYPE);
             if (rType.getValue() == null && itemId.denotesNode()) {
                 throw new RepositoryException("Internal error: requested node definition and got property definition.");
             }
@@ -764,7 +765,7 @@
             // build the definition
             QItemDefinition definition = null;
             if (propertySet.contains(ItemResourceConstants.JCR_DEFINITION)) {
-                DavProperty prop = propertySet.get(ItemResourceConstants.JCR_DEFINITION);
+                DavProperty<?> prop = propertySet.get(ItemResourceConstants.JCR_DEFINITION);
                 Object value = prop.getValue();
                 if (value != null && value instanceof Element) {
                     Element idfElem = (Element) value;
@@ -819,12 +820,12 @@
             }
 
             MultiStatusResponse nodeResponse = null;
-            List childResponses = new ArrayList();
-            for (int i = 0; i < responses.length; i++) {
-                if (isSameResource(uri, responses[i])) {
-                    nodeResponse = responses[i];
+            List<MultiStatusResponse> childResponses = new ArrayList<MultiStatusResponse>();
+            for (MultiStatusResponse response : responses) {
+                if (isSameResource(uri, response)) {
+                    nodeResponse = response;
                 } else {
-                    childResponses.add(responses[i]);
+                    childResponses.add(response);
                 }
             }
 
@@ -844,11 +845,10 @@
 
             NodeInfoImpl nInfo = buildNodeInfo(nodeResponse, parentId, propSet, sessionInfo, resolver);
 
-            for (Iterator it = childResponses.iterator(); it.hasNext();) {
-                MultiStatusResponse resp = (MultiStatusResponse) it.next();
+            for (MultiStatusResponse resp : childResponses) {
                 DavPropertySet childProps = resp.getProperties(DavServletResponse.SC_OK);
                 if (childProps.contains(DavPropertyName.RESOURCETYPE) &&
-                    childProps.get(DavPropertyName.RESOURCETYPE).getValue() != null) {
+                        childProps.get(DavPropertyName.RESOURCETYPE).getValue() != null) {
                     // any other resource type than default (empty) is represented by a node item
                     // --> build child info object
                     nInfo.addChildInfo(buildChildInfo(childProps, sessionInfo));
@@ -874,11 +874,11 @@
     /**
      * @see RepositoryService#getItemInfos(SessionInfo, NodeId)
      */
-    public Iterator getItemInfos(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException {
+    public Iterator<? extends ItemInfo> getItemInfos(SessionInfo sessionInfo, NodeId nodeId) throws RepositoryException {
         // TODO: implement batch read properly:
         // currently: missing 'value/values' property PropertyInfo cannot be built
         // currently: missing prop-names with child-NodeInfo
-        List l = new ArrayList();
+        List<ItemInfo> l = new ArrayList<ItemInfo>();
         NodeInfo nInfo = getNodeInfo(sessionInfo, nodeId);
         l.add(nInfo);
         // at least add propertyInfos for the meta-props already known from the
@@ -895,9 +895,7 @@
         NodeInfoImpl nInfo = new NodeInfoImpl(id, propSet, resolver);
         if (propSet.contains(ItemResourceConstants.JCR_REFERENCES)) {
             HrefProperty refProp = new HrefProperty(propSet.get(ItemResourceConstants.JCR_REFERENCES));
-            Iterator hrefIter = refProp.getHrefs().iterator();
-            while(hrefIter.hasNext()) {
-                String propertyHref = hrefIter.next().toString();
+            for (String propertyHref : refProp.getHrefs()) {
                 PropertyId propertyId = uriResolver.getPropertyId(propertyHref, sessionInfo);
                 nInfo.addReference(propertyId);
             }
@@ -905,8 +903,8 @@
         return nInfo;
     }
 
-    private List buildPropertyInfos(NodeInfo nInfo) throws RepositoryException {
-        List l = new ArrayList(3);
+    private List<PropertyInfo> buildPropertyInfos(NodeInfo nInfo) throws RepositoryException {
+        List<PropertyInfo> l = new ArrayList<PropertyInfo>(3);
         NodeId nid = nInfo.getId();
         Path nPath = nInfo.getPath();
 
@@ -943,7 +941,7 @@
     /**
      * @see RepositoryService#getChildInfos(SessionInfo, NodeId)
      */
-    public Iterator getChildInfos(SessionInfo sessionInfo, NodeId parentId) throws RepositoryException {
+    public Iterator<ChildInfo> getChildInfos(SessionInfo sessionInfo, NodeId parentId) throws RepositoryException {
         // set of properties to be retrieved
         DavPropertyNameSet nameSet = new DavPropertyNameSet();
         nameSet.add(ItemResourceConstants.JCR_NAME);
@@ -959,18 +957,19 @@
             getClient(sessionInfo).executeMethod(method);
             method.checkSuccess();
 
+            List<ChildInfo> childEntries;
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length < 1) {
                 throw new ItemNotFoundException("Unable to retrieve the node with id " + saveGetIdString(parentId, sessionInfo));
             } else if (responses.length == 1) {
                 // no child nodes nor properties
-                return Collections.EMPTY_LIST.iterator();
+                childEntries = Collections.emptyList();
+                return childEntries.iterator();
             }
 
-            List childEntries = new ArrayList();
-            for (int i = 0; i < responses.length; i++) {
-                if (!isSameResource(uri, responses[i])) {
-                    MultiStatusResponse resp = responses[i];
+            childEntries = new ArrayList<ChildInfo>();
+            for (MultiStatusResponse resp : responses) {
+                if (!isSameResource(uri, resp)) {
                     DavPropertySet childProps = resp.getProperties(DavServletResponse.SC_OK);
                     if (childProps.contains(DavPropertyName.RESOURCETYPE) &&
                         childProps.get(DavPropertyName.RESOURCETYPE).getValue() != null) {
@@ -1022,24 +1021,21 @@
                 throw new ItemNotFoundException("Unable to retrieve the node with id " + saveGetIdString(nodeId, sessionInfo));
             }
 
-            List<PropertyId> refIds = new ArrayList<PropertyId>();
-            for (int i = 0; i < responses.length; i++) {
-                if (isSameResource(uri, responses[i])) {
-                    MultiStatusResponse resp = responses[i];
+            List<PropertyId> refIds = Collections.emptyList();
+            for (MultiStatusResponse resp : responses) {
+                if (isSameResource(uri, resp)) {
                     DavPropertySet props = resp.getProperties(DavServletResponse.SC_OK);
-                    DavProperty p;
+                    DavProperty<?> p;
                     if (weakReferences) {
                         p = props.get(ItemResourceConstants.JCR_WEAK_REFERENCES);
                     } else {
                         p = props.get(ItemResourceConstants.JCR_REFERENCES);
                     }
 
-                    if (p == null) {
-                        return Collections.EMPTY_LIST.iterator();
-                    } else {
+                    if (p != null) {
+                        refIds = new ArrayList<PropertyId>();
                         HrefProperty hp = new HrefProperty(p);
-                        for (Iterator it = hp.getHrefs().iterator(); it.hasNext();) {
-                            String propHref = it.next().toString();
+                        for (String propHref : hp.getHrefs()) {
                             PropertyId propId = uriResolver.getPropertyId(propHref, sessionInfo);
                             if (propertyName == null || propertyName.equals(propId.getName())) {
                                 refIds.add(propId);
@@ -1142,7 +1138,7 @@
                 // not representation of a jcr-property
                 throw new ItemNotFoundException("No property found at " + saveGetIdString(id, resolver));
             } else {
-                DavProperty p = DefaultDavProperty.createFromXml(prop);
+                DavProperty<?> p = DefaultDavProperty.createFromXml(prop);
                 ValuesProperty vp = new ValuesProperty(p, PropertyType.STRING, valueFactory);
 
                 Value[] jcrVs = vp.getJcrValues();
@@ -1187,7 +1183,7 @@
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length == 1) {
                 DavPropertySet props = responses[0].getProperties(DavServletResponse.SC_OK);
-                DavProperty type = props.get(ItemResourceConstants.JCR_TYPE);
+                DavProperty<?> type = props.get(ItemResourceConstants.JCR_TYPE);
                 if (type != null) {
                     return PropertyType.valueFromName(type.getValue().toString());
                 } else {
@@ -1197,7 +1193,9 @@
                 throw new ItemNotFoundException("Internal error. Cannot retrieve property type at " + saveGetIdString(propertyId, resolver));
             }
         } finally {
-            method.releaseConnection();
+            if (method != null) {
+                method.releaseConnection();
+            }
         }
     }
 
@@ -1228,9 +1226,9 @@
             boolean success = false;
 
             try {
-                Iterator it = batchImpl.methods();
+                Iterator<DavMethod> it = batchImpl.methods();
                 while (it.hasNext()) {
-                    method = (DavMethod) it.next();
+                    method = it.next();
                     initMethod(method, batchImpl, true);
 
                     client.executeMethod(method);
@@ -1261,7 +1259,7 @@
         Name nodeName = getNameFactory().create(Name.NS_DEFAULT_URI, UUID.randomUUID().toString());
         String uri = getItemUri(parentId, nodeName, sessionInfo);
         MkColMethod method = new MkColMethod(uri);
-        method.addRequestHeader(ItemResourceConstants.IMPORT_UUID_BEHAVIOR, new Integer(uuidBehaviour).toString());
+        method.addRequestHeader(ItemResourceConstants.IMPORT_UUID_BEHAVIOR, Integer.toString(uuidBehaviour));
         method.setRequestEntity(new InputStreamRequestEntity(xmlStream, "text/xml"));
         execute(method, sessionInfo);
     }
@@ -1330,7 +1328,7 @@
 
             DavPropertySet ps = responses[0].getProperties(DavServletResponse.SC_OK);
             if (ps.contains(DavPropertyName.LOCKDISCOVERY)) {
-                DavProperty p = ps.get(DavPropertyName.LOCKDISCOVERY);
+                DavProperty<?> p = ps.get(DavPropertyName.LOCKDISCOVERY);
                 LockDiscovery ld = LockDiscovery.createFromXml(p.toXml(domFactory));
                 NodeId parentId = getParentId(ps, sessionInfo);
                 return retrieveLockInfo(ld, sessionInfo, nodeId, parentId);
@@ -1421,11 +1419,9 @@
 
     private LockInfo retrieveLockInfo(LockDiscovery lockDiscovery, SessionInfo sessionInfo,
                                       NodeId nodeId, NodeId parentId) throws RepositoryException {
-        List activeLocks = (List) lockDiscovery.getValue();
-        Iterator it = activeLocks.iterator();
+        List<ActiveLock> activeLocks = lockDiscovery.getValue();
         ActiveLock activeLock = null;
-        while (it.hasNext()) {
-            ActiveLock l = (ActiveLock) it.next();
+        for (ActiveLock l : activeLocks) {
             Scope sc = l.getScope();
             if (l.getType() == Type.WRITE && (sc == Scope.EXCLUSIVE || sc == ItemResourceConstants.EXCLUSIVE_SESSION)) {
                 if (activeLock != null) {
@@ -1542,14 +1538,14 @@
     /**
      * @see RepositoryService#merge(SessionInfo, NodeId, String, boolean)
      */
-    public Iterator merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+    public Iterator<NodeId> merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
         return merge(sessionInfo, nodeId, srcWorkspaceName, bestEffort, false);
     }
 
     /**
      * @see RepositoryService#merge(SessionInfo, NodeId, String, boolean, boolean)
      */
-    public Iterator merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+    public Iterator<NodeId> merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
         if (!isShallow) {
             try {
                 String wspHref = uriResolver.getWorkspaceUri(srcWorkspaceName);
@@ -1560,9 +1556,9 @@
                 execute(method, sessionInfo);
 
                 MultiStatusResponse[] resps = method.getResponseBodyAsMultiStatus().getResponses();
-                List failedIds = new ArrayList(resps.length);
-                for (int i = 0; i < resps.length; i++) {
-                    String href = resps[i].getHref();
+                List<NodeId> failedIds = new ArrayList<NodeId>(resps.length);
+                for (MultiStatusResponse resp : resps) {
+                    String href = resp.getHref();
                     failedIds.add(uriResolver.getNodeId(href, sessionInfo));
                 }
                 return failedIds.iterator();
@@ -1582,7 +1578,7 @@
      */
     public void resolveMergeConflict(SessionInfo sessionInfo, NodeId nodeId, NodeId[] mergeFailedIds, NodeId[] predecessorIds) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
         try {
-            List changeList = new ArrayList();
+            List<HrefProperty> changeList = new ArrayList<HrefProperty>();
             String[] mergeFailedHref = new String[mergeFailedIds.length];
             for (int i = 0; i < mergeFailedIds.length; i++) {
                 mergeFailedHref[i] = getItemUri(mergeFailedIds[i], sessionInfo);
@@ -1651,7 +1647,7 @@
     /**
      * @see RepositoryService#mergeActivity(SessionInfo, NodeId)
      */
-    public Iterator mergeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+    public Iterator<NodeId> mergeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
         // TODO
         throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
     }
@@ -1688,7 +1684,7 @@
     public String[] checkQueryStatement(SessionInfo sessionInfo,
                                     String statement,
                                     String language,
-                                    Map namespaces)
+                                    Map<String, String> namespaces)
             throws InvalidQueryException, RepositoryException {
         // TODO implement
         return new String[0];
@@ -1746,16 +1742,16 @@
             throws UnsupportedRepositoryOperationException, RepositoryException {
         // resolve node type names
         // todo what if new node types become available while event filter is still in use?
-        Set resolvedTypeNames = null;
+        Set<Name> resolvedTypeNames = null;
         if (nodeTypeNames != null) {
-            resolvedTypeNames = new HashSet();
+            resolvedTypeNames = new HashSet<Name>();
             // make sure node type definitions are available
             if (nodeTypeDefinitions.size() == 0) {
                 getQNodeTypeDefinitions(sessionInfo);
             }
             synchronized (nodeTypeDefinitions) {
-                for (int i = 0; i < nodeTypeNames.length; i++) {
-                    resolveNodeType(resolvedTypeNames, nodeTypeNames[i]);
+                for (Name nodeTypeName : nodeTypeNames) {
+                    resolveNodeType(resolvedTypeNames, nodeTypeName);
                 }
             }
         }
@@ -1867,15 +1863,14 @@
         }
     }
 
-    private void resolveNodeType(Set resolved, Name ntName) {
+    private void resolveNodeType(Set<Name> resolved, Name ntName) {
         if (!resolved.add(ntName)) {
             return;
         }
-        QNodeTypeDefinition def = (QNodeTypeDefinition) nodeTypeDefinitions.get(ntName);
+        QNodeTypeDefinition def = nodeTypeDefinitions.get(ntName);
         if (def != null) {
-            Name[] supertypes = def.getSupertypes();
-            for (int i = 0; i < supertypes.length; i++) {
-                resolveNodeType(resolved, supertypes[i]);
+            for (Name supertype : def.getSupertypes()) {
+                resolveNodeType(resolved, supertype);
             }
         }
     }
@@ -1896,7 +1891,7 @@
                 ElementIterator it = DomUtil.getChildren(discEl,
                         ObservationConstants.XML_EVENTBUNDLE,
                         ObservationConstants.NAMESPACE);
-                List bundles = new ArrayList();
+                List<EventBundle> bundles = new ArrayList<EventBundle>();
                 while (it.hasNext()) {
                     Element bundleElement = it.nextElement();
                     String value = DomUtil.getAttribute(bundleElement,
@@ -1911,7 +1906,7 @@
                             buildEventList(bundleElement, sessionInfo),
                             isLocal));
                 }
-                events = (EventBundle[]) bundles.toArray(new EventBundle[bundles.size()]);
+                events = bundles.toArray(new EventBundle[bundles.size()]);
             }
             return events;
         } catch (IOException e) {
@@ -1925,8 +1920,8 @@
         }
     }
 
-    private List buildEventList(Element bundleElement, SessionInfoImpl sessionInfo) {
-        List events = new ArrayList();
+    private List<Event> buildEventList(Element bundleElement, SessionInfoImpl sessionInfo) {
+        List<Event> events = new ArrayList<Event>();
         ElementIterator eventElementIterator = DomUtil.getChildren(bundleElement, ObservationConstants.XML_EVENT, ObservationConstants.NAMESPACE);
         while (eventElementIterator.hasNext()) {
             Element evElem = eventElementIterator.nextElement();
@@ -1983,7 +1978,7 @@
     /**
      * @see RepositoryService#getRegisteredNamespaces(SessionInfo)
      */
-    public Map getRegisteredNamespaces(SessionInfo sessionInfo) throws RepositoryException {
+    public Map<String, String> getRegisteredNamespaces(SessionInfo sessionInfo) throws RepositoryException {
         ReportInfo info = new ReportInfo(RegisteredNamespacesReport.REGISTERED_NAMESPACES_REPORT, DEPTH_0);
         ReportMethod method = null;
         try {
@@ -1992,7 +1987,7 @@
             method.checkSuccess();
 
             Document doc = method.getResponseBodyAsDocument();
-            Map namespaces = new HashMap();
+            Map<String, String> namespaces = new HashMap<String, String>();
             if (doc != null) {
                 Element rootElement = doc.getDocumentElement();
                 ElementIterator nsElems = DomUtil.getChildren(rootElement, ItemResourceConstants.XML_NAMESPACE, ItemResourceConstants.NAMESPACE);
@@ -2061,7 +2056,7 @@
         // make sure we have them all
         getRegisteredNamespaces(sessionInfo);
 
-        Map namespaces = new HashMap(nsCache.getNamespaces());
+        Map<String, String> namespaces = new HashMap<String, String>(nsCache.getNamespaces());
         // add new pair that needs to be registered.
         namespaces.put(prefix, uri);
 
@@ -2079,7 +2074,7 @@
         getRegisteredNamespaces(sessionInfo);
 
         String prefix = nsCache.getPrefix(uri);
-        Map namespaces = new HashMap(nsCache.getNamespaces());
+        Map<String, String> namespaces = new HashMap<String, String>(nsCache.getNamespaces());
         // remove pair that needs to be unregistered
         namespaces.remove(prefix);
 
@@ -2097,7 +2092,7 @@
      * @throws AccessDeniedException
      * @throws RepositoryException
      */
-    private void internalSetNamespaces(SessionInfo sessionInfo, Map namespaces) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException {
+    private void internalSetNamespaces(SessionInfo sessionInfo, Map<String, String> namespaces) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException {
         DavPropertySet setProperties = new DavPropertySet();
         setProperties.add(new NamespacesProperty(namespaces));
 
@@ -2124,7 +2119,7 @@
     /**
      * @see RepositoryService#getQNodeTypeDefinitions(SessionInfo)
      */
-    public Iterator getQNodeTypeDefinitions(SessionInfo sessionInfo) throws RepositoryException {
+    public Iterator<QNodeTypeDefinition> getQNodeTypeDefinitions(SessionInfo sessionInfo) throws RepositoryException {
         ReportInfo info = new ReportInfo(NodeTypesReport.NODETYPES_REPORT, DEPTH_0);
         info.setContentElement(DomUtil.createElement(domFactory, NodeTypeConstants.XML_REPORT_ALLNODETYPES, NodeTypeConstants.NAMESPACE));
 
@@ -2151,7 +2146,7 @@
     /**
      * {@inheritDoc}
      */
-    public Iterator getQNodeTypeDefinitions(SessionInfo sessionInfo, Name[] nodetypeNames) throws RepositoryException {
+    public Iterator<QNodeTypeDefinition> getQNodeTypeDefinitions(SessionInfo sessionInfo, Name[] nodetypeNames) throws RepositoryException {
         // in order to avoid individual calls for every nodetype, retrieve
         // the complete set from the server (again).
         return getQNodeTypeDefinitions(sessionInfo);
@@ -2196,9 +2191,9 @@
      * @return
      * @throws RepositoryException
      */
-    private Iterator retrieveQNodeTypeDefinitions(SessionInfo sessionInfo, Document reportDoc) throws RepositoryException {
+    private Iterator<QNodeTypeDefinition> retrieveQNodeTypeDefinitions(SessionInfo sessionInfo, Document reportDoc) throws RepositoryException {
         ElementIterator it = DomUtil.getChildren(reportDoc.getDocumentElement(), NodeTypeConstants.NODETYPE_ELEMENT, null);
-            List ntDefs = new ArrayList();
+            List<QNodeTypeDefinition> ntDefs = new ArrayList<QNodeTypeDefinition>();
             NamePathResolver resolver = getNamePathResolver(sessionInfo);
             while (it.hasNext()) {
                 ntDefs.add(new QNodeTypeDefinitionImpl(it.nextElement(), resolver, getQValueFactory()));
@@ -2206,8 +2201,8 @@
             // refresh node type definitions map
             synchronized (nodeTypeDefinitions) {
                 nodeTypeDefinitions.clear();
-                for (Iterator defIt = ntDefs.iterator(); defIt.hasNext(); ) {
-                    QNodeTypeDefinition def = (QNodeTypeDefinition) defIt.next();
+                for (Object ntDef : ntDefs) {
+                    QNodeTypeDefinition def = (QNodeTypeDefinition) ntDef;
                     nodeTypeDefinitions.put(def.getName(), def);
                 }
             }
@@ -2229,7 +2224,7 @@
 
         private final SessionInfo sessionInfo;
         private final ItemId targetId;
-        private final List methods = new ArrayList();
+        private final List<DavMethod> methods = new ArrayList<DavMethod>();
         private final NamePathResolver resolver;
 
         private String batchId;
@@ -2313,7 +2308,7 @@
             return methods.isEmpty();
         }
 
-        private Iterator methods() {
+        private Iterator<DavMethod> methods() {
             return methods.iterator();
         }
 
@@ -2724,11 +2719,11 @@
      */
     private static class NamespaceCache extends AbstractNamespaceResolver {
 
-        private final HashMap prefixToURI = new HashMap();
-        private final HashMap uriToPrefix = new HashMap();
+        private final HashMap<String, String> prefixToURI = new HashMap<String, String>();
+        private final HashMap<String, String> uriToPrefix = new HashMap<String, String>();
 
-        public Map getNamespaces() {
-            return new HashMap(prefixToURI);
+        public Map<String, String> getNamespaces() {
+            return new HashMap<String, String>(prefixToURI);
         }
 
         public void add(String prefix, String uri) {
@@ -2744,7 +2739,7 @@
         //----------------------------------------------< NamespaceResolver >---
 
         public String getURI(String prefix) throws NamespaceException {
-            String uri = (String) prefixToURI.get(prefix);
+            String uri = prefixToURI.get(prefix);
             if (uri != null) {
                 return uri;
             } else {
@@ -2753,7 +2748,7 @@
         }
 
         public String getPrefix(String uri) throws NamespaceException {
-            String prefix = (String) uriToPrefix.get(uri);
+            String prefix = uriToPrefix.get(uri);
             if (prefix != null) {
                 return prefix;
             } else {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/SessionInfoImpl.java Tue Feb 23 14:36:22 2010
@@ -28,7 +28,7 @@
 public class SessionInfoImpl extends org.apache.jackrabbit.spi.commons.SessionInfoImpl {
 
     private final CredentialsWrapper credentials;
-    private final Set sessionScopedTokens = new HashSet();
+    private final Set<String> sessionScopedTokens = new HashSet<String>();
 
     private String lastBatchId;
     private NamePathResolver resolver;
@@ -43,6 +43,7 @@
     /**
      * @inheritDoc
      */
+    @Override
     public String getUserID() {
         return credentials.getUserId();
     }
@@ -90,9 +91,9 @@
      * JCR API for they belong to session-scoped locks.
      */
     String[] getAllLockTokens() {
-        Set s = new HashSet(Arrays.asList(getLockTokens()));
+        Set<String> s = new HashSet<String>(Arrays.asList(getLockTokens()));
         s.addAll(sessionScopedTokens);
-        return (String[]) s.toArray(new String[s.size()]);
+        return s.toArray(new String[s.size()]);
     }
 
     void addLockToken(String token, boolean sessionScoped) {
@@ -110,4 +111,4 @@
             super.removeLockToken(token);
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/URIResolverImpl.java Tue Feb 23 14:36:22 2010
@@ -60,7 +60,7 @@
 
     // TODO: to-be-fixed. uri/id-caches don't get updated
     // for each workspace a separate idUri-cache is created
-    private final Map idURICaches = new HashMap();
+    private final Map<String, IdURICache> idURICaches = new HashMap<String, IdURICache>();
 
     URIResolverImpl(URI repositoryUri, RepositoryServiceImpl service, Document domFactory) {
         this.repositoryUri = repositoryUri;
@@ -70,7 +70,7 @@
 
     private IdURICache getCache(String workspaceName) {
         if (idURICaches.containsKey(workspaceName)) {
-            return (IdURICache) idURICaches.get(workspaceName);
+            return idURICaches.get(workspaceName);
         } else {
             IdURICache c = new IdURICache(getWorkspaceUri(workspaceName));
             idURICaches.put(workspaceName, c);
@@ -324,4 +324,4 @@
             throw new RepositoryException(e);
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ChildInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ChildInfoImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ChildInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ChildInfoImpl.java Tue Feb 23 14:36:22 2010
@@ -82,12 +82,15 @@
     /**
      * @see Object#hashCode()
      */
+    @Override
     public int hashCode() {
         // build hashCode (format: <name>/<name>/<index>/<uniqueID>)
         if (hashCode == 0) {
             StringBuffer sb = new StringBuffer();
             sb.append(name.toString());
+            sb.append("/");
             sb.append(index);
+            sb.append("/");
             if (uniqueId != null) {
                 sb.append(uniqueId);
             }
@@ -99,6 +102,7 @@
     /**
      * @see Object#equals(Object)
      */
+    @Override
     public boolean equals(Object object) {
         if (object == this) {
             return true;
@@ -114,6 +118,7 @@
     /**
      * @see Object#toString()
      */
+    @Override
     public String toString() {
         StringBuffer sb = new StringBuffer();
         sb.append(name.toString());

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/GetMethod.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/GetMethod.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/GetMethod.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/GetMethod.java Tue Feb 23 14:36:22 2010
@@ -33,11 +33,13 @@
         super(uri);
     }
 
+    @Override
     public String getName() {
         return DavMethods.METHOD_GET;
     }
 
+    @Override
     protected boolean isSuccess(int statusCode) {
         return statusCode == DavServletResponse.SC_OK;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ItemInfoJSONHandler.java Tue Feb 23 14:36:22 2010
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
@@ -49,7 +50,7 @@
 
     private static final int SPECIAL_JSON_PAIR = Integer.MAX_VALUE;
 
-    private final List itemInfos;
+    private final List<ItemInfo> itemInfos;
     private final NamePathResolver resolver;
     private final String rootURI;
 
@@ -61,7 +62,7 @@
     private int propertyType;
     private int index = Path.INDEX_DEFAULT;
 
-    private Stack nodeInfos = new Stack();
+    private Stack<NodeInfo> nodeInfos = new Stack<NodeInfo>();
     private PropertyInfoImpl mvPropInfo;
 
     ItemInfoJsonHandler(NamePathResolver resolver, NodeInfo nInfo,
@@ -76,7 +77,7 @@
         this.pFactory = pFactory;
         this.idFactory = idFactory;
 
-        itemInfos = new ArrayList();
+        itemInfos = new ArrayList<ItemInfo>();
         itemInfos.add(nInfo);
         nodeInfos.push(nInfo);
     }
@@ -265,12 +266,12 @@
         }
     }
 
-    Iterator getItemInfos() {
+    Iterator<? extends ItemInfo> getItemInfos() {
         return Collections.unmodifiableList(itemInfos).iterator();
     }
 
     private NodeInfoImpl getCurrentNodeInfo() {
-        return  (nodeInfos.isEmpty()) ? (NodeInfoImpl) null : (NodeInfoImpl) nodeInfos.peek();
+        return  (nodeInfos.isEmpty()) ? null : (NodeInfoImpl) nodeInfos.peek();
     }
 
     private PropertyInfoImpl createPropertyInfo(QValue value, boolean isMultiValued) throws RepositoryException {
@@ -314,4 +315,4 @@
             return PropertyType.UNDEFINED;
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/NodeInfoImpl.java Tue Feb 23 14:36:22 2010
@@ -16,15 +16,6 @@
  */
 package org.apache.jackrabbit.spi2davex;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.jcr.RepositoryException;
-
 import org.apache.jackrabbit.spi.ChildInfo;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.Name;
@@ -35,26 +26,28 @@
 import org.apache.jackrabbit.spi.PropertyInfo;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import javax.jcr.RepositoryException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.LinkedHashSet;
 
 /**
  * <code>NodeInfoImpl</code>...
  */
 public class NodeInfoImpl extends ItemInfoImpl implements NodeInfo {
 
-    private static Logger log = LoggerFactory.getLogger(NodeInfoImpl.class);
-
     private NodeId id;
     private String uniqueID;
     private Name primaryNodeTypeName;
     private Name[] mixinNodeTypeNames = new Name[0];
 
-    private final Set propertyInfos = new LinkedHashSet();
+    private final Set<PropertyInfo> propertyInfos = new LinkedHashSet<PropertyInfo>();
     private Set<ChildInfo> childInfos = null;
 
-    private final int numberOfChildNodes = -1;
-
     /**
      * Creates a new <code>NodeInfo</code>.
      *
@@ -88,16 +81,15 @@
         return new PropertyId[0];
     }
 
-    public Iterator getPropertyIds() {
-        List l = new ArrayList();
-        for (Iterator it = propertyInfos.iterator(); it.hasNext(); ) {
-            PropertyId pId = ((PropertyInfo) it.next()).getId();
-            l.add(pId);
+    public Iterator<PropertyId> getPropertyIds() {
+        List<PropertyId> l = new ArrayList<PropertyId>();
+        for (PropertyInfo propertyInfo : propertyInfos) {
+            l.add(propertyInfo.getId());
         }
         return l.iterator();
     }
 
-    public Iterator getChildInfos() {
+    public Iterator<ChildInfo> getChildInfos() {
         return (childInfos == null) ? null : childInfos.iterator();
     }
 
@@ -148,4 +140,4 @@
     String getUniqueID() {
         return uniqueID;
     }
-}
+}
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PostMethod.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PostMethod.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PostMethod.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PostMethod.java Tue Feb 23 14:36:22 2010
@@ -43,7 +43,7 @@
     /**
      * The buffered request body consisting of <code>NameValuePair</code>s.
      */
-    private List params = new ArrayList();
+    private List<NameValuePair> params = new ArrayList<NameValuePair>();
 
     public PostMethod(String uri) {
         super(uri);
@@ -52,18 +52,21 @@
     }
 
     // -----------------------------------------------------< DavMethodBase >---
+    @Override
     protected boolean isSuccess(int statusCode) {
         return statusCode == DavServletResponse.SC_OK ||
                 statusCode == DavServletResponse.SC_NO_CONTENT ||
                 statusCode == DavServletResponse.SC_CREATED;
     }
 
+    @Override
     public String getName() {
         return DavMethods.METHOD_POST;
     }
 
     // COPIED FROM httpclient PostMethod.
     // ---------------------------------------------< EntityEnclosingMethod >---
+    @Override
     protected boolean hasRequestContent() {
         if (!params.isEmpty()) {
             return true;
@@ -72,12 +75,14 @@
         }
     }
 
+    @Override
     protected void clearRequestBody() {
         log.debug("enter PostMethod.clearRequestBody()");
         this.params.clear();
         super.clearRequestBody();
     }
 
+    @Override
     protected RequestEntity generateRequestEntity() {
         if (!this.params.isEmpty()) {
             // Use a ByteArrayRequestEntity instead of a StringRequestEntity.
@@ -85,7 +90,7 @@
             // are ASCII by definition but the content type may not be.  Treating the content
             // as bytes allows us to keep the current charset without worrying about how
             // this charset will effect the encoding of the form url encoded string.
-            NameValuePair[] mvps = (NameValuePair[]) params.toArray(new NameValuePair[params.size()]);
+            NameValuePair[] mvps = params.toArray(new NameValuePair[params.size()]);
             String content = EncodingUtil.formUrlEncode(mvps, getRequestCharSet());
             ByteArrayRequestEntity entity = new ByteArrayRequestEntity(
                     EncodingUtil.getAsciiBytes(content),
@@ -117,4 +122,4 @@
         params.add(new NameValuePair(paramName, paramValue));
     }
     // COPIED FROM httpclient PostMethod.
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PropertyInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PropertyInfoImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PropertyInfoImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/PropertyInfoImpl.java Tue Feb 23 14:36:22 2010
@@ -35,7 +35,7 @@
 
     private PropertyId id;
     private int propertyType;
-    private List values = new ArrayList();
+    private List<QValue> values = new ArrayList<QValue>();
 
     public PropertyInfoImpl(PropertyId id, Path path, int propertyType,
                             QValue singleValue) throws RepositoryException {
@@ -72,7 +72,7 @@
     }
 
     public QValue[] getValues() {
-        return (QValue[]) values.toArray(new QValue[values.size()]);
+        return values.toArray(new QValue[values.size()]);
     }
 
     //--------------------------------------------------------------------------
@@ -86,7 +86,7 @@
 
     void addValue(QValue value) throws RepositoryException {
         if (values == null) {
-            values = new ArrayList();
+            values = new ArrayList<QValue>();
         } else if (!isMultiValued && !values.isEmpty()) {
             throw new RepositoryException("Attempt to add multiple values to a single valued PropertyInfo");
         }
@@ -105,4 +105,4 @@
             throw new RepositoryException("Incomplete PropertyInfo: missing type of multivalued property.");
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/QValueFactoryImpl.java Tue Feb 23 14:36:22 2010
@@ -238,6 +238,7 @@
          *         or -1L if the length can't be determined.
          * @see QValue#getLength()
          */
+        @Override
         public long getLength() {
             if (file != null) {
                 // this instance is backed by a 'real' file
@@ -286,6 +287,7 @@
         /**
          * @see QValue#getName()
          */
+        @Override
         public Name getName() throws RepositoryException {
             throw new UnsupportedOperationException();
         }
@@ -293,6 +295,7 @@
         /**
          * @see QValue#getPath()
          */
+        @Override
         public Path getPath() throws RepositoryException {
             throw new UnsupportedOperationException();
         }
@@ -303,6 +306,7 @@
          * calling this method will have no effect.
          * @see QValue#discard()
          */
+        @Override
         public void discard() {
             if (!temp) {
                 // do nothing if this instance is not backed by temporarily
@@ -328,6 +332,7 @@
          *
          * @return A string representation of this <code>BinaryQValue</code> instance.
          */
+        @Override
         public String toString() {
             if (file != null) {
                 // this instance is backed by a 'real' file
@@ -343,6 +348,7 @@
         /**
          * {@inheritDoc}
          */
+        @Override
         public boolean equals(Object obj) {
             if (this == obj) {
                 return true;
@@ -379,6 +385,7 @@
          * @return always zero
          * @see Object#hashCode()
          */
+        @Override
         public int hashCode() {
             return 0;
         }
@@ -450,7 +457,7 @@
                     DocumentBuilder db = DomUtil.BUILDER_FACTORY.newDocumentBuilder();
                     Document doc = db.parse(in);
                     Element prop = DomUtil.getChildElement(doc, ItemResourceConstants.JCR_VALUES.getName(), ItemResourceConstants.JCR_VALUES.getNamespace());
-                    DavProperty p = DefaultDavProperty.createFromXml(prop);
+                    DavProperty<?> p = DefaultDavProperty.createFromXml(prop);
                     ValuesProperty vp = new ValuesProperty(p, PropertyType.BINARY, vf);
 
                     Value[] jcrVs = vp.getJcrValues();



Mime
View raw message