Enable caching of IncludeTransformer if not all includes could be resolved
--------------------------------------------------------------------------

                 Key: COCOON-2166
                 URL: https://issues.apache.org/jira/browse/COCOON-2166
             Project: Cocoon
          Issue Type: Improvement
          Components: * Cocoon Core
    Affects Versions: 2.1.12-dev (Current SVN)
            Reporter: Andreas Hartmann


About the context: In Lenya, we have a couple of modules, which are basically 
directories. A module directory can include an optional menu.xml file. The 
Lenya GUI menubar is an aggregation of all these menu.xml files, with some 
postprocessing. The same mechanism is used for the i18n catalogue - modules can 
provide i18n catalogues for their GUIs.

We use the IncludeTransformer to assemble the menu XML, ignoring the 
non-existing menus using <i:fallback/>. It looks basically like this:

  <xsl:forEach select="lenya:module">
    <i:include src="cocoon:/menu-xml/module/[EMAIL PROTECTED]">
      <i:fallback/>
    </i:include>
  </xsl:forEach>


This is extremely fast if all modules contain menu.xml files, because the 
aggregated XML is cached. But if some of the includes can't be resolved, 
nothing is cached. This causes up to 50% more request processing time, so it 
has quite a big impact on the Lenya GUI performance :)

I tracked the source of the behaviour down to the MultiSourceValidity class. As 
soon as one of the sources has no validity (IIUC this happens if a FileSource 
doesn't exist), the whole MultiSourceValidity becomes invalid:

  public void addSource(Source src) {
      if (this.uris != null) {
          SourceValidity validity = src.getValidity();
          if (validity == null) {
              /* The source has no validity: this will be
                 always be invalid. */
              this.uris = null;


>From my POV it would be better to ignore the non-existing sources, and check 
>their existence when the validity is computed the next time. I.e. 
>MultiSourceValidity.isValid() would return UNKNOWN, and isValid(newValidity) 
>-> computeStatus() would check if newValidity provides a validity for the 
>formerly missing source.

Do you think this behaviour would be reasonable? If yes, I'd try to implement 
it, preferrably with test cases to avoid regressions. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to