cziegeler    2003/03/20 00:54:18

  Modified:    src/java/org/apache/cocoon/components/treeprocessor
                        TreeProcessor.java
               src/java/org/apache/cocoon/components
                        CocoonComponentManager.java
  Log:
  Moving things
  
  Revision  Changes    Path
  1.2       +40 -1     
cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
  
  Index: TreeProcessor.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TreeProcessor.java        9 Mar 2003 00:09:18 -0000       1.1
  +++ TreeProcessor.java        20 Mar 2003 08:54:17 -0000      1.2
  @@ -78,8 +78,11 @@
   import org.apache.cocoon.environment.Environment;
   import org.apache.excalibur.source.Source;
   
  +import java.util.Collections;
  +import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.Map;
   
   /**
    * Interpreted tree-traversal implementation of a pipeline assembly language.
  @@ -150,6 +153,9 @@
       /** component configurations */
       protected Configuration componentConfigurations;
   
  +    /** The different sitemap component configurations */
  +    protected Map sitemapComponentConfigurations;
  +    
       /**
        * Create a TreeProcessor.
        */
  @@ -356,6 +362,39 @@
        * @since 2.1
        */
       public Configuration getComponentConfigurations() {
  +        // do we have the sitemap configurations prepared for this processor?
  +        /*if ( null == sitemapComponentConfigurations ) {
  +
  +            // do we have configurations?
  +            final Configuration[] childs = (this.componentConfigurations == null ? 
null : this.componentConfigurations.getChildren());
  +            
  +            if ( childs == null ) {
  +                Map configurationMap = null;
  +                if ( null == this.parent ) {
  +                    this.sitemapComponentConfigurations = Collections.EMPTY_MAP;
  +                } else {
  +                    // use configuration from parent
  +                    this.sitemapComponentConfigurations = 
(Map)this.parent.getComponentConfigurations(); 
  +                }
  +
  +            } else {
  +
  +                Map configurationMap = null;
  +                if ( null == this.parent ) {
  +                    configurationMap = new HashMap(12);
  +                } else {
  +                    // copy all configurations from parent
  +                    configurationMap = new 
HashMap((Map)this.parent.getComponentConfigurations()); 
  +                }
  +                
  +                // and now check for new configurations
  +                for(int m = 0; m < childs.length; m++) {
  +                    
  +                    //final String r = 
this.roleManager.getRoleForName(childs[m].getName());
  +                }
  +            }
  +        }*/
  +        
           return this.componentConfigurations;
       }
   
  
  
  
  1.4       +12 -41    
cocoon-2.1/src/java/org/apache/cocoon/components/CocoonComponentManager.java
  
  Index: CocoonComponentManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/CocoonComponentManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CocoonComponentManager.java       19 Mar 2003 15:21:19 -0000      1.3
  +++ CocoonComponentManager.java       20 Mar 2003 08:54:18 -0000      1.4
  @@ -109,7 +109,7 @@
       private static ComponentManager rootManager;
       
       /** The [EMAIL PROTECTED] SitemapConfigurationHolder}s */
  -    private static Map sitemapConfigurationHolders = new HashMap(5);
  +    private static Map sitemapConfigurationHolders = new HashMap(15);
       
       /** Create the ComponentManager */
       public CocoonComponentManager() {
  @@ -153,44 +153,6 @@
                final EnvironmentStack stack = 
(EnvironmentStack)environmentStack.get();
                stack.push(new Object[] {env, processor, manager});
       
  -        /* New:
  -        // do we have the sitemap configurations prepared for this processor?
  -        final Object o = sitemapConfigurationHolders.get(processor);
  -        if ( null == o ) { 
  -            // first we have to lookup the parent processor
  -            final Processor parentProcessor = 
(Processor)env.getAttribute("CocoonComponentManager.processor");
  -
  -            // do we have configurations?
  -            final Configuration currentConf = 
processor.getComponentConfigurations();
  -            final Configuration[] childs = (currentConf == null ? null : 
currentConf.getChildren());
  -            
  -            if ( childs == null ) {
  -                Map configurationMap = null;
  -                if ( null == parentProcessor || parentProcessor.equals(processor)) {
  -                    configurationMap = new HashMap(12);
  -                } else {
  -                    // use configuration from parent
  -                    configurationMap = 
(Map)sitemapConfigurationHolders.get(parentProcessor); 
  -                }
  -                sitemapConfigurationHolders.put(processor, configurationMap);
  -
  -            } else {
  -
  -                Map configurationMap = null;
  -                if ( null == parentProcessor || parentProcessor.equals(processor)) {
  -                    configurationMap = new HashMap(12);
  -                } else {
  -                    // copy all configurations from parent
  -                    configurationMap = new 
HashMap((Map)sitemapConfigurationHolders.get(parentProcessor)); 
  -                }
  -                // and now check for new configurations
  -                for(int m = 0; m < childs.length; m++) {
  -                    
  -                    //final String r = 
this.roleManager.getRoleForName(childs[m].getName());
  -                }
  -            }
  -        }
  -        */
           final EnvironmentDescription desc = 
(EnvironmentDescription)env.getObjectModel().get(PROCESS_KEY);
           desc.addSitemapConfiguration(processor.getComponentConfigurations());
           env.setAttribute("CocoonComponentManager.processor", processor);
  @@ -382,9 +344,18 @@
                   }
               }
           }
  +        
           /*
  -        if ( null != component && component instanceof SitemapConfigurable) {
  +         if ( null != component && component instanceof SitemapConfigurable) {
               // FIXME: how can we prevent that this is called over and over again?
  +            SitemapConfigurationHolder holder;
  +            
  +            holder = (SitemapConfigurationHolder)sitemapConfigurationHolders.get( 
role );
  +            if ( null == holder ) {
  +                // create new holder
  +                sitemapConfigurationHolders.put( role, holder );
  +            }
  +            ((SitemapConfigurable)component).configure(holder);
           }*/
           return component;
       }
  
  
  

Reply via email to