incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r693873 - in /incubator/sling/trunk/extensions/jcrinstall/src: main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/RepositoryObserver.java test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/MockRepositoryObserver.java
Date Wed, 10 Sep 2008 15:53:14 GMT
Author: bdelacretaz
Date: Wed Sep 10 08:53:14 2008
New Revision: 693873

URL: http://svn.apache.org/viewvc?rev=693873&view=rev
Log:
SLING-646 - fix failing tests again (time for dinner I guess)

Modified:
    incubator/sling/trunk/extensions/jcrinstall/src/main/java/org/apache/sling/jcr/jcrinstall/jcr/impl/RepositoryObserver.java
    incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/MockRepositoryObserver.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=693873&r1=693872&r2=693873&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
Wed Sep 10 08:53:14 2008
@@ -92,19 +92,13 @@
     	final String [] roots = DEFAULT_ROOTS; 
     	filenameFilter = new RegexpFilter(DEFAULT_FILENAME_REGEXP);
     	
-    	String regexp = (String)context.getProperties().get(FOLDER_NAME_REGEXP_PROPERTY);
+    	String regexp = getPropertyValue(context, FOLDER_NAME_REGEXP_PROPERTY);
     	if(regexp != null) {
-    	    log.info("Using folder name regexp '{}' from ComponentContext {} property", regexp,
FOLDER_NAME_REGEXP_PROPERTY);
+    	    log.info("Using folder name regexp '{}' from context property '{}'", regexp, FOLDER_NAME_REGEXP_PROPERTY);
     	    folderNameFilter = new RegexpFilter(regexp);
     	} else {
-    	    regexp = context.getBundleContext().getProperty(FOLDER_NAME_REGEXP_PROPERTY);
-    	    if(regexp != null) {
-                log.info("Using folder name regexp '{}' from BundleContext {} property",
regexp, FOLDER_NAME_REGEXP_PROPERTY);
-                folderNameFilter = new RegexpFilter(regexp);
-    	    } else {
-                log.info("Using default folder name regexp '{}'", DEFAULT_FOLDER_NAME_REGEXP);
-    	        folderNameFilter = new RegexpFilter(DEFAULT_FOLDER_NAME_REGEXP);
-    	    }
+            log.info("Using default folder name regexp '{}'", DEFAULT_FOLDER_NAME_REGEXP);
+	        folderNameFilter = new RegexpFilter(DEFAULT_FOLDER_NAME_REGEXP);
     	}
         
         // Listen for any new WatchedFolders created after activation
@@ -142,6 +136,15 @@
         t.start();
     }
     
+    /** Get a property value from the component context or bundle context */
+    protected String getPropertyValue(ComponentContext ctx, String name) {
+        String result = (String)ctx.getProperties().get(name);
+        if(result == null) {
+            result = ctx.getBundleContext().getProperty(name);
+        }
+        return result;
+    }
+    
     protected void deactivate(ComponentContext oldContext) {
     	
         running = false;

Modified: incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/MockRepositoryObserver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/MockRepositoryObserver.java?rev=693873&r1=693872&r2=693873&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/MockRepositoryObserver.java
(original)
+++ incubator/sling/trunk/extensions/jcrinstall/src/test/java/org/apache/sling/jcr/jcrinstall/jcr/impl/MockRepositoryObserver.java
Wed Sep 10 08:53:14 2008
@@ -22,6 +22,7 @@
 
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.jcrinstall.osgi.OsgiController;
+import org.osgi.service.component.ComponentContext;
 
 /** Slightly customized RepositoryObserver
  *  used for testing.
@@ -51,4 +52,8 @@
         }
         return result;
     }
+    
+    protected String getPropertyValue(ComponentContext ctx, String name) {
+        return null;
+    }
 }



Mime
View raw message