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 2001/10/16 15:45:17 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/components/source SourceHandlerImpl.java

cziegeler    01/10/16 06:45:17

  Modified:    .        changes.xml
               src/org/apache/cocoon/components/source
                        SourceHandlerImpl.java
  Log:
  Added support for configurable source factories. Submitted by Gianugo Rabellino [gianugo@rabellino.it]
  
  Revision  Changes    Path
  1.40      +5 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- changes.xml	2001/10/16 12:26:54	1.39
  +++ changes.xml	2001/10/16 13:45:17	1.40
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: changes.xml,v 1.39 2001/10/16 12:26:54 cziegeler Exp $
  +  $Id: changes.xml,v 1.40 2001/10/16 13:45:17 cziegeler Exp $
   -->
   
   <changes title="History of Changes">
  @@ -26,6 +26,10 @@
    </devs>
   
    <release version="2.1-dev" date="@date@">
  +  <action dev="CZ" type="update">
  +    Added support for configurable SourceFactories.
  +    Patch submitted by Gianugo Rabellino [gianugo@rabellino.it].
  +  </action>
     <action dev="CZ" type="fix">
       Updated session handling of commandline interface and fixed
       parameter handling.
  
  
  
  1.8       +12 -7     xml-cocoon2/src/org/apache/cocoon/components/source/SourceHandlerImpl.java
  
  Index: SourceHandlerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/source/SourceHandlerImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SourceHandlerImpl.java	2001/10/11 07:28:19	1.7
  +++ SourceHandlerImpl.java	2001/10/16 13:45:17	1.8
  @@ -35,7 +35,7 @@
   
   /**
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version $Id: SourceHandlerImpl.java,v 1.7 2001/10/11 07:28:19 cziegeler Exp $
  + * @version $Id: SourceHandlerImpl.java,v 1.8 2001/10/16 13:45:17 cziegeler Exp $
    */
   public final class SourceHandlerImpl
   extends AbstractLoggable
  @@ -72,7 +72,7 @@
   
                   getLogger().debug("\tfor protocol: " + protocol + " " + configs[i].getAttribute("class"));
                   sourceFactory = (SourceFactory) ClassUtils.newInstance(configs[i].getAttribute("class"));
  -                this.init(sourceFactory);
  +                this.init(sourceFactory, configs[i]);
                   this.sourceFactories.put(protocol, sourceFactory);
               }
           } catch (ConfigurationException e) {
  @@ -163,22 +163,27 @@
               throw new ProcessingException("cannot initialize factory: " + factory, e);
           } catch (ContextException e) {
               throw new ProcessingException("cannot initialize factory: " + factory, e);
  +        } catch (ConfigurationException e) {
  +            throw new ProcessingException("cannot configure factory: " + factory, e);
           }
       }
   
       /**
        * Init a source factory
        */
  -    private void init(SourceFactory factory)
  -    throws ContextException, ComponentException {
  -        if (factory instanceof Contextualizable) {
  -            ((Contextualizable) factory).contextualize (this.context);
  -        }
  +    private void init(SourceFactory factory, Configuration config)
  +    throws ContextException, ComponentException, ConfigurationException {
           if (factory instanceof Loggable) {
               ((Loggable) factory).setLogger(getLogger());
           }
  +        if (factory instanceof Contextualizable) {
  +            ((Contextualizable) factory).contextualize (this.context);
  +        }
           if (factory instanceof Composable) {
               ((Composable) factory).compose(this.manager);
  +        }
  +        if (factory instanceof Configurable) {
  +            ((Configurable) factory).configure(config);
           }
       }
   
  
  
  

----------------------------------------------------------------------
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