cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: AW: [C2]: Proposal for caching
Date Thu, 25 Jan 2001 13:19:31 GMT
Carsten Ziegeler wrote:

> OK, now I get what you meant. I think it is really a good idea. It would
> lead to a repository of possible, configurable validators (equivalent
> to the repository of generators, transformers etc.) and the sitemap
> designer chooses the right validator for the component.
> But it is not possible to write validators which are usable for any
> component as only the component knows which data to test. So you
> have a tight coupling between a component and its validators.

If there is a tight coupling between validators, then we need to look at
coupling them.  More down below.

> Quickly thinking I see a possible solution:
> Each component declares his own usable validators which can only be used
> with this component:
> 
> <map:generators>
>     <map:generator label="content" name="file" src="org.apache.cocoon.generation.FileGenerator">
>         <map:validators>
>            <map:validator name="fileChangedValidator" class ="org.apache.cocoon.validation.FileChangedValidator"/>
>            ....
>         </map:validators>
>     </map:generator>
> <map:generators>
> ...
>    <map:match="test">
>      <map:generate src="http://myserver/resource.xml"
>           type="http"
>            validator="fileChangedValidator">
>      </map:generate>
>       ...
>    </map:match>
> 
> What do you think about this?

I think that modifying the sitemap like this only serves to make
things more confusing or at least cluttered.  I understand the
idea of swapping Validators, but I think that might be flexibility
syndrome.  How many ways is a FileGenerator going to invalidate
a cache entry for a File?  I do think they should be external
components, but I also think that they should be hard-wired to
the Component.

FileGenerator {
   Validator validator = new FileChangedValidator();

   ......
 
   generate() {
      if (validator.hasChanged(file) {
          // normal processing
      } else {
          // retrieve from cache.
      }
   }
}

Mime
View raw message