incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r718257 - in /incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl: RepositoryObserver.java WatchedFolder.java
Date Mon, 17 Nov 2008 15:10:37 GMT
Author: bdelacretaz
Date: Mon Nov 17 07:10:37 2008
New Revision: 718257

URL: http://svn.apache.org/viewvc?rev=718257&view=rev
Log:
SLING-735 - Sort the list of WatchedFolders fore more predictable install sequences

Modified:
    incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/RepositoryObserver.java
    incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java

Modified: incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/RepositoryObserver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/RepositoryObserver.java?rev=718257&r1=718256&r2=718257&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/RepositoryObserver.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/RepositoryObserver.java
Mon Nov 17 07:10:37 2008
@@ -30,6 +30,8 @@
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 import javax.jcr.Item;
 import javax.jcr.Node;
@@ -66,7 +68,7 @@
  */
 public class RepositoryObserver implements Runnable, BundleListener {
 
-    protected Set<WatchedFolder> folders;
+    protected SortedSet<WatchedFolder> folders;
     private RegexpFilter folderNameFilter;
     private RegexpFilter filenameFilter;
     private ResourceOverrideRules roRules;
@@ -151,7 +153,7 @@
         }
         
         // Find folders to watch
-        folders = new HashSet<WatchedFolder>();
+        folders = new TreeSet<WatchedFolder>();
         for(String root : roots) {
             folders.addAll(findWatchedFolders(root));
         }

Modified: incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java?rev=718257&r1=718256&r2=718257&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/WatchedFolder.java
Mon Nov 17 07:10:37 2008
@@ -46,7 +46,7 @@
  *  to it (non-recursively) and sending the appropriate messages
  *  to the OsgiController service.
  */
-class WatchedFolder implements EventListener {
+class WatchedFolder implements EventListener, Comparable<Object> {
     private final String path;
     private final OsgiController controller;
     private long nextScan;
@@ -112,8 +112,16 @@
         final WatchedFolder other = (WatchedFolder) obj;
         return path.equals(other.path);
     }
+    
+    public int compareTo(Object obj) {
+        if (!(obj instanceof WatchedFolder)) {
+            return 1;
+        }
+        final WatchedFolder other = (WatchedFolder) obj;
+		return path.compareTo(other.path);
+	}
 
-    @Override
+	@Override
     public int hashCode() {
         return path.hashCode();
     }



Mime
View raw message