You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/02/24 13:46:49 UTC

svn commit: r380655 - in /cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon: ./ components/ components/container/ components/treeprocessor/ core/ core/container/spring/ core/container/util/ core/servlet/

Author: cziegeler
Date: Fri Feb 24 04:46:43 2006
New Revision: 380655

URL: http://svn.apache.org/viewcvs?rev=380655&view=rev
Log:
Add support for SitemapConfigurable

Added:
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/ComponentContext.java
      - copied, changed from r380606, cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/ComponentContext.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/DefaultSitemapConfigurationHolder.java
      - copied, changed from r380606, cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/DefaultSitemapConfigurationHolder.java
Removed:
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/ComponentContext.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/DefaultSitemapConfigurationHolder.java
Modified:
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/ChainedConfiguration.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurable.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurationHolder.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonXmlWebApplicationContext.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ConfigurationInfo.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java Fri Feb 24 04:46:43 2006
@@ -20,7 +20,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.logger.Logger;
@@ -287,7 +286,7 @@
     /**
      * @see org.apache.cocoon.Processor#getComponentConfigurations()
      */
-    public Configuration[] getComponentConfigurations() {
+    public Map getComponentConfigurations() {
         return null;
     }
 

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/Processor.java Fri Feb 24 04:46:43 2006
@@ -15,6 +15,8 @@
  */
 package org.apache.cocoon;
 
+import java.util.Map;
+
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.ServiceSelector;
@@ -84,9 +86,9 @@
 
     /**
      * Get the sitemap component configurations
-     * @since 2.2
+     * @since 2.1
      */
-    Configuration[] getComponentConfigurations();
+    Map getComponentConfigurations();
 
     /**
      * Get the root processor parent of this processor.

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/ChainedConfiguration.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/ChainedConfiguration.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/ChainedConfiguration.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/ChainedConfiguration.java Fri Feb 24 04:46:43 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,26 +21,26 @@
 /**
  * This configuration object is used for {@link SitemapConfigurable} 
  * components. It 'extends' {@link Configuration} by a parent.
- * 
+ *
  * @since 2.1
- * 
+ *
  * @version $Id$
  */
 public final class ChainedConfiguration implements Configuration {
 
     private Configuration wrappedConfiguration;
-    
+
     private ChainedConfiguration parentConfiguration;
-    
+
     /**
      * Constructor
      */
     public ChainedConfiguration(Configuration wrapped,
-                                 ChainedConfiguration parent) {
+                                ChainedConfiguration parent) {
         this.wrappedConfiguration = wrapped;
         this.parentConfiguration = parent;
     }
-    
+
     /** 
      * Get the parent configuration
      * @return the parent configuration or null.
@@ -49,28 +49,28 @@
         return this.parentConfiguration;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttribute(java.lang.String, java.lang.String)
      */
     public String getAttribute(String arg0, String arg1) {
         return this.wrappedConfiguration.getAttribute(arg0, arg1);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttribute(java.lang.String)
      */
     public String getAttribute(String arg0) throws ConfigurationException {
         return this.wrappedConfiguration.getAttribute(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsBoolean(java.lang.String, boolean)
      */
     public boolean getAttributeAsBoolean(String arg0, boolean arg1) {
         return this.wrappedConfiguration.getAttributeAsBoolean(arg0, arg1);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsBoolean(java.lang.String)
      */
     public boolean getAttributeAsBoolean(String arg0)
@@ -78,14 +78,14 @@
         return this.wrappedConfiguration.getAttributeAsBoolean(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsFloat(java.lang.String, float)
      */
     public float getAttributeAsFloat(String arg0, float arg1) {
         return this.wrappedConfiguration.getAttributeAsFloat(arg0, arg1);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsFloat(java.lang.String)
      */
     public float getAttributeAsFloat(String arg0)
@@ -93,14 +93,14 @@
         return this.wrappedConfiguration.getAttributeAsFloat(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsInteger(java.lang.String, int)
      */
     public int getAttributeAsInteger(String arg0, int arg1) {
         return this.wrappedConfiguration.getAttributeAsInteger(arg0, arg1);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsInteger(java.lang.String)
      */
     public int getAttributeAsInteger(String arg0)
@@ -108,140 +108,140 @@
         return this.wrappedConfiguration.getAttributeAsInteger(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsLong(java.lang.String, long)
      */
     public long getAttributeAsLong(String arg0, long arg1) {
         return this.wrappedConfiguration.getAttributeAsLong(arg0, arg1);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsLong(java.lang.String)
      */
     public long getAttributeAsLong(String arg0) throws ConfigurationException {
         return this.wrappedConfiguration.getAttributeAsLong(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getAttributeNames()
      */
     public String[] getAttributeNames() {
         return this.wrappedConfiguration.getAttributeNames();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getChild(java.lang.String, boolean)
      */
     public Configuration getChild(String arg0, boolean arg1) {
         return this.wrappedConfiguration.getChild(arg0, arg1);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getChild(java.lang.String)
      */
     public Configuration getChild(String arg0) {
         return this.wrappedConfiguration.getChild(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getChildren()
      */
     public Configuration[] getChildren() {
         return this.wrappedConfiguration.getChildren();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getChildren(java.lang.String)
      */
     public Configuration[] getChildren(String arg0) {
         return this.wrappedConfiguration.getChildren(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getLocation()
      */
     public String getLocation() {
         return this.wrappedConfiguration.getLocation();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getName()
      */
     public String getName() {
         return this.wrappedConfiguration.getName();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getNamespace()
      */
     public String getNamespace() throws ConfigurationException {
         return this.wrappedConfiguration.getNamespace();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValue()
      */
     public String getValue() throws ConfigurationException {
         return this.wrappedConfiguration.getValue();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValue(java.lang.String)
      */
     public String getValue(String arg0) {
         return this.wrappedConfiguration.getValue(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValueAsBoolean()
      */
     public boolean getValueAsBoolean() throws ConfigurationException {
         return this.wrappedConfiguration.getValueAsBoolean();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValueAsBoolean(boolean)
      */
     public boolean getValueAsBoolean(boolean arg0) {
         return this.wrappedConfiguration.getValueAsBoolean(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValueAsFloat()
      */
     public float getValueAsFloat() throws ConfigurationException {
         return this.wrappedConfiguration.getValueAsFloat();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValueAsFloat(float)
      */
     public float getValueAsFloat(float arg0) {
         return this.wrappedConfiguration.getValueAsFloat(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValueAsInteger()
      */
     public int getValueAsInteger() throws ConfigurationException {
         return this.wrappedConfiguration.getValueAsInteger();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValueAsInteger(int)
      */
     public int getValueAsInteger(int arg0) {
         return this.wrappedConfiguration.getValueAsInteger(arg0);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValueAsLong()
      */
     public long getValueAsLong() throws ConfigurationException {
         return this.wrappedConfiguration.getValueAsLong();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.avalon.framework.configuration.Configuration#getValueAsLong(long)
      */
     public long getValueAsLong(long arg0) {
@@ -275,5 +275,4 @@
     public double getValueAsDouble(double arg0) {
         return this.wrappedConfiguration.getValueAsDouble(arg0);
     }
-
 }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurable.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurable.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurable.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurable.java Fri Feb 24 04:46:43 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,9 +20,6 @@
 /**
  * Objects implementing this marker interface can get a configuration
  * from the map:pipelines section of the sitemap when they are created.
- * Due to a problem in the component handling the
- * {@link #configure(SitemapConfigurationHolder)} method is actually called
- * each time the component is looked up!
  *
  * @since 2.1
  * @version $Id$

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurationHolder.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurationHolder.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurationHolder.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/SitemapConfigurationHolder.java Fri Feb 24 04:46:43 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,9 +18,9 @@
 /**
  * A {@link SitemapConfigurable} component gets the sitemap configuration
  * using this object.
- * 
+ *
  * @since 2.1
- * 
+ *
  * @version $Id$
  */
 public interface SitemapConfigurationHolder {
@@ -30,13 +30,13 @@
      * @return The configuration
      */
     ChainedConfiguration getConfiguration();
-    
+
     /**
      * Get the prepared configuration for the current sitemap
      * @return The configuration or null if no prepared is available
      */
     Object getPreparedConfiguration();
-    
+
     /**
      * Set the prepared configuration for the current sitemap.
      * After it is set by a component, it can be get using

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java Fri Feb 24 04:46:43 2006
@@ -29,6 +29,7 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.Processor;
+import org.apache.cocoon.components.ChainedConfiguration;
 import org.apache.cocoon.components.source.impl.SitemapSourceInfo;
 import org.apache.cocoon.core.container.spring.CocoonXmlWebApplicationContext;
 import org.apache.cocoon.environment.Environment;
@@ -74,6 +75,9 @@
 
     private Configuration componentConfigurations;
 
+    /** The sitemap configurations. */
+    protected Map sitemapComponentConfigurations;
+
     /** Number of simultaneous uses of this processor (either by concurrent request or by internal requests) */
     private int requestCount;
 
@@ -148,29 +152,53 @@
     /** Set the sitemap component configurations (called as part of the tree building process) */
     public void setComponentConfigurations(Configuration componentConfigurations) {
         this.componentConfigurations = componentConfigurations;
+        this.sitemapComponentConfigurations = null;
     }
 
     /**
      * @see org.apache.cocoon.Processor#getComponentConfigurations()
      */
-    public Configuration[] getComponentConfigurations() {
-        if (this.componentConfigurations == null) {
-            if (this.wrappingProcessor.parent != null) {
-                return this.wrappingProcessor.parent.getComponentConfigurations();
+    public Map getComponentConfigurations() {
+        // do we have the sitemap configurations prepared for this processor?
+        if ( null == this.sitemapComponentConfigurations ) {
+
+            synchronized (this) {
+
+                if ( this.sitemapComponentConfigurations == null ) {
+                    // do we have configurations?
+                    final Configuration[] childs = (this.componentConfigurations == null
+                                                     ? null
+                                                     : this.componentConfigurations.getChildren());
+
+                    if ( null != childs ) {
+
+                        if ( null == this.wrappingProcessor.parent ) {
+                            this.sitemapComponentConfigurations = new HashMap(12);
+                        } else {
+                            // copy all configurations from parent
+                            this.sitemapComponentConfigurations = new HashMap(
+                                        this.wrappingProcessor.parent.getComponentConfigurations());
+                        }
+
+                        // and now check for new configurations
+                        for(int m = 0; m < childs.length; m++) {
+                            final String r = this.applicationContext.getNameForAlias(childs[m].getName());
+                            this.sitemapComponentConfigurations.put(r, new ChainedConfiguration(childs[m],
+                                                                             (ChainedConfiguration)this.sitemapComponentConfigurations.get(r)));
+                        }
+                    } else {
+                        // we don't have configurations
+                        if ( null == this.wrappingProcessor.parent ) {
+                            this.sitemapComponentConfigurations = Collections.EMPTY_MAP;
+                        } else {
+                            // use configuration from parent
+                            this.sitemapComponentConfigurations = this.wrappingProcessor.parent.getComponentConfigurations();
+                        }
+                    }
+                }
             }
-            return null;
-        }
-        if (this.wrappingProcessor.parent == null) {
-            return new Configuration[]{this.componentConfigurations};
-        }
-        final Configuration[] parentArray = this.wrappingProcessor.parent.getComponentConfigurations();
-        if ( parentArray != null ) {
-            final Configuration[] newArray = new Configuration[parentArray.length + 1];
-            System.arraycopy(parentArray, 0, newArray, 1, parentArray.length);
-            newArray[0] = this.componentConfigurations;
-            return newArray;
         }
-        return new Configuration[] {this.componentConfigurations};
+        return this.sitemapComponentConfigurations;
     }
 
     /**

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java Fri Feb 24 04:46:43 2006
@@ -286,29 +286,22 @@
         return result;
     }
 
-//    /**
-//     * Set the sitemap component configurations
-//     */
-//    public void setComponentConfigurations(Configuration componentConfigurations) {
-//        this.concreteProcessor.setComponentConfigurations(componentConfigurations);
-//    }
-
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.Processor#getComponentConfigurations()
      */
-    public Configuration[] getComponentConfigurations() {
+    public Map getComponentConfigurations() {
         return this.concreteProcessor.getComponentConfigurations();
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.Processor#getContext()
      */
     public String getContext() {
         return this.environmentHelper.getContext();
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.cocoon.Processor#getEnvironmentHelper()
+    /**
+     * @see org.apache.cocoon.Processor#getSourceResolver()
      */
     public org.apache.cocoon.environment.SourceResolver getSourceResolver() {
         return this.environmentHelper;

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java Fri Feb 24 04:46:43 2006
@@ -43,7 +43,6 @@
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.Processor;
 import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.components.container.ComponentContext;
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.components.source.impl.DelayedRefreshSourceWrapper;
 import org.apache.cocoon.core.container.spring.ApplicationContextFactory;
@@ -51,6 +50,7 @@
 import org.apache.cocoon.core.container.spring.CocoonXmlWebApplicationContext;
 import org.apache.cocoon.core.container.spring.ConfigReader;
 import org.apache.cocoon.core.container.spring.ConfigurationInfo;
+import org.apache.cocoon.core.container.util.ComponentContext;
 import org.apache.cocoon.core.container.util.ConfigurationBuilder;
 import org.apache.cocoon.core.container.util.SimpleSourceResolver;
 import org.apache.cocoon.util.ClassUtils;

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ApplicationContextFactory.java Fri Feb 24 04:46:43 2006
@@ -190,7 +190,7 @@
                 final Configuration conf = builder.build(servletContext.getResourceAsStream(loggerConfig));
                 // override log level?
                 if (settings.getOverrideLogLevel() != null) {
-                    // TODO
+                    // TODO - override loglevel for log4j
                 }
                 loggerManager.configure(conf);
             } else {

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonXmlWebApplicationContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonXmlWebApplicationContext.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonXmlWebApplicationContext.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonXmlWebApplicationContext.java Fri Feb 24 04:46:43 2006
@@ -29,6 +29,8 @@
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.components.SitemapConfigurable;
+import org.apache.cocoon.core.container.util.DefaultSitemapConfigurationHolder;
 import org.apache.cocoon.environment.ObjectModelHelper;
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.sitemap.EnterSitemapEvent;
@@ -52,7 +54,6 @@
 /**
  * This is a Cocoon specific implementation of a Spring {@link ApplicationContext}.
  *
- * TODO - Support for SitemapConfigurable
  * @since 2.2
  * @version $Id$
  */
@@ -97,6 +98,19 @@
         return this.avalonConfiguration;
     }
 
+    public String getNameForAlias(String alias) {
+        if ( this.avalonConfiguration != null ) {
+            final String value = this.avalonConfiguration.getRoleForName(alias);
+            if ( value != null ) {
+                return value;
+            }
+            if ( this.getParent() instanceof CocoonXmlWebApplicationContext ) {
+                return ((CocoonXmlWebApplicationContext)this.getParent()).getNameForAlias(alias);
+            }
+        }
+        // default: we just return the alias
+        return alias;
+    }
     /**
      * Register a child context as a listener. This allows a child context to destroy itself
      * when the parent is destroyed.
@@ -278,6 +292,9 @@
                         }
                         ContainerUtil.parameterize(bean, p);
                     }
+                }
+                if ( bean instanceof SitemapConfigurable ) {
+                    ((SitemapConfigurable)bean).configure(new DefaultSitemapConfigurationHolder(beanName));
                 }
                 ContainerUtil.initialize(bean);
             } catch (Exception e) {

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ConfigurationInfo.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ConfigurationInfo.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ConfigurationInfo.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/ConfigurationInfo.java Fri Feb 24 04:46:43 2006
@@ -99,4 +99,12 @@
     public List getImports() {
         return this.imports;
     }
+
+    public String getRoleForName(String alias) {
+        final String value = (String)this.shorthands.get(alias);
+        if ( value != null ) {
+            return value;
+        }
+        return alias;
+    }
 }

Copied: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/ComponentContext.java (from r380606, cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/ComponentContext.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/ComponentContext.java?p2=cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/ComponentContext.java&p1=cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/ComponentContext.java&r1=380606&r2=380655&rev=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/ComponentContext.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/ComponentContext.java Fri Feb 24 04:46:43 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.components.container;
+package org.apache.cocoon.core.container.util;
 
 import java.util.Map;
 

Copied: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/DefaultSitemapConfigurationHolder.java (from r380606, cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/DefaultSitemapConfigurationHolder.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/DefaultSitemapConfigurationHolder.java?p2=cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/DefaultSitemapConfigurationHolder.java&p1=cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/DefaultSitemapConfigurationHolder.java&r1=380606&r2=380655&rev=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/components/container/DefaultSitemapConfigurationHolder.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/container/util/DefaultSitemapConfigurationHolder.java Fri Feb 24 04:46:43 2006
@@ -1,30 +1,29 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.components.container;
+package org.apache.cocoon.core.container.util;
 
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.cocoon.components.ChainedConfiguration;
 import org.apache.cocoon.components.SitemapConfigurationHolder;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
 
 /**
+ * Implementation of the sitemap configuration holder.
  *
  * @version $Id$
  */
@@ -33,57 +32,19 @@
 
     /** The role of the sitemap component */
     private final String role;
-    
-    /** The role manager */
-//    private final RoleManager roleManager;
 
-    /** The prepared configurations indexed by the ChainedConfiguration */
+    /** The prepared configurations indexed by the ChainedConfiguration. */
     private Map preparedConfigurations;
-    
-    public DefaultSitemapConfigurationHolder(String role/*, RoleManager manager*/) {
-        this.role = role;
-        //this.roleManager = manager;
-    }
-    
-    protected Map convert(Configuration[] configs, int index) {
-        Map sitemapComponentConfigurations;
-        
-        // do we have configurations?
-        final Configuration[] childs = configs[index].getChildren();
-
-        if ( null != childs && childs.length > 0 ) {
-
-            if ( index == configs.length - 1 ) {
-                sitemapComponentConfigurations = new HashMap(12);
-            } else {
-                // copy all configurations from parent
-                sitemapComponentConfigurations = new HashMap(this.convert(configs, index+1));
-            }
-
-            // and now check for new configurations
-            for(int m = 0; m < childs.length; m++) {
 
-                final String r = null;//this.roleManager.getRoleForName(childs[m].getName());
-                sitemapComponentConfigurations.put(r, new ChainedConfiguration(childs[m],
-                                                                 (ChainedConfiguration)sitemapComponentConfigurations.get(r)));
-            }
-        } else {
-            // we don't have configurations
-            if ( index == configs.length - 1 ) {
-                sitemapComponentConfigurations = Collections.EMPTY_MAP;
-            } else {
-                // use configuration from parent
-                sitemapComponentConfigurations = this.convert(configs, index+1);
-            }
-        }
-        return sitemapComponentConfigurations;        
+    public DefaultSitemapConfigurationHolder(String role) {
+        this.role = role;
     }
     
     /**
      * @see SitemapConfigurationHolder#getConfiguration()
      */
     public ChainedConfiguration getConfiguration() {
-        Map confs = this.convert(EnvironmentHelper.getCurrentProcessor().getComponentConfigurations(), 0);
+        Map confs = EnvironmentHelper.getCurrentProcessor().getComponentConfigurations();
         return (ChainedConfiguration) (confs == null ? null : confs.get(this.role));
     }
 
@@ -110,5 +71,4 @@
         }
         this.preparedConfigurations.put(configuration, preparedConfig);
     }
-
 }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java?rev=380655&r1=380654&r2=380655&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/servlet/CoreUtil.java Fri Feb 24 04:46:43 2006
@@ -27,10 +27,10 @@
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.components.container.ComponentContext;
 import org.apache.cocoon.core.Core;
 import org.apache.cocoon.core.MutableSettings;
 import org.apache.cocoon.core.Settings;
+import org.apache.cocoon.core.container.util.ComponentContext;
 import org.apache.cocoon.environment.Context;
 import org.apache.cocoon.environment.http.HttpContext;
 import org.apache.cocoon.servlet.SettingsHelper;