jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r915339 [2/4] - in /jackrabbit/trunk/jackrabbit-jcr-server/src: main/java/org/apache/jackrabbit/server/io/ main/java/org/apache/jackrabbit/server/jcr/ main/java/org/apache/jackrabbit/server/remoting/davex/ main/java/org/apache/jackrabbit/se...
Date Tue, 23 Feb 2010 13:37:40 GMT
Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java Tue Feb 23 13:37:38 2010
@@ -48,6 +48,7 @@
 import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
 import org.apache.jackrabbit.webdav.property.HrefProperty;
 import org.apache.jackrabbit.webdav.property.ResourceType;
+import org.apache.jackrabbit.webdav.property.PropEntry;
 import org.apache.jackrabbit.webdav.search.QueryGrammerSet;
 import org.apache.jackrabbit.webdav.search.SearchInfo;
 import org.apache.jackrabbit.webdav.search.SearchResource;
@@ -184,7 +185,7 @@
     /**
      * @see org.apache.jackrabbit.webdav.DavResource#getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
      */
-    public DavProperty getProperty(DavPropertyName name) {
+    public DavProperty<?> getProperty(DavPropertyName name) {
         return getProperties().get(name);
     }
 
@@ -205,7 +206,7 @@
      * @throws DavException Always throws {@link DavServletResponse#SC_METHOD_NOT_ALLOWED}
      * @see org.apache.jackrabbit.webdav.DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
      */
-    public void setProperty(DavProperty property) throws DavException {
+    public void setProperty(DavProperty<?> property) throws DavException {
         throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
     }
 
@@ -225,7 +226,7 @@
      *
      * @see DavResource#alterProperties(List)
      */
-    public MultiStatusResponse alterProperties(List changeList) throws DavException {
+    public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException {
         throw new DavException(DavServletResponse.SC_METHOD_NOT_ALLOWED);
     }
 
@@ -295,7 +296,7 @@
      * todo improve....
      */
     public ActiveLock[] getLocks() {
-        List locks = new ArrayList();
+        List<ActiveLock> locks = new ArrayList<ActiveLock>();
         // tx locks
         ActiveLock l = getLock(TransactionConstants.TRANSACTION, TransactionConstants.LOCAL);
         if (l != null) {
@@ -315,7 +316,7 @@
                 locks.add(l);
             }
         }
-        return (ActiveLock[]) locks.toArray(new ActiveLock[locks.size()]);
+        return locks.toArray(new ActiveLock[locks.size()]);
     }
 
     /**
@@ -471,17 +472,17 @@
      * @see DeltaVResource#getReferenceResources(org.apache.jackrabbit.webdav.property.DavPropertyName)
      */
     public DavResource[] getReferenceResources(DavPropertyName hrefPropertyName) throws DavException {
-        DavProperty prop = getProperty(hrefPropertyName);
+        DavProperty<?> prop = getProperty(hrefPropertyName);
         if (prop == null || !(prop instanceof HrefProperty)) {
             throw new DavException(DavServletResponse.SC_CONFLICT, "Unknown Href-Property '"+hrefPropertyName+"' on resource "+getResourcePath());
         }
 
-        List hrefs = ((HrefProperty)prop).getHrefs();
+        List<String> hrefs = ((HrefProperty)prop).getHrefs();
         DavResource[] refResources = new DavResource[hrefs.size()];
-        Iterator hrefIter = hrefs.iterator();
+        Iterator<String> hrefIter = hrefs.iterator();
         int i = 0;
         while (hrefIter.hasNext()) {
-            refResources[i] = getResourceFromHref((String)hrefIter.next());
+            refResources[i] = getResourceFromHref(hrefIter.next());
             i++;
         }
         return refResources;
@@ -539,31 +540,31 @@
      */
     protected void initProperties() {
         if (getDisplayName() != null) {
-            properties.add(new DefaultDavProperty(DavPropertyName.DISPLAYNAME, getDisplayName()));
+            properties.add(new DefaultDavProperty<String>(DavPropertyName.DISPLAYNAME, getDisplayName()));
         }
         if (isCollection()) {
             properties.add(new ResourceType(ResourceType.COLLECTION));
             // Windows XP support
-            properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "1"));
+            properties.add(new DefaultDavProperty<String>(DavPropertyName.ISCOLLECTION, "1"));
         } else {
             properties.add(new ResourceType(ResourceType.DEFAULT_RESOURCE));
             // Windows XP support
-            properties.add(new DefaultDavProperty(DavPropertyName.ISCOLLECTION, "0"));
+            properties.add(new DefaultDavProperty<String>(DavPropertyName.ISCOLLECTION, "0"));
         }
         // todo: add etag
 
         // default last modified
         String lastModified = IOUtil.getLastModified(getModificationTime());
-        properties.add(new DefaultDavProperty(DavPropertyName.GETLASTMODIFIED, lastModified));
+        properties.add(new DefaultDavProperty<String>(DavPropertyName.GETLASTMODIFIED, lastModified));
 
         // default creation time
-        properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE, HttpDateFormat.creationDateFormat().format(new Date(0))));
+        properties.add(new DefaultDavProperty<String>(DavPropertyName.CREATIONDATE, HttpDateFormat.creationDateFormat().format(new Date(0))));
 
         // supported lock property
         properties.add(supportedLock);
 
         // set current lock information. If no lock is applied to this resource,
-        // an empty lockdiscovery will be returned in the response.
+        // an empty xlockdiscovery will be returned in the response.
         properties.add(new LockDiscovery(getLocks()));
 
         properties.add(new SupportedMethodSetProperty(getSupportedMethods().split(",\\s")));
@@ -571,8 +572,8 @@
         // DeltaV properties
         properties.add(supportedReports);
         // creator-displayname, comment: not value available from jcr
-        properties.add(new DefaultDavProperty(DeltaVConstants.CREATOR_DISPLAYNAME, null, true));
-        properties.add(new DefaultDavProperty(DeltaVConstants.COMMENT, null, true));
+        properties.add(new DefaultDavProperty<String>(DeltaVConstants.CREATOR_DISPLAYNAME, null, true));
+        properties.add(new DefaultDavProperty<String>(DeltaVConstants.COMMENT, null, true));
 
         // 'workspace' property as defined by RFC 3253
         String workspaceHref = getWorkspaceHref();
@@ -580,7 +581,7 @@
             properties.add(new HrefProperty(DeltaVConstants.WORKSPACE, workspaceHref, true));
         }
         // name of the jcr workspace
-        properties.add(new DefaultDavProperty(ItemResourceConstants.JCR_WORKSPACE_NAME,
+        properties.add(new DefaultDavProperty<String>(ItemResourceConstants.JCR_WORKSPACE_NAME,
                 getRepositorySession().getWorkspace().getName()));
 
         // TODO: required supported-live-property-set
@@ -746,4 +747,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DavLocatorFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DavLocatorFactoryImpl.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DavLocatorFactoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DavLocatorFactoryImpl.java Tue Feb 23 13:37:38 2010
@@ -45,6 +45,7 @@
      * @return
      * @see AbstractLocatorFactory#getRepositoryPath(String, String)
      */
+    @Override
     protected String getRepositoryPath(String resourcePath, String wspPath) {
         if (resourcePath == null) {
             return null;
@@ -73,6 +74,7 @@
      * @return
      * @see AbstractLocatorFactory#getResourcePath(String, String)
      */
+    @Override
     protected String getResourcePath(String repositoryPath, String wspPath) {
         if (wspPath != null) {
             StringBuffer b = new StringBuffer(wspPath);

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java Tue Feb 23 13:37:38 2010
@@ -26,7 +26,6 @@
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -44,6 +43,8 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.version.VersionIterator;
+import javax.jcr.version.Version;
 import javax.jcr.lock.Lock;
 import javax.jcr.nodetype.NodeType;
 import javax.xml.parsers.ParserConfigurationException;
@@ -82,6 +83,7 @@
 import org.apache.jackrabbit.webdav.property.DavPropertyName;
 import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
 import org.apache.jackrabbit.webdav.property.HrefProperty;
+import org.apache.jackrabbit.webdav.property.PropEntry;
 import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -116,6 +118,7 @@
     /**
      * @see org.apache.jackrabbit.webdav.DavResource#getComplianceClass()
      */
+    @Override
     public String getComplianceClass() {
         String cc = super.getComplianceClass();
         if (isOrderable()) {
@@ -148,6 +151,7 @@
     /**
      * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
      */
+    @Override
     public String getSupportedMethods() {
         String ms = super.getSupportedMethods();
         if (isOrderable()) {
@@ -177,6 +181,7 @@
      * @throws IOException
      * @see Session#exportSystemView(String, OutputStream, boolean, boolean)
      */
+    @Override
     public void spool(OutputContext outputContext) throws IOException {
         // spool properties
         super.spool(outputContext);
@@ -207,7 +212,8 @@
      * @see org.apache.jackrabbit.webdav.DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
      * @see #JCR_MIXINNODETYPES
      */
-    public void setProperty(DavProperty property) throws DavException {
+    @Override
+    public void setProperty(DavProperty<?> property) throws DavException {
         internalSetProperty(property);
         complete();
     }
@@ -219,7 +225,7 @@
      * @throws DavException
      * @see #setProperty(DavProperty)
      */
-    private void internalSetProperty(DavProperty property) throws DavException {
+    private void internalSetProperty(DavProperty<?> property) throws DavException {
         if (!exists()) {
             throw new DavException(DavServletResponse.SC_NOT_FOUND);
         }
@@ -227,12 +233,11 @@
         if (JCR_MIXINNODETYPES.equals(propName)) {
             Node n = (Node) item;
             try {
-                NodeType[] existingMixin = n.getMixinNodeTypes();
                 NodeTypeProperty mix = new NodeTypeProperty(property);
-                Set mixins = mix.getNodeTypeNames();
+                Set<String> mixins = mix.getNodeTypeNames();
 
-                for (int i = 0; i < existingMixin.length; i++) {
-                    String name = existingMixin[i].getName();
+                for (NodeType existingMixin : n.getMixinNodeTypes()) {
+                    String name = existingMixin.getName();
                     if (mixins.contains(name)){
                         // do not add existing mixins
                         mixins.remove(name);
@@ -243,9 +248,8 @@
                 }
 
                 // add the remaining mixing types that are not yet set
-                Iterator it = mixins.iterator();
-                while (it.hasNext()) {
-                    n.addMixin((String)it.next());
+                for (String mixin : mixins) {
+                    n.addMixin(mixin);
                 }
             } catch (RepositoryException e) {
                 throw new JcrDavException(e);
@@ -254,9 +258,9 @@
             Node n = (Node) item;
             try {
                 NodeTypeProperty ntProp = new NodeTypeProperty(property);
-                Set names = ntProp.getNodeTypeNames();
+                Set<String> names = ntProp.getNodeTypeNames();
                 if (names.size() == 1) {
-                    String ntName = names.iterator().next().toString();
+                    String ntName = names.iterator().next();
                     n.setPrimaryType(ntName);
                 } else {
                     // only a single node type can be primary node type.
@@ -266,7 +270,7 @@
                 throw new JcrDavException(e);
             }
         } else {
-            // all props except for mixinnodetypes and primaryType are read-only
+            // all props except for mixin node types and primaryType are read-only
             throw new DavException(DavServletResponse.SC_CONFLICT);
         }
     }
@@ -280,6 +284,7 @@
      * @see org.apache.jackrabbit.webdav.DavResource#removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
      * @see #JCR_MIXINNODETYPES
      */
+    @Override
     public void removeProperty(DavPropertyName propertyName) throws DavException {
         internalRemoveProperty(propertyName);
         complete();
@@ -300,16 +305,15 @@
             // remove all mixin nodetypes
             try {
                 Node n = (Node)item;
-                NodeType[] mixins = n.getMixinNodeTypes();
-                for (int i = 0; i < mixins.length; i++) {
-                    n.removeMixin(mixins[i].getName());
+                for (NodeType mixin : n.getMixinNodeTypes()) {
+                    n.removeMixin(mixin.getName());
                 }
             } catch (RepositoryException e) {
                 // NoSuchNodeTypeException, ConstraintViolationException should never occur...
                 throw new JcrDavException(e);
             }
         } else {
-            // all props except for mixinnodetypes are read-only
+            // all props except for mixin node types are read-only
             throw new DavException(DavServletResponse.SC_CONFLICT);
         }
     }
@@ -328,17 +332,16 @@
      * @return
      * @throws DavException
      */
-    public MultiStatusResponse alterProperties(List changeList) throws DavException {
-        Iterator it = changeList.iterator();
-        while (it.hasNext()) {
-            Object propEntry = it.next();
+    @Override
+    public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException {
+        for (PropEntry propEntry : changeList) {
             if (propEntry instanceof DavPropertyName) {
                 // use the internal remove method in order to prevent premature 'save'
                 DavPropertyName propName = (DavPropertyName) propEntry;
                 internalRemoveProperty(propName);
             } else if (propEntry instanceof DavProperty) {
                 // use the internal set method in order to prevent premature 'save'
-                DavProperty prop = (DavProperty) propEntry;
+                DavProperty<?> prop = (DavProperty<?>) propEntry;
                 internalSetProperty(prop);
             } else {
                 throw new IllegalArgumentException("unknown object in change list: " + propEntry.getClass().getName());
@@ -347,7 +350,7 @@
         // TODO: missing undo of successful set/remove if subsequent operation fails
         // NOTE, that this is relevant with transactions only.
 
-        // success: save all changes together if no error occured
+        // success: save all changes together if no error occurred
         complete();
         return new MultiStatusResponse(getHref(), DavServletResponse.SC_OK);
     }
@@ -404,8 +407,8 @@
                         }
                     }
                     if (getTransactionId() == null) {
-                        // if not part of a transaction directely import on workspace
-                        // since changes would be explicitely saved in the
+                        // if not part of a transaction directly import on workspace
+                        // since changes would be explicitly saved in the
                         // complete-call.
                         getRepositorySession().getWorkspace().importXML(itemPath, in, uuidBehavior);
                     } else {
@@ -483,7 +486,7 @@
      * @see org.apache.jackrabbit.webdav.DavResource#getMembers()
      */
     public DavResourceIterator getMembers() {
-        ArrayList memberList = new ArrayList();
+        ArrayList<DavResource> memberList = new ArrayList<DavResource>();
         if (exists()) {
             try {
                 Node n = (Node)item;
@@ -547,6 +550,7 @@
      * fails, false is returned.
      * @see org.apache.jackrabbit.webdav.DavResource#hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
      */
+    @Override
     public boolean hasLock(Type type, Scope scope) {
         if (isLockable(type, scope)) {
             if (Type.WRITE.equals(type)) {
@@ -573,6 +577,7 @@
      * @see org.apache.jackrabbit.webdav.DavResource#getLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
      * @see javax.jcr.Node#getLock() for the write locks.
      */
+    @Override
     public ActiveLock getLock(Type type, Scope scope) {
         ActiveLock lock = null;
         if (Type.WRITE.equals(type)) {
@@ -608,6 +613,7 @@
      * @see org.apache.jackrabbit.webdav.DavResource#lock(org.apache.jackrabbit.webdav.lock.LockInfo)
      * @see Node#lock(boolean, boolean)
      */
+    @Override
     public ActiveLock lock(LockInfo reqLockInfo) throws DavException {
 
         if (!isLockable(reqLockInfo.getType(), reqLockInfo.getScope())) {
@@ -648,6 +654,7 @@
      * @see org.apache.jackrabbit.webdav.DavResource#refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String)
      * @see javax.jcr.lock.Lock#refresh()
      */
+    @Override
     public ActiveLock refreshLock(LockInfo reqLockInfo, String lockToken)
             throws DavException {
 
@@ -688,6 +695,7 @@
      * @see org.apache.jackrabbit.webdav.DavResource#unlock(String)
      * @see javax.jcr.Node#unlock()
      */
+    @Override
     public void unlock(String lockToken) throws DavException {
         ActiveLock lock = getWriteLock();
         if (lock != null && lockToken.equals(lock.getToken())) {
@@ -761,12 +769,11 @@
             throw new DavException(DavServletResponse.SC_UNPROCESSABLE_ENTITY, "Only DAV:custom ordering type supported.");
         }
 
-        OrderPatch.Member[] instructions = orderPatch.getOrderInstructions();
         Node n = (Node)item;
         try {
-            for (int i = 0; i < instructions.length; i++) {
-                String srcRelPath = Text.unescape(instructions[i].getMemberHandle());
-                Position pos = instructions[i].getPosition();
+            for (OrderPatch.Member instruction : orderPatch.getOrderInstructions()) {
+                String srcRelPath = Text.unescape(instruction.getMemberHandle());
+                Position pos = instruction.getPosition();
                 String destRelPath = getRelDestinationPath(pos, n.getNodes());
                 // preform the reordering
                 n.orderBefore(srcRelPath, destRelPath);
@@ -807,7 +814,7 @@
             String afterRelPath = position.getSegment();
             boolean found = false;
             // jcr only knows order-before > retrieve the node that follows the
-            // one incidated by the 'afterRelPath'.
+            // one indicated by the 'afterRelPath'.
             while (childNodes.hasNext() && destRelPath == null) {
                 // compare to last segment of node-path instead of name.
                 String childRelPath = Text.getName(childNodes.nextNode().getPath());
@@ -818,7 +825,7 @@
                 }
             }
         } else {
-            // before or last. in the latter case the segmet is 'null'
+            // before or last. in the latter case the segment is 'null'
             destRelPath = position.getSegment();
         }
         if (destRelPath != null) {
@@ -836,6 +843,7 @@
      *
      * @see org.apache.jackrabbit.JcrConstants#MIX_LOCKABLE
      */
+    @Override
     protected void initLockSupport() {
         super.initLockSupport();
         // add exclusive write lock if allowed for the given node
@@ -859,6 +867,7 @@
      *
      * @see org.apache.jackrabbit.webdav.version.report.SupportedReportSetProperty
      */
+    @Override
     protected void initSupportedReports() {
         super.initSupportedReports();
         if (exists()) {
@@ -870,17 +879,18 @@
     /**
      * Fill the property set for this resource.
      */
+    @Override
     protected void initProperties() {
         super.initProperties();
         if (exists()) {
             // resource is serialized as system-view (xml)
-            properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, "text/xml"));
+            properties.add(new DefaultDavProperty<String>(DavPropertyName.GETCONTENTTYPE, "text/xml"));
             Node n = (Node)item;
             // overwrite the default creation date if possible
             try {
                 if (n.hasProperty(JcrConstants.JCR_CREATED)) {
                     long creationTime = n.getProperty(JcrConstants.JCR_CREATED).getValue().getLong();
-                    properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE,
+                    properties.add(new DefaultDavProperty<String>(DavPropertyName.CREATIONDATE,
                         HttpDateFormat.creationDateFormat().format(new Date(creationTime))));
                 }
             } catch (RepositoryException e) {
@@ -891,11 +901,11 @@
             try {
                 properties.add(new NodeTypeProperty(JCR_PRIMARYNODETYPE, n.getPrimaryNodeType(), false));
                 properties.add(new NodeTypeProperty(JCR_MIXINNODETYPES, n.getMixinNodeTypes(), false));
-                properties.add(new DefaultDavProperty(JCR_INDEX, new Integer(n.getIndex()), true));
+                properties.add(new DefaultDavProperty<Integer>(JCR_INDEX, n.getIndex(), true));
                 addHrefProperty(JCR_REFERENCES, n.getReferences(), true);
                 addHrefProperty(JCR_WEAK_REFERENCES, n.getWeakReferences(), true);
                 if (n.isNodeType(JcrConstants.MIX_REFERENCEABLE)) {
-                    properties.add(new DefaultDavProperty(JCR_UUID, n.getUUID(), true));
+                    properties.add(new DefaultDavProperty<String>(JCR_UUID, n.getUUID(), true));
                 }
             } catch (RepositoryException e) {
                 log.error("Failed to retrieve node-specific property: " + e);
@@ -938,7 +948,7 @@
 
     /**
      * Add a new {@link HrefProperty href property} to the property set, where
-     * all items present in the specifed iterator are referenced in the
+     * all properties present in the specifed iterator are referenced in the
      * resulting property.
      *
      * @param name
@@ -946,13 +956,31 @@
      * @param isProtected
      * @see #addHrefProperty(DavPropertyName, Item[], boolean)
      */
-    protected void addHrefProperty(DavPropertyName name, Iterator itemIterator,
+    protected void addHrefProperty(DavPropertyName name, PropertyIterator itemIterator,
+                                   boolean isProtected) {
+        ArrayList<Property> l = new ArrayList<Property>();
+        while (itemIterator.hasNext()) {
+            l.add(itemIterator.nextProperty());
+        }
+        addHrefProperty(name, l.toArray(new Property[l.size()]), isProtected);
+    }
+
+    /**
+     * Add a new {@link HrefProperty href property} to the property set, where
+     * all versions present in the specifed iterator are referenced in the
+     * resulting property.
+     *
+     * @param name
+     * @param itemIterator
+     * @param isProtected
+     */
+    protected void addHrefProperty(DavPropertyName name, VersionIterator itemIterator,
                                    boolean isProtected) {
-        ArrayList l = new ArrayList();
+        ArrayList<Version> l = new ArrayList<Version>();
         while (itemIterator.hasNext()) {
-            l.add(itemIterator.next());
+            l.add(itemIterator.nextVersion());
         }
-        addHrefProperty(name, (Item[]) l.toArray(new Item[l.size()]), isProtected);
+        addHrefProperty(name, l.toArray(new Version[l.size()]), isProtected);
     }
 
     /**
@@ -967,7 +995,7 @@
         String errorMsg = "Cannot parse stream into a 'ValuesProperty'.";
         try {
             Document reqBody = DomUtil.BUILDER_FACTORY.newDocumentBuilder().parse(in);
-            DavProperty defaultProp = DefaultDavProperty.createFromXml(reqBody.getDocumentElement());
+            DavProperty<?> defaultProp = DefaultDavProperty.createFromXml(reqBody.getDocumentElement());
             ValuesProperty vp = new ValuesProperty(defaultProp, PropertyType.STRING, getRepositorySession().getValueFactory());
             return vp;
         } catch (IOException e) {

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemResource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemResource.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemResource.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemResource.java Tue Feb 23 13:37:38 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.webdav.jcr;
 
+import org.apache.jackrabbit.server.io.IOUtil;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.DavResource;
 import org.apache.jackrabbit.webdav.DavResourceFactory;
@@ -24,7 +25,6 @@
 import org.apache.jackrabbit.webdav.DavResourceLocator;
 import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.MultiStatusResponse;
-import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.jackrabbit.webdav.io.InputContext;
 import org.apache.jackrabbit.webdav.io.OutputContext;
 import org.apache.jackrabbit.webdav.jcr.property.LengthsProperty;
@@ -34,10 +34,9 @@
 import org.apache.jackrabbit.webdav.lock.Type;
 import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.apache.jackrabbit.webdav.property.DavPropertySet;
 import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
-import org.apache.jackrabbit.server.io.IOUtil;
+import org.apache.jackrabbit.webdav.property.PropEntry;
+import org.apache.jackrabbit.webdav.xml.DomUtil;
 import org.apache.xml.serialize.OutputFormat;
 import org.apache.xml.serialize.XMLSerializer;
 import org.slf4j.Logger;
@@ -49,16 +48,15 @@
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.ValueFormatException;
 import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
 import javax.xml.parsers.ParserConfigurationException;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.Collections;
 import java.util.Date;
+import java.util.List;
 
 /**
  * <code>DefaultItemResource</code> represents JCR property item.
@@ -113,6 +111,7 @@
      * @param outputContext
      * @see DavResource#spool(OutputContext)
      */
+    @Override
     public void spool(OutputContext outputContext) throws IOException {
         // write properties
         super.spool(outputContext);
@@ -158,7 +157,8 @@
      * @throws DavException
      * @see DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
      */
-    public void setProperty(DavProperty property) throws DavException {
+    @Override
+    public void setProperty(DavProperty<?> property) throws DavException {
         internalSetProperty(property);
         complete();
     }
@@ -169,9 +169,9 @@
      * @param property
      * @throws DavException
      * @see #setProperty(DavProperty)
-     * @see #alterProperties(DavPropertySet, DavPropertyNameSet)
+     * @see #alterProperties(List)
      */
-    private void internalSetProperty(DavProperty property) throws DavException {
+    private void internalSetProperty(DavProperty<?> property) throws DavException {
         if (!exists()) {
             throw new DavException(DavServletResponse.SC_NOT_FOUND);
         }
@@ -201,6 +201,7 @@
      * @throws DavException
      * @see org.apache.jackrabbit.webdav.DavResource#removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
      */
+    @Override
     public void removeProperty(DavPropertyName propertyName) throws DavException {
         if (!exists()) {
             throw new DavException(DavServletResponse.SC_NOT_FOUND);
@@ -220,16 +221,15 @@
      * @throws DavException
      * @see DavResource#alterProperties(List)
      */
-    public MultiStatusResponse alterProperties(List changeList) throws DavException {
-        Iterator it = changeList.iterator();
-        while (it.hasNext()) {
-            Object propEntry = it.next();
+    @Override
+    public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException {
+        for (PropEntry propEntry : changeList) {
             if (propEntry instanceof DavPropertyName) {
                 // altering any properties fails if an attempt is made to remove
                 // a property
                 throw new DavException(DavServletResponse.SC_FORBIDDEN);
             } else if (propEntry instanceof DavProperty) {
-                DavProperty prop = (DavProperty) propEntry;
+                DavProperty<?> prop = (DavProperty<?>) propEntry;
                 internalSetProperty(prop);
             } else {
                 throw new IllegalArgumentException("unknown object in change list: " + propEntry.getClass().getName());
@@ -257,7 +257,8 @@
      */
     public DavResourceIterator getMembers() {
         log.warn("A non-collection resource never has internal members.");
-        return new DavResourceIteratorImpl(new ArrayList(0));
+        List<DavResource> drl = Collections.emptyList();
+        return new DavResourceIteratorImpl(drl);
     }
 
     /**
@@ -281,6 +282,7 @@
      * has no lock.
      * @see DavResource#getLock(Type, Scope)
      */
+    @Override
     public ActiveLock getLock(Type type, Scope scope) {
         if (Type.WRITE.equals(type)) {
             return getCollection().getLock(type, scope);
@@ -293,6 +295,7 @@
     /**
      * Add resource specific properties.
      */
+    @Override
     protected void initProperties() {
         super.initProperties();
         if (exists()) {
@@ -308,17 +311,17 @@
                     contentType = IOUtil.buildContentType(JcrValueType.contentTypeFromType(type), "utf-8");
 
                 }
-                properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, contentType));
+                properties.add(new DefaultDavProperty<String>(DavPropertyName.GETCONTENTTYPE, contentType));
 
                 // add jcr-specific resource properties
-                properties.add(new DefaultDavProperty(JCR_TYPE, PropertyType.nameFromValue(type)));
+                properties.add(new DefaultDavProperty<String>(JCR_TYPE, PropertyType.nameFromValue(type)));
                 if (isMultiple()) {
                     properties.add(new ValuesProperty(prop.getValues()));
                     properties.add(new LengthsProperty(prop.getLengths()));
                 } else {
                     properties.add(new ValuesProperty(prop.getValue()));
                     long length = prop.getLength();
-                    properties.add(new DefaultDavProperty(JCR_LENGTH, String.valueOf(length), true));
+                    properties.add(new DefaultDavProperty<String>(JCR_LENGTH, String.valueOf(length), true));
                 }
             } catch (RepositoryException e) {
                 log.error("Failed to retrieve resource properties: "+e.getMessage());
@@ -343,4 +346,4 @@
         }
         return false;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/ItemResourceConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/ItemResourceConstants.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/ItemResourceConstants.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/ItemResourceConstants.java Tue Feb 23 13:37:38 2010
@@ -76,7 +76,7 @@
     public static final String XML_PREFIX = "prefix";
     public static final String XML_URI = "uri";
 
-    // xml elements used for repository-descritors report
+    // xml elements used for repository-descriptors report
     public static final String XML_DESCRIPTOR = "descriptor";
     public static final String XML_DESCRIPTORKEY = "descriptorkey";
     public static final String XML_DESCRIPTORVALUE = "descriptorvalue";
@@ -146,7 +146,7 @@
     // property names used for resource representing a workspace
     public static final DavPropertyName JCR_NAMESPACES = DavPropertyName.create("namespaces", NAMESPACE);
 
-    // property names used for resource representing a version hisotry
+    // property names used for resource representing a version history
     public static final DavPropertyName JCR_VERSIONABLEUUID = DavPropertyName.create("versionableuuid", NAMESPACE);
 
     //-----------------------------------------< JSR170 specific privileges >---
@@ -166,4 +166,4 @@
      * Privilege representing the JSR170 'remove' action.
      */
     public static final Privilege PRIVILEGE_JCR_REMOVE = Privilege.getPrivilege("remove", NAMESPACE);
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JCRWebdavServerServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JCRWebdavServerServlet.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JCRWebdavServerServlet.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JCRWebdavServerServlet.java Tue Feb 23 13:37:38 2010
@@ -95,6 +95,7 @@
      *
      * @throws ServletException
      */
+    @Override
     public void init() throws ServletException {
         super.init();
 
@@ -113,7 +114,7 @@
         subscriptionMgr = new SubscriptionManagerImpl();
         txMgr.addTransactionListener((SubscriptionManagerImpl) subscriptionMgr);
 
-        // todo: ev. make configurable
+        // todo: eventually make configurable
         resourceFactory = new DavResourceFactoryImpl(txMgr, subscriptionMgr);
         locatorFactory = new DavLocatorFactoryImpl(pathPrefix);
     }
@@ -128,6 +129,7 @@
      *
      * @see AbstractWebdavServlet#isPreconditionValid(WebdavRequest, DavResource)
      */
+    @Override
     protected boolean isPreconditionValid(WebdavRequest request, DavResource resource) {
         // first check matching If header
         if (!request.matchesIfHeader(resource)) {
@@ -140,7 +142,7 @@
             Session repositorySesssion = JcrDavSession.getRepositorySession(request.getDavSession());
             String reqWspName = resource.getLocator().getWorkspaceName();
             String wsName = repositorySesssion.getWorkspace().getName();
-            //  compare workspace names if the req. resource is not the root-collection.
+            //  compare workspace names if the requested resource isn't the root-collection.
             if (reqWspName != null && !reqWspName.equals(wsName)) {
                 return false;
             }
@@ -161,6 +163,7 @@
      * @return server
      * @see AbstractWebdavServlet#getDavSessionProvider()
      */
+    @Override
     public DavSessionProvider getDavSessionProvider() {
         if (server == null) {
             Repository repository = getRepository();
@@ -177,6 +180,7 @@
      *
      * @see AbstractWebdavServlet#setDavSessionProvider(DavSessionProvider)
      */
+    @Override
     public void setDavSessionProvider(DavSessionProvider davSessionProvider) {
         throw new UnsupportedOperationException("Not implemented. DavSession(s) are provided by the 'JCRWebdavServer'");
     }
@@ -186,6 +190,7 @@
      *
      * @see AbstractWebdavServlet#getLocatorFactory()
      */
+    @Override
     public DavLocatorFactory getLocatorFactory() {
         if (locatorFactory == null) {
             locatorFactory = new DavLocatorFactoryImpl(pathPrefix);
@@ -198,6 +203,7 @@
      *
      * @see AbstractWebdavServlet#setLocatorFactory(DavLocatorFactory)
      */
+    @Override
     public void setLocatorFactory(DavLocatorFactory locatorFactory) {
         this.locatorFactory = locatorFactory;
     }
@@ -207,6 +213,7 @@
      *
      * @see AbstractWebdavServlet#getResourceFactory()
      */
+    @Override
     public DavResourceFactory getResourceFactory() {
         if (resourceFactory == null) {
             resourceFactory = new DavResourceFactoryImpl(txMgr, subscriptionMgr);
@@ -219,6 +226,7 @@
      *
      * @see AbstractWebdavServlet#setResourceFactory(org.apache.jackrabbit.webdav.DavResourceFactory)
      */
+    @Override
     public void setResourceFactory(DavResourceFactory resourceFactory) {
         this.resourceFactory = resourceFactory;
     }
@@ -230,6 +238,7 @@
      * @return corresponding init parameter or {@link #DEFAULT_AUTHENTICATE_HEADER}.
      * @see #INIT_PARAM_AUTHENTICATE_HEADER
      */
+    @Override
     public String getAuthenticateHeaderValue() {
         return authenticate_header;
     }

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrDavException.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrDavException.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrDavException.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrDavException.java Tue Feb 23 13:37:38 2010
@@ -44,7 +44,6 @@
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.version.VersionException;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.LinkedHashMap;
 
@@ -58,47 +57,49 @@
     private static Logger log = LoggerFactory.getLogger(JcrDavException.class);
 
     // ordered mapping of Jcr exceptions to error codes.
-    private static Map codeMap = new LinkedHashMap(20);
+    private static Map<Class<? extends Throwable>, Integer> codeMap = new LinkedHashMap<Class<? extends Throwable>, Integer>(20);
     static {
-        codeMap.put(AccessDeniedException.class, new Integer(DavServletResponse.SC_FORBIDDEN));
-        codeMap.put(ConstraintViolationException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(InvalidItemStateException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(InvalidSerializedDataException.class, new Integer(DavServletResponse.SC_BAD_REQUEST));
-        codeMap.put(InvalidQueryException.class, new Integer(DavServletResponse.SC_BAD_REQUEST));
-        codeMap.put(ItemExistsException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(ItemNotFoundException.class, new Integer(DavServletResponse.SC_FORBIDDEN));
-        codeMap.put(LockException.class, new Integer(DavServletResponse.SC_LOCKED));
-        codeMap.put(MergeException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(NamespaceException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(NoSuchNodeTypeException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(NoSuchWorkspaceException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(PathNotFoundException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(ReferentialIntegrityException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(LoginException.class, new Integer(DavServletResponse.SC_UNAUTHORIZED));
-        codeMap.put(UnsupportedRepositoryOperationException.class, new Integer(DavServletResponse.SC_NOT_IMPLEMENTED));
-        codeMap.put(ValueFormatException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(VersionException.class, new Integer(DavServletResponse.SC_CONFLICT));
-        codeMap.put(RepositoryException.class, new Integer(DavServletResponse.SC_FORBIDDEN));
+        codeMap.put(AccessDeniedException.class, DavServletResponse.SC_FORBIDDEN);
+        codeMap.put(ConstraintViolationException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(InvalidItemStateException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(InvalidSerializedDataException.class, DavServletResponse.SC_BAD_REQUEST);
+        codeMap.put(InvalidQueryException.class, DavServletResponse.SC_BAD_REQUEST);
+        codeMap.put(ItemExistsException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(ItemNotFoundException.class, DavServletResponse.SC_FORBIDDEN);
+        codeMap.put(LockException.class, DavServletResponse.SC_LOCKED);
+        codeMap.put(MergeException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(NamespaceException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(NoSuchNodeTypeException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(NoSuchWorkspaceException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(PathNotFoundException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(ReferentialIntegrityException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(LoginException.class, DavServletResponse.SC_UNAUTHORIZED);
+        codeMap.put(UnsupportedRepositoryOperationException.class, DavServletResponse.SC_NOT_IMPLEMENTED);
+        codeMap.put(ValueFormatException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(VersionException.class, DavServletResponse.SC_CONFLICT);
+        codeMap.put(RepositoryException.class, DavServletResponse.SC_FORBIDDEN);
     }
 
-    private static int lookupErrorCode(Class exceptionClass) {
-        Integer code = (Integer) codeMap.get(exceptionClass);
+    private static int lookupErrorCode(Class<? extends Throwable> exceptionClass) {
+        Integer code = codeMap.get(exceptionClass);
         if (code == null) {
-            for (Iterator it = codeMap.keySet().iterator(); it.hasNext();) {
-                Class jcrExceptionClass = (Class) it.next();
+            for (Class<? extends Throwable> jcrExceptionClass : codeMap.keySet()) {
                 if (jcrExceptionClass.isAssignableFrom(exceptionClass)) {
-                    code = (Integer) codeMap.get(jcrExceptionClass);
+                    code = codeMap.get(jcrExceptionClass);
                     break;
                 }
             }
             if (code == null) {
-                code = new Integer(DavServletResponse.SC_FORBIDDEN); // fallback
+                code = DavServletResponse.SC_FORBIDDEN; // fallback
             }
         }
-        return code.intValue();
+        return code;
     }
-    
-    private Class exceptionClass;
+
+    /**
+     * The exception wrapped by this DavException instance.
+     */
+    private Class<? extends Throwable> exceptionClass;
 
     /**
      * Create a new <code>JcrDavException</code>.
@@ -136,6 +137,7 @@
      *
      * @return true
      */
+    @Override
     public boolean hasErrorCondition() {
         return true;
     }
@@ -148,6 +150,7 @@
      * @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document)
      * @param document
      */
+    @Override
     public Element toXml(Document document) {
         Element error = DomUtil.createElement(document, XML_ERROR, DavConstants.NAMESPACE);
         Element excep = DomUtil.createElement(document, "exception", ItemResourceConstants.NAMESPACE);

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrDavSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrDavSession.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrDavSession.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/JcrDavSession.java Tue Feb 23 13:37:38 2010
@@ -49,7 +49,7 @@
     private final Session session;
 
     /** the lock tokens of this session */
-    private final HashSet lockTokens = new HashSet();
+    private final HashSet<String> lockTokens = new HashSet<String>();
 
     /**
      *
@@ -107,7 +107,7 @@
      * @see DavSession#getLockTokens()
      */
     public String[] getLockTokens() {
-        return (String[]) lockTokens.toArray(new String[lockTokens.size()]);
+        return lockTokens.toArray(new String[lockTokens.size()]);
     }
 
     /**
@@ -128,4 +128,4 @@
             return token;
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java Tue Feb 23 13:37:38 2010
@@ -194,11 +194,11 @@
      * @see org.apache.jackrabbit.webdav.DavResource#getMembers()
      */
     public DavResourceIterator getMembers() {
-        List memberList = new ArrayList();
+        List<DavResource> memberList = new ArrayList();
         try {
             String[] wsNames = getRepositorySession().getWorkspace().getAccessibleWorkspaceNames();
-            for (int i = 0; i < wsNames.length; i++) {
-                String wspPath = "/"+wsNames[i];
+            for (String wsName : wsNames) {
+                String wspPath = "/" + wsName;
                 DavResourceLocator childLoc = getLocator().getFactory().createResourceLocator(getLocator().getPrefix(), wspPath, wspPath);
                 memberList.add(createResourceFromLocator(childLoc));
             }
@@ -223,6 +223,7 @@
     /**
      * @see AbstractResource#initLockSupport()
      */
+    @Override
     protected void initLockSupport() {
         // no locking supported
     }
@@ -235,7 +236,8 @@
      * @return <code>null</code>
      * @see AbstractResource#getWorkspaceHref()
      */
+    @Override
     protected String getWorkspaceHref() {
         return null;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/VersionControlledItemCollection.java Tue Feb 23 13:37:38 2010
@@ -29,6 +29,7 @@
 import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
 import org.apache.jackrabbit.webdav.property.HrefProperty;
 import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.property.PropEntry;
 import org.apache.jackrabbit.webdav.version.LabelInfo;
 import org.apache.jackrabbit.webdav.version.MergeInfo;
 import org.apache.jackrabbit.webdav.version.UpdateInfo;
@@ -54,7 +55,7 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import java.util.List;
-import java.util.ArrayList;
+import java.util.Collections;
 
 /**
  * <code>VersionControlledItemCollection</code> represents a JCR node item and
@@ -90,6 +91,7 @@
      * @return the supported method names.
      * @see org.apache.jackrabbit.webdav.DavResource#getSupportedMethods()
      */
+    @Override
     public String getSupportedMethods() {
         StringBuffer sb = new StringBuffer(super.getSupportedMethods());
         // Versioning support
@@ -112,10 +114,11 @@
     /**
      * @param changeList
      * @throws DavException
-     * @see DefaultItemCollection#alterProperties(org.apache.jackrabbit.webdav.property.DavPropertySet, org.apache.jackrabbit.webdav.property.DavPropertyNameSet)
+     * @see DefaultItemCollection#alterProperties(List)
      * for additional description of non-compliant behaviour.
      */
-    public MultiStatusResponse alterProperties(List changeList) throws DavException {
+    @Override
+    public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException {
         /* first resolve merge conflict since they cannot be handled by
            setting property values in jcr (and are persisted immediately).
            NOTE: this violates RFC 2518 that requires that proppatch
@@ -144,18 +147,18 @@
      * @see Node#doneMerge(Version)
      * @see Node#cancelMerge(Version)
      */
-    private void resolveMergeConflict(List changeList) throws DavException {
+    private void resolveMergeConflict(List<? extends PropEntry> changeList) throws DavException {
         if (!exists()) {
             throw new DavException(DavServletResponse.SC_NOT_FOUND);
         }
         try {
-            Node n = (Node)item;
-            DavProperty autoMergeSet = null;
-            DavProperty predecessorSet = null;
+            Node n = (Node) item;
+            DavProperty<?> autoMergeSet = null;
+            DavProperty<?> predecessorSet = null;
             /* find DAV:auto-merge-set entries. If none exists no attempt is made
                to resolve merge conflict > return silently */
             for (int i = 0; i < changeList.size(); i++) {
-                Object propEntry = changeList.get(i);
+                PropEntry propEntry = changeList.get(i);
                 // If DAV:auto-merge-set is DavPropertyName all remaining merge
                 // conflicts are resolved with 'cancel'
                 if (propEntry instanceof DavPropertyName && AUTO_MERGE_SET.equals(propEntry)) {
@@ -164,16 +167,16 @@
                         throw new DavException(DavServletResponse.SC_CONFLICT, "Attempt to resolve non-existing merge conflicts.");
                     }
                     Value[] mergeFailed = n.getProperty(JcrConstants.JCR_MERGEFAILED).getValues();
-                    for (int j = 0; j < mergeFailed.length; j++) {
-                        n.cancelMerge((Version)getRepositorySession().getNodeByUUID(mergeFailed[j].getString()));
+                    for (Value value : mergeFailed) {
+                        n.cancelMerge((Version) getRepositorySession().getNodeByUUID(value.getString()));
                     }
                     // remove this entry from the changeList
                     changeList.remove(propEntry);
                 } else if (propEntry instanceof DavProperty) {
-                    if (AUTO_MERGE_SET.equals(((DavProperty)propEntry).getName())) {
-                        autoMergeSet = (DavProperty)propEntry;
-                    } else if (PREDECESSOR_SET.equals(((DavProperty)propEntry).getName())) {
-                        predecessorSet = (DavProperty)propEntry;
+                    if (AUTO_MERGE_SET.equals(((DavProperty<?>)propEntry).getName())) {
+                        autoMergeSet = (DavProperty<?>) propEntry;
+                    } else if (PREDECESSOR_SET.equals(((DavProperty<?>)propEntry).getName())) {
+                        predecessorSet = (DavProperty<?>) propEntry;
                     }
                 }
             }
@@ -186,17 +189,22 @@
                     throw new DavException(DavServletResponse.SC_CONFLICT, "Attempt to resolve non-existing merge conflicts.");
                 }
 
-                List mergeset = new HrefProperty(autoMergeSet).getHrefs();
-                List predecSet = (predecessorSet == null) ? new ArrayList() : new HrefProperty(predecessorSet).getHrefs();
+                List<String> mergeset = new HrefProperty(autoMergeSet).getHrefs();
+                List<String> predecL;
+                if (predecessorSet == null) {
+                    predecL = Collections.emptyList();
+                } else {
+                    predecL = new HrefProperty(predecessorSet).getHrefs();
+                }
 
                 Session session = getRepositorySession();
                 // loop over the mergeFailed values (versions) and test whether they are
                 // removed from the DAV:auto-merge-set thus indicating resolution.
                 Value[] mergeFailed = n.getProperty(JcrConstants.JCR_MERGEFAILED).getValues();
-                for (int i = 0; i < mergeFailed.length; i++) {
+                for (Value value : mergeFailed) {
                     // build version-href from each entry in the jcr:mergeFailed property
                     // in order to be able to compare to the entries in the HrefProperty.
-                    Version version = (Version) session.getNodeByUUID(mergeFailed[i].getString());
+                    Version version = (Version) session.getNodeByUUID(value.getString());
                     String href = getLocatorFromItem(version).getHref(true);
 
                     // Test if that version has been removed from the merge-set.
@@ -207,7 +215,7 @@
                         // appropriate. If the value has been removed from the
                         // merge-set but not added to the predecessors 'cancelMerge'
                         // must be called.
-                        if (predecSet.contains(href)) {
+                        if (predecL.contains(href)) {
                             n.doneMerge(version);
                         } else {
                             n.cancelMerge(version);
@@ -497,19 +505,21 @@
      *
      * @see SupportedReportSetProperty
      */
+    @Override
     protected void initSupportedReports() {
         super.initSupportedReports();
         if (exists()) {
-	    supportedReports.addReportType(ReportType.LOCATE_BY_HISTORY);
+            supportedReports.addReportType(ReportType.LOCATE_BY_HISTORY);
             if (this.isVersionControlled()) {
-            supportedReports.addReportType(ReportType.VERSION_TREE);
-	    }
+                supportedReports.addReportType(ReportType.VERSION_TREE);
+            }
         }
     }
 
     /**
      * Fill the property set for this resource.
      */
+    @Override
     protected void initProperties() {
         super.initProperties();
         if (exists()) {
@@ -523,7 +533,7 @@
                     properties.add(new HrefProperty(VERSION_HISTORY, vhHref, true));
 
                     // DAV:auto-version property: there is no auto version, explicit CHECKOUT is required.
-                    properties.add(new DefaultDavProperty(AUTO_VERSION, null, false));
+                    properties.add(new DefaultDavProperty<String>(AUTO_VERSION, null, false));
 
                     String baseVHref = getLocatorFromItem(n.getBaseVersion()).getHref(true);
                     if (n.isCheckedOut()) {
@@ -570,7 +580,7 @@
             throws ValueFormatException, IllegalStateException, RepositoryException {
         Node[] nodes = new Node[values.length];
         for (int i = 0; i < values.length; i++) {
-            nodes[i] = getRepositorySession().getNodeByUUID(values[i].getString());
+            nodes[i] = getRepositorySession().getNodeByIdentifier(values[i].getString());
         }
         addHrefProperty(name, nodes, isProtected);
     }
@@ -602,4 +612,4 @@
         String prefix = getLocator().getPrefix();
         return f.createResourceLocator(prefix, href);
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java Tue Feb 23 13:37:38 2010
@@ -40,6 +40,7 @@
 import org.apache.jackrabbit.webdav.jcr.property.NamespacesProperty;
 import org.apache.jackrabbit.webdav.jcr.version.report.JcrPrivilegeReport;
 import org.apache.jackrabbit.webdav.property.DavProperty;
+import org.apache.jackrabbit.webdav.property.PropEntry;
 import org.apache.jackrabbit.webdav.io.InputContext;
 import org.apache.jackrabbit.webdav.io.OutputContext;
 import org.w3c.dom.Element;
@@ -52,12 +53,11 @@
 import javax.jcr.Repository;
 import javax.jcr.version.Version;
 import javax.jcr.observation.EventListener;
-import java.util.Iterator;
 import java.util.List;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Collections;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.OutputStreamWriter;
@@ -214,16 +214,17 @@
      * @return
      */
     public DavResourceIterator getMembers() {
-        List l = new ArrayList();
         try {
             DavResourceLocator loc = getLocatorFromItem(getRepositorySession().getRootNode());
-            l.add(createResourceFromLocator(loc));
+            List<DavResource> list = Collections.singletonList(createResourceFromLocator(loc));
+            return new DavResourceIteratorImpl(list);
         } catch (DavException e) {
             log.error("Internal error while building resource for the root node.", e);
+            return DavResourceIteratorImpl.EMPTY;
         } catch (RepositoryException e) {
             log.error("Internal error while building resource for the root node.", e);
-        }
-        return new DavResourceIteratorImpl(l);
+            return DavResourceIteratorImpl.EMPTY;
+        }       
     }
 
     /**
@@ -247,30 +248,27 @@
      * @throws DavException
      * @see DavResource#setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
      */
-    public void setProperty(DavProperty property) throws DavException {
+    @Override
+    public void setProperty(DavProperty<?> property) throws DavException {
         if (ItemResourceConstants.JCR_NAMESPACES.equals(property.getName())) {
             NamespacesProperty nsp = new NamespacesProperty(property);
             try {
-                Map changes = new HashMap(nsp.getNamespaces());
+                Map<String, String> changes = new HashMap<String, String>(nsp.getNamespaces());
                 NamespaceRegistry nsReg = getRepositorySession().getWorkspace().getNamespaceRegistry();
-                String[] registeredPrefixes = nsReg.getPrefixes();
-                for (int i = 0; i < registeredPrefixes.length; i++) {
-                    String prfx = registeredPrefixes[i];
-                    if (!changes.containsKey(prfx)) {
+                for (String prefix : nsReg.getPrefixes()) {
+                    if (!changes.containsKey(prefix)) {
                         // prefix not present amongst the new values any more > unregister
-                        nsReg.unregisterNamespace(prfx);
-                    } else if (changes.get(prfx).equals(nsReg.getURI(prfx))) {
+                        nsReg.unregisterNamespace(prefix);
+                    } else if (changes.get(prefix).equals(nsReg.getURI(prefix))) {
                         // present with same uri-value >> no action required
-                        changes.remove(prfx);
+                        changes.remove(prefix);
                     }
                 }
 
                 // try to register any prefix/uri pair that has a changed uri or
                 // it has not been present before.
-                Iterator prefixIt = changes.keySet().iterator();
-                while (prefixIt.hasNext()) {
-                    String prefix = (String)prefixIt.next();
-                    String uri = (String)changes.get(prefix);
+                for (String prefix : changes.keySet()) {
+                    String uri = changes.get(prefix);
                     nsReg.registerNamespace(prefix, uri);
                 }
             } catch (RepositoryException e) {
@@ -287,22 +285,23 @@
      * and forwards any other set or remove requests to the super class.
      *
      * @see #setProperty(DavProperty)
-     * @see DefaultItemCollection#alterProperties(org.apache.jackrabbit.webdav.property.DavPropertySet, org.apache.jackrabbit.webdav.property.DavPropertyNameSet)
+     * @see DefaultItemCollection#alterProperties(List)
      */
-    public MultiStatusResponse alterProperties(List changeList) throws DavException {
+    @Override
+    public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException {
         if (changeList.size() == 1) {
-           Object propEntry = changeList.get(0);
+           PropEntry propEntry = changeList.get(0);
             // only modification of prop is allowed. removal is not possible
             if (propEntry instanceof DavProperty
-                && ItemResourceConstants.JCR_NAMESPACES.equals(((DavProperty)propEntry).getName())) {
-                DavProperty namespaceProp = (DavProperty) propEntry;
+                && ItemResourceConstants.JCR_NAMESPACES.equals(((DavProperty<?>)propEntry).getName())) {
+                DavProperty<?> namespaceProp = (DavProperty<?>) propEntry;
                 setProperty(namespaceProp);
             } else {
                 // attempt to remove the namespace property
                 throw new DavException(DavServletResponse.SC_CONFLICT);
             }
         } else {
-            // changelist contains more than the jcr:namespaces property
+            // change list contains more than the jcr:namespaces property
             // TODO: build multistatus instead
             throw new DavException(DavServletResponse.SC_CONFLICT);
         }
@@ -427,25 +426,29 @@
     }
 
     //---------------------------------------------------< AbstractResource >---
+    @Override
     protected void initLockSupport() {
         // lock not allowed
     }
 
+    @Override
     protected void initSupportedReports() {
         super.initSupportedReports();
         supportedReports.addReportType(JcrPrivilegeReport.PRIVILEGES_REPORT);
     }
 
+    @Override
     protected String getWorkspaceHref() {
         return getHref();
     }
 
+    @Override
     protected void initProperties() {
         super.initProperties();
         try {
             // init workspace specific properties
             NamespaceRegistry nsReg = getRepositorySession().getWorkspace().getNamespaceRegistry();
-            DavProperty namespacesProp = new NamespacesProperty(nsReg);
+            DavProperty<?> namespacesProp = new NamespacesProperty(nsReg);
             properties.add(namespacesProp);
         } catch (RepositoryException e) {
             log.error("Failed to access NamespaceRegistry: " + e.getMessage());
@@ -453,4 +456,4 @@
 
         // TODO: required property DAV:workspace-checkout-set (computed)
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/JcrActiveLock.java Tue Feb 23 13:37:38 2010
@@ -96,11 +96,11 @@
         String token = lock.getLockToken();
         if (token == null && lock.isSessionScoped()
                 && lock instanceof javax.jcr.lock.Lock
-                && ((javax.jcr.lock.Lock)lock).isLockOwningSession()) {
+                && lock.isLockOwningSession()) {
             // special handling for session scoped locks that are owned by the
             // current session but never expose their token with jsr 283.
             try {
-                token = ((javax.jcr.Node)lock.getNode()).getIdentifier();
+                token = lock.getNode().getIdentifier();
             } catch (RepositoryException e) {
                 // should never get here
                 log.warn("Unexpected error while retrieving node identifier for building a DAV specific lock token.",e.getMessage());
@@ -177,4 +177,4 @@
     public Scope getScope() {
         return (lock.isSessionScoped()) ? ItemResourceConstants.EXCLUSIVE_SESSION : Scope.EXCLUSIVE;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/NodeDefinitionImpl.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/NodeDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/NodeDefinitionImpl.java Tue Feb 23 13:37:38 2010
@@ -99,6 +99,7 @@
      * @return xml representation
      * @param document
      */
+    @Override
     public Element toXml(Document document) {
         Element elem = super.toXml(document);
         elem.setAttribute(SAMENAMESIBLINGS_ATTRIBUTE, Boolean.toString(allowsSameNameSiblings()));
@@ -108,11 +109,10 @@
             elem.setAttribute(DEFAULTPRIMARYTYPE_ATTRIBUTE, defaultPrimaryType.getName());
         }
         // reqPrimaryTypes: minimal set is nt:base.
-        NodeType[] nts = getRequiredPrimaryTypes();
         Element reqPrimaryTypes = document.createElement(REQUIREDPRIMARYTYPES_ELEMENT);
-        for (int i = 0; i < nts.length; i++) {
+        for (NodeType nt : getRequiredPrimaryTypes()) {
             Element rptElem = document.createElement(REQUIREDPRIMARYTYPE_ELEMENT);
-            DomUtil.setText(rptElem, nts[i].getName());
+            DomUtil.setText(rptElem, nt.getName());
             reqPrimaryTypes.appendChild(rptElem);
 
         }
@@ -125,8 +125,9 @@
      *
      * @return always returns {@link #CHILDNODEDEFINITION_ELEMENT}.
      */
+    @Override
     String getElementName() {
         return CHILDNODEDEFINITION_ELEMENT;
     }
 
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/NodeTypeProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/NodeTypeProperty.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/NodeTypeProperty.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/NodeTypeProperty.java Tue Feb 23 13:37:38 2010
@@ -26,20 +26,19 @@
 import org.w3c.dom.Element;
 
 import javax.jcr.nodetype.NodeType;
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
 /**
  * <code>NodeTypeProperty</code>...
  */
-public class NodeTypeProperty extends AbstractDavProperty implements NodeTypeConstants {
+public class NodeTypeProperty extends AbstractDavProperty<Set<String>> implements NodeTypeConstants {
 
     private static Logger log = LoggerFactory.getLogger(NodeTypeProperty.class);
 
-    private final Set nodetypeNames = new HashSet();
+    private final Set<String> nodetypeNames = new HashSet<String>();
 
     public NodeTypeProperty(DavPropertyName name, NodeType nodeType, boolean isProtected) {
         this(name, new NodeType[]{nodeType}, isProtected);
@@ -47,19 +46,18 @@
 
     public NodeTypeProperty(DavPropertyName name, NodeType[] nodeTypes, boolean isProtected) {
         super(name, isProtected);
-        for (int i = 0; i < nodeTypes.length; i++) {
-            NodeType nt = nodeTypes[i];
+        for (NodeType nt : nodeTypes) {
             if (nt != null) {
-                nodetypeNames.add(nodeTypes[i].getName());
+                nodetypeNames.add(nt.getName());
             }
         }
     }
 
     public NodeTypeProperty(DavPropertyName name, String[] nodeTypeNames, boolean isProtected) {
         super(name, isProtected);
-        for (int i = 0; i < nodeTypeNames.length; i++) {
-            if (nodeTypeNames[i] != null) {
-                nodetypeNames.add(nodeTypeNames[i]);
+        for (String nodeTypeName : nodeTypeNames) {
+            if (nodeTypeName != null) {
+                nodetypeNames.add(nodeTypeName);
             }
         }
     }
@@ -70,18 +68,17 @@
      *
      * @param property
      */
-    public NodeTypeProperty(DavProperty property) {
+    public NodeTypeProperty(DavProperty<?> property) {
         super(property.getName(), property.isInvisibleInAllprop());
         if (property instanceof NodeTypeProperty) {
-            nodetypeNames.addAll(((NodeTypeProperty)property).nodetypeNames);
+            nodetypeNames.addAll(((NodeTypeProperty) property).nodetypeNames);
         } else {
             // assume property has be built from xml
             Object propValue = property.getValue();
             if (propValue instanceof List) {
-                retrieveNodeTypeNames(((List)propValue));
+                retrieveNodeTypeNames(((List<?>)propValue));
             } else if (propValue instanceof Element) {
-                List l = new ArrayList();
-                l.add(propValue);
+                List<Element> l = Collections.singletonList((Element) propValue);
                 retrieveNodeTypeNames(l);
             } else {
                 log.debug("NodeTypeProperty '" + property.getName() + "' has no/unparsable value.");
@@ -89,21 +86,19 @@
         }
     }
 
-    private void retrieveNodeTypeNames(List elementList) {
-        Iterator it = elementList.iterator();
-        while (it.hasNext()) {
-            Object content = it.next();
+    private void retrieveNodeTypeNames(List<?> elementList) {
+        for (Object content : elementList) {
             if (!(content instanceof Element)) {
                 continue;
             }
-            Element el = (Element)content;
+            Element el = (Element) content;
             if (XML_NODETYPE.equals(el.getLocalName()) && NodeTypeConstants.NAMESPACE.isSame(el.getNamespaceURI())) {
                 String nodetypeName = DomUtil.getChildText(el, XML_NODETYPENAME, NodeTypeConstants.NAMESPACE);
                 if (nodetypeName != null && !"".equals(nodetypeName)) {
                     nodetypeNames.add(nodetypeName);
                 }
             } else {
-                log.debug("'dcr:nodetype' element expected -> ignoring element '" + ((Element)content).getNodeName() + "'");
+                log.debug("'dcr:nodetype' element expected -> ignoring element '" + ((Element) content).getNodeName() + "'");
             }
         }
     }
@@ -113,7 +108,7 @@
      *
      * @return set of nodetype names
      */
-    public Set getNodeTypeNames() {
+    public Set<String> getNodeTypeNames() {
         return nodetypeNames;
     }
 
@@ -122,21 +117,20 @@
      *
      * @return a Set of nodetype names (String).
      */
-    public Object getValue() {
+    public Set<String> getValue() {
         return nodetypeNames;
     }
 
     /**
      * @see org.apache.jackrabbit.webdav.xml.XmlSerializable#toXml(Document)
      */
+    @Override
     public Element toXml(Document document) {
         Element elem = getName().toXml(document);
-        Iterator it = getNodeTypeNames().iterator();
-        while (it.hasNext()) {
-            String name = it.next().toString();
+        for (String name : getNodeTypeNames()) {
             Element ntElem = DomUtil.addChildElement(elem, XML_NODETYPE, NodeTypeConstants.NAMESPACE);
             DomUtil.addChildElement(ntElem, XML_NODETYPENAME, NodeTypeConstants.NAMESPACE, name);
         }
         return elem;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/PropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/PropertyDefinitionImpl.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/PropertyDefinitionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/nodetype/PropertyDefinitionImpl.java Tue Feb 23 13:37:38 2010
@@ -119,6 +119,7 @@
      * @return xml representation
      * @param document
      */
+    @Override
     public Element toXml(Document document) {
         Element elem = super.toXml(document);
 
@@ -133,10 +134,10 @@
         Value[] values = getDefaultValues();
         if (values != null) {
             Element dvElement = document.createElement(DEFAULTVALUES_ELEMENT);
-            for (int i = 0; i < values.length; i++) {
+            for (Value value : values) {
                 try {
                     Element valElem = document.createElement(DEFAULTVALUE_ELEMENT);
-                    DomUtil.setText(valElem, values[i].getString());
+                    DomUtil.setText(valElem, value.getString());
                     dvElement.appendChild(valElem);
                 } catch (RepositoryException e) {
                     // should not occur
@@ -147,20 +148,18 @@
         }
         // value constraints array is never null.
         Element constrElem = document.createElement(VALUECONSTRAINTS_ELEMENT);
-        String[] constraints = getValueConstraints();
-        for (int i = 0; i < constraints.length; i++) {
+        for (String constraint : getValueConstraints()) {
             Element vcElem = document.createElement(VALUECONSTRAINT_ELEMENT);
-            DomUtil.setText(vcElem, constraints[i]);
+            DomUtil.setText(vcElem, constraint);
             constrElem.appendChild(vcElem);
         }
         elem.appendChild(constrElem);
 
         // JCR 2.0 extension
         Element qopElem = document.createElement(AVAILABLE_QUERY_OPERATORS_ELEMENT);
-        String[] qops = getAvailableQueryOperators();
-        for (int i = 0; i < qops.length; i++) {
+        for (String qop : getAvailableQueryOperators()) {
             Element opElem = document.createElement(AVAILABLE_QUERY_OPERATOR_ELEMENT);
-            DomUtil.setText(opElem, qops[i]);
+            DomUtil.setText(opElem, qop);
             qopElem.appendChild(opElem);
         }
         elem.appendChild(qopElem);
@@ -173,7 +172,8 @@
      *
      * @return always returns {@link #PROPERTYDEFINITION_ELEMENT}
      */
+    @Override
     String getElementName() {
         return PROPERTYDEFINITION_ELEMENT;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/observation/SubscriptionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/observation/SubscriptionImpl.java?rev=915339&r1=915338&r2=915339&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/observation/SubscriptionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/observation/SubscriptionImpl.java Tue Feb 23 13:37:38 2010
@@ -46,7 +46,6 @@
 import javax.jcr.observation.EventListener;
 import javax.jcr.observation.ObservationManager;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -111,7 +110,7 @@
 
     private final DavResourceLocator locator;
     private final String subscriptionId = UUID.randomUUID().toString();
-    private final List eventBundles = new ArrayList();
+    private final List<EventBundle> eventBundles = new ArrayList<EventBundle>();
     private final ObservationManager obsMgr;
 
     /**
@@ -193,8 +192,8 @@
     int getJcrEventTypes() throws DavException {
         EventType[] eventTypes = info.getEventTypes();
         int events = 0;
-        for (int i = 0; i < eventTypes.length; i++) {
-            events |= getJcrEventType(eventTypes[i]);
+        for (EventType eventType : eventTypes) {
+            events |= getJcrEventType(eventType);
         }
         return events;
     }
@@ -214,15 +213,14 @@
     }
 
     private String[] getFilterValues(String filterLocalName) {
-        Filter[] filters = info.getFilters(filterLocalName, NAMESPACE);
-        List values = new ArrayList();
-        for (int i = 0; i < filters.length; i++) {
-            String val = filters[i].getValue();
+        List<String> values = new ArrayList<String>();
+        for (Filter filter : info.getFilters(filterLocalName, NAMESPACE)) {
+            String val = filter.getValue();
             if (val != null) {
                 values.add(val);
             }
         }
-        return (values.size() > 0) ? (String[])values.toArray(new String[values.size()]) : null;
+        return (values.size() > 0) ? values.toArray(new String[values.size()]) : null;
     }
 
     /**
@@ -290,9 +288,7 @@
                 // continue and possibly return empty event discovery
             }
         }
-        Iterator it = eventBundles.iterator();
-        while (it.hasNext()) {
-            EventBundle eb = (EventBundle) it.next();
+        for (EventBundle eb : eventBundles) {
             ed.addEventBundle(eb);
         }
         // clear list
@@ -310,14 +306,17 @@
             // a subscription which is not interested in local changes does
             // not need the transaction id
             return new TransactionEvent() {
+                @Override
                 public void onEvent(EventIterator events) {
                     // ignore
                 }
 
+                @Override
                 public void beforeCommit(TransactionResource resource, String lockToken) {
                     // ignore
                 }
 
+                @Override
                 public void afterCommit(TransactionResource resource,
                                         String lockToken,
                                         boolean success) {
@@ -518,20 +517,20 @@
                     log.error(e.getMessage());
                 }
                 eventElem.appendChild(DomUtil.hrefToXml(eHref, document));
-                // eventtype
+                // event type
                 Element eType = DomUtil.addChildElement(eventElem, XML_EVENTTYPE, NAMESPACE);
                 eType.appendChild(getEventType(event.getType()).toXml(document));
                 // user id
                 DomUtil.addChildElement(eventElem, XML_EVENTUSERID, NAMESPACE, event.getUserID());
 
                 // Additional JCR 2.0 event information
-                // userdata
+                // user data
                 try {
                     DomUtil.addChildElement(eventElem, XML_EVENTUSERDATA, NAMESPACE, event.getUserData());
                 } catch (RepositoryException e) {
                     log.error("Internal error while retrieving event user data.", e.getMessage());
                 }
-                // timestamp
+                // time stamp
                 try {
                     DomUtil.addChildElement(eventElem, XML_EVENTDATE, NAMESPACE, String.valueOf(event.getDate()));
                 } catch (RepositoryException e) {
@@ -546,9 +545,9 @@
                 // info
                 Element info = DomUtil.addChildElement(eventElem, XML_EVENTINFO, NAMESPACE);
                 try {
-                    Map m = event.getInfo();
-                    for (Iterator it = m.keySet().iterator(); it.hasNext();) {
-                        String key = it.next().toString();
+                    @SuppressWarnings({"RawUseOfParameterizedType"}) Map m = event.getInfo();
+                    for (Object o : m.keySet()) {
+                        String key = o.toString();
                         Object value = m.get(key);
                         if (value != null) {
                             DomUtil.addChildElement(info, key, Namespace.EMPTY_NAMESPACE, value.toString());



Mime
View raw message