jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r915333 [2/3] - in /jackrabbit/trunk/jackrabbit-webdav/src: main/java/org/apache/jackrabbit/webdav/ main/java/org/apache/jackrabbit/webdav/bind/ main/java/org/apache/jackrabbit/webdav/client/methods/ main/java/org/apache/jackrabbit/webdav/h...
Date Tue, 23 Feb 2010 13:27:13 GMT
Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/IfHeader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/IfHeader.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/IfHeader.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/IfHeader.java Tue Feb 23 13:27:10 2010
@@ -97,11 +97,11 @@
     /**
      * The list of all positive tokens present in the If header.
      */
-    private List allTokens = new ArrayList();
+    private List<String> allTokens = new ArrayList<String>();
     /**
      * The list of all NOT tokens present in the If header.
      */
-    private List allNotTokens = new ArrayList();
+    private List<String> allNotTokens = new ArrayList<String>();
 
     /**
      * Create a Untagged <code>IfHeader</code> if the given lock tokens.
@@ -111,9 +111,9 @@
     public IfHeader(String[] tokens) {
         allTokens.addAll(Arrays.asList(tokens));
         StringBuffer b = new StringBuffer();
-        for (int i = 0; i < tokens.length; i++) {
+        for (String token : tokens) {
             b.append("(").append("<");
-            b.append(tokens[i]);
+            b.append(token);
             b.append(">").append(")");
         }
         headerValue = b.toString();
@@ -194,7 +194,7 @@
      * @return an iterator over all tokens present in the if header, that were
      * not denied by a leading NOT statement.
      */
-    public Iterator getAllTokens() {
+    public Iterator<String> getAllTokens() {
         return allTokens.iterator();
     }
 
@@ -202,7 +202,7 @@
      * @return an iterator over all NOT tokens present in the if header, that
      * were explicitly denied.
      */
-    public Iterator getAllNotTokens() {
+    public Iterator<String> getAllNotTokens() {
         return allNotTokens.iterator();
     }
 
@@ -265,7 +265,7 @@
         IfHeaderMap map = new IfHeaderMap();
         try {
             while (true) {
-                // read next non-whitespace
+                // read next non-white space
                 int c = readWhiteSpace(reader);
                 if (c < 0) {
                     // end of input, no more entries
@@ -307,7 +307,7 @@
         IfHeaderList list = new IfHeaderList();
         try {
             while (true) {
-                // read next non-whitespace
+                // read next non white space
                 reader.mark(1);
                 int c = readWhiteSpace(reader);
                 if (c < 0) {
@@ -617,6 +617,7 @@
          *
          * @return the String representation of this entry.
          */
+        @Override
         public String toString() {
             if (stringValue == null) {
                 stringValue = getType() + ": " + (positive?"":"!") + value;
@@ -654,6 +655,7 @@
          * @return <code>true</code> if the token matches the <em>IfList</em>
          *      entry's token value.
          */
+        @Override
         public boolean match(String token, String etag) {
             return super.match(token);
         }
@@ -664,6 +666,7 @@
          *
          * @return The fixed string <em>Token</em> as the type name.
          */
+        @Override
         protected String getType() {
             return "Token";
         }
@@ -698,6 +701,7 @@
          * @return <code>true</code> if the etag matches the <em>IfList</em>
          *      entry's etag value.
          */
+        @Override
         public boolean match(String token, String etag) {
             return super.match(etag);
         }
@@ -708,6 +712,7 @@
          *
          * @return The fixed string <em>ETag</em> as the type name.
          */
+        @Override
         protected String getType() {
             return "ETag";
         }
@@ -725,44 +730,16 @@
      * </pre>
      * <p>
      */
-    private static class IfList extends ArrayList {
-
-        /**
-         * Throws an <code>IllegalStateException</code> because only
-         * {@link IfListEntry} objects are supported in this list.
-         *
-         * @param o The <code>Object</code> to add.
-         * @return <code>true</code> if successful
-         *
-         * @throws IllegalStateException because only {@link IfListEntry}
-         *      objects are supported in this list.
-         */
-        public boolean add(Object o) {
-            throw new IllegalArgumentException("Only IfListEntry instances allowed");
-        }
-
-        /**
-         * Throws an <code>IllegalStateException</code> because only
-         * {@link IfListEntry} objects are supported in this list.
-         *
-         * @param index The position at which to add the object.
-         * @param element The <code>Object</code> to add.
-         *
-         * @throws IllegalStateException because only {@link IfListEntry}
-         *      objects are supported in this list.
-         */
-        public void add(int index, Object element) {
-            throw new IllegalArgumentException("Only IfListEntry instances allowed");
-        }
+    private static class IfList extends ArrayList<IfListEntry> {
 
         /**
          * Adds the {@link IfListEntry} at the end of the list.
          *
          * @param entry The {@link IfListEntry} to add to the list
          *
-         * @return <code>true</code> (as per the general contract of
-         *      Collection.add).
+         * @return <code>true</code> (as per the general contract of Collection.add).
          */
+        @Override
         public boolean add(IfListEntry entry) {
             return super.add(entry);
         }
@@ -776,6 +753,7 @@
          * @throws IndexOutOfBoundsException if index is out of range
          *      <code>(index &lt; 0 || index &gt; size())</code>.
          */
+        @Override
         public void add(int index, IfListEntry entry) {
             super.add(index, entry);
         }
@@ -794,7 +772,7 @@
         public boolean match(String token, String etag) {
             log.debug("match: Trying to match token="+token+", etag="+etag);
             for (int i=0; i < size(); i++) {
-                IfListEntry ile = (IfListEntry) get(i);
+                IfListEntry ile = get(i);
                 if (!ile.match(token, etag)) {
                     log.debug("match: Entry "+String.valueOf(i)+"-"+ile+" does not match");
                     return false;
@@ -840,7 +818,7 @@
          Untagged = { "(" IfList ")" } .
      * </pre>
      */
-    private static class IfHeaderList extends ArrayList implements IfHeaderInterface {
+    private static class IfHeaderList extends ArrayList<IfList> implements IfHeaderInterface {
 
         /**
          * Matches a list of {@link IfList}s against the token and etag. If any of
@@ -860,10 +838,9 @@
         public boolean matches(String resource, String token, String etag) {
             log.debug("matches: Trying to match token="+token+", etag="+etag);
 
-            for (int i=0; i < size(); i++) {
-                IfList il = (IfList) get(i);
+            for (IfList il : this) {
                 if (il.match(token, etag)) {
-                    log.debug("matches: Found match with "+il);
+                    log.debug("matches: Found match with " + il);
                     return true;
                 }
             }
@@ -881,7 +858,7 @@
          Tagged = { "<" Word ">" "(" IfList ")" } .
      * </pre>
      */
-    private static class IfHeaderMap extends HashMap implements IfHeaderInterface {
+    private static class IfHeaderMap extends HashMap<String, IfHeaderList> implements IfHeaderInterface {
 
         /**
          * Matches the token and etag for the given resource. If the resource is
@@ -899,7 +876,7 @@
         public boolean matches(String resource, String token, String etag) {
             log.debug("matches: Trying to match resource="+resource+", token="+token+","+etag);
 
-            IfHeaderList list = (IfHeaderList) get(resource);
+            IfHeaderList list = get(resource);
             if (list == null) {
                 log.debug("matches: No entry for tag "+resource+", assuming match");
                 return true;

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/PollTimeoutHeader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/PollTimeoutHeader.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/PollTimeoutHeader.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/header/PollTimeoutHeader.java Tue Feb 23 13:27:10 2010
@@ -30,6 +30,7 @@
         super(timeout);
     }
 
+    @Override
     public String getHeaderName() {
         return ObservationConstants.HEADER_POLL_TIMEOUT;
     }

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/LockDiscovery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/LockDiscovery.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/LockDiscovery.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/LockDiscovery.java Tue Feb 23 13:27:10 2010
@@ -25,7 +25,6 @@
 import org.w3c.dom.Element;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -33,7 +32,7 @@
  * property that is sent in the request body (PROPFIND and LOCK) and received
  * in a LOCK response body.
  */
-public class LockDiscovery extends AbstractDavProperty {
+public class LockDiscovery extends AbstractDavProperty<List<ActiveLock>> {
 
     /**
      * Listing of existing locks applied to the resource this discovery was
@@ -42,7 +41,7 @@
      * NOTE, that any of the information listed may be not availble for the
      * server is free to withhold any or all of this information.
      */
-    private List activeLocks = new ArrayList();
+    private List<ActiveLock> activeLocks = new ArrayList<ActiveLock>();
 
     /**
      * Creates a new empty LockDiscovery property
@@ -68,8 +67,8 @@
      */
     public LockDiscovery(ActiveLock[] locks) {
         super(DavPropertyName.LOCKDISCOVERY, false);
-        for (int i = 0; i < locks.length; i++) {
-            addActiveLock(locks[i]);
+        for (ActiveLock lock : locks) {
+            addActiveLock(lock);
         }
     }
 
@@ -85,7 +84,7 @@
      * @return list of active locks
      * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
      */
-    public Object getValue() {
+    public List<ActiveLock> getValue() {
         return activeLocks;
     }
 
@@ -97,11 +96,10 @@
      * @return A <code>&lt;lockdiscovery&gt;</code> element.
      * @param document
      */
+    @Override
     public Element toXml(Document document) {
         Element lockdiscovery = getName().toXml(document);
-        Iterator it = activeLocks.iterator();
-        while (it.hasNext()) {
-            ActiveLock lock = (ActiveLock) it.next();
+        for (ActiveLock lock : activeLocks) {
             lockdiscovery.appendChild(lock.toXml(document));
         }
         return lockdiscovery;
@@ -121,14 +119,14 @@
             throw new IllegalArgumentException("DAV:lockdiscovery element expected.");
         }
 
-        List activeLocks = new ArrayList();
+        List<ActiveLock> activeLocks = new ArrayList<ActiveLock>();
         ElementIterator it = DomUtil.getChildren(lockDiscoveryElement, XML_ACTIVELOCK, NAMESPACE);
         while (it.hasNext()) {
             Element al = it.nextElement();
             activeLocks.add(new ALockImpl(al));
         }
 
-        return new LockDiscovery((ActiveLock[]) activeLocks.toArray(new ActiveLock[activeLocks.size()]));
+        return new LockDiscovery(activeLocks.toArray(new ActiveLock[activeLocks.size()]));
     }
 
     //------< inner class >-----------------------------------------------------

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/Scope.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/Scope.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/Scope.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/Scope.java Tue Feb 23 13:27:10 2010
@@ -31,7 +31,7 @@
  */
 public class Scope implements XmlSerializable {
 
-    private static final Map scopes = new HashMap();
+    private static final Map<String, Scope> scopes = new HashMap<String, Scope>();
 
     public static final Scope EXCLUSIVE = Scope.create(DavConstants.XML_EXCLUSIVE, DavConstants.NAMESPACE);
     public static final Scope SHARED = Scope.create(DavConstants.XML_SHARED, DavConstants.NAMESPACE);
@@ -69,6 +69,7 @@
      * @param obj
      * @return
      */
+    @Override
     public boolean equals(Object obj) {
         if (this == obj) {
             return true;
@@ -108,11 +109,11 @@
     public static Scope create(String localName, Namespace namespace) {
         String key = DomUtil.getExpandedName(localName, namespace);
         if (scopes.containsKey(key)) {
-            return (Scope) scopes.get(key);
+            return scopes.get(key);
         } else {
             Scope scope = new Scope(localName, namespace);
             scopes.put(key, scope);
             return scope;
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SimpleLockManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SimpleLockManager.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SimpleLockManager.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SimpleLockManager.java Tue Feb 23 13:27:10 2010
@@ -23,7 +23,7 @@
 import org.apache.jackrabbit.webdav.DavServletResponse;
 
 import java.util.HashMap;
-import java.util.Iterator;
+import java.util.Map;
 
 /**
  * Simple manager for webdav locks.<br>
@@ -31,7 +31,7 @@
 public class SimpleLockManager implements LockManager {
 
     /** map of locks */
-    private HashMap locks = new HashMap();
+    private Map<String, ActiveLock> locks = new HashMap<String, ActiveLock>();
 
     /**
      *
@@ -41,7 +41,7 @@
      * @see LockManager#hasLock(String, org.apache.jackrabbit.webdav.DavResource)
      */
     public boolean hasLock(String lockToken, DavResource resource) {
-        ActiveLock lock = (ActiveLock) locks.get(resource.getResourcePath());
+        ActiveLock lock = locks.get(resource.getResourcePath());
         if (lock != null && lock.getToken().equals(lockToken)) {
             return true;
         }
@@ -71,7 +71,7 @@
      * @return
      */
     private ActiveLock getLock(String path) {
-        ActiveLock lock = (ActiveLock) locks.get(path);
+        ActiveLock lock = locks.get(path);
         if (lock != null) {
             // check if not expired
             if (lock.isExpired()) {
@@ -105,7 +105,7 @@
 
         String resourcePath = resource.getResourcePath();
         // test if there is already a lock present on this resource
-        ActiveLock lock = (ActiveLock) locks.get(resourcePath);
+        ActiveLock lock = locks.get(resourcePath);
         if (lock != null && lock.isExpired()) {
             locks.remove(resourcePath);
             lock = null;
@@ -115,12 +115,10 @@
         }
         // test if the new lock would conflict with any lock inherited from the
         // collection or with a lock present on any member resource.
-        Iterator it = locks.keySet().iterator();
-        while (it.hasNext()) {
-            String key = (String) it.next();
+        for (String key : locks.keySet()) {
             // TODO: is check for lock on internal-member correct?
             if (Text.isDescendant(key, resourcePath)) {
-                ActiveLock l = (ActiveLock) locks.get(key);
+                ActiveLock l = locks.get(key);
                 if (l.isDeep() || (key.equals(Text.getRelativeParent(resourcePath, 1)) && !resource.isCollection())) {
                     throw new DavException(DavServletResponse.SC_LOCKED, "Resource '" + resource.getResourcePath() + "' already inherits a lock by its collection.");
                 }
@@ -168,7 +166,7 @@
         if (!locks.containsKey(resource.getResourcePath())) {
             throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED);
         }
-        ActiveLock lock = (ActiveLock) locks.get(resource.getResourcePath());
+        ActiveLock lock = locks.get(resource.getResourcePath());
         if (lock.getToken().equals(lockToken)) {
             locks.remove(resource.getResourcePath());
         } else {

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SupportedLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SupportedLock.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SupportedLock.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SupportedLock.java Tue Feb 23 13:27:10 2010
@@ -23,16 +23,17 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * The <code>SupportedLock</code> class encapsulates the lock capabilties
  * of a resource. It is mainly responsible for generating the &lt;supportedlock>
  * property.
  */
-public class SupportedLock extends AbstractDavProperty {
+public class SupportedLock extends AbstractDavProperty<List<LockEntry>> {
 
     /** the list of lock entries */
-    private final ArrayList entries = new ArrayList();
+    private final List<LockEntry> entries = new ArrayList<LockEntry>();
 
     /**
      * Creates a new empty SupportedLock property.
@@ -75,9 +76,7 @@
      * supported.
      */
     public boolean isSupportedLock(Type type, Scope scope) {
-        Iterator it = entries.iterator();
-        while (it.hasNext()) {
-            LockEntry le = (LockEntry) it.next();
+        for (LockEntry le : entries) {
             if (le.getType().equals(type) && le.getScope().equals(scope)) {
                 return true;
             }
@@ -90,7 +89,7 @@
      *
      * @return an iterator over all supported locks
      */
-    public Iterator getSupportedLocks() {
+    public Iterator<LockEntry> getSupportedLocks() {
         return entries.iterator();
     }
 
@@ -100,11 +99,10 @@
      * @return An XML element of this lock support.
      * @param document
      */
+    @Override
     public Element toXml(Document document) {
         Element support = getName().toXml(document);
-        Iterator iter = entries.iterator();
-        while (iter.hasNext()) {
-            LockEntry le = (LockEntry) iter.next();
+        for (LockEntry le : entries) {
             support.appendChild(le.toXml(document));
         }
         return support;
@@ -116,7 +114,7 @@
      * @return list of supported lock.
      * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
      */
-    public Object getValue() {
+    public List<LockEntry> getValue() {
         return entries;
     }
 

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/Type.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/Type.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/Type.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/Type.java Tue Feb 23 13:27:10 2010
@@ -31,13 +31,15 @@
  */
 public class Type implements XmlSerializable {
 
-    private static Map types = new HashMap();
+    private static Map<String, Type> types = new HashMap<String, Type>();
 
     public static final Type WRITE = Type.create(DavConstants.XML_WRITE, DavConstants.NAMESPACE);
 
     private final String localName;
     private final Namespace namespace;
 
+    private int hashCode = -1;
+
     /**
      * Private constructor.
      *
@@ -61,21 +63,32 @@
         return lockType;
     }
 
+    @Override
+    public int hashCode() {
+        if (hashCode == -1) {
+            StringBuilder b = new StringBuilder();
+            b.append("LockType : {").append(namespace).append("}").append(localName);
+            hashCode = b.toString().hashCode();         
+        }
+        return hashCode;
+    }
+
     /**
      * Returns <code>true</code> if this Type is equal to the given one.
      *
      * @param obj
      * @return
      */
+    @Override
     public boolean equals(Object obj) {
-	if (this == obj) {
-	    return true;
-	}
-	if (obj instanceof Type) {
-	    Type other = (Type) obj;
-	    return localName.equals(other.localName) && namespace.equals(other.namespace);
-	}
-	return false;
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof Type) {
+            Type other = (Type) obj;
+            return localName.equals(other.localName) && namespace.equals(other.namespace);
+        }
+        return false;
     }
 
     /**
@@ -106,11 +119,11 @@
     public static Type create(String localName, Namespace namespace) {
         String key = DomUtil.getExpandedName(localName, namespace);
         if (types.containsKey(key)) {
-            return (Type) types.get(key);
+            return types.get(key);
         } else {
             Type type = new Type(localName, namespace);
             types.put(key, type);
             return type;
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/DefaultEventType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/DefaultEventType.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/DefaultEventType.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/DefaultEventType.java Tue Feb 23 13:27:10 2010
@@ -35,7 +35,7 @@
  */
 public class DefaultEventType implements EventType {
 
-    private static final Map eventTypes = new HashMap();
+    private static final Map<String, EventType> eventTypes = new HashMap<String, EventType>();
 
     private final String localName;
     private final Namespace namespace;
@@ -66,7 +66,7 @@
         }
         String key = DomUtil.getExpandedName(localName, namespace);
         if (eventTypes.containsKey(key)) {
-            return (EventType) eventTypes.get(key);
+            return eventTypes.get(key);
         } else {
             EventType type = new DefaultEventType(localName, namespace);
             eventTypes.put(key, type);
@@ -88,13 +88,13 @@
             throw new IllegalArgumentException("'eventtype' element expected which contains a least a single child element.");
         }
 
-        List etypes = new ArrayList();
+        List<EventType> etypes = new ArrayList<EventType>();
         ElementIterator it = DomUtil.getChildren(eventType);
         while (it.hasNext()) {
             Element el = it.nextElement();
             etypes.add(create(el.getLocalName(), DomUtil.getNamespace(el)));
         }
-        return (EventType[]) etypes.toArray(new EventType[etypes.size()]);
+        return etypes.toArray(new EventType[etypes.size()]);
     }
 
     //----------------------------------------------------------< EventType >---

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/EventDiscovery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/EventDiscovery.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/EventDiscovery.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/EventDiscovery.java Tue Feb 23 13:27:10 2010
@@ -37,7 +37,7 @@
 
     private static Logger log = LoggerFactory.getLogger(EventDiscovery.class);
 
-    private final List bundles = new ArrayList();
+    private final List<EventBundle> bundles = new ArrayList<EventBundle>();
 
     /**
      * Add the Xml representation of an single 'eventBundle' listing the
@@ -59,7 +59,7 @@
      *
      * @return iterator over event bundles present.
      */
-    public Iterator getEventBundles() {
+    public Iterator<EventBundle> getEventBundles() {
         return bundles.iterator();
     }
 
@@ -84,11 +84,9 @@
      */
     public Element toXml(Document document) {
         Element ed = DomUtil.createElement(document, XML_EVENTDISCOVERY, NAMESPACE);
-        Iterator it = getEventBundles();
-        while (it.hasNext()) {
-            EventBundle bundle = (EventBundle)it.next();
+        for (EventBundle bundle : bundles) {
             ed.appendChild(bundle.toXml(document));
         }
         return ed;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/SubscriptionDiscovery.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/SubscriptionDiscovery.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/SubscriptionDiscovery.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/SubscriptionDiscovery.java Tue Feb 23 13:27:10 2010
@@ -31,7 +31,7 @@
  * <code>SubscriptionDiscovery</code> encapsulates the 'subscriptiondiscovery'
  * property of a webdav resource.
  */
-public class SubscriptionDiscovery extends AbstractDavProperty {
+public class SubscriptionDiscovery extends AbstractDavProperty<Subscription[]> {
 
     private final Subscription[] subscriptions;
 
@@ -71,7 +71,7 @@
      * @return an array of {@link Subscription}s
      * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
      */
-    public Object getValue() {
+    public Subscription[] getValue() {
         return subscriptions;
     }
 
@@ -82,10 +82,11 @@
      * @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document)
      * @param document
      */
+    @Override
     public Element toXml(Document document) {
         Element elem = getName().toXml(document);
-        for (int i = 0; i < subscriptions.length; i++) {
-            elem.appendChild(subscriptions[i].toXml(document));
+        for (Subscription subscription : subscriptions) {
+            elem.appendChild(subscription.toXml(document));
         }
         return elem;
     }
@@ -96,7 +97,7 @@
             throw new IllegalArgumentException("'subscriptiondiscovery' element expected.");
         }
 
-        List subscriptions = new ArrayList();
+        List<Subscription> subscriptions = new ArrayList<Subscription>();
         ElementIterator it = DomUtil.getChildren(sDiscoveryElement, ObservationConstants.XML_SUBSCRIPTION, ObservationConstants.NAMESPACE);
         while (it.hasNext()) {
             final Element sb = it.nextElement();
@@ -122,6 +123,6 @@
             subscriptions.add(s);
         }
 
-        return new SubscriptionDiscovery((Subscription[]) subscriptions.toArray(new Subscription[subscriptions.size()]));
+        return new SubscriptionDiscovery(subscriptions.toArray(new Subscription[subscriptions.size()]));
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/SubscriptionInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/SubscriptionInfo.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/SubscriptionInfo.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/observation/SubscriptionInfo.java Tue Feb 23 13:27:10 2010
@@ -129,7 +129,7 @@
             throw new DavException(DavServletResponse.SC_BAD_REQUEST);
         }
 
-        List filters = new ArrayList();
+        List<Filter> filters = new ArrayList<Filter>();
         el = DomUtil.getChildElement(reqInfo, XML_FILTER, NAMESPACE);
         if (el != null) {
             ElementIterator it = DomUtil.getChildren(el);
@@ -138,7 +138,7 @@
                 filters.add(f);
             }
         }
-        this.filters = (Filter[])filters.toArray(new Filter[filters.size()]);
+        this.filters = filters.toArray(new Filter[filters.size()]);
 
         this.noLocal = DomUtil.hasChildElement(reqInfo, XML_NOLOCAL, NAMESPACE);
         this.isDeep = isDeep;
@@ -174,13 +174,13 @@
      * name.
      */
     public Filter[] getFilters(String localName, Namespace namespace) {
-        List l = new ArrayList();
-        for (int i = 0; i < filters.length; i++) {
-            if (filters[i].isMatchingFilter(localName, namespace)) {
-               l.add(filters[i]);
+        List<Filter> l = new ArrayList<Filter>();
+        for (Filter filter : filters) {
+            if (filter.isMatchingFilter(localName, namespace)) {
+                l.add(filter);
             }
         }
-        return (Filter[])l.toArray(new Filter[l.size()]);
+        return l.toArray(new Filter[l.size()]);
     }
 
     /**
@@ -223,14 +223,14 @@
     public Element toXml(Document document) {
         Element subscrInfo = DomUtil.createElement(document, XML_SUBSCRIPTIONINFO, NAMESPACE);
         Element eventType = DomUtil.addChildElement(subscrInfo, XML_EVENTTYPE, NAMESPACE);
-        for (int i = 0; i < eventTypes.length; i++) {
-            eventType.appendChild(eventTypes[i].toXml(document));
+        for (EventType et : eventTypes) {
+            eventType.appendChild(et.toXml(document));
         }
 
         if (filters.length > 0) {
             Element filter = DomUtil.addChildElement(subscrInfo, XML_FILTER, NAMESPACE);
-            for (int i = 0; i < filters.length; i++) {
-                filter.appendChild(filters[i].toXml(document));
+            for (Filter f : filters) {
+                filter.appendChild(f.toXml(document));
             }
         }
 
@@ -239,4 +239,4 @@
         }
         return subscrInfo;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/OrderPatch.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/OrderPatch.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/OrderPatch.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/OrderPatch.java Tue Feb 23 13:27:10 2010
@@ -106,8 +106,8 @@
         Element otype = DomUtil.addChildElement(orderPatch, XML_ORDERING_TYPE, NAMESPACE);
         otype.appendChild(DomUtil.hrefToXml(orderingType, document));
         // add DAV:member elements below DAV:orderpatch
-        for (int i = 0; i < instructions.length; i++) {
-            orderPatch.appendChild(instructions[i].toXml(document));
+        for (Member instruction : instructions) {
+            orderPatch.appendChild(instruction.toXml(document));
         }
         return orderPatch;
     }
@@ -136,7 +136,7 @@
         }
 
         // set build the list of ordering instructions
-        List tmpList = new ArrayList();
+        List<Member> tmpList = new ArrayList<Member>();
         ElementIterator it = DomUtil.getChildren(orderPatchElement, XML_ORDER_MEMBER, NAMESPACE);
         while (it.hasNext()) {
             Element el = it.nextElement();
@@ -152,7 +152,7 @@
                 throw new DavException(DavServletResponse.SC_BAD_REQUEST);
             }
         }
-        Member[] instructions = (Member[]) tmpList.toArray(new Member[tmpList.size()]);
+        Member[] instructions = tmpList.toArray(new Member[tmpList.size()]);
         return new OrderPatch(orderingType, instructions);
     }
 
@@ -209,4 +209,4 @@
         }
 
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/OrderingType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/OrderingType.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/OrderingType.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/OrderingType.java Tue Feb 23 13:27:10 2010
@@ -26,7 +26,7 @@
  * including the Ordering-Type header with a MKCOL request or by submitting an
  * ORDERPATCH request.
  *
- * @see org.apache.jackrabbit.webdav.property.DavProperty#isProtected()
+ * @see org.apache.jackrabbit.webdav.property.DavProperty#isInvisibleInAllprop()
  */
 public class OrderingType extends HrefProperty implements OrderingConstants {
 
@@ -43,10 +43,10 @@
      * NOTE: the ordering-type property is defined to be protected.
      *
      * @param href
-     * @see org.apache.jackrabbit.webdav.property.DavProperty#isProtected()
+     * @see org.apache.jackrabbit.webdav.property.DavProperty#isInvisibleInAllprop()
      */
     public OrderingType(String href) {
         // spec requires that the default value is 'DAV:unordered'
         super(ORDERING_TYPE, (href != null) ? href : ORDERING_TYPE_UNORDERED, true);
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/Position.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/Position.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/Position.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/ordering/Position.java Tue Feb 23 13:27:10 2010
@@ -41,7 +41,7 @@
 
     private static Logger log = LoggerFactory.getLogger(Position.class);
 
-    private static final Set VALID_TYPES = new HashSet();
+    private static final Set<String> VALID_TYPES = new HashSet<String>();
     static {
         VALID_TYPES.add(XML_FIRST);
         VALID_TYPES.add(XML_LAST);
@@ -161,4 +161,4 @@
             throw new IllegalArgumentException("The 'DAV:position' element required with exact one child indicating the type.");
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/AbstractDavProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/AbstractDavProperty.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/AbstractDavProperty.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/AbstractDavProperty.java Tue Feb 23 13:27:10 2010
@@ -26,13 +26,12 @@
 import org.w3c.dom.Node;
 
 import java.util.Collection;
-import java.util.Iterator;
 
 /**
  * <code>AbstractDavProperty</code> provides generic METHODS used by various
  * implementations of the {@link DavProperty} interface.
  */
-public abstract class AbstractDavProperty implements DavProperty {
+public abstract class AbstractDavProperty<T> implements DavProperty<T> {
 
     private static Logger log = LoggerFactory.getLogger(AbstractDavProperty.class);
 
@@ -54,6 +53,7 @@
      *
      * @return the hash code
      */
+    @Override
     public int hashCode() {
         int hashCode = getName().hashCode();
         if (getValue() != null) {
@@ -70,9 +70,10 @@
      * @return <code>true</code> if the 2 objects are equal;
      *         <code>false</code> otherwise
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj instanceof DavProperty) {
-            DavProperty prop = (DavProperty) obj;
+            DavProperty<?> prop = (DavProperty<?>) obj;
             boolean equalName = getName().equals(prop.getName());
             boolean equalValue = (getValue() == null) ? prop.getValue() == null : getValue().equals(prop.getValue());
             return equalName && equalValue;
@@ -108,7 +109,7 @@
      */
     public Element toXml(Document document) {
         Element elem = getName().toXml(document);
-        Object value = getValue();
+        T value = getValue();
         // todo: improve....
         if (value != null) {
             if (value instanceof XmlSerializable) {
@@ -122,13 +123,11 @@
                     elem.appendChild(n);
                 }
             } else if (value instanceof Collection) {
-                Iterator it = ((Collection)value).iterator();
-                while (it.hasNext()) {
-                    Object entry = it.next();
+                for (Object entry : ((Collection<?>) value)) {
                     if (entry instanceof XmlSerializable) {
-                        elem.appendChild(((XmlSerializable)entry).toXml(document));
+                        elem.appendChild(((XmlSerializable) entry).toXml(document));
                     } else if (entry instanceof Node) {
-                        Node n = document.importNode((Node)entry, true);
+                        Node n = document.importNode((Node) entry, true);
                         elem.appendChild(n);
                     } else {
                         DomUtil.setText(elem, entry.toString());
@@ -161,4 +160,4 @@
     public boolean isInvisibleInAllprop() {
         return isInvisibleInAllprop;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavProperty.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavProperty.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavProperty.java Tue Feb 23 13:27:10 2010
@@ -44,7 +44,7 @@
  * &lt;/Z:custom-property&gt;
  * </pre>
  */
-public interface DavProperty extends XmlSerializable, DavConstants {
+public interface DavProperty<T> extends XmlSerializable, DavConstants, PropEntry {
 
     /**
      * Returns the name of this property
@@ -58,7 +58,7 @@
      *
      * @return the value of this property
      */
-    public Object getValue();
+    public T getValue();
 
     /**
      * Return <code>true</code> if this property should be suppressed

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyIterator.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyIterator.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyIterator.java Tue Feb 23 13:27:10 2010
@@ -23,12 +23,12 @@
  * The <code>DavPropertyIterator</code> extends the <code>Iterator</code> by
  * a property specific <code>next()</code> method.
  */
-public interface DavPropertyIterator extends Iterator {
+public interface DavPropertyIterator extends Iterator<DavProperty<?>> {
     /**
      * Returns the next <code>Property</code> in the interation.
      *
      * @return the next <code>Property</code> in the iteration.
      * @throws java.util.NoSuchElementException if iteration has no more elements.
      */
-    public DavProperty nextProperty() throws NoSuchElementException;
+    public DavProperty<?> nextProperty() throws NoSuchElementException;
 }

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyName.java Tue Feb 23 13:27:10 2010
@@ -24,15 +24,16 @@
 import org.w3c.dom.Element;
 
 import java.util.HashMap;
+import java.util.Map;
 
 /**
  * The <code>DavPropertyName</code> class reflects a Webdav property name. It
  * holds together the actualy name of the property and its namespace.
  */
-public class DavPropertyName implements DavConstants, XmlSerializable {
+public class DavPropertyName implements DavConstants, XmlSerializable, PropEntry {
 
     /** internal 'cache' of created property names */
-    private static final HashMap cache = new HashMap();
+    private static final Map<Namespace, Map<String, DavPropertyName>> cache = new HashMap<Namespace, Map<String, DavPropertyName>>();
 
     /* some standard webdav property (that have #PCDATA) */
     public static final DavPropertyName CREATIONDATE = DavPropertyName.create(PROPERTY_CREATIONDATE);
@@ -70,13 +71,13 @@
     public synchronized static DavPropertyName create(String name, Namespace namespace) {
 
         // get (or create) map for the given namespace
-        HashMap map = (HashMap) cache.get(namespace);
+        Map<String, DavPropertyName> map = cache.get(namespace);
         if (map == null) {
-            map = new HashMap();
+            map = new HashMap<String, DavPropertyName>();
             cache.put(namespace, map);
         }
         // get (or create) property name object
-        DavPropertyName ret = (DavPropertyName) map.get(name);
+        DavPropertyName ret = map.get(name);
         if (ret == null) {
             if (namespace.equals(NAMESPACE)) {
                 // ensure prefix for default 'DAV:' namespace
@@ -157,6 +158,7 @@
      *
      * @return the hash code
      */
+    @Override
     public int hashCode() {
         return (name.hashCode() + namespace.hashCode()) % Integer.MAX_VALUE;
     }
@@ -170,6 +172,7 @@
      * @return <code>true</code> if the 2 objects are equal;
      *         <code>false</code> otherwise
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj instanceof DavPropertyName) {
             DavPropertyName propName = (DavPropertyName) obj;
@@ -183,6 +186,7 @@
      *
      * @return a human readable string representation
      */
+    @Override
     public String toString() {
         return DomUtil.getExpandedName(name, namespace);
     }

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyNameIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyNameIterator.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyNameIterator.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyNameIterator.java Tue Feb 23 13:27:10 2010
@@ -21,8 +21,8 @@
 /**
  * <code>DavPropertyNameIterator</code>...
  */
-public interface DavPropertyNameIterator extends Iterator {
+public interface DavPropertyNameIterator extends Iterator<DavPropertyName> {
 
     public DavPropertyName nextPropertyName();
 
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyNameSet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyNameSet.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyNameSet.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertyNameSet.java Tue Feb 23 13:27:10 2010
@@ -25,6 +25,7 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.Set;
 
 /**
  * <code>DavPropertyNameSet</code> represents a Set of {@link DavPropertyName}
@@ -33,7 +34,7 @@
 public class DavPropertyNameSet extends PropContainer {
 
     private static Logger log = LoggerFactory.getLogger(DavPropertyNameSet.class);
-    private final HashSet set = new HashSet();
+    private final Set<DavPropertyName> set = new HashSet<DavPropertyName>();
 
     /**
      * Create a new empty set.
@@ -89,7 +90,7 @@
      * @return true if the set has been modified by this call.
      */
     public boolean addAll(DavPropertyNameSet propertyNames) {
-        return set.addAll(propertyNames.getContent());
+        return set.addAll(propertyNames.set);
     }
 
     /**
@@ -115,6 +116,7 @@
     /**
      * @see PropContainer#contains(DavPropertyName)
      */
+    @Override
     public boolean contains(DavPropertyName name) {
         return set.contains(name);
     }
@@ -126,9 +128,10 @@
      * that could be added to this set. False otherwise.
      * @see PropContainer#addContent(Object)
      */
-    public boolean addContent(Object contentEntry) {
+    @Override
+    public boolean addContent(PropEntry contentEntry) {
         if (contentEntry instanceof DavPropertyName) {
-            return add((DavPropertyName)contentEntry);
+            return add((DavPropertyName) contentEntry);
         }
         log.debug("DavPropertyName object expected. Found: " + contentEntry.getClass().toString());
         return false;
@@ -137,6 +140,7 @@
     /**
      * @see PropContainer#isEmpty()
      */
+    @Override
     public boolean isEmpty() {
         return set.isEmpty();
     }
@@ -144,6 +148,7 @@
     /**
      * @see PropContainer#getContentSize()
      */
+    @Override
     public int getContentSize() {
         return set.size();
     }
@@ -151,21 +156,22 @@
     /**
      * @see PropContainer#getContent()
      */
-    public Collection getContent() {
+    @Override
+    public Collection<? extends PropEntry> getContent() {
         return set;
     }
 
     //--------------------------------------------------------< inner class >---
     private class PropertyNameIterator implements DavPropertyNameIterator {
 
-        private Iterator iter;
+        private Iterator<DavPropertyName> iter;
 
         private PropertyNameIterator() {
             this.iter = set.iterator();
         }
 
         public DavPropertyName nextPropertyName() {
-            return (DavPropertyName)iter.next();
+            return iter.next();
         }
 
         public void remove() {
@@ -176,8 +182,8 @@
             return iter.hasNext();
         }
 
-        public Object next() {
+        public DavPropertyName next() {
             return iter.next();
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertySet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertySet.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertySet.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DavPropertySet.java Tue Feb 23 13:27:10 2010
@@ -25,7 +25,6 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.NoSuchElementException;
-import java.util.Set;
 
 /**
  * The <code>DavPropertySet</code> class represents a set of WebDAV
@@ -38,7 +37,7 @@
     /**
      * the set of property
      */
-    private final Map map = new HashMap();
+    private final Map<DavPropertyName, DavProperty<?>> map = new HashMap<DavPropertyName, DavProperty<?>>();
 
     /**
      * Adds a new property to this set.
@@ -47,8 +46,8 @@
      *
      * @return The previously assigned property or <code>null</code>.
      */
-    public DavProperty add(DavProperty property) {
-        return (DavProperty) map.put(property.getName(), property);
+    public DavProperty<?> add(DavProperty<?> property) {
+        return map.put(property.getName(), property);
     }
 
     /**
@@ -56,7 +55,7 @@
      * @param pset Properties to add
      */
     public void addAll(DavPropertySet pset) {
-	map.putAll(pset.map);
+        map.putAll(pset.map);
     }
 
     /**
@@ -67,8 +66,8 @@
      *
      * @return The desired property or <code>null</code>
      */
-    public DavProperty get(String name) {
-    	return get(DavPropertyName.create(name));
+    public DavProperty<?> get(String name) {
+        return get(DavPropertyName.create(name));
     }
 
     /**
@@ -80,7 +79,7 @@
      *
      * @return The desired property or <code>null</code>
      */
-    public DavProperty get(String name, Namespace namespace) {
+    public DavProperty<?> get(String name, Namespace namespace) {
         return get(DavPropertyName.create(name, namespace));
     }
 
@@ -91,8 +90,8 @@
      *
      * @return The desired property or <code>null</code>
      */
-    public DavProperty get(DavPropertyName name) {
-    	return (DavProperty) map.get(name);
+    public DavProperty<?> get(DavPropertyName name) {
+        return map.get(name);
     }
 
 
@@ -103,8 +102,8 @@
      *
      * @return The removed property or <code>null</code>
      */
-    public DavProperty remove(DavPropertyName name) {
-        return (DavProperty) map.remove(name);
+    public DavProperty<?> remove(DavPropertyName name) {
+        return map.remove(name);
     }
 
     /**
@@ -115,7 +114,7 @@
      *
      * @return The removed property or <code>null</code>
      */
-    public DavProperty remove(String name) {
+    public DavProperty<?> remove(String name) {
         return remove(DavPropertyName.create(name));
     }
 
@@ -128,7 +127,7 @@
      *
      * @return The removed property or <code>null</code>
      */
-    public DavProperty remove(String name, Namespace namespace) {
+    public DavProperty<?> remove(String name, Namespace namespace) {
         return remove(DavPropertyName.create(name, namespace));
     }
 
@@ -159,8 +158,7 @@
      * @return array of {@link DavPropertyName property names} present in this set.
      */
     public DavPropertyName[] getPropertyNames() {
-        Set keySet = map.keySet();
-	return (DavPropertyName[]) keySet.toArray(new DavPropertyName[keySet.size()]);
+        return map.keySet().toArray(new DavPropertyName[map.keySet().size()]);
     }
 
     //------------------------------------------------------< PropContainer >---
@@ -172,6 +170,7 @@
      *         <code>false</code> otherwise.
      * @see PropContainer#contains(DavPropertyName)
      */
+    @Override
     public boolean contains(DavPropertyName name) {
         return map.containsKey(name);
     }
@@ -181,11 +180,12 @@
      * <code>DavProperty</code> in order to be successfully added to this set.
      * @return true if the specified object is an instance of <code>DavProperty</code>
      * and false otherwise.
-     * @see PropContainer#addContent(Object)
+     * @see PropContainer#addContent(PropEntry)
      */
-    public boolean addContent(Object contentEntry) {
+    @Override
+    public boolean addContent(PropEntry contentEntry) {
         if (contentEntry instanceof DavProperty) {
-            add((DavProperty)contentEntry);
+            add((DavProperty<?>) contentEntry);
             return true;
         }
         log.debug("DavProperty object expected. Found: " + contentEntry.getClass().toString());
@@ -195,6 +195,7 @@
     /**
      * @see PropContainer#isEmpty()
      */
+    @Override
     public boolean isEmpty() {
         return map.isEmpty();
     }
@@ -202,6 +203,7 @@
     /**
      * @see PropContainer#getContentSize()
      */
+    @Override
     public int getContentSize() {
         return map.size();
     }
@@ -209,7 +211,8 @@
     /**
      * @see PropContainer#getContent()
      */
-    public Collection getContent() {
+    @Override
+    public Collection<? extends PropEntry> getContent() {
         return map.values();
     }
 
@@ -224,10 +227,10 @@
         private final Namespace namespace;
 
         /** the internal iterator */
-        private final Iterator iterator;
+        private final Iterator<DavProperty<?>> iterator;
 
         /** the next property to return */
-        private DavProperty next;
+        private DavProperty<?> next;
 
         /**
          * Creates a new property iterator.
@@ -240,7 +243,7 @@
          * Creates a new iterator with the given namespace
          * @param namespace The namespace to match against
          */
-	private PropIter(Namespace namespace) {
+        private PropIter(Namespace namespace) {
             this.namespace = namespace;
             iterator = map.values().iterator();
             seek();
@@ -249,11 +252,11 @@
         /**
          * @see DavPropertyIterator#nextProperty();
          */
-        public DavProperty nextProperty() throws NoSuchElementException {
+        public DavProperty<?> nextProperty() throws NoSuchElementException {
             if (next==null) {
                 throw new NoSuchElementException();
             }
-            DavProperty ret = next;
+            DavProperty<?> ret = next;
             seek();
             return ret;
         }
@@ -268,7 +271,7 @@
         /**
          * @see DavPropertyIterator#next();
          */
-        public Object next() {
+        public DavProperty<?> next() {
             return nextProperty();
         }
 
@@ -284,7 +287,7 @@
          */
         private void seek() {
             while (iterator.hasNext()) {
-                next = (DavProperty) iterator.next();
+                next = iterator.next();
                 if (namespace == null || namespace.equals(next.getName().getNamespace())) {
                     return;
                 }

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DefaultDavProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DefaultDavProperty.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DefaultDavProperty.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/DefaultDavProperty.java Tue Feb 23 13:27:10 2010
@@ -28,14 +28,14 @@
 /**
  * <code>DefaultDavProperty</code>...
  */
-public class DefaultDavProperty extends AbstractDavProperty {
+public class DefaultDavProperty<T> extends AbstractDavProperty<T> {
 
     private static Logger log = LoggerFactory.getLogger(DefaultDavProperty.class);
 
     /**
      * the value of the property
      */
-    private final Object value;
+    private final T value;
 
     /**
      * Creates a new WebDAV property with the given namespace, name and value.
@@ -49,7 +49,7 @@
      * It will not be returned in a {@link org.apache.jackrabbit.webdav.DavConstants#PROPFIND_ALL_PROP DAV:allprop}
      * PROPFIND request and cannot be set/removed with a PROPPATCH request.
      */
-    public DefaultDavProperty(String name, Object value, Namespace namespace, boolean isProtected) {
+    public DefaultDavProperty(String name, T value, Namespace namespace, boolean isProtected) {
         super(DavPropertyName.create(name, namespace), isProtected);
         this.value = value;
     }
@@ -62,7 +62,7 @@
      * @param value the value of the property
      * @param namespace the namespace of the property
      */
-    public DefaultDavProperty(String name, Object value, Namespace namespace) {
+    public DefaultDavProperty(String name, T value, Namespace namespace) {
         this(name, value, namespace, false);
     }
 
@@ -77,7 +77,7 @@
      * It will not be returned in a {@link org.apache.jackrabbit.webdav.DavConstants#PROPFIND_ALL_PROP DAV:allprop}
      * PROPFIND request and cannot be set/removed with a PROPPATCH request.
      */
-    public DefaultDavProperty(DavPropertyName name, Object value, boolean isProtected) {
+    public DefaultDavProperty(DavPropertyName name, T value, boolean isProtected) {
         super(name, isProtected);
         this.value = value;
     }
@@ -89,7 +89,7 @@
      * @param name the name of the property
      * @param value the value of the property
      */
-    public DefaultDavProperty(DavPropertyName name, Object value) {
+    public DefaultDavProperty(DavPropertyName name, T value) {
         this(name, value, false);
     }
 
@@ -98,7 +98,7 @@
      *
      * @return the value of this property
      */
-    public Object getValue() {
+    public T getValue() {
         return value;
     }
 
@@ -117,28 +117,28 @@
      * @param propertyElement
      * @return
      */
-    public static DefaultDavProperty createFromXml(Element propertyElement) {
+    public static DefaultDavProperty<?> createFromXml(Element propertyElement) {
         if (propertyElement == null) {
             throw new IllegalArgumentException("Cannot create a new DavProperty from a 'null' element.");
         }
         DavPropertyName name = DavPropertyName.createFromXml(propertyElement);
-        Object value;
-
+        DefaultDavProperty<?> prop;
+        
         if (!DomUtil.hasContent(propertyElement)) {
-            value = null;
+            prop = new DefaultDavProperty<String>(name, null, false);
         }  else {
-            List c = DomUtil.getContent(propertyElement);
+            List<Node> c = DomUtil.getContent(propertyElement);
             if (c.size() == 1) {
-                Node n = (Node)c.get(0);
+                Node n = c.get(0);
                 if (n instanceof Element) {
-                    value = n;
+                    prop = new DefaultDavProperty<Element>(name, (Element) n, false);
                 } else {
-                    value = n.getNodeValue();
+                    prop = new DefaultDavProperty<String>(name, n.getNodeValue(), false);
                 }
             } else /* size > 1 */ {
-                value = c;
+                prop = new DefaultDavProperty<List<Node>>(name, c, false);
             }
         }
-        return new DefaultDavProperty(name, value, false);
+        return prop;
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/HrefProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/HrefProperty.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/HrefProperty.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/HrefProperty.java Tue Feb 23 13:27:10 2010
@@ -24,7 +24,6 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -36,7 +35,7 @@
  * @see org.apache.jackrabbit.webdav.DavConstants#XML_HREF
  * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
  */
-public class HrefProperty extends AbstractDavProperty {
+public class HrefProperty extends AbstractDavProperty<String[]> {
 
     private static Logger log = LoggerFactory.getLogger(HrefProperty.class);
 
@@ -77,25 +76,23 @@
      *
      * @param prop
      */
-    public HrefProperty(DavProperty prop) {
+    public HrefProperty(DavProperty<?> prop) {
         super(prop.getName(), prop.isInvisibleInAllprop());
         if (prop instanceof HrefProperty) {
             // already an HrefProperty: no parsing required
             this.value = ((HrefProperty)prop).value;
         } else {
             // assume property has be built from xml
-            ArrayList hrefList = new ArrayList();
+            ArrayList<String> hrefList = new ArrayList<String>();
             Object val = prop.getValue();
             if (val instanceof List) {
-                Iterator it = ((List)val).iterator();
-                while (it.hasNext()) {
-                    Object o = it.next();
-                    if (o instanceof Element && XML_HREF.equals(((Element)o).getLocalName())) {
-                        String href = DomUtil.getText((Element)o);
+                for (Object entry : ((List<?>) val)) {
+                    if (entry instanceof Element && XML_HREF.equals(((Element) entry).getLocalName())) {
+                        String href = DomUtil.getText((Element) entry);
                         if (href != null) {
                             hrefList.add(href);
                         } else {
-                            log.warn("Valid DAV:href element expected instead of " + o.toString());
+                            log.warn("Valid DAV:href element expected instead of " + entry.toString());
                         }
                     } else {
                         log.warn("DAV: href element expected in the content of " + getName().toString());
@@ -109,7 +106,7 @@
                     log.warn("Valid DAV:href element expected instead of " + val.toString());
                 }
             }
-            value = (String[]) hrefList.toArray(new String[hrefList.size()]);
+            value = hrefList.toArray(new String[hrefList.size()]);
         }
     }
 
@@ -127,14 +124,14 @@
      * @see org.apache.jackrabbit.webdav.xml.DomUtil#hrefToXml(String,org.w3c.dom.Document)
      * @param document
      */
+    @Override
     public Element toXml(Document document) {
         Element elem = getName().toXml(document);
         Object value = getValue();
         if (value != null) {
             if (value instanceof String[]) {
-                String[] hrefs = (String[]) value;
-                for (int i = 0; i < hrefs.length; i++) {
-                    elem.appendChild(DomUtil.hrefToXml(hrefs[i], document));
+                for (String href : (String[]) value) {
+                    elem.appendChild(DomUtil.hrefToXml(href, document));
                 }
             } else {
                 elem.appendChild(DomUtil.hrefToXml(value.toString(), document));
@@ -149,7 +146,7 @@
      * @return an array of String.
      * @see DavProperty#getValue()
      */
-    public Object getValue() {
+    public String[] getValue() {
         return value;
     }
 
@@ -160,7 +157,7 @@
      *
      * @return list of href String
      */
-    public List getHrefs() {
-        return (value != null) ? Arrays.asList(value) : new ArrayList();
+    public List<String> getHrefs() {
+        return (value != null) ? Arrays.asList(value) : new ArrayList<String>();
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropContainer.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropContainer.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropContainer.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropContainer.java Tue Feb 23 13:27:10 2010
@@ -25,7 +25,6 @@
 import org.w3c.dom.Element;
 
 import java.util.Collection;
-import java.util.Iterator;
 
 /**
  * <code>PropContainer</code>...
@@ -41,8 +40,27 @@
      *
      * @param contentEntry
      * @return true if the object could be added; false otherwise
+     * @deprecated Use {@link #addContent(PropEntry) instead.
      */
-    public abstract boolean addContent(Object contentEntry);
+    public boolean addContent(Object contentEntry) {
+        if (contentEntry instanceof PropEntry) {
+            return addContent((PropEntry) contentEntry);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Tries to add the specified entry to the <code>PropContainer</code> and
+     * returns a boolean indicating whether the content could be added to the
+     * internal set/map.
+     *
+     * @param contentEntry
+     * @return true if the object could be added; false otherwise
+     * @param contentEntry
+     * @return
+     */
+    public abstract boolean addContent(PropEntry contentEntry);
 
     /**
      * Returns true if the PropContainer does not yet contain any content elements.
@@ -65,7 +83,7 @@
      *
      * @return collection representing the contents of this <code>PropContainer</code>.
      */
-    public abstract Collection getContent();
+    public abstract Collection<? extends PropEntry> getContent();
 
     /**
      * Returns true if this <code>PropContainer</code> contains a content element
@@ -90,11 +108,9 @@
      */
     public Element toXml(Document document) {
         Element prop = DomUtil.createElement(document, XML_PROP, NAMESPACE);
-        Iterator it = getContent().iterator();
-        while (it.hasNext()) {
-            Object content = it.next();
+        for (Object content : getContent()) {
             if (content instanceof XmlSerializable) {
-                prop.appendChild(((XmlSerializable)content).toXml(document));
+                prop.appendChild(((XmlSerializable) content).toXml(document));
             } else {
                 log.debug("Unexpected content in PropContainer: should be XmlSerializable.");
             }
@@ -102,4 +118,4 @@
         return prop;
     }
 
-}
\ No newline at end of file
+}

Added: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropEntry.java?rev=915333&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropEntry.java (added)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropEntry.java Tue Feb 23 13:27:10 2010
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.webdav.property;
+
+/**
+ * Marker interface used to flag the different types of entries that form
+ * part of a PROPPATCH request and define the possible entries for a
+ * <code>PropContainer</code>.
+ */
+public interface PropEntry {
+}

Propchange: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/PropEntry.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/ResourceType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/ResourceType.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/ResourceType.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/property/ResourceType.java Tue Feb 23 13:27:10 2010
@@ -40,7 +40,7 @@
  * <li>'{@link #BASELINE DAV:baseline}',</li>
  * </ul>
  */
-public class ResourceType extends AbstractDavProperty {
+public class ResourceType extends AbstractDavProperty<Set<XmlSerializable>> {
 
     /**
      * The default resource type
@@ -70,14 +70,14 @@
     /**
      * Array containing all possible resourcetype elements
      */
-    private static final List NAMES = new ArrayList();
+    private static final List<TypeName> NAMES = new ArrayList<TypeName>();
     static {
         NAMES.add(null);
         NAMES.add(new TypeName(XML_COLLECTION, NAMESPACE));
         NAMES.add(new TypeName(DeltaVConstants.XML_VERSION_HISTORY, DeltaVConstants.NAMESPACE));
         NAMES.add(new TypeName(DeltaVConstants.XML_ACTIVITY, DeltaVConstants.NAMESPACE));
         NAMES.add(new TypeName(DeltaVConstants.XML_BASELINE, DeltaVConstants.NAMESPACE));
-    };
+    }
 
     private final int[] resourceTypes;
 
@@ -93,12 +93,12 @@
      */
     public ResourceType(int[] resourceTypes) {
         super(DavPropertyName.RESOURCETYPE, false);
-        for (int i=0; i<resourceTypes.length; i++) {
-            if (!isValidResourceType(resourceTypes[i])) {
-                throw new IllegalArgumentException("Invalid resource type '"+ resourceTypes[i] +"'.");
+        for (int resourceType : resourceTypes) {
+            if (!isValidResourceType(resourceType)) {
+                throw new IllegalArgumentException("Invalid resource type '" + resourceType + "'.");
             }
         }
-	this.resourceTypes = resourceTypes;
+        this.resourceTypes = resourceTypes;
     }
 
     /**
@@ -108,12 +108,12 @@
      * @return a <code>Set</code> of resource types representing this property.
      * @see DavProperty#getValue()
      */
-    public Object getValue() {
-        Set rTypes = new HashSet();
-        for (int i=0; i<resourceTypes.length; i++) {
-            Object n = NAMES.get(resourceTypes[i]);
+    public Set<XmlSerializable> getValue() {
+        Set<XmlSerializable> rTypes = new HashSet<XmlSerializable>();
+        for (int resourceType : resourceTypes) {
+            TypeName n = NAMES.get(resourceType);
             if (n != null) {
-               rTypes.add(n);
+                rTypes.add(n);
             }
         }
         return rTypes;
@@ -185,10 +185,12 @@
             hashCode = DomUtil.getExpandedName(localName, namespace).hashCode();
         }
 
+        @Override
         public int hashCode() {
             return hashCode;
         }
 
+        @Override
         public boolean equals(Object o) {
             if (o instanceof TypeName) {
                 return hashCode == ((TypeName)o).hashCode;
@@ -199,6 +201,5 @@
         public Element toXml(Document document) {
             return DomUtil.createElement(document, localName, namespace);
         }
-
     }
 }

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/QueryGrammerSet.java Tue Feb 23 13:27:10 2010
@@ -20,11 +20,11 @@
 import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.jackrabbit.webdav.xml.Namespace;
+import org.apache.jackrabbit.webdav.xml.XmlSerializable;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 /**
@@ -32,9 +32,9 @@
  * encapsulates the 'supported-query-grammer-set' as defined by the
  * Webdav SEARCH internet draft.
  */
-public class QueryGrammerSet extends AbstractDavProperty implements SearchConstants {
+public class QueryGrammerSet extends AbstractDavProperty<Set<? extends XmlSerializable>> implements SearchConstants {
 
-    private final Set queryGrammers = new HashSet();
+    private final Set<Grammer> queryGrammers = new HashSet<Grammer>();
 
     /**
      * Create a new empty <code>QueryGrammerSet</code>. Supported query grammers
@@ -64,7 +64,7 @@
         int size = queryGrammers.size();
         if (size > 0) {
             String[] qLangStr = new String[size];
-            Grammer[] grammers = (Grammer[]) queryGrammers.toArray(new Grammer[size]);
+            Grammer[] grammers = queryGrammers.toArray(new Grammer[size]);
             for (int i = 0; i < grammers.length; i++) {
                 qLangStr[i] = grammers[i].namespace.getURI() + grammers[i].localName;
             }
@@ -83,14 +83,11 @@
      * @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document)
      * @param document
      */
+    @Override
     public Element toXml(Document document) {
         Element elem = getName().toXml(document);
-        Iterator qlIter = queryGrammers.iterator();
-        while (qlIter.hasNext()) {
-            Element sqg = DomUtil.addChildElement(elem, XML_QUERY_GRAMMAR, SearchConstants.NAMESPACE);
-            Element grammer = DomUtil.addChildElement(sqg, XML_GRAMMER, SearchConstants.NAMESPACE);
-            Grammer qGrammer = (Grammer)qlIter.next();
-            DomUtil.addChildElement(grammer, qGrammer.localName, qGrammer.namespace);
+        for (Grammer qGrammer : queryGrammers) {
+            elem.appendChild(qGrammer.toXml(document));
         }
         return elem;
     }
@@ -101,12 +98,12 @@
      * @return list of supported query languages.
      * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue()
      */
-    public Object getValue() {
+    public Set<? extends XmlSerializable> getValue() {
         return queryGrammers;
     }
 
 
-    private class Grammer {
+    private class Grammer implements XmlSerializable {
 
         private final String localName;
         private final Namespace namespace;
@@ -118,10 +115,12 @@
             hashCode = DomUtil.getExpandedName(localName, namespace).hashCode();
         }
 
+        @Override
         public int hashCode() {
             return hashCode;
         }
 
+        @Override
         public boolean equals(Object obj) {
             if (obj == this) {
                 return true;
@@ -131,5 +130,15 @@
             }
             return false;
         }
+
+        /**
+         * @see XmlSerializable#toXml(org.w3c.dom.Document) 
+         */
+        public Element toXml(Document document) {
+            Element sqg = DomUtil.createElement(document, XML_QUERY_GRAMMAR, SearchConstants.NAMESPACE);
+            Element grammer = DomUtil.addChildElement(sqg, XML_GRAMMER, SearchConstants.NAMESPACE);
+            DomUtil.addChildElement(grammer, localName, namespace);
+            return sqg;
+        }
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/SearchInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/SearchInfo.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/SearchInfo.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/search/SearchInfo.java Tue Feb 23 13:27:10 2010
@@ -31,7 +31,6 @@
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.Set;
 import java.util.HashSet;
 
@@ -72,10 +71,10 @@
     /**
      * Set of namespace uri String which are ignored in the search request.
      */
-    private static final Set IGNORED_NAMESPACES;
+    private static final Set<String> IGNORED_NAMESPACES;
 
     static {
-        Set s = new HashSet();
+        Set<String> s = new HashSet<String>();
         s.add(Namespace.XMLNS_NAMESPACE.getURI());
         s.add(Namespace.XML_NAMESPACE.getURI());
         s.add(DavConstants.NAMESPACE.getURI());
@@ -85,7 +84,7 @@
     private final String language;
     private final Namespace languageNamespace;
     private final String query;
-    private final Map namespaces;
+    private final Map<String, String> namespaces;
 
     private long nresults = NRESULTS_UNDEFINED;
     private long offset = OFFSET_UNDEFINED;
@@ -98,7 +97,8 @@
      * @param query
      * @param namespaces the re-mapped namespaces. Key=prefix, value=uri.
      */
-    public SearchInfo(String language, Namespace languageNamespace, String query, Map namespaces) {
+    public SearchInfo(String language, Namespace languageNamespace, String query,
+                      Map<String, String> namespaces) {
         this.language = language;
         this.languageNamespace = languageNamespace;
         this.query = query;
@@ -113,7 +113,7 @@
      * @param query
      */
     public SearchInfo(String language, Namespace languageNamespace, String query) {
-        this(language,  languageNamespace, query, Collections.EMPTY_MAP);
+        this(language,  languageNamespace, query, Collections.<String, String>emptyMap());
     }
 
     /**
@@ -148,7 +148,7 @@
      *
      * @return map of namespace to prefix mappings. Key=prefix, value=uri.
      */
-    public Map getNamespaces() {
+    public Map<String, String> getNamespaces() {
         return namespaces;
     }
 
@@ -196,9 +196,8 @@
      */
     public Element toXml(Document document) {
         Element sRequestElem = DomUtil.createElement(document, XML_SEARCHREQUEST, NAMESPACE);
-        for (Iterator it = namespaces.keySet().iterator(); it.hasNext(); ) {
-            String prefix = (String) it.next();
-            String uri = (String) namespaces.get(prefix);
+        for (String prefix : namespaces.keySet()) {
+            String uri = namespaces.get(prefix);
             DomUtil.setNamespaceAttribute(sRequestElem, prefix, uri);
         }
         DomUtil.addChildElement(sRequestElem, language, languageNamespace, query);
@@ -231,11 +230,11 @@
         }
         Element first = DomUtil.getFirstChildElement(searchRequest);
         Attr[] nsAttributes = DomUtil.getNamespaceAttributes(searchRequest);
-        Map namespaces = new HashMap();
-        for (int i = 0; i < nsAttributes.length; i++) {
+        Map<String, String> namespaces = new HashMap<String, String>();
+        for (Attr nsAttribute : nsAttributes) {
             // filter out xmlns namespace and DAV namespace
-            if (!IGNORED_NAMESPACES.contains(nsAttributes[i].getValue())) {
-                namespaces.put(nsAttributes[i].getLocalName(), nsAttributes[i].getValue());
+            if (!IGNORED_NAMESPACES.contains(nsAttribute.getValue())) {
+                namespaces.put(nsAttribute.getLocalName(), nsAttribute.getValue());
             }
         }
         SearchInfo sInfo;
@@ -269,4 +268,4 @@
         }
         return sInfo;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/security/AclProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/security/AclProperty.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/security/AclProperty.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/security/AclProperty.java Tue Feb 23 13:27:10 2010
@@ -51,9 +51,9 @@
  * @see Principal for details regarding DAV:principal
  * @see Privilege for details regarding DAV:privilege
  */
-public class AclProperty extends AbstractDavProperty {
+public class AclProperty extends AbstractDavProperty<List<AclProperty.Ace>> {
 
-    private final List aces;
+    private final List<Ace> aces;
 
     /**
      * Create a new <code>AclProperty</code> from the given ACEs.
@@ -62,10 +62,10 @@
      * @see AclProperty#createDenyAce(Principal, Privilege[], boolean, boolean, AclResource) for a factory method to create a deny ACE.
      */
     public AclProperty(Ace[] accessControlElements) {
-        this((accessControlElements == null) ? new ArrayList() : Arrays.asList(accessControlElements));
+        this((accessControlElements == null) ? new ArrayList<Ace>() : Arrays.asList(accessControlElements));
     }
 
-    private AclProperty(List aces) {
+    private AclProperty(List<Ace> aces) {
         super(SecurityConstants.ACL, true);
         this.aces = aces;
     }
@@ -75,7 +75,7 @@
      * an empty list is returned.
      * @see DavProperty#getValue()
      */
-    public Object getValue() {
+    public List<Ace> getValue() {
         return aces;
     }
 
@@ -91,7 +91,7 @@
         if (!DomUtil.matches(aclElement, SecurityConstants.ACL.getName(), SecurityConstants.ACL.getNamespace())) {
             throw new DavException(DavServletResponse.SC_BAD_REQUEST, "ACL request requires a DAV:acl body.");
         }
-        List aces = new ArrayList();
+        List<Ace> aces = new ArrayList<Ace>();
         ElementIterator it = DomUtil.getChildren(aclElement, Ace.XML_ACE, SecurityConstants.NAMESPACE);
         while (it.hasNext()) {
             Element aceElem = it.nextElement();
@@ -101,13 +101,11 @@
     }
 
     public static Ace createGrantAce(Principal principal, Privilege[] privileges, boolean invert, boolean isProtected, AclResource inheritedFrom) {
-        Ace ace = new Ace(principal, invert, privileges, true, isProtected, inheritedFrom);
-        return ace;
+        return new Ace(principal, invert, privileges, true, isProtected, inheritedFrom);
     }
 
     public static Ace createDenyAce(Principal principal, Privilege[] privileges, boolean invert, boolean isProtected, AclResource inheritedFrom) {
-        Ace ace = new Ace(principal, invert, privileges, false, isProtected, inheritedFrom);
-        return ace;
+        return new Ace(principal, invert, privileges, false, isProtected, inheritedFrom);
     }
 
     //--------------------------------------------------------< inner class >---
@@ -212,8 +210,8 @@
                 ace.appendChild(principal.toXml(document));
             }
             Element gd = DomUtil.addChildElement(ace, ((grant) ? XML_GRANT : XML_DENY), SecurityConstants.NAMESPACE);
-            for (int i = 0; i < privileges.length; i++) {
-                gd.appendChild(privileges[i].toXml(document));
+            for (Privilege privilege : privileges) {
+                gd.appendChild(privilege.toXml(document));
             }
             if (isProtected) {
                 DomUtil.addChildElement(ace, XML_PROTECTED, SecurityConstants.NAMESPACE);
@@ -243,13 +241,13 @@
             } else {
                 gdElem = DomUtil.getChildElement(aceElement, XML_DENY, NAMESPACE);
             }
-            List privilegeList = new ArrayList();
+            List<Privilege> privilegeList = new ArrayList<Privilege>();
             ElementIterator privIt = DomUtil.getChildren(gdElem, Privilege.XML_PRIVILEGE, NAMESPACE);
             while (privIt.hasNext()) {
                Privilege pv = Privilege.getPrivilege(privIt.nextElement());
                privilegeList.add(pv);
             }
-            Privilege[] privileges = (Privilege[])privilegeList.toArray(new Privilege[privilegeList.size()]);
+            Privilege[] privileges = privilegeList.toArray(new Privilege[privilegeList.size()]);
 
             boolean isProtected = DomUtil.hasChildElement(aceElement, XML_PROTECTED, NAMESPACE);
             String inheritedHref = null;
@@ -262,4 +260,4 @@
             return ace;
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/security/AclRestrictionsProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/security/AclRestrictionsProperty.java?rev=915333&r1=915332&r2=915333&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/security/AclRestrictionsProperty.java (original)
+++ jackrabbit/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/security/AclRestrictionsProperty.java Tue Feb 23 13:27:10 2010
@@ -70,6 +70,7 @@
    /**
      * @see DavProperty#toXml(Document)
      */
+    @Override
     public Element toXml(Document document) {
         Element elem = getName().toXml(document);
         if (grantOnly) {
@@ -103,4 +104,4 @@
         // TODO: check of should be replaced by specific required-principal...
         return requiredPrincipal;
     }
-}
\ No newline at end of file
+}



Mime
View raw message