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





------- Additional Comments From [EMAIL PROTECTED]  2004-11-10 04:09 -------
Your right. XMLFileModule doesn't check properly the validity.

However, I actually discovered the problem while writting my own custom action
an invoking the EventValidity.isValid() which always returns VALID even if the
the cache has been invalidated.

So we have two problems: XMLFileModule that doesn't check the SourceValidity the
right way and EventValidity which doesn't respect the contract of 
SourceValidity.

My action was something like this;

  private SourceValidity validity;
  private Object someCostlyComputedValue;

  public Map act(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters parameters) {

   Source source = resolver.resolveURI(src);
   SourceValidity newValidity = source.getValidity();   

   if(this.validity == null || this.validity.isValid() == 
SourceValidity.INVALID || 
      (this.validity.isValid() == SourceValidity.UNKNOWN &&
this.validity.isValid(newValidity) !=  SourceValidity.VALID))
   {
     someCostlyComputedValue = someComputationOn(source); // Use the 'refreshed'
source
     this.validity = newValidity;
   }

   Map map = new HashMap();
   map.put("value", someCostlyComputedValue);
   return map;
}

And it didn't work even if the validity is used properly, because EventValidity
doesn't respect the SourceValidity contract.

As a client of EventValidity, I am, for now, more interested in being sure that
it respects the SourceValidity contract rather than solving the XMLFileModule
problem. I think the responsibility of EventValididity is to work as expected
when it is properly used by a client.

I have thought of some possible solutions that would imply some minor changes to
EventValidity, EventAwareCacheImpl and EventRegistry.

But first, do you agree that the EventValidity should respect the contract of
SourceValidity?

Reply via email to