cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/util ComponentPool.java
Date Fri, 16 Feb 2001 22:07:51 GMT
bloritsch    01/02/16 14:07:51

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
                        DefaultComponentManager.java
               src/org/apache/cocoon/components/language/generator Tag:
                        xml-cocoon2 AbstractCompiledComponent.java
                        CompiledComponent.java ProgramGeneratorImpl.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/components/language/markup/xsp Tag:
                        xml-cocoon2 XSPGenerator.java
               src/org/apache/cocoon/generation Tag: xml-cocoon2
                        RequestGenerator.java ServerPagesGenerator.java
                        ServletGenerator.java
               src/org/apache/cocoon/serialization Tag: xml-cocoon2
                        AbstractSerializer.java SVGSerializer.java
               src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        AbstractSitemap.java Handler.java Manager.java
                        ResourcePipeline.java Sitemap.java
                        SitemapComponentManager.java
               src/org/apache/cocoon/util Tag: xml-cocoon2
                        ComponentPool.java
  Removed:     src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        ComponentHolder.java ComponentHolderFactory.java
                        DefaultComponentHolder.java
                        PoolableComponentHolder.java
                        ThreadSafeComponentHolder.java
  Log:
  Radical change in Sitemap ComponentHandling ! Works now
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.55  +2 -1      xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4.2.54
  retrieving revision 1.4.2.55
  diff -u -r1.4.2.54 -r1.4.2.55
  --- Cocoon.java	2001/02/15 21:55:50	1.4.2.54
  +++ Cocoon.java	2001/02/16 22:07:31	1.4.2.55
  @@ -45,7 +45,7 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a> (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4.2.54 $ $Date: 2001/02/15 21:55:50 $
  + * @version CVS $Revision: 1.4.2.55 $ $Date: 2001/02/16 22:07:31 $
    */
   public class Cocoon extends AbstractLoggable implements Component, Initializable, Modifiable, Processor, Contextualizable {
       /** The application context */
  @@ -156,6 +156,7 @@
           // Create the sitemap
           Configuration sconf = conf.getChild("sitemap");
           this.sitemapManager = new Manager(null);
  +        this.sitemapManager.contextualize(this.context);
           this.sitemapManager.setLogger(getLogger());
           this.sitemapManager.compose(this.componentManager);
           this.sitemapManager.configure(conf);
  
  
  
  1.1.2.19  +2 -2      xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java
  
  Index: DefaultComponentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java,v
  retrieving revision 1.1.2.18
  retrieving revision 1.1.2.19
  diff -u -r1.1.2.18 -r1.1.2.19
  --- DefaultComponentManager.java	2001/02/16 20:28:55	1.1.2.18
  +++ DefaultComponentManager.java	2001/02/16 22:07:31	1.1.2.19
  @@ -40,9 +40,9 @@
   
   /** Default component manager for Cocoon's non sitemap components.
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/02/16 20:28:55 $
  + * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/02/16 22:07:31 $
    */
  -public class DefaultComponentManager implements ComponentManager, Configurable, Loggable {
  +public class DefaultComponentManager implements ComponentManager, Loggable, Configurable, Contextualizable {
   
       protected Logger log;
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +2 -2      xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/AbstractCompiledComponent.java
  
  Index: AbstractCompiledComponent.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/AbstractCompiledComponent.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- AbstractCompiledComponent.java	2001/02/16 19:09:04	1.1.2.1
  +++ AbstractCompiledComponent.java	2001/02/16 22:07:33	1.1.2.2
  @@ -17,7 +17,7 @@
    * includes Sitemaps and XSP Pages
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/02/16 19:09:04 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/02/16 22:07:33 $
    */
   public abstract class AbstractCompiledComponent extends AbstractLoggable implements PoolClient, CompiledComponent {
       private Pool pool;
  @@ -28,7 +28,7 @@
           }
       }
   
  -    public void recycle() {
  +    public void returnToPool() {
          this.pool.put(this);
       }
   }
  
  
  
  1.1.2.4   +3 -4      xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/CompiledComponent.java
  
  Index: CompiledComponent.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/CompiledComponent.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- CompiledComponent.java	2001/02/16 18:11:47	1.1.2.3
  +++ CompiledComponent.java	2001/02/16 22:07:33	1.1.2.4
  @@ -9,15 +9,14 @@
   
   import org.apache.avalon.Composer;
   import org.apache.avalon.Modifiable;
  -import org.apache.avalon.Poolable;
  -import org.apache.avalon.Recyclable;
  +import org.apache.cocoon.PoolClient;
   
   /**
    * This interface is the common base of all Compiled Components.  This
    * includes Sitemaps and XSP Pages
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/02/16 18:11:47 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/02/16 22:07:33 $
    */
  -public interface CompiledComponent extends Composer, Poolable, Recyclable, Modifiable {
  +public interface CompiledComponent extends Composer, PoolClient, Modifiable {
   }
  
  
  
  1.1.2.29  +5 -8      xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java,v
  retrieving revision 1.1.2.28
  retrieving revision 1.1.2.29
  diff -u -r1.1.2.28 -r1.1.2.29
  --- ProgramGeneratorImpl.java	2001/02/16 16:29:21	1.1.2.28
  +++ ProgramGeneratorImpl.java	2001/02/16 22:07:34	1.1.2.29
  @@ -45,7 +45,7 @@
   /**
    * The default implementation of <code>ProgramGenerator</code>
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.28 $ $Date: 2001/02/16 16:29:21 $
  + * @version CVS $Revision: 1.1.2.29 $ $Date: 2001/02/16 22:07:34 $
    */
   public class ProgramGeneratorImpl extends AbstractLoggable implements ProgramGenerator, Contextualizable, Composer, Configurable, ThreadSafe {
   
  @@ -159,12 +159,9 @@
                           // Store loaded program in cache
                           this.cache.addGenerator(filename, program);
                       }
  -                    // Instantiate program
  -                    programInstance = programmingLanguage.instantiate(program);
  -                    if (programInstance instanceof Loggable) {
  -                        ((Loggable)programInstance).setLogger(getLogger());
  -                    }
  -                    programInstance.compose(this.manager);
  +
  +                    programInstance = (CompiledComponent) this.cache.select(filename);
  +
                   } catch (LanguageException le) {
                       getLogger().debug("Language Exception", le);
                   }
  @@ -202,7 +199,7 @@
                       this.cache.addGenerator(filename, program);
                   }
                   // Instantiate
  -                programInstance = programmingLanguage.instantiate(program);
  +                programInstance = (CompiledComponent) this.cache.select(filename);
               }
               return programInstance;
       }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.78  +5 -7      xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
  retrieving revision 1.1.2.77
  retrieving revision 1.1.2.78
  diff -u -r1.1.2.77 -r1.1.2.78
  --- sitemap.xsl	2001/02/15 20:34:39	1.1.2.77
  +++ sitemap.xsl	2001/02/16 22:07:35	1.1.2.78
  @@ -84,7 +84,6 @@
       import org.apache.cocoon.matching.Matcher;
       import org.apache.cocoon.selection.Selector;
       import org.apache.cocoon.sitemap.AbstractSitemap;
  -    import org.apache.cocoon.sitemap.ComponentHolder;
       import org.apache.cocoon.sitemap.ResourcePipeline;
       import org.apache.cocoon.sitemap.Sitemap;
       import org.apache.cocoon.sitemap.ErrorNotifier;
  @@ -95,7 +94,7 @@
        *
        * @author &lt;a href="mailto:giacomo@apache.org"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:bloritsch@apache.org"&gt;Berin Loritsch&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.1.2.77 2001/02/15 20:34:39 bloritsch Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.1.2.78 2001/02/16 22:07:35 bloritsch Exp $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -191,7 +190,6 @@
          * &lt;code&gt;Configurable&lt;/code&gt; class.
          */
         public void configure(Configuration conf) throws ConfigurationException {
  -        super.configure(conf);
           this.sitemapManager = new Manager(super.sitemapComponentManager);
           this.sitemapManager.setLogger(getLogger());
           this.sitemapManager.compose(this.manager);
  @@ -490,7 +488,7 @@
             <xsl:value-of select="$matcher-name2"/>
           </xsl:when>
           <xsl:otherwise>
  -          ((Matcher)((ComponentHolder)super.sitemapComponentManager.lookup("matcher:<xsl:value-of select="$matcher-type"/>")).get()).match
  +          ((Matcher)super.sitemapComponentManager.lookup("matcher:<xsl:value-of select="$matcher-type"/>")).match
           </xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
  @@ -563,7 +561,7 @@
               <xsl:value-of select="$selector-name2"/>
             </xsl:when>
             <xsl:otherwise>
  -            ((Selector)((ComponentHolder)super.sitemapComponentManager.lookup("selector:<xsl:value-of select="$selector-type"/>")).get()).select
  +            ((Selector)super.sitemapComponentManager.lookup("selector:<xsl:value-of select="$selector-type"/>")).select
             </xsl:otherwise>
           </xsl:choose>
         </xsl:variable>
  @@ -608,7 +606,7 @@
   
       <!-- gets the string how the action is to be invoced in java code -->
       <xsl:variable name="action-name">
  -      ((Action)((ComponentHolder)super.sitemapComponentManager.lookup("action:<xsl:value-of select="$action-type"/>")).get()).act
  +      ((Action)super.sitemapComponentManager.lookup("action:<xsl:value-of select="$action-type"/>")).act
       </xsl:variable>
   
       <!-- test if we have to define parameters for this action -->
  @@ -668,7 +666,7 @@
   
       <!-- gets the string how the action is to be invoced in java code -->
       <xsl:variable name="action-name">
  -      ((Action)((ComponentHolder)super.sitemapComponentManager.lookup("action:<xsl:value-of select="$action-type"/>")).get()).act
  +      ((Action)super.sitemapComponentManager.lookup("action:<xsl:value-of select="$action-type"/>")).act
       </xsl:variable>
   
       <!-- test if we have to define parameters for this action -->
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.13  +17 -2     xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPGenerator.java
  
  Index: XSPGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPGenerator.java,v
  retrieving revision 1.1.2.12
  retrieving revision 1.1.2.13
  diff -u -r1.1.2.12 -r1.1.2.13
  --- XSPGenerator.java	2001/02/15 20:34:48	1.1.2.12
  +++ XSPGenerator.java	2001/02/16 22:07:37	1.1.2.13
  @@ -11,8 +11,12 @@
   import org.apache.avalon.ComponentManager;
   import org.apache.cocoon.components.parser.Parser;
   
  +import org.apache.cocoon.components.language.generator.CompiledComponent;
  +import org.apache.cocoon.PoolClient;
  +
   import org.apache.log.Logger;
   import org.apache.avalon.Loggable;
  +import org.apache.avalon.util.pool.Pool;
   
   import org.apache.cocoon.generation.AbstractServerPage;
   
  @@ -20,10 +24,11 @@
    * Base class for XSP-generated <code>ServerPagesGenerator</code> classes
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/15 20:34:48 $
  + * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/02/16 22:07:37 $
    */
  -public abstract class XSPGenerator extends AbstractServerPage implements Loggable {
  +public abstract class XSPGenerator extends AbstractServerPage implements Loggable, PoolClient, CompiledComponent {
   
  +  protected Pool pool;
     protected Parser parser;
     protected Logger log;
   
  @@ -49,4 +54,14 @@
           log.error("Can't find component", e);
       }
     }
  +    public void setPool(Pool pool) {
  +        if (this.pool == null) {
  +           this.pool = pool;
  +        }
  +    }
  +
  +    public void returnToPool() {
  +       super.recycle();
  +       this.pool.put(this);
  +    }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +8 -6      xml-cocoon/src/org/apache/cocoon/generation/Attic/RequestGenerator.java
  
  Index: RequestGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/RequestGenerator.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- RequestGenerator.java	2000/10/19 14:43:50	1.1.2.5
  +++ RequestGenerator.java	2001/02/16 22:07:38	1.1.2.6
  @@ -13,14 +13,16 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.helpers.AttributesImpl;
   
  +import org.apache.avalon.Poolable;
  +
   /**
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/10/19 14:43:50 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/02/16 22:07:38 $
    */
  -public class RequestGenerator extends ServletGenerator {
  +public class RequestGenerator extends ServletGenerator implements Poolable {
   
       /** The URI of the namespace of this generator. */
       private String URI="http://xml.apache.org/cocoon/2.0/RequestGenerator";
  @@ -33,7 +35,7 @@
           this.contentHandler.startDocument();
           this.contentHandler.startPrefixMapping("",URI);
           AttributesImpl attr=new AttributesImpl();
  -        
  +
           this.attribute(attr,"target",this.request.getRequestURI());
           this.attribute(attr,"source",this.source);
           this.start("request",attr);
  @@ -109,11 +111,11 @@
           this.contentHandler.endPrefixMapping("");
           this.contentHandler.endDocument();
       }
  -    
  +
       private void attribute(AttributesImpl attr, String name, String value) {
           attr.addAttribute("",name,name,"CDATA",value);
       }
  -    
  +
       private void start(String name, AttributesImpl attr)
       throws SAXException {
           super.contentHandler.startElement(URI,name,name,attr);
  @@ -124,7 +126,7 @@
       throws SAXException {
           super.contentHandler.endElement(URI,name,name);
       }
  -    
  +
       private void data(String data)
       throws SAXException {
           super.contentHandler.characters(data.toCharArray(),0,data.length());
  
  
  
  1.1.2.18  +7 -6      xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java,v
  retrieving revision 1.1.2.17
  retrieving revision 1.1.2.18
  diff -u -r1.1.2.17 -r1.1.2.18
  --- ServerPagesGenerator.java	2001/02/16 18:34:00	1.1.2.17
  +++ ServerPagesGenerator.java	2001/02/16 22:07:39	1.1.2.18
  @@ -21,10 +21,11 @@
   
   import org.apache.avalon.Composer;
   import org.apache.avalon.ComponentManager;
  -import org.apache.avalon.Poolable;
  +import org.apache.avalon.ThreadSafe;
   
   import org.apache.cocoon.components.language.generator.CompiledComponent;
   import org.apache.cocoon.components.language.generator.ProgramGenerator;
  +import org.apache.cocoon.components.language.markup.xsp.XSPGenerator;
   import org.apache.cocoon.components.url.URLFactory;
   
   import java.io.IOException;
  @@ -40,11 +41,11 @@
    * delegating actual SAX event generation.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/02/16 18:34:00 $
  + * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/02/16 22:07:39 $
    */
   public class ServerPagesGenerator
     extends ServletGenerator
  -  implements ContentHandler, LexicalHandler, Poolable
  +  implements ContentHandler, LexicalHandler, ThreadSafe
   {
     /**
      * The sitemap-defined server pages program generator
  @@ -132,10 +133,10 @@
           );
       }
   
  -    Generator generator = null;
  +    XSPGenerator generator = null;
   
       try {
  -      generator = (Generator)
  +      generator = (XSPGenerator)
           programGenerator.load(file, this.markupLanguage, this.programmingLanguage, this.resolver);
       } catch (Exception e) {
         getLogger().warn("ServerPagesGenerator.generate()", e);
  @@ -192,7 +193,7 @@
         }
       }
   
  -    ((CompiledComponent) generator).recycle();
  +    generator.returnToPool();
     }
   
     /* Handlers */
  
  
  
  1.1.2.10  +2 -3      xml-cocoon/src/org/apache/cocoon/generation/Attic/ServletGenerator.java
  
  Index: ServletGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/ServletGenerator.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- ServletGenerator.java	2001/02/16 15:38:32	1.1.2.9
  +++ ServletGenerator.java	2001/02/16 22:07:39	1.1.2.10
  @@ -15,7 +15,6 @@
   import javax.servlet.http.HttpServletResponse;
   
   import org.apache.avalon.Parameters;
  -import org.apache.avalon.Poolable;
   import org.apache.avalon.Composer;
   
   import org.apache.cocoon.Constants;
  @@ -27,10 +26,10 @@
   /**
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/16 15:38:32 $
  + * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/16 22:07:39 $
    */
   public abstract class ServletGenerator extends ComposerGenerator
  -implements Composer, Poolable {
  +implements Composer {
   
       protected HttpServletRequest request=null;
       protected HttpServletResponse response=null;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +6 -6      xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSerializer.java
  
  Index: AbstractSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSerializer.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- AbstractSerializer.java	2001/02/12 13:30:45	1.1.2.9
  +++ AbstractSerializer.java	2001/02/16 22:07:42	1.1.2.10
  @@ -5,7 +5,7 @@
    * version 1.1, a copy of which has been included  with this distribution in *
    * the LICENSE file.                                                         *
    *****************************************************************************/
  - 
  +
   package org.apache.cocoon.serialization;
   
   import java.io.OutputStream;
  @@ -16,14 +16,14 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/12 13:30:45 $
  + * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/16 22:07:42 $
    */
  - 
  +
   public abstract class AbstractSerializer extends AbstractXMLPipe implements Serializer, Recyclable {
   
       /**
        * The <code>OutputStream</code> used by this serializer.
  -     */    
  +     */
       protected OutputStream output;
   
       /**
  @@ -35,7 +35,7 @@
   
       /**
        * Get the mime-type of the output of this <code>Serializer</code>
  -     * This default implementation returns null to indicate that the 
  +     * This default implementation returns null to indicate that the
        * mime-type specified in the sitemap is to be used
        */
       public String getMimeType() {
  @@ -43,7 +43,7 @@
       }
   
       /**
  -     * Recycle serializer by removing references 
  +     * Recycle serializer by removing references
        */
       public void recycle() {
           this.output = null;
  
  
  
  1.1.2.22  +2 -2      xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java
  
  Index: SVGSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java,v
  retrieving revision 1.1.2.21
  retrieving revision 1.1.2.22
  diff -u -r1.1.2.21 -r1.1.2.22
  --- SVGSerializer.java	2001/01/11 19:12:32	1.1.2.21
  +++ SVGSerializer.java	2001/02/16 22:07:42	1.1.2.22
  @@ -37,7 +37,7 @@
    * A Batik based Serializer for generating PNG/JPG images
    *
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/01/11 19:12:32 $
  + * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/02/16 22:07:42 $
    */
   public class SVGSerializer extends SVGBuilder implements Composer, Serializer, Configurable {
   
  @@ -122,7 +122,7 @@
       public void notify(Document doc) throws SAXException {
           try {
               TranscoderFactory transcoderFactory =
  -	            ConcreteTranscoderFactory.getTranscoderFactoryImplementation();
  +                ConcreteTranscoderFactory.getTranscoderFactoryImplementation();
               AbstractTranscoder transcoder = (AbstractTranscoder)
                   transcoderFactory.createTranscoder(mimetype);
               transcoder.transcodeToStream(doc,this.output);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.21  +24 -21    xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java
  
  Index: AbstractSitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java,v
  retrieving revision 1.1.2.20
  retrieving revision 1.1.2.21
  diff -u -r1.1.2.20 -r1.1.2.21
  --- AbstractSitemap.java	2001/02/16 18:11:53	1.1.2.20
  +++ AbstractSitemap.java	2001/02/16 22:07:44	1.1.2.21
  @@ -17,11 +17,14 @@
   import java.util.Map;
   
   import org.apache.avalon.ComponentManager;
  +import org.apache.avalon.Contextualizable;
  +import org.apache.avalon.Context;
   import org.apache.avalon.Component;
   import org.apache.avalon.Composer;
   import org.apache.avalon.Configurable;
   import org.apache.avalon.Configuration;
  -import org.apache.avalon.ConfigurationException;
  +import org.apache.avalon.ComponentManagerException;
  +import org.apache.avalon.ComponentNotFoundException;
   
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.Processor;
  @@ -30,7 +33,6 @@
   import org.apache.cocoon.components.classloader.RepositoryClassLoader;
   import org.apache.cocoon.components.language.generator.AbstractCompiledComponent;
   import org.apache.cocoon.environment.Environment;
  -import org.apache.cocoon.sitemap.ComponentHolderFactory;
   import org.apache.cocoon.sitemap.SitemapComponentManager;
   import org.apache.cocoon.util.ClassUtils;
   
  @@ -40,9 +42,10 @@
    * Base class for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/02/16 18:11:53 $
  + * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/02/16 22:07:44 $
    */
   public abstract class AbstractSitemap extends AbstractCompiledComponent implements Sitemap {
  +    private Context context;
   
       private static final int BYTE_ARRAY_SIZE = 1024;
   
  @@ -65,35 +68,32 @@
        * Set the current <code>ComponentManager</code> instance used by this
        * <code>Composer</code>.
        */
  -    public void setParentSitemapComponentManager(ComponentManager parentSitemapComponentManager) {
  +    public void setParentSitemapComponentManager(SitemapComponentManager parentSitemapComponentManager) {
           this.sitemapComponentManager = new SitemapComponentManager (parentSitemapComponentManager);
  -        try {
  -            this.sitemapComponentManager.setURLFactory((URLFactory)manager.lookup(Roles.URL_FACTORY));
  -        } catch (Exception e) {
  -            getLogger().warn("cannot obtain URLFactory", e);
  -        }
  +        this.sitemapComponentManager.contextualize(this.context);
  +        this.sitemapComponentManager.setLogger(getLogger());
  +        this.sitemapComponentManager.addComponentInstance(Roles.URL_FACTORY, this.urlFactory);
       }
   
       /**
        * Set the current <code>ComponentManager</code> instance used by this
        * <code>Composer</code>.
        */
  -    public void compose(ComponentManager manager) {
  +    public void compose(ComponentManager manager)  throws ComponentManagerException {
           this.manager = manager;
  -    }
   
  -    /**
  -     * Configure this instance
  -     */
  -    public void configure(Configuration conf) throws ConfigurationException {
           try {
               this.urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
           } catch (Exception e) {
               getLogger().error("cannot obtain the URLFactory", e);
  -            throw new ConfigurationException ("cannot obtain the URLFactory", e);
  +            throw new ComponentNotFoundException ("cannot obtain the URLFactory", e);
           }
       }
   
  +    public void contextualize(Context context) {
  +        this.context = context;
  +    }
  +
       /**
        * Determines whether this generator's source files have changed
        *
  @@ -135,11 +135,14 @@
           if (!Component.class.isAssignableFrom(clazz)) {
               throw new IllegalAccessException ("Object " + classURL + " is not a Component");
           }
  -        this.sitemapComponentManager.put(
  -            type, ComponentHolderFactory.getComponentHolder(
  -                getLogger(), clazz, configuration, this.manager, mime_type
  -            )
  -        );
  +
  +        if (this.sitemapComponentManager == null) {
  +            this.sitemapComponentManager = new SitemapComponentManager();
  +            this.sitemapComponentManager.contextualize(this.context);
  +            this.sitemapComponentManager.setLogger(getLogger());
  +        }
  +
  +        this.sitemapComponentManager.addSitemapComponent(type, clazz, configuration, mime_type);
       }
   
       private byte [] getByteArrayFromStream (InputStream stream) {
  
  
  
  1.1.2.16  +11 -6     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java,v
  retrieving revision 1.1.2.15
  retrieving revision 1.1.2.16
  diff -u -r1.1.2.15 -r1.1.2.16
  --- Handler.java	2001/02/15 18:18:25	1.1.2.15
  +++ Handler.java	2001/02/16 22:07:46	1.1.2.16
  @@ -29,6 +29,8 @@
   import org.apache.avalon.Configuration;
   import org.apache.avalon.Composer;
   import org.apache.avalon.ComponentManager;
  +import org.apache.avalon.Contextualizable;
  +import org.apache.avalon.Context;
   
   import org.apache.avalon.AbstractLoggable;
   import org.apache.avalon.Loggable;
  @@ -38,9 +40,10 @@
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/02/15 18:18:25 $
  + * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/02/16 22:07:46 $
    */
  -public class Handler extends AbstractLoggable implements Runnable, Configurable, Composer, Processor {
  +public class Handler extends AbstractLoggable implements Runnable, Configurable, Composer, Contextualizable, Processor {
  +    private Context context;
   
       /** the configuration */
       private Configuration conf;
  @@ -49,7 +52,7 @@
       private ComponentManager manager;
   
       /** the parent sitemap component manager */
  -    private ComponentManager parentSitemapComponentManager;
  +    private SitemapComponentManager parentSitemapComponentManager;
   
       /** the source of this sitemap */
       private String source;
  @@ -87,7 +90,11 @@
           this.conf = conf;
       }
   
  -    protected Handler (ComponentManager sitemapComponentManager, String source, boolean check_reload)
  +    public void contextualize (Context context) {
  +        this.context = context;
  +    }
  +
  +    protected Handler (SitemapComponentManager sitemapComponentManager, String source, boolean check_reload)
       throws FileNotFoundException {
           this.parentSitemapComponentManager = sitemapComponentManager;
           this.check_reload = check_reload;
  @@ -168,8 +175,6 @@
           try {
               ProgramGenerator programGenerator = (ProgramGenerator) this.manager.lookup(Roles.PROGRAM_GENERATOR);
               smap = (Sitemap) programGenerator.load(this.sourceFile, markupLanguage, programmingLanguage, environment);
  -            if (smap instanceof Loggable) ((Loggable)smap).setLogger(getLogger());
  -            if (smap instanceof Composer) smap.compose(this.manager);
               smap.setParentSitemapComponentManager (this.parentSitemapComponentManager);
               if (smap instanceof Configurable) smap.configure(this.conf);
   
  
  
  
  1.1.2.7   +13 -5     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- Manager.java	2001/02/15 00:59:08	1.1.2.6
  +++ Manager.java	2001/02/16 22:07:46	1.1.2.7
  @@ -15,13 +15,14 @@
   import java.util.Iterator;
   import java.util.HashMap;
   
  +import org.apache.avalon.Contextualizable;
  +import org.apache.avalon.Context;
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.Composer;
   import org.apache.avalon.Configurable;
   import org.apache.avalon.Configuration;
   import org.apache.avalon.Loggable;
   import org.apache.avalon.AbstractLoggable;
  -//import org.apache.log.Logger;
   
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.environment.Environment;
  @@ -35,10 +36,12 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/02/15 00:59:08 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/16 22:07:46 $
    */
  -public class Manager extends AbstractLoggable implements Configurable, Composer {
  +public class Manager extends AbstractLoggable implements Configurable, Composer, Contextualizable {
   
  +    private Context context;
  +
       /** The vectors of sub sitemaps */
       private HashMap sitemaps = new HashMap();
   
  @@ -49,9 +52,9 @@
       private ComponentManager manager;
   
       /** The parent sitemap component manager */
  -    private ComponentManager parentSitemapComponentManager;
  +    private SitemapComponentManager parentSitemapComponentManager;
   
  -    public Manager (ComponentManager sitemapComponentManager) {
  +    public Manager (SitemapComponentManager sitemapComponentManager) {
           this.parentSitemapComponentManager = sitemapComponentManager;
       }
   
  @@ -59,6 +62,10 @@
           this.conf = conf;
       }
   
  +    public void contextualize (Context context) {
  +        this.context = context;
  +    }
  +
       public void compose (ComponentManager manager) {
           this.manager = manager;
       }
  @@ -86,6 +93,7 @@
               }
           } else {
               sitemapHandler = new Handler(parentSitemapComponentManager, source, check_reload);
  +            sitemapHandler.contextualize(this.context);
               sitemapHandler.setLogger(getLogger());
               sitemapHandler.compose(this.manager);
               sitemapHandler.configure(this.conf);
  
  
  
  1.1.2.19  +83 -85    xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourcePipeline.java
  
  Index: ResourcePipeline.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourcePipeline.java,v
  retrieving revision 1.1.2.18
  retrieving revision 1.1.2.19
  diff -u -r1.1.2.18 -r1.1.2.19
  --- ResourcePipeline.java	2000/10/19 14:44:23	1.1.2.18
  +++ ResourcePipeline.java	2001/02/16 22:07:47	1.1.2.19
  @@ -25,6 +25,7 @@
   import org.apache.cocoon.transformation.Transformer;
   import org.apache.cocoon.serialization.Serializer;
   import org.apache.cocoon.xml.XMLProducer;
  +import org.apache.cocoon.PoolClient;
   
   import org.apache.cocoon.sitemap.ErrorNotifier;
   
  @@ -33,32 +34,34 @@
   
   /**
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.18 $ $Date: 2000/10/19 14:44:23 $
  + * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/02/16 22:07:47 $
    */
   public class ResourcePipeline implements Composer {
  -    private ComponentHolder generator;
  +    private Generator generator;
       private Parameters generatorParam;
       private String generatorSource;
       private Exception generatorException;
  -    private ComponentHolder reader;
  +    private Reader reader;
       private Parameters readerParam;
       private String readerSource;
       private String readerMimeType;
  +    private String sitemapReaderMimeType;
       private Vector transformers = new Vector();
       private Vector transformerParams = new Vector();
       private Vector transformerSources = new Vector();
  -    private ComponentHolder serializer;
  +    private Serializer serializer;
       private Parameters serializerParam;
       private String serializerSource;
       private String serializerMimeType;
  +    private String sitemapSerializerMimeType;
   
       /** the component manager */
       private ComponentManager manager;
   
       /** the sitemap component manager */
  -    private ComponentManager sitemapComponentManager;
  +    private SitemapComponentManager sitemapComponentManager;
   
  -    public ResourcePipeline (ComponentManager sitemapComponentManager) {
  +    public ResourcePipeline (SitemapComponentManager sitemapComponentManager) {
           this.sitemapComponentManager = sitemapComponentManager;
       }
   
  @@ -77,7 +80,7 @@
           if (this.generator != null) {
               throw new ProcessingException ("Generator already set. You can only select one Generator (" + role + ")");
           }
  -        this.generator = (ComponentHolder)sitemapComponentManager.lookup(role);
  +        this.generator = (Generator)sitemapComponentManager.lookup(role);
           this.generatorSource = source;
           this.generatorParam = param;
       }
  @@ -92,10 +95,11 @@
           if (this.reader != null) {
               throw new ProcessingException ("Reader already set. You can only select one Reader (" + role + ")");
           }
  -        this.reader = (ComponentHolder)sitemapComponentManager.lookup(role);
  +        this.reader = (Reader)sitemapComponentManager.lookup(role);
           this.readerSource = source;
           this.readerParam = param;
           this.readerMimeType = mimeType;
  +        this.sitemapReaderMimeType = this.sitemapComponentManager.getMimeTypeForRole(role);
       }
   
       public void setSerializer (String role, String source, Parameters param)
  @@ -108,15 +112,16 @@
           if (this.serializer != null) {
               throw new ProcessingException ("Serializer already set. You can only select one Serializer (" + role + ")");
           }
  -        this.serializer = (ComponentHolder)sitemapComponentManager.lookup(role);
  +        this.serializer = (Serializer)sitemapComponentManager.lookup(role);
           this.serializerSource = source;
           this.serializerParam = param;
           this.serializerMimeType = mimeType;
  +        this.sitemapSerializerMimeType = this.sitemapComponentManager.getMimeTypeForRole(role);
       }
   
       public void addTransformer (String role, String source, Parameters param)
       throws Exception {
  -        this.transformers.add ((ComponentHolder)sitemapComponentManager.lookup(role));
  +        this.transformers.add ((Transformer)sitemapComponentManager.lookup(role));
           this.transformerSources.add (source);
           this.transformerParams.add (param);
       }
  @@ -125,91 +130,84 @@
                               throws Exception {
           String mime_type;
   
  -        if (generator == null) {
  -            if (reader != null) {
  -                Reader myReader = null;
  -                try {
  -                    myReader = (Reader) reader.get();
  -                    myReader.setup ((EntityResolver) environment, environment.getObjectModel(), readerSource, readerParam);
  -                    mime_type = myReader.getMimeType();
  -                    if (mime_type != null) {
  -                        // we have a mimeType freom the component itself
  -                        environment.setContentType (mime_type);
  -                    } else if (readerMimeType != null) {
  -                        // there was a mimeType specified in the sitemap pipeline
  -                        environment.setContentType (readerMimeType);
  -                    } else {
  -                        // use the mimeType specified in the sitemap component declaration
  -                        environment.setContentType (reader.getMimeType());
  -                    }
  -                    myReader.setOutputStream (environment.getOutputStream());
  -                    myReader.generate();
  -                } finally {
  -                    if (myReader != null)
  -                        reader.put(myReader);
  +        if (this.generator == null) {
  +            if (this.reader != null) {
  +                this.reader.setup ((EntityResolver) environment, environment.getObjectModel(), readerSource, readerParam);
  +                mime_type = this.reader.getMimeType();
  +                if (mime_type != null) {
  +                    // we have a mimeType freom the component itself
  +                    environment.setContentType (mime_type);
  +                } else if (readerMimeType != null) {
  +                    // there was a mimeType specified in the sitemap pipeline
  +                    environment.setContentType (this.readerMimeType);
  +                } else {
  +                    // use the mimeType specified in the sitemap component declaration
  +                    environment.setContentType (this.sitemapReaderMimeType);
                   }
  +                reader.setOutputStream (environment.getOutputStream());
  +                reader.generate();
   
  +                if (reader instanceof PoolClient) {
  +                   ((PoolClient)reader).returnToPool();
  +                }
  +
               } else {
                   throw new ProcessingException ("Generator or Reader not specified");
               }
           } else {
  -            if (serializer == null) {
  +            if (this.serializer == null) {
                   throw new ProcessingException ("Serializer not specified");
               }
   
  -            Generator myGenerator = (Generator) generator.get();
  -            try {
  -                if (generatorException != null) {
  -                    ((ErrorNotifier)myGenerator).setException (generatorException);
  -                }
  -                int i = transformers.size();
  -                Transformer myTransformer[] = new Transformer[i];
  -                int num_transformers = 0;
  -
  -                try {
  -                    for (num_transformers=0; num_transformers < i; num_transformers++) {
  -                        myTransformer[num_transformers] = (Transformer)((ComponentHolder) transformers.elementAt (num_transformers)).get();
  -                    }
  -
  -                    Serializer mySerializer = (Serializer) serializer.get();
  -                    try {
  -
  -                        myGenerator.setup ((EntityResolver) environment, environment.getObjectModel(), generatorSource, generatorParam);
  -                        Transformer transformer = null;
  -                        XMLProducer producer = myGenerator;
  -                        for (int j=0; j < i; j++) {
  -                            myTransformer[j].setup ((EntityResolver) environment, environment.getObjectModel(),
  -                                    (String)transformerSources.elementAt (j),
  -                                    (Parameters)transformerParams.elementAt (j));
  -                            producer.setConsumer (myTransformer[j]);
  -                            producer = myTransformer[j];
  -                        }
  -
  -                        mime_type = mySerializer.getMimeType();
  -                        if (mime_type != null) {
  -                            // we have a mimeType freom the component itself
  -                            environment.setContentType (mime_type);
  -                        } else if (serializerMimeType != null) {
  -                            // there was a mimeType specified in the sitemap pipeline
  -                            environment.setContentType (serializerMimeType);
  -                        } else {
  -                            // use the mimeType specified in the sitemap component declaration
  -                            environment.setContentType (serializer.getMimeType());
  -                        }
  -                        mySerializer.setOutputStream (environment.getOutputStream());
  -                        producer.setConsumer (mySerializer);
  -                        myGenerator.generate();
  -                    } finally {
  -                        serializer.put(mySerializer);
  -                    }
  -                } finally {
  -                    for (int j=0; j < num_transformers; j++) {
  -                        ((ComponentHolder) transformers.elementAt (j)).put(myTransformer[j]);
  -                    }
  +            if (generatorException != null) {
  +                ((ErrorNotifier)this.generator).setException (generatorException);
  +            }
  +            int i = transformers.size();
  +            Transformer myTransformer[] = new Transformer[i];
  +            int num_transformers = 0;
  +
  +            for (num_transformers=0; num_transformers < i; num_transformers++) {
  +                myTransformer[num_transformers] = (Transformer) transformers.elementAt (num_transformers);
  +            }
  +
  +            this.generator.setup ((EntityResolver) environment, environment.getObjectModel(), generatorSource, generatorParam);
  +            Transformer transformer = null;
  +            XMLProducer producer = this.generator;
  +            for (int j=0; j < i; j++) {
  +                myTransformer[j].setup ((EntityResolver) environment, environment.getObjectModel(),
  +                        (String)transformerSources.elementAt (j),
  +                        (Parameters)transformerParams.elementAt (j));
  +                producer.setConsumer (myTransformer[j]);
  +                producer = myTransformer[j];
  +            }
  +
  +            mime_type = this.serializer.getMimeType();
  +            if (mime_type != null) {
  +                // we have a mimeType freom the component itself
  +                environment.setContentType (mime_type);
  +            } else if (serializerMimeType != null) {
  +                // there was a mimeType specified in the sitemap pipeline
  +                environment.setContentType (serializerMimeType);
  +            } else {
  +                // use the mimeType specified in the sitemap component declaration
  +                environment.setContentType (this.sitemapSerializerMimeType);
  +            }
  +            this.serializer.setOutputStream (environment.getOutputStream());
  +            producer.setConsumer (this.serializer);
  +            this.generator.generate();
  +
  +            if (generator instanceof PoolClient) {
  +               ((PoolClient)reader).returnToPool();
  +            }
  +
  +            for (int j=0; j < i; j++) {
  +                if (myTransformer[j] instanceof PoolClient) {
  +                   ((PoolClient)myTransformer[j]).returnToPool();
                   }
  -            } finally {
  -                if (myGenerator != null)
  -                    generator.put(myGenerator);
  +            }
  +
  +            if (serializer instanceof PoolClient) {
  +               ((PoolClient)reader).returnToPool();
               }
           }
           return true;
  
  
  
  1.1.4.13  +4 -3      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java
  
  Index: Sitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java,v
  retrieving revision 1.1.4.12
  retrieving revision 1.1.4.13
  diff -u -r1.1.4.12 -r1.1.4.13
  --- Sitemap.java	2001/02/16 15:38:33	1.1.4.12
  +++ Sitemap.java	2001/02/16 22:07:47	1.1.4.13
  @@ -9,6 +9,7 @@
   
   import org.apache.avalon.Configurable;
   import org.apache.avalon.ComponentManager;
  +import org.apache.avalon.Contextualizable;
   
   import org.apache.cocoon.components.language.generator.CompiledComponent;
   import org.apache.cocoon.Processor;
  @@ -17,8 +18,8 @@
    * Base interface for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.4.12 $ $Date: 2001/02/16 15:38:33 $
  + * @version CVS $Revision: 1.1.4.13 $ $Date: 2001/02/16 22:07:47 $
    */
  -public interface Sitemap extends CompiledComponent, Configurable, Processor {
  -    void setParentSitemapComponentManager (ComponentManager sitemapComponentManager);
  +public interface Sitemap extends CompiledComponent, Configurable, Contextualizable, Processor {
  +    void setParentSitemapComponentManager (SitemapComponentManager sitemapComponentManager);
   }
  
  
  
  1.1.2.2   +34 -10    xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapComponentManager.java
  
  Index: SitemapComponentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapComponentManager.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- SitemapComponentManager.java	2001/02/14 11:39:08	1.1.2.1
  +++ SitemapComponentManager.java	2001/02/16 22:07:48	1.1.2.2
  @@ -8,34 +8,58 @@
   
   package org.apache.cocoon.sitemap;
   
  +import java.util.HashMap;
  +
   import org.apache.avalon.ComponentManager;
  -import org.apache.avalon.DefaultComponentManager;
  +import org.apache.avalon.Configuration;
  +import org.apache.avalon.ConfigurationException;
  +import org.apache.avalon.Component;
  +import org.apache.avalon.ComponentManagerException;
  +import org.apache.cocoon.DefaultComponentManager;
   
   import org.apache.cocoon.components.url.URLFactory;
   
   /** Default component manager for Cocoon's sitemap components.
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version CVS $Id: SitemapComponentManager.java,v 1.1.2.1 2001/02/14 11:39:08 giacomo Exp $
  + * @version CVS $Id: SitemapComponentManager.java,v 1.1.2.2 2001/02/16 22:07:48 bloritsch Exp $
    */
   public class SitemapComponentManager extends DefaultComponentManager {
  -
  -    /** The URLFactory
  -     */
  -    private URLFactory urlFactory;
  +    ComponentManager manager;
  +    HashMap mime_types;
   
       /** The conctructors (same as the Avalon DefaultComponentManager)
        */
       public SitemapComponentManager () {
           super();
  +        this.mime_types = new HashMap();
       }
   
       public SitemapComponentManager (ComponentManager parent) {
  -        super(parent);
  +        this();
  +        this.manager = parent;
       }
  +
  +    public Component lookup(String role) throws ComponentManagerException {
  +        try {
  +            Component comp = super.lookup(role);
  +            return comp;
  +        } catch (ComponentManagerException cme) {
  +            if (this.manager != null) {
  +                return this.manager.lookup(role);
  +            }
   
  -    public void setURLFactory(URLFactory urlFactory) {
  -        if (this.urlFactory == null) {
  -            this.urlFactory = urlFactory;
  +            throw cme;
           }
  +    }
  +
  +    protected String getMimeTypeForRole(String role) {
  +        return (String) this.mime_types.get(role);
  +    }
  +
  +    protected void addSitemapComponent(String type, Class component, Configuration conf, String mime_type)
  +    throws ComponentManagerException,
  +           ConfigurationException {
  +        super.addComponent(type, component, conf);
  +        this.mime_types.put(type, mime_type);
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +0 -9      xml-cocoon/src/org/apache/cocoon/util/Attic/ComponentPool.java
  
  Index: ComponentPool.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/ComponentPool.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- ComponentPool.java	2001/02/16 18:11:57	1.1.2.4
  +++ ComponentPool.java	2001/02/16 22:07:50	1.1.2.5
  @@ -32,18 +32,12 @@
       public ComponentPool(final ObjectFactory factory,
                            final PoolController controller) throws Exception {
           super(factory, controller, DEFAULT_POOL_SIZE/2, DEFAULT_POOL_SIZE);
  -        if (factory instanceof ComponentFactory) {
  -            ((ComponentFactory) factory).setPool(this);
  -        }
       }
   
       public ComponentPool(final ObjectFactory factory,
                            final PoolController controller,
                            final int initial) throws Exception {
           super(factory, controller, initial, initial);
  -        if (factory instanceof ComponentFactory) {
  -            ((ComponentFactory) factory).setPool(this);
  -        }
       }
   
       public ComponentPool(final ObjectFactory factory,
  @@ -51,9 +45,6 @@
                            final int initial,
                            final int maximum) throws Exception {
           super(factory, controller, initial, maximum);
  -        if (factory instanceof ComponentFactory) {
  -            ((ComponentFactory) factory).setPool(this);
  -        }
       }
   
       public void setLogger(Logger log) {
  
  
  

Mime
View raw message