cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject cvs commit: xml-cocoon/webapp cocoon.xconf
Date Mon, 12 Feb 2001 13:30:48 GMT
giacomo     01/02/12 05:30:48

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
                        CocoonComponentSelector.java Constants.java
                        DefaultComponentManager.java Main.java Roles.java
               src/org/apache/cocoon/acting Tag: xml-cocoon2
                        ComposerAction.java
               src/org/apache/cocoon/components/language/generator Tag:
                        xml-cocoon2 ProgramGeneratorImpl.java
               src/org/apache/cocoon/components/language/markup Tag:
                        xml-cocoon2 AbstractMarkupLanguage.java
               src/org/apache/cocoon/components/language/markup/xsp Tag:
                        xml-cocoon2 XSPUtil.java
               src/org/apache/cocoon/components/language/markup/xsp/java
                        Tag: xml-cocoon2 util.xsl
               src/org/apache/cocoon/generation Tag: xml-cocoon2
                        AbstractGenerator.java DirectoryGenerator.java
                        HTMLGenerator.java ServerPagesGenerator.java
               src/org/apache/cocoon/reading Tag: xml-cocoon2
                        ResourceReader.java
               src/org/apache/cocoon/serialization Tag: xml-cocoon2
                        AbstractSerializer.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
               src/org/apache/cocoon/transformation Tag: xml-cocoon2
                        I18nTransformer.java TraxTransformer.java
                        XIncludeTransformer.java XTTransformer.java
               src/org/apache/cocoon/util Tag: xml-cocoon2 NetUtils.java
                        RoleUtils.java
               src/org/apache/cocoon/xml Tag: xml-cocoon2
                        AbstractXMLProducer.java
               webapp   Tag: xml-cocoon2 cocoon.xconf
  Log:
  First bunch of changes to move from the static methods getURL in NetUtils class to a component based and pluggable URL system. Any suggestions are welcome.
  
  Additionnally the patch submitted by Carsten Ziegeler has be applied as well.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.48  +17 -20    xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4.2.47
  retrieving revision 1.4.2.48
  diff -u -r1.4.2.47 -r1.4.2.48
  --- Cocoon.java	2001/02/08 18:30:39	1.4.2.47
  +++ Cocoon.java	2001/02/12 13:30:42	1.4.2.48
  @@ -22,6 +22,8 @@
   import org.apache.avalon.Composer;
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.ComponentManagerException;
  +import org.apache.avalon.Context;
  +import org.apache.avalon.Contextualizable;
   import org.apache.avalon.Modifiable;
   import org.apache.avalon.Configurable;
   import org.apache.avalon.Configuration;
  @@ -30,6 +32,7 @@
   import org.apache.avalon.Initializable;
   
   import org.apache.cocoon.components.parser.Parser;
  +import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.serialization.Serializer;
   import org.apache.cocoon.sitemap.Manager;
  @@ -47,13 +50,16 @@
    * @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.4.2.47 $ $Date: 2001/02/08 18:30:39 $
  + * @version CVS $Revision: 1.4.2.48 $ $Date: 2001/02/12 13:30:42 $
    */
   public class Cocoon
  -  implements Component, Configurable, ComponentManager, Modifiable, Processor, Constants, Loggable {
  +  implements Component, Configurable, ComponentManager, Modifiable, Processor, Constants, Loggable, Contextualizable {
   
       private Logger log;
   
  +    /** The application context */
  +    private Context context;
  +
       /** The table of role-class */
       private HashMap components = new HashMap();
   
  @@ -72,9 +78,6 @@
       /** The sitemap manager */
       private Manager sitemapManager;
   
  -    /** The root uri/path */
  -    private URL root;
  -
       /** The classpath (null if not available) */
       private String classpath;
   
  @@ -96,7 +99,7 @@
        * Create a new <code>Cocoon</code> object, parsing configuration from
        * the specified file.
        */
  -    public Cocoon(final URL configurationFile, final String classpath, File workDir, final String root)
  +    public Cocoon(final URL configurationFile, final String classpath, File workDir)
       throws SAXException,
              IOException,
          ConfigurationException,
  @@ -106,10 +109,6 @@
           this.classpath = classpath;
           this.workDir = workDir;
           this.configurationFile = configurationFile;
  -
  -        File rootFile = new File(root);
  -        NetUtils.setRoot(rootFile);
  -        this.root = rootFile.toURL();
       }
   
       public void setLogger(Logger logger) {
  @@ -119,6 +118,13 @@
           }
       }
   
  +    public void contextualize(Context context) {
  +        if (this.context == null) {
  +            this.context = context;
  +            this.componentManager.contextualize(this.context);
  +        }
  +    }
  +
       public void init() throws Exception {
           log.debug("New Cocoon object.");
   
  @@ -151,15 +157,6 @@
       }
   
       /**
  -     * Set the cocoon root.
  -     * @param root The new Cocoon root.
  -     */
  -    public void setRoot(URL root) {
  -        log.debug("Root URL set to: " + root.toExternalForm());
  -        this.root = root;
  -    }
  -
  -    /**
        * Get the local classpath
        * @return the classpath available to this instance or null if not available.
        */
  @@ -243,7 +240,7 @@
        */
       public boolean process(Environment environment)
       throws Exception {
  -        String file = new URL(environment.resolveEntity(null, this.sitemapFileName).getSystemId()).getFile();
  +        String file = ((URLFactory)componentManager.lookup(Roles.URL_FACTORY)).getURL(environment.resolveEntity(null, this.sitemapFileName).getSystemId()).getFile();
           return this.sitemapManager.invoke(environment, "", file, true);
       }
   
  
  
  
  1.1.2.15  +5 -5      xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java
  
  Index: CocoonComponentSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java,v
  retrieving revision 1.1.2.14
  retrieving revision 1.1.2.15
  diff -u -r1.1.2.14 -r1.1.2.15
  --- CocoonComponentSelector.java	2001/01/22 21:56:32	1.1.2.14
  +++ CocoonComponentSelector.java	2001/02/12 13:30:42	1.1.2.15
  @@ -40,7 +40,7 @@
   /** Default component manager for Cocoon's non sitemap components.
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/01/22 21:56:32 $
  + * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/02/12 13:30:42 $
    */
   public class CocoonComponentSelector implements ComponentSelector, Composer, Configurable, ThreadSafe, Loggable {
       protected Logger log;
  @@ -254,6 +254,10 @@
               ((Loggable)c).setLogger(this.log);
           }
   
  +        if ( c instanceof Composer ) {
  +            ((Composer)c).compose(this.manager);
  +        }
  +
           if ( c instanceof Configurable ) {
               try {
                   ((Configurable)c).configure(
  @@ -266,10 +270,6 @@
                       e
                   );
               }
  -        }
  -
  -        if ( c instanceof Composer ) {
  -            ((Composer)c).compose(this.manager);
           }
       }
   
  
  
  
  1.1.2.15  +4 -1      xml-cocoon/src/org/apache/cocoon/Attic/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Constants.java,v
  retrieving revision 1.1.2.14
  retrieving revision 1.1.2.15
  diff -u -r1.1.2.14 -r1.1.2.15
  --- Constants.java	2001/02/07 17:52:37	1.1.2.14
  +++ Constants.java	2001/02/12 13:30:42	1.1.2.15
  @@ -10,7 +10,7 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/02/07 17:52:37 $
  + * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/02/12 13:30:42 $
    */
   
   public interface Constants {
  @@ -56,4 +56,7 @@
       String ERROR_NAMESPACE_URI = "http://apache.org/cocoon/" + CONF_VERSION + "/error";
       String ERROR_NAMESPACE_PREFIX = "error";
   
  +    String CONTEXT_SERVLET_CONTEXT = "servlet-context";
  +    String CONTEXT_ROOT_PATH       = "root-path";
  +    String CONTEXT_CLASS_LOADER    = "class-loader";
   }
  
  
  
  1.1.2.14  +20 -4     xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java
  
  Index: DefaultComponentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- DefaultComponentManager.java	2001/01/22 21:56:32	1.1.2.13
  +++ DefaultComponentManager.java	2001/02/12 13:30:42	1.1.2.14
  @@ -18,6 +18,8 @@
   import org.apache.avalon.ComponentManagerException;
   import org.apache.avalon.ComponentNotFoundException;
   import org.apache.avalon.ComponentNotAccessibleException;
  +import org.apache.avalon.Context;
  +import org.apache.avalon.Contextualizable;
   import org.apache.avalon.SingleThreaded;
   import org.apache.avalon.ThreadSafe;
   import org.apache.avalon.Poolable;
  @@ -38,12 +40,16 @@
   
   /** Default component manager for Cocoon's non sitemap components.
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/01/22 21:56:32 $
  + * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/02/12 13:30:42 $
    */
   public class DefaultComponentManager implements ComponentManager, Configurable, Loggable {
   
       protected Logger log;
   
  +    /** The application context for components
  +     */
  +    private Context context;
  +
       /** Hashmap of all components which this ComponentManager knows about.
        */
       private Map components;
  @@ -76,6 +82,12 @@
           }
       }
   
  +    public void contextualize(Context context) {
  +        if (this.context == null) {
  +            this.context = context;
  +        }
  +    }
  +
       /** Return an instance of a component.
        */
       public Component lookup( String role )
  @@ -108,9 +120,9 @@
   
               this.components.put(role, componentClass);
   
  -        if (Configurable.class.isAssignableFrom(componentClass)) {
  -            this.configurations.put(role, new DefaultConfiguration("", "-"));
  -        }
  +            if (Configurable.class.isAssignableFrom(componentClass)) {
  +                this.configurations.put(role, new DefaultConfiguration("", "-"));
  +            }
           }
   
           if ( !Component.class.isAssignableFrom(componentClass) ) {
  @@ -288,6 +300,10 @@
       throws ComponentManagerException {
           if ( c instanceof Loggable ) {
               ((Loggable)c).setLogger(this.log);
  +        }
  +
  +        if ( c instanceof Contextualizable ) {
  +            ((Contextualizable)c).contextualize(this.context);
           }
   
           if ( c instanceof Configurable ) {
  
  
  
  1.1.4.20  +8 -2      xml-cocoon/src/org/apache/cocoon/Attic/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Main.java,v
  retrieving revision 1.1.4.19
  retrieving revision 1.1.4.20
  diff -u -r1.1.4.19 -r1.1.4.20
  --- Main.java	2001/01/31 15:48:35	1.1.4.19
  +++ Main.java	2001/02/12 13:30:42	1.1.4.20
  @@ -28,6 +28,7 @@
   import org.apache.avalon.util.cli.CLOption;
   import org.apache.avalon.util.cli.CLOptionDescriptor;
   import org.apache.avalon.util.cli.CLUtil;
  +import org.apache.avalon.DefaultContext;
   
   import org.apache.cocoon.util.IOUtils;
   import org.apache.cocoon.util.NetUtils;
  @@ -48,7 +49,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.4.19 $ $Date: 2001/01/31 15:48:35 $
  + * @version CVS $Revision: 1.1.4.20 $ $Date: 2001/02/12 13:30:42 $
    */
   
   public class Main {
  @@ -191,8 +192,13 @@
               File work = getDir(workDir, "working");
               File context = getDir(contextDir, "context");
               File conf = getConfigurationFile(context);
  -            Cocoon c = new Cocoon(conf.toURL(), null, work, context.getCanonicalPath());
  +            DefaultContext appContext = new DefaultContext();
  +            //appContext.put(Constants.CONTEXT_SERVLET_CONTEXT, contextDir);
  +            appContext.put(Constants.CONTEXT_ROOT_PATH, contextDir);
  +            appContext.put(Constants.CONTEXT_CLASS_LOADER, Main.class.getClassLoader());
  +            Cocoon c = new Cocoon(conf.toURL(), null, work);
               c.setLogger(log);
  +            c.contextualize(appContext);
               c.init();
               Main main = new Main(c, context, dest);
               main.warmup();
  
  
  
  1.1.2.5   +2 -1      xml-cocoon/src/org/apache/cocoon/Attic/Roles.java
  
  Index: Roles.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Roles.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- Roles.java	2001/02/06 15:23:36	1.1.2.4
  +++ Roles.java	2001/02/12 13:30:42	1.1.2.5
  @@ -12,7 +12,7 @@
    * Created this interface to specify the Avalon role names.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/02/06 15:23:36 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/02/12 13:30:42 $
    */
   
   public interface Roles {
  @@ -29,5 +29,6 @@
       String POOL_CONTROLLER      = "org.apache.avalon.util.pool.PoolController";
       String IMAGE_ENCODER        = "org.apache.cocoon.components.image.ImageEncoderSelector";
       String DB_CONNECTION        = "org.apache.avalon.util.datasource.DataSourceComponentSelector";
  +    String URL_FACTORY          = "org.apache.cocoon.components.url.URLFactory";
   
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +2 -2      xml-cocoon/src/org/apache/cocoon/acting/Attic/ComposerAction.java
  
  Index: ComposerAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/ComposerAction.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- ComposerAction.java	2001/02/12 05:56:49	1.1.2.2
  +++ ComposerAction.java	2001/02/12 13:30:43	1.1.2.3
  @@ -16,12 +16,12 @@
    * that extends this to access SitemapComponents.
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/02/12 05:56:49 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/02/12 13:30:43 $
    */
   public abstract class ComposerAction extends AbstractAction implements Composer {
   
       /** The component manager instance */
  -    protected ComponentManager manager=null;
  +    protected ComponentManager manager;
   
       /**
        * Set the current <code>ComponentManager</code> instance used by this
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.24  +4 -1      xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java,v
  retrieving revision 1.1.2.23
  retrieving revision 1.1.2.24
  diff -u -r1.1.2.23 -r1.1.2.24
  --- ProgramGeneratorImpl.java	2001/02/08 21:04:22	1.1.2.23
  +++ ProgramGeneratorImpl.java	2001/02/12 13:30:43	1.1.2.24
  @@ -53,7 +53,7 @@
    * The default implementation of <code>ProgramGenerator</code>
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.23 $ $Date: 2001/02/08 21:04:22 $
  + * @version CVS $Revision: 1.1.2.24 $ $Date: 2001/02/12 13:30:43 $
    */
   public class ProgramGeneratorImpl
     implements ProgramGenerator, Composer, Configurable, ThreadSafe, Loggable
  @@ -180,6 +180,9 @@
           programInstance = programmingLanguage.instantiate(program);
           if (programInstance instanceof Loggable) {
               ((Loggable)programInstance).setLogger(this.log);
  +        }
  +        if (programInstance instanceof Composer) {
  +            ((Composer)programInstance).compose(this.manager);
           }
         } catch (LanguageException e) { log.debug("Language Exception", e); }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.25  +18 -7     xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/AbstractMarkupLanguage.java
  
  Index: AbstractMarkupLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/AbstractMarkupLanguage.java,v
  retrieving revision 1.1.2.24
  retrieving revision 1.1.2.25
  diff -u -r1.1.2.24 -r1.1.2.25
  --- AbstractMarkupLanguage.java	2001/02/08 21:04:30	1.1.2.24
  +++ AbstractMarkupLanguage.java	2001/02/12 13:30:43	1.1.2.25
  @@ -19,6 +19,7 @@
   import java.util.Hashtable;
   import java.util.Enumeration;
   import java.util.Iterator;
  +
   import org.xml.sax.InputSource;
   import org.xml.sax.EntityResolver;
   import org.xml.sax.SAXException;
  @@ -27,6 +28,7 @@
   import org.xml.sax.Attributes;
   import org.xml.sax.helpers.XMLFilterImpl;
   import org.xml.sax.helpers.XMLReaderFactory;
  +
   import org.apache.avalon.Composer;
   import org.apache.avalon.Component;
   import org.apache.avalon.ComponentManager;
  @@ -34,17 +36,19 @@
   import org.apache.avalon.Configuration;
   import org.apache.avalon.ConfigurationException;
   import org.apache.avalon.Parameters;
  -import org.apache.cocoon.util.IOUtils;
  -import org.apache.cocoon.util.NetUtils;
  -import org.apache.cocoon.components.store.MemoryStore;
  -import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
   import org.apache.avalon.AbstractLoggable;
   
  +import org.apache.cocoon.Roles;
  +import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
  +import org.apache.cocoon.components.store.MemoryStore;
  +import org.apache.cocoon.components.url.URLFactory;
  +import org.apache.cocoon.util.IOUtils;
  +
   /**
    * Base implementation of <code>MarkupLanguage</code>. This class uses
    * logicsheets as the only means of code generation. Code generation should be decoupled from this context!!!
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.24 $ $Date: 2001/02/08 21:04:30 $
  + * @version CVS $Revision: 1.1.2.25 $ $Date: 2001/02/12 13:30:43 $
    */
   public abstract class AbstractMarkupLanguage extends AbstractLoggable implements MarkupLanguage, Composer, Configurable {
       /** The supported language table */
  @@ -162,7 +166,8 @@
               logicsheet.setLogger(getLogger());
           }
   
  -        logicsheetURL = NetUtils.getURL(logicsheetLocation);
  +        URLFactory urlFactory = (URLFactory)this.manager.lookup(Roles.URL_FACTORY);
  +        logicsheetURL = urlFactory.getURL(logicsheetLocation);
   
           logicsheet.setInputSource(new InputSource(logicsheetURL.openStream()));
   
  @@ -272,7 +277,13 @@
                   throw new SAXException("codeGenerator must never be null.");
               }
   
  -            URL url = NetUtils.getURL(logicsheetLocation);
  +            URL url = null;
  +            try {
  +                url = ((URLFactory)manager.lookup(Roles.URL_FACTORY)).getURL(logicsheetLocation);
  +            } catch (Exception e) {
  +                getLogger().error("cannot get logicsheet at " + logicsheetLocation);
  +                new SAXException ("cannot get logicsheet at " + logicsheetLocation, e);
  +            }
               getLogger().debug("Logicsheet Used:" + url.toExternalForm());
               inputSource = new InputSource(url.openStream());
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +7 -7      xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPUtil.java
  
  Index: XSPUtil.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPUtil.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- XSPUtil.java	2001/02/09 15:05:55	1.1.2.6
  +++ XSPUtil.java	2001/02/12 13:30:43	1.1.2.7
  @@ -29,6 +29,8 @@
   import org.xml.sax.SAXException;
   
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.Roles;
  +import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.components.parser.Parser;
   import org.apache.cocoon.util.IOUtils;
   import org.apache.cocoon.util.NetUtils;
  @@ -42,7 +44,7 @@
    * The XSP <code>Utility</code> object helper
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:bloritsch@apache.org>Berin Loritsch</a>
  - * @version $Revision: 1.1.2.6 $ $Date: 2001/02/09 15:05:55 $
  + * @version $Revision: 1.1.2.7 $ $Date: 2001/02/12 13:30:43 $
    */
   public class XSPUtil {
       public static String pathComponent(String filename) {
  @@ -205,14 +207,12 @@
     /* Logicsheet Utility Methods */
   
       // Inclusion
  -    public static String getURLContents(String url) throws IOException {
  -        return getContents(
  -            new URL(url).openStream());
  +    public static String getURLContents(String url, URLFactory urlFactory) throws IOException {
  +        return getContents(urlFactory.getURL(url).openStream());
       }
   
  -    public static String getURLContents(String url, String encoding) throws IOException {
  -        return getContents(
  -            new URL(url).openStream(), encoding);
  +    public static String getURLContents(String url, String encoding, URLFactory urlFactory) throws IOException {
  +        return getContents(urlFactory.getURL(url).openStream(), encoding);
       }
   
       public static String getFileContents(String filename) throws IOException {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +1 -1      xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/util.xsl
  
  Index: util.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/java/Attic/util.xsl,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- util.xsl	2000/12/27 18:43:04	1.1.2.2
  +++ util.xsl	2001/02/12 13:30:44	1.1.2.3
  @@ -133,7 +133,7 @@
         String __name = String.valueOf(<xsl:copy-of select="$href"/>);
   
         try {
  -          URL __url = new URL(__name);
  +          URL __url = ((org.apache.cocoon.components.url.URLFactory)manager.lookup(org.apache.cocoon.Roles.URL_FACTORY)).getURL(__name);
             InputSource __is = new InputSource(__url.openStream());
             __is.setSystemId(__url.toString());
             org.apache.cocoon.components.parser.Parser newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(Roles.PARSER);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +14 -2     xml-cocoon/src/org/apache/cocoon/generation/Attic/AbstractGenerator.java
  
  Index: AbstractGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/AbstractGenerator.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- AbstractGenerator.java	2001/02/11 19:13:19	1.1.2.7
  +++ AbstractGenerator.java	2001/02/12 13:30:44	1.1.2.8
  @@ -11,6 +11,7 @@
   import java.io.IOException;
   
   import org.apache.avalon.Parameters;
  +import org.apache.avalon.Recyclable;
   
   import org.apache.cocoon.xml.AbstractXMLProducer;
   import org.apache.cocoon.ProcessingException;
  @@ -22,10 +23,10 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/11 19:13:19 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/12 13:30:44 $
    */
   public abstract class AbstractGenerator extends AbstractXMLProducer
  -implements Generator {
  +implements Generator, Recyclable {
   
       /** The current <code>EntityResolver</code>. */
       protected EntityResolver resolver=null;
  @@ -47,4 +48,15 @@
           this.source=src;
           this.parameters=par;
       }
  +
  +    /**
  +     * Recycle the generator by removing references
  +     */
  +    public void recycle() {
  +        this.resolver = null;
  +        this.objectModel = null;
  +        this.source = null;
  +        this.parameters = null;
  +    }
  +
   }
  
  
  
  1.1.2.16  +9 -2      xml-cocoon/src/org/apache/cocoon/generation/Attic/DirectoryGenerator.java
  
  Index: DirectoryGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/DirectoryGenerator.java,v
  retrieving revision 1.1.2.15
  retrieving revision 1.1.2.16
  diff -u -r1.1.2.15 -r1.1.2.16
  --- DirectoryGenerator.java	2001/02/11 19:13:19	1.1.2.15
  +++ DirectoryGenerator.java	2001/02/12 13:30:44	1.1.2.16
  @@ -24,7 +24,9 @@
   import org.apache.avalon.Poolable;
   
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.Roles;
   import org.apache.cocoon.ResourceNotFoundException;
  +import org.apache.cocoon.components.url.URLFactory;
   
   /**
    * Generates an XML directory listing.
  @@ -59,7 +61,7 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/02/11 19:13:19 $ */
  + * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/02/12 13:30:44 $ */
   
   public class DirectoryGenerator extends ComposerGenerator implements Poolable {
   
  @@ -136,7 +138,12 @@
           File path;
   
           input = resolver.resolveEntity(null,super.source);
  -            url = new URL(input.getSystemId());
  +            try {
  +                url = ((URLFactory)manager.lookup(Roles.URL_FACTORY)).getURL(input.getSystemId());
  +            } catch (Exception e) {
  +                log.error("cannot obtain the URLFactory");
  +                throw new SAXException ("cannot obtain the URLFactory", e);
  +            }
               path = new File(url.getFile());
   
               if (!path.isDirectory()) {
  
  
  
  1.1.2.8   +3 -2      xml-cocoon/src/org/apache/cocoon/generation/Attic/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/HTMLGenerator.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- HTMLGenerator.java	2001/02/06 15:23:40	1.1.2.7
  +++ HTMLGenerator.java	2001/02/12 13:30:44	1.1.2.8
  @@ -9,6 +9,7 @@
   
   import org.apache.avalon.Poolable;
   import org.apache.cocoon.components.parser.Parser;
  +import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.ResourceNotFoundException;
   import org.apache.cocoon.Roles;
  @@ -28,7 +29,7 @@
   
   /**
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/06 15:23:40 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/12 13:30:44 $
    */
   public class HTMLGenerator extends ComposerGenerator implements Poolable {
       /**
  @@ -44,7 +45,7 @@
               tidy.setXHTML(true);
   
               // Extract the document using JTidy and stream it.
  -            URL url = new URL(this.source);
  +            URL url = ((URLFactory)manager.lookup(Roles.URL_FACTORY)).getURL(this.source);
               org.w3c.dom.Document doc = tidy.parseDOM(new BufferedInputStream(url.openStream()), null);
               DOMStreamer streamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
               streamer.stream(doc);
  
  
  
  1.1.2.14  +9 -2      xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- ServerPagesGenerator.java	2001/02/05 16:23:10	1.1.2.13
  +++ ServerPagesGenerator.java	2001/02/12 13:30:44	1.1.2.14
  @@ -24,6 +24,7 @@
   import org.apache.avalon.Poolable;
   
   import org.apache.cocoon.components.language.generator.ProgramGenerator;
  +import org.apache.cocoon.components.url.URLFactory;
   
   import java.io.IOException;
   import org.xml.sax.SAXException;
  @@ -38,7 +39,7 @@
    * delegating actual SAX event generation.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/02/05 16:23:10 $
  + * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/02/12 13:30:44 $
    */
   public class ServerPagesGenerator
     extends ServletGenerator
  @@ -106,7 +107,13 @@
   
       String systemId = inputSource.getSystemId();
   
  -    URL url = new URL(systemId);
  +    URL url = null;
  +    try {
  +        url = ((URLFactory)manager.lookup(Roles.URL_FACTORY)).getURL(systemId);
  +    } catch (Exception e) {
  +        log.error ("cannot obtain the URLFactory");
  +        throw new SAXException("cannot obtain the URLFactory", e);
  +    }
       if (!url.getProtocol().equals("file")) {
         throw new ResourceNotFoundException("Not a file: " + url.toString());
       }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.13  +23 -4     xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java
  
  Index: ResourceReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
  retrieving revision 1.1.2.12
  retrieving revision 1.1.2.13
  diff -u -r1.1.2.12 -r1.1.2.13
  --- ResourceReader.java	2001/02/05 16:23:14	1.1.2.12
  +++ ResourceReader.java	2001/02/12 13:30:45	1.1.2.13
  @@ -25,13 +25,18 @@
   import org.apache.cocoon.Cocoon;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.ResourceNotFoundException;
  +import org.apache.cocoon.Roles;
  +import org.apache.cocoon.components.url.URLFactory;
   
  +import org.apache.avalon.ComponentManager;
  +import org.apache.avalon.Composer;
  +
   import org.xml.sax.SAXException;
   
   /**
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/05 16:23:14 $
  + * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/02/12 13:30:45 $
    *
    * The <code>ResourceReader</code> component is used to serve binary data
    * in a sitemap pipeline. It makes use of HTTP Headers to determine if
  @@ -47,7 +52,13 @@
    *       </dd>
    *   </dl>
    */
  -public class ResourceReader extends AbstractReader {
  +public class ResourceReader extends AbstractReader implements Composer {
  +
  +    private ComponentManager manager;
  +
  +    public void compose (ComponentManager manager) {
  +        this.manager = manager;
  +    }
   
       /**
        * Generates the requested resource.
  @@ -55,6 +66,14 @@
       public void generate() throws IOException, ProcessingException {
           HttpServletRequest req = (HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT);
           HttpServletResponse res = (HttpServletResponse) objectModel.get(Cocoon.RESPONSE_OBJECT);
  +        URLFactory urlFactory = null;
  +
  +        try {
  +            urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
  +        } catch (Exception e) {
  +            log.error("cannot obtain the URLFactory", e);
  +            throw new ProcessingException ("cannot obtain the URLFactory");
  +        }
   
           if (res == null) {
              throw new ProcessingException ("Missing a Response object in the objectModel");
  @@ -71,7 +90,7 @@
           try {
               if(this.source.indexOf(":/") != -1) {
                   src = this.source;
  -                url = new URL (src);
  +                url = urlFactory.getURL (src);
                   conn = url.openConnection();
                   if (!modified (conn.getLastModified(), req, res)) {
                       return;
  @@ -80,7 +99,7 @@
                   is = conn.getInputStream();
               } else {
                   src = this.resolver.resolveEntity (null,this.source).getSystemId();
  -                url = new URL (src);
  +                url = urlFactory.getURL (src);
                   file = new File (url.getFile());
                   if (!modified (file.lastModified(), req, res)) {
                       return;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.9   +10 -3     xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSerializer.java
  
  Index: AbstractSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSerializer.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- AbstractSerializer.java	2000/09/27 16:15:33	1.1.2.8
  +++ AbstractSerializer.java	2001/02/12 13:30:45	1.1.2.9
  @@ -9,17 +9,17 @@
   package org.apache.cocoon.serialization;
   
   import java.io.OutputStream;
  -
  +import org.apache.avalon.Recyclable;
   import org.apache.cocoon.xml.AbstractXMLPipe;
   
   /**
    * @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.1.2.8 $ $Date: 2000/09/27 16:15:33 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/12 13:30:45 $
    */
    
  -public abstract class AbstractSerializer extends AbstractXMLPipe implements Serializer {
  +public abstract class AbstractSerializer extends AbstractXMLPipe implements Serializer, Recyclable {
   
       /**
        * The <code>OutputStream</code> used by this serializer.
  @@ -40,5 +40,12 @@
        */
       public String getMimeType() {
           return null;
  +    }
  +
  +    /**
  +     * Recycle serializer by removing references 
  +     */
  +    public void recycle() {
  +        this.output = null;
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.52  +18 -15    xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
  retrieving revision 1.1.4.51
  retrieving revision 1.1.4.52
  diff -u -r1.1.4.51 -r1.1.4.52
  --- CocoonServlet.java	2001/02/09 04:19:27	1.1.4.51
  +++ CocoonServlet.java	2001/02/12 13:30:45	1.1.4.52
  @@ -29,10 +29,12 @@
   
   import org.xml.sax.SAXException;
   
  -import org.apache.avalon.ConfigurationException;
   import org.apache.avalon.ComponentNotAccessibleException;
  +import org.apache.avalon.ConfigurationException;
  +import org.apache.avalon.DefaultContext;
   
   import org.apache.cocoon.Cocoon;
  +import org.apache.cocoon.Constants;
   import org.apache.cocoon.Notifier;
   import org.apache.cocoon.Notification;
   import org.apache.cocoon.ResourceNotFoundException;
  @@ -57,7 +59,7 @@
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.4.51 $ $Date: 2001/02/09 04:19:27 $
  + * @version CVS $Revision: 1.1.4.52 $ $Date: 2001/02/12 13:30:45 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -72,10 +74,10 @@
       private Cocoon cocoon;
       private URL configFile;
       private Exception exception;
  -    private ServletContext context;
  +    private ServletContext servletContext;
  +    private DefaultContext appContext = new DefaultContext();
       private String classpath;
       private File workDir;
  -    private String root;
       private RepositoryClassLoader classloader = new RepositoryClassLoader(new URL[] {}, this.getClass().getClassLoader());
   
       /**
  @@ -95,23 +97,23 @@
   
           super.init(conf);
   
  -        this.context = conf.getServletContext();
  +        this.servletContext = conf.getServletContext();
  +        this.appContext.put(Constants.CONTEXT_SERVLET_CONTEXT, this.servletContext);
   
  -        this.initLogger(conf.getInitParameter("log-level"), this.context);
  +        this.initLogger(conf.getInitParameter("log-level"), this.servletContext);
   
  -        this.setClassPath(this.context);
  +        this.setClassPath(this.servletContext);
   
           this.forceLoad(conf.getInitParameter("load-class"));
   
  -        this.workDir = (File) this.context.getAttribute("javax.servlet.context.tempdir");
  +        this.workDir = (File) this.servletContext.getAttribute("javax.servlet.context.tempdir");
   
  -        this.setConfigFile(conf.getInitParameter("configurations"), this.context);
  +        this.setConfigFile(conf.getInitParameter("configurations"), this.servletContext);
   
  -        this.root = this.context.getRealPath("/");
  +        this.appContext.put(Constants.CONTEXT_ROOT_PATH, this.servletContext.getRealPath("/"));
   
           ClassUtils.setClassLoader(this.classloader);
  -
  -        NetUtils.setContext(this.context);
  +        this.appContext.put(Constants.CONTEXT_CLASS_LOADER, this.classloader);
   
           this.createCocoon();
       }
  @@ -232,7 +234,7 @@
           log.debug("Using configuration file: " + usedFileName);
   
           try {
  -            this.configFile = this.context.getResource(usedFileName);
  +            this.configFile = this.servletContext.getResource(usedFileName);
           } catch (Exception mue) {
               log.error("Servlet initialization argument 'configurations' not found at " + usedFileName, mue);
               throw new ServletException("Servlet initialization argument 'configurations' not found at " + usedFileName);
  @@ -326,7 +328,7 @@
                   uri = uri.substring(1);
               }
   
  -            HttpEnvironment env = new HttpEnvironment(uri, req, res, this.context);
  +            HttpEnvironment env = new HttpEnvironment(uri, req, res, this.servletContext);
               env.setLogger(this.log);
   
               if (!this.cocoon.process(env)) {
  @@ -400,8 +402,9 @@
       private void createCocoon() {
           try {
               log.info("Reloading from: " + this.configFile.toExternalForm());
  -            Cocoon c = new Cocoon(this.configFile, this.classpath, this.workDir, this.root);
  +            Cocoon c = new Cocoon(this.configFile, this.classpath, this.workDir);
               c.setLogger(this.log);
  +            c.contextualize(this.appContext);
               c.init();
               this.creationTime = new Date().getTime();
               this.cocoon = c;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +10 -5     xml-cocoon/src/org/apache/cocoon/transformation/Attic/I18nTransformer.java
  
  Index: I18nTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/I18nTransformer.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- I18nTransformer.java	2001/01/23 13:38:48	1.1.2.4
  +++ I18nTransformer.java	2001/02/12 13:30:46	1.1.2.5
  @@ -11,7 +11,9 @@
   
   import org.apache.cocoon.Roles;
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.acting.LangSelect;
   import org.apache.cocoon.components.parser.Parser;
  +import org.apache.cocoon.components.url.URLFactory;
   
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.Composer;
  @@ -34,8 +36,6 @@
   import java.net.URL;
   import java.net.MalformedURLException;
   
  -import org.apache.cocoon.acting.LangSelect;
  -
   
   
   /**
  @@ -145,9 +145,14 @@
   
           String translations_file = parameters.getParameter("src", null);
   
  -        URL tr =
  -                new URL(resolver.resolveEntity(null,
  -                translations_file).getSystemId());
  +        URL tr = null;
  +        try {
  +            tr = ((URLFactory)manager.lookup(Roles.URL_FACTORY))
  +                .getURL(resolver.resolveEntity(null, translations_file).getSystemId());
  +        } catch (Exception e) {
  +            log.error("cannot obtain the URLFactory", e);
  +            throw new SAXException("cannot obtain the URLFactory", e);
  +        }
           initialiseDictionary(tr);
       }
   
  
  
  
  1.1.2.3   +2 -1      xml-cocoon/src/org/apache/cocoon/transformation/Attic/TraxTransformer.java
  
  Index: TraxTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/TraxTransformer.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- TraxTransformer.java	2001/02/09 13:17:35	1.1.2.2
  +++ TraxTransformer.java	2001/02/12 13:30:46	1.1.2.3
  @@ -58,7 +58,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/02/09 13:17:35 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/02/12 13:30:46 $
    */
   public class TraxTransformer extends ContentHandlerWrapper
   implements Transformer, Composer, Poolable, Recyclable, Configurable {
  @@ -286,6 +286,7 @@
           } catch (Exception e){
               log.debug("Exception in recycle:", e);
           }
  +        this.transformerHandler = null;
           super.recycle();    
       }
   }
  
  
  
  1.1.2.16  +13 -13    xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java
  
  Index: XIncludeTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java,v
  retrieving revision 1.1.2.15
  retrieving revision 1.1.2.16
  diff -u -r1.1.2.15 -r1.1.2.16
  --- XIncludeTransformer.java	2001/01/22 21:56:51	1.1.2.15
  +++ XIncludeTransformer.java	2001/02/12 13:30:46	1.1.2.16
  @@ -31,6 +31,7 @@
   import org.apache.cocoon.Roles;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.parser.Parser;
  +import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.xml.dom.DOMBuilder;
   import org.apache.cocoon.xml.dom.DOMStreamer;
   import org.apache.xpath.XPathAPI;
  @@ -48,11 +49,11 @@
    * by the SAX event FSM yet.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
  - * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/01/22 21:56:51 $ $Author: bloritsch $
  + * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/02/12 13:30:46 $ $Author: giacomo $
    */
   public class XIncludeTransformer extends AbstractTransformer implements Composer, Loggable {
   
  -    protected Logger log;
  +    protected URLFactory urlFactory;
   
       protected ComponentManager manager = null;
   
  @@ -82,19 +83,13 @@
   
       protected Stack xmlbase_element_name_stack = new Stack();
   
  -    public void setLogger(Logger logger) {
  -        if (this.log == null) {
  -            this.log = logger;
  -        }
  -    }
  -
       public void setup(EntityResolver resolver, Map objectModel,
                         String source, Parameters parameters)
               throws ProcessingException, SAXException, IOException {}
       /*
           try {
               log.debug("SOURCE: "+source);
  -            base_xmlbase_uri = new URL(source);
  +            base_xmlbase_uri = urlFactory.getURL(source);
               log.debug("SOURCE URI: "+base_xmlbase_uri.toString());
           } catch (MalformedURLException e) {
               log.debug("XincludeTransformer", e);
  @@ -105,6 +100,11 @@
   
       public void compose(ComponentManager manager) {
           this.manager = manager;
  +        try {
  +            this.urlFactory = (URLFactory)this.manager.lookup(Roles.URL_FACTORY);
  +        } catch (Exception e) {
  +            log.error("cannot obtain URLFactory", e);
  +        }
       }
   
       public void startElement(String uri, String name, String raw, Attributes attr) throws SAXException {
  @@ -146,7 +146,7 @@
   
       public void setDocumentLocator(Locator locator) {
           try {
  -            base_xmlbase_uri = new URL(locator.getSystemId());
  +            base_xmlbase_uri = urlFactory.getURL(locator.getSystemId());
               if (current_xmlbase_uri == null) {
                   current_xmlbase_uri = base_xmlbase_uri;
               }
  @@ -158,7 +158,7 @@
           if (current_xmlbase_uri != null) {
               xmlbase_stack.push(current_xmlbase_uri);
           }
  -        current_xmlbase_uri = new URL(value);
  +        current_xmlbase_uri = urlFactory.getURL(value);
   
           xmlbase_element_uri_stack.push(last_xmlbase_element_uri);
           last_xmlbase_element_uri = uri;
  @@ -183,10 +183,10 @@
           String suffix;
           int index = href.indexOf('#');
           if (index < 0) {
  -            url = new URL(current_xmlbase_uri,href);
  +            url = urlFactory.getURL(current_xmlbase_uri,href);
               suffix = "";
           } else {
  -            url = new URL(current_xmlbase_uri,href.substring(0,index));
  +            url = urlFactory.getURL(current_xmlbase_uri,href.substring(0,index));
               suffix = href.substring(index+1);
           }
           log.debug("URL: "+url+"\nSuffix: "+suffix);
  
  
  
  1.1.2.10  +21 -3     xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java
  
  Index: XTTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- XTTransformer.java	2001/01/22 21:56:51	1.1.2.9
  +++ XTTransformer.java	2001/02/12 13:30:46	1.1.2.10
  @@ -30,6 +30,7 @@
   import org.apache.cocoon.xml.DocumentHandlerWrapper;
   import org.apache.cocoon.transformation.Transformer;
   import org.apache.cocoon.components.store.Store;
  +import org.apache.cocoon.components.url.URLFactory;
   
   import org.xml.sax.ContentHandler;
   import org.xml.sax.Locator;
  @@ -70,12 +71,15 @@
    * This Transformer use the XT processor.
    *
    * @author <a href="mailto:ssahuc@imediation.com">Sahuc Sebastien</a>
  - * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/01/22 21:56:51 $
  + * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/12 13:30:46 $
    */
   public class XTTransformer extends DocumentHandlerWrapper
   implements Transformer, Composer, Loggable {
       private Logger log;
   
  +    /** The component manager */
  +    private ComponentManager manager = null;
  +
       /** The store service instance */
       private Store store = null;
   
  @@ -96,6 +100,8 @@
        * <code>Composer</code>.
        */
       public void compose(ComponentManager manager) {
  +        this.manager = manager;
  +
           try {
               log.debug("Looking up " + Roles.STORE);
               this.store = (Store) manager.lookup(Roles.STORE);
  @@ -131,6 +137,7 @@
           if (store != null) {
               loaderprocessor = (XTProcessor) store.get(xsluri);
               loaderprocessor.setLogger(this.log);
  +            loaderprocessor.compose(this.manager);
           }
   
           // If not in the store or if style sheet has changed, loads and stores it
  @@ -276,7 +283,7 @@
     * The XT processor.
     */
   
  -class XTProcessor implements Cloneable, ParameterSet, Modifiable, Loggable {
  +class XTProcessor implements Cloneable, ParameterSet, Modifiable, Loggable, Composer {
   
       protected Logger log;
       private XMLProcessorEx sheetLoader;
  @@ -290,6 +297,7 @@
       private HashMap params = new HashMap();
       private File xslFile;
       private long lastModified;
  +    private ComponentManager manager;
   
       public void setLogger(Logger logger) {
           if (this.log == null) {
  @@ -297,6 +305,10 @@
           }
       }
   
  +    public void compose(ComponentManager manager) {
  +        this.manager = manager;
  +    }
  +
       /**
       * set the Parser that will parse the XSL style sheet
       */
  @@ -330,7 +342,13 @@
       */
       public void loadStylesheet(InputSource sheetSource) throws SAXException, IOException {
           // Set the xslFile for the caching mechanism
  -        URL url = new URL (sheetSource.getSystemId());
  +        URL url = null;
  +        try {
  +            url = ((URLFactory)this.manager.lookup(Roles.URL_FACTORY)).getURL(sheetSource.getSystemId());
  +        } catch (Exception e) {
  +            log.error("cannot obtain the URLFactory", e);
  +            throw new SAXException ("cannot obtain the URLFactory", e);
  +        }
           this.xslFile = new File(url.getFile());
           lastModified = xslFile.lastModified();
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +1 -65     xml-cocoon/src/org/apache/cocoon/util/Attic/NetUtils.java
  
  Index: NetUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/NetUtils.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- NetUtils.java	2001/02/01 21:22:25	1.1.2.7
  +++ NetUtils.java	2001/02/12 13:30:47	1.1.2.8
  @@ -12,7 +12,6 @@
   import java.util.Map;
   import java.net.URL;
   import java.net.MalformedURLException;
  -import javax.servlet.ServletContext;
   import org.apache.log.LogKit;
   
   /**
  @@ -20,68 +19,12 @@
    * utility methods
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/01 21:22:25 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/12 13:30:47 $
    */
   
   public class NetUtils {
  -    /** The root directory for relative resolution */
  -    private static File root = null;
   
       /**
  -     * This is a write once function that Cocoon uses to register the
  -     * root directory.
  -     */
  -    public static void setRoot(File directory) {
  -        if (NetUtils.root == null) {
  -            NetUtils.root = directory;
  -        }
  -    }
  -
  -    /** Temporary Hack until the protocols are actually working */
  -    private static ServletContext context = null;
  -
  -    public static void setContext(ServletContext context) {
  -        if (NetUtils.context == null) {
  -            NetUtils.context = context;
  -        }
  -
  -        org.apache.cocoon.util.url.context.Handler.setContext(context);
  -    }
  -
  -    /**
  -     * Create a URL from a location. This method supports the
  -     * <i>resource://</i> pseudo-protocol for loading resources
  -     * accessible to this same class' <code>ClassLoader</code>
  -     *
  -     * @param location The location
  -     * @return The URL pointed to by the location
  -     * @exception MalformedURLException If the location is malformed
  -     */
  -    public static URL getURL(String location) throws MalformedURLException {
  -        if (location.startsWith("resource://")) {
  -            URL u = ClassUtils.getResource(location.substring("resource://".length()));
  -            if (u != null) return u;
  -            else throw new RuntimeException(location + " could not be found. (possible classloader problem)");
  -        } else if (location.startsWith("context://")) {
  -            URL u = NetUtils.context.getResource(location.substring("context://".length()));
  -            if (u != null) return u;
  -            else throw new RuntimeException(location + " could not be found. (possible classloader problem)");
  -        }
  -
  -        try {
  -            return new URL(location);
  -        } catch (MalformedURLException mue) {
  -            LogKit.getLoggerFor("cocoon").debug("Making URL a File relative to context root", mue);
  -
  -            if (NetUtils.root != null) {
  -                return (new File(NetUtils.root, location)).toURL();
  -            }
  -
  -            return (new File(location)).toURL();
  -        }
  -    }
  -
  -    /**
        * Returns the path of the given resource.
        *
        * @path the resource
  @@ -246,12 +189,5 @@
               parameters.put(name, value);
           }
           return uri.substring(0, i);
  -    }
  -
  -    public static void main(String[] args) {
  -        String absoluteURI = absolutize(args[0], args[1]);
  -        String normalizedURI = normalize(absoluteURI);
  -        String relativeURI = relativize(args[0], normalizedURI);
  -        System.out.println(absoluteURI + " --> " + normalizedURI + " --> " + relativeURI);
       }
   }
  
  
  
  1.1.2.5   +3 -1      xml-cocoon/src/org/apache/cocoon/util/Attic/RoleUtils.java
  
  Index: RoleUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/RoleUtils.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- RoleUtils.java	2001/02/08 12:24:22	1.1.2.4
  +++ RoleUtils.java	2001/02/12 13:30:47	1.1.2.5
  @@ -19,7 +19,7 @@
    * role aliases and the real Avalon role names.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/02/08 12:24:22 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/02/12 13:30:47 $
    */
   
   public class RoleUtils {
  @@ -41,6 +41,7 @@
           setup.put("pool-controller", Roles.POOL_CONTROLLER);
           setup.put("image-encoder", Roles.IMAGE_ENCODER);
           setup.put("datasources", Roles.DB_CONNECTION);
  +        setup.put("url-factory", Roles.URL_FACTORY);
   
           shorthand = Collections.unmodifiableMap(setup);
   
  @@ -54,6 +55,7 @@
           setup.put(Roles.PROGRAM_GENERATOR, "org.apache.cocoon.components.language.generator.ProgramGeneratorImpl");
           setup.put(Roles.DB_CONNECTION, "org.apache.cocoon.CocoonComponentSelector");
           setup.put(Roles.POOL_CONTROLLER, "org.apache.cocoon.util.ComponentPoolController");
  +        setup.put(Roles.URL_FACTORY, "org.apache.cocoon.components.url.URLFactoryImpl");
   
           classname = Collections.unmodifiableMap(setup);
       }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +11 -2     xml-cocoon/src/org/apache/cocoon/xml/Attic/AbstractXMLProducer.java
  
  Index: AbstractXMLProducer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/AbstractXMLProducer.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- AbstractXMLProducer.java	2001/01/22 21:56:54	1.1.2.7
  +++ AbstractXMLProducer.java	2001/02/12 13:30:47	1.1.2.8
  @@ -12,6 +12,7 @@
   
   import org.apache.avalon.Loggable;
   import org.apache.log.Logger;
  +import org.apache.avalon.Recyclable;
   
   /**
    * This abstract class provides default implementation of the methods specified
  @@ -19,9 +20,9 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/01/22 21:56:54 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/12 13:30:47 $
    */
  -public abstract class AbstractXMLProducer implements XMLProducer, Loggable {
  +public abstract class AbstractXMLProducer implements XMLProducer, Loggable, Recyclable {
   
       protected Logger log;
   
  @@ -70,5 +71,13 @@
        */
       public void setLexicalHandler(LexicalHandler handler) {
           this.lexicalHandler = handler;
  +    }
  +
  +    /**
  +     * Recycle the producer by removing references
  +     */
  +    public void recycle() {
  +        this.contentHandler = null;
  +        this.lexicalHandler = null;
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.22  +13 -8     xml-cocoon/webapp/Attic/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/webapp/Attic/cocoon.xconf,v
  retrieving revision 1.1.2.21
  retrieving revision 1.1.2.22
  diff -u -r1.1.2.21 -r1.1.2.22
  --- cocoon.xconf	2001/02/11 21:08:52	1.1.2.21
  +++ cocoon.xconf	2001/02/12 13:30:48	1.1.2.22
  @@ -6,6 +6,11 @@
     <parser class="org.apache.cocoon.components.parser.JaxpParser"/>
     <store class="org.apache.cocoon.components.store.MemoryStore"/>
   
  +  <url-factory>
  +    <protocol name="resource" class="org.apache.cocoon.components.url.ResourceURLFactory"/>
  +    <protocol name="context"  class="org.apache.cocoon.components.url.ContextURLFactory"/>
  +  </url-factory>
  +
     <programming-languages>
       <component-instance name="java" class="org.apache.cocoon.components.language.programming.java.JavaLanguage">
         <parameter name="compiler" value="org.apache.cocoon.components.language.programming.java.Javac"/>
  @@ -34,15 +39,15 @@
             <parameter name="prefix" value="xsp-response"/>
             <parameter name="uri" value="http://apache.org/xsp/response"/>
             <parameter name="href" value="resource://org/apache/cocoon/components/language/markup/xsp/java/response.xsl"/>
  +        </builtin-logicsheet>
  +
  +        <builtin-logicsheet>
  +          <parameter name="prefix" value="session"/>
  +          <parameter name="uri" value="http://apache.org/xsp/session"/>
  +          <parameter name="href" value="resource://org/apache/cocoon/components/language/markup/xsp/java/session.xsl"/>
           </builtin-logicsheet>
  -<!--
  -		<builtin-logicsheet>
  -	  	  <parameter name="prefix" value="session"/>
  -	  	  <parameter name="uri" value="http://apache.org/xsp/session"/>
  -	  	  <parameter name="href" value="resource://org/apache/cocoon/components/language/markup/xsp/java/session.xsl"/>
  -		</builtin-logicsheet>
  --->
  -   		<builtin-logicsheet>
  +
  +        <builtin-logicsheet>
             <parameter name="prefix" value="esql"/>
             <parameter name="uri" value="http://apache.org/cocoon/SQL/v2"/>
             <parameter name="href" value="resource://org/apache/cocoon/components/language/markup/xsp/java/esql.xsl"/>
  
  
  

Mime
View raw message