cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/impl AbstractCachingProcessingPipeline.java
Date Wed, 15 Oct 2003 18:03:53 GMT
cziegeler    2003/10/15 11:03:53

  Modified:    src/java/org/apache/cocoon/environment
                        AbstractEnvironment.java SourceResolver.java
                        Environment.java
               src/java/org/apache/cocoon/components/treeprocessor
                        TreeProcessor.java
               .        build.properties
               src/java/org/apache/cocoon/generation
                        AbstractServerPage.java
               src/java/org/apache/cocoon/components/pipeline
                        AbstractProcessingPipeline.java
               src/java/org/apache/cocoon/components/pipeline/impl
                        AbstractCachingProcessingPipeline.java
  Removed:     src/deprecated/java/org/apache/cocoon/matching
                        WildcardParameterValueMatcher.java
                        RequestParamMatcher.java
                        RegexpTargetHostMatcher.java
               src/deprecated/java/org/apache/cocoon/environment
                        ModifiableSource.java WriteableSource.java
                        URLFactorySourceResolver.java
               src/deprecated/java/org/apache/cocoon/caching
                        NOPCacheValidity.java ParametersCacheValidity.java
                        AggregatedCacheValidity.java
                        DeltaTimeCacheValidity.java
                        CompositeCacheValidity.java
                        IncludeCacheValidity.java CachedEventObject.java
                        TimeStampCacheValidity.java CachedStreamObject.java
               src/deprecated/java/org/apache/cocoon/components/source
                        SourceFactory.java
                        AbstractStreamWriteableSource.java
                        CocoonSourceFactory.java FileSource.java
                        SourceHandler.java DelayedRefreshSourceWrapper.java
                        AbstractStreamSource.java AbstractSAXSource.java
                        FileSourceFactory.java SitemapSource.java
                        SourceHandlerImpl.java URLSource.java
               src/deprecated/java/org/apache/cocoon/components/parser
                        JaxpParser.java XercesParser.java Parser.java
                        PooledJaxpParser.java
               src/deprecated/java/org/apache/cocoon/components/xslt
                        XSLTProcessorImpl.java XSLTProcessor.java
               src/deprecated/java/org/apache/cocoon/components/resolver
                        Resolver.java ResolverImpl.java
               src/java/org/apache/cocoon/environment Source.java
               src/deprecated/java/org/apache/cocoon/components/source/impl
                        AvalonToCocoonSourceInvocationHandler.java
                        AvalonToCocoonSource.java SourceFactoryWrapper.java
                        CocoonToAvalonSource.java URLFactoryWrapper.java
               src/deprecated/java/org/apache/cocoon/components/store
                        JispFilesystemStore.java StoreJanitorImpl.java
                        MRUMemoryStore.java Store.java MemoryStore.java
                        JispStringKey.java FilesystemStore.java
                        StoreJanitor.java
               src/deprecated/java/org/apache/cocoon/selection
                        SessionStateSelector.java RequestSelector.java
               src/java/org/apache/cocoon/caching Cacheable.java
                        CacheValidityToSourceValidity.java
                        CacheValidity.java SourceCacheValidity.java
               src/deprecated/java/org/apache/cocoon/components/url
                        URLFactoryImpl.java URLFactory.java
                        ContextURLFactory.java ResourceURLFactory.java
               src/deprecated/java/org/apache/cocoon/xml XMLizable.java
               src/deprecated/conf deprecated.xconf deprecated.xroles
               src/deprecated/java/org/apache/cocoon/transformation
                        CachingCIncludeTransformer.java
               src/deprecated/java/org/apache/cocoon/components/treeprocessor
                        MapStackResolver.java
               src/deprecated/java/org/apache/cocoon/matching/helpers
                        WildcardURIMatcher.java
  Log:
  Syncing
  
  Revision  Changes    Path
  1.17      +4 -90     cocoon-2.2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AbstractEnvironment.java	18 Sep 2003 14:40:25 -0000	1.16
  +++ AbstractEnvironment.java	15 Oct 2003 18:03:52 -0000	1.17
  @@ -63,14 +63,10 @@
   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;
  -import org.apache.cocoon.util.ClassUtils;
   import org.apache.commons.collections.iterators.IteratorEnumeration;
  -import org.apache.excalibur.source.SourceException;
  -import org.xml.sax.SAXException;
   
   /**
    * Base class for any environment
  @@ -80,7 +76,9 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Id$
    */
  -public abstract class AbstractEnvironment extends AbstractLogEnabled implements Environment
{
  +public abstract class AbstractEnvironment 
  +    extends AbstractLogEnabled 
  +    implements Environment {
   
       /** The current uri in progress */
       protected String uris;
  @@ -345,59 +343,6 @@
       }
   
       /**
  -     * Resolve an entity.
  -     * @deprecated Use the resolveURI methods instead
  -     */
  -    public Source resolve(String systemId)
  -    throws ProcessingException, SAXException, IOException {
  -        if ( !this.initializedComponents) {
  -            this.initComponents();
  -        }
  -        if (getLogger().isDebugEnabled()) {
  -            this.getLogger().debug("Resolving '"+systemId+"' in context '" + this.context
+ "'");
  -        }
  -        if (systemId == null) throw new SAXException("Invalid System ID");
  -
  -        // get the wrapper class - we don't want to import the wrapper directly
  -        // to avoid a direct dependency from the core to the deprecation package
  -        Class clazz;
  -        try {
  -            clazz = ClassUtils.loadClass("org.apache.cocoon.components.source.impl.AvalonToCocoonSourceInvocationHandler");
  -        } catch (Exception e) {
  -            throw new ProcessingException("The deprecated resolve() method of the environment
was called."
  -                                          +"Please either update your code to use the new
resolveURI() method or"
  -                                          +" install the deprecation support.", e);
  -        }
  -        if ( null == avalonToCocoonSourceWrapper ) {
  -            synchronized (this.getClass()) {
  -                try {
  -                    avalonToCocoonSourceWrapper = clazz.getDeclaredMethod("createProxy",
  -                           new Class[] {ClassUtils.loadClass("org.apache.excalibur.source.Source"),
  -                                        ClassUtils.loadClass("org.apache.excalibur.source.SourceResolver"),
  -                                        ClassUtils.loadClass(Environment.class.getName()),
  -                                        ClassUtils.loadClass(ComponentManager.class.getName())});
  -                } catch (Exception e) {
  -                    throw new ProcessingException("The deprecated resolve() method of the
environment was called."
  -                                                  +"Please either update your code to use
the new resolveURI() method or"
  -                                                  +" install the deprecation support.",
e);
  -                }
  -            }
  -           
  -        }
  -        try {
  -            org.apache.excalibur.source.Source source = this.resolveURI( systemId );
  -            Source wrappedSource;
  -            wrappedSource = (Source)avalonToCocoonSourceWrapper.invoke(clazz,
  -                        new Object[] {source, this.sourceResolver, this, this.manager});
  -            return wrappedSource;
  -        } catch (SourceException se) {
  -            throw SourceUtil.handle(se);
  -        } catch (Exception e) {
  -            throw new ProcessingException("Unable to create source wrapper.", e);
  -        }
  -    }
  -
  -    /**
        * Check if the response has been modified since the same
        * "resource" was requested.
        * The caller has to test if it is really the same "resource"
  @@ -488,37 +433,6 @@
               this.secureOutputStream.realFlush();
           } else if ( this.outputStream != null ){
               this.outputStream.flush();
  -        }
  -    }
  -
  -    /**
  -     * Get a <code>Source</code> object.
  -     */
  -    public org.apache.excalibur.source.Source resolveURI(final String location)
  -    throws MalformedURLException, IOException, SourceException
  -    {
  -        return this.resolveURI(location, null, null);
  -    }
  -
  -    /**
  -     * Get a <code>Source</code> object.
  -     */
  -    public org.apache.excalibur.source.Source resolveURI(final String location,
  -                                                         String baseURI,
  -                                                         final Map    parameters)
  -    throws MalformedURLException, IOException, SourceException {
  -        if ( !this.initializedComponents) {
  -            this.initComponents();
  -        }
  -        return this.sourceResolver.resolveURI(location, baseURI, parameters);
  -    }
  -
  -    /**
  -     * Releases a resolved resource
  -     */
  -    public void release( final org.apache.excalibur.source.Source source ) {
  -        if ( null != source ) {
  -            this.sourceResolver.release( source );
           }
       }
   
  
  
  
  1.3       +1 -15     cocoon-2.2/src/java/org/apache/cocoon/environment/SourceResolver.java
  
  Index: SourceResolver.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/environment/SourceResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SourceResolver.java	16 May 2003 07:04:55 -0000	1.2
  +++ SourceResolver.java	15 Oct 2003 18:03:52 -0000	1.3
  @@ -50,11 +50,6 @@
   */
   package org.apache.cocoon.environment;
   
  -import java.io.IOException;
  -
  -import org.apache.cocoon.ProcessingException;
  -import org.xml.sax.SAXException;
  -
   /**
    * Base interface for resolving a source by system identifiers. This 
    * component is a special extension of the Avalon Excalibur 
  @@ -67,15 +62,6 @@
   
   public interface SourceResolver
   extends org.apache.excalibur.source.SourceResolver {
  -
  -    /**
  -     * Resolve the source.
  -     * @param systemID This is either a system identifier
  -     * (<code>java.net.URL</code> or a local file.
  -     * @deprecated Use the resolveURI methods instead
  -     */
  -    Source resolve(String systemID)
  -    throws ProcessingException, SAXException, IOException;
   
   }
   
  
  
  
  1.6       +2 -3      cocoon-2.2/src/java/org/apache/cocoon/environment/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/environment/Environment.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Environment.java	10 Jul 2003 13:17:03 -0000	1.5
  +++ Environment.java	15 Oct 2003 18:03:52 -0000	1.6
  @@ -63,8 +63,7 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Id$
    */
  -public interface Environment
  -    extends SourceResolver {
  +public interface Environment {
   
       /**
        * Get the URI to process. The prefix is stripped off.
  
  
  
  1.15      +20 -8     cocoon-2.2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
  
  Index: TreeProcessor.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TreeProcessor.java	10 Sep 2003 17:42:04 -0000	1.14
  +++ TreeProcessor.java	15 Oct 2003 18:03:52 -0000	1.15
  @@ -85,6 +85,7 @@
   import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
   import org.apache.cocoon.environment.wrapper.MutableEnvironmentFacade;
   import org.apache.excalibur.source.Source;
  +import org.apache.excalibur.source.SourceResolver;
   
   /**
    * Interpreted tree-traversal implementation of a pipeline assembly language.
  @@ -136,7 +137,7 @@
       protected long lastModified = 0;
   
       /** The source of the tree definition */
  -    protected Source source;
  +    protected DelayedRefreshSourceWrapper source;
   
       /** Delay for <code>sourceLastModified</code>. */
       protected long lastModifiedDelay;
  @@ -159,6 +160,9 @@
       /** The component manager for the sitemap */
       protected ComponentManager sitemapComponentManager;
       
  +    /** The source resolver */
  +    protected SourceResolver resolver;
  +    
       /**
        * Create a TreeProcessor.
        */
  @@ -187,7 +191,7 @@
   
           // We have our own CM
           this.manager = manager;
  -
  +        
           // Other fields are setup in initialize()
       }
   
  @@ -217,6 +221,7 @@
   
       public void compose(ComponentManager manager) throws ComponentException {
           this.manager = manager;
  +        this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
       }
   
       public void setRoleManager(RoleManager rm) {
  @@ -250,16 +255,14 @@
   
           // Read the builtin languages definition file
           Configuration builtin;
  -        org.apache.excalibur.source.SourceResolver resolver = null;
           try {
  -            resolver = (org.apache.excalibur.source.SourceResolver)this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE);
  -            org.apache.excalibur.source.Source source = resolver.resolveURI( xconfURL );
  +            Source source = this.resolver.resolveURI( xconfURL );
               try {
                   SAXConfigurationHandler handler = new SAXConfigurationHandler();
                   SourceUtil.toSAX( this.manager, source, null, handler);
                   builtin = handler.getConfiguration();
               } finally {
  -                resolver.release( source );
  +                this.resolver.release( source );
               }
           } catch(Exception e) {
               String msg = "Error while reading " + xconfURL + ": " + e.getMessage();
  @@ -503,7 +506,7 @@
               }
   
               if (this.source == null) {
  -                this.source = new DelayedRefreshSourceWrapper(env.resolveURI(this.fileName),
lastModifiedDelay);
  +                this.source = new DelayedRefreshSourceWrapper(this.resolver.resolveURI(this.fileName),
lastModifiedDelay);
               }
               root = builder.build(this.source);
   
  @@ -530,6 +533,15 @@
           if (this.parent == null) {
               // root processor : dispose the builder selector
               this.builderSelector.dispose();
  +        }
  +        if ( this.manager != null ) {
  +            if ( this.source != null ) {
  +                this.resolver.release(this.source.getSource());
  +                this.source = null;
  +            }
  +            this.manager.release(this.resolver);
  +            this.resolver = null;
  +            this.manager = null;
           }
       }
   
  
  
  
  1.29      +1 -0      cocoon-2.2/build.properties
  
  Index: build.properties
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/build.properties,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- build.properties	15 Oct 2003 09:12:19 -0000	1.28
  +++ build.properties	15 Oct 2003 18:03:52 -0000	1.29
  @@ -16,6 +16,7 @@
   
   # ---- Build Exclusions --------------------------------------------------------
   
  +# Don't set this to false as we currently have no deprecated stuff!
   exclude.deprecated=true
   exclude.javadocs=true
   exclude.idldocs=true
  
  
  
  1.4       +2 -35     cocoon-2.2/src/java/org/apache/cocoon/generation/AbstractServerPage.java
  
  Index: AbstractServerPage.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/generation/AbstractServerPage.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractServerPage.java	19 Mar 2003 15:53:19 -0000	1.3
  +++ AbstractServerPage.java	15 Oct 2003 18:03:53 -0000	1.4
  @@ -54,8 +54,6 @@
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.ComponentException;
   
  -import org.apache.cocoon.caching.CacheValidity;
  -import org.apache.cocoon.caching.Cacheable;
   import org.apache.cocoon.caching.CacheableProcessingComponent;
   import org.apache.cocoon.components.language.generator.CompiledComponent;
   import org.apache.cocoon.environment.Request;
  @@ -78,7 +76,7 @@
    */
   public abstract class AbstractServerPage
     extends ServletGenerator 
  -  implements CompiledComponent, CacheableProcessingComponent, Cacheable, Recomposable {
  +  implements CompiledComponent, CacheableProcessingComponent, Recomposable {
       /**
        * Code generators should produce a constructor
        * block that initializes the generator's
  @@ -231,36 +229,5 @@
           return 0;
       }
   
  -    /**
  -     * Generate the validity object.
  -     *
  -     * @return The generated validity object, <code>NOPCacheValidity</code>
  -     *         is the default if hasContentChange() gives false otherwise
  -     *         <code>null</code> will be returned.
  -     */
  -    public CacheValidity generateValidity() {
  -        if (hasContentChanged(request))
  -            return null;
  -        else
  -            return NOPCacheValidity.CACHE_VALIDITY;
  -    }
  -
   }
   
  -/** 
  - * This is here to avaid references to the deprecated package.
  - * It is required to support the deprecated caching algorithm
  - */
  -final class NOPCacheValidity
  -implements CacheValidity {
  -
  -    public static final CacheValidity CACHE_VALIDITY = new NOPCacheValidity();
  -
  -    public boolean isValid(CacheValidity validity) {
  -        return validity instanceof NOPCacheValidity;
  -    }
  -
  -    public String toString() {
  -        return "NOP Validity";
  -    }
  -}
  \ No newline at end of file
  
  
  
  1.9       +62 -5     cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
  
  Index: AbstractProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractProcessingPipeline.java	24 Sep 2003 21:41:12 -0000	1.8
  +++ AbstractProcessingPipeline.java	15 Oct 2003 18:03:53 -0000	1.9
  @@ -51,6 +51,7 @@
   package org.apache.cocoon.components.pipeline;
   
   import org.apache.avalon.excalibur.pool.Recyclable;
  +import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
  @@ -71,14 +72,18 @@
   import org.apache.cocoon.transformation.Transformer;
   import org.apache.cocoon.xml.XMLConsumer;
   import org.apache.cocoon.xml.XMLProducer;
  +import org.apache.excalibur.source.Source;
  +import org.apache.excalibur.source.SourceResolver;
   import org.apache.excalibur.source.SourceValidity;
   import org.xml.sax.SAXException;
   
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
  +import java.net.MalformedURLException;
   import java.net.SocketException;
   import java.util.ArrayList;
   import java.util.Iterator;
  +import java.util.Map;
   import java.util.NoSuchElementException;
   import java.util.StringTokenizer;
   
  @@ -91,7 +96,7 @@
    */
   public abstract class AbstractProcessingPipeline
     extends AbstractLogEnabled
  -  implements ProcessingPipeline, Parameterizable, Recyclable {
  +  implements ProcessingPipeline, Parameterizable, Recyclable, Disposable {
   
       // Generator stuff
       protected Generator generator;
  @@ -150,6 +155,12 @@
       /** Output Buffer Size */
       protected int  outputBufferSize;
   
  +    /** The source resolver */
  +    protected SourceResolver resolver;
  +    
  +    /** The wrapper passed on the sitemap components */
  +    protected org.apache.cocoon.environment.SourceResolver resolverWrapper;
  +    
       /**
        * Composable Interface
        */
  @@ -157,6 +168,8 @@
       throws ComponentException {
           this.manager = manager;
           this.newManager = manager;
  +        this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
  +        this.resolverWrapper = new SourceResolverWrapper(this.resolver);
       }
   
       /**
  @@ -379,7 +392,7 @@
           try {
               // setup the generator
               this.generator.setup(
  -                environment,
  +                this.resolverWrapper,
                   environment.getObjectModel(),
                   generatorSource,
                   generatorParam
  @@ -392,7 +405,7 @@
               while ( transformerItt.hasNext() ) {
                   Transformer trans = (Transformer)transformerItt.next();
                   trans.setup(
  -                    environment,
  +                    this.resolverWrapper,
                       environment.getObjectModel(),
                       (String)transformerSourceItt.next(),
                       (Parameters)transformerParamItt.next()
  @@ -563,7 +576,7 @@
       throws ProcessingException {
           try {
               String mimeType;
  -            this.reader.setup(environment,environment.getObjectModel(),readerSource,readerParam);
  +            this.reader.setup(this.resolverWrapper,environment.getObjectModel(),readerSource,readerParam);
               mimeType = this.reader.getMimeType();
               if ( mimeType != null ) {
                   environment.setContentType(mimeType);
  @@ -771,6 +784,50 @@
        */
       public String getKeyForEventPipeline() {
           return null;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.avalon.framework.activity.Disposable#dispose()
  +     */
  +    public void dispose() {
  +        if ( this.manager != null ) {
  +            this.manager.release(this.resolver);
  +            this.resolver = null;
  +            this.manager = null;
  +        }
  +    }
  +
  +}
  +
  +final class SourceResolverWrapper
  +implements org.apache.cocoon.environment.SourceResolver {
  +    
  +    protected SourceResolver resolver;
  +    
  +    public SourceResolverWrapper(SourceResolver resolver) {
  +        this.resolver = resolver;
  +    }
  +    /* (non-Javadoc)
  +     * @see org.apache.excalibur.source.SourceResolver#release(org.apache.excalibur.source.Source)
  +     */
  +    public void release(Source source) {
  +        this.resolver.release(source);
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.excalibur.source.SourceResolver#resolveURI(java.lang.String, java.lang.String,
java.util.Map)
  +     */
  +    public Source resolveURI(String arg0, String arg1, Map arg2)
  +    throws MalformedURLException, IOException {
  +        return this.resolveURI(arg0, arg1, arg2);
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.excalibur.source.SourceResolver#resolveURI(java.lang.String)
  +     */
  +    public Source resolveURI(String arg0)
  +    throws MalformedURLException, IOException {
  +        return this.resolver.resolveURI(arg0);
       }
   
   }
  
  
  
  1.15      +10 -59    cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java
  
  Index: AbstractCachingProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/impl/AbstractCachingProcessingPipeline.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractCachingProcessingPipeline.java	24 Sep 2003 21:41:11 -0000	1.14
  +++ AbstractCachingProcessingPipeline.java	15 Oct 2003 18:03:53 -0000	1.15
  @@ -116,10 +116,6 @@
       /** Cache complete response */
       protected boolean cacheCompleteResponse;
   
  -    protected boolean   generatorIsCacheableProcessingComponent;
  -    protected boolean   serializerIsCacheableProcessingComponent;
  -    protected boolean[] transformerIsCacheableProcessingComponent;
  -
       /** Smart caching ? */
       protected boolean doSmartCaching;
       /** Default setting for smart caching */
  @@ -306,9 +302,6 @@
           this.toCacheKey = null;
   
           Serializable key = null;
  -        this.generatorIsCacheableProcessingComponent = false;
  -        this.serializerIsCacheableProcessingComponent = false;
  -        this.transformerIsCacheableProcessingComponent = new boolean[this.transformers.size()];
   
           this.firstNotCacheableTransformerIndex = 0;
           this.cacheCompleteResponse = false;
  @@ -322,9 +315,6 @@
           // is the generator cacheable?
           if (super.generator instanceof CacheableProcessingComponent) {
               key = ((CacheableProcessingComponent)super.generator).getKey();
  -            this.generatorIsCacheableProcessingComponent = true;
  -        } else if (super.generator instanceof Cacheable) {
  -            key = new Long(((Cacheable)super.generator).generateKey());
           }
   
           if (key != null) {
  @@ -345,9 +335,6 @@
                   key = null;
                   if (trans instanceof CacheableProcessingComponent) {
                       key = ((CacheableProcessingComponent)trans).getKey();
  -                    this.transformerIsCacheableProcessingComponent[this.firstNotCacheableTransformerIndex]
= true;
  -                } else if (trans instanceof Cacheable) {
  -                    key = new Long(((Cacheable)trans).generateKey());
                   }
                   if (key != null) {
                       this.toCacheKey.addKey(this.newComponentCacheKey(ComponentCacheKey.ComponentType_Transformer,
  @@ -367,9 +354,6 @@
                   key = null;
                   if (super.serializer instanceof CacheableProcessingComponent) {
                       key = ((CacheableProcessingComponent)this.serializer).getKey();
  -                    this.serializerIsCacheableProcessingComponent = true;
  -                } else if (this.serializer instanceof Cacheable) {
  -                    key = new Long(((Cacheable)this.serializer).generateKey());
                   }
                   if (key != null) {
                       this.toCacheKey.addKey(this.newComponentCacheKey(ComponentCacheKey.ComponentType_Serializer,
  @@ -691,12 +675,8 @@
   
               // test if reader is cacheable
               Serializable readerKey = null;
  -            boolean isCacheableProcessingComponent = false;
               if (super.reader instanceof CacheableProcessingComponent) {
                   readerKey = ((CacheableProcessingComponent)super.reader).getKey();
  -                isCacheableProcessingComponent = true;
  -            } else if (super.reader instanceof Cacheable) {
  -                readerKey = new Long(((Cacheable)super.reader).generateKey());
               }
   
               if ( readerKey != null) {
  @@ -734,14 +714,8 @@
                           boolean valid = false;
                           if ( result == 0 ) {
                               // get reader validity and compare
  -                            if (isCacheableProcessingComponent) {
  -                                readerValidity = ((CacheableProcessingComponent)super.reader).getValidity();
  -                            } else {
  -                                CacheValidity cv = ((Cacheable)super.reader).generateValidity();
  -                                if ( cv != null ) {
  -                                    readerValidity = CacheValidityToSourceValidity.createValidity(
cv );
  -                                }
  -                            }
  +                            readerValidity = ((CacheableProcessingComponent)super.reader).getValidity();
  +
                               if (readerValidity != null) {
                                   result = cachedValidity.isValid(readerValidity);
                                   if ( result == 0 ) {
  @@ -783,14 +757,7 @@
                           this.getLogger().debug("processReader: caching content for further
requests of '" + environment.getURI() + "'.");
                       }
                       if (readerValidity == null) {
  -                        if (isCacheableProcessingComponent) {
  -                            readerValidity = ((CacheableProcessingComponent)super.reader).getValidity();
  -                        } else {
  -                            CacheValidity cv = ((Cacheable)super.reader).generateValidity();
  -                            if ( cv != null ) {
  -                                readerValidity = CacheValidityToSourceValidity.createValidity(
cv );
  -                            }
  -                        }
  +                        readerValidity = ((CacheableProcessingComponent)super.reader).getValidity();
                       }
                       if (readerValidity != null) {
                           outputStream = environment.getOutputStream(this.outputBufferSize);
  @@ -906,32 +873,17 @@
   
           if (index == 0) {
               // test generator
  -            if (this.generatorIsCacheableProcessingComponent) {
  -                validity = ((CacheableProcessingComponent)super.generator).getValidity();
  -                if(debug) msg += "generator: using getValidity";
  -            } else {
  -                validity = CacheValidityToSourceValidity.createValidity(((Cacheable)super.generator).generateValidity());
  -                if(debug) msg += "generator: using generateValidity";
  -            }
  +            validity = ((CacheableProcessingComponent)super.generator).getValidity();
  +            if(debug) msg += "generator: using getValidity";
           } else if (index <= firstNotCacheableTransformerIndex) {
               // test transformer
               final Transformer trans = (Transformer)super.transformers.get(index-1);
  -            if (this.transformerIsCacheableProcessingComponent[index-1]) {
  -                validity = ((CacheableProcessingComponent)trans).getValidity();
  -                if(debug) msg += "transformer: using getValidity";
  -            } else {
  -                validity = CacheValidityToSourceValidity.createValidity(((Cacheable)trans).generateValidity());
  -                if(debug) msg += "transformer: using generateValidity";
  -            }
  +            validity = ((CacheableProcessingComponent)trans).getValidity();
  +            if(debug) msg += "transformer: using getValidity";
           } else {
               // test serializer
  -            if (this.serializerIsCacheableProcessingComponent) {
  -                validity = ((CacheableProcessingComponent)super.serializer).getValidity();
  -                if(debug) msg += "serializer: using getValidity";
  -            } else {
  -                validity = CacheValidityToSourceValidity.createValidity(((Cacheable)super.serializer).generateValidity());
  -                if(debug) msg += "serializer: using generateValidity";
  -            }
  +            validity = ((CacheableProcessingComponent)super.serializer).getValidity();
  +            if(debug) msg += "serializer: using getValidity";
           }
   
           if(debug) {
  @@ -954,7 +906,6 @@
           this.fromCacheKey = null;
           this.cachedResponse = null;
           
  -        this.transformerIsCacheableProcessingComponent = null;
           this.toCacheKey = null;
           this.toCacheSourceValidities = null;
   
  
  
  

Mime
View raw message