bloritsch    2003/10/22 08:37:51

  Modified:    src/java/org/apache/cocoon/components
                        ComponentLocatorImpl.java ParentAware.java
                        CocoonContainer.java ContextHelper.java
                        RequestLifecycleComponent.java LifecycleHelper.java
                        RequestLifecycleHelper.java
                        GlobalRequestLifecycleComponent.java
                        SitemapConfigurable.java
                        CocoonComponentManager.java ComponentLocator.java
                        DefaultSitemapConfigurationHolder.java
                        RequestLifestyleComponentHandler.java
                        ComponentContext.java EnvironmentStack.java
  Added:       src/java/org/apache/cocoon/components
                        SitemapConfigurableAccessor.java
  Log:
  Ok, we are almost at the point where a special CocoonComponentManager is not 
needed.
  
  Revision  Changes    Path
  1.5       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/ComponentLocatorImpl.java
  
  Index: ComponentLocatorImpl.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/ComponentLocatorImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  
  
  
  1.4       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/ParentAware.java
  
  Index: ParentAware.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/ParentAware.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  
  
  
  1.5       +0 -0      
cocoon-2.2/src/java/org/apache/cocoon/components/CocoonContainer.java
  
  Index: CocoonContainer.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/CocoonContainer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  
  
  
  1.7       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/ContextHelper.java
  
  Index: ContextHelper.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/ContextHelper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  
  
  
  1.8       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/RequestLifecycleComponent.java
  
  Index: RequestLifecycleComponent.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/RequestLifecycleComponent.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  
  
  
  1.9       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/LifecycleHelper.java
  
  Index: LifecycleHelper.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/LifecycleHelper.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  
  
  
  1.3       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/RequestLifecycleHelper.java
  
  Index: RequestLifecycleHelper.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/RequestLifecycleHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RequestLifecycleHelper.java       22 Oct 2003 15:13:55 -0000      1.2
  +++ RequestLifecycleHelper.java       22 Oct 2003 15:37:50 -0000      1.3
  @@ -118,7 +118,7 @@
                   while ( iter.hasNext() ) {
                       final Object[] o = (Object[])iter.next();
                       final Object c = o[0];
  -                    ((CocoonComponentManager)o[1]).releaseRLComponent( c );
  +                    ((RequestLifestyleComponentHandler)o[1]).release( c );
                   }
               }
               
env.removeAttribute(GlobalRequestLifecycleComponent.class.getName());
  
  
  
  1.7       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/GlobalRequestLifecycleComponent.java
  
  Index: GlobalRequestLifecycleComponent.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/GlobalRequestLifecycleComponent.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  
  
  
  1.4       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/SitemapConfigurable.java
  
  Index: SitemapConfigurable.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/SitemapConfigurable.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  
  
  
  1.25      +1 -36     
cocoon-2.2/src/java/org/apache/cocoon/components/CocoonComponentManager.java
  
  Index: CocoonComponentManager.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/CocoonComponentManager.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- CocoonComponentManager.java       22 Oct 2003 15:13:55 -0000      1.24
  +++ CocoonComponentManager.java       22 Oct 2003 15:37:50 -0000      1.25
  @@ -51,15 +51,12 @@
   package org.apache.cocoon.components;
   
   import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.service.ServiceException;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.excalibur.source.SourceResolver;
   
   import java.util.ArrayList;
  -import java.util.HashMap;
   import java.util.Iterator;
  -import java.util.Map;
   
   /**
    * Cocoon Component Manager.
  @@ -82,9 +79,6 @@
       /** The configured [EMAIL PROTECTED] SourceResolver} */
       private SourceResolver sourceResolver;
   
  -    /** The [EMAIL PROTECTED] SitemapConfigurationHolder}s */
  -    private Map sitemapConfigurationHolders = new HashMap(15);
  -
       /** The parent component manager for implementing parent aware 
components */
       private ServiceManager parentManager;
   
  @@ -127,24 +121,6 @@
           }
   
   
  -        if ( null != component && component instanceof SitemapConfigurable) {
  -
  -            // FIXME: how can we prevent that this is called over and over 
again?
  -            SitemapConfigurationHolder holder;
  -
  -            holder = 
(SitemapConfigurationHolder)this.sitemapConfigurationHolders.get( role );
  -            if ( null == holder ) {
  -                // create new holder
  -                holder = new DefaultSitemapConfigurationHolder( role );
  -                this.sitemapConfigurationHolders.put( role, holder );
  -            }
  -
  -            try {
  -                ((SitemapConfigurable)component).configure(holder);
  -            } catch (ConfigurationException ce) {
  -                throw new ServiceException(role, "Exception during setup of 
SitemapConfigurable.", ce);
  -            }
  -        }
           return component;
       }
   
  @@ -157,21 +133,10 @@
               return;
           }
   
  -        if ( component instanceof RequestLifecycleComponent
  -             || component instanceof GlobalRequestLifecycleComponent) {
  -            return;
  -        }
           if ( component == this ) {
               return;
           }
           parentManager.release( component);
  -    }
  -
  -    /**
  -     * Release a RequestLifecycleComponent
  -     */
  -    protected void releaseRLComponent( final Object component ) {
  -        parentManager.release( component );
       }
   
       /**
  
  
  
  1.5       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/ComponentLocator.java
  
  Index: ComponentLocator.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/ComponentLocator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  
  
  
  1.6       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/DefaultSitemapConfigurationHolder.java
  
  Index: DefaultSitemapConfigurationHolder.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/DefaultSitemapConfigurationHolder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  
  
  
  1.2       +3 -0      
cocoon-2.2/src/java/org/apache/cocoon/components/RequestLifestyleComponentHandler.java
  
  Index: RequestLifestyleComponentHandler.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/RequestLifestyleComponentHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestLifestyleComponentHandler.java     22 Oct 2003 15:13:55 -0000      
1.1
  +++ RequestLifestyleComponentHandler.java     22 Oct 2003 15:37:50 -0000      
1.2
  @@ -216,6 +216,9 @@
        * @param component the component to return to the handler
        */
       protected void doPut( final Object component )
  +    {}
  +
  +    void release( final Object component )
       {
           m_pool.release( component );
       }
  
  
  
  1.5       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/ComponentContext.java
  
  Index: ComponentContext.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/ComponentContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  
  
  
  1.5       +1 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/EnvironmentStack.java
  
  Index: EnvironmentStack.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/EnvironmentStack.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  
  
  
  1.1                  
cocoon-2.2/src/java/org/apache/cocoon/components/SitemapConfigurableAccessor.java
  
  Index: SitemapConfigurableAccessor.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software 
Foundation"
      must not be used to endorse or promote products derived from this  
software
      without  prior written permission. For written permission, please contact
      [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components;
  
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.lifecycle.Accessor;
  
  import java.util.HashMap;
  import java.util.Map;
  
  /**
   * SitemapConfigurableAccessor does XYZ
   *
   * @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
   * @version CVS $ Revision: 1.1 $
   */
  public class SitemapConfigurableAccessor implements Accessor
  {
      /** The [EMAIL PROTECTED] SitemapConfigurationHolder}s */
      private Map m_sitemapConfigurationHolders = new HashMap( 15 );
  
      public void access( Object object, Context context ) throws Exception
      {
          if ( object instanceof SitemapConfigurable )
          {
              String role = (String) context.get( "component.name" );
              // FIXME: how can we prevent that this is called over and over 
again?
              SitemapConfigurationHolder holder;
  
              holder = (SitemapConfigurationHolder) 
m_sitemapConfigurationHolders.get( role );
              if ( null == holder )
              {
                  // create new holder
                  holder = new DefaultSitemapConfigurationHolder( role );
                  m_sitemapConfigurationHolders.put( role, holder );
              }
  
              ( (SitemapConfigurable) object ).configure( holder );
          }
      }
  
      public void release( Object object, Context context )
      {}
  }
  
  
  

Reply via email to