1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.struts.flow.core.source;
18
19 import java.io.Serializable;
20
21 /***
22 * A <code>SourceValidity</code> object contains all information to check if a Source
23 * object is still valid.
24 * <p>
25 * There are two possibilities:
26 * <ul>
27 * <li>The validity object has all information to check by itself if it is valid
28 * (e.g. given an expires date).</li>
29 * <li>The validity object possibility needs another (newer) validity object to compare
30 * against (e.g. to test a last modification date).</li>
31 * </ul>
32 * To avoid testing what the actual implementation of the validity object supports,
33 * the invocation order is to first call {@link #isValid()} and only if this result
34 * is <code>0</code> (i.e. "don't know"), then to call {@link #isValid(SourceValidity)}.
35 * <p>
36 * Remember to call {@link #isValid(SourceValidity)} when {@link #isValid()} returned
37 * <code>0</code> !
38 *
39 * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
40 * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:26 $
41 */
42 public interface SourceValidity
43 extends Serializable
44 {
45 final int VALID = +1;
46 final int INVALID = -1;
47 /*** @deprecated because it has been misspelled, use UNKNOWN of course */
48 final int UNKNWON = 0;
49 final int UNKNOWN = 0;
50
51 /***
52 * Check if the component is still valid. The possible results are :
53 * <ul>
54 * <li><code>-1</code>: invalid. The component isn't valid anymore.</li>
55 * <li><code>0</code>: don't know. This validity should be checked against a new
56 * validity object using {@link #isValid(SourceValidity)}.</li>
57 * <li><code>1</code>: valid. The component is still valid.</li>
58 * </ul>
59 */
60 int isValid();
61
62 /***
63 * Check if the component is still valid. This is only true if the incoming Validity
64 * is of the same type and has the "same" values.
65 * <p>
66 * The invocation order is that the isValid
67 * method of the old Validity object is called with the new one as a
68 * parameter.
69 * @return -1 is returned, if the validity object is not valid anymore
70 * +1 is returned, if the validity object is still valid
71 * 0 is returned, if the validity check could not be performed.
72 * In this case, the new validity object is not usable. Examples
73 * for this are: when the validity objects have different types,
74 * or when one validity object for any reason is not able to
75 * get the required information.
76 */
77 int isValid( SourceValidity newValidity );
78 }