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/transformation AbstractDOMTransformer.java FragmentExtractorTransformer.java I18nTransformer.java XIncludeTransformer.java XTTransformer.java
Date Thu, 22 Feb 2001 19:08:26 GMT
bloritsch    01/02/22 11:08:25

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
               src/org/apache/cocoon/components/language/generator Tag:
                        xml-cocoon2 ProgramGeneratorImpl.java
               src/org/apache/cocoon/components/language/markup Tag:
                        xml-cocoon2 AbstractMarkupLanguage.java
               src/org/apache/cocoon/components/language/markup/xsp Tag:
                        xml-cocoon2 XSPGenerator.java
               src/org/apache/cocoon/components/language/markup/xsp/java
                        Tag: xml-cocoon2 esql.xsl util.xsl
               src/org/apache/cocoon/generation Tag: xml-cocoon2
                        FileGenerator.java HTMLGenerator.java
               src/org/apache/cocoon/reading Tag: xml-cocoon2
                        ResourceReader.java
               src/org/apache/cocoon/sitemap Tag: xml-cocoon2 Handler.java
                        ResourcePipeline.java
               src/org/apache/cocoon/transformation Tag: xml-cocoon2
                        AbstractDOMTransformer.java
                        FragmentExtractorTransformer.java
                        I18nTransformer.java XIncludeTransformer.java
                        XTTransformer.java
  Log:
  Updated with change to support more efficient Component Use.
  Also release components when you are done....
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.58  +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.57
  retrieving revision 1.4.2.58
  diff -u -r1.4.2.57 -r1.4.2.58
  --- Cocoon.java	2001/02/19 21:57:45	1.4.2.57
  +++ Cocoon.java	2001/02/22 19:07:34	1.4.2.58
  @@ -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.57 $ $Date: 2001/02/19 21:57:45 $
  + * @version CVS $Revision: 1.4.2.58 $ $Date: 2001/02/22 19:07:34 $
    */
   public class Cocoon extends AbstractLoggable implements Component, Initializable, Modifiable, Processor, Contextualizable {
       /** The application context */
  @@ -137,6 +137,7 @@
               is.setSystemId(this.configurationFile.toExternalForm());
               p.parse(is);
               this.configuration = b.getConfiguration();
  +            this.componentManager.release((Component) p);
           } catch (Exception e) {
               getLogger().error("Could not configure Cocoon environment", e);
               throw new ConfigurationException("Error trying to load configurations");
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.37  +10 -2     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.36
  retrieving revision 1.1.2.37
  diff -u -r1.1.2.36 -r1.1.2.37
  --- ProgramGeneratorImpl.java	2001/02/22 17:10:26	1.1.2.36
  +++ ProgramGeneratorImpl.java	2001/02/22 19:07:41	1.1.2.37
  @@ -46,7 +46,7 @@
   /**
    * The default implementation of <code>ProgramGenerator</code>
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.36 $ $Date: 2001/02/22 17:10:26 $
  + * @version CVS $Revision: 1.1.2.37 $ $Date: 2001/02/22 19:07:41 $
    */
   public class ProgramGeneratorImpl extends AbstractLoggable implements ProgramGenerator, Contextualizable, Composer, Configurable, ThreadSafe {
   
  @@ -171,7 +171,11 @@
               }
           }
   
  -        if (this.autoReload == false) return programInstance;
  +        if (this.autoReload == false) {
  +            this.markupSelector.release((Component) markupLanguage);
  +            this.languageSelector.release((Component) programmingLanguage);
  +            return programInstance;
  +        }
   
           /*
            * FIXME: It's the program (not the instance) that must
  @@ -189,6 +193,10 @@
           if (programInstance == null) {
               program = generateResource(file, normalizedName, markupLanguage, programmingLanguage, resolver);
           }
  +
  +        this.markupSelector.release((Component) markupLanguage);
  +        this.languageSelector.release((Component) programmingLanguage);
  +
           // Instantiate
           return (CompiledComponent) this.cache.select(normalizedName);
       }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.26  +8 -3      xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/AbstractMarkupLanguage.java
  
  Index: AbstractMarkupLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/AbstractMarkupLanguage.java,v
  retrieving revision 1.1.2.25
  retrieving revision 1.1.2.26
  diff -u -r1.1.2.25 -r1.1.2.26
  --- AbstractMarkupLanguage.java	2001/02/12 13:30:43	1.1.2.25
  +++ AbstractMarkupLanguage.java	2001/02/22 19:07:48	1.1.2.26
  @@ -48,7 +48,7 @@
    * Base implementation of <code>MarkupLanguage</code>. This class uses
    * logicsheets as the only means of code generation. Code generation should be decoupled from this context!!!
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.25 $ $Date: 2001/02/12 13:30:43 $
  + * @version CVS $Revision: 1.1.2.26 $ $Date: 2001/02/22 19:07:48 $
    */
   public abstract class AbstractMarkupLanguage extends AbstractLoggable implements MarkupLanguage, Composer, Configurable {
       /** The supported language table */
  @@ -166,9 +166,12 @@
               logicsheet.setLogger(getLogger());
           }
   
  -        URLFactory urlFactory = (URLFactory)this.manager.lookup(Roles.URL_FACTORY);
  +        URLFactory urlFactory = (URLFactory) this.manager.lookup(Roles.URL_FACTORY);
  +
           logicsheetURL = urlFactory.getURL(logicsheetLocation);
   
  +        this.manager.release((Component) urlFactory);
  +
           logicsheet.setInputSource(new InputSource(logicsheetURL.openStream()));
   
           entry = new CachedURL(logicsheetURL, logicsheet);
  @@ -279,7 +282,9 @@
   
               URL url = null;
               try {
  -                url = ((URLFactory)manager.lookup(Roles.URL_FACTORY)).getURL(logicsheetLocation);
  +                Component urlFactory = this.manager.lookup(Roles.URL_FACTORY);
  +                url = ((URLFactory) urlFactory).getURL(logicsheetLocation);
  +                this.manager.release(urlFactory);
               } catch (Exception e) {
                   getLogger().error("cannot get logicsheet at " + logicsheetLocation);
                   new SAXException ("cannot get logicsheet at " + logicsheetLocation, e);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.15  +2 -11     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.14
  retrieving revision 1.1.2.15
  diff -u -r1.1.2.14 -r1.1.2.15
  --- XSPGenerator.java	2001/02/22 17:10:28	1.1.2.14
  +++ XSPGenerator.java	2001/02/22 19:07:53	1.1.2.15
  @@ -23,11 +23,9 @@
    * 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.14 $ $Date: 2001/02/22 17:10:28 $
  + * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/02/22 19:07:53 $
    */
  -public abstract class XSPGenerator extends AbstractServerPage implements Loggable, Poolable, CompiledComponent {
  -
  -  protected Parser parser;
  +public abstract class XSPGenerator extends AbstractServerPage implements Loggable, CompiledComponent {
     protected Logger log;
   
       public void setLogger(Logger logger) {
  @@ -44,12 +42,5 @@
      */
     public void compose(ComponentManager manager) {
       super.compose(manager);
  -
  -    try {
  -        log.debug("Looking up " + Roles.PARSER);
  -        this.parser = (Parser) this.manager.lookup(Roles.PARSER);
  -    } catch (Exception e) {
  -        log.error("Can't find component", e);
  -    }
     }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.48  +26 -9     xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/esql.xsl
  
  Index: esql.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/esql.xsl,v
  retrieving revision 1.1.2.47
  retrieving revision 1.1.2.48
  diff -u -r1.1.2.47 -r1.1.2.48
  --- esql.xsl	2001/02/20 05:10:21	1.1.2.47
  +++ esql.xsl	2001/02/22 19:07:57	1.1.2.48
  @@ -1,5 +1,5 @@
   <?xml version="1.0"?>
  -<!-- $Id: esql.xsl,v 1.1.2.47 2001/02/20 05:10:21 balld Exp $-->
  +<!-- $Id: esql.xsl,v 1.1.2.48 2001/02/22 19:07:57 bloritsch Exp $-->
   <!--
   
    ============================================================================
  @@ -174,6 +174,9 @@
         <xsp:include>java.text.DecimalFormat</xsp:include>
         <xsp:include>java.io.StringWriter</xsp:include>
         <xsp:include>java.io.PrintWriter</xsp:include>
  +      <xsl:if test="$environment = 'cocoon2'">
  +          <xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
  +      </xsl:if>
         <xsl:if test=".//esql:connection/esql:pool">
           <xsl:choose>
             <xsl:when test="$environment = 'cocoon1'">
  @@ -182,7 +185,6 @@
             </xsl:when>
             <xsl:when test="$environment = 'cocoon2'">
               <xsp:include>org.apache.avalon.util.datasource.DataSourceComponent</xsp:include>
  -            <xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
             </xsl:when>
           </xsl:choose>
         </xsl:if>
  @@ -305,10 +307,10 @@
             try {
               _esql_connection.dburl = String.valueOf(<xsl:copy-of select="$dburl"/>);
               <xsl:if test="esql:username">
  -              _esql_connection.info.put("user", String.valueOf(<xsl:copy-of select="$username"/>)); 
  +              _esql_connection.info.put("user", String.valueOf(<xsl:copy-of select="$username"/>));
               </xsl:if>
               <xsl:if test="esql:password">
  -              _esql_connection.info.put("password", String.valueOf(<xsl:copy-of select="$password"/>)); 
  +              _esql_connection.info.put("password", String.valueOf(<xsl:copy-of select="$password"/>));
               </xsl:if>
               <xsl:for-each select="esql:property">
                 _esql_connection.info.put("<xsl:value-of select="@name"/>",<xsl:call-template name="get-nested-string"><xsl:with-param name="content" select="."/></xsl:call-template>);
  @@ -745,11 +747,26 @@
       </xsl:when>
       <xsl:when test="$environment = 'cocoon2'">
         <xsp:logic>
  -        try {
  -          XSPUtil.include(new InputSource(new StringReader(<xsl:copy-of select="$content"/>)),this.contentHandler,parser);
  -        } catch (Exception _esql_exception_<xsl:value-of select="generate-id(.)"/>) {
  -          throw new RuntimeException("error parsing xml: "+_esql_exception_<xsl:value-of select="generate-id(.)"/>.getMessage()+": "+String.valueOf(<xsl:copy-of select="$content"/>));
  -        }
  +      {
  +          org.apache.cocoon.components.parser.Parser newParser = null;
  +
  +          try {
  +              newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(Roles.PARSER);
  +
  +              InputSource __is = new InputSource(
  +                      new StringReader(
  +                          String.valueOf(<xsl:copy-of select="$content"/>)
  +                      )
  +                  );
  +
  +
  +              XSPUtil.include(__is, this.contentHandler, newParser);
  +          } catch (Exception e) {
  +              getLogger().error("Could not include page", e);
  +          } finally {
  +              if (newParser != null) this.manager.release((Component) newParser);
  +          }
  +      }
         </xsp:logic>
       </xsl:when>
       <xsl:otherwise>
  
  
  
  1.1.2.4   +55 -38    xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/util.xsl
  
  Index: util.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/util.xsl,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- util.xsl	2001/02/12 13:30:44	1.1.2.3
  +++ util.xsl	2001/02/22 19:07:59	1.1.2.4
  @@ -131,16 +131,21 @@
   
       <xsp:logic> {
         String __name = String.valueOf(<xsl:copy-of select="$href"/>);
  +      {
  +          org.apache.cocoon.components.parser.Parser newParser = null;
   
  -      try {
  -          URL __url = ((org.apache.cocoon.components.url.URLFactory)manager.lookup(org.apache.cocoon.Roles.URL_FACTORY)).getURL(__name);
  -          InputSource __is = new InputSource(__url.openStream());
  -          __is.setSystemId(__url.toString());
  -          org.apache.cocoon.components.parser.Parser newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(Roles.PARSER);
  -
  -          XSPUtil.include(__is, this.contentHandler, newParser);
  -      } catch (Exception e) {
  -          this.cocoonLogger.error("Could not include page", e);
  +          try {
  +              newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(Roles.PARSER);
  +              URL __url = ((org.apache.cocoon.components.url.URLFactory)manager.lookup(org.apache.cocoon.Roles.URL_FACTORY)).getURL(__name);
  +              InputSource __is = new InputSource(__url.openStream());
  +              __is.setSystemId(__url.toString());
  +
  +              XSPUtil.include(__is, this.contentHandler, newParser);
  +          } catch (Exception e) {
  +              this.cocoonLogger.error("Could not include page", e);
  +          } finally {
  +              this.manager.release((Component) newParser);
  +          }
         }
       } </xsp:logic>
     </xsl:template>
  @@ -158,23 +163,29 @@
          </xsl:choose>
        </xsl:variable>
        <xsp:logic>
  -      try {
  -          InputSource __is = new InputSource(
  -                  new FileReader(
  -                     XSPUtil.relativeFilename(
  -                       <xsl:copy-of select="$name"/>,
  -                       this.request,
  -                       this.context
  -                     )
  -                  )
  -              );
  -
  -          org.apache.cocoon.components.parser.Parser newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(Roles.PARSER);
  -
  -          XSPUtil.include(__is, this.contentHandler, newParser);
  -      } catch (Exception e) {
  -          this.cocoonLogger.error("Could not include page", e);
  -      }
  +       {
  +          org.apache.cocoon.components.parser.Parser newParser = null;
  +
  +          try {
  +              newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(Roles.PARSER);
  +              InputSource __is = new InputSource(
  +                      new FileReader(
  +                         XSPUtil.relativeFilename(
  +                           <xsl:copy-of select="$name"/>,
  +                           this.request,
  +                           this.context
  +                         )
  +                      )
  +                  );
  +
  +
  +              XSPUtil.include(__is, this.contentHandler, newParser);
  +            } catch (Exception e) {
  +              this.cocoonLogger.error("Could not include page", e);
  +            } finally {
  +              this.manager.release((Component) newParser);
  +            }
  +       }
        </xsp:logic>
      </xsl:template>
   
  @@ -190,18 +201,24 @@
       </xsl:variable>
   
       <xsp:logic>
  -      try {
  -          InputSource __is = new InputSource(
  -                  new StringReader(
  -                      String.valueOf(<xsl:copy-of select="$expr"/>)
  -                  )
  -              );
  -
  -          org.apache.cocoon.components.parser.Parser newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(Roles.PARSER);
  -
  -          XSPUtil.include(__is, this.contentHandler, newParser);
  -      } catch (Exception e) {
  -          this.cocoonLogger.error("Could not include page", e);
  +      {
  +          org.apache.cocoon.components.parser.Parser newParser = null;
  +
  +          try {
  +              newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(Roles.PARSER);
  +              InputSource __is = new InputSource(
  +                      new StringReader(
  +                          String.valueOf(<xsl:copy-of select="$expr"/>)
  +                      )
  +                  );
  +
  +
  +              XSPUtil.include(__is, this.contentHandler, newParser);
  +          } catch (Exception e) {
  +              this.cocoonLogger.error("Could not include page", e);
  +          } finally {
  +              this.manager.release((Component) newParser);
  +          }
         }
       </xsp:logic>
     </xsl:template>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.21  +4 -7      xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java
  
  Index: FileGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java,v
  retrieving revision 1.1.2.20
  retrieving revision 1.1.2.21
  diff -u -r1.1.2.20 -r1.1.2.21
  --- FileGenerator.java	2001/02/22 17:10:31	1.1.2.20
  +++ FileGenerator.java	2001/02/22 19:08:02	1.1.2.21
  @@ -32,6 +32,7 @@
   import org.apache.avalon.ConfigurationException;
   import org.apache.avalon.Parameters;
   import org.apache.avalon.Poolable;
  +import org.apache.avalon.Component;
   
   /**
    *
  @@ -58,7 +59,7 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/02/22 17:10:31 $
  + * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/02/22 19:08:02 $
    */
   public class FileGenerator extends ComposerGenerator implements Poolable, Configurable {
   
  @@ -139,6 +140,7 @@
   
               if(cxml == null)
               {
  +                Parser parser = (Parser)this.manager.lookup(Roles.PARSER);
                   // use the xmlcompiler for local files if storing is on
                   if (this.useStore == true && systemID.startsWith("file:") == true)
                   {
  @@ -148,9 +150,6 @@
                       XMLMulticaster multicaster = new XMLMulticaster(compiler, null,
                                 this.contentHandler, this.lexicalHandler);
   
  -                    getLogger().debug("Looking up " + Roles.PARSER);
  -                    Parser parser=(Parser)this.manager.lookup(Roles.PARSER);
  -
                       parser.setContentHandler(multicaster);
                       parser.setLexicalHandler(multicaster);
                       parser.parse(src);
  @@ -161,13 +160,11 @@
                       cxmlAndTime[1] = new Long(System.currentTimeMillis());
                       store.hold(systemID, cxmlAndTime);
                   } else {
  -                    getLogger().debug("Looking up " + Roles.PARSER);
  -                    Parser parser=(Parser)this.manager.lookup(Roles.PARSER);
  -
                       parser.setContentHandler(this.contentHandler);
                       parser.setLexicalHandler(this.lexicalHandler);
                       parser.parse(src);
                   }
  +                this.manager.release((Component) parser);
               } else {
                   // use the stored cxml
                   ByteArrayInputStream bais = new ByteArrayInputStream(cxml);
  
  
  
  1.1.2.13  +4 -2      xml-cocoon/src/org/apache/cocoon/generation/Attic/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/HTMLGenerator.java,v
  retrieving revision 1.1.2.12
  retrieving revision 1.1.2.13
  diff -u -r1.1.2.12 -r1.1.2.13
  --- HTMLGenerator.java	2001/02/22 17:10:33	1.1.2.12
  +++ HTMLGenerator.java	2001/02/22 19:08:04	1.1.2.13
  @@ -29,7 +29,7 @@
   
   /**
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/22 17:10:33 $
  + * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/02/22 19:08:04 $
    */
   public class HTMLGenerator extends ComposerGenerator implements Poolable {
   
  @@ -46,7 +46,9 @@
               tidy.setXHTML(true);
   
               // Extract the document using JTidy and stream it.
  -            URL url = ((URLFactory)manager.lookup(Roles.URL_FACTORY)).getURL(this.source);
  +            Component urlFactory = this.manager.lookup(Roles.URL_FACTORY);
  +            URL url = ((URLFactory) urlFactory).getURL(this.source);
  +            this.manager.release(urlFactory);
               org.w3c.dom.Document doc = tidy.parseDOM(new BufferedInputStream(url.openStream()), null);
               DOMStreamer streamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
               streamer.stream(doc);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.18  +7 -2      xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java
  
  Index: ResourceReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
  retrieving revision 1.1.2.17
  retrieving revision 1.1.2.18
  diff -u -r1.1.2.17 -r1.1.2.18
  --- ResourceReader.java	2001/02/20 20:34:18	1.1.2.17
  +++ ResourceReader.java	2001/02/22 19:08:07	1.1.2.18
  @@ -30,13 +30,14 @@
   
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.Composer;
  +import org.apache.avalon.Component;
   
   import org.xml.sax.SAXException;
   
   /**
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/02/20 20:34:18 $
  + * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/02/22 19:08:07 $
    *
    * The <code>ResourceReader</code> component is used to serve binary data
    * in a sitemap pipeline. It makes use of HTTP Headers to determine if
  @@ -69,16 +70,18 @@
           URLFactory urlFactory = null;
   
           try {
  -            urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
  +            urlFactory = (URLFactory) this.manager.lookup(Roles.URL_FACTORY);
           } catch (Exception e) {
               getLogger().error("cannot obtain the URLFactory", e);
               throw new ProcessingException ("cannot obtain the URLFactory");
           }
   
           if (res == null) {
  +           this.manager.release((Component) urlFactory);
              throw new ProcessingException ("Missing a Response object in the objectModel");
           }
           if (req == null) {
  +           this.manager.release((Component) urlFactory);
              throw new ProcessingException ("Missing a Request object in the objectModel");
           }
           String src = null;
  @@ -115,6 +118,8 @@
               getLogger().error("ResourceReader: malformed source \"" + source + "\"", mue);
               throw new ResourceNotFoundException ("ResourceReader: malformed source \""
                   +src+"\". ", mue);
  +        } finally {
  +            this.manager.release((Component) urlFactory);
           }
           byte[] buffer = new byte[(int)len];
           is.read(buffer);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.18  +9 -5      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.17
  retrieving revision 1.1.2.18
  diff -u -r1.1.2.17 -r1.1.2.18
  --- Handler.java	2001/02/19 21:57:50	1.1.2.17
  +++ Handler.java	2001/02/22 19:08:10	1.1.2.18
  @@ -21,6 +21,7 @@
   import org.apache.cocoon.Processor;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.language.generator.ProgramGenerator;
  +import org.apache.cocoon.components.language.generator.CompiledComponent;
   import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.Roles;
  @@ -31,7 +32,7 @@
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.Contextualizable;
   import org.apache.avalon.Context;
  -
  +import org.apache.avalon.Component;
   import org.apache.avalon.AbstractLoggable;
   import org.apache.avalon.Loggable;
   
  @@ -40,7 +41,7 @@
    *
    * @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.17 $ $Date: 2001/02/19 21:57:50 $
  + * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/02/22 19:08:10 $
    */
   public class Handler extends AbstractLoggable implements Runnable, Configurable, Composer, Contextualizable, Processor {
       private Context context;
  @@ -171,10 +172,11 @@
           try {
               ProgramGenerator programGenerator = (ProgramGenerator) this.manager.lookup(Roles.PROGRAM_GENERATOR);
               smap = (Sitemap) programGenerator.load(this.sourceFile, markupLanguage, programmingLanguage, environment);
  -            smap.contextualize(this.context);
  -            smap.compose(this.manager);
  -            smap.configure(this.conf);
   
  +            if (this.sitemap != null) {
  +               programGenerator.release((CompiledComponent) this.sitemap);
  +            }
  +
               this.sitemap = smap;
               getLogger().debug("Sitemap regeneration complete");
   
  @@ -183,6 +185,8 @@
               } else {
                   getLogger().debug("No errors, but the sitemap has not been set.");
               }
  +
  +            this.manager.release((Component) programGenerator);
           } catch (Throwable t) {
               getLogger().error("Error compiling sitemap", t);
   
  
  
  
  1.1.2.23  +69 -52    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.22
  retrieving revision 1.1.2.23
  diff -u -r1.1.2.22 -r1.1.2.23
  --- ResourcePipeline.java	2001/02/22 17:10:52	1.1.2.22
  +++ ResourcePipeline.java	2001/02/22 19:08:12	1.1.2.23
  @@ -35,7 +35,7 @@
   
   /**
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/02/22 17:10:52 $
  + * @version CVS $Revision: 1.1.2.23 $ $Date: 2001/02/22 19:08:12 $
    */
   public class ResourcePipeline implements Composer {
       private Generator generator;
  @@ -130,69 +130,86 @@
   
           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);
  +                try {
  +                    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();
  +                } catch (Exception e) {
  +                    throw new ProcessingException("There was an error with the reader", e);
  +                } finally {
  +                    ((ComponentSelector) this.manager.lookup(Roles.READERS)).release((Component) reader);
                   }
  -                reader.setOutputStream (environment.getOutputStream());
  -                reader.generate();
  -
  -                ((ComponentSelector) this.manager.lookup(Roles.READERS)).release((Component) reader);
               } else {
                   throw new ProcessingException ("Generator or Reader not specified");
               }
           } else {
  -            if (this.serializer == null) {
  -                throw new ProcessingException ("Serializer not specified");
  -            }
  +            Transformer myTransformer[] = (Transformer []) transformers.toArray(new Transformer[] {});
   
  -            if (generatorException != null) {
  -                ((ErrorNotifier)this.generator).setException (generatorException);
  -            }
  +            try {
  +                if (this.serializer == null) {
  +                    if (this.generator != null) {
  +                        ((ComponentSelector) this.manager.lookup(Roles.GENERATORS)).release((Component) generator);
  +                    }
  +
  +                    if (this.transformers.isEmpty() == false) {
  +                        for (int i = 0; i < myTransformer.length; i++) {
  +                            ((ComponentSelector) this.manager.lookup(Roles.TRANSFORMERS)).release((Component) myTransformer[i]);
  +                        }
  +                    }
  +                    throw new ProcessingException ("Serializer not specified");
  +                }
   
  -            Transformer myTransformer[] = (Transformer []) transformers.toArray(new Transformer[] {});
  +                if (generatorException != null) {
  +                    ((ErrorNotifier)this.generator).setException (generatorException);
  +                }
   
  -            this.generator.setup ((EntityResolver) environment, environment.getObjectModel(), generatorSource, generatorParam);
  -            Transformer transformer = null;
  -            XMLProducer producer = this.generator;
  -            for (int i = 0; i < myTransformer.length; i++) {
  -                myTransformer[i].setup ((EntityResolver) environment, environment.getObjectModel(),
  -                        (String)transformerSources.get (i),
  -                        (Parameters)transformerParams.get (i));
  -                producer.setConsumer (myTransformer[i]);
  -                producer = myTransformer[i];
  -            }
  +                this.generator.setup ((EntityResolver) environment, environment.getObjectModel(), generatorSource, generatorParam);
  +                Transformer transformer = null;
  +                XMLProducer producer = this.generator;
  +                for (int i = 0; i < myTransformer.length; i++) {
  +                    myTransformer[i].setup ((EntityResolver) environment, environment.getObjectModel(),
  +                            (String)transformerSources.get (i),
  +                            (Parameters)transformerParams.get (i));
  +                    producer.setConsumer (myTransformer[i]);
  +                    producer = myTransformer[i];
  +                }
   
  -            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();
  +                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();
  +            } catch (Exception e) {
  +                throw new ProcessingException("Error generating the resource");
  +            } finally {
  +                ((ComponentSelector) this.manager.lookup(Roles.GENERATORS)).release((Component) generator);
   
  -            ((ComponentSelector) this.manager.lookup(Roles.GENERATORS)).release((Component) generator);
  +                for (int i = 0; i < myTransformer.length; i++) {
  +                    ((ComponentSelector) this.manager.lookup(Roles.TRANSFORMERS)).release((Component) myTransformer[i]);
  +                }
   
  -            for (int i = 0; i < myTransformer.length; i++) {
  -                ((ComponentSelector) this.manager.lookup(Roles.TRANSFORMERS)).release((Component) myTransformer[i]);
  +                ((ComponentSelector) this.manager.lookup(Roles.SERIALIZERS)).release((Component) serializer);
               }
  -
  -            ((ComponentSelector) this.manager.lookup(Roles.SERIALIZERS)).release((Component) serializer);
           }
           return true;
       }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +68 -67    xml-cocoon/src/org/apache/cocoon/transformation/Attic/AbstractDOMTransformer.java
  
  Index: AbstractDOMTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/AbstractDOMTransformer.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- AbstractDOMTransformer.java	2001/01/12 15:31:31	1.1.2.5
  +++ AbstractDOMTransformer.java	2001/02/22 19:08:16	1.1.2.6
  @@ -18,6 +18,7 @@
   import org.apache.avalon.Composer;
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.Parameters;
  +import org.apache.avalon.Recyclable;
   
   /**
    * An Abstract DOM Transformer, for use when a transformer needs a DOM-based
  @@ -25,89 +26,89 @@
    * Subclass this interface and implement <code>transform(Document doc)</code>.
    * If you need a ComponentManager there is an instance variable
    * <code>manager</code> for use.
  - * 
  + *
    * @author <A HREF="rossb@apache.org">Ross Burton</A>
    * @author <A HREF="brobertson@mta.ca">Bruce G. Robertson</A>
    * @version CVS $Revision $Date
    */
   public abstract class AbstractDOMTransformer extends DOMBuilder
  -	implements Transformer, DOMBuilder.Listener, Composer {
  +    implements Transformer, DOMBuilder.Listener, Composer {
   
  -	/** The SAX entity resolver */
  -	protected EntityResolver resolver;
  -	/** The request object model */
  -	protected Map objectModel;
  -	/** The URI requested */
  -	protected String source;
  -	/** Parameters in the sitemap */
  -	protected Parameters parameters;
  -
  -	/**
  -	 * A <code>ComponentManager</code> which is available for use.
  -	 */
  -	protected ComponentManager manager;
  -
  -	public AbstractDOMTransformer() {
  -		// Set the factory later, when we have a Component Manager to get a
  -		// Parser from
  -		super();
  -		super.listener = this;
  -	}
  -
  -	/**
  -	 * Set the component manager.
  -	 */
  -	public void compose(ComponentManager manager) {
  -		this.manager = manager;
  -		// Get a parser and use it as a DOM factory
  -		try {
  -		    log.debug("Looking up " + Roles.PARSER);
  -		    Parser p = (Parser)manager.lookup(Roles.PARSER);
  -		    super.factory = (DOMFactory)p;
  -		} catch (Exception e) {
  -		    log.error("Could not find component", e);
  -		}
  -	}
  +    /** The SAX entity resolver */
  +    protected EntityResolver resolver;
  +    /** The request object model */
  +    protected Map objectModel;
  +    /** The URI requested */
  +    protected String source;
  +    /** Parameters in the sitemap */
  +    protected Parameters parameters;
   
       /**
  +     * A <code>ComponentManager</code> which is available for use.
  +     */
  +    protected ComponentManager manager;
  +
  +    public AbstractDOMTransformer() {
  +        // Set the factory later, when we have a Component Manager to get a
  +        // Parser from
  +        super();
  +        super.listener = this;
  +    }
  +
  +    /**
  +     * Set the component manager.
  +     */
  +    public void compose(ComponentManager manager) {
  +        this.manager = manager;
  +        // Get a parser and use it as a DOM factory
  +        try {
  +            log.debug("Looking up " + Roles.PARSER);
  +            Parser p = (Parser)manager.lookup(Roles.PARSER);
  +            super.factory = (DOMFactory)p;
  +        } catch (Exception e) {
  +            log.error("Could not find component", e);
  +        }
  +    }
  +
  +    /**
        * Set the <code>EntityResolver</code>, objectModel <code>Map</code>,
        * the source and sitemap <code>Parameters</code> used to process the request.
  -	 *
  -	 * If you wish to process the parameters, override this method, call
  -	 * <code>super()</code> and then add your code.
  +     *
  +     * If you wish to process the parameters, override this method, call
  +     * <code>super()</code> and then add your code.
        */
       public void setup(EntityResolver resolver, Map objectModel, String src, Parameters par)
  -		throws ProcessingException, SAXException, IOException {
  -		this.resolver = resolver;
  -		this.objectModel = objectModel;
  -		this.source = src;
  -		this.parameters = par;
  -	}
  -
  -	/**
  -	 * This method is called when the Document is finished.
  -	 * @param doc The DOM Document object representing this SAX stream
  -	 * @see org.apache.cocoon.xml.dom.DOMBuilder.Listener
  -	 */
  -	public void notify(Document doc) throws SAXException {
  -		// Call the user's transform method
  -		Document newdoc = transform(doc);
  -		// Now we stream the DOM tree out
  -		DOMStreamer s = new DOMStreamer(contentHandler, lexicalHandler);
  -		s.stream(newdoc);
  -	}
  -
  -	/**
  -	 * Transform the specified DOM, returning a new DOM to stream down the pipeline.
  -	 * @param doc The DOM Document representing the SAX stream
  -	 * @returns A DOM Document to stream down the pipeline
  -	 */
  -	protected abstract Document transform(Document doc) ;
  +        throws ProcessingException, SAXException, IOException {
  +        this.resolver = resolver;
  +        this.objectModel = objectModel;
  +        this.source = src;
  +        this.parameters = par;
  +    }
   
  +    /**
  +     * This method is called when the Document is finished.
  +     * @param doc The DOM Document object representing this SAX stream
  +     * @see org.apache.cocoon.xml.dom.DOMBuilder.Listener
  +     */
  +    public void notify(Document doc) throws SAXException {
  +        // Call the user's transform method
  +        Document newdoc = transform(doc);
  +        // Now we stream the DOM tree out
  +        DOMStreamer s = new DOMStreamer(contentHandler, lexicalHandler);
  +        s.stream(newdoc);
  +    }
   
  +    /**
  +     * Transform the specified DOM, returning a new DOM to stream down the pipeline.
  +     * @param doc The DOM Document representing the SAX stream
  +     * @returns A DOM Document to stream down the pipeline
  +     */
  +    protected abstract Document transform(Document doc) ;
  +
  +
       /** The <code>ContentHandler</code> receiving SAX events. */
       protected ContentHandler contentHandler;
  -    
  +
       /** The <code>LexicalHandler</code> receiving SAX events. */
       protected LexicalHandler lexicalHandler;
   
  
  
  
  1.1.2.4   +32 -35    xml-cocoon/src/org/apache/cocoon/transformation/Attic/FragmentExtractorTransformer.java
  
  Index: FragmentExtractorTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/FragmentExtractorTransformer.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- FragmentExtractorTransformer.java	2001/02/20 14:46:41	1.1.2.3
  +++ FragmentExtractorTransformer.java	2001/02/22 19:08:17	1.1.2.4
  @@ -10,6 +10,7 @@
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.Composer;
   import org.apache.avalon.ComponentManagerException;
  +import org.apache.avalon.Component;
   
   import org.xml.sax.SAXException;
   import org.xml.sax.Attributes;
  @@ -32,39 +33,33 @@
    * <a href="http://c2.com/cgi/wiki?YouArentGonnaNeedIt">you aren't gonna need it</a>,
    * so I've just used very simple extraction based on a URI and local name.
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/02/20 14:46:41 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/02/22 19:08:17 $
    */
   public class FragmentExtractorTransformer extends AbstractTransformer implements Composer {
       private static String EXTRACT_URI="http://www.w3.org/2000/svg";
       private static String EXTRACT_ELEMENT="svg";
  -    
  +
       private static String FE_URI="http://apache.org/cocoon/fragmentextractor";
       private static String XLINK_URI="http://www.w3c.org/1999/xlink";
  -    
  +
       private static String generatorClass = "org.apache.cocoon.generation.FragmentExtractorGenerator";
  -    
  +
       private DOMBuilder currentBuilder;
  -    
  +
       private Map prefixMap;
  -    
  +
       private int extractLevel;
  -    
  +
       private int imageID;
  -    
  +
       protected ComponentManager manager;
  -    
  +
       private DOMFactory documentFactory;
  -    
  +
       public void compose(ComponentManager manager) {
           this.manager = manager;
  -        try {
  -            documentFactory = (DOMFactory) manager.lookup(Roles.PARSER);
  -        } catch ( ComponentManagerException cme ) {
  -            documentFactory = null;
  -            getLogger().error("FragmentExtractorTransformer could not lookup parser.");
  -        }
       }
  -    
  +
       /** Setup the transformer.
        */
       public void setup(EntityResolver resolver, Map objectModel, String src, Parameters par)
  @@ -72,21 +67,21 @@
           extractLevel = 0;
           imageID = 0;
           prefixMap = new HashMap();
  -        
  -        if ( documentFactory == null ) {
  -            throw new ProcessingException(
  -                "FragmentExtractorTransformer has no document factory. "
  -                + "This is likely to be because a parser could not be "
  -                + "Retrived."
  -            );
  -        }
       }
  -     
  +
       /**
        * Receive notification of the beginning of a document.
        */
       public void startDocument()
       throws SAXException {
  +        try {
  +            documentFactory = (DOMFactory) manager.lookup(Roles.PARSER);
  +        } catch ( ComponentManagerException cme ) {
  +            documentFactory = null;
  +            getLogger().error("FragmentExtractorTransformer could not lookup parser.");
  +            throw new SAXException("Could not get documentFactory", cme);
  +        }
  +
           super.startDocument();
       }
   
  @@ -96,6 +91,9 @@
       public void endDocument()
       throws SAXException {
           super.endDocument();
  +
  +        this.manager.release((Component) this.documentFactory);
  +        this.documentFactory = null;
       }
   
       /**
  @@ -149,7 +147,6 @@
               imageID++;
               getLogger().debug("FragmentExtractorTransformer extractLevel now " + extractLevel + ".");
   
  -            
               // Start the DOM document
               this.currentBuilder = new DOMBuilder(documentFactory);
               this.currentBuilder.startDocument();
  @@ -162,7 +159,7 @@
                   );
               }
           }
  -        
  +
           if ( extractLevel == 0 ) {
               super.startElement(uri,loc,raw,a);
           } else {
  @@ -191,7 +188,7 @@
               if ( uri.equals(this.EXTRACT_URI) && loc.equals(this.EXTRACT_ELEMENT) ) {
                   extractLevel--;
                   getLogger().debug("FragmentExtractorTransformer extractLevel now " + extractLevel + ".");
  -                
  +
                   if ( extractLevel == 0 ) {
                       // finish building the DOM. remove existing prefix mappings.
                       Iterator itt = prefixMap.entrySet().iterator();
  @@ -202,11 +199,11 @@
                           );
                       }
                       this.currentBuilder.endDocument();
  -                    
  +
                       Document doc = this.currentBuilder.getDocument();
                       String id = FragmentExtractorGenerator.store(doc);
  -					getLogger().debug("FragmentExtractorTransformer stored document " + id + ".");
  -                    
  +                    getLogger().debug("FragmentExtractorTransformer stored document " + id + ".");
  +
                       // Insert ref.
                       super.startPrefixMapping("fe",FE_URI);
                       AttributesImpl atts = new AttributesImpl();
  @@ -278,7 +275,7 @@
           if ( extractLevel == 0 ) {
               super.skippedEntity(name);
           } else {
  -            this.currentBuilder.skippedEntity(name);    
  +            this.currentBuilder.skippedEntity(name);
           }
       }
   
  @@ -298,7 +295,7 @@
           } else {
               throw new SAXException(
                   "Recieved startDTD after beginning SVG extraction process."
  -            );  
  +            );
           }
       }
   
  @@ -384,7 +381,7 @@
               this.currentBuilder.comment(ch,start,len);
           }
       }
  -    
  +
       public void processDocument(Document doc) {
           getLogger().debug("FragmentExtractorTransformer recieved document.");
       }
  
  
  
  1.1.2.9   +5 -1      xml-cocoon/src/org/apache/cocoon/transformation/Attic/I18nTransformer.java
  
  Index: I18nTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/I18nTransformer.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- I18nTransformer.java	2001/02/22 17:10:54	1.1.2.8
  +++ I18nTransformer.java	2001/02/22 19:08:18	1.1.2.9
  @@ -18,6 +18,7 @@
   import org.apache.avalon.Poolable;
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.Composer;
  +import org.apache.avalon.Component;
   import org.apache.avalon.Parameters;
   import org.apache.avalon.Loggable;
   
  @@ -145,8 +146,10 @@
   
           URL tr = null;
           try {
  -            tr = ((URLFactory)manager.lookup(Roles.URL_FACTORY))
  +            Component urlFactory = this.manager.lookup(Roles.URL_FACTORY);
  +            tr = ((URLFactory) urlFactory)
                   .getURL(resolver.resolveEntity(null, translations_file).getSystemId());
  +            this.manager.release(urlFactory);
           } catch (Exception e) {
               getLogger().error("cannot obtain the URLFactory", e);
               throw new SAXException("cannot obtain the URLFactory", e);
  @@ -328,5 +331,6 @@
           parser.setContentHandler(i18n_handler);
           parser.parse(input);
   
  +        this.manager.release((Component) parser);
       }
   }
  
  
  
  1.1.2.20  +4 -1      xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java
  
  Index: XIncludeTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java,v
  retrieving revision 1.1.2.19
  retrieving revision 1.1.2.20
  diff -u -r1.1.2.19 -r1.1.2.20
  --- XIncludeTransformer.java	2001/02/22 17:10:56	1.1.2.19
  +++ XIncludeTransformer.java	2001/02/22 19:08:19	1.1.2.20
  @@ -31,6 +31,7 @@
   import org.apache.avalon.Loggable;
   import org.apache.avalon.AbstractLoggable;
   import org.apache.avalon.Poolable;
  +import org.apache.avalon.Component;
   import org.apache.cocoon.Roles;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.parser.Parser;
  @@ -48,7 +49,7 @@
    * by the SAX event FSM yet.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
  - * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/02/22 17:10:56 $ $Author: bloritsch $
  + * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/02/22 19:08:19 $ $Author: bloritsch $
    */
   public class XIncludeTransformer extends AbstractTransformer implements Composer, Poolable {
   
  @@ -265,6 +266,8 @@
                   parser.setLexicalHandler(xinclude_handler);
                   parser.parse(input);
               }
  +
  +            this.manager.release((Component) parser);
           }
       }
   
  
  
  
  1.1.2.14  +4 -2      xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java
  
  Index: XTTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- XTTransformer.java	2001/02/22 17:10:57	1.1.2.13
  +++ XTTransformer.java	2001/02/22 19:08:20	1.1.2.14
  @@ -71,7 +71,7 @@
    * This Transformer use the XT processor.
    *
    * @author <a href="mailto:ssahuc@imediation.com">Sahuc Sebastien</a>
  - * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/02/22 17:10:57 $
  + * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/02/22 19:08:20 $
    */
   public class XTTransformer extends DocumentHandlerWrapper
   implements Transformer, Composer, Loggable, Poolable {
  @@ -344,7 +344,9 @@
           // Set the xslFile for the caching mechanism
           URL url = null;
           try {
  -            url = ((URLFactory)this.manager.lookup(Roles.URL_FACTORY)).getURL(sheetSource.getSystemId());
  +            Component urlFactory = this.manager.lookup(Roles.URL_FACTORY);
  +            url = ((URLFactory) urlFactory).getURL(sheetSource.getSystemId());
  +            this.manager.release(urlFactory);
           } catch (Exception e) {
               log.error("cannot obtain the URLFactory", e);
               throw new SAXException ("cannot obtain the URLFactory", e);
  
  
  

Mime
View raw message