cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Gallardo <>
Subject Re: SourceValidity
Date Sat, 13 Aug 2005 06:02:14 GMT
Ivan Bogouchev / Иван Богушев wrote:

> Hi all,
> I have implemented the interface 
> org.apache.excalibur.source.SourceValidity in a class and actually
> only the no argument isValid() method gets called.
> What is the intent of the method SourceValidity.isValid(SourceValidity 
> arg0)

 From excalibur javadocs (unfortunately this javadocs are not avaliable 

A SourceValidity object contains all information to check if a Source 
object is still valid.

There are two possibilities:

* The validity object has all information to check by itself if it is 
valid (e.g. given an expires date).
* The validity object possibility needs another (newer) validity object 
to compare against (e.g. to test a last modification date).

To avoid testing what the actual implementation of the validity object 
supports, the invocation order is to first call isValid() and only if 
this result is 0 (i.e. "don't know"), then to call isValid(SourceValidity).

Remember to call isValid(SourceValidity) when isValid() returned 0 !

Method Detail
public int isValid()

Check if the component is still valid. The possible results are :
-1: invalid. The component isn't valid anymore.
0: don't know. This validity should be checked against a new validity 
object using isValid(SourceValidity).
1: valid. The component is still valid.

public int isValid(SourceValidity newValidity)
Check if the component is still valid. This is only true if the incoming 
Validity is of the same type and has the "same" values.
The invocation order is that the isValid method of the old Validity 
object is called with the new one as a parameter.
-1 is returned, if the validity object is not valid anymore +1 is 
returned, if the validity object is still valid 0 is returned, if the 
validity check could not be performed. In this case, the new validity 
object is not usable. Examples for this are: when the validity objects 
have different types, or when one validity object for any reason is not 
able to get the required information.

Hope this helps,

Best Regards,

Antonio Gallardo.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message