cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/util IOUtils.java
Date Wed, 06 Jun 2001 17:13:33 GMT
bloritsch    01/06/06 10:13:32

  Modified:    src/org/apache/cocoon Tag: cocoon_20_branch Cocoon.java
                        cocoon.roles
               src/org/apache/cocoon/components/language/generator Tag:
                        cocoon_20_branch GeneratorSelector.java
                        ProgramGeneratorImpl.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: cocoon_20_branch sitemap.xsl
               src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
                        AbstractSitemap.java Handler.java Manager.java
                        SitemapComponentSelector.java
               src/org/apache/cocoon/util Tag: cocoon_20_branch
                        IOUtils.java
  Added:       lib      Tag: cocoon_20_branch avalon-excalibur-4.0b3.jar
                        avalon-framework-4.0b3.jar logkit-1.0b2.jar
               src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
                        sitemap.roles
  Removed:     lib      Tag: cocoon_20_branch avalon-excalibur-4.0b1.jar
                        avalon-framework-4.0b1.jar logkit-1.0b1.jar
  Log:
  Upgrade to Avalon-4.0beta3  (beta 2 had a serious bug that
  surfaced when I tried to do the port for Cocoon 2).
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +303 -0    xml-cocoon2/lib/Attic/avalon-excalibur-4.0b3.jar
  
  	<<Binary file>>
  
  
  1.1.2.1   +118 -0    xml-cocoon2/lib/Attic/avalon-framework-4.0b3.jar
  
  	<<Binary file>>
  
  
  1.1.2.1   +102 -0    xml-cocoon2/lib/Attic/logkit-1.0b2.jar
  
  	<<Binary file>>
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.1   +69 -33    xml-cocoon2/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- Cocoon.java	2001/06/05 08:05:13	1.9
  +++ Cocoon.java	2001/06/06 17:12:58	1.9.2.1
  @@ -42,9 +42,10 @@
   import org.apache.cocoon.environment.Source;
   import org.apache.cocoon.serialization.Serializer;
   import org.apache.cocoon.sitemap.Manager;
  +import org.apache.cocoon.sitemap.AbstractSitemap;
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.util.NetUtils;
  -import org.apache.avalon.excalibur.component.DefaultComponentManager;
  +import org.apache.avalon.excalibur.component.ExcaliburComponentManager;
   import org.apache.avalon.excalibur.component.DefaultRoleManager;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  @@ -54,7 +55,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.9 $ $Date: 2001/06/05 08:05:13 $
  + * @version CVS $Revision: 1.9.2.1 $ $Date: 2001/06/06 17:12:58 $
    */
   public class Cocoon extends AbstractLoggable implements ThreadSafe, Component, Initializable,
Disposable, Modifiable, Processor, Contextualizable {
       /** The application context */
  @@ -85,7 +86,7 @@
       private boolean reloadSitemapAsynchron = true;
   
       /** The component manager. */
  -    public DefaultComponentManager componentManager;
  +    private ExcaliburComponentManager componentManager;
   
       /** flag for disposed or not */
       private boolean disposed = false;
  @@ -111,7 +112,7 @@
       }
   
       public void initialize() throws Exception {
  -        this.componentManager = new DefaultComponentManager();
  +        this.componentManager = new ExcaliburComponentManager((ClassLoader)this.context.get(Constants.CONTEXT_CLASS_LOADER));
           this.componentManager.setLogger(getLogger());
           this.componentManager.contextualize(this.context);
   
  @@ -120,9 +121,12 @@
           // If one need to use a different parser, set the given system property
           String parser = System.getProperty(Constants.PARSER_PROPERTY, Constants.DEFAULT_PARSER);
           getLogger().debug("Using parser: " + parser);
  +        ExcaliburComponentManager startupManager = new ExcaliburComponentManager((ClassLoader)this.context.get(Constants.CONTEXT_CLASS_LOADER));
  +        startupManager.setLogger(getLogger());
  +        startupManager.contextualize(this.context);
   
           try {
  -            this.componentManager.addComponent(Roles.PARSER, ClassUtils.loadClass(parser),
null);
  +            startupManager.addComponent(Roles.PARSER, ClassUtils.loadClass(parser), null);
           } catch (Exception e) {
               getLogger().error("Could not load parser, Cocoon object not created.", e);
               throw new ConfigurationException("Could not load parser " + parser, e);
  @@ -141,17 +145,44 @@
   
           getLogger().debug("Classpath = " + classpath);
           getLogger().debug("Work directory = " + workDir.getCanonicalPath());
  -        this.configure();
  +        startupManager.initialize();
  +
  +        Configuration conf = this.configure(startupManager);
  +        startupManager.dispose();
  +
  +        this.componentManager.initialize();
  +
  +        getLogger().debug("Setting up the sitemap.");
  +        // Create the sitemap
  +        Configuration sconf = conf.getChild("sitemap");
  +        this.sitemapManager = new Manager();
  +        this.sitemapManager.setLogger(getLogger());
  +        this.sitemapManager.contextualize(this.context);
  +        this.sitemapManager.compose(this.componentManager);
  +        this.sitemapManager.configure(conf);
  +        this.sitemapFileName = sconf.getAttribute("file");
  +        if (this.sitemapFileName == null) {
  +            getLogger().error("No sitemap file name");
  +            throw new ConfigurationException("No sitemap file name\n" + conf.toString());
  +        }
  +        String value = sconf.getAttribute("check-reload", "yes");
  +        this.checkSitemapReload = !(value != null && value.equalsIgnoreCase("no")
== true);
  +        value = sconf.getAttribute("reload-method", "asynchron");
  +        this.reloadSitemapAsynchron = !(value != null && value.equalsIgnoreCase("synchron")
== true);
  +        getLogger().debug("Sitemap location = " + this.sitemapFileName);
  +        getLogger().debug("Checking sitemap reload = " + this.checkSitemapReload);
  +        getLogger().debug("Reloading sitemap asynchron = " + this.reloadSitemapAsynchron);
       }
   
       /** Configure this <code>Cocoon</code> instance. */
  -    public void configure() throws ConfigurationException, ContextException {
  +    public Configuration configure(ExcaliburComponentManager startupManager) throws ConfigurationException,
ContextException {
           Parser p = null;
           Configuration roleConfig = null;
  +        Configuration sitemapConfig = null;
   
           try {
               this.configurationFile.refresh();
  -            p = (Parser)this.componentManager.lookup(Roles.PARSER);
  +            p = (Parser)startupManager.lookup(Roles.PARSER);
               SAXConfigurationHandler b = new SAXConfigurationHandler();
               InputStream inputStream = ClassUtils.getResource("org/apache/cocoon/cocoon.roles").openStream();
               InputSource is = new InputSource(inputStream);
  @@ -163,7 +194,7 @@
               getLogger().error("Could not configure Cocoon environment", e);
               throw new ConfigurationException("Error trying to load configurations", e);
           } finally {
  -            if (p != null) this.componentManager.release(p);
  +            if (p != null) startupManager.release(p);
           }
   
           DefaultRoleManager drm = new DefaultRoleManager();
  @@ -172,8 +203,31 @@
           roleConfig = null;
   
           try {
  -            p = (Parser)this.componentManager.lookup(Roles.PARSER);
  +            this.configurationFile.refresh();
  +            p = (Parser)startupManager.lookup(Roles.PARSER);
               SAXConfigurationHandler b = new SAXConfigurationHandler();
  +            InputStream inputStream = ClassUtils.getResource("org/apache/cocoon/sitemap/sitemap.roles").openStream();
  +            InputSource is = new InputSource(inputStream);
  +            is.setSystemId(this.configurationFile.getSystemId());
  +            p.setContentHandler(b);
  +            p.parse(is);
  +            sitemapConfig = b.getConfiguration();
  +        } catch (Exception e) {
  +            getLogger().error("Could not configure Cocoon environment", e);
  +            throw new ConfigurationException("Error trying to load configurations", e);
  +        } finally {
  +            if (p != null) startupManager.release(p);
  +        }
  +
  +        DefaultRoleManager sitemapRoleManager = new DefaultRoleManager();
  +        sitemapRoleManager.setLogger(getLogger());
  +        sitemapRoleManager.configure(sitemapConfig);
  +
  +        AbstractSitemap.setRoleManager(sitemapRoleManager);
  +
  +        try {
  +            p = (Parser)startupManager.lookup(Roles.PARSER);
  +            SAXConfigurationHandler b = new SAXConfigurationHandler();
               InputSource is = this.configurationFile.getInputSource();
               p.setContentHandler(b);
               p.parse(is);
  @@ -182,7 +236,7 @@
               getLogger().error("Could not configure Cocoon environment", e);
               throw new ConfigurationException("Error trying to load configurations",e);
           } finally {
  -            if (p != null) this.componentManager.release(p);
  +            if (p != null) startupManager.release(p);
           }
   
           Configuration conf = this.configuration;
  @@ -199,7 +253,7 @@
           String userRoles = conf.getAttribute("user-roles", "");
           if ("".equals(userRoles) == false) {
               try {
  -                p = (Parser)this.componentManager.lookup(Roles.PARSER);
  +                p = (Parser)startupManager.lookup(Roles.PARSER);
                   SAXConfigurationHandler b = new SAXConfigurationHandler();
                   org.apache.cocoon.environment.Context context =
                       (org.apache.cocoon.environment.Context) this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
  @@ -213,7 +267,7 @@
                   getLogger().error("Could not configure Cocoon environment", e);
                   throw new ConfigurationException("Error trying to load configurations",
e);
               } finally {
  -                if (p != null) this.componentManager.release(p);
  +                if (p != null) startupManager.release(p);
               }
   
               DefaultRoleManager urm = new DefaultRoleManager(drm);
  @@ -227,26 +281,8 @@
   
           getLogger().debug("Setting up components...");
           this.componentManager.configure(conf);
  -        getLogger().debug("Setting up the sitemap.");
  -        // Create the sitemap
  -        Configuration sconf = conf.getChild("sitemap");
  -        this.sitemapManager = new Manager();
  -        this.sitemapManager.setLogger(getLogger());
  -        this.sitemapManager.contextualize(this.context);
  -        this.sitemapManager.compose(this.componentManager);
  -        this.sitemapManager.configure(conf);
  -        this.sitemapFileName = sconf.getAttribute("file");
  -        if (this.sitemapFileName == null) {
  -            getLogger().error("No sitemap file name");
  -            throw new ConfigurationException("No sitemap file name\n" + conf.toString());
  -        }
  -        String value = sconf.getAttribute("check-reload", "yes");
  -        this.checkSitemapReload = !(value != null && value.equalsIgnoreCase("no")
== true);
  -        value = sconf.getAttribute("reload-method", "asynchron");
  -        this.reloadSitemapAsynchron = !(value != null && value.equalsIgnoreCase("synchron")
== true);
  -        getLogger().debug("Sitemap location = " + this.sitemapFileName);
  -        getLogger().debug("Checking sitemap reload = " + this.checkSitemapReload);
  -        getLogger().debug("Reloading sitemap asynchron = " + this.reloadSitemapAsynchron);
  +
  +        return conf;
       }
   
       /** Queries the class to estimate its ergodic period termination. */
  
  
  
  1.6.2.1   +6 -46     xml-cocoon2/src/org/apache/cocoon/cocoon.roles
  
  Index: cocoon.roles
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/cocoon.roles,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- cocoon.roles	2001/05/28 12:01:14	1.6
  +++ cocoon.roles	2001/06/06 17:12:59	1.6.2.1
  @@ -26,11 +26,11 @@
   
    <role name="org.apache.cocoon.components.language.markup.MarkupLanguageSelector"
          shorthand="markup-languages"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
  +       default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
   
    <role name="org.apache.cocoon.components.language.programming.ProgrammingLanguageSelector"
          shorthand="programming-languages"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
  +       default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
   
    <role name="org.apache.cocoon.components.language.generator.ProgramGenerator"
          shorthand="program-generator"
  @@ -40,10 +40,6 @@
          shorthand="classloader"
          default-class="org.apache.cocoon.components.classloader.ClassLoaderManagerImpl"/>
   
  - <role name="org.apache.avalon.excalibur.pool.PoolController"
  -       shorthand="pool-controller"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentPoolController"/>
  -
    <role name="org.apache.cocoon.components.saxconnector.SAXConnector"
          shorthand="sax-connector"
          default-class="org.apache.cocoon.components.saxconnector.NullSAXConnector"/>
  @@ -53,7 +49,7 @@
   
    <role name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
          shorthand="datasources"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector">
  +       default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
       <hint shorthand="jdbc" class="org.apache.avalon.excalibur.datasource.JdbcDataSource"/>
       <hint shorthand="j2ee" class="org.apache.excalibur.datasource.J2eeDataSource"/>
   </role>
  @@ -61,44 +57,8 @@
    <role name="org.apache.cocoon.components.url.URLFactory"
          shorthand="url-factory"
          default-class="org.apache.cocoon.components.url.URLFactoryImpl"/>
  -
  - <role name="org.apache.cocoon.components.pipeline.StreamPipeline"
  -       shorthand="stream-pipeline"
  -       default-class="org.apache.cocoon.components.pipeline.NonCachingStreamPipeline"/>
  -
  - <role name="org.apache.cocoon.components.pipeline.EventPipeline"
  -       shorthand="event-pipeline"
  -       default-class="org.apache.cocoon.components.pipeline.NonCachingEventPipeline"/>
  -
  - <role name="org.apache.cocoon.acting.ActionSelector"
  -       shorthand="action"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
  -
  - <role name="org.apache.cocoon.selection.SelectorSelector"
  -       shorthand="selector"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
  -
  - <role name="org.apache.cocoon.matching.MatcherSelector"
  -       shorthand="matcher"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
  -
  - <role name="org.apache.cocoon.generation.GeneratorSelector"
  -       shorthand="generator"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
  -
  - <role name="org.apache.cocoon.transformation.TransformerSelector"
  -       shorthand="transformer"
  -       default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
  -
  - <role name="org.apache.cocoon.serialization.SerializerSelector"
  -       shorthand="serializer"
  -       default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"/>
  -
  - <role name="org.apache.cocoon.reading.ReaderSelector"
  -       shorthand="reader"
  -       default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"/>
   
  -<role name="org.apache.cocoon.components.sax.XMLSerializer"
  + <role name="org.apache.cocoon.components.sax.XMLSerializer"
          shorthand="xml-serializer"
          default-class="org.apache.cocoon.components.sax.XMLByteStreamCompiler"/>
   
  @@ -106,11 +66,11 @@
          shorthand="xml-deserializer"
          default-class="org.apache.cocoon.components.sax.XMLByteStreamInterpreter"/>
   
  -<role name="org.apache.cocoon.caching.EventCache"
  + <role name="org.apache.cocoon.caching.EventCache"
          shorthand="event-cache"
          default-class="org.apache.cocoon.caching.EventMemoryCache"/>
   
  -<role name="org.apache.cocoon.caching.StreamCache"
  + <role name="org.apache.cocoon.caching.StreamCache"
          shorthand="stream-cache"
          default-class="org.apache.cocoon.caching.StreamMemoryCache"/>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.1.1.2.1 +63 -6     xml-cocoon2/src/org/apache/cocoon/components/language/generator/GeneratorSelector.java
  
  Index: GeneratorSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/GeneratorSelector.java,v
  retrieving revision 1.1.1.1
  retrieving revision 1.1.1.1.2.1
  diff -u -r1.1.1.1 -r1.1.1.1.2.1
  --- GeneratorSelector.java	2001/05/09 20:49:49	1.1.1.1
  +++ GeneratorSelector.java	2001/06/06 17:13:04	1.1.1.1.2.1
  @@ -12,26 +12,48 @@
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
  +import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.configuration.DefaultConfiguration;
   import org.apache.cocoon.Constants;
   import org.apache.cocoon.Roles;
   import org.apache.cocoon.components.classloader.ClassLoaderManager;
   import org.apache.cocoon.util.ClassUtils;
  -import org.apache.avalon.excalibur.component.DefaultComponentSelector;
  +import org.apache.avalon.excalibur.component.ExcaliburComponentSelector;
  +import org.apache.avalon.excalibur.component.ComponentHandler;
  +import org.apache.avalon.excalibur.component.RoleManager;
   
  +import java.util.Map;
  +import java.util.HashMap;
  +
   /**
    * This interface is the common base of all Compiled Components.  This
    * includes Sitemaps and XSP Pages
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.1.1 $ $Date: 2001/05/09 20:49:49 $
  + * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/06/06 17:13:04 $
    */
  -public class GeneratorSelector extends DefaultComponentSelector implements Disposable {
  +public class GeneratorSelector extends ExcaliburComponentSelector implements Disposable
{
       private ClassLoaderManager classManager;
   
       /** The component manager */
       protected ComponentManager manager = null;
   
  +    protected Context context = null;
  +
  +    protected RoleManager roles = null;
  +
  +    protected Map componentHandlers = new HashMap();
  +
  +    public void contextualize(Context context) {
  +        super.contextualize(context);
  +        this.context = context;
  +    }
  +
  +    public void setRoleManager(RoleManager roleMgr) {
  +        super.setRoleManager(roleMgr);
  +        this.roles = roleMgr;
  +    }
  +
       public void compose (ComponentManager manager) throws ComponentException {
           super.compose(manager);
           this.manager = manager;
  @@ -54,8 +76,23 @@
               return super.select(hint);
           } catch (Exception e) {
               // if it isn't loaded, it may already be compiled...
  -            this.addGenerator(hint);
  -            return super.select(hint);
  +            try {
  +                ComponentHandler handler = (ComponentHandler) this.componentHandlers.get(hint);
  +
  +                if (handler == null) {
  +                    this.addGenerator(hint);
  +                    handler = (ComponentHandler) this.componentHandlers.get(hint);
  +
  +                    if (handler == null) {
  +                        throw new ComponentException("Could not find component for hint:
" + hint);
  +                    }
  +                }
  +
  +                return (Component) handler.get();
  +            } catch (Exception ce) {
  +                getLogger().debug("Could not access component for hint: " + hint, ce);
  +                throw new ComponentException("Could not access component for hint: " +
hint, ce);
  +            }
           }
       }
   
  @@ -72,7 +109,27 @@
       }
   
       public void addGenerator(Object hint, Class generator) throws ComponentException {
  -        super.addComponent(hint, generator, new DefaultConfiguration("", "GeneratorSelector"));
  +        try
  +        {
  +            final ComponentHandler handler =
  +                ComponentHandler.getComponentHandler( generator,
  +                                                      new DefaultConfiguration("", "GeneratorSelector"),
  +                                                      this.manager,
  +                                                      this.context,
  +                                                      this.roles );
  +
  +            handler.setLogger( getLogger() );
  +            handler.initialize();
  +            this.componentHandlers.put( hint, handler );
  +            getLogger().debug( "Adding " + generator.getName() + " for " + hint.toString()
);
  +        }
  +        catch( final Exception e )
  +        {
  +            final String message =
  +                "Could not set up Component for hint: " + hint;
  +            getLogger().error( message, e);
  +            throw new ComponentException( message, e );
  +        }
       }
   
       public void dispose() {
  
  
  
  1.5.2.1   +8 -3      xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- ProgramGeneratorImpl.java	2001/05/31 17:37:50	1.5
  +++ ProgramGeneratorImpl.java	2001/06/06 17:13:05	1.5.2.1
  @@ -48,7 +48,7 @@
   /**
    * The default implementation of <code>ProgramGenerator</code>
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.5 $ $Date: 2001/05/31 17:37:50 $
  + * @version CVS $Revision: 1.5.2.1 $ $Date: 2001/06/06 17:13:05 $
    */
   public class ProgramGeneratorImpl extends AbstractLoggable
       implements ProgramGenerator, Contextualizable, Composable, Configurable, ThreadSafe,
Disposable {
  @@ -160,8 +160,13 @@
                   getLogger().debug("Language Exception", le);
                   throw new ProcessingException("Language Exception", le);
               } finally {
  -                this.markupSelector.release(markupLanguage);
  -                this.languageSelector.release(programmingLanguage);
  +                if (this.markupSelector != null) {
  +                    this.markupSelector.release(markupLanguage);
  +                }
  +
  +                if (this.languageSelector != null) {
  +                    this.languageSelector.release(programmingLanguage);
  +                }
               }
   
               try {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.1  +9 -8      xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
  retrieving revision 1.11
  retrieving revision 1.11.2.1
  diff -u -r1.11 -r1.11.2.1
  --- sitemap.xsl	2001/06/05 21:36:23	1.11
  +++ sitemap.xsl	2001/06/06 17:13:11	1.11.2.1
  @@ -100,7 +100,7 @@
        *
        * @author &lt;a href="mailto:giacomo@apache.org"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:bloritsch@apache.org"&gt;Berin Loritsch&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.11 2001/06/05 21:36:23 dims Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.11.2.1 2001/06/06 17:13:11 bloritsch Exp $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/',
'.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -191,6 +191,7 @@
             configurer.configActions();
             configurer = null;
   
  +          this.manager.initialize();
           /* catch any exception thrown by a component during configuration */
           } catch (Exception e) {
             getLogger().warn(e.getMessage(), e);
  @@ -609,10 +610,10 @@
           <xsl:with-param name="param">param</xsl:with-param>
       </xsl:apply-templates>
   
  -    <!-- modification end -->		
  -		
  -	<!-- Modified 20010510 L.Sutic Changed to pass sitemap parameters. -->
  +    <!-- modification end -->
   
  +    <!-- Modified 20010510 L.Sutic Changed to pass sitemap parameters. -->
  +
       <!-- break on error when old parameter syntax exists -->
       <xsl:if test="parameter">
         <xsl:call-template name="error">
  @@ -620,7 +621,7 @@
         </xsl:call-template>
       </xsl:if>
   
  -	<!-- test if we have to define parameters for this action -->
  +    <!-- test if we have to define parameters for this action -->
       <xsl:if test="count(map:parameter)>0">
         param = new Parameters ();
       </xsl:if>
  @@ -641,10 +642,10 @@
       <xsl:apply-templates select="map:parameter">
           <xsl:with-param name="param">param</xsl:with-param>
       </xsl:apply-templates>
  +
  +    <!-- modification end -->
  +
   
  -	<!-- modification end -->
  -		
  -		
       <!-- loop through all the when cases -->
       <xsl:for-each select="./map:when">
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +65 -17    xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java
  
  Index: AbstractSitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- AbstractSitemap.java	2001/05/31 17:38:49	1.4
  +++ AbstractSitemap.java	2001/06/06 17:13:15	1.4.2.1
  @@ -15,6 +15,7 @@
   import java.util.List;
   import java.util.Map;
   import org.apache.avalon.framework.activity.Disposable;
  +import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentException;
  @@ -22,6 +23,7 @@
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
  +import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.context.ContextException;
   import org.apache.avalon.framework.context.Contextualizable;
  @@ -37,22 +39,28 @@
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.util.ClassUtils;
  -import org.apache.avalon.excalibur.component.DefaultComponentSelector;
  +import org.apache.avalon.excalibur.component.ExcaliburComponentManager;
  +import org.apache.avalon.excalibur.component.ExcaliburComponentSelector;
  +import org.apache.avalon.excalibur.component.RoleManager;
  +import org.apache.avalon.excalibur.component.DefaultRoleManager;
  +import org.apache.log.Hierarchy;
   import org.xml.sax.SAXException;
   
   /**
    * Base class for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.4 $ $Date: 2001/05/31 17:38:49 $
  + * @version CVS $Revision: 1.4.2.1 $ $Date: 2001/06/06 17:13:15 $
    */
   public abstract class AbstractSitemap extends AbstractLoggable implements Sitemap, Disposable,
ThreadSafe {
       private Context context;
   
       private static final int BYTE_ARRAY_SIZE = 1024;
   
  +    private static RoleManager roleManager;
  +
       /** The component manager instance */
  -    protected ComponentManager manager;
  +    protected ExcaliburComponentManager manager;
   
       /** The sitemap manager instance */
       protected Manager sitemapManager;
  @@ -63,34 +71,74 @@
       /** The creation date */
       protected static long dateCreated = -1L;
   
  -    protected DefaultComponentSelector generators;
  -    protected DefaultComponentSelector transformers;
  +    protected ExcaliburComponentSelector generators;
  +    protected ExcaliburComponentSelector transformers;
       protected SitemapComponentSelector serializers;
       protected SitemapComponentSelector readers;
  -    protected DefaultComponentSelector actions;
  -    protected DefaultComponentSelector matchers;
  -    protected DefaultComponentSelector selectors;
  +    protected ExcaliburComponentSelector actions;
  +    protected ExcaliburComponentSelector matchers;
  +    protected ExcaliburComponentSelector selectors;
   
       /**
  +     * Set the role manager
  +     */
  +    public static void setRoleManager(RoleManager roles) {
  +        if (AbstractSitemap.roleManager == null) {
  +            AbstractSitemap.roleManager = roles;
  +        }
  +    }
  +
  +    /**
        * Set the current <code>ComponentManager</code> instance used by this
        * <code>Composable</code>.
        */
       public void compose(ComponentManager manager)  throws ComponentException {
  -        this.manager = manager;
  +        this.manager = new ExcaliburComponentManager(manager);
  +        this.manager.setLogger(getLogger());
  +        this.manager.contextualize(this.context);
  +        this.manager.setRoleManager(AbstractSitemap.roleManager);
   
           try {
  -            this.urlFactory = (URLFactory) this.manager.lookup(Roles.URL_FACTORY);
  -            this.generators = (DefaultComponentSelector) this.manager.lookup(Roles.GENERATORS);
  -            this.transformers = (DefaultComponentSelector) this.manager.lookup(Roles.TRANSFORMERS);
  -            this.serializers = (SitemapComponentSelector) this.manager.lookup(Roles.SERIALIZERS);
  -            this.readers = (SitemapComponentSelector) this.manager.lookup(Roles.READERS);
  -            this.actions = (DefaultComponentSelector) this.manager.lookup(Roles.ACTIONS);
  -            this.matchers = (DefaultComponentSelector) this.manager.lookup(Roles.MATCHERS);
  -            this.selectors = (DefaultComponentSelector) this.manager.lookup(Roles.SELECTORS);
  +            this.urlFactory = (URLFactory) manager.lookup(Roles.URL_FACTORY);
  +
  +            this.generators = new ExcaliburComponentSelector();
  +            this.setupSelector(this.generators);
  +            this.manager.addComponentInstance(Roles.GENERATORS, this.generators);
  +
  +            this.transformers = new ExcaliburComponentSelector();
  +            this.setupSelector(this.transformers);
  +            this.manager.addComponentInstance(Roles.TRANSFORMERS, this.transformers);
  +
  +            this.serializers = new SitemapComponentSelector();
  +            this.setupSelector(this.serializers);
  +            this.manager.addComponentInstance(Roles.SERIALIZERS, this.serializers);
  +
  +            this.readers = new SitemapComponentSelector();
  +            this.setupSelector(this.readers);
  +            this.manager.addComponentInstance(Roles.READERS, this.readers);
  +
  +            this.actions = new ExcaliburComponentSelector();
  +            this.setupSelector(this.actions);
  +            this.manager.addComponentInstance(Roles.ACTIONS, this.actions);
  +
  +            this.matchers = new ExcaliburComponentSelector();
  +            this.setupSelector(this.matchers);
  +            this.manager.addComponentInstance(Roles.MATCHERS, this.matchers);
  +
  +            this.selectors = new ExcaliburComponentSelector();
  +            this.setupSelector(this.selectors);
  +            this.manager.addComponentInstance(Roles.SELECTORS, this.selectors);
           } catch (Exception e) {
               getLogger().error("cannot obtain the Component", e);
               throw new ComponentException ("cannot obtain the URLFactory", e);
           }
  +    }
  +
  +    private void setupSelector(ExcaliburComponentSelector selector) throws Exception {
  +        selector.setLogger(getLogger());
  +        selector.contextualize(this.context);
  +        selector.setRoleManager(AbstractSitemap.roleManager);
  +        selector.compose(this.manager);
       }
   
       public void contextualize(Context context) throws ContextException {
  
  
  
  1.9.2.1   +2 -1      xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- Handler.java	2001/05/31 19:10:08	1.9
  +++ Handler.java	2001/06/06 17:13:16	1.9.2.1
  @@ -21,6 +21,7 @@
   import org.apache.avalon.framework.context.ContextException;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLoggable;
  +import org.apache.avalon.excalibur.component.RoleManager;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.Processor;
   import org.apache.cocoon.Roles;
  @@ -42,7 +43,7 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @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.9 $ $Date: 2001/05/31 19:10:08 $
  + * @version CVS $Revision: 1.9.2.1 $ $Date: 2001/06/06 17:13:16 $
    */
   public class Handler extends AbstractLoggable
   implements Runnable, Configurable, Composable, Contextualizable, Processor, Disposable
{
  
  
  
  1.2.2.1   +12 -1     xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- Manager.java	2001/05/31 17:38:54	1.2
  +++ Manager.java	2001/06/06 17:13:18	1.2.2.1
  @@ -22,6 +22,7 @@
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLoggable;
   import org.apache.avalon.framework.thread.ThreadSafe;
  +import org.apache.avalon.excalibur.component.RoleManager;
   import org.apache.cocoon.Constants;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.pipeline.EventPipeline;
  @@ -37,7 +38,7 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 17:38:54 $
  + * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/06 17:13:18 $
    */
   public class Manager extends AbstractLoggable implements Component, Configurable, Composable,
Contextualizable, ThreadSafe {
   
  @@ -51,6 +52,16 @@
   
       /** The component manager */
       private ComponentManager manager;
  +
  +    /** The sitemap role manager */
  +    private RoleManager sitemapRoles;
  +
  +    /**
  +     * Set the role manager
  +     */
  +    public void setRoleManager(RoleManager roles) {
  +        this.sitemapRoles = roles;
  +    }
   
       /** get a configuration
        * @param conf the configuration
  
  
  
  1.2.2.1   +3 -3      xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapComponentSelector.java
  
  Index: SitemapComponentSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapComponentSelector.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- SitemapComponentSelector.java	2001/05/22 14:45:35	1.2
  +++ SitemapComponentSelector.java	2001/06/06 17:13:19	1.2.2.1
  @@ -15,14 +15,14 @@
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.avalon.excalibur.component.DefaultComponentSelector;
  +import org.apache.avalon.excalibur.component.ExcaliburComponentSelector;
   
   /** Default component manager for Cocoon's sitemap components.
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
  - * @version CVS $Id: SitemapComponentSelector.java,v 1.2 2001/05/22 14:45:35 cziegeler
Exp $
  + * @version CVS $Id: SitemapComponentSelector.java,v 1.2.2.1 2001/06/06 17:13:19 bloritsch
Exp $
    */
  -public class SitemapComponentSelector extends DefaultComponentSelector {
  +public class SitemapComponentSelector extends ExcaliburComponentSelector {
       HashMap mime_types;
   
       /** The conctructors (same as the Avalon ComponentManager)
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +39 -0     xml-cocoon2/src/org/apache/cocoon/sitemap/Attic/sitemap.roles
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +4 -4      xml-cocoon2/src/org/apache/cocoon/util/IOUtils.java
  
  Index: IOUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/IOUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- IOUtils.java	2001/05/25 14:25:59	1.2
  +++ IOUtils.java	2001/06/06 17:13:29	1.2.2.1
  @@ -20,7 +20,7 @@
   import java.text.Collator;
   import java.util.Arrays;
   import java.util.Locale;
  -import org.apache.log.LogKit;
  +import org.apache.log.Hierarchy;
   
   /**
    * A collection of <code>File</code>, <code>URL</code> and filename
  @@ -28,7 +28,7 @@
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/25 14:25:59 $
  + * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/06 17:13:29 $
    */
   public class IOUtils {
   
  @@ -242,7 +242,7 @@
       try {
         return file.getCanonicalPath();
       } catch (Exception e) {
  -      LogKit.getLoggerFor("cocoon").debug("IOUtils.getFullFilename", e);
  +      Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon").debug("IOUtils.getFullFilename",
e);
         return file.getAbsolutePath();
       }
     }
  @@ -283,7 +283,7 @@
                 filePath = filePath.substring(directoryPath.length());
             }
         } catch (Exception e){
  -          LogKit.getLoggerFor("cocoon").debug("IOUtils.getContextFilePath", e);
  +          Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon").debug("IOUtils.getContextFilePath",
e);
         }
   
         return filePath;
  
  
  

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