You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Davanum Srinivas <di...@yahoo.com> on 2001/06/07 15:36:18 UTC

Re: cvs commit: xml-cocoon2/src/org/apache/cocoon/util IOUtils.java

Berin,
Shouldn't these changes get into 2.1 also?

Thanks,
dims

--- bloritsch@apache.org wrote:
> 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);
> 
=== message truncated ===


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: cvs commit: xml-cocoon2/src/org/apache/cocoon/util IOUtils.java

Posted by Berin Loritsch <bl...@apache.org>.
Davanum Srinivas wrote:
> 
> Berin,
> Shouldn't these changes get into 2.1 also?

Yes.  There are some architectural things that I would like to see done
RSN.  They do not affect client code, just the way Cocoon works internally.

I have to think how I plan on doing that.

> 
> Thanks,
> dims
> 
> --- bloritsch@apache.org wrote:
> > 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);
> >
> === message truncated ===
> 
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org