Index: src/org/apache/cocoon/Cocoon.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.33
diff -u -r1.33 Cocoon.java
--- src/org/apache/cocoon/Cocoon.java	2001/12/06 18:54:03	1.33
+++ src/org/apache/cocoon/Cocoon.java	2001/12/09 22:18:07
@@ -59,6 +59,8 @@
 import org.apache.avalon.excalibur.component.ExcaliburComponentManager;
 import org.apache.avalon.excalibur.logger.LogKitManageable;
 import org.apache.avalon.excalibur.logger.LogKitManager;
+import org.apache.avalon.excalibur.monitor.FileResource;
+import org.apache.avalon.excalibur.monitor.Monitor;
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
 import org.apache.avalon.framework.component.Component;
@@ -90,6 +92,8 @@
 import org.apache.cocoon.util.ClassUtils;
 import org.xml.sax.InputSource;
 
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeEvent;
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.IOException;
@@ -116,7 +120,8 @@
                    Processor,
                    Contextualizable,
                    Composable,
-                   LogKitManageable{
+                   LogKitManageable,
+                   PropertyChangeListener {
     /** The application context */
     private Context context;
 
@@ -153,6 +158,12 @@
     /** the Processor if it is ThreadSafe */
     private Processor threadSafeProcessor = null;
 
+    /** Resource Monitor */
+    private Monitor monitor;
+
+    /** Last modified date */
+    private long lastModified;
+
     /**
      * Creates a new <code>Cocoon</code> instance.
      *
@@ -171,6 +182,7 @@
      */
     public void compose(ComponentManager manager) {
         this.parentComponentManager = manager;
+       
     }
 
     /**
@@ -187,9 +199,14 @@
             try {
                 this.configurationFile = new URLSource((URL)context.get(Constants.CONTEXT_CONFIG_URL),
                                                        this.componentManager);
+                  
+               
             } catch (IOException ioe) {
                 getLogger().error("Could not open configuration file.", ioe);
                 throw new ContextException("Could not open configuration file.", ioe);
+            } catch (Exception e) {
+                getLogger().error("contextualize(..) Exception", e);
+                throw new ContextException("contextualize(..) Exception", e);
             }
         }
     }
@@ -424,6 +441,18 @@
         }
         this.componentManager.configure(conf);
 
+        /** Monitoring the Configuration source */
+        try {
+            this.monitor = (Monitor)this.componentManager.lookup(Monitor.ROLE);
+            URL configURL = new URL(configurationFile.getSystemId());
+            getLogger().debug("Configuration path=" + configURL.getFile());
+            FileResource file = new FileResource(configURL.getFile());
+            file.addPropertyChangeListener(this);
+            monitor.addResource(file);
+        } catch (Exception e) {
+            getLogger().error("Caught Exception while setting up the Resource Monitor", e);
+        }
+
         return conf;
     }
 
@@ -434,8 +463,8 @@
      * @return a <code>boolean</code> value
      */
     public boolean modifiedSince(long date) {
-        this.configurationFile.refresh();
-        return date < this.configurationFile.getLastModified();
+        getLogger().debug("modifiedSince(..) date=" + date);
+        return date < this.getLastModified();
     }
 
     /**
@@ -733,4 +762,15 @@
         --activeRequestCount;
     }
 
+    public void propertyChange(PropertyChangeEvent evt) {
+        setLastModified(((Long)evt.getNewValue()).longValue());
+    }
+
+    private void setLastModified(long _lastModified) {
+        lastModified = _lastModified;
+    }
+
+    private long getLastModified() {
+        return lastModified;
+    }
 }
