You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2004/11/06 21:04:00 UTC

DO NOT REPLY [Bug 32095] New: - Cache Event invalidation not working with non sitemap components

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32095>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32095

Cache Event invalidation not working with non sitemap components

           Summary: Cache Event invalidation not working with non sitemap
                    components
           Product: Cocoon 2
           Version: 2.1.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: general components
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: oscgoogle@yahoo.com


A cocoon protocole source used in a non sitemap component is not refreshed after
having been invalidated by a NamedEvent.

TEST CONFIGURATION:

-- cocoon.xconf --
<component-instance
class="org.apache.cocoon.components.modules.input.XMLFileModule" logger="test"
name="testxml">
  <file src="cocoon://test/test"/>
  <reloadable>true</reloadable>
  <cacheable>true</cacheable>
</component-instance>


-- sitemap.xmap --
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <map:components>
    <map:actions>
      <map:action name="cache-event-action" logger="test"
src="org.apache.cocoon.acting.CacheEventAction"/>
    </map:actions>
    <map:pipes default="caching">
      <map:pipe logger="test" name="event-aware"
src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline">
        <parameter name="cache-role"
value="org.apache.cocoon.caching.Cache/EventAware"/>
      </map:pipe>
    </map:pipes>
  </map:components>

  <map:pipelines>

    <map:pipeline type="event-aware">

      <map:match pattern="test">
        <map:generate type="serverpages" src="test.xsp"/>
        <map:serialize type="xml"/>
      </map:match>

      <map:match pattern="result">
        <map:generate type="serverpages" src="result.xsp">
	  <map:parameter name="result" value="{testxml:/test}"/>
        </map:generate>
        <map:serialize type="xml"/>
      </map:match>

      <map:match pattern="invalidate-works">
        <map:act type="cache-event">
          <map:parameter name="event" value="test-event"/>
	  <map:redirect-to uri="cocoon:/test"/>
        </map:act>
      </map:match>

      <map:match pattern="invalidate-not-working">
        <map:act type="cache-event">
          <map:parameter name="event" value="test-event"/>
	  <map:redirect-to uri="cocoon:/result"/>
        </map:act>
      </map:match>

    </map:pipeline>

  </map:pipelines>
</map:sitemap>


-- test.xsp --
<?xml version="1.0"?>
<xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp"
	  >

  <xsp:structure>
    <xsp:include>org.apache.excalibur.source.SourceValidity</xsp:include>
    <xsp:include>org.apache.cocoon.caching.validity.EventValidity</xsp:include>
    <xsp:include>org.apache.cocoon.caching.validity.NamedEvent</xsp:include>
  </xsp:structure>

  <xsp:logic>
    public SourceValidity getValidity() {
      return new EventValidity(new NamedEvent("test-event"));
    }
  </xsp:logic>

  <test>some value</test>

</xsp:page>

-- result.xsp
<?xml version="1.0"?>
<xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp"
	  >

  <result><xsp:expr>parameters.getParameter("result", null)</xsp:expr></result>

</xsp:page>


TEST:

Step 1:
http://localhost//test/invalidate-not-working
==> <result>some value</result>
(expected result)

Step 2:
http://localhost//test/invalidate-works
==> <result>some value</result>
(expected result)

Step 3:
In test.xsp change 'some value' to 'a new value'

Step 4:
http://localhost//test/invalidate-not-working
==> <result>some value</result>
The expected result should be : <result>a new value</result> 

Step 5:
http://localhost//test/invalidate-works
==> <result>a new value</result>
(expected result)

NOTES:
- Step 5 shows that the invalidation was done properly. It just happens that the
XMLFileModule component considers its source as still valid.
- If instead of an EventValidity I use a FileStampValidity everything works as
expected. It strongly suggests that the non expected result in Step 4 it not due
to the XMLFileModule configuration but rather to the Validity that is used in
test.xsp.
- I have noticed that EventValidity.isValid() always returns SourceValidity.VALID.
- If it is something difficult to solve, any workaround?