cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/source AbstractStreamSource.java FileSourceFactory.java SourceHandlerImpl.java
Date Thu, 14 Mar 2002 12:55:10 GMT
sylvain     02/03/14 04:55:10

  Modified:    src/java/org/apache/cocoon/components/source
                        AbstractStreamSource.java FileSourceFactory.java
                        SourceHandlerImpl.java
  Log:
  Make StreamSource extend AbstractLoggable
  
  Revision  Changes    Path
  1.2       +18 -2     xml-cocoon2/src/java/org/apache/cocoon/components/source/AbstractStreamSource.java
  
  Index: AbstractStreamSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/AbstractStreamSource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractStreamSource.java	22 Feb 2002 23:25:18 -0000	1.1
  +++ AbstractStreamSource.java	14 Mar 2002 12:55:10 -0000	1.2
  @@ -58,6 +58,7 @@
   import org.apache.avalon.excalibur.xml.Parser;
   import org.apache.avalon.excalibur.source.SourceParameters;
   import org.apache.avalon.excalibur.source.SourceUtil;
  +import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.environment.ModifiableSource;
  @@ -99,10 +100,11 @@
    *
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version $Id: AbstractStreamSource.java,v 1.1 2002/02/22 23:25:18 sylvain Exp $
  + * @version $Id: AbstractStreamSource.java,v 1.2 2002/03/14 12:55:10 sylvain Exp $
    */
   
  -public abstract class AbstractStreamSource implements ModifiableSource {
  +public abstract class AbstractStreamSource extends AbstractLoggable
  +    implements ModifiableSource {
   // FIXME(SW) : this implements *Modifiable*Source just to call refresh()
   //             if JTidy fails. Can we avoid this ?
   
  @@ -227,6 +229,20 @@
        */
       public long getLastModified() {
         return 0;
  +    }
  +    
  +    /**
  +     * Returns <code>true</code> if <code>getInputStream()</code>
succeeds.
  +     * Subclasses can provide a more efficient implementation.
  +     */
  +    public boolean exists() {
  +        try {
  +            InputStream stream = getInputStream();
  +            stream.close();
  +            return true;
  +        } catch(Exception e) {
  +            return false;
  +        }
       }
       
       /**
  
  
  
  1.2       +7 -3      xml-cocoon2/src/java/org/apache/cocoon/components/source/FileSourceFactory.java
  
  Index: FileSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/FileSourceFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileSourceFactory.java	22 Feb 2002 23:25:18 -0000	1.1
  +++ FileSourceFactory.java	14 Mar 2002 12:55:10 -0000	1.2
  @@ -58,6 +58,7 @@
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
  +import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.avalon.framework.thread.ThreadSafe;
   
   import org.apache.cocoon.components.source.SourceFactory;
  @@ -73,10 +74,11 @@
    * A factory for 'file:' sources.
    *
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  - * @version $Id: FileSourceFactory.java,v 1.1 2002/02/22 23:25:18 sylvain Exp $
  + * @version $Id: FileSourceFactory.java,v 1.2 2002/03/14 12:55:10 sylvain Exp $
    */
   
  -public class FileSourceFactory implements SourceFactory, Composable, ThreadSafe {
  +public class FileSourceFactory extends AbstractLoggable
  +    implements SourceFactory, Composable, ThreadSafe {
       
       private ComponentManager manager;
   
  @@ -86,7 +88,9 @@
       
       public Source getSource(Environment environment, String location)
         throws ProcessingException, MalformedURLException, IOException {
  -        return new FileSource(location, this.manager);
  +        Source result = new FileSource(location, this.manager);
  +        setupLogger(result);
  +        return result;
       }
   
       public Source getSource(Environment environment, URL base, String location)
  
  
  
  1.7       +4 -2      xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceHandlerImpl.java
  
  Index: SourceHandlerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceHandlerImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SourceHandlerImpl.java	22 Feb 2002 07:00:13 -0000	1.6
  +++ SourceHandlerImpl.java	14 Mar 2002 12:55:10 -0000	1.7
  @@ -79,7 +79,7 @@
   
   /**
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version $Id: SourceHandlerImpl.java,v 1.6 2002/02/22 07:00:13 cziegeler Exp $
  + * @version $Id: SourceHandlerImpl.java,v 1.7 2002/03/14 12:55:10 sylvain Exp $
    */
   public final class SourceHandlerImpl
   extends AbstractLoggable
  @@ -178,7 +178,9 @@
           }
   
           // default implementation
  -        return new URLSource(this.urlFactory.getURL(location), this.manager);
  +        Source result = new URLSource(this.urlFactory.getURL(location), this.manager);
  +        this.setupLogger(result);
  +        return result;
       }
   
       /**
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message