Author: sylvain
Date: Tue Apr 12 08:53:58 2005
New Revision: 161066

URL: http://svn.apache.org/viewcvs?view=rev&rev=161066
Log:
allow root sitemap to be elsewhere than in webapp context dir

Modified:
    
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
    cocoon/trunk/status.xml

Modified: 
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
URL: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java?view=diff&r1=161065&r2=161066
==============================================================================
--- 
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
 (original)
+++ 
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
 Tue Apr 12 08:53:58 2005
@@ -80,9 +80,6 @@
     /** Delay for <code>sourceLastModified</code>. */
     protected long lastModifiedDelay;
 
-    /** The file to process */
-    protected String fileName;
-
     /** Check for reload? */
     protected boolean checkReload;
     
@@ -210,7 +207,7 @@
      */
     public void configure(Configuration config)
     throws ConfigurationException {
-        this.fileName = config.getAttribute("file", null);
+
         this.checkReload = config.getAttributeAsBoolean("check-reload", true);
 
         // Obtain the configuration file, or use the XCONF_URL if none
@@ -220,6 +217,14 @@
         // Reload check delay. Default is 1 second.
         this.lastModifiedDelay = 
config.getChild("reload").getAttributeAsLong("delay", 1000L);
 
+        String fileName = config.getAttribute("file", "sitemap.xmap");
+        
+        try {
+            this.source = new 
DelayedRefreshSourceWrapper(this.resolver.resolveURI(fileName), 
lastModifiedDelay);
+        } catch (Exception e) {
+            throw new ConfigurationException("Cannot resolve " + fileName, e);
+        }
+
         // Read the builtin languages definition file
         try {
             Source source = this.resolver.resolveURI(xconfURL);
@@ -346,7 +351,12 @@
      * Sets up the concrete processor, building or rebuilding it if necessary.
      */
     private void setupConcreteProcessor(Environment env) throws Exception {
-        // first, check for sitemap changes
+
+        if (this.parent == null) {
+            // Ensure root sitemap uses the correct context, even if not 
located in the webapp context
+            this.environmentHelper.changeContext(this.source, "");
+        }
+
         if (this.concreteProcessor == null || 
this.concreteProcessor.isReloadNeeded() ||
                 (this.checkReload && this.source.getLastModified() != 
this.lastModified)) {
             buildConcreteProcessor(env);
@@ -380,14 +390,6 @@
         EnvironmentHelper.enterProcessor(this, this.manager, env);
 
         try {
-            // Load the sitemap file
-            if (this.fileName == null) {
-                this.fileName = "sitemap.xmap";
-            }
-            if (this.source == null) {
-                this.source = new 
DelayedRefreshSourceWrapper(this.resolver.resolveURI(this.fileName),
-                                                              
lastModifiedDelay);
-            }
 
             // Build a namespace-aware configuration object
             NamespacedSAXConfigurationHandler handler = new 
NamespacedSAXConfigurationHandler();

Modified: cocoon/trunk/status.xml
URL: 
http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?view=diff&r1=161065&r2=161066
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Tue Apr 12 08:53:58 2005
@@ -426,6 +426,10 @@
    </action>
   </release>
   <release version="2.1.8" date="TBD">
+    <action dev="SW" type="fix">
+      Fix environment handling to allow the root sitemap to be at an abitrary 
location
+      and not only in the main webapp context directory.
+    </action>
     <action dev="VG" type="fix">
       Updated excalibur-pool to 2.0.0, excalibur-datasource to 1.2.0.
       Fixes problem of database connections pools not coming up after


Reply via email to