cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/environment AbstractEnvironment.java Environment.java
Date Mon, 03 Mar 2003 21:25:18 GMT
cziegeler    2003/03/03 13:25:18

  Modified:    src/java/org/apache/cocoon Cocoon.java
               src/java/org/apache/cocoon/environment/wrapper
                        EnvironmentWrapper.java
               src/java/org/apache/cocoon/components
                        CocoonComponentManager.java
               src/java/org/apache/cocoon/environment
                        AbstractEnvironment.java Environment.java
  Log:
  Finished refactoring - now we can polish everything and fix remaining problems
  
  Revision  Changes    Path
  1.54      +1 -2      xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- Cocoon.java	3 Mar 2003 18:39:35 -0000	1.53
  +++ Cocoon.java	3 Mar 2003 21:25:18 -0000	1.54
  @@ -584,7 +584,6 @@
               throw new IllegalStateException("You cannot process a Disposed Cocoon engine.");
           }
   
  -        environment.setComponents( this.sourceResolver, this.xmlizer );
           Object key = CocoonComponentManager.startProcessing(environment);
           try {
               CocoonComponentManager.enterEnvironment(environment,
  
  
  
  1.29      +2 -2      xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
  
  Index: EnvironmentWrapper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- EnvironmentWrapper.java	3 Mar 2003 18:39:35 -0000	1.28
  +++ EnvironmentWrapper.java	3 Mar 2003 21:25:18 -0000	1.29
  @@ -146,7 +146,7 @@
                                 boolean          rawMode)
       throws MalformedURLException {
           super(env.getURI(), env.getView(), env.getRootContext(), env.getAction());
  -        this.setComponents(env.getSourceResolver(), env.getXMLizer());
  +
           this.enableLogging(logger);
           this.environment = env;
   
  
  
  
  1.49      +3 -1      xml-cocoon2/src/java/org/apache/cocoon/components/CocoonComponentManager.java
  
  Index: CocoonComponentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/CocoonComponentManager.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- CocoonComponentManager.java	3 Mar 2003 18:39:36 -0000	1.48
  +++ CocoonComponentManager.java	3 Mar 2003 21:25:18 -0000	1.49
  @@ -174,6 +174,7 @@
       public static Object startProcessing(Environment env) {
           EnvironmentDescription desc = new EnvironmentDescription(env);
           env.getObjectModel().put(PROCESS_KEY, desc);
  +		env.startingProcessing();
           return desc;
       }
       
  @@ -185,6 +186,7 @@
        *         {@link #startProcessing(Environment)}.
        */
       public static void endProcessing(Environment env, Object key) {
  +		env.finishingProcessing();
           EnvironmentDescription desc = (EnvironmentDescription)key;
           desc.release();
           env.getObjectModel().remove(PROCESS_KEY);
  
  
  
  1.45      +38 -25    xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- AbstractEnvironment.java	3 Mar 2003 18:39:36 -0000	1.44
  +++ AbstractEnvironment.java	3 Mar 2003 21:25:18 -0000	1.45
  @@ -52,9 +52,14 @@
   
   import org.apache.commons.collections.IteratorEnumeration;
   
  +import org.apache.avalon.framework.CascadingRuntimeException;
  +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.logger.AbstractLogEnabled;
   
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.components.CocoonComponentManager;
   import org.apache.cocoon.components.source.SourceUtil;
   import org.apache.cocoon.util.BufferedOutputStream;
   
  @@ -110,6 +115,9 @@
       /** The real xmlizer */
       protected org.apache.excalibur.xmlizer.XMLizer xmlizer;
   
  +    /** The component manager */
  +    protected ComponentManager manager;
  +    
       /** The attributes */
       private Map attributes = new HashMap();
   
  @@ -164,30 +172,6 @@
           this.rootContext = context;
       }
   
  -    /**
  -     * Set the <code>SourceResolver</code> and the <code>XMLizer</code>
  -     */
  -    public void setComponents(org.apache.excalibur.source.SourceResolver resolver,
  -                              XMLizer xmlizer) {
  -        this.xmlizer = xmlizer;
  -        this.sourceResolver = resolver;
  -    }
  -
  -    /**
  -     * Get the <code>SourceResolver</code>
  -     */
  -    public org.apache.excalibur.source.SourceResolver getSourceResolver() {
  -        return this.sourceResolver;
  -    }
  -
  -    /**
  -     * Get the <code>XMLizer</code>
  -     * This is an internal method, use it at your own risk!
  -     */
  -    public XMLizer getXMLizer() {
  -        return this.xmlizer;
  -    }
  -
       // Sitemap methods
   
       /**
  @@ -543,4 +527,33 @@
               throw e;
           }
       }
  +    
  +	/**
  +	 * Notify that the processing starts.
  +	 */
  +	public void startingProcessing() {
  +		try {
  +			this.manager = CocoonComponentManager.getSitemapComponentManager();
  +			this.xmlizer = (XMLizer)this.manager.lookup(XMLizer.ROLE);
  +			this.sourceResolver = (org.apache.excalibur.source.SourceResolver)this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE);
  +		} catch (ComponentException ce) {
  +			// this should never happen!
  +			throw new CascadingRuntimeException("Unable to lookup component.", ce);
  +		}
  +	}
  +    
  +	/**
  +	 * Notify that the processing is finished
  +	 * This can be used to cleanup the environment object
  +	 */
  +	public void finishingProcessing() {
  +		if ( null != this.manager ) {
  +			this.manager.release( (Component)this.xmlizer );
  +			this.manager.release( this.sourceResolver );
  +			this.manager = null;
  +			this.xmlizer = null;
  +			this.sourceResolver = null;
  +		}
  +	}
  +    
   }
  
  
  
  1.21      +11 -22    xml-cocoon2/src/java/org/apache/cocoon/environment/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/Environment.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Environment.java	3 Mar 2003 18:39:36 -0000	1.20
  +++ Environment.java	3 Mar 2003 21:25:18 -0000	1.21
  @@ -56,8 +56,6 @@
   import java.util.Enumeration;
   import java.util.Map;
   
  -import org.apache.excalibur.xmlizer.XMLizer;
  -
   /**
    * Base interface for an environment abstraction
    *
  @@ -70,25 +68,6 @@
       extends SourceResolver {
   
       /**
  -     * Set the <code>SourceResolver</code> and the <code>XMLizer</code>
  -     * This is an internal method, use it at your own risk!
  -     */
  -    void setComponents(org.apache.excalibur.source.SourceResolver resolver,
  -                       XMLizer xmlizer);
  -
  -    /**
  -     * Get the <code>SourceResolver</code>
  -     * This is an internal method, use it at your own risk!
  -     */
  -    org.apache.excalibur.source.SourceResolver getSourceResolver();
  -
  -    /**
  -     * Get the <code>XMLizer</code>
  -     * This is an internal method, use it at your own risk!
  -     */
  -    XMLizer getXMLizer();
  -
  -    /**
        * Get the URI to process. The prefix is stripped off.
        */
       String getURI();
  @@ -244,5 +223,15 @@
        */
       void commitResponse() throws IOException;
       
  +    /**
  +     * Notify that the processing starts.
  +     */
  +    void startingProcessing();
  +    
  +    /**
  +     * Notify that the processing is finished
  +     * This can be used to cleanup the environment object
  +     */
  +    void finishingProcessing();
   }
   
  
  
  

Mime
View raw message