cziegeler    2003/01/09 03:27:59

  Modified:    src/java/org/apache/cocoon/components/pipeline
                        ProcessingPipeline.java
                        AbstractProcessingPipeline.java
               src/java/org/apache/cocoon/components/source/impl
                        SitemapSource.java
               src/java/org/apache/cocoon Cocoon.java
  Log:
  Caching now works again, if internal requests are aggregated
  
  Revision  Changes    Path
  1.13      +10 -1     
xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java
  
  Index: ProcessingPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ProcessingPipeline.java   5 Dec 2002 10:10:45 -0000       1.12
  +++ ProcessingPipeline.java   9 Jan 2003 11:27:59 -0000       1.13
  @@ -160,8 +160,17 @@
       throws ProcessingException;
   
       /**
  +     * Prepare an internal processing
  +     * @param environment          The current environment.
  +     * @throws ProcessingException
  +     */
  +    void prepareInternal(Environment environment)
  +    throws ProcessingException;
  +
  +    /**
        * Process the given <code>Environment</code>, but do not use the
        * serializer. Instead the sax events are streamed to the XMLConsumer.
  +     * Make sure to call {@link #prepareInternal(Environment) beforehand.
        */
       boolean process(Environment environment, XMLConsumer consumer)
       throws ProcessingException;
  
  
  
  1.26      +35 -14    
xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
  
  Index: AbstractProcessingPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AbstractProcessingPipeline.java   5 Dec 2002 10:10:45 -0000       1.25
  +++ AbstractProcessingPipeline.java   9 Jan 2003 11:27:59 -0000       1.26
  @@ -460,6 +460,24 @@
        */
       public boolean process(Environment environment)
       throws ProcessingException {
  +        this.preparePipeline(environment);
  +        if ( this.reader != null ) {
  +            if (this.checkLastModified( environment )) {
  +                return true;
  +            }
  +
  +            return this.processReader(environment);
  +        } else {
  +            this.connectPipeline(environment);
  +            return this.processXMLPipeline(environment);
  +        }
  +    }
  +
  +    /**
  +     * Prepare the pipeline 
  +     */
  +    protected void preparePipeline(Environment environment)
  +    throws ProcessingException {
           if ( !checkPipeline() ) {
               throw new ProcessingException("Attempted to process incomplete 
pipeline.");
           }
  @@ -473,18 +491,22 @@
           }
           if ( this.reader != null ) {
               this.setupReader( environment );
  -            if (this.checkLastModified( environment )) {
  -                return true;
  -            }
  -
  -            return this.processReader(environment);
           } else {
               this.setupPipeline(environment);
  -            this.connectPipeline(environment);
  -            return this.processXMLPipeline(environment);
           }
       }
  -
  +    
  +    /**
  +     * Prepare an internal processing
  +     * @param environment          The current environment.
  +     * @throws ProcessingException
  +     */
  +    public void prepareInternal(Environment environment)
  +    throws ProcessingException {
  +        this.lastConsumer = null;
  +        this.preparePipeline(environment);
  +    }
  +    
       /**
        * Process the SAX event pipeline
        */
  @@ -640,15 +662,14 @@
        */
       public boolean process(Environment environment, XMLConsumer consumer)
       throws ProcessingException {
  -        if ( !checkPipeline() ) {
  -            throw new ProcessingException("Attempted to process incomplete 
pipeline.");
  -        }
  +        this.lastConsumer = consumer;
           if ( this.reader != null ) {
               // FIXME (CZ) We *could* use the xmlizer here...but does this make 
sense?!?
               throw new ProcessingException("Streaming of pipeline is not possible 
with a reader.");
  +        } else {
  +            this.connectPipeline(environment);
  +            return this.processXMLPipeline(environment);
           }
  -        this.lastConsumer = consumer;
  -        return this.process( environment );
       }
   
       /**
  
  
  
  1.32      +2 -1      
xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
  
  Index: SitemapSource.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- SitemapSource.java        9 Jan 2003 10:34:29 -0000       1.31
  +++ SitemapSource.java        9 Jan 2003 11:27:59 -0000       1.32
  @@ -336,6 +336,7 @@
               this.processKey = 
CocoonComponentManager.startProcessing(this.environment);
               this.environment.setURI(this.prefix, this.uri);
               this.processingPipeline = 
this.processor.processInternal(this.environment);
  +            this.processingPipeline.prepareInternal(this.environment);
               this.pipelineProcessor = this.environment.changeToLastContext();
               String redirectURL = this.environment.getRedirectURL();
               if (redirectURL == null) {
  
  
  
  1.44      +5 -1      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.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Cocoon.java       4 Dec 2002 09:48:40 -0000       1.43
  +++ Cocoon.java       9 Jan 2003 11:27:59 -0000       1.44
  @@ -586,6 +586,9 @@
           environment.setComponents( this.sourceResolver, this.xmlizer );
           Object key = CocoonComponentManager.startProcessing(environment);
           try {
  +            CocoonComponentManager.enterEnvironment(environment,
  +                                                    environment.getObjectModel(),
  +                                                    this);
               boolean result;
               if (this.getLogger().isDebugEnabled()) {
                   ++activeRequestCount;
  @@ -611,6 +614,7 @@
               environment.tryResetResponse();
               throw any;
           } finally {
  +            CocoonComponentManager.leaveEnvironment();
               CocoonComponentManager.endProcessing(environment, key);
               if (this.getLogger().isDebugEnabled()) {
                   --activeRequestCount;
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to