cziegeler    01/09/06 07:04:31

  Modified:    src/org/apache/cocoon/components/source Tag:
                        cocoon_20_branch SitemapSource.java URLSource.java
               src/org/apache/cocoon/components/xslt Tag: cocoon_20_branch
                        XSLTProcessorImpl.java
  Log:
  Added automatic refreshing of Source objects according to Berins proposal
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.18  +9 -1      
xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/SitemapSource.java,v
  retrieving revision 1.1.2.17
  retrieving revision 1.1.2.18
  diff -u -r1.1.2.17 -r1.1.2.18
  --- SitemapSource.java        2001/09/06 11:11:09     1.1.2.17
  +++ SitemapSource.java        2001/09/06 14:04:30     1.1.2.18
  @@ -48,7 +48,7 @@
    * Description of a source which is defined by a pipeline.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/09/06 11:11:09 $
  + * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/09/06 14:04:30 $
    */
   
   public final class SitemapSource
  @@ -88,6 +88,9 @@
       /** The <code>SAXException</code> if unable to get resource */
       private SAXException exception;
   
  +    /** Do I need a refresh ? */
  +    private boolean needsRefresh;
  +
       /**
        * Construct a new object
        */
  @@ -152,6 +155,7 @@
        * is not possible to determine the date.
        */
       public long getLastModified() {
  +        if (this.needsRefresh == true) this.refresh();
           return this.lastModificationDate;
       }
   
  @@ -172,6 +176,7 @@
           if (this.exception != null) {
               throw new ProcessingException(this.exception);
           }
  +        if (this.needsRefresh == true) this.refresh();
           SitemapComponentSelector serializerSelector = null;
           Serializer serializer = null;
           try {
  @@ -248,6 +253,7 @@
               this.exception = new SAXException("Could not get sitemap source "
                                                 + this.systemId, e);
           }
  +        this.needsRefresh = false;
       }
   
       /**
  @@ -268,6 +274,7 @@
           if (this.exception != null) {
               throw this.exception;
           }
  +        if (this.needsRefresh == true) this.refresh();
           try {
               XMLConsumer consumer;
               if (contentHandler instanceof XMLConsumer) {
  @@ -303,6 +310,7 @@
           if (this.redirectSource != null) this.redirectSource.recycle();
           this.redirectSource = null;
           this.exception = null;
  +        this.needsRefresh = true;
       }
   
       public void recycle() {
  
  
  
  1.1.2.11  +8 -3      
xml-cocoon2/src/org/apache/cocoon/components/source/URLSource.java
  
  Index: URLSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/URLSource.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- URLSource.java    2001/09/06 11:11:09     1.1.2.10
  +++ URLSource.java    2001/09/06 14:04:30     1.1.2.11
  @@ -31,7 +31,7 @@
    * Description of a source which is described by an URL.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/09/06 11:11:09 $
  + * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/09/06 14:04:30 $
    */
   
   public final class URLSource implements ModifiableSource {
  @@ -128,8 +128,10 @@
        */
       public InputStream getInputStream()
       throws IOException {
  +        this.getInfos();
  +        InputStream input = null;
           if (this.isFile == true) {
  -            return new FileInputStream(this.systemId.substring(FILE.length()));
  +            input = new FileInputStream(this.systemId.substring(FILE.length()));
           } else {
               if (this.connection == null) {
                   this.connection = this.url.openConnection();
  @@ -139,8 +141,11 @@
                       this.connection.setRequestProperty("Authorization","Basic 
"+encodeBASE64(userInfo));
                   }
               }
  -            return this.connection.getInputStream();
  +
  +            input = this.connection.getInputStream();
  +            this.connection = null; // make sure a new connection is created next 
time
           }
  +        return input;
       }
   
       private static boolean checkedURLClass = false;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.2   +1 -4      
xml-cocoon2/src/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java
  
  Index: XSLTProcessorImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/xslt/XSLTProcessorImpl.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  --- XSLTProcessorImpl.java    2001/09/05 22:18:13     1.4.2.1
  +++ XSLTProcessorImpl.java    2001/09/06 14:04:30     1.4.2.2
  @@ -271,10 +271,7 @@
           store.remove(is.getSystemId());
         }
       }
  -    if (stylesheet instanceof ModifiableSource) {
  -        ((ModifiableSource)stylesheet).refresh();
  -    }
  -    return templates;
  +   return templates;
     }
   
     private void putTemplates (Templates templates, Source stylesheet)
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to