I would like to propose a change to the registry watcher in order to allow
it to load xreg files from subdirectories beneath the base directory.
Below, I have pasted the patches that are needed in order to add this
ability.

Jeremy Ford

Index: RegistryWatcher.java
===================================================================
RCS file:
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/services/regis
try/RegistryWatcher.java,v
retrieving revision 1.7
diff -u -r1.7 RegistryWatcher.java
--- RegistryWatcher.java 6 Nov 2002 00:00:24 -0000 1.7
+++ RegistryWatcher.java 24 Nov 2002 22:06:01 -0000
@@ -222,6 +222,10 @@
      */
     private void findFiles(File f)
     {
+     if(Log.getLogger().isDebugEnabled()) {
+            Log.debug("RegistryWatcher: Find files for " + f);
+        }
+
         File[] contents = null;

         if (f.exists() && f.canRead())
@@ -240,19 +244,26 @@
                 {
                     for (int i=0; i< contents.length; i++)
                     {
-                        files.put(contents[i],new
Long(contents[i].lastModified()));
-
-                        if (subscriber!=null)
-                        {
-                            try
-                            {
-
subscriber.loadFragment(contents[i].getCanonicalPath());
-                            }
-                            catch (Exception e)
-                            {
-                                Log.error("RegistryWatcher: Can't load
fragment", e);
-                            }
-                        }
+                     if(contents[i].isDirectory())
+                     {
+                      findFiles(contents[i]);
+                     }
+                     else
+                     {
+                         files.put(contents[i],new
Long(contents[i].lastModified()));
+
+                         if (subscriber!=null)
+                         {
+                             try
+                             {
+
subscriber.loadFragment(contents[i].getCanonicalPath());
+                             }
+                             catch (Exception e)
+                             {
+                                 Log.error("RegistryWatcher: Can't load
fragment", e);
+                             }
+                         }
+                     }
                     }
                 }
             }


Index: CastorRegistryService.java
===================================================================
RCS file:
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/services/regis
try/CastorRegistryService.java,v
retrieving revision 1.27
diff -u -r1.27 CastorRegistryService.java
--- CastorRegistryService.java 17 Nov 2002 03:05:41 -0000 1.27
+++ CastorRegistryService.java 24 Nov 2002 22:06:52 -0000
@@ -926,6 +926,9 @@

         public boolean accept(File f)
         {
+         if(f.isDirectory()) {
+          return true;
+         }
             return f.toString().endsWith(extension);
         }
     }

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to