You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/10/15 22:15:29 UTC

cvs commit: cocoon-2.2/src/java/org/apache/cocoon/components/source/impl SitemapSource.java

cziegeler    2003/10/15 13:15:29

  Modified:    src/java/org/apache/cocoon/components/source/impl
                        SitemapSource.java
  Log:
  Remove hacky cast from environment to SourceResolver
  
  Revision  Changes    Path
  1.13      +15 -3     cocoon-2.2/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SitemapSource.java	8 Oct 2003 20:18:34 -0000	1.12
  +++ SitemapSource.java	15 Oct 2003 20:15:29 -0000	1.13
  @@ -77,6 +77,7 @@
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
   import org.apache.excalibur.source.SourceNotFoundException;
  +import org.apache.excalibur.source.SourceResolver;
   import org.apache.excalibur.source.SourceValidity;
   import org.apache.excalibur.xml.sax.XMLizable;
   import org.xml.sax.ContentHandler;
  @@ -142,6 +143,9 @@
       /** The used protocol */
       private String protocol;
   
  +    /** SourceResolver (for the redirect source) */
  +    private SourceResolver sourceResolver;
  +    
       /**
        * Construct a new object
        */
  @@ -413,7 +417,10 @@
                   if (redirectURL.indexOf(":") == -1) {
                       redirectURL = this.protocol + ":/" + redirectURL;
                   }
  -                this.redirectSource = this.environment.resolveURI(redirectURL);
  +                if ( this.sourceResolver == null ) {
  +                    this.sourceResolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
  +                }
  +                this.redirectSource = this.sourceResolver.resolveURI(redirectURL);
                   this.redirectValidity = this.redirectSource.getValidity();
               }
           } catch (SAXException e) {
  @@ -485,7 +492,9 @@
           }
           this.processingPipeline = null;
           this.sourceValidity = null;
  -        if (this.redirectSource != null) this.environment.release(this.redirectSource);
  +        if (this.redirectSource != null) {
  +            this.sourceResolver.release(this.redirectSource);
  +        }
           this.environment.reset();
           this.redirectSource = null;
           this.redirectValidity = null;
  @@ -499,6 +508,9 @@
        */
       public void recycle() {
           this.reset();
  +        if ( this.sourceResolver != null ) {
  +            this.manager.release( this.sourceResolver );
  +        }
       }
   
       /**